author | dav |
Mon, 07 Apr 2008 16:52:51 +0400 | |
changeset 439 | 3488710b02f8 |
parent 2 | 90ce3da70b43 |
child 1966 | 12a51fb0db0d |
permissions | -rw-r--r-- |
2 | 1 |
/* |
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
2 |
* Copyright 2002-2008 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 |
package sun.awt.X11; |
|
27 |
||
28 |
import java.security.AccessController; |
|
29 |
import java.security.PrivilegedAction; |
|
30 |
import sun.misc.*; |
|
31 |
||
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
32 |
final public class XlibWrapper |
2 | 33 |
{ |
34 |
static Unsafe unsafe = Unsafe.getUnsafe(); |
|
35 |
// strange constants |
|
36 |
static final int MAXSIZE = 32767; |
|
37 |
static final int MINSIZE = 1; |
|
38 |
||
39 |
// define a private constructor here to prevent this class and all |
|
40 |
// its descendants from being created |
|
41 |
private XlibWrapper() |
|
42 |
{ |
|
43 |
} |
|
44 |
||
45 |
/* |
|
46 |
Display *XOpenDisplay(display_name) |
|
47 |
char *display_name; |
|
48 |
||
49 |
*/ |
|
50 |
public final static String eventToString[]= |
|
51 |
{"<none:0>", "<none:1>", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", |
|
52 |
"MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", |
|
53 |
"KeymapNotify", "Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify", |
|
54 |
"CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest", |
|
55 |
"ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify", |
|
56 |
"ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify", |
|
57 |
"SelectionClear", "SelectionRequest", "SelectionNotify", "ColormapNotify", |
|
58 |
"ClientMessage", "MappingNotify", "LASTEvent"}; |
|
59 |
||
60 |
static native void XFree(long ptr); |
|
61 |
static native void memcpy(long dest_ptr, long src_ptr, long length); |
|
62 |
static native long getAddress(Object o); |
|
63 |
static native void copyIntArray(long dest_ptr, Object array, int size_bytes); |
|
64 |
static native void copyLongArray(long dest_ptr, Object array, int size_bytes); |
|
65 |
||
66 |
/** |
|
67 |
* Gets byte string from str_ptr and copies it into byte array |
|
68 |
* String should be NULL terminated |
|
69 |
*/ |
|
70 |
static native byte[] getStringBytes(long str_ptr); |
|
71 |
||
72 |
static native long XOpenDisplay(long display); |
|
73 |
||
74 |
static native void XCloseDisplay(long display); |
|
75 |
||
76 |
static native long XDisplayString(long display); |
|
77 |
||
78 |
static native void XSetCloseDownMode(long display, int close_mode); |
|
79 |
||
80 |
static native long DefaultScreen(long display); |
|
81 |
||
82 |
static native long ScreenOfDisplay(long display, long screen_number); |
|
83 |
||
84 |
static native int DoesBackingStore(long screen); |
|
85 |
||
86 |
static native long DisplayWidth(long display, long screen); |
|
87 |
static native long DisplayWidthMM(long display, long screen); |
|
88 |
||
89 |
static native long DisplayHeight(long display, long screen); |
|
90 |
static native long DisplayHeightMM(long display, long screen); |
|
91 |
||
92 |
static native long RootWindow(long display, long screen_number); |
|
93 |
static native int ScreenCount(long display); |
|
94 |
||
95 |
||
96 |
/* |
|
97 |
Window XCreateWindow(display, parent, x, y, width, height, |
|
98 |
border_width, depth, |
|
99 |
class, visual, valuemask, attributes) |
|
100 |
Display *display; |
|
101 |
Window parent; |
|
102 |
int x, y; |
|
103 |
unsigned int width, height; |
|
104 |
unsigned int border_width; |
|
105 |
int depth; |
|
106 |
unsigned int class; |
|
107 |
Visual *visual |
|
108 |
unsigned long valuemask; |
|
109 |
XSetWindowAttributes *attributes; |
|
110 |
*/ |
|
111 |
||
112 |
static native long XCreateWindow(long display, long parent, int x,int y, int width, int height, int border_width, int depth, long wclass, long visual, long valuemask, long attributes); |
|
113 |
||
114 |
static native void XDestroyWindow(long display, long window); |
|
115 |
||
116 |
static native int XGrabPointer(long display, long grab_window, |
|
117 |
int owner_events, int event_mask, int pointer_mode, |
|
118 |
int keyboard_mode, long confine_to, long cursor, long time); |
|
119 |
||
120 |
static native void XUngrabPointer(long display, long time); |
|
121 |
||
122 |
static native int XGrabKeyboard(long display, long grab_window, |
|
123 |
int owner_events, int pointer_mode, |
|
124 |
int keyboard_mode, long time); |
|
125 |
||
126 |
static native void XUngrabKeyboard(long display, long time); |
|
127 |
||
128 |
static native void XGrabServer(long display); |
|
129 |
static native void XUngrabServer(long display); |
|
130 |
||
131 |
/* |
|
132 |
||
133 |
void XSetWMProperties(display, w, window_name, icon_name, |
|
134 |
argv, argc, normal_hints, wm_hints, class_hints) |
|
135 |
Display *display; |
|
136 |
Window w; |
|
137 |
XTextProperty *window_name; |
|
138 |
XTextProperty *icon_name; |
|
139 |
char **argv; |
|
140 |
int argc; |
|
141 |
XSizeHints *normal_hints; |
|
142 |
XWMHints *wm_hints; |
|
143 |
XClassHint *class_hints; |
|
144 |
*/ |
|
145 |
||
146 |
/* |
|
147 |
||
148 |
XMapWindow(display, w) |
|
149 |
Display *display; |
|
150 |
Window w; |
|
151 |
*/ |
|
152 |
||
153 |
static native void XMapWindow(long display, long window); |
|
154 |
static native void XMapRaised(long display, long window); |
|
155 |
static native void XRaiseWindow(long display, long window); |
|
156 |
||
157 |
static native void XLowerWindow(long display, long window); |
|
158 |
static native void XRestackWindows(long display, long windows, int length); |
|
159 |
static native void XSetInputFocus(long display, long window); |
|
160 |
static native void XSetInputFocus2(long display, long window, long time); |
|
161 |
static native long XGetInputFocus(long display); |
|
162 |
||
163 |
/* |
|
164 |
||
165 |
XUnmapWindow(display, w) |
|
166 |
Display *display; |
|
167 |
Window w; |
|
168 |
*/ |
|
169 |
||
170 |
static native void XUnmapWindow(long display, long window); |
|
171 |
||
172 |
||
173 |
||
174 |
||
175 |
/* |
|
176 |
XSelectInput(display, w, event_mask) |
|
177 |
Display *display; |
|
178 |
Window w; |
|
179 |
long event_mask; |
|
180 |
||
181 |
*/ |
|
182 |
static native void XSelectInput(long display, long window, long event_mask); |
|
183 |
||
184 |
/* |
|
185 |
XNextEvent(display, event_return) |
|
186 |
Display *display; |
|
187 |
XEvent *event_return; |
|
188 |
||
189 |
*/ |
|
190 |
||
191 |
static native void XNextEvent(long display,long ptr); |
|
192 |
||
193 |
/* |
|
194 |
XMaskEvent(display, event_mask, event_return) |
|
195 |
Display *display; |
|
196 |
long event_mask; |
|
197 |
XEvent *event_return; |
|
198 |
*/ |
|
199 |
static native void XMaskEvent(long display, long event_mask, long event_return); |
|
200 |
||
201 |
static native void XWindowEvent(long display, long window, long event_mask, long event_return); |
|
202 |
||
203 |
/* |
|
204 |
Bool XFilterEvent(event, w) |
|
205 |
XEvent *event; |
|
206 |
Window w; |
|
207 |
*/ |
|
208 |
static native boolean XFilterEvent(long ptr, long window); |
|
209 |
||
210 |
/* |
|
211 |
Bool XSupportsLocale() |
|
212 |
*/ |
|
213 |
static native boolean XSupportsLocale(); |
|
214 |
||
215 |
/* |
|
216 |
char *XSetLocaleModifiers(modifier_list) |
|
217 |
char *modifier_list; |
|
218 |
*/ |
|
219 |
static native String XSetLocaleModifiers(String modifier_list); |
|
220 |
||
221 |
||
222 |
static native int XTranslateCoordinates( |
|
223 |
long display, long src_w, long dest_w, |
|
224 |
long src_x, long src_y, |
|
225 |
long dest_x_return, long dest_y_return, |
|
226 |
long child_return); |
|
227 |
||
228 |
/* |
|
229 |
XPeekEvent(display, event_return) |
|
230 |
Display *display; |
|
231 |
XEvent *event_return; |
|
232 |
||
233 |
*/ |
|
234 |
||
235 |
static native void XPeekEvent(long display,long ptr); |
|
236 |
||
237 |
/* |
|
238 |
XFlush(display) |
|
239 |
Display *display; |
|
240 |
*/ |
|
241 |
||
242 |
static native void XFlush(long display); |
|
243 |
||
244 |
/* |
|
245 |
XSync(display, discard) |
|
246 |
Display *display; |
|
247 |
Bool discard; |
|
248 |
*/ |
|
249 |
||
250 |
static native void XSync(long display,int discard); |
|
251 |
||
252 |
||
253 |
/* XMoveResizeWindow(display, w, x, y, width, height) |
|
254 |
Display *display; |
|
255 |
Window w; |
|
256 |
int x, y; |
|
257 |
unsigned int width, height; |
|
258 |
*/ |
|
259 |
static native void XMoveResizeWindow(long display, long window, int x, int y, int width, int height); |
|
260 |
static native void XResizeWindow(long display, long window, int width, int height); |
|
261 |
static native void XMoveWindow(long display, long window, int x, int y); |
|
262 |
||
263 |
/* |
|
264 |
Bool XQueryPointer(display, w, root_return, child_return, |
|
265 |
root_x_return, root_y_return, |
|
266 |
win_x_return, win_y_return, |
|
267 |
mask_return) |
|
268 |
Display *display; |
|
269 |
Window w; |
|
270 |
Window *root_return, *child_return; |
|
271 |
int *root_x_return, *root_y_return; |
|
272 |
int *win_x_return, *win_y_return; |
|
273 |
unsigned int *mask_return; |
|
274 |
*/ |
|
275 |
||
276 |
static native boolean XQueryPointer (long display, long window, long root_return, long child_return, long root_x_return, long root_y_return, long win_x_return, long win_y_return, long mask_return); |
|
277 |
||
278 |
/* XFreeCursor(display, cursor) |
|
279 |
Display *display; |
|
280 |
Cursor cursor; |
|
281 |
*/ |
|
282 |
||
283 |
static native void XFreeCursor(long display, long cursor); |
|
284 |
||
285 |
/* |
|
286 |
XSetWindowBackground(display, w, background_pixel) |
|
287 |
Display *display; |
|
288 |
Window w; |
|
289 |
unsigned long background_pixel; |
|
290 |
*/ |
|
291 |
||
292 |
static native void XSetWindowBackground(long display, long window, long background_pixel); |
|
293 |
||
294 |
static native int XEventsQueued(long display, int mode); |
|
295 |
||
296 |
/* |
|
297 |
Atom XInternAtom(display, atom_name, only_if_exists) |
|
298 |
Display *display; |
|
299 |
char *atom_name; |
|
300 |
Bool only_if_exists; |
|
301 |
*/ |
|
302 |
||
303 |
static native int XInternAtoms(long display, String[] names, boolean only_if_exists, long atoms); |
|
304 |
||
305 |
static native void SetProperty(long display, long window, long atom, String str); |
|
306 |
static native String GetProperty(long display ,long window, long atom); |
|
307 |
static native long InternAtom(long display, String string, int only_if_exists); |
|
308 |
static native int XGetWindowProperty(long display, long window, long atom, |
|
309 |
long long_offset, long long_length, |
|
310 |
long delete, long req_type, long actualy_type, |
|
311 |
long actualy_format, long nitems_ptr, |
|
312 |
long bytes_after, long data_ptr); |
|
313 |
native static void XChangePropertyImpl(long display, long window, long atom, |
|
314 |
long type, int format, int mode, long data, |
|
315 |
int nelements); |
|
316 |
static void XChangeProperty(long display, long window, long atom, |
|
317 |
long type, int format, int mode, long data, |
|
318 |
int nelements) { |
|
319 |
// TODO: handling of XChangePropertyImpl return value, if not Success - don't cache |
|
320 |
if (XPropertyCache.isCachingSupported() && |
|
321 |
XToolkit.windowToXWindow(window) != null && |
|
322 |
WindowPropertyGetter.isCacheableProperty(XAtom.get(atom)) && |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
323 |
mode == XConstants.PropModeReplace) |
2 | 324 |
{ |
325 |
int length = (format / 8) * nelements; |
|
326 |
XPropertyCache.storeCache( |
|
327 |
new XPropertyCache.PropertyCacheEntry(format, |
|
328 |
nelements, |
|
329 |
0, |
|
330 |
data, |
|
331 |
length), |
|
332 |
window, |
|
333 |
XAtom.get(atom)); |
|
334 |
} |
|
335 |
XChangePropertyImpl(display, window, atom, type, format, mode, data, nelements); |
|
336 |
} |
|
337 |
||
338 |
static native void XChangePropertyS(long display, long window, long atom, |
|
339 |
long type, int format, int mode, String value); |
|
340 |
static native void XDeleteProperty(long display, long window, long atom); |
|
341 |
||
342 |
static native void XSetTransientFor(long display, long window, long transient_for_window); |
|
343 |
static native void XSetWMHints(long display, long window, long wmhints); |
|
344 |
static native void XGetWMHints(long display, long window, long wmhints); |
|
345 |
static native long XAllocWMHints(); |
|
346 |
static native int XGetPointerMapping(long display, long map, int buttonNumber); |
|
347 |
static native String XGetDefault(long display, String program, String option); |
|
348 |
static native long getScreenOfWindow(long display, long window); |
|
349 |
static native long XScreenNumberOfScreen(long screen); |
|
350 |
static native int XIconifyWindow(long display, long window, long screenNumber); |
|
351 |
static native String ServerVendor(long display); |
|
352 |
static native int VendorRelease(long display); |
|
353 |
||
354 |
static native void XBell(long display, int percent); |
|
355 |
||
356 |
/* |
|
357 |
Cursor XCreateFontCursor(display, shape) |
|
358 |
Display *display; |
|
359 |
unsigned int shape; |
|
360 |
||
361 |
we always pass int as shape param. |
|
362 |
perhaps later we will need to change type of shape to long. |
|
363 |
*/ |
|
364 |
||
365 |
static native int XCreateFontCursor(long display, int shape); |
|
366 |
||
367 |
/* |
|
368 |
Pixmap XCreateBitmapFromData(display, d, data, width, |
|
369 |
height) |
|
370 |
Display *display; |
|
371 |
Drawable d; |
|
372 |
char *data; |
|
373 |
unsigned int width, height; |
|
374 |
*/ |
|
375 |
||
376 |
static native long XCreateBitmapFromData(long display, long drawable, long data, int width, int height); |
|
377 |
||
378 |
/* |
|
379 |
XFreePixmap(display, pixmap) |
|
380 |
Display *display; |
|
381 |
Pixmap pixmap; |
|
382 |
*/ |
|
383 |
||
384 |
static native void XFreePixmap(long display, long pixmap); |
|
385 |
||
386 |
/* |
|
387 |
Cursor XCreatePixmapCursor(display, source, mask, |
|
388 |
foreground_color, background_color, x, y) |
|
389 |
Display *display; |
|
390 |
Pixmap source; |
|
391 |
Pixmap mask; |
|
392 |
XColor *foreground_color; |
|
393 |
XColor *background_color; |
|
394 |
unsigned int x, y; |
|
395 |
*/ |
|
396 |
static native long XCreatePixmapCursor(long display, long source, long mask, long fore, long back, int x, int y); |
|
397 |
||
398 |
||
399 |
/* |
|
400 |
Status XQueryBestCursor(display, d, width, height, |
|
401 |
width_return, height_return) |
|
402 |
Display *display; |
|
403 |
Drawable d; |
|
404 |
unsigned int width, height; |
|
405 |
unsigned int *width_return, *height_return; |
|
406 |
||
407 |
*/ |
|
408 |
||
409 |
static native boolean XQueryBestCursor(long display, long drawable, int width, int height, long width_return, long height_return); |
|
410 |
||
411 |
||
412 |
/* |
|
413 |
Status XAllocColor(display, colormap, screen_in_out) |
|
414 |
Display *display; |
|
415 |
Colormap colormap; |
|
416 |
XColor *screen_in_out; |
|
417 |
*/ |
|
418 |
||
419 |
static native boolean XAllocColor( long display, long colormap, long screen_in_out); |
|
420 |
||
421 |
||
422 |
static native long SetToolkitErrorHandler(); |
|
423 |
static native void XSetErrorHandler(long handler); |
|
424 |
static native int CallErrorHandler(long handler, long display, long event_ptr); |
|
425 |
||
426 |
/* |
|
427 |
XChangeWindowAttributes(display, w, valuemask, attributes) |
|
428 |
Display *display; |
|
429 |
Window w; |
|
430 |
unsigned long valuemask; |
|
431 |
XSetWindowAttributes *attributes; |
|
432 |
*/ |
|
433 |
||
434 |
static native void XChangeWindowAttributes(long display, long window, long valuemask, long attributes); |
|
435 |
static native int XGetWindowAttributes(long display, long window, long attr_ptr); |
|
436 |
static native int XGetGeometry(long display, long drawable, long root_return, long x_return, long y_return, |
|
437 |
long width_return, long height_return, long border_width_return, long depth_return); |
|
438 |
||
439 |
static native int XGetWMNormalHints(long display, long window, long hints, long supplied_return); |
|
440 |
static native void XSetWMNormalHints(long display, long window, long hints); |
|
441 |
static native void XSetMinMaxHints(long display, long window, int x, int y, int width, int height, long flags); |
|
442 |
static native long XAllocSizeHints(); |
|
443 |
||
444 |
static native int XSendEvent(long display, long window, boolean propagate, long event_mask, long event); |
|
445 |
static native void XPutBackEvent(long display, long event); |
|
446 |
static native int XQueryTree(long display, long window, long root_return, long parent_return, long children_return, long nchildren_return); |
|
447 |
static native long XGetVisualInfo(long display, long vinfo_mask, long vinfo_template, long nitems_return); |
|
448 |
static native void XReparentWindow(long display, long window, long parent, int x, int y); |
|
449 |
||
450 |
static native void XConvertSelection(long display, long selection, |
|
451 |
long target, long property, |
|
452 |
long requestor, long time); |
|
453 |
||
454 |
static native void XSetSelectionOwner(long display, long selection, |
|
455 |
long owner, long time); |
|
456 |
||
457 |
static native long XGetSelectionOwner(long display, long selection); |
|
458 |
||
459 |
static native String XGetAtomName(long display, long atom); |
|
460 |
||
461 |
static native long XMaxRequestSize(long display); |
|
462 |
||
463 |
||
464 |
static native long XCreatePixmap(long display, long drawable, int width, int height, int depth); |
|
465 |
static native long XCreateImage(long display, long visual_ptr, int depth, int format, |
|
466 |
int offset, long data, int width, int height, int bitmap_pad, |
|
467 |
int bytes_per_line); |
|
468 |
static native void XDestroyImage(long image); |
|
469 |
static native void XPutImage(long display, long drawable, long gc, long image, |
|
470 |
int src_x, int src_y, int dest_x, int dest_y, |
|
471 |
int width, int height); |
|
472 |
static native long XCreateGC(long display, long drawable, long valuemask, long values); |
|
473 |
static native void XFreeGC(long display, long gc); |
|
474 |
static native void XSetWindowBackgroundPixmap(long display, long window, long pixmap); |
|
475 |
static native void XClearWindow(long display, long window); |
|
476 |
static native int XGetIconSizes(long display, long window, long ret_sizes, long ret_count); |
|
477 |
static native int XdbeQueryExtension(long display, long major_version_return, |
|
478 |
long minor_version_return); |
|
479 |
static native boolean XQueryExtension(long display, String name, long mop_return, |
|
480 |
long feve_return, long err_return); |
|
481 |
static native boolean IsKeypadKey(long keysym); |
|
482 |
static native long XdbeAllocateBackBufferName(long display, long window, int swap_action); |
|
483 |
static native int XdbeDeallocateBackBufferName(long display, long buffer); |
|
484 |
static native int XdbeBeginIdiom(long display); |
|
485 |
static native int XdbeEndIdiom(long display); |
|
486 |
static native int XdbeSwapBuffers(long display, long swap_info, int num_windows); |
|
487 |
||
488 |
static native long XKeycodeToKeysym(long display, int keycode, int index); |
|
489 |
||
490 |
static native int XKeysymToKeycode(long display, long keysym); |
|
491 |
||
492 |
static native void XConvertCase(long keysym, |
|
493 |
long keysym_lowercase, |
|
494 |
long keysym_uppercase); |
|
495 |
||
496 |
static native long XGetModifierMapping(long display); |
|
497 |
||
498 |
static native void XFreeModifiermap(long keymap); |
|
499 |
||
500 |
static native void XChangeActivePointerGrab(long display, int mask, |
|
501 |
long cursor, long time); |
|
502 |
||
503 |
/* |
|
504 |
int (*XSynchronize(Display *display, Bool onoff))(); |
|
505 |
display Specifies the connection to the X server. |
|
506 |
onoff Specifies a Boolean value that indicates whether to enable or disable synchronization. |
|
507 |
*/ |
|
508 |
public static native int XSynchronize(long display, boolean onoff); |
|
509 |
||
510 |
/** |
|
511 |
* Extracts an X event that can be processed in a secondary loop. |
|
512 |
* Should only be called on the toolkit thread. |
|
513 |
* Returns false if this secondary event was terminated. |
|
514 |
*/ |
|
515 |
static native boolean XNextSecondaryLoopEvent(long display, long ptr); |
|
516 |
/** |
|
517 |
* Terminates the topmost secondary loop (if any). |
|
518 |
* Should never be called on the toolkit thread. |
|
519 |
*/ |
|
520 |
static native void ExitSecondaryLoop(); |
|
521 |
||
522 |
/** |
|
523 |
* Calls XTextPropertyToStringList on the specified byte array and returns |
|
524 |
* the array of strings. |
|
525 |
*/ |
|
526 |
static native String[] XTextPropertyToStringList(byte[] bytes, long encoding_atom); |
|
527 |
||
528 |
/** |
|
529 |
* XSHAPE extension support. |
|
530 |
*/ |
|
531 |
static native boolean XShapeQueryExtension(long display, long event_base_return, long error_base_return); |
|
532 |
static native void SetRectangularShape(long display, long window, |
|
533 |
int lox, int loy, int hix, int hiy, |
|
534 |
sun.java2d.pipe.Region region); |
|
535 |
||
536 |
/* Global memory area used for X lib parameter passing */ |
|
537 |
||
538 |
final static long lbuffer = unsafe.allocateMemory(64); // array to hold 8 longs |
|
539 |
final static long ibuffer = unsafe.allocateMemory(32); // array to hold 8 ints |
|
540 |
||
541 |
static final long larg1 = lbuffer; |
|
542 |
static final long larg2 = larg1+8; |
|
543 |
static final long larg3 = larg2+8; |
|
544 |
static final long larg4 = larg3+8; |
|
545 |
static final long larg5 = larg4+8; |
|
546 |
static final long larg6 = larg5+8; |
|
547 |
static final long larg7 = larg6+8; |
|
548 |
static final long larg8 = larg7+8; |
|
549 |
||
550 |
static final long iarg1 = ibuffer; |
|
551 |
static final long iarg2 = iarg1+4; |
|
552 |
static final long iarg3 = iarg2+4; |
|
553 |
static final long iarg4 = iarg3+4; |
|
554 |
static final long iarg5 = iarg4+4; |
|
555 |
static final long iarg6 = iarg5+4; |
|
556 |
static final long iarg7 = iarg6+4; |
|
557 |
static final long iarg8 = iarg7+4; |
|
558 |
||
559 |
||
560 |
static int dataModel; |
|
561 |
static final boolean isBuildInternal; |
|
562 |
||
563 |
static { |
|
564 |
String dataModelProp = (String)AccessController.doPrivileged( |
|
565 |
new PrivilegedAction() { |
|
566 |
public Object run() { |
|
567 |
return System.getProperty("sun.arch.data.model"); |
|
568 |
} |
|
569 |
}); |
|
570 |
try { |
|
571 |
dataModel = Integer.parseInt(dataModelProp); |
|
572 |
} catch (Exception e) { |
|
573 |
dataModel = 32; |
|
574 |
} |
|
575 |
||
576 |
isBuildInternal = getBuildInternal(); |
|
577 |
||
578 |
// System.loadLibrary("mawt"); |
|
579 |
} |
|
580 |
||
581 |
static int getDataModel() { |
|
582 |
return dataModel; |
|
583 |
} |
|
584 |
||
585 |
static String hintsToString(long flags) { |
|
586 |
StringBuffer buf = new StringBuffer(); |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
587 |
if ((flags & XUtilConstants.PMaxSize) != 0) { |
2 | 588 |
buf.append("PMaxSize "); |
589 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
590 |
if ((flags & XUtilConstants.PMinSize) != 0) { |
2 | 591 |
buf.append("PMinSize "); |
592 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
593 |
if ((flags & XUtilConstants.USSize) != 0) { |
2 | 594 |
buf.append("USSize "); |
595 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
596 |
if ((flags & XUtilConstants.USPosition) != 0) { |
2 | 597 |
buf.append("USPosition "); |
598 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
599 |
if ((flags & XUtilConstants.PPosition) != 0) { |
2 | 600 |
buf.append("PPosition "); |
601 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
602 |
if ((flags & XUtilConstants.PSize) != 0) { |
2 | 603 |
buf.append("PSize "); |
604 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
605 |
if ((flags & XUtilConstants.PWinGravity) != 0) { |
2 | 606 |
buf.append("PWinGravity "); |
607 |
} |
|
608 |
return buf.toString(); |
|
609 |
} |
|
610 |
||
611 |
private static boolean getBuildInternal() { |
|
612 |
String javaVersion = XToolkit.getSystemProperty("java.version"); |
|
613 |
return javaVersion != null && javaVersion.contains("internal"); |
|
614 |
} |
|
615 |
} |