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