97 |
97 |
98 WindowPropertyGetter wpg = |
98 WindowPropertyGetter wpg = |
99 new WindowPropertyGetter(embedder, |
99 new WindowPropertyGetter(embedder, |
100 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, |
100 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, |
101 0, 0xFFFF, false, |
101 0, 0xFFFF, false, |
102 XlibWrapper.AnyPropertyType); |
102 XConstants.AnyPropertyType); |
103 |
103 |
104 try { |
104 try { |
105 status = wpg.execute(XToolkit.IgnoreBadWindowHandler); |
105 status = wpg.execute(XToolkit.IgnoreBadWindowHandler); |
106 |
106 |
107 /* |
107 /* |
116 * CARD16 num_drop_sites B16; |
116 * CARD16 num_drop_sites B16; |
117 * CARD16 pad2 B16; |
117 * CARD16 pad2 B16; |
118 * CARD32 heap_offset B32; |
118 * CARD32 heap_offset B32; |
119 * } xmDragReceiverInfoStruct; |
119 * } xmDragReceiverInfoStruct; |
120 */ |
120 */ |
121 if (status == (int)XlibWrapper.Success && wpg.getData() != 0 && |
121 if (status == (int)XConstants.Success && wpg.getData() != 0 && |
122 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && |
122 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && |
123 wpg.getNumberOfItems() >= |
123 wpg.getNumberOfItems() >= |
124 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { |
124 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { |
125 |
125 |
126 overriden = true; |
126 overriden = true; |
164 |
164 |
165 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
165 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
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, XlibWrapper.PropModeReplace, |
169 8, XConstants.PropModeReplace, |
170 data, dataSize); |
170 data, dataSize); |
171 XToolkit.RESTORE_XERROR_HANDLER(); |
171 XToolkit.RESTORE_XERROR_HANDLER(); |
172 |
172 |
173 if (XToolkit.saved_error != null && |
173 if (XToolkit.saved_error != null && |
174 XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { |
174 XToolkit.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); |
199 |
199 |
200 WindowPropertyGetter wpg = |
200 WindowPropertyGetter wpg = |
201 new WindowPropertyGetter(embedder, |
201 new WindowPropertyGetter(embedder, |
202 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, |
202 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, |
203 0, 0xFFFF, false, |
203 0, 0xFFFF, false, |
204 XlibWrapper.AnyPropertyType); |
204 XConstants.AnyPropertyType); |
205 |
205 |
206 try { |
206 try { |
207 status = wpg.execute(XToolkit.IgnoreBadWindowHandler); |
207 status = wpg.execute(XToolkit.IgnoreBadWindowHandler); |
208 |
208 |
209 /* |
209 /* |
218 * CARD16 num_drop_sites B16; |
218 * CARD16 num_drop_sites B16; |
219 * CARD16 pad2 B16; |
219 * CARD16 pad2 B16; |
220 * CARD32 heap_offset B32; |
220 * CARD32 heap_offset B32; |
221 * } xmDragReceiverInfoStruct; |
221 * } xmDragReceiverInfoStruct; |
222 */ |
222 */ |
223 if (status == (int)XlibWrapper.Success && wpg.getData() != 0 && |
223 if (status == (int)XConstants.Success && wpg.getData() != 0 && |
224 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && |
224 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && |
225 wpg.getNumberOfItems() >= |
225 wpg.getNumberOfItems() >= |
226 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { |
226 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { |
227 |
227 |
228 int dataSize = MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE; |
228 int dataSize = MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE; |
238 |
238 |
239 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
239 XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler); |
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, XlibWrapper.PropModeReplace, |
243 8, XConstants.PropModeReplace, |
244 data, dataSize); |
244 data, dataSize); |
245 XToolkit.RESTORE_XERROR_HANDLER(); |
245 XToolkit.RESTORE_XERROR_HANDLER(); |
246 |
246 |
247 if (XToolkit.saved_error != null && |
247 if (XToolkit.saved_error != null && |
248 XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { |
248 XToolkit.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(); |
271 |
271 |
272 WindowPropertyGetter wpg = |
272 WindowPropertyGetter wpg = |
273 new WindowPropertyGetter(embedded, |
273 new WindowPropertyGetter(embedded, |
274 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, |
274 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, |
275 0, 0xFFFF, false, |
275 0, 0xFFFF, false, |
276 XlibWrapper.AnyPropertyType); |
276 XConstants.AnyPropertyType); |
277 |
277 |
278 try { |
278 try { |
279 status = wpg.execute(XToolkit.IgnoreBadWindowHandler); |
279 status = wpg.execute(XToolkit.IgnoreBadWindowHandler); |
280 |
280 |
281 /* |
281 /* |
290 * CARD16 num_drop_sites B16; |
290 * CARD16 num_drop_sites B16; |
291 * CARD16 pad2 B16; |
291 * CARD16 pad2 B16; |
292 * CARD32 heap_offset B32; |
292 * CARD32 heap_offset B32; |
293 * } xmDragReceiverInfoStruct; |
293 * } xmDragReceiverInfoStruct; |
294 */ |
294 */ |
295 if (status == (int)XlibWrapper.Success && wpg.getData() != 0 && |
295 if (status == (int)XConstants.Success && wpg.getData() != 0 && |
296 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && |
296 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && |
297 wpg.getNumberOfItems() >= |
297 wpg.getNumberOfItems() >= |
298 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { |
298 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { |
299 |
299 |
300 overriden = true; |
300 overriden = true; |
320 public boolean isProtocolSupported(long window) { |
320 public boolean isProtocolSupported(long window) { |
321 WindowPropertyGetter wpg = |
321 WindowPropertyGetter wpg = |
322 new WindowPropertyGetter(window, |
322 new WindowPropertyGetter(window, |
323 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, |
323 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, |
324 0, 0xFFFF, false, |
324 0, 0xFFFF, false, |
325 XlibWrapper.AnyPropertyType); |
325 XConstants.AnyPropertyType); |
326 |
326 |
327 try { |
327 try { |
328 int status = wpg.execute(XToolkit.IgnoreBadWindowHandler); |
328 int status = wpg.execute(XToolkit.IgnoreBadWindowHandler); |
329 |
329 |
330 if (status == (int)XlibWrapper.Success && wpg.getData() != 0 && |
330 if (status == (int)XConstants.Success && wpg.getData() != 0 && |
331 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && |
331 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && |
332 wpg.getNumberOfItems() >= |
332 wpg.getNumberOfItems() >= |
333 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { |
333 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { |
334 return true; |
334 return true; |
335 } else { |
335 } else { |
375 MotifDnDConstants.XA_MOTIF_DRAG_INITIATOR_INFO.getAtom()); |
375 MotifDnDConstants.XA_MOTIF_DRAG_INITIATOR_INFO.getAtom()); |
376 |
376 |
377 try { |
377 try { |
378 int status = wpg.execute(XToolkit.IgnoreBadWindowHandler); |
378 int status = wpg.execute(XToolkit.IgnoreBadWindowHandler); |
379 |
379 |
380 if (status == XlibWrapper.Success && wpg.getData() != 0 && |
380 if (status == XConstants.Success && wpg.getData() != 0 && |
381 wpg.getActualType() == |
381 wpg.getActualType() == |
382 MotifDnDConstants.XA_MOTIF_DRAG_INITIATOR_INFO.getAtom() && |
382 MotifDnDConstants.XA_MOTIF_DRAG_INITIATOR_INFO.getAtom() && |
383 wpg.getActualFormat() == 8 && |
383 wpg.getActualFormat() == 8 && |
384 wpg.getNumberOfItems() == |
384 wpg.getNumberOfItems() == |
385 MotifDnDConstants.MOTIF_INITIATOR_INFO_SIZE) { |
385 MotifDnDConstants.MOTIF_INITIATOR_INFO_SIZE) { |
418 |
418 |
419 XToolkit.RESTORE_XERROR_HANDLER(); |
419 XToolkit.RESTORE_XERROR_HANDLER(); |
420 |
420 |
421 if (status == 0 || |
421 if (status == 0 || |
422 (XToolkit.saved_error != null && |
422 (XToolkit.saved_error != null && |
423 XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) { |
423 XToolkit.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 { |
430 } |
430 } |
431 |
431 |
432 XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); |
432 XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); |
433 XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win, |
433 XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win, |
434 source_win_mask | |
434 source_win_mask | |
435 XlibWrapper.StructureNotifyMask); |
435 XConstants.StructureNotifyMask); |
436 |
436 |
437 XToolkit.RESTORE_XERROR_HANDLER(); |
437 XToolkit.RESTORE_XERROR_HANDLER(); |
438 |
438 |
439 if (XToolkit.saved_error != null && |
439 if (XToolkit.saved_error != null && |
440 XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { |
440 XToolkit.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; |
588 } |
588 } |
589 |
589 |
590 XClientMessageEvent dummy = new XClientMessageEvent(); |
590 XClientMessageEvent dummy = new XClientMessageEvent(); |
591 |
591 |
592 try { |
592 try { |
593 dummy.set_type(XlibWrapper.ClientMessage); |
593 dummy.set_type(XConstants.ClientMessage); |
594 dummy.set_window(xclient.get_window()); |
594 dummy.set_window(xclient.get_window()); |
595 dummy.set_format(32); |
595 dummy.set_format(32); |
596 dummy.set_message_type(0); |
596 dummy.set_message_type(0); |
597 dummy.set_data(0, 0); |
597 dummy.set_data(0, 0); |
598 dummy.set_data(1, 0); |
598 dummy.set_data(1, 0); |
599 dummy.set_data(2, 0); |
599 dummy.set_data(2, 0); |
600 dummy.set_data(3, 0); |
600 dummy.set_data(3, 0); |
601 dummy.set_data(4, 0); |
601 dummy.set_data(4, 0); |
602 XlibWrapper.XSendEvent(XToolkit.getDisplay(), |
602 XlibWrapper.XSendEvent(XToolkit.getDisplay(), |
603 proxy, false, XlibWrapper.NoEventMask, |
603 proxy, false, XConstants.NoEventMask, |
604 dummy.pData); |
604 dummy.pData); |
605 } finally { |
605 } finally { |
606 dummy.dispose(); |
606 dummy.dispose(); |
607 } |
607 } |
608 } |
608 } |
819 } |
819 } |
820 |
820 |
821 XClientMessageEvent msg = new XClientMessageEvent(); |
821 XClientMessageEvent msg = new XClientMessageEvent(); |
822 |
822 |
823 try { |
823 try { |
824 msg.set_type(XlibWrapper.ClientMessage); |
824 msg.set_type(XConstants.ClientMessage); |
825 msg.set_window(MotifDnDConstants.Swapper.getInt(data + 12, eventByteOrder)); |
825 msg.set_window(MotifDnDConstants.Swapper.getInt(data + 12, eventByteOrder)); |
826 msg.set_format(8); |
826 msg.set_format(8); |
827 msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom()); |
827 msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom()); |
828 |
828 |
829 long responseData = msg.get_data(); |
829 long responseData = msg.get_data(); |