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/extensions/Xrender.h> 45 #endif /* !HEADLESS */ 46 #include "awt.h" 47 #include "awt_util.h" 48 #include "color.h" 49 #include "colordata.h" 50 #include "gdefs.h" 51 52 #ifndef HEADLESS 53 #ifndef min 54 #define min(a,b) ((a) <= (b)? (a):(b)) 55 #endif 56 #ifndef max 57 #define max(a,b) ((a) >= (b)? (a):(b)) 58 #endif 59 #endif /* !HEADLESS */ 60 61 #define RepaintPending_NONE 0 62 #define RepaintPending_REPAINT (1 << 0) 63 #define RepaintPending_EXPOSE (1 << 1) 64 #define LOOKUPSIZE 32 65 66 #ifndef HEADLESS 67 68 typedef XRenderPictFormat * 69 XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual); 70 71 typedef struct _AwtGraphicsConfigData { 72 int awt_depth; 73 Colormap awt_cmap; 74 XVisualInfo awt_visInfo; 75 int awt_num_colors; 76 awtImageData *awtImage; 77 int (*AwtColorMatch)(int, int, int, 78 struct _AwtGraphicsConfigData *); 79 XImage *monoImage; 80 Pixmap monoPixmap; /* Used in X11TextRenderer_md.c */ 81 int monoPixmapWidth; /* Used in X11TextRenderer_md.c */ 82 int monoPixmapHeight;/* Used in X11TextRenderer_md.c */ 83 GC monoPixmapGC; /* Used in X11TextRenderer_md.c */ 84 int pixelStride; /* Used in X11SurfaceData.c */ 85 ColorData *color_data; 86 struct _GLXGraphicsConfigInfo *glxInfo; 87 int isTranslucencySupported; /* Uses Xrender to find this out. */ 88 XRenderPictFormat renderPictFormat; /*Used only if translucency supported*/ 89 } AwtGraphicsConfigData; 90 91 typedef AwtGraphicsConfigData* AwtGraphicsConfigDataPtr; 92 93 typedef struct _AwtScreenData { 94 int numConfigs; 95 Window root; 96 unsigned long whitepixel; 97 unsigned long blackpixel; 98 AwtGraphicsConfigDataPtr defaultConfig; 99 AwtGraphicsConfigDataPtr *configs; 100 } AwtScreenData; 101 102 typedef AwtScreenData* AwtScreenDataPtr; 103 104 #define W_GRAVITY_INITIALIZED 1 105 #define W_IS_EMBEDDED 2 106 107 typedef struct awtFontList { 108 char *xlfd; 109 int index_length; 110 int load; 111 char *charset_name; 112 XFontStruct *xfont; 113 } awtFontList; 114 115 struct FontData { 116 int charset_num; 117 awtFontList *flist; 118 XFontSet xfs; /* for TextField & TextArea */ 119 XFontStruct *xfont; /* Latin1 font */ 120 }; 121 122 extern struct FontData *awtJNI_GetFontData(JNIEnv *env,jobject font, char **errmsg); 123 124 extern AwtGraphicsConfigDataPtr getDefaultConfig(int screen); 125 extern AwtScreenDataPtr getScreenData(int screen); 126 #endif /* !HEADLESS */ 127 128 /* allocated and initialize a structure */ 129 #define ZALLOC(T) ((struct T *)calloc(1, sizeof(struct T))) 130 131 #ifndef HEADLESS 132 #define XDISPLAY awt_display; 133 134 extern int awt_allocate_colors(AwtGraphicsConfigDataPtr); 135 extern void awt_allocate_systemcolors(XColor *, int, AwtGraphicsConfigDataPtr); 136 extern void awt_allocate_systemrgbcolors(jint *, int, AwtGraphicsConfigDataPtr); 137 138 extern int awtJNI_GetColor(JNIEnv *, jobject); 139 extern int awtJNI_GetColorForVis (JNIEnv *, jobject, AwtGraphicsConfigDataPtr); 140 extern jobject awtJNI_GetColorModel(JNIEnv *, AwtGraphicsConfigDataPtr); 141 extern void awtJNI_CreateColorData (JNIEnv *, AwtGraphicsConfigDataPtr, int lock); 142 143 #endif /* !HEADLESS */ 144 #endif /* _AWT_P_H_ */