1 /* 2 * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 /* 27 * Motif-specific data structures for AWT Java objects. 28 * 29 */ 30 #ifndef _AWT_P_H_ 31 #define _AWT_P_H_ 32 33 /* turn on to do event filtering */ 34 #define NEW_EVENT_MODEL 35 /* turn on to only filter keyboard events */ 36 #define KEYBOARD_ONLY_EVENTS 37 38 #include <stdarg.h> 39 #include <stdio.h> 40 #include <stdlib.h> 41 #include <string.h> 42 #include <unistd.h> 43 #ifndef HEADLESS 44 #include <X11/Intrinsic.h> 45 #include <X11/IntrinsicP.h> 46 #include <X11/Shell.h> 47 #include <X11/StringDefs.h> 48 #include <X11/Xatom.h> 49 #include <X11/keysym.h> 50 #include <X11/keysymdef.h> 51 #include <X11/extensions/Xrender.h> 52 #endif /* !HEADLESS */ 53 #include "awt.h" 54 #include "awt_util.h" 55 #include "color.h" 56 #include "colordata.h" 57 #include "gdefs.h" 58 59 #ifndef HEADLESS 60 #ifndef min 61 #define min(a,b) ((a) <= (b)? (a):(b)) 62 #endif 63 #ifndef max 64 #define max(a,b) ((a) >= (b)? (a):(b)) 65 #endif 66 #endif /* !HEADLESS */ 67 68 #define RepaintPending_NONE 0 69 #define RepaintPending_REPAINT (1 << 0) 70 #define RepaintPending_EXPOSE (1 << 1) 71 #define LOOKUPSIZE 32 72 73 #ifndef HEADLESS 74 75 typedef XRenderPictFormat * 76 XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual); 77 78 typedef struct _AwtGraphicsConfigData { 79 int awt_depth; 80 Colormap awt_cmap; 81 XVisualInfo awt_visInfo; 82 int awt_num_colors; 83 awtImageData *awtImage; 84 int (*AwtColorMatch)(int, int, int, 85 struct _AwtGraphicsConfigData *); 86 XImage *monoImage; 87 Pixmap monoPixmap; /* Used in X11TextRenderer_md.c */ 88 int monoPixmapWidth; /* Used in X11TextRenderer_md.c */ 89 int monoPixmapHeight;/* Used in X11TextRenderer_md.c */ 90 GC monoPixmapGC; /* Used in X11TextRenderer_md.c */ 91 int pixelStride; /* Used in X11SurfaceData.c */ 92 ColorData *color_data; 93 struct _GLXGraphicsConfigInfo *glxInfo; 94 int isTranslucencySupported; /* Uses Xrender to find this out. */ 95 XRenderPictFormat renderPictFormat; /*Used only if translucency supported*/ 96 } AwtGraphicsConfigData; 97 98 typedef AwtGraphicsConfigData* AwtGraphicsConfigDataPtr; 99 100 typedef struct _AwtScreenData { 101 int numConfigs; 102 Window root; 103 unsigned long whitepixel; 104 unsigned long blackpixel; 105 AwtGraphicsConfigDataPtr defaultConfig; 106 AwtGraphicsConfigDataPtr *configs; 107 } AwtScreenData; 108 109 typedef AwtScreenData* AwtScreenDataPtr; 110 111 #define W_GRAVITY_INITIALIZED 1 112 #define W_IS_EMBEDDED 2 113 114 typedef struct awtFontList { 115 char *xlfd; 116 int index_length; 117 int load; 118 char *charset_name; 119 XFontStruct *xfont; 120 } awtFontList; 121 122 struct FontData { 123 int charset_num; 124 awtFontList *flist; 125 XFontSet xfs; /* for TextField & TextArea */ 126 XFontStruct *xfont; /* Latin1 font */ 127 }; 128 129 extern struct FontData *awtJNI_GetFontData(JNIEnv *env,jobject font, char **errmsg); 130 131 extern AwtGraphicsConfigDataPtr getDefaultConfig(int screen); 132 extern AwtScreenDataPtr getScreenData(int screen); 133 #endif /* !HEADLESS */ 134 135 /* allocated and initialize a structure */ 136 #define ZALLOC(T) ((struct T *)calloc(1, sizeof(struct T))) 137 138 #ifndef HEADLESS 139 #define XDISPLAY awt_display; 140 141 extern int awt_allocate_colors(AwtGraphicsConfigDataPtr); 142 extern void awt_allocate_systemcolors(XColor *, int, AwtGraphicsConfigDataPtr); 143 extern void awt_allocate_systemrgbcolors(jint *, int, AwtGraphicsConfigDataPtr); 144 145 extern int awtJNI_GetColor(JNIEnv *, jobject); 146 extern int awtJNI_GetColorForVis (JNIEnv *, jobject, AwtGraphicsConfigDataPtr); 147 extern jobject awtJNI_GetColorModel(JNIEnv *, AwtGraphicsConfigDataPtr); 148 extern void awtJNI_CreateColorData (JNIEnv *, AwtGraphicsConfigDataPtr, int lock); 149 150 #endif /* !HEADLESS */ 151 #endif /* _AWT_P_H_ */