1 /*
2 * Copyright (c) 2003, 2010, 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
184 0, 0xFFFF, false,
185 XConstants.AnyPropertyType);
186
187 try {
188 int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
189
190 /*
191 * DragICCI.h:
192 *
193 * typedef struct _xmDragReceiverInfoStruct{
194 * BYTE byte_order;
195 * BYTE protocol_version;
196 * BYTE drag_protocol_style;
197 * BYTE pad1;
198 * CARD32 proxy_window B32;
199 * CARD16 num_drop_sites B16;
200 * CARD16 pad2 B16;
201 * CARD32 heap_offset B32;
202 * } xmDragReceiverInfoStruct;
203 */
204 if (status == (int)XConstants.Success && wpg.getData() != 0 &&
205 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
206 wpg.getNumberOfItems() >=
207 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
208
209 long data = wpg.getData();
210 byte byteOrderByte = unsafe.getByte(data);
211 byte dragProtocolStyle = unsafe.getByte(data + 2);
212 switch (dragProtocolStyle) {
213 case MotifDnDConstants.MOTIF_PREFER_PREREGISTER_STYLE :
214 case MotifDnDConstants.MOTIF_PREFER_DYNAMIC_STYLE :
215 case MotifDnDConstants.MOTIF_DYNAMIC_STYLE :
216 case MotifDnDConstants.MOTIF_PREFER_RECEIVER_STYLE :
217 int proxy = unsafe.getInt(data + 4);
218 if (byteOrderByte != MotifDnDConstants.getByteOrderByte()) {
219 proxy = MotifDnDConstants.Swapper.swap(proxy);
220 }
221
222 int protocolVersion = unsafe.getByte(data + 1);
223
224 return new TargetWindowInfo(proxy, protocolVersion);
|
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
184 0, 0xFFFF, false,
185 XConstants.AnyPropertyType);
186
187 try {
188 int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
189
190 /*
191 * DragICCI.h:
192 *
193 * typedef struct _xmDragReceiverInfoStruct{
194 * BYTE byte_order;
195 * BYTE protocol_version;
196 * BYTE drag_protocol_style;
197 * BYTE pad1;
198 * CARD32 proxy_window B32;
199 * CARD16 num_drop_sites B16;
200 * CARD16 pad2 B16;
201 * CARD32 heap_offset B32;
202 * } xmDragReceiverInfoStruct;
203 */
204 if (status == XConstants.Success && wpg.getData() != 0 &&
205 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
206 wpg.getNumberOfItems() >=
207 MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
208
209 long data = wpg.getData();
210 byte byteOrderByte = unsafe.getByte(data);
211 byte dragProtocolStyle = unsafe.getByte(data + 2);
212 switch (dragProtocolStyle) {
213 case MotifDnDConstants.MOTIF_PREFER_PREREGISTER_STYLE :
214 case MotifDnDConstants.MOTIF_PREFER_DYNAMIC_STYLE :
215 case MotifDnDConstants.MOTIF_DYNAMIC_STYLE :
216 case MotifDnDConstants.MOTIF_PREFER_RECEIVER_STYLE :
217 int proxy = unsafe.getInt(data + 4);
218 if (byteOrderByte != MotifDnDConstants.getByteOrderByte()) {
219 proxy = MotifDnDConstants.Swapper.swap(proxy);
220 }
221
222 int protocolVersion = unsafe.getByte(data + 1);
223
224 return new TargetWindowInfo(proxy, protocolVersion);
|