author | anthony |
Wed, 06 May 2009 20:06:23 +0400 | |
changeset 2760 | f038acdbdf9c |
parent 2758 | d2fbe9b5857a |
child 2807 | db01a7f6d657 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2451 | 2 |
* Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved. |
2 | 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. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any 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 |
#ifndef XAWT |
|
52 |
#include <Xm/CascadeB.h> |
|
53 |
#include <Xm/DrawingA.h> |
|
54 |
#include <Xm/FileSB.h> |
|
55 |
#include <Xm/BulletinB.h> |
|
56 |
#include <Xm/Form.h> |
|
57 |
#include <Xm/Frame.h> |
|
58 |
#include <Xm/Label.h> |
|
59 |
#include <Xm/PushB.h> |
|
60 |
#include <Xm/PushBG.h> |
|
61 |
#include <Xm/RowColumn.h> |
|
62 |
#include <Xm/ScrollBar.h> |
|
63 |
#include <Xm/ScrolledW.h> |
|
64 |
#include <Xm/SelectioB.h> |
|
65 |
#include <Xm/SeparatoG.h> |
|
66 |
#include <Xm/ToggleB.h> |
|
67 |
#include <Xm/TextF.h> |
|
68 |
#include <Xm/Text.h> |
|
69 |
#include <Xm/List.h> |
|
70 |
#include <Xm/Xm.h> |
|
71 |
#include <Xm/MainW.h> |
|
72 |
#endif |
|
73 |
#endif /* !HEADLESS */ |
|
74 |
#include "awt.h" |
|
75 |
#include "awt_util.h" |
|
76 |
#include "color.h" |
|
77 |
#include "colordata.h" |
|
78 |
#include "gdefs.h" |
|
79 |
||
80 |
#ifndef XAWT |
|
81 |
#include "GLXGraphicsConfig.h" |
|
1175
026b52c440fe
6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents:
2
diff
changeset
|
82 |
//#include <sun_awt_motif_MComponentPeer.h> |
2 | 83 |
#endif |
84 |
||
85 |
#ifndef HEADLESS |
|
86 |
#ifndef XAWT |
|
87 |
#include "awt_motif.h" |
|
88 |
#endif |
|
89 |
#ifndef min |
|
90 |
#define min(a,b) ((a) <= (b)? (a):(b)) |
|
91 |
#endif |
|
92 |
#ifndef max |
|
93 |
#define max(a,b) ((a) >= (b)? (a):(b)) |
|
94 |
#endif |
|
95 |
||
96 |
extern Pixel awt_pixel_by_name(Display *dpy, char *color, char *defaultColor); |
|
97 |
||
98 |
typedef struct DropSiteInfo* DropSitePtr; |
|
99 |
||
100 |
struct WidgetInfo { |
|
101 |
Widget widget; |
|
102 |
Widget origin; |
|
103 |
void* peer; |
|
104 |
jlong event_mask; |
|
105 |
struct WidgetInfo* next; |
|
106 |
}; |
|
107 |
#endif /* !HEADLESS */ |
|
108 |
||
109 |
#define RepaintPending_NONE 0 |
|
110 |
#define RepaintPending_REPAINT (1 << 0) |
|
111 |
#define RepaintPending_EXPOSE (1 << 1) |
|
112 |
#define LOOKUPSIZE 32 |
|
113 |
||
114 |
typedef struct _DamageRect { |
|
115 |
int x1; |
|
116 |
int y1; |
|
117 |
int x2; |
|
118 |
int y2; |
|
119 |
} DamageRect; |
|
120 |
||
121 |
#ifndef HEADLESS |
|
122 |
typedef struct _AwtGraphicsConfigData { |
|
123 |
int awt_depth; |
|
124 |
Colormap awt_cmap; |
|
125 |
XVisualInfo awt_visInfo; |
|
126 |
int awt_num_colors; |
|
127 |
awtImageData *awtImage; |
|
128 |
int (*AwtColorMatch)(int, int, int, |
|
129 |
struct _AwtGraphicsConfigData *); |
|
130 |
XImage *monoImage; |
|
131 |
Pixmap monoPixmap; /* Used in X11TextRenderer_md.c */ |
|
132 |
int monoPixmapWidth; /* Used in X11TextRenderer_md.c */ |
|
133 |
int monoPixmapHeight;/* Used in X11TextRenderer_md.c */ |
|
134 |
GC monoPixmapGC; /* Used in X11TextRenderer_md.c */ |
|
135 |
int pixelStride; /* Used in X11SurfaceData.c */ |
|
136 |
ColorData *color_data; |
|
137 |
struct _GLXGraphicsConfigInfo *glxInfo; |
|
2451 | 138 |
int isTranslucencySupported; /* Uses Xrender to find this out. */ |
2 | 139 |
} AwtGraphicsConfigData; |
140 |
||
141 |
typedef AwtGraphicsConfigData* AwtGraphicsConfigDataPtr; |
|
142 |
||
143 |
typedef struct _AwtScreenData { |
|
144 |
int numConfigs; |
|
145 |
Window root; |
|
146 |
unsigned long whitepixel; |
|
147 |
unsigned long blackpixel; |
|
148 |
AwtGraphicsConfigDataPtr defaultConfig; |
|
149 |
AwtGraphicsConfigDataPtr *configs; |
|
150 |
} AwtScreenData; |
|
151 |
||
152 |
typedef AwtScreenData* AwtScreenDataPtr; |
|
153 |
||
154 |
struct ComponentData { |
|
155 |
Widget widget; |
|
156 |
int repaintPending; |
|
157 |
DamageRect repaintRect; |
|
158 |
DamageRect exposeRect; |
|
159 |
DropSitePtr dsi; |
|
160 |
}; |
|
161 |
||
162 |
struct MessageDialogData { |
|
163 |
struct ComponentData comp; |
|
164 |
int isModal; |
|
165 |
}; |
|
166 |
||
167 |
struct CanvasData { |
|
168 |
struct ComponentData comp; |
|
169 |
Widget shell; |
|
170 |
int flags; |
|
171 |
}; |
|
172 |
||
173 |
struct MenuItemData { |
|
174 |
struct ComponentData comp; |
|
175 |
int index; |
|
176 |
}; |
|
177 |
||
178 |
struct MenuData { |
|
179 |
struct ComponentData comp; |
|
180 |
struct MenuItemData itemData; |
|
181 |
}; |
|
182 |
||
183 |
||
184 |
#define W_GRAVITY_INITIALIZED 1 |
|
185 |
#define W_IS_EMBEDDED 2 |
|
186 |
||
187 |
struct FrameData { |
|
188 |
struct CanvasData winData; |
|
189 |
int isModal; |
|
190 |
Widget mainWindow; |
|
191 |
Widget focusProxy; /* for all key events */ |
|
192 |
Widget menuBar; |
|
193 |
Widget warningWindow; |
|
194 |
int top; /* these four are the insets... */ |
|
195 |
int bottom; |
|
196 |
int left; |
|
197 |
int right; |
|
198 |
int topGuess; /* these four are the guessed insets */ |
|
199 |
int bottomGuess; |
|
200 |
int leftGuess; |
|
201 |
int rightGuess; |
|
202 |
int mbHeight; /* height of the menubar window */ |
|
203 |
int wwHeight; /* height of the warning window */ |
|
204 |
jint state; /* java.awt.Frame.state bits */ |
|
205 |
Boolean reparented; |
|
206 |
Boolean configure_seen; |
|
207 |
Boolean shellResized; /* frame shell has been resized */ |
|
208 |
Boolean canvasResized; /* frame inner canvas resized */ |
|
209 |
Boolean menuBarReset; /* frame menu bar added/removed */ |
|
210 |
Boolean isResizable; /* is this window resizable ? */ |
|
211 |
Boolean isFixedSizeSet; /* is fixed size already set ? */ |
|
212 |
Boolean isShowing; /* is this window now showing ? */ |
|
213 |
Boolean hasTextComponentNative; |
|
214 |
Boolean need_reshape; |
|
215 |
Boolean callbacksAdded; /* needed for fix for 4078176 */ |
|
216 |
Pixmap iconPixmap; /* Pixmap to hold icon image */ |
|
217 |
int iconWidth; |
|
218 |
int iconHeight; |
|
219 |
int imHeight; /* imStatusBar's height */ |
|
220 |
Boolean imRemove; /* ImStatusBar is being removed */ |
|
221 |
Boolean fixInsets; /* [jk] REMINDER: remove if possible */ |
|
222 |
int decor; /* type of native decorations */ |
|
223 |
Boolean initialFocus; /* does Window take focus initially */ |
|
224 |
Boolean isInputMethodWindow; |
|
225 |
||
226 |
/* |
|
227 |
* Fix for BugTraq ID 4060975. |
|
228 |
* firstShellEH() stores to this field handle of the widget that had |
|
229 |
* focus before the shell was resized so that we can later restore it. |
|
230 |
*/ |
|
231 |
Widget focusWidget; |
|
232 |
int screenNum; /* Which screen this Window is on. Xinerama-aware. */ |
|
233 |
Boolean isDisposeScheduled; |
|
234 |
Boolean isFocusableWindow; /* a cache of Window.isFocusableWindow() return value */ |
|
235 |
}; |
|
236 |
||
237 |
struct ListData { |
|
238 |
struct ComponentData comp; |
|
239 |
Widget list; |
|
240 |
}; |
|
241 |
||
242 |
struct TextAreaData { |
|
243 |
struct ComponentData comp; |
|
244 |
Widget txt; |
|
245 |
}; |
|
246 |
||
247 |
struct TextFieldData { |
|
248 |
struct ComponentData comp; |
|
249 |
int echoContextID; |
|
250 |
Boolean echoContextIDInit; |
|
251 |
}; |
|
252 |
||
253 |
struct FileDialogData { |
|
254 |
struct ComponentData comp; |
|
255 |
char *file; |
|
256 |
}; |
|
257 |
||
258 |
typedef struct awtFontList { |
|
259 |
char *xlfd; |
|
260 |
int index_length; |
|
261 |
int load; |
|
262 |
char *charset_name; |
|
263 |
XFontStruct *xfont; |
|
264 |
} awtFontList; |
|
265 |
||
266 |
struct FontData { |
|
267 |
int charset_num; |
|
268 |
awtFontList *flist; |
|
269 |
XFontSet xfs; /* for TextField & TextArea */ |
|
270 |
XFontStruct *xfont; /* Latin1 font */ |
|
271 |
}; |
|
272 |
||
273 |
#ifndef XAWT |
|
274 |
extern XmFontList getMotifFontList(void); |
|
275 |
extern XFontSet getMotifFontSet(void); |
|
276 |
extern XFontStruct *getMotifFontStruct(void); |
|
277 |
extern Boolean awt_isAwtWidget(Widget widget); |
|
278 |
#endif |
|
279 |
||
280 |
struct ChoiceData { |
|
281 |
struct ComponentData comp; |
|
282 |
Widget menu; |
|
283 |
Widget *items; |
|
284 |
int maxitems; |
|
285 |
int n_items; |
|
286 |
short n_columns; |
|
287 |
/* Bug 4255631 Solaris: Size returned by Choice.getSize() does not match |
|
288 |
* actual size |
|
289 |
* y and height which Choice takes in pReshape |
|
290 |
*/ |
|
291 |
jint bounds_y; |
|
292 |
jint bounds_height; |
|
293 |
}; |
|
294 |
||
295 |
struct MenuList { |
|
296 |
Widget menu; |
|
297 |
struct MenuList* next; |
|
298 |
}; |
|
299 |
||
300 |
extern struct FontData *awtJNI_GetFontData(JNIEnv *env,jobject font, char **errmsg); |
|
301 |
||
302 |
extern AwtGraphicsConfigDataPtr getDefaultConfig(int screen); |
|
303 |
extern AwtScreenDataPtr getScreenData(int screen); |
|
304 |
#endif /* !HEADLESS */ |
|
305 |
||
306 |
/* allocated and initialize a structure */ |
|
307 |
#define ZALLOC(T) ((struct T *)calloc(1, sizeof(struct T))) |
|
308 |
||
309 |
#ifndef HEADLESS |
|
310 |
#define XDISPLAY awt_display; |
|
311 |
||
312 |
extern Boolean awt_currentThreadIsPrivileged(JNIEnv *env); |
|
313 |
extern void null_event_handler(Widget w, XtPointer client_data, |
|
314 |
XEvent * event, Boolean * cont); |
|
315 |
||
316 |
extern void awt_put_back_event(JNIEnv *env, XEvent *event); |
|
317 |
extern void awt_MToolkit_modalWait(int (*terminateFn)(void *data), void *data); |
|
318 |
extern void awt_Frame_guessInsets(struct FrameData *fdata); |
|
319 |
||
320 |
extern void awt_addWidget(Widget w, Widget origin, void *peer, jlong event_mask); |
|
321 |
extern void awt_delWidget(Widget w); |
|
322 |
||
323 |
extern void awt_addMenuWidget(Widget w); |
|
324 |
extern void awt_delMenuWidget(Widget w); |
|
325 |
||
326 |
extern int awt_allocate_colors(AwtGraphicsConfigDataPtr); |
|
327 |
extern void awt_allocate_systemcolors(XColor *, int, AwtGraphicsConfigDataPtr); |
|
328 |
extern void awt_allocate_systemrgbcolors(jint *, int, AwtGraphicsConfigDataPtr); |
|
329 |
||
330 |
extern int awtJNI_GetColor(JNIEnv *, jobject); |
|
331 |
extern int awtJNI_GetColorForVis (JNIEnv *, jobject, AwtGraphicsConfigDataPtr); |
|
332 |
extern jobject awtJNI_GetColorModel(JNIEnv *, AwtGraphicsConfigDataPtr); |
|
333 |
extern void awtJNI_CreateColorData (JNIEnv *, AwtGraphicsConfigDataPtr, int lock); |
|
334 |
||
335 |
extern Boolean awtJNI_isSelectionOwner(JNIEnv *env, char *sel_str); |
|
336 |
extern void awtJNI_notifySelectionLost(JNIEnv *env, char *sel_str); |
|
337 |
extern void removePopupMenus(); |
|
338 |
extern Boolean awtMenuIsActive(); |
|
339 |
#endif /* !HEADLESS */ |
|
340 |
||
341 |
extern void awtJNI_DeleteGlobalRef(JNIEnv *env,jobject thiscomp); |
|
342 |
extern void awtJNI_DeleteGlobalMenuRef(JNIEnv *env,jobject thismenu); |
|
343 |
extern jobject awtJNI_CreateAndSetGlobalRef(JNIEnv *env,jobject thiscomp); |
|
344 |
extern void awtJNI_CleanupGlobalRefs(void); |
|
345 |
||
346 |
#ifndef HEADLESS |
|
347 |
/* XXX: Motif internals. Need to fix 4090493. */ |
|
348 |
#define MOTIF_XmINVALID_DIMENSION ((Dimension) 0xFFFF) |
|
349 |
#define MOTIF_XmDEFAULT_INDICATOR_DIM ((Dimension) 9) |
|
350 |
||
351 |
extern Dimension awt_computeIndicatorSize(struct FontData *fdata); |
|
352 |
extern Dimension awt_adjustIndicatorSizeForMenu(Dimension indSize); |
|
353 |
#endif /* !HEADLESS */ |
|
354 |
||
355 |
#endif /* _AWT_P_H_ */ |