author | chegar |
Mon, 17 Jun 2013 11:26:16 +0100 | |
changeset 18274 | 7c4289125569 |
parent 18253 | 4323a5fe8bc4 |
parent 17903 | 643f1ca93dd6 |
child 20155 | 65bcc88496eb |
permissions | -rw-r--r-- |
2 | 1 |
/* |
17679
a81555868357
8005607: Recursion in J2DXErrHandler() Causes a Stack Overflow on Linux
alitvinov
parents:
14659
diff
changeset
|
2 |
* Copyright (c) 2002, 2013, 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 |
#include "sun_awt_X11_XlibWrapper.h" |
|
27 |
#include <X11/Xlib.h> |
|
28 |
#include <X11/keysym.h> |
|
29 |
#include <X11/Xutil.h> |
|
30 |
#include <X11/Xos.h> |
|
31 |
#include <X11/Xatom.h> |
|
32 |
#include <X11/extensions/Xdbe.h> |
|
33 |
#include <X11/extensions/shape.h> |
|
34 |
#include <string.h> |
|
35 |
#include <stdlib.h> |
|
4370
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
36 |
#include <X11/Sunkeysym.h> |
2 | 37 |
|
38 |
#include <jni.h> |
|
39 |
#include <jni_util.h> |
|
40 |
#include <jlong.h> |
|
18232 | 41 |
#include <sizecalc.h> |
2 | 42 |
|
43 |
#include <awt.h> |
|
44 |
#include <jvm.h> |
|
45 |
||
46 |
#include <Region.h> |
|
2472
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
47 |
#include "utility/rect.h" |
2 | 48 |
|
2473
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
49 |
#include <X11/XKBlib.h> |
2 | 50 |
#if defined(DEBUG) || defined(INTERNAL_BUILD) |
51 |
static jmethodID lockIsHeldMID = NULL; |
|
52 |
||
53 |
static void |
|
54 |
CheckHaveAWTLock(JNIEnv *env) |
|
55 |
{ |
|
56 |
if (lockIsHeldMID == NULL) { |
|
57 |
if (tkClass == NULL) return; |
|
58 |
lockIsHeldMID = |
|
59 |
(*env)->GetStaticMethodID(env, tkClass, |
|
60 |
"isAWTLockHeldByCurrentThread", "()Z"); |
|
61 |
} |
|
62 |
if (!(*env)->CallStaticBooleanMethod(env, tkClass, lockIsHeldMID)) { |
|
63 |
JNU_ThrowInternalError(env, "Current thread does not hold AWT_LOCK!"); |
|
64 |
} |
|
65 |
} |
|
66 |
||
67 |
#define AWT_CHECK_HAVE_LOCK() CheckHaveAWTLock(env) |
|
68 |
#else |
|
69 |
#define AWT_CHECK_HAVE_LOCK() |
|
70 |
#endif |
|
71 |
||
72 |
||
73 |
/* |
|
74 |
* Class: XlibWrapper |
|
75 |
* Method: XOpenDisplay |
|
76 |
* Signature: (J)J |
|
77 |
*/ |
|
78 |
||
79 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XOpenDisplay |
|
80 |
(JNIEnv *env, jclass clazz, jlong display_name) |
|
81 |
{ |
|
82 |
Display *dp; |
|
83 |
AWT_CHECK_HAVE_LOCK(); |
|
84 |
dp = XOpenDisplay((char *) jlong_to_ptr(display_name)); |
|
85 |
||
86 |
return ptr_to_jlong(dp); |
|
87 |
} |
|
88 |
||
89 |
JNIEXPORT void JNICALL |
|
90 |
Java_sun_awt_X11_XlibWrapper_XCloseDisplay(JNIEnv *env, jclass clazz, |
|
91 |
jlong display) { |
|
92 |
AWT_CHECK_HAVE_LOCK(); |
|
93 |
XCloseDisplay((Display*) jlong_to_ptr(display)); |
|
94 |
} |
|
95 |
||
96 |
JNIEXPORT jlong JNICALL |
|
97 |
Java_sun_awt_X11_XlibWrapper_XDisplayString(JNIEnv *env, jclass clazz, |
|
98 |
jlong display) { |
|
99 |
AWT_CHECK_HAVE_LOCK(); |
|
100 |
return ptr_to_jlong(XDisplayString((Display*) jlong_to_ptr(display))); |
|
101 |
} |
|
102 |
||
103 |
JNIEXPORT void JNICALL |
|
104 |
Java_sun_awt_X11_XlibWrapper_XSetCloseDownMode(JNIEnv *env, jclass clazz, |
|
105 |
jlong display, jint mode) { |
|
106 |
AWT_CHECK_HAVE_LOCK(); |
|
107 |
XSetCloseDownMode((Display*) jlong_to_ptr(display), (int)mode); |
|
108 |
} |
|
109 |
||
110 |
/* |
|
111 |
* Class: sun_awt_X11_XlibWrapper |
|
112 |
* Method: DefaultScreen |
|
113 |
* Signature: (J)J |
|
114 |
*/ |
|
115 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_DefaultScreen (JNIEnv *env, jclass clazz, jlong display) { |
|
116 |
||
117 |
AWT_CHECK_HAVE_LOCK(); |
|
118 |
return (jlong) DefaultScreen((Display *) jlong_to_ptr(display)); |
|
119 |
} |
|
120 |
||
121 |
/* |
|
122 |
* Class: sun_awt_X11_XlibWrapper |
|
123 |
* Method: ScreenOfDisplay |
|
124 |
* Signature: (JJ)J |
|
125 |
*/ |
|
126 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_ScreenOfDisplay(JNIEnv *env, jclass clazz, jlong display, jlong screen_number) { |
|
127 |
AWT_CHECK_HAVE_LOCK(); |
|
128 |
return ptr_to_jlong(ScreenOfDisplay((Display *) jlong_to_ptr(display), |
|
129 |
screen_number)); |
|
130 |
} |
|
131 |
||
132 |
/* |
|
133 |
* Class: sun_awt_X11_XlibWrapper |
|
134 |
* Method: DoesBackingStore |
|
135 |
* Signature: (J)I |
|
136 |
*/ |
|
137 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_DoesBackingStore(JNIEnv *env, jclass clazz, jlong screen) { |
|
138 |
AWT_CHECK_HAVE_LOCK(); |
|
139 |
return (jint) DoesBackingStore((Screen*) jlong_to_ptr(screen)); |
|
140 |
} |
|
141 |
||
142 |
/* |
|
143 |
* Class: sun_awt_X11_XlibWrapper |
|
144 |
* Method: DisplayWidth |
|
145 |
* Signature: (JJ)J |
|
146 |
*/ |
|
147 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_DisplayWidth |
|
148 |
(JNIEnv *env, jclass clazz, jlong display, jlong screen) { |
|
149 |
||
150 |
AWT_CHECK_HAVE_LOCK(); |
|
151 |
return (jlong) DisplayWidth((Display *) jlong_to_ptr(display),screen); |
|
152 |
||
153 |
} |
|
154 |
||
155 |
/* |
|
156 |
* Class: sun_awt_X11_XlibWrapper |
|
157 |
* Method: DisplayWidthMM |
|
158 |
* Signature: (JJ)J |
|
159 |
*/ |
|
160 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_DisplayWidthMM |
|
161 |
(JNIEnv *env, jclass clazz, jlong display, jlong screen) { |
|
162 |
AWT_CHECK_HAVE_LOCK(); |
|
163 |
return (jlong) DisplayWidthMM((Display *) jlong_to_ptr(display),screen); |
|
164 |
} |
|
165 |
||
166 |
/* |
|
167 |
* Class: sun_awt_X11_XlibWrapper |
|
168 |
* Method: DisplayHeight |
|
169 |
* Signature: (JJ)J |
|
170 |
*/ |
|
171 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_DisplayHeight |
|
172 |
(JNIEnv *env, jclass clazz, jlong display, jlong screen) { |
|
173 |
||
174 |
AWT_CHECK_HAVE_LOCK(); |
|
175 |
return (jlong) DisplayHeight((Display *) jlong_to_ptr(display),screen); |
|
176 |
} |
|
177 |
/* |
|
178 |
* Class: sun_awt_X11_XlibWrapper |
|
179 |
* Method: DisplayHeightMM |
|
180 |
* Signature: (JJ)J |
|
181 |
*/ |
|
182 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_DisplayHeightMM |
|
183 |
(JNIEnv *env, jclass clazz, jlong display, jlong screen) { |
|
184 |
AWT_CHECK_HAVE_LOCK(); |
|
185 |
return (jlong) DisplayHeightMM((Display *) jlong_to_ptr(display),screen); |
|
186 |
} |
|
187 |
||
188 |
/* |
|
189 |
* Class: sun_awt_X11_XlibWrapper |
|
190 |
* Method: RootWindow |
|
191 |
* Signature: (JJ)J |
|
192 |
*/ |
|
193 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_RootWindow |
|
194 |
(JNIEnv *env , jclass clazz, jlong display, jlong screen_number) { |
|
195 |
AWT_CHECK_HAVE_LOCK(); |
|
196 |
return (jlong) RootWindow((Display *) jlong_to_ptr(display), screen_number); |
|
197 |
} |
|
198 |
||
199 |
/* |
|
200 |
* Class: sun_awt_X11_XlibWrapper |
|
201 |
* Method: ScreenCount |
|
202 |
*/ |
|
203 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_ScreenCount |
|
204 |
(JNIEnv *env , jclass clazz, jlong display) { |
|
205 |
AWT_CHECK_HAVE_LOCK(); |
|
206 |
return ScreenCount((Display *) jlong_to_ptr(display)); |
|
207 |
} |
|
208 |
||
209 |
||
210 |
/* |
|
211 |
* Class: XlibWrapper |
|
212 |
* Method: XCreateWindow |
|
213 |
* Signature: (JJIIIIIIJJJJ)J |
|
214 |
*/ |
|
215 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XCreateWindow |
|
216 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, |
|
217 |
jint x, jint y, jint w, jint h , jint border_width, jint depth, |
|
218 |
jlong wclass, jlong visual, jlong valuemask, jlong attributes) |
|
219 |
{ |
|
220 |
AWT_CHECK_HAVE_LOCK(); |
|
221 |
return XCreateWindow((Display *) jlong_to_ptr(display),(Window) window, x, y, w, h, |
|
222 |
border_width, depth, wclass, (Visual *) jlong_to_ptr(visual), |
|
223 |
valuemask, (XSetWindowAttributes *) jlong_to_ptr(attributes)); |
|
224 |
||
225 |
} |
|
226 |
||
227 |
/* |
|
228 |
* Class: XlibWrapper |
|
229 |
* Method: XConvertCase |
|
230 |
* Signature: (JJJ)V |
|
231 |
*/ |
|
232 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XConvertCase |
|
233 |
(JNIEnv *env, jclass clazz, jlong keysym, |
|
234 |
jlong keysym_lowercase, jlong keysym_uppercase) |
|
235 |
{ |
|
236 |
AWT_CHECK_HAVE_LOCK(); |
|
237 |
XConvertCase(keysym, (jlong_to_ptr(keysym_lowercase)), |
|
238 |
(jlong_to_ptr(keysym_uppercase))); |
|
239 |
} |
|
240 |
||
241 |
||
242 |
/* |
|
243 |
* Class: XlibWrapper |
|
244 |
* Method: XMapWindow |
|
245 |
* Signature: (JJ)V |
|
246 |
*/ |
|
247 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMapWindow |
|
248 |
(JNIEnv *env, jclass clazz, jlong display, jlong window) |
|
249 |
{ |
|
250 |
AWT_CHECK_HAVE_LOCK(); |
|
251 |
XMapWindow( (Display *)jlong_to_ptr(display),(Window) window); |
|
252 |
||
253 |
} |
|
254 |
||
255 |
/* |
|
256 |
* Class: XlibWrapper |
|
257 |
* Method: XMapRaised |
|
258 |
* Signature: (JJ)V |
|
259 |
*/ |
|
260 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMapRaised |
|
261 |
(JNIEnv *env, jclass clazz, jlong display, jlong window) |
|
262 |
{ |
|
263 |
AWT_CHECK_HAVE_LOCK(); |
|
264 |
XMapRaised( (Display *)jlong_to_ptr(display),(Window) window); |
|
265 |
||
266 |
} |
|
267 |
||
268 |
/* |
|
269 |
* Class: XlibWrapper |
|
270 |
* Method: XRaiseWindow |
|
271 |
* Signature: (JJ)V |
|
272 |
*/ |
|
273 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XRaiseWindow |
|
274 |
(JNIEnv *env, jclass clazz, jlong display, jlong window) |
|
275 |
{ |
|
276 |
||
277 |
AWT_CHECK_HAVE_LOCK(); |
|
278 |
XRaiseWindow( (Display *)jlong_to_ptr(display),(Window) window); |
|
279 |
||
280 |
} |
|
281 |
||
282 |
/* |
|
283 |
* Class: XlibWrapper |
|
284 |
* Method: XLowerWindow |
|
285 |
* Signature: (JJ)V |
|
286 |
*/ |
|
287 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XLowerWindow |
|
288 |
(JNIEnv *env, jclass clazz, jlong display, jlong window) |
|
289 |
{ |
|
290 |
||
291 |
AWT_CHECK_HAVE_LOCK(); |
|
292 |
XLowerWindow( (Display *)jlong_to_ptr(display),(Window) window); |
|
293 |
||
294 |
} |
|
295 |
||
296 |
/* |
|
297 |
* Class: XlibWrapper |
|
298 |
* Method: XRestackWindows |
|
299 |
* Signature: (JJI)V |
|
300 |
*/ |
|
301 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XRestackWindows |
|
302 |
(JNIEnv *env, jclass clazz, jlong display, jlong windows, jint length) |
|
303 |
{ |
|
304 |
||
305 |
AWT_CHECK_HAVE_LOCK(); |
|
306 |
XRestackWindows( (Display *) jlong_to_ptr(display), (Window *) jlong_to_ptr(windows), length); |
|
307 |
||
308 |
} |
|
309 |
||
310 |
/* |
|
311 |
* Class: XlibWrapper |
|
2472
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
312 |
* Method: XConfigureWindow |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
313 |
* Signature: (JJJJ)V |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
314 |
*/ |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
315 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XConfigureWindow |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
316 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong value_mask, |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
317 |
jlong values) |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
318 |
{ |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
319 |
AWT_CHECK_HAVE_LOCK(); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
320 |
XConfigureWindow((Display*)jlong_to_ptr(display), (Window)window, |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
321 |
(unsigned int)value_mask, (XWindowChanges*)jlong_to_ptr(values)); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
322 |
} |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
323 |
|
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
324 |
/* |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
325 |
* Class: XlibWrapper |
2 | 326 |
* Method: XSetInputFocus |
327 |
* Signature: (JJ)V |
|
328 |
*/ |
|
329 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetInputFocus |
|
330 |
(JNIEnv *env, jclass clazz, jlong display, jlong window) |
|
331 |
{ |
|
332 |
||
333 |
AWT_CHECK_HAVE_LOCK(); |
|
334 |
XSetInputFocus( (Display *)jlong_to_ptr(display),(Window) window, RevertToPointerRoot, CurrentTime); |
|
335 |
||
336 |
} |
|
337 |
/* |
|
338 |
* Class: XlibWrapper |
|
339 |
* Method: XSetInputFocus2 |
|
340 |
* Signature: (JJJ)V |
|
341 |
*/ |
|
342 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetInputFocus2 |
|
343 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong time) |
|
344 |
{ |
|
345 |
||
346 |
AWT_CHECK_HAVE_LOCK(); |
|
347 |
XSetInputFocus( (Display *)jlong_to_ptr(display),(Window) window, RevertToPointerRoot, time); |
|
348 |
||
349 |
} |
|
350 |
||
351 |
/* |
|
352 |
* Class: XlibWrapper |
|
353 |
* Method: XGetInputFocus |
|
354 |
* Signature: (JJ)V |
|
355 |
*/ |
|
356 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XGetInputFocus |
|
357 |
(JNIEnv *env, jclass clazz, jlong display) |
|
358 |
{ |
|
359 |
||
360 |
Window focusOwner; |
|
361 |
int revert_to; |
|
362 |
AWT_CHECK_HAVE_LOCK(); |
|
363 |
XGetInputFocus( (Display *)jlong_to_ptr(display), &focusOwner, &revert_to); |
|
364 |
return focusOwner; |
|
365 |
} |
|
366 |
||
367 |
||
368 |
/* |
|
369 |
* Class: XlibWrapper |
|
370 |
* Method: XDestroyWindow |
|
371 |
* Signature: (JJ)V |
|
372 |
*/ |
|
373 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XDestroyWindow |
|
374 |
(JNIEnv *env, jclass clazz, jlong display, jlong window) |
|
375 |
{ |
|
376 |
AWT_CHECK_HAVE_LOCK(); |
|
377 |
XDestroyWindow( (Display *)jlong_to_ptr(display),(Window) window); |
|
378 |
} |
|
379 |
||
433
a7f6bc61993d
6677332: incorrect signatures for JNI methods in XWindow.c and XlibWrapper.c
son
parents:
2
diff
changeset
|
380 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGrabPointer |
2 | 381 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, |
382 |
jint owner_events, jint event_mask, jint pointer_mode, |
|
383 |
jint keyboard_mode, jlong confine_to, jlong cursor, jlong time) |
|
384 |
{ |
|
385 |
AWT_CHECK_HAVE_LOCK(); |
|
386 |
return XGrabPointer( (Display *)jlong_to_ptr(display), (Window) window, |
|
387 |
(Bool) owner_events, (unsigned int) event_mask, (int) pointer_mode, |
|
388 |
(int) keyboard_mode, (Window) confine_to, (Cursor) cursor, (Time) time); |
|
389 |
} |
|
390 |
||
391 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XUngrabPointer |
|
392 |
(JNIEnv *env, jclass clazz, jlong display, jlong time) |
|
393 |
{ |
|
394 |
AWT_CHECK_HAVE_LOCK(); |
|
395 |
XUngrabPointer( (Display *)jlong_to_ptr(display), (Time) time); |
|
396 |
} |
|
397 |
||
433
a7f6bc61993d
6677332: incorrect signatures for JNI methods in XWindow.c and XlibWrapper.c
son
parents:
2
diff
changeset
|
398 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGrabKeyboard |
2 | 399 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, |
400 |
jint owner_events, jint pointer_mode, |
|
401 |
jint keyboard_mode, jlong time) |
|
402 |
{ |
|
403 |
AWT_CHECK_HAVE_LOCK(); |
|
404 |
return XGrabKeyboard( (Display *)jlong_to_ptr(display), (Window) window, |
|
405 |
(Bool) owner_events, (int) pointer_mode, |
|
406 |
(int) keyboard_mode, (Time) time); |
|
407 |
} |
|
408 |
||
409 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XUngrabKeyboard |
|
410 |
(JNIEnv *env, jclass clazz, jlong display, jlong time) |
|
411 |
{ |
|
412 |
AWT_CHECK_HAVE_LOCK(); |
|
413 |
XUngrabKeyboard( (Display *)jlong_to_ptr(display), (Time) time); |
|
414 |
} |
|
415 |
||
416 |
JNIEXPORT void JNICALL |
|
417 |
Java_sun_awt_X11_XlibWrapper_XGrabServer(JNIEnv *env, jclass clazz, |
|
418 |
jlong display) { |
|
419 |
AWT_CHECK_HAVE_LOCK(); |
|
420 |
XGrabServer((Display*)jlong_to_ptr(display)); |
|
421 |
} |
|
422 |
||
423 |
JNIEXPORT void JNICALL |
|
424 |
Java_sun_awt_X11_XlibWrapper_XUngrabServer(JNIEnv *env, jclass clazz, |
|
425 |
jlong display) { |
|
426 |
AWT_CHECK_HAVE_LOCK(); |
|
427 |
XUngrabServer((Display*)jlong_to_ptr(display)); |
|
428 |
/* Workaround for bug 5039226 */ |
|
429 |
XSync((Display*)jlong_to_ptr(display), False); |
|
430 |
} |
|
431 |
||
432 |
/* |
|
433 |
* Class: XlibWrapper |
|
434 |
* Method: XUnmapWindow |
|
435 |
* Signature: (JJ)V |
|
436 |
*/ |
|
437 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XUnmapWindow |
|
438 |
(JNIEnv *env, jclass clazz, jlong display, jlong window) |
|
439 |
{ |
|
440 |
||
441 |
AWT_CHECK_HAVE_LOCK(); |
|
442 |
XUnmapWindow( (Display *)jlong_to_ptr(display),(Window) window); |
|
443 |
||
444 |
} |
|
445 |
||
446 |
||
447 |
||
448 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSelectInput |
|
449 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong mask) |
|
450 |
{ |
|
451 |
AWT_CHECK_HAVE_LOCK(); |
|
452 |
XSelectInput((Display *) jlong_to_ptr(display), (Window) window, mask); |
|
453 |
} |
|
454 |
||
2473
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
455 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSelectEvents |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
456 |
(JNIEnv *env, jclass clazz, jlong display, jlong device, jlong bits_to_change, jlong values_for_bits) |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
457 |
{ |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
458 |
AWT_CHECK_HAVE_LOCK(); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
459 |
XkbSelectEvents((Display *) jlong_to_ptr(display), (unsigned int)device, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
460 |
(unsigned long)bits_to_change, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
461 |
(unsigned long)values_for_bits); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
462 |
} |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
463 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSelectEventDetails |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
464 |
(JNIEnv *env, jclass clazz, jlong display, jlong device, jlong event_type, jlong bits_to_change, jlong values_for_bits) |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
465 |
{ |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
466 |
AWT_CHECK_HAVE_LOCK(); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
467 |
XkbSelectEventDetails((Display *) jlong_to_ptr(display), (unsigned int)device, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
468 |
(unsigned int) event_type, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
469 |
(unsigned long)bits_to_change, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
470 |
(unsigned long)values_for_bits); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
471 |
} |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
472 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbQueryExtension |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
473 |
(JNIEnv *env, jclass clazz, jlong display, jlong opcode_rtrn, jlong event_rtrn, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
474 |
jlong error_rtrn, jlong major_in_out, jlong minor_in_out) |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
475 |
{ |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
476 |
AWT_CHECK_HAVE_LOCK(); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
477 |
return XkbQueryExtension( (Display *) jlong_to_ptr(display), |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
478 |
(int *) jlong_to_ptr(opcode_rtrn), |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
479 |
(int *) jlong_to_ptr(event_rtrn), |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
480 |
(int *) jlong_to_ptr(error_rtrn), |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
481 |
(int *) jlong_to_ptr(major_in_out), |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
482 |
(int *) jlong_to_ptr(minor_in_out)); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
483 |
} |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
484 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
485 |
(JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out) |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
486 |
{ |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
487 |
AWT_CHECK_HAVE_LOCK(); |
6825 | 488 |
*((int *)jlong_to_ptr(lib_major_in_out)) = XkbMajorVersion; |
489 |
*((int *)jlong_to_ptr(lib_minor_in_out)) = XkbMinorVersion; |
|
2473
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
490 |
return XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out), (int *)jlong_to_ptr(lib_minor_in_out)); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
491 |
} |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
492 |
|
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
493 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetMap |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
494 |
(JNIEnv *env, jclass clazz, jlong display, jlong which, jlong device_spec) |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
495 |
{ |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
496 |
AWT_CHECK_HAVE_LOCK(); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
497 |
return (jlong) XkbGetMap( (Display *) jlong_to_ptr(display), |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
498 |
(unsigned int) which, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
499 |
(unsigned int) device_spec); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
500 |
} |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
501 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetUpdatedMap |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
502 |
(JNIEnv *env, jclass clazz, jlong display, jlong which, jlong xkb) |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
503 |
{ |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
504 |
AWT_CHECK_HAVE_LOCK(); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
505 |
return (jlong) XkbGetUpdatedMap( (Display *) jlong_to_ptr(display), |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
506 |
(unsigned int) which, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
507 |
(XkbDescPtr) jlong_to_ptr(xkb)); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
508 |
} |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
509 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbFreeKeyboard |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
510 |
(JNIEnv *env, jclass clazz, jlong xkb, jlong which, jboolean free_all) |
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 |
AWT_CHECK_HAVE_LOCK(); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
513 |
XkbFreeKeyboard(jlong_to_ptr(xkb), (unsigned int)which, free_all); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
514 |
} |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
515 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
516 |
(JNIEnv *env, jclass clazz, jlong xkb, jint keycode, jlong mods, jlong mods_rtrn, jlong keysym_rtrn) |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
517 |
{ |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
518 |
Bool b; |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
519 |
b = XkbTranslateKeyCode((XkbDescPtr)xkb, (unsigned int)keycode, (unsigned int)mods, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
520 |
(unsigned int *)jlong_to_ptr(mods_rtrn), |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
521 |
(KeySym *)jlong_to_ptr(keysym_rtrn)); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
522 |
//printf("native, input: keycode:0x%0X; mods:0x%0X\n", keycode, mods); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
523 |
//printf("native, output: keysym:0x%0X; mods:0x%0X\n", *(unsigned int *)jlong_to_ptr(keysym_rtrn), *(unsigned int *)jlong_to_ptr(mods_rtrn)); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
524 |
return b; |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
525 |
} |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
526 |
|
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
527 |
|
2 | 528 |
/* |
529 |
* Class: sun_awt_X11_XlibWrapper |
|
530 |
* Method: XNextEvent |
|
531 |
* Signature: (JJ)V |
|
532 |
*/ |
|
533 |
||
534 |
||
535 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XNextEvent |
|
536 |
(JNIEnv *env, jclass clazz, jlong display, jlong ptr) |
|
537 |
{ |
|
538 |
AWT_CHECK_HAVE_LOCK(); |
|
539 |
XNextEvent( (Display *) jlong_to_ptr(display), jlong_to_ptr(ptr)); |
|
540 |
} |
|
541 |
||
542 |
/* |
|
543 |
* Class: sun_awt_X11_XlibWrapper |
|
544 |
* Method: XMaskEvent |
|
545 |
* Signature: (JJJ)V |
|
546 |
*/ |
|
547 |
||
548 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMaskEvent |
|
549 |
(JNIEnv *env, jclass clazz, jlong display, jlong event_mask, jlong event_return) |
|
550 |
{ |
|
551 |
AWT_CHECK_HAVE_LOCK(); |
|
552 |
XMaskEvent( (Display *) jlong_to_ptr(display), event_mask, (XEvent *) jlong_to_ptr(event_return)); |
|
553 |
} |
|
554 |
||
555 |
/* |
|
556 |
* Class: sun_awt_X11_XlibWrapper |
|
557 |
* Method: XWindowEvent |
|
558 |
* Signature: (JJJJ)V |
|
559 |
*/ |
|
560 |
||
561 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XWindowEvent |
|
562 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong event_mask, jlong event_return) |
|
563 |
{ |
|
564 |
AWT_CHECK_HAVE_LOCK(); |
|
565 |
XWindowEvent( (Display *) jlong_to_ptr(display), (Window)window, event_mask, (XEvent *) jlong_to_ptr(event_return)); |
|
566 |
} |
|
567 |
||
568 |
/* |
|
569 |
* Class: sun_awt_X11_XlibWrapper |
|
570 |
* Method: XFilterEvent |
|
571 |
* Signature: (JJ)Z |
|
572 |
*/ |
|
573 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XFilterEvent |
|
574 |
(JNIEnv *env, jclass clazz, jlong ptr, jlong window) |
|
575 |
{ |
|
576 |
AWT_CHECK_HAVE_LOCK(); |
|
577 |
return (jboolean) XFilterEvent((XEvent *) jlong_to_ptr(ptr), (Window) window); |
|
578 |
} |
|
579 |
||
580 |
/* |
|
581 |
* Class: sun_awt_X11_XlibWrapper |
|
582 |
* Method: XSupportsLocale |
|
583 |
* Signature: ()Z |
|
584 |
*/ |
|
585 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XSupportsLocale |
|
586 |
(JNIEnv *env, jclass clazz) |
|
587 |
{ |
|
588 |
AWT_CHECK_HAVE_LOCK(); |
|
589 |
return (jboolean)XSupportsLocale(); |
|
590 |
} |
|
591 |
||
592 |
/* |
|
593 |
* Class: sun_awt_X11_XlibWrapper |
|
594 |
* Method: XSetLocaleModifiers |
|
595 |
* Signature: (Ljava/lang/String;)Ljava/lang/String; |
|
596 |
*/ |
|
597 |
JNIEXPORT jstring JNICALL Java_sun_awt_X11_XlibWrapper_XSetLocaleModifiers |
|
598 |
(JNIEnv *env, jclass clazz, jstring jstr) |
|
599 |
{ |
|
600 |
char * modifier_list = NULL; |
|
601 |
char * ret = NULL; |
|
602 |
||
603 |
if (!JNU_IsNull(env, jstr)) { |
|
604 |
modifier_list = (char *)JNU_GetStringPlatformChars(env, jstr, NULL); |
|
605 |
} |
|
606 |
||
607 |
AWT_CHECK_HAVE_LOCK(); |
|
608 |
if (modifier_list) { |
|
609 |
ret = XSetLocaleModifiers(modifier_list); |
|
610 |
JNU_ReleaseStringPlatformChars(env, jstr, (const char *) modifier_list); |
|
611 |
} else { |
|
612 |
ret = XSetLocaleModifiers(""); |
|
613 |
} |
|
614 |
||
615 |
return (ret != NULL ? JNU_NewStringPlatform(env, ret): NULL); |
|
616 |
} |
|
617 |
||
618 |
||
619 |
/* |
|
620 |
* Class: sun_awt_X11_wrappers_XlibWrapper |
|
621 |
* Method: XPeekEvent |
|
622 |
* Signature: (JJ)V |
|
623 |
*/ |
|
624 |
||
625 |
||
626 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XPeekEvent |
|
627 |
(JNIEnv *env, jclass clazz, jlong display, jlong ptr) |
|
628 |
{ |
|
629 |
AWT_CHECK_HAVE_LOCK(); |
|
630 |
XPeekEvent((Display *) jlong_to_ptr(display),jlong_to_ptr(ptr)); |
|
631 |
} |
|
632 |
||
633 |
||
634 |
/* |
|
635 |
* Class: sun_awt_X11_XlibWrapper |
|
636 |
* Method: XMoveResizeWindow |
|
637 |
* Signature: (JJIIII)V |
|
638 |
*/ |
|
639 |
||
640 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMoveResizeWindow |
|
641 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jint x , jint y , jint width, jint height) { |
|
642 |
||
643 |
AWT_CHECK_HAVE_LOCK(); |
|
644 |
XMoveResizeWindow( (Display *) jlong_to_ptr(display), (Window) window, x, y, width, height); |
|
645 |
||
646 |
} |
|
647 |
||
648 |
/* |
|
649 |
* Class: sun_awt_X11_XlibWrapper |
|
650 |
* Method: XResizeWindow |
|
651 |
* Signature: (JJII)V |
|
652 |
*/ |
|
653 |
||
654 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XResizeWindow |
|
655 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jint width, jint height) |
|
656 |
{ |
|
657 |
AWT_CHECK_HAVE_LOCK(); |
|
658 |
XResizeWindow( (Display *) jlong_to_ptr(display),(Window) window,width,height); |
|
659 |
} |
|
660 |
||
661 |
/* |
|
662 |
* Class: sun_awt_X11_XlibWrapper |
|
663 |
* Method: XMoveWindow |
|
664 |
* Signature: (JJII)V |
|
665 |
*/ |
|
666 |
||
667 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XMoveWindow |
|
668 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jint width, jint height) |
|
669 |
{ |
|
670 |
AWT_CHECK_HAVE_LOCK(); |
|
671 |
XMoveWindow( (Display *) jlong_to_ptr(display),(Window) window,width,height); |
|
672 |
} |
|
673 |
||
674 |
||
675 |
/* |
|
676 |
* Class: sun_awt_X11_XlibWrapper |
|
677 |
* Method: XSetWindowBackground |
|
678 |
* Signature: (JJJ)V |
|
679 |
*/ |
|
680 |
||
681 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetWindowBackground |
|
682 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong background_pixel) { |
|
683 |
||
684 |
AWT_CHECK_HAVE_LOCK(); |
|
685 |
XSetWindowBackground((Display *) jlong_to_ptr(display),window,background_pixel); |
|
686 |
||
687 |
} |
|
688 |
||
689 |
||
690 |
/* |
|
691 |
* Class: sun_awt_X11_XlibWrapper |
|
692 |
* Method: XFlush |
|
693 |
* Signature: (J)V |
|
694 |
*/ |
|
695 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XFlush |
|
696 |
(JNIEnv *env, jclass clazz, jlong display) { |
|
697 |
||
698 |
AWT_CHECK_HAVE_LOCK(); |
|
699 |
XFlush((Display *)jlong_to_ptr(display)); |
|
700 |
} |
|
701 |
||
702 |
/* |
|
703 |
* Class: sun_awt_X11_XlibWrapper |
|
704 |
* Method: XSync |
|
705 |
* Signature: (JI)V |
|
706 |
*/ |
|
707 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSync |
|
708 |
(JNIEnv *env, jclass clazz, jlong display, jint discard) { |
|
709 |
||
710 |
AWT_CHECK_HAVE_LOCK(); |
|
711 |
XSync((Display *) jlong_to_ptr(display), discard); |
|
712 |
||
713 |
} |
|
714 |
||
433
a7f6bc61993d
6677332: incorrect signatures for JNI methods in XWindow.c and XlibWrapper.c
son
parents:
2
diff
changeset
|
715 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XTranslateCoordinates |
2 | 716 |
(JNIEnv *env, jclass clazz, jlong display, jlong src_w, jlong dest_w, |
717 |
jlong src_x, jlong src_y, jlong dest_x_return, jlong dest_y_return, |
|
718 |
jlong child_return) |
|
719 |
{ |
|
720 |
AWT_CHECK_HAVE_LOCK(); |
|
721 |
return XTranslateCoordinates( (Display *) jlong_to_ptr(display), src_w, dest_w, |
|
722 |
src_x, src_y, |
|
723 |
(int *) jlong_to_ptr(dest_x_return), |
|
724 |
(int *) jlong_to_ptr(dest_y_return), |
|
725 |
(Window *) jlong_to_ptr(child_return)); |
|
726 |
} |
|
727 |
||
433
a7f6bc61993d
6677332: incorrect signatures for JNI methods in XWindow.c and XlibWrapper.c
son
parents:
2
diff
changeset
|
728 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XEventsQueued |
2 | 729 |
(JNIEnv *env, jclass clazz, jlong display, jint mode) { |
730 |
||
731 |
AWT_CHECK_HAVE_LOCK(); |
|
732 |
return XEventsQueued((Display *) jlong_to_ptr(display), mode); |
|
733 |
||
734 |
} |
|
735 |
||
736 |
/* |
|
737 |
* Class: sun_awt_X11_XlibWrapper |
|
738 |
* Method: SetProperty |
|
739 |
* Signature: (JJJLjava/lang/String;)V |
|
740 |
*/ |
|
741 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_SetProperty |
|
742 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong atom, jstring jstr) { |
|
743 |
char *cname; |
|
744 |
XTextProperty tp; |
|
745 |
int32_t status; |
|
746 |
||
747 |
/* |
|
748 |
In case there are direct support of UTF-8 declared, use UTF-8 strings. |
|
749 |
*/ |
|
750 |
if (!JNU_IsNull(env, jstr)) { |
|
751 |
#ifdef X_HAVE_UTF8_STRING |
|
752 |
cname = (char *) (*env)->GetStringUTFChars(env, jstr, JNI_FALSE); |
|
753 |
#else |
|
754 |
cname = (char *) JNU_GetStringPlatformChars(env, jstr, NULL); |
|
755 |
#endif |
|
756 |
} else { |
|
757 |
cname = ""; |
|
758 |
} |
|
759 |
||
760 |
||
761 |
AWT_CHECK_HAVE_LOCK(); |
|
762 |
||
763 |
#ifdef X_HAVE_UTF8_STRING |
|
764 |
status = Xutf8TextListToTextProperty((Display *)jlong_to_ptr(display), &cname, 1, |
|
765 |
XStdICCTextStyle, &tp); |
|
766 |
#else |
|
767 |
status = XmbTextListToTextProperty((Display *)jlong_to_ptr(display), &cname, 1, |
|
768 |
XStdICCTextStyle, &tp); |
|
769 |
#endif |
|
770 |
||
771 |
||
772 |
if (status == Success || status > 0) { |
|
773 |
XChangeProperty((Display *)jlong_to_ptr(display), window, atom, tp.encoding, tp.format, PropModeReplace, tp.value, tp.nitems); |
|
774 |
if (tp.value != NULL) { |
|
775 |
XFree(tp.value); |
|
776 |
} |
|
777 |
} |
|
778 |
||
779 |
if (!JNU_IsNull(env, jstr)) { |
|
780 |
#ifdef X_HAVE_UTF8_STRING |
|
781 |
(*env)->ReleaseStringUTFChars(env, jstr, (const char *) cname); |
|
782 |
#else |
|
783 |
JNU_ReleaseStringPlatformChars(env, jstr, (const char *) cname); |
|
784 |
#endif |
|
785 |
} |
|
786 |
} |
|
787 |
||
788 |
/* |
|
789 |
* Class: sun_awt_X11_XlibWrapper |
|
790 |
* Method: XChangeProperty |
|
791 |
* Signature: (JJJJJJJJJJJ)V |
|
792 |
*/ |
|
793 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XChangePropertyImpl( |
|
794 |
JNIEnv *env, jclass clazz, jlong display, jlong window, jlong property, |
|
795 |
jlong type, jint format, jint mode, jlong data, jint nelements) |
|
796 |
{ |
|
797 |
AWT_CHECK_HAVE_LOCK(); |
|
798 |
XChangeProperty((Display*) jlong_to_ptr(display), (Window) window, (Atom) property, |
|
799 |
(Atom) type, format, mode, (unsigned char*) jlong_to_ptr(data), |
|
800 |
nelements); |
|
801 |
} |
|
802 |
/* |
|
803 |
* Class: sun_awt_X11_XlibWrapper |
|
804 |
* Method: XChangePropertyS |
|
805 |
* Signature: (JJJJJJJJJLjava/lang/String;)V |
|
806 |
*/ |
|
807 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XChangePropertyS( |
|
808 |
JNIEnv *env, jclass clazz, jlong display, jlong window, jlong property, |
|
809 |
jlong type, jint format, jint mode, jstring value) |
|
810 |
{ |
|
811 |
jboolean iscopy; |
|
812 |
const char * chars = JNU_GetStringPlatformChars(env, value, &iscopy); |
|
813 |
AWT_CHECK_HAVE_LOCK(); |
|
814 |
XChangeProperty((Display*)jlong_to_ptr(display), window, (Atom)property, |
|
815 |
(Atom)type, format, mode, (unsigned char*)chars, strlen(chars)); |
|
816 |
if (iscopy) { |
|
817 |
JNU_ReleaseStringPlatformChars(env, value, chars); |
|
818 |
} |
|
819 |
} |
|
820 |
||
821 |
/* |
|
822 |
* Class: sun_awt_X11_XlibWrapper |
|
823 |
* Method: XGetWindowProperty |
|
824 |
* Signature: (JJJJJJJJJJJ)J; |
|
825 |
*/ |
|
826 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGetWindowProperty |
|
827 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong property, jlong long_offset, |
|
828 |
jlong long_length, jlong delete, jlong req_type, jlong actual_type, |
|
829 |
jlong actual_format, jlong nitems_ptr, jlong bytes_after, jlong data_ptr) |
|
830 |
{ |
|
831 |
AWT_CHECK_HAVE_LOCK(); |
|
832 |
return XGetWindowProperty((Display*) jlong_to_ptr(display), window, property, long_offset, long_length, |
|
833 |
delete, (Atom) req_type, (Atom*) jlong_to_ptr(actual_type), |
|
834 |
(int *) jlong_to_ptr(actual_format), (unsigned long *) jlong_to_ptr(nitems_ptr), |
|
835 |
(unsigned long*) jlong_to_ptr(bytes_after), (unsigned char**) jlong_to_ptr(data_ptr)); |
|
836 |
} |
|
837 |
||
838 |
/* |
|
839 |
* Class: sun_awt_X11_XlibWrapper |
|
840 |
* Method: GetProperty |
|
841 |
* Signature: (JJJ)Ljava/lang/String; |
|
842 |
*/ |
|
843 |
JNIEXPORT jstring JNICALL Java_sun_awt_X11_XlibWrapper_GetProperty |
|
844 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong atom) |
|
845 |
{ |
|
846 |
/* Request status */ |
|
847 |
int status; |
|
848 |
||
849 |
/* Returns of XGetWindowProperty */ |
|
850 |
Atom actual_type; |
|
851 |
int actual_format; |
|
852 |
unsigned long nitems; |
|
853 |
unsigned long bytes_after; |
|
854 |
unsigned char * string; |
|
855 |
jstring res; |
|
856 |
AWT_CHECK_HAVE_LOCK(); |
|
857 |
status = XGetWindowProperty((Display*)jlong_to_ptr(display), window, |
|
858 |
atom, 0, 0xFFFF, False, XA_STRING, |
|
859 |
&actual_type, &actual_format, &nitems, &bytes_after, |
|
860 |
&string); |
|
861 |
if (status != Success || string == NULL) { |
|
862 |
return NULL; |
|
863 |
} |
|
864 |
||
865 |
if (actual_type != XA_STRING || actual_format != 8) { |
|
866 |
XFree(string); |
|
867 |
return NULL; |
|
868 |
} |
|
869 |
||
870 |
// Memory leak??? |
|
871 |
return JNU_NewStringPlatform(env,(char*) string); |
|
872 |
} |
|
873 |
||
874 |
/* |
|
875 |
* Class: sun_awt_X11_XlibWrapper |
|
876 |
* Method: InternAtom |
|
877 |
* Signature: (JLjava/lang/String;I)J |
|
878 |
*/ |
|
879 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_InternAtom |
|
880 |
(JNIEnv *env, jclass clazz, jlong display, jstring jstr, jint ife) { |
|
881 |
||
882 |
char *cname; |
|
883 |
unsigned long atom; |
|
884 |
||
885 |
if (!JNU_IsNull(env, jstr)) { |
|
886 |
cname = (char *)JNU_GetStringPlatformChars(env, jstr, NULL); |
|
887 |
} else { |
|
888 |
cname = ""; |
|
889 |
} |
|
890 |
||
891 |
AWT_CHECK_HAVE_LOCK(); |
|
892 |
atom = XInternAtom((Display *) jlong_to_ptr(display), cname, ife); |
|
893 |
||
894 |
if (!JNU_IsNull(env, jstr)) { |
|
895 |
JNU_ReleaseStringPlatformChars(env, jstr, (const char *) cname); |
|
896 |
} |
|
897 |
||
898 |
return (jlong) atom; |
|
899 |
||
900 |
} |
|
901 |
||
902 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XCreateFontCursor |
|
903 |
(JNIEnv *env, jclass clazz, jlong display, jint shape) { |
|
904 |
AWT_CHECK_HAVE_LOCK(); |
|
905 |
return XCreateFontCursor((Display *) jlong_to_ptr(display), (int) shape); |
|
906 |
} |
|
907 |
||
908 |
||
909 |
/* |
|
910 |
* Class: sun_awt_X11_XlibWrapper |
|
911 |
* Method: XCreatePixmapCursor |
|
912 |
* Signature: (JJJJJII)J |
|
913 |
*/ |
|
914 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XCreatePixmapCursor |
|
915 |
(JNIEnv *env , jclass clazz, jlong display, jlong source, jlong mask, jlong fore, jlong back, jint x , jint y) { |
|
916 |
||
917 |
AWT_CHECK_HAVE_LOCK(); |
|
918 |
return (jlong) XCreatePixmapCursor((Display *) jlong_to_ptr(display), (Pixmap) source, (Pixmap) mask, |
|
919 |
(XColor *) jlong_to_ptr(fore), (XColor *) jlong_to_ptr(back), x, y); |
|
920 |
} |
|
921 |
||
922 |
||
923 |
/* |
|
924 |
* Class: sun_awt_X11_XlibWrapper |
|
925 |
* Method: XQueryBestCursor |
|
926 |
* Signature: (JJIIJJ)Z |
|
927 |
*/ |
|
928 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XQueryBestCursor |
|
929 |
(JNIEnv *env, jclass clazz, jlong display, jlong drawable, jint width, jint height, jlong width_return, jlong height_return) { |
|
930 |
||
931 |
Status status; |
|
932 |
||
933 |
AWT_CHECK_HAVE_LOCK(); |
|
934 |
status = XQueryBestCursor((Display *) jlong_to_ptr(display), (Drawable) drawable, width,height, |
|
935 |
(unsigned int *) jlong_to_ptr(width_return), (unsigned int *) jlong_to_ptr(height_return)); |
|
936 |
||
937 |
if (status == 0) return JNI_FALSE; |
|
938 |
else return JNI_TRUE; |
|
939 |
} |
|
940 |
||
941 |
||
942 |
/* |
|
943 |
* Class: sun_awt_X11_XlibWrapper |
|
944 |
* Method: XFreeCursor |
|
945 |
* Signature: (JJ)V |
|
946 |
*/ |
|
947 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XFreeCursor |
|
948 |
(JNIEnv *env, jclass clazz, jlong display, jlong cursor) { |
|
949 |
||
950 |
AWT_CHECK_HAVE_LOCK(); |
|
951 |
XFreeCursor( (Display *) jlong_to_ptr(display), (Cursor) cursor); |
|
952 |
} |
|
953 |
||
954 |
/* |
|
955 |
* Class: sun_awt_X11_XlibWrapper |
|
956 |
* Method: XQueryPointer |
|
957 |
* Signature: (JJJJJJJJJ)Z |
|
958 |
*/ |
|
959 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XQueryPointer |
|
960 |
(JNIEnv *env, jclass clazz, jlong display, jlong w, jlong root_return, jlong child_return, jlong root_x_return , jlong root_y_return, jlong win_x_return, jlong win_y_return, jlong mask_return) { |
|
961 |
||
962 |
Bool b; |
|
963 |
||
964 |
AWT_CHECK_HAVE_LOCK(); |
|
965 |
b = XQueryPointer((Display *) jlong_to_ptr(display), |
|
966 |
(Window) w, (Window *) jlong_to_ptr(root_return), (Window *) jlong_to_ptr(child_return), |
|
967 |
(int *) jlong_to_ptr(root_x_return), (int *) jlong_to_ptr(root_y_return), |
|
968 |
(int *) jlong_to_ptr(win_x_return), (int *) jlong_to_ptr(win_y_return), |
|
969 |
(unsigned int *) jlong_to_ptr(mask_return)); |
|
970 |
if (b == True) return JNI_TRUE; |
|
971 |
else return JNI_FALSE; |
|
972 |
||
973 |
} |
|
974 |
||
975 |
/* |
|
976 |
* Class: sun_awt_X11_XlibWrapper |
|
977 |
* Method: XChangeWindowAttributes |
|
978 |
* Signature: (JJJJ)V |
|
979 |
*/ |
|
980 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XChangeWindowAttributes |
|
981 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong valuemask, jlong attributes) { |
|
982 |
||
983 |
AWT_CHECK_HAVE_LOCK(); |
|
984 |
XChangeWindowAttributes((Display *) jlong_to_ptr(display), (Window) window, (unsigned long) valuemask, |
|
985 |
(XSetWindowAttributes *) jlong_to_ptr(attributes)); |
|
986 |
} |
|
987 |
||
988 |
||
989 |
/* |
|
990 |
* Class: sun_awt_X11_XlibWrapper |
|
991 |
* Method: XSetTransientFor |
|
992 |
* Signature: (JJJ)V |
|
993 |
*/ |
|
994 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetTransientFor |
|
995 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong transient_for_window) |
|
996 |
{ |
|
997 |
AWT_CHECK_HAVE_LOCK(); |
|
998 |
XSetTransientForHint((Display *) jlong_to_ptr(display), window, transient_for_window); |
|
999 |
} |
|
1000 |
||
1001 |
/* |
|
1002 |
* Class: sun_awt_X11_XlibWrapper |
|
1003 |
* Method: XSetWMHints |
|
1004 |
* Signature: (JJJ)V |
|
1005 |
*/ |
|
1006 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetWMHints |
|
1007 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong hints) |
|
1008 |
{ |
|
1009 |
AWT_CHECK_HAVE_LOCK(); |
|
1010 |
XSetWMHints((Display *) jlong_to_ptr(display), window, (XWMHints *) jlong_to_ptr(hints)); |
|
1011 |
} |
|
1012 |
||
1013 |
/* |
|
1014 |
* Class: sun_awt_X11_XlibWrapper |
|
1015 |
* Method: XGetWMHints |
|
1016 |
* Signature: (JJJ)V |
|
1017 |
*/ |
|
1018 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XGetWMHints |
|
1019 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong hints) |
|
1020 |
{ |
|
1021 |
XWMHints * get_hints; |
|
1022 |
AWT_CHECK_HAVE_LOCK(); |
|
1023 |
get_hints = XGetWMHints((Display*)jlong_to_ptr(display), window); |
|
1024 |
if (get_hints != NULL) { |
|
1025 |
memcpy(jlong_to_ptr(hints), get_hints, sizeof(XWMHints)); |
|
1026 |
XFree(get_hints); |
|
1027 |
} else { |
|
1028 |
memset(jlong_to_ptr(hints), 0, sizeof(XWMHints)); |
|
1029 |
} |
|
1030 |
} |
|
1031 |
||
1032 |
/* |
|
1033 |
* Class: sun_awt_X11_XlibWrapper |
|
1034 |
* Method: XGetPointerMapping |
|
1035 |
* Signature: (JJI)I |
|
1036 |
*/ |
|
1037 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGetPointerMapping |
|
1038 |
(JNIEnv *env, jclass clazz, jlong display, jlong map, jint buttonNumber) |
|
1039 |
{ |
|
1040 |
AWT_CHECK_HAVE_LOCK(); |
|
1041 |
return XGetPointerMapping((Display*)jlong_to_ptr(display), (unsigned char*) jlong_to_ptr(map), buttonNumber); |
|
1042 |
} |
|
1043 |
||
1044 |
/* |
|
1045 |
* Class: sun_awt_X11_XlibWrapper |
|
1046 |
* Method: XGetDefault |
|
1047 |
* Signature: (JJI)I |
|
1048 |
*/ |
|
1049 |
JNIEXPORT jstring JNICALL Java_sun_awt_X11_XlibWrapper_XGetDefault |
|
1050 |
(JNIEnv *env, jclass clazz, jlong display, jstring program, jstring option) |
|
1051 |
{ |
|
1052 |
char * c_program = NULL; |
|
1053 |
char * c_option = NULL; |
|
1054 |
char * c_res = NULL; |
|
1055 |
||
1056 |
if (!JNU_IsNull(env, program)) { |
|
1057 |
c_program = (char *)JNU_GetStringPlatformChars(env, program, NULL); |
|
1058 |
} |
|
1059 |
if (!JNU_IsNull(env, option)) { |
|
1060 |
c_option = (char *)JNU_GetStringPlatformChars(env, option, NULL); |
|
1061 |
} |
|
1062 |
||
1063 |
if (c_program == NULL || c_option == NULL) { |
|
1064 |
if (!JNU_IsNull(env, program)) { |
|
1065 |
JNU_ReleaseStringPlatformChars(env, program, (const char *) c_program); |
|
1066 |
} |
|
1067 |
if (!JNU_IsNull(env, option)) { |
|
1068 |
JNU_ReleaseStringPlatformChars(env, option, (const char *) c_option); |
|
1069 |
} |
|
1070 |
return NULL; |
|
1071 |
} |
|
1072 |
AWT_CHECK_HAVE_LOCK(); |
|
1073 |
c_res = XGetDefault((Display*)jlong_to_ptr(display), c_program, c_option); |
|
1074 |
||
1075 |
if (!JNU_IsNull(env, program)) { |
|
1076 |
JNU_ReleaseStringPlatformChars(env, program, (const char *) c_program); |
|
1077 |
} |
|
1078 |
if (!JNU_IsNull(env, option)) { |
|
1079 |
JNU_ReleaseStringPlatformChars(env, option, (const char *) c_option); |
|
1080 |
} |
|
1081 |
||
1082 |
if (c_res != NULL) { |
|
1083 |
// Memory leak??? |
|
1084 |
return JNU_NewStringPlatform(env, c_res); |
|
1085 |
} else { |
|
1086 |
return NULL; |
|
1087 |
} |
|
1088 |
} |
|
1089 |
||
1090 |
||
1091 |
/* |
|
1092 |
* Class: sun_awt_X11_XlibWrapper |
|
1093 |
* Method: getScreenOfWindow |
|
1094 |
* Signature: (JJ)J |
|
1095 |
*/ |
|
1096 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_getScreenOfWindow |
|
1097 |
(JNIEnv *env, jclass clazz, jlong display, jlong window) |
|
1098 |
{ |
|
1099 |
XWindowAttributes attrs; |
|
1100 |
memset(&attrs, 0, sizeof(attrs)); |
|
1101 |
AWT_CHECK_HAVE_LOCK(); |
|
1102 |
XGetWindowAttributes((Display *) jlong_to_ptr(display), window, &attrs); |
|
1103 |
return ptr_to_jlong(attrs.screen); |
|
1104 |
} |
|
1105 |
||
1106 |
/* |
|
1107 |
* Class: sun_awt_X11_XlibWrapper |
|
1108 |
* Method: XScreenNumberOfScreen |
|
1109 |
* Signature: (J)J |
|
1110 |
*/ |
|
1111 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XScreenNumberOfScreen |
|
1112 |
(JNIEnv *env, jclass clazz, jlong screen) |
|
1113 |
{ |
|
1114 |
AWT_CHECK_HAVE_LOCK(); |
|
1115 |
if(jlong_to_ptr(screen) == NULL) { |
|
1116 |
return -1; |
|
1117 |
} |
|
1118 |
return XScreenNumberOfScreen((Screen*) jlong_to_ptr(screen)); |
|
1119 |
} |
|
1120 |
||
1121 |
/* |
|
1122 |
* Class: sun_awt_X11_XlibWrapper |
|
1123 |
* Method: XIconifyWindow |
|
1124 |
* Signature: (JJJ)V |
|
1125 |
*/ |
|
1126 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XIconifyWindow |
|
1127 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong screenNumber) |
|
1128 |
{ |
|
1129 |
AWT_CHECK_HAVE_LOCK(); |
|
1130 |
return XIconifyWindow((Display*) jlong_to_ptr(display), window, screenNumber); |
|
1131 |
} |
|
1132 |
||
1133 |
/* |
|
1134 |
* Class: sun_awt_X11_XlibWrapper |
|
1135 |
* Method: XFree |
|
1136 |
* Signature: (J)V |
|
1137 |
*/ |
|
1138 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XFree |
|
1139 |
(JNIEnv *env, jclass clazz, jlong ptr) |
|
1140 |
{ |
|
1141 |
AWT_CHECK_HAVE_LOCK(); |
|
1142 |
XFree(jlong_to_ptr(ptr)); |
|
1143 |
} |
|
1144 |
||
1145 |
/* |
|
1146 |
* Class: sun_awt_X11_XlibWrapper |
|
1147 |
* Method: XFree |
|
1148 |
* Signature: (J)V |
|
1149 |
*/ |
|
1150 |
JNIEXPORT jbyteArray JNICALL Java_sun_awt_X11_XlibWrapper_getStringBytes |
|
1151 |
(JNIEnv *env, jclass clazz, jlong str_ptr) |
|
1152 |
{ |
|
1153 |
unsigned char * str = (unsigned char*) jlong_to_ptr(str_ptr); |
|
1154 |
long length = strlen((char*)str); |
|
1155 |
jbyteArray res = (*env)->NewByteArray(env, length); |
|
1156 |
void * storage = malloc(length+1); |
|
1157 |
memcpy(storage, str, length+1); |
|
1158 |
(*env)->SetByteArrayRegion(env, res, 0, length, |
|
1159 |
(const signed char*) storage); |
|
1160 |
return res; |
|
1161 |
} |
|
1162 |
||
1163 |
||
1164 |
/* |
|
1165 |
* Class: sun_awt_X11_XlibWrapper |
|
1166 |
* Method: ServerVendor |
|
1167 |
* Signature: (J)Ljava/lang/String; |
|
1168 |
*/ |
|
1169 |
JNIEXPORT jstring JNICALL Java_sun_awt_X11_XlibWrapper_ServerVendor |
|
1170 |
(JNIEnv *env, jclass clazz, jlong display) |
|
1171 |
{ |
|
1172 |
AWT_CHECK_HAVE_LOCK(); |
|
1173 |
return JNU_NewStringPlatform(env, ServerVendor((Display*)jlong_to_ptr(display))); |
|
1174 |
} |
|
1175 |
/* |
|
1176 |
* Class: sun_awt_X11_XlibWrapper |
|
1177 |
* Method: VendorRelease |
|
1178 |
* Signature: (J)I; |
|
1179 |
*/ |
|
1180 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_VendorRelease |
|
1181 |
(JNIEnv *env, jclass clazz, jlong display) |
|
1182 |
{ |
|
1183 |
AWT_CHECK_HAVE_LOCK(); |
|
1184 |
return VendorRelease((Display*)jlong_to_ptr(display)); |
|
1185 |
} |
|
3088 | 1186 |
/* |
1187 |
* Class: sun_awt_X11_XlibWrapper |
|
1188 |
* Method: IsXsunKPBehavior |
|
1189 |
* Signature: (J)Z; |
|
1190 |
*/ |
|
1191 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsXsunKPBehavior |
|
1192 |
(JNIEnv *env, jclass clazz, jlong display) |
|
1193 |
{ |
|
1194 |
// Xsun without XKB uses keysymarray[2] keysym to determine if it is KP event. |
|
1195 |
// Otherwise, it is [1] or sometimes [0]. |
|
1196 |
// This sniffer first tries to determine what is a keycode for XK_KP_7 |
|
1197 |
// using XKeysymToKeycode; |
|
1198 |
// second, in which place in the keysymarray is XK_KP_7 |
|
1199 |
// using XKeycodeToKeysym. |
|
1200 |
int kc7; |
|
1201 |
AWT_CHECK_HAVE_LOCK(); |
|
1202 |
kc7 = XKeysymToKeycode((Display*)jlong_to_ptr(display), XK_KP_7); |
|
1203 |
if( !kc7 ) { |
|
1204 |
// keycode is not defined. Why, it's a reduced keyboard perhaps: |
|
1205 |
// report arbitrarily false. |
|
1206 |
return JNI_FALSE; |
|
1207 |
} else { |
|
1208 |
long ks2 = XKeycodeToKeysym((Display*)jlong_to_ptr(display), kc7, 2); |
|
1209 |
if( ks2 == XK_KP_7 ) { |
|
1210 |
//XXX If some Xorg server would put XK_KP_7 in keysymarray[2] as well, |
|
1211 |
//XXX for yet unknown to me reason, the sniffer would lie. |
|
1212 |
return JNI_TRUE; |
|
1213 |
}else{ |
|
1214 |
return JNI_FALSE; |
|
1215 |
} |
|
1216 |
} |
|
1217 |
} |
|
2 | 1218 |
|
4370
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1219 |
|
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1220 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsSunKeyboard |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1221 |
(JNIEnv *env, jclass clazz, jlong display) |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1222 |
{ |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1223 |
int xx; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1224 |
AWT_CHECK_HAVE_LOCK(); |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1225 |
xx = XKeysymToKeycode((Display*)jlong_to_ptr(display), SunXK_F37); |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1226 |
return (!xx) ? JNI_FALSE : JNI_TRUE; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1227 |
} |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1228 |
|
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1229 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1230 |
(JNIEnv *env, jclass clazz, jlong display) |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1231 |
{ |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1232 |
int xx; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1233 |
static jboolean result = JNI_FALSE; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1234 |
|
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1235 |
int32_t minKeyCode, maxKeyCode, keySymsPerKeyCode; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1236 |
KeySym *keySyms, *keySymsStart, keySym; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1237 |
int32_t i; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1238 |
int32_t kanaCount = 0; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1239 |
|
6825 | 1240 |
AWT_CHECK_HAVE_LOCK(); |
1241 |
||
4370
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1242 |
// There's no direct way to determine whether the keyboard has |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1243 |
// a kana lock key. From available keyboard mapping tables, it looks |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1244 |
// like only keyboards with the kana lock key can produce keysyms |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1245 |
// for kana characters. So, as an indirect test, we check for those. |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1246 |
XDisplayKeycodes((Display*)jlong_to_ptr(display), &minKeyCode, &maxKeyCode); |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1247 |
keySyms = XGetKeyboardMapping((Display*)jlong_to_ptr(display), minKeyCode, maxKeyCode - minKeyCode + 1, &keySymsPerKeyCode); |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1248 |
keySymsStart = keySyms; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1249 |
for (i = 0; i < (maxKeyCode - minKeyCode + 1) * keySymsPerKeyCode; i++) { |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1250 |
keySym = *keySyms++; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1251 |
if ((keySym & 0xff00) == 0x0400) { |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1252 |
kanaCount++; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1253 |
} |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1254 |
} |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1255 |
XFree(keySymsStart); |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1256 |
|
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1257 |
// use a (somewhat arbitrary) minimum so we don't get confused by a stray function key |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1258 |
result = kanaCount > 10; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1259 |
return result ? JNI_TRUE : JNI_FALSE; |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1260 |
} |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1261 |
|
2 | 1262 |
JavaVM* jvm = NULL; |
1263 |
static int ToolkitErrorHandler(Display * dpy, XErrorEvent * event) { |
|
14659
cda39b3e7f15
8004344: Fix a crash in ToolkitErrorHandler() in XlibWrapper.c
aph
parents:
7668
diff
changeset
|
1264 |
JNIEnv * env; |
2 | 1265 |
if (jvm != NULL) { |
14659
cda39b3e7f15
8004344: Fix a crash in ToolkitErrorHandler() in XlibWrapper.c
aph
parents:
7668
diff
changeset
|
1266 |
env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); |
cda39b3e7f15
8004344: Fix a crash in ToolkitErrorHandler() in XlibWrapper.c
aph
parents:
7668
diff
changeset
|
1267 |
if (env) { |
17679
a81555868357
8005607: Recursion in J2DXErrHandler() Causes a Stack Overflow on Linux
alitvinov
parents:
14659
diff
changeset
|
1268 |
return JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", |
a81555868357
8005607: Recursion in J2DXErrHandler() Causes a Stack Overflow on Linux
alitvinov
parents:
14659
diff
changeset
|
1269 |
"globalErrorHandler", "(JJ)I", ptr_to_jlong(dpy), ptr_to_jlong(event)).i; |
14659
cda39b3e7f15
8004344: Fix a crash in ToolkitErrorHandler() in XlibWrapper.c
aph
parents:
7668
diff
changeset
|
1270 |
} |
2 | 1271 |
} |
14659
cda39b3e7f15
8004344: Fix a crash in ToolkitErrorHandler() in XlibWrapper.c
aph
parents:
7668
diff
changeset
|
1272 |
return 0; |
2 | 1273 |
} |
1274 |
||
1275 |
/* |
|
1276 |
* Class: sun_awt_X11_XlibWrapper |
|
1277 |
* Method: SetToolkitErrorHandler |
|
1278 |
* Signature: ()J |
|
1279 |
*/ |
|
1280 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_SetToolkitErrorHandler |
|
1281 |
(JNIEnv *env, jclass clazz) |
|
1282 |
{ |
|
1283 |
(*env)->GetJavaVM(env, &jvm); |
|
1284 |
AWT_CHECK_HAVE_LOCK(); |
|
1285 |
return ptr_to_jlong(XSetErrorHandler(ToolkitErrorHandler)); |
|
1286 |
} |
|
1287 |
||
1288 |
/* |
|
1289 |
* Class: sun_awt_X11_XlibWrapper |
|
1290 |
* Method: XSetErrorHandler |
|
1291 |
* Signature: (J)V |
|
1292 |
*/ |
|
1293 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetErrorHandler |
|
1294 |
(JNIEnv *env, jclass clazz, jlong handler) |
|
1295 |
{ |
|
1296 |
AWT_CHECK_HAVE_LOCK(); |
|
1297 |
XSetErrorHandler((XErrorHandler) jlong_to_ptr(handler)); |
|
1298 |
} |
|
1299 |
||
1300 |
/* |
|
1301 |
* Class: sun_awt_X11_XlibWrapper |
|
1302 |
* Method: CallErrorHandler |
|
1303 |
* Signature: (JJJ)I |
|
1304 |
*/ |
|
1305 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_CallErrorHandler |
|
1306 |
(JNIEnv *env, jclass clazz, jlong handler, jlong display, jlong event_ptr) |
|
1307 |
{ |
|
1308 |
return (*(XErrorHandler)jlong_to_ptr(handler))((Display*) jlong_to_ptr(display), (XErrorEvent*) jlong_to_ptr(event_ptr)); |
|
1309 |
} |
|
1310 |
||
4370
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1311 |
|
2802
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1312 |
/* |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1313 |
* Class: sun_awt_X11_XlibWrapper |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1314 |
* Method: PrintXErrorEvent |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1315 |
* Signature: (JJ)V |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1316 |
*/ |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1317 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1318 |
(JNIEnv *env, jclass clazz, jlong display, jlong event_ptr) |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1319 |
{ |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1320 |
char msg[128]; |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1321 |
char buf[128]; |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1322 |
|
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1323 |
XErrorEvent* err = (XErrorEvent *)jlong_to_ptr(event_ptr); |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1324 |
|
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1325 |
XGetErrorText((Display *)jlong_to_ptr(display), err->error_code, msg, sizeof(msg)); |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1326 |
jio_fprintf(stderr, "Xerror %s, XID %x, ser# %d\n", msg, err->resourceid, err->serial); |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1327 |
jio_snprintf(buf, sizeof(buf), "%d", err->request_code); |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1328 |
XGetErrorDatabaseText((Display *)jlong_to_ptr(display), "XRequest", buf, "Unknown", msg, sizeof(msg)); |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1329 |
jio_fprintf(stderr, "Major opcode %d (%s)\n", err->request_code, msg); |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1330 |
if (err->request_code > 128) { |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1331 |
jio_fprintf(stderr, "Minor opcode %d\n", err->minor_code); |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1332 |
} |
d05a9dcc8296
6678385: Random java.lang.StackOverflowError from various JDKs
art
parents:
2473
diff
changeset
|
1333 |
} |
2 | 1334 |
|
1335 |
||
1336 |
/* |
|
1337 |
* Class: sun_awt_X11_XlibWrapper |
|
1338 |
* Method: XInternAtoms |
|
1339 |
* Signature: (J[Ljava/lang/String;ZJ)I |
|
1340 |
*/ |
|
1341 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms |
|
1342 |
(JNIEnv *env, jclass clazz, jlong display, jobjectArray names_arr, jboolean only_if_exists, jlong atoms) |
|
1343 |
{ |
|
1344 |
int length = (*env)->GetArrayLength(env, names_arr); |
|
1345 |
char ** names = (char**)malloc(length*sizeof(char*)); |
|
1346 |
jboolean copy; |
|
1347 |
int index, name_index = 0; |
|
1348 |
int status; |
|
6825 | 1349 |
|
1350 |
AWT_CHECK_HAVE_LOCK(); |
|
1351 |
||
2 | 1352 |
for (index = 0; index < length; index++) { |
1353 |
jstring str = (*env)->GetObjectArrayElement(env, names_arr, index); |
|
1354 |
if (!JNU_IsNull(env, str)) { |
|
1355 |
const char * str_char = JNU_GetStringPlatformChars(env, str, NULL); |
|
1356 |
names[name_index++] = strdup(str_char); |
|
1357 |
JNU_ReleaseStringPlatformChars(env, str, str_char); |
|
1358 |
(*env)->DeleteLocalRef(env, str); |
|
1359 |
} |
|
1360 |
} |
|
1361 |
status = XInternAtoms((Display*)jlong_to_ptr(display), names, name_index, only_if_exists, (Atom*) jlong_to_ptr(atoms)); |
|
1362 |
for (index = 0; index < length; index++) { |
|
1363 |
free(names[index]); |
|
1364 |
} |
|
1365 |
free(names); |
|
1366 |
return status; |
|
1367 |
} |
|
1368 |
||
1369 |
||
1370 |
||
1371 |
/* |
|
1372 |
* Class: sun_awt_X11_XlibWrapper |
|
1373 |
* Method: XGetWindowAttributes |
|
1374 |
* Signature: (JJJ)I |
|
1375 |
*/ |
|
1376 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGetWindowAttributes |
|
1377 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong attr_ptr) |
|
1378 |
{ |
|
1379 |
jint status; |
|
1380 |
AWT_CHECK_HAVE_LOCK(); |
|
1381 |
memset((XWindowAttributes*) jlong_to_ptr(attr_ptr), 0, sizeof(XWindowAttributes)); |
|
1382 |
status = XGetWindowAttributes((Display*)jlong_to_ptr(display), window, (XWindowAttributes*) jlong_to_ptr(attr_ptr)); |
|
1383 |
return status; |
|
1384 |
} |
|
1385 |
||
1386 |
||
1387 |
/* |
|
1388 |
* Class: sun_awt_X11_XlibWrapper |
|
1389 |
* Method: XGetGeometry |
|
1390 |
* Signature: (JJJJJJJJJ)I |
|
1391 |
*/ |
|
1392 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGetGeometry |
|
1393 |
(JNIEnv *env, jclass clazz, jlong display, jlong drawable, jlong root_return, |
|
1394 |
jlong x_return, jlong y_return, jlong width_return, jlong height_return, |
|
1395 |
jlong border_width_return, jlong depth_return) |
|
1396 |
{ |
|
1397 |
jint status; |
|
1398 |
AWT_CHECK_HAVE_LOCK(); |
|
1399 |
status = XGetGeometry((Display *)jlong_to_ptr(display), |
|
1400 |
(Drawable)drawable, (Window *)jlong_to_ptr(root_return), |
|
1401 |
(int *)jlong_to_ptr(x_return), (int *)jlong_to_ptr(y_return), |
|
1402 |
(unsigned int *)jlong_to_ptr(width_return), (unsigned int *)jlong_to_ptr(height_return), |
|
1403 |
(unsigned int *)jlong_to_ptr(border_width_return), |
|
1404 |
(unsigned int *)jlong_to_ptr(depth_return)); |
|
1405 |
return status; |
|
1406 |
} |
|
1407 |
||
1408 |
||
1409 |
/* |
|
1410 |
* Class: sun_awt_X11_XlibWrapper |
|
1411 |
* Method: XGetWMNormalHints |
|
1412 |
* Signature: (JJJJ)I |
|
1413 |
*/ |
|
1414 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGetWMNormalHints |
|
1415 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong hints, jlong supplied_return) |
|
1416 |
{ |
|
1417 |
AWT_CHECK_HAVE_LOCK(); |
|
1418 |
return XGetWMNormalHints((Display*) jlong_to_ptr(display), |
|
1419 |
window, |
|
1420 |
(XSizeHints*) jlong_to_ptr(hints), |
|
1421 |
(long*) jlong_to_ptr(supplied_return)); |
|
1422 |
} |
|
1423 |
||
1424 |
/* |
|
1425 |
* Class: sun_awt_X11_XlibWrapper |
|
1426 |
* Method: XSetWMNormalHints |
|
1427 |
* Signature: (JJJ)V |
|
1428 |
*/ |
|
1429 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetWMNormalHints |
|
1430 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong hints) |
|
1431 |
{ |
|
1432 |
AWT_CHECK_HAVE_LOCK(); |
|
1433 |
XSetWMNormalHints((Display*) jlong_to_ptr(display), window, (XSizeHints*) jlong_to_ptr(hints)); |
|
1434 |
} |
|
1435 |
||
1436 |
/* |
|
1437 |
* Class: sun_awt_X11_XlibWrapper |
|
1438 |
* Method: XDeleteProperty |
|
1439 |
* Signature: (JJJ)V |
|
1440 |
*/ |
|
1441 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XDeleteProperty |
|
1442 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong atom) |
|
1443 |
{ |
|
1444 |
AWT_CHECK_HAVE_LOCK(); |
|
1445 |
XDeleteProperty((Display*) jlong_to_ptr(display), window, (Atom)atom); |
|
1446 |
} |
|
1447 |
||
1448 |
/* |
|
1449 |
* Class: sun_awt_X11_XlibWrapper |
|
1450 |
* Method: XSendEvent |
|
1451 |
* Signature: (JJZJJ)V |
|
1452 |
*/ |
|
1453 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XSendEvent |
|
1454 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jboolean propagate, jlong event_mask, jlong event) |
|
1455 |
{ |
|
1456 |
AWT_CHECK_HAVE_LOCK(); |
|
1457 |
return XSendEvent((Display*) jlong_to_ptr(display), |
|
1458 |
window, |
|
1459 |
propagate==JNI_TRUE?True:False, |
|
1460 |
(long) event_mask, |
|
1461 |
(XEvent*) jlong_to_ptr(event)); |
|
1462 |
} |
|
1463 |
||
1464 |
||
1465 |
/* |
|
1466 |
* Class: sun_awt_X11_XlibWrapper |
|
1467 |
* Method: XQueryTree |
|
1468 |
* Signature: (JJJJJJ)I |
|
1469 |
*/ |
|
1470 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XQueryTree |
|
1471 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong root_return, jlong parent_return, jlong children_return, jlong nchildren_return) |
|
1472 |
{ |
|
1473 |
AWT_CHECK_HAVE_LOCK(); |
|
1474 |
return XQueryTree((Display*) jlong_to_ptr(display), |
|
1475 |
window, |
|
1476 |
(Window *) jlong_to_ptr(root_return), |
|
1477 |
(Window*) jlong_to_ptr(parent_return), |
|
1478 |
(Window**) jlong_to_ptr(children_return), |
|
1479 |
(unsigned int*) jlong_to_ptr(nchildren_return)); |
|
1480 |
} |
|
1481 |
||
1482 |
||
1483 |
/* |
|
1484 |
* Class: sun_awt_X11_XlibWrapper |
|
1485 |
* Method: memcpy |
|
1486 |
* Signature: (JJJ)V |
|
1487 |
*/ |
|
1488 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_memcpy |
|
1489 |
(JNIEnv *env, jclass clazz, jlong dest_ptr, jlong src_ptr, jlong length) |
|
1490 |
{ |
|
1491 |
memcpy(jlong_to_ptr(dest_ptr), jlong_to_ptr(src_ptr), length); |
|
1492 |
} |
|
1493 |
||
1494 |
||
1495 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XSetMinMaxHints |
|
1496 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jint x, jint y, jint width, jint height, jlong flags) { |
|
1497 |
XSizeHints * hints; |
|
1498 |
AWT_CHECK_HAVE_LOCK(); |
|
1499 |
hints = XAllocSizeHints(); |
|
1500 |
hints->flags = flags; |
|
1501 |
hints->width = width; |
|
1502 |
hints->min_width = width; |
|
1503 |
hints->max_width = width; |
|
1504 |
hints->height = height; |
|
1505 |
hints->min_height = height; |
|
1506 |
hints->max_height = height; |
|
1507 |
hints->x = x; |
|
1508 |
hints->y = y; |
|
1509 |
XSetWMNormalHints((Display*) jlong_to_ptr(display), window, hints); |
|
1510 |
XFree(hints); |
|
1511 |
} |
|
1512 |
||
1513 |
||
1514 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XGetVisualInfo |
|
1515 |
(JNIEnv *env, jclass clazz, jlong display, jlong vinfo_mask, jlong vinfo_template, |
|
1516 |
jlong nitems_return) |
|
1517 |
{ |
|
1518 |
AWT_CHECK_HAVE_LOCK(); |
|
1519 |
return ptr_to_jlong(XGetVisualInfo((Display*) jlong_to_ptr(display), |
|
1520 |
(long) vinfo_mask, |
|
1521 |
(XVisualInfo*) jlong_to_ptr(vinfo_template), |
|
1522 |
(int*) jlong_to_ptr(nitems_return))); |
|
1523 |
} |
|
1524 |
||
1525 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XAllocSizeHints |
|
1526 |
(JNIEnv *env, jclass clazz) |
|
1527 |
{ |
|
1528 |
AWT_CHECK_HAVE_LOCK(); |
|
1529 |
return ptr_to_jlong(XAllocSizeHints()); |
|
1530 |
} |
|
1531 |
||
1532 |
/* |
|
1533 |
* Class: sun_awt_X11_XlibWrapper |
|
1534 |
* Method: XIconifyWindow |
|
1535 |
* Signature: (JJJ)V |
|
1536 |
*/ |
|
1537 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XBell |
|
1538 |
(JNIEnv *env, jclass clazz, jlong display, jint percent) |
|
1539 |
{ |
|
1540 |
AWT_CHECK_HAVE_LOCK(); |
|
1541 |
XBell((Display*)jlong_to_ptr(display), percent); |
|
1542 |
} |
|
1543 |
||
1544 |
||
1545 |
/* |
|
1546 |
* Class: sun_awt_X11_XlibWrapper |
|
1547 |
* Method: XAllocColor |
|
1548 |
* Signature: (JJJ)Z |
|
1549 |
*/ |
|
1550 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XAllocColor |
|
1551 |
(JNIEnv *env, jclass clazz, jlong display , jlong colormap, jlong xcolor) { |
|
1552 |
||
1553 |
Status status; |
|
1554 |
AWT_CHECK_HAVE_LOCK(); |
|
1555 |
status = XAllocColor((Display *) jlong_to_ptr(display), (Colormap) colormap, (XColor *) jlong_to_ptr(xcolor)); |
|
1556 |
||
1557 |
if (status == 0) return JNI_FALSE; |
|
1558 |
else return JNI_TRUE; |
|
1559 |
} |
|
1560 |
||
1561 |
||
1562 |
/* |
|
1563 |
* Class: sun_awt_X11_XlibWrapper |
|
1564 |
* Method: XCreateBitmapFromData |
|
1565 |
* Signature: (JJJII)J |
|
1566 |
*/ |
|
1567 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XCreateBitmapFromData |
|
1568 |
(JNIEnv *env, jclass clazz, jlong display, jlong drawable, jlong data, jint width, jint height) { |
|
1569 |
AWT_CHECK_HAVE_LOCK(); |
|
1570 |
||
1571 |
return (jlong) XCreateBitmapFromData((Display *) jlong_to_ptr(display), (Drawable) drawable, |
|
1572 |
(char *) jlong_to_ptr(data), width, height); |
|
1573 |
} |
|
1574 |
||
1575 |
||
1576 |
/* |
|
1577 |
* Class: sun_awt_X11_XlibWrapper |
|
1578 |
* Method: XFreePixmap |
|
1579 |
* Signature: (JJ)V |
|
1580 |
*/ |
|
1581 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XFreePixmap |
|
1582 |
(JNIEnv *env, jclass clazz, jlong display, jlong pixmap) { |
|
1583 |
AWT_CHECK_HAVE_LOCK(); |
|
1584 |
XFreePixmap((Display *)jlong_to_ptr(display), (Pixmap) pixmap); |
|
1585 |
} |
|
1586 |
||
1587 |
/* |
|
1588 |
* Class: sun_awt_X11_XlibWrapper |
|
1589 |
* Method: XReparentWindow |
|
1590 |
* Signature: (JJJII)V |
|
1591 |
*/ |
|
1592 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XReparentWindow |
|
1593 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong parent, jint x, jint y) { |
|
1594 |
AWT_CHECK_HAVE_LOCK(); |
|
1595 |
XReparentWindow((Display*)jlong_to_ptr(display), window, parent, x, y); |
|
1596 |
} |
|
1597 |
||
1598 |
/* |
|
1599 |
* Class: sun_awt_X11_XlibWrapper |
|
1600 |
* Method: XConvertSelection |
|
1601 |
* Signature: (JJJJJJ)V |
|
1602 |
*/ |
|
1603 |
JNIEXPORT void JNICALL |
|
1604 |
Java_sun_awt_X11_XlibWrapper_XConvertSelection(JNIEnv *env, jclass clazz, |
|
1605 |
jlong display, jlong selection, |
|
1606 |
jlong target, jlong property, |
|
1607 |
jlong requestor, jlong time) { |
|
1608 |
AWT_CHECK_HAVE_LOCK(); |
|
1609 |
XConvertSelection((Display*)jlong_to_ptr(display), selection, target, property, requestor, |
|
1610 |
time); |
|
1611 |
} |
|
1612 |
||
1613 |
/* |
|
1614 |
* Class: sun_awt_X11_XlibWrapper |
|
1615 |
* Method: XSetSelectionOwner |
|
1616 |
* Signature: (JJJJ)V |
|
1617 |
*/ |
|
1618 |
JNIEXPORT void JNICALL |
|
1619 |
Java_sun_awt_X11_XlibWrapper_XSetSelectionOwner(JNIEnv *env, jclass clazz, |
|
1620 |
jlong display, jlong selection, |
|
1621 |
jlong owner, jlong time) { |
|
1622 |
AWT_CHECK_HAVE_LOCK(); |
|
1623 |
XSetSelectionOwner((Display*)jlong_to_ptr(display), selection, owner, time); |
|
1624 |
} |
|
1625 |
||
1626 |
/* |
|
1627 |
* Class: sun_awt_X11_XlibWrapper |
|
1628 |
* Method: XGetSelectionOwner |
|
1629 |
* Signature: (JJ)J |
|
1630 |
*/ |
|
1631 |
JNIEXPORT jlong JNICALL |
|
1632 |
Java_sun_awt_X11_XlibWrapper_XGetSelectionOwner(JNIEnv *env, jclass clazz, |
|
1633 |
jlong display, jlong selection) { |
|
1634 |
AWT_CHECK_HAVE_LOCK(); |
|
1635 |
return (jlong)XGetSelectionOwner((Display*)jlong_to_ptr(display), selection); |
|
1636 |
} |
|
1637 |
||
1638 |
/* |
|
1639 |
* Class: sun_awt_X11_XlibWrapper |
|
1640 |
* Method: XGetAtomName |
|
1641 |
* Signature: (JJ)Ljava/lang/String; |
|
1642 |
*/ |
|
1643 |
JNIEXPORT jstring JNICALL |
|
1644 |
Java_sun_awt_X11_XlibWrapper_XGetAtomName(JNIEnv *env, jclass clazz, |
|
1645 |
jlong display, jlong atom) |
|
1646 |
{ |
|
1647 |
jstring string = NULL; |
|
1648 |
char* name; |
|
1649 |
AWT_CHECK_HAVE_LOCK(); |
|
1650 |
name = (char*) XGetAtomName((Display*)jlong_to_ptr(display), atom); |
|
1651 |
||
1652 |
if (name == NULL) { |
|
1653 |
fprintf(stderr, "Atom was %d\n", (int)atom); |
|
1654 |
JNU_ThrowNullPointerException(env, "Failed to retrieve atom name."); |
|
1655 |
return NULL; |
|
1656 |
} |
|
1657 |
||
1658 |
string = (*env)->NewStringUTF(env, (const char *)name); |
|
1659 |
||
1660 |
XFree(name); |
|
1661 |
||
1662 |
return string; |
|
1663 |
} |
|
1664 |
||
1665 |
/* |
|
1666 |
* Class: sun_awt_X11_XlibWrapper |
|
1667 |
* Method: XMaxRequestSize |
|
1668 |
* Signature: (J)J |
|
1669 |
*/ |
|
1670 |
JNIEXPORT jlong JNICALL |
|
1671 |
Java_sun_awt_X11_XlibWrapper_XMaxRequestSize(JNIEnv *env, jclass clazz, |
|
1672 |
jlong display) { |
|
1673 |
AWT_CHECK_HAVE_LOCK(); |
|
1674 |
return XMaxRequestSize((Display*) jlong_to_ptr(display)); |
|
1675 |
} |
|
1676 |
||
1677 |
JNIEXPORT jlong JNICALL |
|
1678 |
Java_sun_awt_X11_XlibWrapper_XAllocWMHints(JNIEnv *env, jclass clazz) |
|
1679 |
{ |
|
1680 |
AWT_CHECK_HAVE_LOCK(); |
|
1681 |
return ptr_to_jlong(XAllocWMHints()); |
|
1682 |
} |
|
1683 |
||
1684 |
JNIEXPORT jlong JNICALL |
|
1685 |
Java_sun_awt_X11_XlibWrapper_XCreatePixmap(JNIEnv *env, jclass clazz, jlong display, jlong drawable, jint width, jint height, jint depth) |
|
1686 |
{ |
|
1687 |
AWT_CHECK_HAVE_LOCK(); |
|
1688 |
return XCreatePixmap((Display*)jlong_to_ptr(display), (Drawable)drawable, width, height, depth); |
|
1689 |
} |
|
1690 |
JNIEXPORT jlong JNICALL |
|
1691 |
Java_sun_awt_X11_XlibWrapper_XCreateImage |
|
1692 |
(JNIEnv *env, jclass clazz, jlong display, jlong visual_ptr, |
|
1693 |
jint depth, jint format, jint offset, jlong data, jint width, |
|
1694 |
jint height, jint bitmap_pad, jint bytes_per_line) |
|
1695 |
{ |
|
1696 |
AWT_CHECK_HAVE_LOCK(); |
|
1697 |
return ptr_to_jlong(XCreateImage((Display*) jlong_to_ptr(display), (Visual*) jlong_to_ptr(visual_ptr), |
|
1698 |
depth, format, offset, (char*) jlong_to_ptr(data), |
|
1699 |
width, height, bitmap_pad, bytes_per_line)); |
|
1700 |
} |
|
1701 |
JNIEXPORT jlong JNICALL |
|
1702 |
Java_sun_awt_X11_XlibWrapper_XCreateGC |
|
1703 |
(JNIEnv *env, jclass clazz, jlong display, jlong drawable, |
|
1704 |
jlong valuemask, jlong values) |
|
1705 |
{ |
|
1706 |
AWT_CHECK_HAVE_LOCK(); |
|
1707 |
return ptr_to_jlong(XCreateGC((Display*) jlong_to_ptr(display), (Drawable)drawable, valuemask, (XGCValues*) jlong_to_ptr(values))); |
|
1708 |
} |
|
1709 |
||
1710 |
JNIEXPORT void JNICALL |
|
1711 |
Java_sun_awt_X11_XlibWrapper_XDestroyImage(JNIEnv *env, jclass clazz, jlong image) |
|
1712 |
{ |
|
1713 |
XImage *img = (XImage*) jlong_to_ptr(image); |
|
1714 |
AWT_CHECK_HAVE_LOCK(); |
|
1715 |
||
1716 |
// Fix for bug 4903671 : |
|
1717 |
// We should be careful to not double free the memory pointed to data |
|
1718 |
// Since we use unsafe to allocate it, we should use unsafe to free it. |
|
1719 |
// So we should NULL the data pointer before calling XDestroyImage so |
|
1720 |
// that X does not free the pointer for us. |
|
1721 |
img->data = NULL; |
|
1722 |
XDestroyImage(img); |
|
1723 |
} |
|
1724 |
JNIEXPORT void JNICALL |
|
1725 |
Java_sun_awt_X11_XlibWrapper_XPutImage(JNIEnv *env, jclass clazz, jlong display, jlong drawable, jlong gc, jlong image, jint src_x, jint src_y, jint dest_x, jint dest_y, jint width, jint height) |
|
1726 |
{ |
|
1727 |
AWT_CHECK_HAVE_LOCK(); |
|
1728 |
XPutImage((Display*)jlong_to_ptr(display), (Drawable)drawable, (GC) jlong_to_ptr(gc), (XImage*) jlong_to_ptr(image), src_x, src_y, |
|
1729 |
dest_x, dest_y, width, height); |
|
1730 |
} |
|
1731 |
JNIEXPORT void JNICALL |
|
1732 |
Java_sun_awt_X11_XlibWrapper_XFreeGC(JNIEnv *env, jclass clazz, jlong display, jlong gc) |
|
1733 |
{ |
|
1734 |
AWT_CHECK_HAVE_LOCK(); |
|
1735 |
XFreeGC((Display*) jlong_to_ptr(display), (GC) jlong_to_ptr(gc)); |
|
1736 |
} |
|
1737 |
JNIEXPORT void JNICALL |
|
1738 |
Java_sun_awt_X11_XlibWrapper_XSetWindowBackgroundPixmap(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong pixmap) |
|
1739 |
{ |
|
1740 |
AWT_CHECK_HAVE_LOCK(); |
|
1741 |
XSetWindowBackgroundPixmap((Display*) jlong_to_ptr(display), (Window)window, (Pixmap)pixmap); |
|
1742 |
} |
|
1743 |
JNIEXPORT void JNICALL |
|
1744 |
Java_sun_awt_X11_XlibWrapper_XClearWindow(JNIEnv *env, jclass clazz, jlong display, jlong window) |
|
1745 |
{ |
|
1746 |
AWT_CHECK_HAVE_LOCK(); |
|
1747 |
XClearWindow((Display*) jlong_to_ptr(display), (Window)window); |
|
1748 |
} |
|
1749 |
||
1750 |
JNIEXPORT jint JNICALL |
|
1751 |
Java_sun_awt_X11_XlibWrapper_XGetIconSizes(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong ret_sizes, jlong ret_count) |
|
1752 |
{ |
|
1753 |
XIconSize** psize = (XIconSize**) jlong_to_ptr(ret_sizes); |
|
1754 |
int * pcount = (int *) jlong_to_ptr(ret_count); |
|
1755 |
Status res; |
|
1756 |
AWT_CHECK_HAVE_LOCK(); |
|
1757 |
res = XGetIconSizes((Display*) jlong_to_ptr(display), (Window)window, psize, pcount); |
|
1758 |
return res; |
|
1759 |
} |
|
1760 |
||
1761 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XdbeQueryExtension |
|
1762 |
(JNIEnv *env, jclass clazz, jlong display, jlong major_version_return, |
|
1763 |
jlong minor_version_return) |
|
1764 |
{ |
|
1765 |
AWT_CHECK_HAVE_LOCK(); |
|
1766 |
return XdbeQueryExtension((Display*) jlong_to_ptr(display), (int *) jlong_to_ptr(major_version_return), |
|
1767 |
(int *) jlong_to_ptr(minor_version_return)); |
|
1768 |
} |
|
1769 |
||
1770 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XQueryExtension |
|
1771 |
(JNIEnv *env, jclass clazz, jlong display, jstring jstr, jlong mop_return, |
|
1772 |
jlong feve_return, jlong err_return) |
|
1773 |
{ |
|
1774 |
char *cname; |
|
1775 |
Boolean bu; |
|
1776 |
if (!JNU_IsNull(env, jstr)) { |
|
1777 |
cname = (char *)JNU_GetStringPlatformChars(env, jstr, NULL); |
|
1778 |
} else { |
|
1779 |
cname = ""; |
|
1780 |
} |
|
1781 |
||
1782 |
AWT_CHECK_HAVE_LOCK(); |
|
1783 |
bu = XQueryExtension((Display*) jlong_to_ptr(display), cname, (int *) jlong_to_ptr(mop_return), |
|
1784 |
(int *) jlong_to_ptr(feve_return), (int *) jlong_to_ptr(err_return)); |
|
1785 |
if (!JNU_IsNull(env, jstr)) { |
|
1786 |
JNU_ReleaseStringPlatformChars(env, jstr, (const char *) cname); |
|
1787 |
} |
|
1788 |
return bu ? JNI_TRUE : JNI_FALSE; |
|
1789 |
} |
|
1790 |
||
1791 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKeypadKey |
|
1792 |
(JNIEnv *env, jclass clazz, jlong keysym) |
|
1793 |
{ |
|
1794 |
AWT_CHECK_HAVE_LOCK(); |
|
1795 |
if(IsKeypadKey(keysym)) { |
|
1796 |
return JNI_TRUE; |
|
1797 |
} |
|
1798 |
return JNI_FALSE; |
|
1799 |
} |
|
1800 |
||
1801 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XdbeAllocateBackBufferName |
|
1802 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jint swap_action) |
|
1803 |
{ |
|
1804 |
AWT_CHECK_HAVE_LOCK(); |
|
1805 |
return XdbeAllocateBackBufferName((Display*) jlong_to_ptr(display), (Window) window, |
|
1806 |
(XdbeSwapAction) swap_action); |
|
1807 |
} |
|
1808 |
||
1809 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XdbeDeallocateBackBufferName |
|
1810 |
(JNIEnv *env, jclass clazz, jlong display, jlong buffer) |
|
1811 |
{ |
|
1812 |
AWT_CHECK_HAVE_LOCK(); |
|
1813 |
return XdbeDeallocateBackBufferName((Display*) jlong_to_ptr(display), (XdbeBackBuffer) buffer); |
|
1814 |
} |
|
1815 |
||
1816 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XdbeBeginIdiom |
|
1817 |
(JNIEnv *env, jclass clazz, jlong display) |
|
1818 |
{ |
|
1819 |
AWT_CHECK_HAVE_LOCK(); |
|
1820 |
return XdbeBeginIdiom((Display*) jlong_to_ptr(display)); |
|
1821 |
} |
|
1822 |
||
1823 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XdbeEndIdiom |
|
1824 |
(JNIEnv *env, jclass clazz, jlong display) |
|
1825 |
{ |
|
1826 |
AWT_CHECK_HAVE_LOCK(); |
|
1827 |
return XdbeEndIdiom((Display*) jlong_to_ptr(display)); |
|
1828 |
} |
|
1829 |
||
1830 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XdbeSwapBuffers |
|
1831 |
(JNIEnv *env, jclass clazz, jlong display, jlong swap_info, jint num_windows) |
|
1832 |
{ |
|
1833 |
AWT_CHECK_HAVE_LOCK(); |
|
1834 |
return XdbeSwapBuffers((Display*) jlong_to_ptr(display), (XdbeSwapInfo *) jlong_to_ptr(swap_info), num_windows); |
|
1835 |
} |
|
1966
12a51fb0db0d
5100701: Toolkit.getLockingKeyState() does not work on XToolkit, but works on Motif
yan
parents:
715
diff
changeset
|
1836 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XQueryKeymap |
12a51fb0db0d
5100701: Toolkit.getLockingKeyState() does not work on XToolkit, but works on Motif
yan
parents:
715
diff
changeset
|
1837 |
(JNIEnv *env, jclass clazz, jlong display, jlong vector) |
12a51fb0db0d
5100701: Toolkit.getLockingKeyState() does not work on XToolkit, but works on Motif
yan
parents:
715
diff
changeset
|
1838 |
{ |
12a51fb0db0d
5100701: Toolkit.getLockingKeyState() does not work on XToolkit, but works on Motif
yan
parents:
715
diff
changeset
|
1839 |
|
12a51fb0db0d
5100701: Toolkit.getLockingKeyState() does not work on XToolkit, but works on Motif
yan
parents:
715
diff
changeset
|
1840 |
AWT_CHECK_HAVE_LOCK(); |
12a51fb0db0d
5100701: Toolkit.getLockingKeyState() does not work on XToolkit, but works on Motif
yan
parents:
715
diff
changeset
|
1841 |
XQueryKeymap( (Display *) jlong_to_ptr(display), (char *) jlong_to_ptr(vector)); |
12a51fb0db0d
5100701: Toolkit.getLockingKeyState() does not work on XToolkit, but works on Motif
yan
parents:
715
diff
changeset
|
1842 |
} |
2 | 1843 |
|
1844 |
JNIEXPORT jlong JNICALL |
|
1845 |
Java_sun_awt_X11_XlibWrapper_XKeycodeToKeysym(JNIEnv *env, jclass clazz, |
|
1846 |
jlong display, jint keycode, |
|
1847 |
jint index) { |
|
1848 |
AWT_CHECK_HAVE_LOCK(); |
|
1849 |
return XKeycodeToKeysym((Display*) jlong_to_ptr(display), (unsigned int)keycode, (int)index); |
|
1850 |
} |
|
1851 |
||
1852 |
JNIEXPORT jint JNICALL |
|
2473
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1853 |
Java_sun_awt_X11_XlibWrapper_XkbGetEffectiveGroup(JNIEnv *env, jclass clazz, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1854 |
jlong display) { |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1855 |
XkbStateRec sr; |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1856 |
AWT_CHECK_HAVE_LOCK(); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1857 |
memset(&sr, 0, sizeof(XkbStateRec)); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1858 |
XkbGetState((Display*) jlong_to_ptr(display), XkbUseCoreKbd, &sr); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1859 |
// printf("-------------------------------------VVVV\n"); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1860 |
// printf(" group:0x%0X\n",sr.group); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1861 |
// printf(" base_group:0x%0X\n",sr.base_group); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1862 |
// printf(" latched_group:0x%0X\n",sr.latched_group); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1863 |
// printf(" locked_group:0x%0X\n",sr.locked_group); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1864 |
// printf(" mods:0x%0X\n",sr.mods); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1865 |
// printf(" base_mods:0x%0X\n",sr.base_mods); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1866 |
// printf(" latched_mods:0x%0X\n",sr.latched_mods); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1867 |
// printf(" locked_mods:0x%0X\n",sr.locked_mods); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1868 |
// printf(" compat_state:0x%0X\n",sr.compat_state); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1869 |
// printf(" grab_mods:0x%0X\n",sr.grab_mods); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1870 |
// printf(" compat_grab_mods:0x%0X\n",sr.compat_grab_mods); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1871 |
// printf(" lookup_mods:0x%0X\n",sr.lookup_mods); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1872 |
// printf(" compat_lookup_mods:0x%0X\n",sr.compat_lookup_mods); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1873 |
// printf(" ptr_buttons:0x%0X\n",sr.ptr_buttons); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1874 |
// printf("-------------------------------------^^^^\n"); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1875 |
return (jint)(sr.group); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1876 |
} |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1877 |
JNIEXPORT jlong JNICALL |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1878 |
Java_sun_awt_X11_XlibWrapper_XkbKeycodeToKeysym(JNIEnv *env, jclass clazz, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1879 |
jlong display, jint keycode, |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1880 |
jint group, jint level) { |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1881 |
AWT_CHECK_HAVE_LOCK(); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1882 |
return XkbKeycodeToKeysym((Display*) jlong_to_ptr(display), (unsigned int)keycode, (unsigned int)group, (unsigned int)level); |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1883 |
} |
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1884 |
|
3f4bbd3be2f1
6680988: KeyEvent is still missing VK values for many keyboards
yan
parents:
2472
diff
changeset
|
1885 |
JNIEXPORT jint JNICALL |
2 | 1886 |
Java_sun_awt_X11_XlibWrapper_XKeysymToKeycode(JNIEnv *env, jclass clazz, |
1887 |
jlong display, jlong keysym) { |
|
1888 |
AWT_CHECK_HAVE_LOCK(); |
|
1889 |
return XKeysymToKeycode((Display*) jlong_to_ptr(display), (KeySym)keysym); |
|
1890 |
} |
|
1891 |
||
1892 |
JNIEXPORT jlong JNICALL |
|
1893 |
Java_sun_awt_X11_XlibWrapper_XGetModifierMapping(JNIEnv *env, jclass clazz, |
|
1894 |
jlong display) { |
|
1895 |
AWT_CHECK_HAVE_LOCK(); |
|
1896 |
return ptr_to_jlong(XGetModifierMapping((Display*) jlong_to_ptr(display))); |
|
1897 |
} |
|
1898 |
||
1899 |
JNIEXPORT void JNICALL |
|
1900 |
Java_sun_awt_X11_XlibWrapper_XFreeModifiermap(JNIEnv *env, jclass clazz, |
|
1901 |
jlong keymap) { |
|
1902 |
AWT_CHECK_HAVE_LOCK(); |
|
1903 |
XFreeModifiermap((XModifierKeymap*) jlong_to_ptr(keymap)); |
|
1904 |
} |
|
4370
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1905 |
/* |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1906 |
* Class: sun_awt_X11_XlibWrapper |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1907 |
* Method: XRefreshKeyboardMapping |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1908 |
* Signature: (J)V |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1909 |
*/ |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1910 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XRefreshKeyboardMapping |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1911 |
(JNIEnv *env, jclass clazz, jlong event_ptr) |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1912 |
{ |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1913 |
AWT_CHECK_HAVE_LOCK(); |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1914 |
XRefreshKeyboardMapping((XMappingEvent*) jlong_to_ptr(event_ptr)); |
cc409c51b108
5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents:
3088
diff
changeset
|
1915 |
} |
2 | 1916 |
|
1917 |
JNIEXPORT void JNICALL |
|
1918 |
Java_sun_awt_X11_XlibWrapper_XChangeActivePointerGrab(JNIEnv *env, jclass clazz, |
|
1919 |
jlong display, jint mask, |
|
1920 |
jlong cursor, jlong time) { |
|
1921 |
AWT_CHECK_HAVE_LOCK(); |
|
1922 |
XChangeActivePointerGrab((Display*)jlong_to_ptr(display), (unsigned int)mask, |
|
1923 |
(Cursor)cursor, (Time)time); |
|
1924 |
} |
|
1925 |
||
1926 |
/******************* Secondary loop support ************************************/ |
|
1927 |
#define AWT_SECONDARY_LOOP_TIMEOUT 250 |
|
1928 |
||
1929 |
static Bool exitSecondaryLoop = True; |
|
1930 |
||
1931 |
/* |
|
1932 |
* This predicate procedure allows the Toolkit thread to process specific events |
|
1933 |
* while it is blocked waiting for the event dispatch thread to process |
|
1934 |
* a SunDropTargetEvent. We need this to prevent deadlock when the client code |
|
1935 |
* processing SunDropTargetEvent sets or gets the contents of the system |
|
1936 |
* clipboard/selection. In this case the event dispatch thread waits for the |
|
1937 |
* Toolkit thread to process PropertyNotify or SelectionNotify events. |
|
1938 |
*/ |
|
1939 |
static Bool |
|
1940 |
secondary_loop_event(Display* dpy, XEvent* event, char* arg) { |
|
1941 |
return (event->type == SelectionNotify || |
|
1942 |
event->type == SelectionClear || |
|
1943 |
event->type == PropertyNotify) ? True : False; |
|
1944 |
} |
|
1945 |
||
1946 |
||
1947 |
JNIEXPORT jboolean JNICALL |
|
1948 |
Java_sun_awt_X11_XlibWrapper_XNextSecondaryLoopEvent(JNIEnv *env, jclass clazz, |
|
1949 |
jlong display, jlong ptr) { |
|
17903
643f1ca93dd6
8015375: Edits to text components hang for clipboard access
mcherkas
parents:
17679
diff
changeset
|
1950 |
uint32_t timeout = 1; |
643f1ca93dd6
8015375: Edits to text components hang for clipboard access
mcherkas
parents:
17679
diff
changeset
|
1951 |
|
2 | 1952 |
AWT_CHECK_HAVE_LOCK(); |
1953 |
exitSecondaryLoop = False; |
|
1954 |
while (!exitSecondaryLoop) { |
|
1955 |
if (XCheckIfEvent((Display*) jlong_to_ptr(display), (XEvent*) jlong_to_ptr(ptr), secondary_loop_event, NULL)) { |
|
1956 |
return JNI_TRUE; |
|
1957 |
} |
|
17903
643f1ca93dd6
8015375: Edits to text components hang for clipboard access
mcherkas
parents:
17679
diff
changeset
|
1958 |
timeout = (timeout < AWT_SECONDARY_LOOP_TIMEOUT) ? (timeout << 1) : AWT_SECONDARY_LOOP_TIMEOUT; |
643f1ca93dd6
8015375: Edits to text components hang for clipboard access
mcherkas
parents:
17679
diff
changeset
|
1959 |
AWT_WAIT(timeout); |
2 | 1960 |
} |
1961 |
return JNI_FALSE; |
|
1962 |
} |
|
1963 |
||
1964 |
JNIEXPORT void JNICALL |
|
1965 |
Java_sun_awt_X11_XlibWrapper_ExitSecondaryLoop(JNIEnv *env, jclass clazz) { |
|
1966 |
DASSERT(!exitSecondaryLoop); |
|
1967 |
AWT_CHECK_HAVE_LOCK(); |
|
1968 |
exitSecondaryLoop = True; |
|
1969 |
AWT_NOTIFY_ALL(); |
|
1970 |
} |
|
1971 |
/*******************************************************************************/ |
|
1972 |
||
1973 |
JNIEXPORT jobjectArray JNICALL |
|
1974 |
Java_sun_awt_X11_XlibWrapper_XTextPropertyToStringList(JNIEnv *env, |
|
1975 |
jclass clazz, |
|
1976 |
jbyteArray bytes, |
|
1977 |
jlong encodingAtom) { |
|
1978 |
XTextProperty tp; |
|
1979 |
jbyte *value; |
|
1980 |
||
1981 |
char** strings = (char **)NULL; |
|
1982 |
int32_t nstrings = 0; |
|
1983 |
jobjectArray ret = NULL; |
|
1984 |
int32_t i; |
|
1985 |
jsize len; |
|
1986 |
jboolean isCopy = JNI_FALSE; |
|
1987 |
static jclass stringClass = NULL; |
|
1988 |
jclass stringClassLocal = NULL; |
|
1989 |
||
1990 |
AWT_CHECK_HAVE_LOCK(); |
|
1991 |
||
1992 |
if (JNU_IsNull(env, stringClass)) { |
|
1993 |
stringClassLocal = (*env)->FindClass(env, "java/lang/String"); |
|
1994 |
||
1995 |
if ((*env)->ExceptionCheck(env)) { |
|
1996 |
(*env)->ExceptionDescribe(env); |
|
1997 |
(*env)->ExceptionClear(env); |
|
1998 |
DASSERT(False); |
|
1999 |
} |
|
2000 |
||
2001 |
if (JNU_IsNull(env, stringClassLocal)) { |
|
2002 |
return NULL; |
|
2003 |
} |
|
2004 |
||
2005 |
stringClass = (*env)->NewGlobalRef(env, stringClassLocal); /* never freed! */ |
|
2006 |
(*env)->DeleteLocalRef(env, stringClassLocal); |
|
2007 |
||
2008 |
if (JNU_IsNull(env, stringClass)) { |
|
2009 |
JNU_ThrowOutOfMemoryError(env, ""); |
|
2010 |
return NULL; |
|
2011 |
} |
|
2012 |
} |
|
2013 |
||
2014 |
/* |
|
2015 |
* If the length of the byte array is 0 just return a null |
|
2016 |
*/ |
|
2017 |
len = (*env)->GetArrayLength(env, bytes); |
|
2018 |
if (len == 0) { |
|
2019 |
return (*env)->NewObjectArray(env, 0, stringClass, NULL); |
|
2020 |
} |
|
2021 |
||
2022 |
value = (*env)->GetByteArrayElements(env, bytes, &isCopy); |
|
2023 |
if (JNU_IsNull(env, value)) { |
|
2024 |
return NULL; |
|
2025 |
} |
|
2026 |
||
2027 |
tp.encoding = encodingAtom; |
|
2028 |
tp.value = (unsigned char *)value; |
|
2029 |
tp.nitems = len; |
|
2030 |
tp.format = 8; |
|
2031 |
||
2032 |
/* |
|
2033 |
* Convert the byte stream into a list of X11 strings |
|
2034 |
*/ |
|
2035 |
if (XTextPropertyToStringList(&tp, &strings, &nstrings) == 0) { |
|
2036 |
(*env)->ReleaseByteArrayElements(env, bytes, value, JNI_ABORT); |
|
2037 |
return NULL; |
|
2038 |
} |
|
2039 |
||
2040 |
(*env)->ReleaseByteArrayElements(env, bytes, value, JNI_ABORT); |
|
2041 |
||
2042 |
if (nstrings == 0) { |
|
2043 |
return (*env)->NewObjectArray(env, 0, stringClass, NULL); |
|
2044 |
} |
|
2045 |
||
2046 |
ret = (*env)->NewObjectArray(env, nstrings, stringClass, NULL); |
|
2047 |
||
2048 |
if ((*env)->ExceptionCheck(env)) { |
|
2049 |
(*env)->ExceptionDescribe(env); |
|
2050 |
(*env)->ExceptionClear(env); |
|
2051 |
goto wayout; |
|
2052 |
} |
|
2053 |
||
2054 |
if (JNU_IsNull(env, ret)) { |
|
2055 |
goto wayout; |
|
2056 |
} |
|
2057 |
||
2058 |
for (i = 0; i < nstrings; i++) { |
|
2059 |
jstring string = (*env)->NewStringUTF(env, |
|
2060 |
(const char *)strings[i]); |
|
2061 |
if ((*env)->ExceptionCheck(env)) { |
|
2062 |
(*env)->ExceptionDescribe(env); |
|
2063 |
(*env)->ExceptionClear(env); |
|
2064 |
goto wayout; |
|
2065 |
} |
|
2066 |
||
2067 |
if (JNU_IsNull(env, string)) { |
|
2068 |
goto wayout; |
|
2069 |
} |
|
2070 |
||
2071 |
(*env)->SetObjectArrayElement(env, ret, i, string); |
|
2072 |
||
2073 |
if ((*env)->ExceptionCheck(env)) { |
|
2074 |
(*env)->ExceptionDescribe(env); |
|
2075 |
(*env)->ExceptionClear(env); |
|
2076 |
goto wayout; |
|
2077 |
} |
|
2078 |
||
2079 |
(*env)->DeleteLocalRef(env, string); |
|
2080 |
} |
|
2081 |
||
2082 |
wayout: |
|
2083 |
/* |
|
2084 |
* Clean up and return |
|
2085 |
*/ |
|
2086 |
XFreeStringList(strings); |
|
2087 |
return ret; |
|
2088 |
} |
|
2089 |
||
2090 |
||
2091 |
JNIEXPORT void JNICALL |
|
2092 |
Java_sun_awt_X11_XlibWrapper_XPutBackEvent(JNIEnv *env, |
|
2093 |
jclass clazz, |
|
2094 |
jlong display, |
|
2095 |
jlong event) { |
|
2096 |
XPutBackEvent((Display*)jlong_to_ptr(display), (XEvent*) jlong_to_ptr(event)); |
|
2097 |
} |
|
2098 |
||
2099 |
JNIEXPORT jlong JNICALL |
|
2100 |
Java_sun_awt_X11_XlibWrapper_getAddress(JNIEnv *env, |
|
2101 |
jclass clazz, |
|
2102 |
jobject o) { |
|
2103 |
return ptr_to_jlong(o); |
|
2104 |
} |
|
2105 |
||
2106 |
JNIEXPORT void JNICALL |
|
2107 |
Java_sun_awt_X11_XlibWrapper_copyIntArray(JNIEnv *env, |
|
2108 |
jclass clazz, |
|
2109 |
jlong dest, jobject array, jint size) { |
|
2110 |
jboolean isCopy = JNI_FALSE; |
|
2111 |
jint * ints = (*env)->GetIntArrayElements(env, array, &isCopy); |
|
2112 |
memcpy(jlong_to_ptr(dest), ints, size); |
|
2113 |
if (isCopy) { |
|
2114 |
(*env)->ReleaseIntArrayElements(env, array, ints, JNI_ABORT); |
|
2115 |
} |
|
2116 |
} |
|
2117 |
||
2118 |
JNIEXPORT void JNICALL |
|
2119 |
Java_sun_awt_X11_XlibWrapper_copyLongArray(JNIEnv *env, |
|
2120 |
jclass clazz, |
|
2121 |
jlong dest, jobject array, jint size) { |
|
2122 |
jboolean isCopy = JNI_FALSE; |
|
2123 |
jlong * longs = (*env)->GetLongArrayElements(env, array, &isCopy); |
|
2124 |
memcpy(jlong_to_ptr(dest), longs, size); |
|
2125 |
if (isCopy) { |
|
2126 |
(*env)->ReleaseLongArrayElements(env, array, longs, JNI_ABORT); |
|
2127 |
} |
|
2128 |
} |
|
2129 |
||
2130 |
JNIEXPORT jint JNICALL |
|
2131 |
Java_sun_awt_X11_XlibWrapper_XSynchronize(JNIEnv *env, jclass clazz, jlong display, jboolean onoff) |
|
2132 |
{ |
|
2133 |
return (jint) XSynchronize((Display*)jlong_to_ptr(display), (onoff == JNI_TRUE ? True : False)); |
|
2134 |
} |
|
2135 |
||
2136 |
JNIEXPORT jboolean JNICALL |
|
2137 |
Java_sun_awt_X11_XlibWrapper_XShapeQueryExtension |
|
2138 |
(JNIEnv *env, jclass clazz, jlong display, jlong event_base_return, jlong error_base_return) |
|
2139 |
{ |
|
2140 |
jboolean status; |
|
2141 |
||
2142 |
AWT_CHECK_HAVE_LOCK(); |
|
2143 |
||
2144 |
status = XShapeQueryExtension((Display *)jlong_to_ptr(display), |
|
2145 |
(int *)jlong_to_ptr(event_base_return), (int *)jlong_to_ptr(error_base_return)); |
|
2146 |
return status; |
|
2147 |
} |
|
2148 |
||
2149 |
/* |
|
2150 |
* Class: XlibWrapper |
|
2151 |
* Method: SetRectangularShape |
|
2152 |
*/ |
|
2153 |
||
2154 |
JNIEXPORT void JNICALL |
|
2155 |
Java_sun_awt_X11_XlibWrapper_SetRectangularShape |
|
2156 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, |
|
2157 |
jint x1, jint y1, jint x2, jint y2, |
|
2158 |
jobject region) |
|
2159 |
{ |
|
2160 |
AWT_CHECK_HAVE_LOCK(); |
|
2161 |
||
1978
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2162 |
// If all the params are zeros, the shape must be simply reset. |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2163 |
// Otherwise, the shape may be not rectangular. |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2164 |
if (region || x1 || x2 || y1 || y2) { |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2165 |
XRectangle rects[256]; |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2166 |
XRectangle *pRect = rects; |
2 | 2167 |
|
1978
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2168 |
int numrects = RegionToYXBandedRectangles(env, x1, y1, x2, y2, region, |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2169 |
&pRect, 256); |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2170 |
|
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2171 |
XShapeCombineRectangles((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window), |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2172 |
ShapeClip, 0, 0, pRect, numrects, ShapeSet, YXBanded); |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2173 |
XShapeCombineRectangles((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window), |
2 | 2174 |
ShapeBounding, 0, 0, pRect, numrects, ShapeSet, YXBanded); |
2175 |
||
1978
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2176 |
if (pRect != rects) { |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2177 |
free(pRect); |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2178 |
} |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2179 |
} else { |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2180 |
// Reset the shape to a rectangular form. |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2181 |
XShapeCombineMask((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window), |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2182 |
ShapeClip, 0, 0, None, ShapeSet); |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2183 |
XShapeCombineMask((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window), |
8b981ce05cd0
6797195: Forward-port enhancements for hw/lw mixing from 6u12 to 7
anthony
parents:
1966
diff
changeset
|
2184 |
ShapeBounding, 0, 0, None, ShapeSet); |
2 | 2185 |
} |
2186 |
} |
|
2462
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2187 |
|
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2188 |
/* |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2189 |
* Class: XlibWrapper |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2190 |
* Method: SetZOrder |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2191 |
*/ |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2192 |
|
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2193 |
JNIEXPORT void JNICALL |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2194 |
Java_sun_awt_X11_XlibWrapper_SetZOrder |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2195 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong above) |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2196 |
{ |
6825 | 2197 |
unsigned int value_mask = CWStackMode; |
2462
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2198 |
|
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2199 |
XWindowChanges wc; |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2200 |
wc.sibling = (Window)jlong_to_ptr(above); |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2201 |
|
6825 | 2202 |
AWT_CHECK_HAVE_LOCK(); |
2462
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2203 |
|
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2204 |
if (above == 0) { |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2205 |
wc.stack_mode = Above; |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2206 |
} else { |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2207 |
wc.stack_mode = Below; |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2208 |
value_mask |= CWSibling; |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2209 |
} |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2210 |
|
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2211 |
XConfigureWindow((Display *)jlong_to_ptr(display), |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2212 |
(Window)jlong_to_ptr(window), |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2213 |
value_mask, &wc ); |
192552ca8292
6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents:
1978
diff
changeset
|
2214 |
} |
2472
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2215 |
|
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2216 |
/* |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2217 |
* Class: XlibWrapper |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2218 |
* Method: SetBitmapShape |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2219 |
*/ |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2220 |
JNIEXPORT void JNICALL |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2221 |
Java_sun_awt_X11_XlibWrapper_SetBitmapShape |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2222 |
(JNIEnv *env, jclass clazz, jlong display, jlong window, |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2223 |
jint width, jint height, jintArray bitmap) |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2224 |
{ |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2225 |
jsize len; |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2226 |
jint *values; |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2227 |
jboolean isCopy = JNI_FALSE; |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2228 |
size_t worstBufferSize = (size_t)((width / 2 + 1) * height); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2229 |
RECT_T * pRect; |
6825 | 2230 |
int numrects; |
2472
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2231 |
|
18232 | 2232 |
if (!IS_SAFE_SIZE_MUL(width / 2 + 1, height)) { |
2233 |
return; |
|
2234 |
} |
|
2235 |
||
2472
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2236 |
AWT_CHECK_HAVE_LOCK(); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2237 |
|
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2238 |
len = (*env)->GetArrayLength(env, bitmap); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2239 |
if (len == 0 || len < width * height) { |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2240 |
return; |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2241 |
} |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2242 |
|
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2243 |
values = (*env)->GetIntArrayElements(env, bitmap, &isCopy); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2244 |
if (JNU_IsNull(env, values)) { |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2245 |
return; |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2246 |
} |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2247 |
|
18232 | 2248 |
pRect = (RECT_T *)SAFE_SIZE_ARRAY_ALLOC(malloc, worstBufferSize, sizeof(RECT_T)); |
2249 |
if (!pRect) { |
|
2250 |
return; |
|
2251 |
} |
|
2472
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2252 |
|
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2253 |
/* Note: the values[0] and values[1] are supposed to contain the width |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2254 |
* and height (see XIconInfo.getIntData() for details). So, we do +2. |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2255 |
*/ |
6825 | 2256 |
numrects = BitmapToYXBandedRectangles(32, (int)width, (int)height, |
2472
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2257 |
(unsigned char *)(values + 2), pRect); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2258 |
|
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2259 |
XShapeCombineRectangles((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window), |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2260 |
ShapeClip, 0, 0, pRect, numrects, ShapeSet, YXBanded); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2261 |
XShapeCombineRectangles((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window), |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2262 |
ShapeBounding, 0, 0, pRect, numrects, ShapeSet, YXBanded); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2263 |
|
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2264 |
free(pRect); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2265 |
|
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2266 |
(*env)->ReleaseIntArrayElements(env, bitmap, values, JNI_ABORT); |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2267 |
} |
b7aba00cabb6
6693253: Security Warning appearance requires enhancements
anthony
parents:
2462
diff
changeset
|
2268 |