1 /* |
1 /* |
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
160 unsafe.putShort(data + 8, (short)0); /* num_drop_sites */ |
160 unsafe.putShort(data + 8, (short)0); /* num_drop_sites */ |
161 unsafe.putShort(data + 10, (short)0); /* pad */ |
161 unsafe.putShort(data + 10, (short)0); /* pad */ |
162 unsafe.putInt(data + 12, dataSize); |
162 unsafe.putInt(data + 12, dataSize); |
163 } |
163 } |
164 |
164 |
165 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
165 XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
166 XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder, |
166 XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder, |
167 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), |
167 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), |
168 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), |
168 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), |
169 8, XConstants.PropModeReplace, |
169 8, XConstants.PropModeReplace, |
170 data, dataSize); |
170 data, dataSize); |
171 XToolkit.RESTORE_XERROR_HANDLER(); |
171 XErrorHandlerUtil.RESTORE_XERROR_HANDLER(); |
172 |
172 |
173 if (XToolkit.saved_error != null && |
173 if ((XErrorHandlerUtil.saved_error != null) && |
174 XToolkit.saved_error.get_error_code() != XConstants.Success) { |
174 (XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) { |
175 throw new XException("Cannot write Motif receiver info property"); |
175 throw new XException("Cannot write Motif receiver info property"); |
176 } |
176 } |
177 } finally { |
177 } finally { |
178 if (!overriden) { |
178 if (!overriden) { |
179 unsafe.freeMemory(data); |
179 unsafe.freeMemory(data); |
234 tproxy = MotifDnDConstants.Swapper.swap(tproxy); |
234 tproxy = MotifDnDConstants.Swapper.swap(tproxy); |
235 } |
235 } |
236 |
236 |
237 unsafe.putInt(data + 4, tproxy); |
237 unsafe.putInt(data + 4, tproxy); |
238 |
238 |
239 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
239 XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance()); |
240 XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder, |
240 XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder, |
241 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), |
241 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), |
242 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), |
242 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), |
243 8, XConstants.PropModeReplace, |
243 8, XConstants.PropModeReplace, |
244 data, dataSize); |
244 data, dataSize); |
245 XToolkit.RESTORE_XERROR_HANDLER(); |
245 XErrorHandlerUtil.RESTORE_XERROR_HANDLER(); |
246 |
246 |
247 if (XToolkit.saved_error != null && |
247 if ((XErrorHandlerUtil.saved_error != null) && |
248 XToolkit.saved_error.get_error_code() != XConstants.Success) { |
248 (XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) { |
249 throw new XException("Cannot write Motif receiver info property"); |
249 throw new XException("Cannot write Motif receiver info property"); |
250 } |
250 } |
251 } |
251 } |
252 } finally { |
252 } finally { |
253 wpg.dispose(); |
253 wpg.dispose(); |
410 * Select for StructureNotifyMask to receive DestroyNotify in case of source |
410 * Select for StructureNotifyMask to receive DestroyNotify in case of source |
411 * crash. |
411 * crash. |
412 */ |
412 */ |
413 XWindowAttributes wattr = new XWindowAttributes(); |
413 XWindowAttributes wattr = new XWindowAttributes(); |
414 try { |
414 try { |
415 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
415 XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
416 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), |
416 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), |
417 source_win, wattr.pData); |
417 source_win, wattr.pData); |
418 |
418 |
419 XToolkit.RESTORE_XERROR_HANDLER(); |
419 XErrorHandlerUtil.RESTORE_XERROR_HANDLER(); |
420 |
420 |
421 if (status == 0 || |
421 if ((status == 0) || |
422 (XToolkit.saved_error != null && |
422 ((XErrorHandlerUtil.saved_error != null) && |
423 XToolkit.saved_error.get_error_code() != XConstants.Success)) { |
423 (XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success))) { |
424 throw new XException("XGetWindowAttributes failed"); |
424 throw new XException("XGetWindowAttributes failed"); |
425 } |
425 } |
426 |
426 |
427 source_win_mask = wattr.get_your_event_mask(); |
427 source_win_mask = wattr.get_your_event_mask(); |
428 } finally { |
428 } finally { |
429 wattr.dispose(); |
429 wattr.dispose(); |
430 } |
430 } |
431 |
431 |
432 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
432 XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
433 XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win, |
433 XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win, |
434 source_win_mask | |
434 source_win_mask | |
435 XConstants.StructureNotifyMask); |
435 XConstants.StructureNotifyMask); |
436 |
436 |
437 XToolkit.RESTORE_XERROR_HANDLER(); |
437 XErrorHandlerUtil.RESTORE_XERROR_HANDLER(); |
438 |
438 |
439 if (XToolkit.saved_error != null && |
439 if ((XErrorHandlerUtil.saved_error != null) && |
440 XToolkit.saved_error.get_error_code() != XConstants.Success) { |
440 (XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) { |
441 throw new XException("XSelectInput failed"); |
441 throw new XException("XSelectInput failed"); |
442 } |
442 } |
443 |
443 |
444 sourceWindow = source_win; |
444 sourceWindow = source_win; |
445 sourceWindowMask = source_win_mask; |
445 sourceWindowMask = source_win_mask; |
1022 } |
1022 } |
1023 |
1023 |
1024 if (sourceWindow != 0) { |
1024 if (sourceWindow != 0) { |
1025 XToolkit.awtLock(); |
1025 XToolkit.awtLock(); |
1026 try { |
1026 try { |
1027 XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
1027 XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance()); |
1028 XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow, |
1028 XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow, |
1029 sourceWindowMask); |
1029 sourceWindowMask); |
1030 XToolkit.RESTORE_XERROR_HANDLER(); |
1030 XErrorHandlerUtil.RESTORE_XERROR_HANDLER(); |
1031 } finally { |
1031 } finally { |
1032 XToolkit.awtUnlock(); |
1032 XToolkit.awtUnlock(); |
1033 } |
1033 } |
1034 } |
1034 } |
1035 |
1035 |