6578041: Drag & Drop from Motif to Java does not work.
authordmeetry
Sat, 04 Dec 2010 02:27:43 +0300
changeset 7495 f807f6b93084
parent 7494 3a6d20cc8595
child 7497 6a86e4fcd318
6578041: Drag & Drop from Motif to Java does not work. Summary: fixing java's interpretation of unsigned 32bit int as signed during an implicit conversion to 64bit int. Reviewed-by: denis, chrisphi
jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java
jdk/src/solaris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java
--- a/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java	Thu Dec 02 19:53:51 2010 +0300
+++ b/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java	Sat Dec 04 02:27:43 2010 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -134,7 +134,8 @@
         if (swapNeeded) {
             t = MotifDnDConstants.Swapper.swap(t);
         }
-        long time = t;
+        long time = t & 0xffffffffL;
+             // with correction of (32-bit unsigned to 64-bit signed) implicit conversion.
 
         /* Discard events from the previous receiver. */
         if (targetEnterServerTime == XConstants.CurrentTime ||
--- a/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java	Thu Dec 02 19:53:51 2010 +0300
+++ b/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java	Sat Dec 04 02:27:43 2010 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -928,7 +928,9 @@
             throw new IOException("Cannot get data: drag source property atom unavailable");
         }
 
-        long time_stamp = MotifDnDConstants.Swapper.getInt(data + 4, eventByteOrder);
+        long time_stamp = MotifDnDConstants.Swapper.getInt(data + 4, eventByteOrder) & 0xffffffffL;
+                          // with correction of (32-bit unsigned to 64-bit signed) implicit conversion.
+
         XAtom selectionAtom = XAtom.get(selatom);
 
         XSelection selection = XSelection.getSelection(selectionAtom);
@@ -962,7 +964,9 @@
             return false;
         }
 
-        long time_stamp = MotifDnDConstants.Swapper.getInt(data + 4, eventByteOrder);
+        long time_stamp = MotifDnDConstants.Swapper.getInt(data + 4, eventByteOrder) & 0xffffffffL;
+                          // with correction of (32-bit unsigned to 64-bit signed) implicit conversion.
+
         long sel_atom = MotifDnDConstants.Swapper.getInt(data + 12, eventByteOrder);
 
         long status_atom = 0;