equal
deleted
inserted
replaced
86 long data = Native.allocateLongArray(1); |
86 long data = Native.allocateLongArray(1); |
87 |
87 |
88 try { |
88 try { |
89 Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION); |
89 Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION); |
90 |
90 |
91 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
91 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
92 XDnDConstants.XA_XdndAware.setAtomData(window, XAtom.XA_ATOM, data, 1); |
92 XDnDConstants.XA_XdndAware.setAtomData(window, XAtom.XA_ATOM, data, 1); |
93 XToolkit.RESTORE_XERROR_HANDLER(); |
93 XToolkit.RESTORE_XERROR_HANDLER(); |
94 |
94 |
95 if (XToolkit.saved_error != null && |
95 if (XToolkit.saved_error != null && |
96 XToolkit.saved_error.get_error_code() != XConstants.Success) { |
96 XToolkit.saved_error.get_error_code() != XConstants.Success) { |
120 WindowPropertyGetter wpg1 = |
120 WindowPropertyGetter wpg1 = |
121 new WindowPropertyGetter(embedder, XDnDConstants.XA_XdndAware, 0, 1, |
121 new WindowPropertyGetter(embedder, XDnDConstants.XA_XdndAware, 0, 1, |
122 false, XConstants.AnyPropertyType); |
122 false, XConstants.AnyPropertyType); |
123 |
123 |
124 try { |
124 try { |
125 status = wpg1.execute(XToolkit.IgnoreBadWindowHandler); |
125 status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
126 |
126 |
127 if (status == XConstants.Success && |
127 if (status == XConstants.Success && |
128 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) { |
128 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) { |
129 |
129 |
130 overriden = true; |
130 overriden = true; |
139 WindowPropertyGetter wpg2 = |
139 WindowPropertyGetter wpg2 = |
140 new WindowPropertyGetter(embedder, XDnDConstants.XA_XdndProxy, |
140 new WindowPropertyGetter(embedder, XDnDConstants.XA_XdndProxy, |
141 0, 1, false, XAtom.XA_WINDOW); |
141 0, 1, false, XAtom.XA_WINDOW); |
142 |
142 |
143 try { |
143 try { |
144 status = wpg2.execute(XToolkit.IgnoreBadWindowHandler); |
144 status = wpg2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
145 |
145 |
146 if (status == XConstants.Success && |
146 if (status == XConstants.Success && |
147 wpg2.getData() != 0 && |
147 wpg2.getData() != 0 && |
148 wpg2.getActualType() == XAtom.XA_WINDOW) { |
148 wpg2.getActualType() == XAtom.XA_WINDOW) { |
149 |
149 |
157 WindowPropertyGetter wpg3 = |
157 WindowPropertyGetter wpg3 = |
158 new WindowPropertyGetter(proxy, XDnDConstants.XA_XdndProxy, |
158 new WindowPropertyGetter(proxy, XDnDConstants.XA_XdndProxy, |
159 0, 1, false, XAtom.XA_WINDOW); |
159 0, 1, false, XAtom.XA_WINDOW); |
160 |
160 |
161 try { |
161 try { |
162 status = wpg3.execute(XToolkit.IgnoreBadWindowHandler); |
162 status = wpg3.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
163 |
163 |
164 if (status != XConstants.Success || |
164 if (status != XConstants.Success || |
165 wpg3.getData() == 0 || |
165 wpg3.getData() == 0 || |
166 wpg3.getActualType() != XAtom.XA_WINDOW || |
166 wpg3.getActualType() != XAtom.XA_WINDOW || |
167 Native.getLong(wpg3.getData()) != proxy) { |
167 Native.getLong(wpg3.getData()) != proxy) { |
173 XDnDConstants.XA_XdndAware, |
173 XDnDConstants.XA_XdndAware, |
174 0, 1, false, |
174 0, 1, false, |
175 XConstants.AnyPropertyType); |
175 XConstants.AnyPropertyType); |
176 |
176 |
177 try { |
177 try { |
178 status = wpg4.execute(XToolkit.IgnoreBadWindowHandler); |
178 status = wpg4.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
179 |
179 |
180 if (status != XConstants.Success || |
180 if (status != XConstants.Success || |
181 wpg4.getData() == 0 || |
181 wpg4.getData() == 0 || |
182 wpg4.getActualType() != XAtom.XA_ATOM) { |
182 wpg4.getActualType() != XAtom.XA_ATOM) { |
183 |
183 |
203 try { |
203 try { |
204 Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION); |
204 Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION); |
205 |
205 |
206 /* The proxy window must have the XdndAware set, as XDnD protocol |
206 /* The proxy window must have the XdndAware set, as XDnD protocol |
207 prescribes to check the proxy window for XdndAware. */ |
207 prescribes to check the proxy window for XdndAware. */ |
208 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
208 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
209 XDnDConstants.XA_XdndAware.setAtomData(newProxy, XAtom.XA_ATOM, |
209 XDnDConstants.XA_XdndAware.setAtomData(newProxy, XAtom.XA_ATOM, |
210 data, 1); |
210 data, 1); |
211 XToolkit.RESTORE_XERROR_HANDLER(); |
211 XToolkit.RESTORE_XERROR_HANDLER(); |
212 |
212 |
213 if (XToolkit.saved_error != null && |
213 if (XToolkit.saved_error != null && |
217 } |
217 } |
218 |
218 |
219 Native.putLong(data, 0, newProxy); |
219 Native.putLong(data, 0, newProxy); |
220 |
220 |
221 /* The proxy window must have the XdndProxy set to point to itself.*/ |
221 /* The proxy window must have the XdndProxy set to point to itself.*/ |
222 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
222 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
223 XDnDConstants.XA_XdndProxy.setAtomData(newProxy, XAtom.XA_WINDOW, |
223 XDnDConstants.XA_XdndProxy.setAtomData(newProxy, XAtom.XA_WINDOW, |
224 data, 1); |
224 data, 1); |
225 XToolkit.RESTORE_XERROR_HANDLER(); |
225 XToolkit.RESTORE_XERROR_HANDLER(); |
226 |
226 |
227 if (XToolkit.saved_error != null && |
227 if (XToolkit.saved_error != null && |
230 throw new XException("Cannot write XdndProxy property"); |
230 throw new XException("Cannot write XdndProxy property"); |
231 } |
231 } |
232 |
232 |
233 Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION); |
233 Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION); |
234 |
234 |
235 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
235 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
236 XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM, |
236 XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM, |
237 data, 1); |
237 data, 1); |
238 XToolkit.RESTORE_XERROR_HANDLER(); |
238 XToolkit.RESTORE_XERROR_HANDLER(); |
239 |
239 |
240 if (XToolkit.saved_error != null && |
240 if (XToolkit.saved_error != null && |
243 throw new XException("Cannot write XdndAware property"); |
243 throw new XException("Cannot write XdndAware property"); |
244 } |
244 } |
245 |
245 |
246 Native.putLong(data, 0, newProxy); |
246 Native.putLong(data, 0, newProxy); |
247 |
247 |
248 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
248 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
249 XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW, |
249 XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW, |
250 data, 1); |
250 data, 1); |
251 XToolkit.RESTORE_XERROR_HANDLER(); |
251 XToolkit.RESTORE_XERROR_HANDLER(); |
252 |
252 |
253 if (XToolkit.saved_error != null && |
253 if (XToolkit.saved_error != null && |
276 long data = Native.allocateLongArray(1); |
276 long data = Native.allocateLongArray(1); |
277 |
277 |
278 try { |
278 try { |
279 Native.putLong(data, 0, entry.getVersion()); |
279 Native.putLong(data, 0, entry.getVersion()); |
280 |
280 |
281 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
281 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
282 XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM, |
282 XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM, |
283 data, 1); |
283 data, 1); |
284 XToolkit.RESTORE_XERROR_HANDLER(); |
284 XToolkit.RESTORE_XERROR_HANDLER(); |
285 |
285 |
286 if (XToolkit.saved_error != null && |
286 if (XToolkit.saved_error != null && |
289 throw new XException("Cannot write XdndAware property"); |
289 throw new XException("Cannot write XdndAware property"); |
290 } |
290 } |
291 |
291 |
292 Native.putLong(data, 0, (int)entry.getProxy()); |
292 Native.putLong(data, 0, (int)entry.getProxy()); |
293 |
293 |
294 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
294 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
295 XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW, |
295 XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW, |
296 data, 1); |
296 data, 1); |
297 XToolkit.RESTORE_XERROR_HANDLER(); |
297 XToolkit.RESTORE_XERROR_HANDLER(); |
298 |
298 |
299 if (XToolkit.saved_error != null && |
299 if (XToolkit.saved_error != null && |
327 WindowPropertyGetter wpg1 = |
327 WindowPropertyGetter wpg1 = |
328 new WindowPropertyGetter(embedded, XDnDConstants.XA_XdndAware, 0, 1, |
328 new WindowPropertyGetter(embedded, XDnDConstants.XA_XdndAware, 0, 1, |
329 false, XConstants.AnyPropertyType); |
329 false, XConstants.AnyPropertyType); |
330 |
330 |
331 try { |
331 try { |
332 status = wpg1.execute(XToolkit.IgnoreBadWindowHandler); |
332 status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
333 |
333 |
334 if (status == XConstants.Success && |
334 if (status == XConstants.Success && |
335 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) { |
335 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) { |
336 |
336 |
337 overriden = true; |
337 overriden = true; |
346 WindowPropertyGetter wpg2 = |
346 WindowPropertyGetter wpg2 = |
347 new WindowPropertyGetter(embedded, XDnDConstants.XA_XdndProxy, |
347 new WindowPropertyGetter(embedded, XDnDConstants.XA_XdndProxy, |
348 0, 1, false, XAtom.XA_WINDOW); |
348 0, 1, false, XAtom.XA_WINDOW); |
349 |
349 |
350 try { |
350 try { |
351 status = wpg2.execute(XToolkit.IgnoreBadWindowHandler); |
351 status = wpg2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
352 |
352 |
353 if (status == XConstants.Success && |
353 if (status == XConstants.Success && |
354 wpg2.getData() != 0 && |
354 wpg2.getData() != 0 && |
355 wpg2.getActualType() == XAtom.XA_WINDOW) { |
355 wpg2.getActualType() == XAtom.XA_WINDOW) { |
356 |
356 |
364 WindowPropertyGetter wpg3 = |
364 WindowPropertyGetter wpg3 = |
365 new WindowPropertyGetter(proxy, XDnDConstants.XA_XdndProxy, |
365 new WindowPropertyGetter(proxy, XDnDConstants.XA_XdndProxy, |
366 0, 1, false, XAtom.XA_WINDOW); |
366 0, 1, false, XAtom.XA_WINDOW); |
367 |
367 |
368 try { |
368 try { |
369 status = wpg3.execute(XToolkit.IgnoreBadWindowHandler); |
369 status = wpg3.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
370 |
370 |
371 if (status != XConstants.Success || |
371 if (status != XConstants.Success || |
372 wpg3.getData() == 0 || |
372 wpg3.getData() == 0 || |
373 wpg3.getActualType() != XAtom.XA_WINDOW || |
373 wpg3.getActualType() != XAtom.XA_WINDOW || |
374 Native.getLong(wpg3.getData()) != proxy) { |
374 Native.getLong(wpg3.getData()) != proxy) { |
380 XDnDConstants.XA_XdndAware, |
380 XDnDConstants.XA_XdndAware, |
381 0, 1, false, |
381 0, 1, false, |
382 XConstants.AnyPropertyType); |
382 XConstants.AnyPropertyType); |
383 |
383 |
384 try { |
384 try { |
385 status = wpg4.execute(XToolkit.IgnoreBadWindowHandler); |
385 status = wpg4.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
386 |
386 |
387 if (status != XConstants.Success || |
387 if (status != XConstants.Success || |
388 wpg4.getData() == 0 || |
388 wpg4.getData() == 0 || |
389 wpg4.getActualType() != XAtom.XA_ATOM) { |
389 wpg4.getActualType() != XAtom.XA_ATOM) { |
390 |
390 |
409 WindowPropertyGetter wpg1 = |
409 WindowPropertyGetter wpg1 = |
410 new WindowPropertyGetter(window, XDnDConstants.XA_XdndAware, 0, 1, |
410 new WindowPropertyGetter(window, XDnDConstants.XA_XdndAware, 0, 1, |
411 false, XConstants.AnyPropertyType); |
411 false, XConstants.AnyPropertyType); |
412 |
412 |
413 try { |
413 try { |
414 int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler); |
414 int status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
415 |
415 |
416 if (status == XConstants.Success && |
416 if (status == XConstants.Success && |
417 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) { |
417 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) { |
418 |
418 |
419 return true; |
419 return true; |
471 new WindowPropertyGetter(source_win, |
471 new WindowPropertyGetter(source_win, |
472 XDnDConstants.XA_XdndActionList, |
472 XDnDConstants.XA_XdndActionList, |
473 0, 0xFFFF, false, |
473 0, 0xFFFF, false, |
474 XAtom.XA_ATOM); |
474 XAtom.XA_ATOM); |
475 try { |
475 try { |
476 wpg.execute(XToolkit.IgnoreBadWindowHandler); |
476 wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
477 |
477 |
478 if (wpg.getActualType() == XAtom.XA_ATOM && |
478 if (wpg.getActualType() == XAtom.XA_ATOM && |
479 wpg.getActualFormat() == 32) { |
479 wpg.getActualFormat() == 32) { |
480 long data = wpg.getData(); |
480 long data = wpg.getData(); |
481 |
481 |
503 new WindowPropertyGetter(source_win, |
503 new WindowPropertyGetter(source_win, |
504 XDnDConstants.XA_XdndTypeList, |
504 XDnDConstants.XA_XdndTypeList, |
505 0, 0xFFFF, false, |
505 0, 0xFFFF, false, |
506 XAtom.XA_ATOM); |
506 XAtom.XA_ATOM); |
507 try { |
507 try { |
508 wpg.execute(XToolkit.IgnoreBadWindowHandler); |
508 wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
509 |
509 |
510 if (wpg.getActualType() == XAtom.XA_ATOM && |
510 if (wpg.getActualType() == XAtom.XA_ATOM && |
511 wpg.getActualFormat() == 32) { |
511 wpg.getActualFormat() == 32) { |
512 formats = Native.toLongs(wpg.getData(), |
512 formats = Native.toLongs(wpg.getData(), |
513 wpg.getNumberOfItems()); |
513 wpg.getNumberOfItems()); |
539 * Select for StructureNotifyMask to receive DestroyNotify in case of source |
539 * Select for StructureNotifyMask to receive DestroyNotify in case of source |
540 * crash. |
540 * crash. |
541 */ |
541 */ |
542 XWindowAttributes wattr = new XWindowAttributes(); |
542 XWindowAttributes wattr = new XWindowAttributes(); |
543 try { |
543 try { |
544 XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); |
544 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
545 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), |
545 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), |
546 source_win, wattr.pData); |
546 source_win, wattr.pData); |
547 |
547 |
548 XToolkit.RESTORE_XERROR_HANDLER(); |
548 XToolkit.RESTORE_XERROR_HANDLER(); |
549 |
549 |
556 source_win_mask = wattr.get_your_event_mask(); |
556 source_win_mask = wattr.get_your_event_mask(); |
557 } finally { |
557 } finally { |
558 wattr.dispose(); |
558 wattr.dispose(); |
559 } |
559 } |
560 |
560 |
561 XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); |
561 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
562 XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win, |
562 XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win, |
563 source_win_mask | |
563 source_win_mask | |
564 XConstants.StructureNotifyMask); |
564 XConstants.StructureNotifyMask); |
565 |
565 |
566 XToolkit.RESTORE_XERROR_HANDLER(); |
566 XToolkit.RESTORE_XERROR_HANDLER(); |
961 } |
961 } |
962 |
962 |
963 if (sourceWindow != 0) { |
963 if (sourceWindow != 0) { |
964 XToolkit.awtLock(); |
964 XToolkit.awtLock(); |
965 try { |
965 try { |
966 XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); |
966 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
967 XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow, |
967 XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow, |
968 sourceWindowMask); |
968 sourceWindowMask); |
969 XToolkit.RESTORE_XERROR_HANDLER(); |
969 XToolkit.RESTORE_XERROR_HANDLER(); |
970 } finally { |
970 } finally { |
971 XToolkit.awtUnlock(); |
971 XToolkit.awtUnlock(); |
1102 new WindowPropertyGetter(xclient.get_data(0), |
1102 new WindowPropertyGetter(xclient.get_data(0), |
1103 XDnDConstants.XA_XdndTypeList, |
1103 XDnDConstants.XA_XdndTypeList, |
1104 0, 0xFFFF, false, |
1104 0, 0xFFFF, false, |
1105 XAtom.XA_ATOM); |
1105 XAtom.XA_ATOM); |
1106 try { |
1106 try { |
1107 wpg.execute(XToolkit.IgnoreBadWindowHandler); |
1107 wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
1108 |
1108 |
1109 if (wpg.getActualType() == XAtom.XA_ATOM && |
1109 if (wpg.getActualType() == XAtom.XA_ATOM && |
1110 wpg.getActualFormat() == 32) { |
1110 wpg.getActualFormat() == 32) { |
1111 |
1111 |
1112 XToolkit.awtLock(); |
1112 XToolkit.awtLock(); |
1113 try { |
1113 try { |
1114 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
1114 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
1115 XDnDConstants.XA_XdndTypeList.setAtomData(xclient.get_window(), |
1115 XDnDConstants.XA_XdndTypeList.setAtomData(xclient.get_window(), |
1116 XAtom.XA_ATOM, |
1116 XAtom.XA_ATOM, |
1117 wpg.getData(), |
1117 wpg.getData(), |
1118 wpg.getNumberOfItems()); |
1118 wpg.getNumberOfItems()); |
1119 XToolkit.RESTORE_XERROR_HANDLER(); |
1119 XToolkit.RESTORE_XERROR_HANDLER(); |