author | ohair |
Tue, 25 May 2010 15:58:33 -0700 | |
changeset 5506 | 202f599c92aa |
parent 4370 | cc409c51b108 |
child 13604 | 31089af1a447 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 2002, 2009, Oracle and/or its affiliates. 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 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); |
|
2472
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
159 |
static native void XConfigureWindow(long display, long window, |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
160 |
long value_mask, long values); |
2 | 161 |
static native void XSetInputFocus(long display, long window); |
162 |
static native void XSetInputFocus2(long display, long window, long time); |
|
163 |
static native long XGetInputFocus(long display); |
|
164 |
||
165 |
/* |
|
166 |
||
167 |
XUnmapWindow(display, w) |
|
168 |
Display *display; |
|
169 |
Window w; |
|
170 |
*/ |
|
171 |
||
172 |
static native void XUnmapWindow(long display, long window); |
|
173 |
||
174 |
||
175 |
||
176 |
||
177 |
/* |
|
178 |
XSelectInput(display, w, event_mask) |
|
179 |
Display *display; |
|
180 |
Window w; |
|
181 |
long event_mask; |
|
182 |
||
183 |
*/ |
|
184 |
static native void XSelectInput(long display, long window, long event_mask); |
|
185 |
||
186 |
/* |
|
187 |
XNextEvent(display, event_return) |
|
188 |
Display *display; |
|
189 |
XEvent *event_return; |
|
190 |
||
191 |
*/ |
|
192 |
||
193 |
static native void XNextEvent(long display,long ptr); |
|
194 |
||
195 |
/* |
|
196 |
XMaskEvent(display, event_mask, event_return) |
|
197 |
Display *display; |
|
198 |
long event_mask; |
|
199 |
XEvent *event_return; |
|
200 |
*/ |
|
201 |
static native void XMaskEvent(long display, long event_mask, long event_return); |
|
202 |
||
203 |
static native void XWindowEvent(long display, long window, long event_mask, long event_return); |
|
204 |
||
205 |
/* |
|
206 |
Bool XFilterEvent(event, w) |
|
207 |
XEvent *event; |
|
208 |
Window w; |
|
209 |
*/ |
|
210 |
static native boolean XFilterEvent(long ptr, long window); |
|
211 |
||
212 |
/* |
|
213 |
Bool XSupportsLocale() |
|
214 |
*/ |
|
215 |
static native boolean XSupportsLocale(); |
|
216 |
||
217 |
/* |
|
218 |
char *XSetLocaleModifiers(modifier_list) |
|
219 |
char *modifier_list; |
|
220 |
*/ |
|
221 |
static native String XSetLocaleModifiers(String modifier_list); |
|
222 |
||
223 |
||
224 |
static native int XTranslateCoordinates( |
|
225 |
long display, long src_w, long dest_w, |
|
226 |
long src_x, long src_y, |
|
227 |
long dest_x_return, long dest_y_return, |
|
228 |
long child_return); |
|
229 |
||
230 |
/* |
|
231 |
XPeekEvent(display, event_return) |
|
232 |
Display *display; |
|
233 |
XEvent *event_return; |
|
234 |
||
235 |
*/ |
|
236 |
||
237 |
static native void XPeekEvent(long display,long ptr); |
|
238 |
||
239 |
/* |
|
240 |
XFlush(display) |
|
241 |
Display *display; |
|
242 |
*/ |
|
243 |
||
244 |
static native void XFlush(long display); |
|
245 |
||
246 |
/* |
|
247 |
XSync(display, discard) |
|
248 |
Display *display; |
|
249 |
Bool discard; |
|
250 |
*/ |
|
251 |
||
252 |
static native void XSync(long display,int discard); |
|
253 |
||
254 |
||
255 |
/* XMoveResizeWindow(display, w, x, y, width, height) |
|
256 |
Display *display; |
|
257 |
Window w; |
|
258 |
int x, y; |
|
259 |
unsigned int width, height; |
|
260 |
*/ |
|
261 |
static native void XMoveResizeWindow(long display, long window, int x, int y, int width, int height); |
|
262 |
static native void XResizeWindow(long display, long window, int width, int height); |
|
263 |
static native void XMoveWindow(long display, long window, int x, int y); |
|
264 |
||
265 |
/* |
|
266 |
Bool XQueryPointer(display, w, root_return, child_return, |
|
267 |
root_x_return, root_y_return, |
|
268 |
win_x_return, win_y_return, |
|
269 |
mask_return) |
|
270 |
Display *display; |
|
271 |
Window w; |
|
272 |
Window *root_return, *child_return; |
|
273 |
int *root_x_return, *root_y_return; |
|
274 |
int *win_x_return, *win_y_return; |
|
275 |
unsigned int *mask_return; |
|
276 |
*/ |
|
277 |
||
278 |
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); |
|
279 |
||
280 |
/* XFreeCursor(display, cursor) |
|
281 |
Display *display; |
|
282 |
Cursor cursor; |
|
283 |
*/ |
|
284 |
||
285 |
static native void XFreeCursor(long display, long cursor); |
|
286 |
||
287 |
/* |
|
288 |
XSetWindowBackground(display, w, background_pixel) |
|
289 |
Display *display; |
|
290 |
Window w; |
|
291 |
unsigned long background_pixel; |
|
292 |
*/ |
|
293 |
||
294 |
static native void XSetWindowBackground(long display, long window, long background_pixel); |
|
295 |
||
296 |
static native int XEventsQueued(long display, int mode); |
|
297 |
||
298 |
/* |
|
299 |
Atom XInternAtom(display, atom_name, only_if_exists) |
|
300 |
Display *display; |
|
301 |
char *atom_name; |
|
302 |
Bool only_if_exists; |
|
303 |
*/ |
|
304 |
||
305 |
static native int XInternAtoms(long display, String[] names, boolean only_if_exists, long atoms); |
|
306 |
||
307 |
static native void SetProperty(long display, long window, long atom, String str); |
|
308 |
static native String GetProperty(long display ,long window, long atom); |
|
309 |
static native long InternAtom(long display, String string, int only_if_exists); |
|
310 |
static native int XGetWindowProperty(long display, long window, long atom, |
|
311 |
long long_offset, long long_length, |
|
312 |
long delete, long req_type, long actualy_type, |
|
313 |
long actualy_format, long nitems_ptr, |
|
314 |
long bytes_after, long data_ptr); |
|
315 |
native static void XChangePropertyImpl(long display, long window, long atom, |
|
316 |
long type, int format, int mode, long data, |
|
317 |
int nelements); |
|
318 |
static void XChangeProperty(long display, long window, long atom, |
|
319 |
long type, int format, int mode, long data, |
|
320 |
int nelements) { |
|
321 |
// TODO: handling of XChangePropertyImpl return value, if not Success - don't cache |
|
322 |
if (XPropertyCache.isCachingSupported() && |
|
323 |
XToolkit.windowToXWindow(window) != null && |
|
324 |
WindowPropertyGetter.isCacheableProperty(XAtom.get(atom)) && |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
325 |
mode == XConstants.PropModeReplace) |
2 | 326 |
{ |
327 |
int length = (format / 8) * nelements; |
|
328 |
XPropertyCache.storeCache( |
|
329 |
new XPropertyCache.PropertyCacheEntry(format, |
|
330 |
nelements, |
|
331 |
0, |
|
332 |
data, |
|
333 |
length), |
|
334 |
window, |
|
335 |
XAtom.get(atom)); |
|
336 |
} |
|
337 |
XChangePropertyImpl(display, window, atom, type, format, mode, data, nelements); |
|
338 |
} |
|
339 |
||
340 |
static native void XChangePropertyS(long display, long window, long atom, |
|
341 |
long type, int format, int mode, String value); |
|
342 |
static native void XDeleteProperty(long display, long window, long atom); |
|
343 |
||
344 |
static native void XSetTransientFor(long display, long window, long transient_for_window); |
|
345 |
static native void XSetWMHints(long display, long window, long wmhints); |
|
346 |
static native void XGetWMHints(long display, long window, long wmhints); |
|
347 |
static native long XAllocWMHints(); |
|
348 |
static native int XGetPointerMapping(long display, long map, int buttonNumber); |
|
349 |
static native String XGetDefault(long display, String program, String option); |
|
350 |
static native long getScreenOfWindow(long display, long window); |
|
351 |
static native long XScreenNumberOfScreen(long screen); |
|
352 |
static native int XIconifyWindow(long display, long window, long screenNumber); |
|
353 |
static native String ServerVendor(long display); |
|
354 |
static native int VendorRelease(long display); |
|
3088 | 355 |
static native boolean IsXsunKPBehavior(long display); |
4370
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
356 |
static native boolean IsSunKeyboard(long display); |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
357 |
static native boolean IsKanaKeyboard(long display); |
2 | 358 |
|
359 |
static native void XBell(long display, int percent); |
|
360 |
||
361 |
/* |
|
362 |
Cursor XCreateFontCursor(display, shape) |
|
363 |
Display *display; |
|
364 |
unsigned int shape; |
|
365 |
||
366 |
we always pass int as shape param. |
|
367 |
perhaps later we will need to change type of shape to long. |
|
368 |
*/ |
|
369 |
||
370 |
static native int XCreateFontCursor(long display, int shape); |
|
371 |
||
372 |
/* |
|
373 |
Pixmap XCreateBitmapFromData(display, d, data, width, |
|
374 |
height) |
|
375 |
Display *display; |
|
376 |
Drawable d; |
|
377 |
char *data; |
|
378 |
unsigned int width, height; |
|
379 |
*/ |
|
380 |
||
381 |
static native long XCreateBitmapFromData(long display, long drawable, long data, int width, int height); |
|
382 |
||
383 |
/* |
|
384 |
XFreePixmap(display, pixmap) |
|
385 |
Display *display; |
|
386 |
Pixmap pixmap; |
|
387 |
*/ |
|
388 |
||
389 |
static native void XFreePixmap(long display, long pixmap); |
|
390 |
||
391 |
/* |
|
392 |
Cursor XCreatePixmapCursor(display, source, mask, |
|
393 |
foreground_color, background_color, x, y) |
|
394 |
Display *display; |
|
395 |
Pixmap source; |
|
396 |
Pixmap mask; |
|
397 |
XColor *foreground_color; |
|
398 |
XColor *background_color; |
|
399 |
unsigned int x, y; |
|
400 |
*/ |
|
401 |
static native long XCreatePixmapCursor(long display, long source, long mask, long fore, long back, int x, int y); |
|
402 |
||
403 |
||
404 |
/* |
|
405 |
Status XQueryBestCursor(display, d, width, height, |
|
406 |
width_return, height_return) |
|
407 |
Display *display; |
|
408 |
Drawable d; |
|
409 |
unsigned int width, height; |
|
410 |
unsigned int *width_return, *height_return; |
|
411 |
||
412 |
*/ |
|
413 |
||
414 |
static native boolean XQueryBestCursor(long display, long drawable, int width, int height, long width_return, long height_return); |
|
415 |
||
416 |
||
417 |
/* |
|
418 |
Status XAllocColor(display, colormap, screen_in_out) |
|
419 |
Display *display; |
|
420 |
Colormap colormap; |
|
421 |
XColor *screen_in_out; |
|
422 |
*/ |
|
423 |
||
424 |
static native boolean XAllocColor( long display, long colormap, long screen_in_out); |
|
425 |
||
426 |
||
427 |
static native long SetToolkitErrorHandler(); |
|
428 |
static native void XSetErrorHandler(long handler); |
|
429 |
static native int CallErrorHandler(long handler, long display, long event_ptr); |
|
430 |
||
431 |
/* |
|
432 |
XChangeWindowAttributes(display, w, valuemask, attributes) |
|
433 |
Display *display; |
|
434 |
Window w; |
|
435 |
unsigned long valuemask; |
|
436 |
XSetWindowAttributes *attributes; |
|
437 |
*/ |
|
438 |
||
439 |
static native void XChangeWindowAttributes(long display, long window, long valuemask, long attributes); |
|
440 |
static native int XGetWindowAttributes(long display, long window, long attr_ptr); |
|
441 |
static native int XGetGeometry(long display, long drawable, long root_return, long x_return, long y_return, |
|
442 |
long width_return, long height_return, long border_width_return, long depth_return); |
|
443 |
||
444 |
static native int XGetWMNormalHints(long display, long window, long hints, long supplied_return); |
|
445 |
static native void XSetWMNormalHints(long display, long window, long hints); |
|
446 |
static native void XSetMinMaxHints(long display, long window, int x, int y, int width, int height, long flags); |
|
447 |
static native long XAllocSizeHints(); |
|
448 |
||
449 |
static native int XSendEvent(long display, long window, boolean propagate, long event_mask, long event); |
|
450 |
static native void XPutBackEvent(long display, long event); |
|
451 |
static native int XQueryTree(long display, long window, long root_return, long parent_return, long children_return, long nchildren_return); |
|
452 |
static native long XGetVisualInfo(long display, long vinfo_mask, long vinfo_template, long nitems_return); |
|
453 |
static native void XReparentWindow(long display, long window, long parent, int x, int y); |
|
454 |
||
455 |
static native void XConvertSelection(long display, long selection, |
|
456 |
long target, long property, |
|
457 |
long requestor, long time); |
|
458 |
||
459 |
static native void XSetSelectionOwner(long display, long selection, |
|
460 |
long owner, long time); |
|
461 |
||
462 |
static native long XGetSelectionOwner(long display, long selection); |
|
463 |
||
464 |
static native String XGetAtomName(long display, long atom); |
|
465 |
||
466 |
static native long XMaxRequestSize(long display); |
|
467 |
||
468 |
||
469 |
static native long XCreatePixmap(long display, long drawable, int width, int height, int depth); |
|
470 |
static native long XCreateImage(long display, long visual_ptr, int depth, int format, |
|
471 |
int offset, long data, int width, int height, int bitmap_pad, |
|
472 |
int bytes_per_line); |
|
473 |
static native void XDestroyImage(long image); |
|
474 |
static native void XPutImage(long display, long drawable, long gc, long image, |
|
475 |
int src_x, int src_y, int dest_x, int dest_y, |
|
476 |
int width, int height); |
|
477 |
static native long XCreateGC(long display, long drawable, long valuemask, long values); |
|
478 |
static native void XFreeGC(long display, long gc); |
|
479 |
static native void XSetWindowBackgroundPixmap(long display, long window, long pixmap); |
|
480 |
static native void XClearWindow(long display, long window); |
|
481 |
static native int XGetIconSizes(long display, long window, long ret_sizes, long ret_count); |
|
482 |
static native int XdbeQueryExtension(long display, long major_version_return, |
|
483 |
long minor_version_return); |
|
484 |
static native boolean XQueryExtension(long display, String name, long mop_return, |
|
485 |
long feve_return, long err_return); |
|
486 |
static native boolean IsKeypadKey(long keysym); |
|
487 |
static native long XdbeAllocateBackBufferName(long display, long window, int swap_action); |
|
488 |
static native int XdbeDeallocateBackBufferName(long display, long buffer); |
|
489 |
static native int XdbeBeginIdiom(long display); |
|
490 |
static native int XdbeEndIdiom(long display); |
|
491 |
static native int XdbeSwapBuffers(long display, long swap_info, int num_windows); |
|
492 |
||
1966
12a51fb0db0d
5100701: Toolkit.getLockingKeyState() does not work on XToolkit, but works on Motif
yan
parents:
439
diff
changeset
|
493 |
static native void XQueryKeymap(long display, long vector); |
2 | 494 |
static native long XKeycodeToKeysym(long display, int keycode, int index); |
495 |
||
496 |
static native int XKeysymToKeycode(long display, long keysym); |
|
497 |
||
2473
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
498 |
// xkb-related |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
499 |
static native int XkbGetEffectiveGroup(long display); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
500 |
static native long XkbKeycodeToKeysym(long display, int keycode, int group, int level); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
501 |
static native void XkbSelectEvents(long display, long device, long bits_to_change, long values_for_bits); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
502 |
static native void XkbSelectEventDetails(long display, long device, long event_type, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
503 |
long bits_to_change, long values_for_bits); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
504 |
static native boolean XkbQueryExtension(long display, long opcode_rtrn, long event_rtrn, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
505 |
long error_rtrn, long major_in_out, long minor_in_out); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
506 |
static native boolean XkbLibraryVersion(long lib_major_in_out, long lib_minor_in_out); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
507 |
static native long XkbGetMap(long display, long which, long device_spec); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
508 |
static native long XkbGetUpdatedMap(long display, long which, long xkb); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
509 |
static native void XkbFreeKeyboard(long xkb, long which, boolean free_all); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
510 |
static native boolean XkbTranslateKeyCode(long xkb, int keycode, long mods, long mods_rtrn, long keysym_rtrn); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
511 |
|
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
512 |
|
2 | 513 |
static native void XConvertCase(long keysym, |
514 |
long keysym_lowercase, |
|
515 |
long keysym_uppercase); |
|
516 |
||
517 |
static native long XGetModifierMapping(long display); |
|
4370
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
518 |
static native void XFreeModifiermap(long keymap); |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
519 |
static native void XRefreshKeyboardMapping(long event); |
2 | 520 |
|
521 |
||
522 |
static native void XChangeActivePointerGrab(long display, int mask, |
|
523 |
long cursor, long time); |
|
524 |
||
525 |
/* |
|
526 |
int (*XSynchronize(Display *display, Bool onoff))(); |
|
527 |
display Specifies the connection to the X server. |
|
528 |
onoff Specifies a Boolean value that indicates whether to enable or disable synchronization. |
|
529 |
*/ |
|
530 |
public static native int XSynchronize(long display, boolean onoff); |
|
531 |
||
532 |
/** |
|
533 |
* Extracts an X event that can be processed in a secondary loop. |
|
534 |
* Should only be called on the toolkit thread. |
|
535 |
* Returns false if this secondary event was terminated. |
|
536 |
*/ |
|
537 |
static native boolean XNextSecondaryLoopEvent(long display, long ptr); |
|
538 |
/** |
|
539 |
* Terminates the topmost secondary loop (if any). |
|
540 |
* Should never be called on the toolkit thread. |
|
541 |
*/ |
|
542 |
static native void ExitSecondaryLoop(); |
|
543 |
||
544 |
/** |
|
545 |
* Calls XTextPropertyToStringList on the specified byte array and returns |
|
546 |
* the array of strings. |
|
547 |
*/ |
|
548 |
static native String[] XTextPropertyToStringList(byte[] bytes, long encoding_atom); |
|
549 |
||
550 |
/** |
|
551 |
* XSHAPE extension support. |
|
552 |
*/ |
|
553 |
static native boolean XShapeQueryExtension(long display, long event_base_return, long error_base_return); |
|
554 |
static native void SetRectangularShape(long display, long window, |
|
555 |
int lox, int loy, int hix, int hiy, |
|
556 |
sun.java2d.pipe.Region region); |
|
2472
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
557 |
/** Each int in the bitmap array is one pixel with a 32-bit color: |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
558 |
* R, G, B, and Alpha. |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
559 |
*/ |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
560 |
static native void SetBitmapShape(long display, long window, |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
561 |
int width, int height, int[] bitmap); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
562 |
|
2462
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1966
diff
changeset
|
563 |
static native void SetZOrder(long display, long window, long above); |
2 | 564 |
|
565 |
/* Global memory area used for X lib parameter passing */ |
|
566 |
||
567 |
final static long lbuffer = unsafe.allocateMemory(64); // array to hold 8 longs |
|
568 |
final static long ibuffer = unsafe.allocateMemory(32); // array to hold 8 ints |
|
569 |
||
570 |
static final long larg1 = lbuffer; |
|
571 |
static final long larg2 = larg1+8; |
|
572 |
static final long larg3 = larg2+8; |
|
573 |
static final long larg4 = larg3+8; |
|
574 |
static final long larg5 = larg4+8; |
|
575 |
static final long larg6 = larg5+8; |
|
576 |
static final long larg7 = larg6+8; |
|
577 |
static final long larg8 = larg7+8; |
|
578 |
||
579 |
static final long iarg1 = ibuffer; |
|
580 |
static final long iarg2 = iarg1+4; |
|
581 |
static final long iarg3 = iarg2+4; |
|
582 |
static final long iarg4 = iarg3+4; |
|
583 |
static final long iarg5 = iarg4+4; |
|
584 |
static final long iarg6 = iarg5+4; |
|
585 |
static final long iarg7 = iarg6+4; |
|
586 |
static final long iarg8 = iarg7+4; |
|
587 |
||
588 |
||
589 |
static int dataModel; |
|
590 |
static final boolean isBuildInternal; |
|
591 |
||
592 |
static { |
|
593 |
String dataModelProp = (String)AccessController.doPrivileged( |
|
594 |
new PrivilegedAction() { |
|
595 |
public Object run() { |
|
596 |
return System.getProperty("sun.arch.data.model"); |
|
597 |
} |
|
598 |
}); |
|
599 |
try { |
|
600 |
dataModel = Integer.parseInt(dataModelProp); |
|
601 |
} catch (Exception e) { |
|
602 |
dataModel = 32; |
|
603 |
} |
|
604 |
||
605 |
isBuildInternal = getBuildInternal(); |
|
606 |
||
607 |
// System.loadLibrary("mawt"); |
|
608 |
} |
|
609 |
||
610 |
static int getDataModel() { |
|
611 |
return dataModel; |
|
612 |
} |
|
613 |
||
614 |
static String hintsToString(long flags) { |
|
615 |
StringBuffer buf = new StringBuffer(); |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
616 |
if ((flags & XUtilConstants.PMaxSize) != 0) { |
2 | 617 |
buf.append("PMaxSize "); |
618 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
619 |
if ((flags & XUtilConstants.PMinSize) != 0) { |
2 | 620 |
buf.append("PMinSize "); |
621 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
622 |
if ((flags & XUtilConstants.USSize) != 0) { |
2 | 623 |
buf.append("USSize "); |
624 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
625 |
if ((flags & XUtilConstants.USPosition) != 0) { |
2 | 626 |
buf.append("USPosition "); |
627 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
628 |
if ((flags & XUtilConstants.PPosition) != 0) { |
2 | 629 |
buf.append("PPosition "); |
630 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
631 |
if ((flags & XUtilConstants.PSize) != 0) { |
2 | 632 |
buf.append("PSize "); |
633 |
} |
|
439
3488710b02f8
6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents:
2
diff
changeset
|
634 |
if ((flags & XUtilConstants.PWinGravity) != 0) { |
2 | 635 |
buf.append("PWinGravity "); |
636 |
} |
|
637 |
return buf.toString(); |
|
638 |
} |
|
2473
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
639 |
static String getEventToString( int type ) { |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
640 |
if( (type >= 0) && (type < eventToString.length)) { |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
641 |
return eventToString[type]; |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
642 |
}else if( type == XToolkit.getXKBBaseEventCode() ) { |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
643 |
//XXX TODO various xkb types |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
644 |
return "XkbEvent"; |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
645 |
} |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
646 |
return eventToString[0]; |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
647 |
} |
2 | 648 |
|
649 |
private static boolean getBuildInternal() { |
|
650 |
String javaVersion = XToolkit.getSystemProperty("java.version"); |
|
651 |
return javaVersion != null && javaVersion.contains("internal"); |
|
652 |
} |
|
2802
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
653 |
|
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
654 |
static native void PrintXErrorEvent(long display, long event_ptr); |
2 | 655 |
} |