1 /*
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.
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
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 *
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
101 0, 0xFFFF, false,
102 XConstants.AnyPropertyType);
103
104 try {
105 status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
106
107 /*
108 * DragICCI.h:
109 *
110 * typedef struct _xmDragReceiverInfoStruct{
111 * BYTE byte_order;
112 * BYTE protocol_version;
113 * BYTE drag_protocol_style;
114 * BYTE pad1;
115 * CARD32 proxy_window B32;
116 * CARD16 num_drop_sites B16;
117 * CARD16 pad2 B16;
118 * CARD32 heap_offset B32;
119 * } xmDragReceiverInfoStruct;
120 */
121 if (status == (int)XConstants.Success && wpg.getData() != 0 &&
122 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
123 wpg.getNumberOfItems() >=
124 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
125
126 overriden = true;
127 data = wpg.getData();
128 dataSize = wpg.getNumberOfItems();
129
130 byte byteOrderByte = unsafe.getByte(data);
131
132 {
133 int tproxy = unsafe.getInt(data + 4);
134 if (byteOrderByte != MotifDnDConstants.getByteOrderByte()) {
135 tproxy = MotifDnDConstants.Swapper.swap(tproxy);
136 }
137 proxy = tproxy;
138 }
139
140 if (proxy == newProxy) {
141 // Embedder already registered.
203 0, 0xFFFF, false,
204 XConstants.AnyPropertyType);
205
206 try {
207 status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
208
209 /*
210 * DragICCI.h:
211 *
212 * typedef struct _xmDragReceiverInfoStruct{
213 * BYTE byte_order;
214 * BYTE protocol_version;
215 * BYTE drag_protocol_style;
216 * BYTE pad1;
217 * CARD32 proxy_window B32;
218 * CARD16 num_drop_sites B16;
219 * CARD16 pad2 B16;
220 * CARD32 heap_offset B32;
221 * } xmDragReceiverInfoStruct;
222 */
223 if (status == (int)XConstants.Success && wpg.getData() != 0 &&
224 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
225 wpg.getNumberOfItems() >=
226 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
227
228 int dataSize = MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE;
229 long data = wpg.getData();
230 byte byteOrderByte = unsafe.getByte(data);
231
232 int tproxy = (int)entry.getProxy();
233 if (MotifDnDConstants.getByteOrderByte() != byteOrderByte) {
234 tproxy = MotifDnDConstants.Swapper.swap(tproxy);
235 }
236
237 unsafe.putInt(data + 4, tproxy);
238
239 XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
240 XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
241 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
242 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
243 8, XConstants.PropModeReplace,
275 0, 0xFFFF, false,
276 XConstants.AnyPropertyType);
277
278 try {
279 status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
280
281 /*
282 * DragICCI.h:
283 *
284 * typedef struct _xmDragReceiverInfoStruct{
285 * BYTE byte_order;
286 * BYTE protocol_version;
287 * BYTE drag_protocol_style;
288 * BYTE pad1;
289 * CARD32 proxy_window B32;
290 * CARD16 num_drop_sites B16;
291 * CARD16 pad2 B16;
292 * CARD32 heap_offset B32;
293 * } xmDragReceiverInfoStruct;
294 */
295 if (status == (int)XConstants.Success && wpg.getData() != 0 &&
296 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
297 wpg.getNumberOfItems() >=
298 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
299
300 overriden = true;
301 long data = wpg.getData();
302
303 byte byteOrderByte = unsafe.getByte(data);
304
305 {
306 int tproxy = unsafe.getInt(data + 4);
307 if (byteOrderByte != MotifDnDConstants.getByteOrderByte()) {
308 tproxy = MotifDnDConstants.Swapper.swap(tproxy);
309 }
310 proxy = tproxy;
311 }
312 }
313 } finally {
314 wpg.dispose();
315 }
316
317 putEmbedderRegistryEntry(embedded, overriden, version, proxy);
318 }
319
320 public boolean isProtocolSupported(long window) {
321 WindowPropertyGetter wpg =
322 new WindowPropertyGetter(window,
323 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
324 0, 0xFFFF, false,
325 XConstants.AnyPropertyType);
326
327 try {
328 int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
329
330 if (status == (int)XConstants.Success && wpg.getData() != 0 &&
331 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
332 wpg.getNumberOfItems() >=
333 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
334 return true;
335 } else {
336 return false;
337 }
338 } finally {
339 wpg.dispose();
340 }
341 }
342
343 private boolean processTopLevelEnter(XClientMessageEvent xclient) {
344 assert XToolkit.isAWTLockHeldByCurrentThread();
345
346 if (targetXWindow != null || sourceWindow != 0) {
347 return false;
348 }
349
350 if (!(XToolkit.windowToXWindow(xclient.get_window()) instanceof XWindow)
|
1 /*
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
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 *
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
101 0, 0xFFFF, false,
102 XConstants.AnyPropertyType);
103
104 try {
105 status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
106
107 /*
108 * DragICCI.h:
109 *
110 * typedef struct _xmDragReceiverInfoStruct{
111 * BYTE byte_order;
112 * BYTE protocol_version;
113 * BYTE drag_protocol_style;
114 * BYTE pad1;
115 * CARD32 proxy_window B32;
116 * CARD16 num_drop_sites B16;
117 * CARD16 pad2 B16;
118 * CARD32 heap_offset B32;
119 * } xmDragReceiverInfoStruct;
120 */
121 if (status == XConstants.Success && wpg.getData() != 0 &&
122 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
123 wpg.getNumberOfItems() >=
124 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
125
126 overriden = true;
127 data = wpg.getData();
128 dataSize = wpg.getNumberOfItems();
129
130 byte byteOrderByte = unsafe.getByte(data);
131
132 {
133 int tproxy = unsafe.getInt(data + 4);
134 if (byteOrderByte != MotifDnDConstants.getByteOrderByte()) {
135 tproxy = MotifDnDConstants.Swapper.swap(tproxy);
136 }
137 proxy = tproxy;
138 }
139
140 if (proxy == newProxy) {
141 // Embedder already registered.
203 0, 0xFFFF, false,
204 XConstants.AnyPropertyType);
205
206 try {
207 status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
208
209 /*
210 * DragICCI.h:
211 *
212 * typedef struct _xmDragReceiverInfoStruct{
213 * BYTE byte_order;
214 * BYTE protocol_version;
215 * BYTE drag_protocol_style;
216 * BYTE pad1;
217 * CARD32 proxy_window B32;
218 * CARD16 num_drop_sites B16;
219 * CARD16 pad2 B16;
220 * CARD32 heap_offset B32;
221 * } xmDragReceiverInfoStruct;
222 */
223 if (status == XConstants.Success && wpg.getData() != 0 &&
224 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
225 wpg.getNumberOfItems() >=
226 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
227
228 int dataSize = MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE;
229 long data = wpg.getData();
230 byte byteOrderByte = unsafe.getByte(data);
231
232 int tproxy = (int)entry.getProxy();
233 if (MotifDnDConstants.getByteOrderByte() != byteOrderByte) {
234 tproxy = MotifDnDConstants.Swapper.swap(tproxy);
235 }
236
237 unsafe.putInt(data + 4, tproxy);
238
239 XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
240 XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
241 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
242 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
243 8, XConstants.PropModeReplace,
275 0, 0xFFFF, false,
276 XConstants.AnyPropertyType);
277
278 try {
279 status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
280
281 /*
282 * DragICCI.h:
283 *
284 * typedef struct _xmDragReceiverInfoStruct{
285 * BYTE byte_order;
286 * BYTE protocol_version;
287 * BYTE drag_protocol_style;
288 * BYTE pad1;
289 * CARD32 proxy_window B32;
290 * CARD16 num_drop_sites B16;
291 * CARD16 pad2 B16;
292 * CARD32 heap_offset B32;
293 * } xmDragReceiverInfoStruct;
294 */
295 if (status == XConstants.Success && wpg.getData() != 0 &&
296 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
297 wpg.getNumberOfItems() >=
298 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
299
300 overriden = true;
301 long data = wpg.getData();
302
303 byte byteOrderByte = unsafe.getByte(data);
304
305 {
306 int tproxy = unsafe.getInt(data + 4);
307 if (byteOrderByte != MotifDnDConstants.getByteOrderByte()) {
308 tproxy = MotifDnDConstants.Swapper.swap(tproxy);
309 }
310 proxy = tproxy;
311 }
312 }
313 } finally {
314 wpg.dispose();
315 }
316
317 putEmbedderRegistryEntry(embedded, overriden, version, proxy);
318 }
319
320 public boolean isProtocolSupported(long window) {
321 WindowPropertyGetter wpg =
322 new WindowPropertyGetter(window,
323 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
324 0, 0xFFFF, false,
325 XConstants.AnyPropertyType);
326
327 try {
328 int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
329
330 if (status == XConstants.Success && wpg.getData() != 0 &&
331 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
332 wpg.getNumberOfItems() >=
333 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
334 return true;
335 } else {
336 return false;
337 }
338 } finally {
339 wpg.dispose();
340 }
341 }
342
343 private boolean processTopLevelEnter(XClientMessageEvent xclient) {
344 assert XToolkit.isAWTLockHeldByCurrentThread();
345
346 if (targetXWindow != null || sourceWindow != 0) {
347 return false;
348 }
349
350 if (!(XToolkit.windowToXWindow(xclient.get_window()) instanceof XWindow)
|