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