src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java

Print this page


   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


 988         int version = entry.getVersion();
 989         if (xclient.get_message_type() == XDnDConstants.XA_XdndEnter.getAtom()) {
 990             int min_version = sourceProtocolVersion < version ?
 991                 sourceProtocolVersion : version;
 992             long data1 = min_version << XDnDConstants.XDND_PROTOCOL_SHIFT;
 993             if (sourceFormats != null && sourceFormats.length > 3) {
 994                 data1 |= XDnDConstants.XDND_DATA_TYPES_BIT;
 995             }
 996             if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
 997                 logger.finest("         "
 998                               + " entryVersion=" + version
 999                               + " sourceProtocolVersion=" +
1000                               sourceProtocolVersion
1001                               + " sourceFormats.length=" +
1002                               (sourceFormats != null ? sourceFormats.length : 0));
1003             }
1004             xclient.set_data(1, data1);
1005         }
1006     }
1007 

1008     private void notifyProtocolListener(XWindow xwindow, int x, int y,
1009                                         int dropAction,
1010                                         XClientMessageEvent xclient,
1011                                         int eventID) {
1012         long nativeCtxt = 0;
1013 
1014         // Make a copy of the passed XClientMessageEvent structure, since
1015         // the original structure can be freed before this
1016         // SunDropTargetEvent is dispatched.
1017         if (xclient != null) {
1018             int size = new XClientMessageEvent(nativeCtxt).getSize();
1019 
1020             nativeCtxt = unsafe.allocateMemory(size + 4 * Native.getLongSize());
1021 
1022             unsafe.copyMemory(xclient.pData, nativeCtxt, size);
1023 
1024             long data1 = sourceProtocolVersion << XDnDConstants.XDND_PROTOCOL_SHIFT;
1025             if (sourceFormats != null && sourceFormats.length > 3) {
1026                 data1 |= XDnDConstants.XDND_DATA_TYPES_BIT;
1027             }


1130                         wpg.dispose();
1131                     }
1132                 }
1133                 XDragSourceContextPeer.setProxyModeSourceWindow(xclient.get_data(0));
1134 
1135                 sendEnterMessageToToplevelImpl(embedded, xclient.get_window(),
1136                                                data1, data2, data3, data4);
1137                 overXEmbedClient = true;
1138             }
1139 
1140             if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
1141                 logger.finest("         2 "
1142                               + " embedded=" + embedded
1143                               + " xclient=" + xclient);
1144             }
1145 
1146             /* Make a copy of the original event, since we are going to modify the
1147                event while it still can be referenced from other Java events. */
1148             {
1149                 XClientMessageEvent copy = new XClientMessageEvent();
1150                 unsafe.copyMemory(xclient.pData, copy.pData, copy.getSize());
1151 
1152                 copy.set_data(0, xclient.get_window());
1153 
1154                 forwardClientMessageToToplevel(embedded, copy);
1155             }
1156         }
1157 
1158         if (eventID == MouseEvent.MOUSE_EXITED) {
1159             if (overXEmbedClient) {
1160                 if (ctxt != 0 || prevCtxt != 0) {
1161                     // Last chance to send XdndLeave to the XEmbed client.
1162                     XClientMessageEvent xclient = ctxt != 0 ?
1163                         new XClientMessageEvent(ctxt) :
1164                         new XClientMessageEvent(prevCtxt);
1165                     sendLeaveMessageToToplevelImpl(embedded, xclient.get_window());
1166                 }
1167                 overXEmbedClient = false;
1168                 // We have to clear the proxy mode source window here,
1169                 // when the drag exits the XEmbedCanvasPeer.
1170                 // NOTE: at this point the XEmbed client still might have some


   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


 988         int version = entry.getVersion();
 989         if (xclient.get_message_type() == XDnDConstants.XA_XdndEnter.getAtom()) {
 990             int min_version = sourceProtocolVersion < version ?
 991                 sourceProtocolVersion : version;
 992             long data1 = min_version << XDnDConstants.XDND_PROTOCOL_SHIFT;
 993             if (sourceFormats != null && sourceFormats.length > 3) {
 994                 data1 |= XDnDConstants.XDND_DATA_TYPES_BIT;
 995             }
 996             if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
 997                 logger.finest("         "
 998                               + " entryVersion=" + version
 999                               + " sourceProtocolVersion=" +
1000                               sourceProtocolVersion
1001                               + " sourceFormats.length=" +
1002                               (sourceFormats != null ? sourceFormats.length : 0));
1003             }
1004             xclient.set_data(1, data1);
1005         }
1006     }
1007 
1008     @SuppressWarnings("static")
1009     private void notifyProtocolListener(XWindow xwindow, int x, int y,
1010                                         int dropAction,
1011                                         XClientMessageEvent xclient,
1012                                         int eventID) {
1013         long nativeCtxt = 0;
1014 
1015         // Make a copy of the passed XClientMessageEvent structure, since
1016         // the original structure can be freed before this
1017         // SunDropTargetEvent is dispatched.
1018         if (xclient != null) {
1019             int size = new XClientMessageEvent(nativeCtxt).getSize();
1020 
1021             nativeCtxt = unsafe.allocateMemory(size + 4 * Native.getLongSize());
1022 
1023             unsafe.copyMemory(xclient.pData, nativeCtxt, size);
1024 
1025             long data1 = sourceProtocolVersion << XDnDConstants.XDND_PROTOCOL_SHIFT;
1026             if (sourceFormats != null && sourceFormats.length > 3) {
1027                 data1 |= XDnDConstants.XDND_DATA_TYPES_BIT;
1028             }


1131                         wpg.dispose();
1132                     }
1133                 }
1134                 XDragSourceContextPeer.setProxyModeSourceWindow(xclient.get_data(0));
1135 
1136                 sendEnterMessageToToplevelImpl(embedded, xclient.get_window(),
1137                                                data1, data2, data3, data4);
1138                 overXEmbedClient = true;
1139             }
1140 
1141             if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
1142                 logger.finest("         2 "
1143                               + " embedded=" + embedded
1144                               + " xclient=" + xclient);
1145             }
1146 
1147             /* Make a copy of the original event, since we are going to modify the
1148                event while it still can be referenced from other Java events. */
1149             {
1150                 XClientMessageEvent copy = new XClientMessageEvent();
1151                 unsafe.copyMemory(xclient.pData, copy.pData, XClientMessageEvent.getSize());
1152 
1153                 copy.set_data(0, xclient.get_window());
1154 
1155                 forwardClientMessageToToplevel(embedded, copy);
1156             }
1157         }
1158 
1159         if (eventID == MouseEvent.MOUSE_EXITED) {
1160             if (overXEmbedClient) {
1161                 if (ctxt != 0 || prevCtxt != 0) {
1162                     // Last chance to send XdndLeave to the XEmbed client.
1163                     XClientMessageEvent xclient = ctxt != 0 ?
1164                         new XClientMessageEvent(ctxt) :
1165                         new XClientMessageEvent(prevCtxt);
1166                     sendLeaveMessageToToplevelImpl(embedded, xclient.get_window());
1167                 }
1168                 overXEmbedClient = false;
1169                 // We have to clear the proxy mode source window here,
1170                 // when the drag exits the XEmbedCanvasPeer.
1171                 // NOTE: at this point the XEmbed client still might have some