summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop
diff options
context:
space:
mode:
authorDuong Nguyen <dnguyen>2008-07-22 19:00:16 +0000
committerDuong Nguyen <dnguyen>2008-07-22 19:00:16 +0000
commitd9d246eb364431120619874d4f6e316ef38fcc5d (patch)
treebb746e5b06664798f1489436dc65e67078c601f5 /bundles/org.eclipse.swt/Eclipse SWT Drag and Drop
parent1c2c078c2c6ec69adbdea230aea1d80b2c96c464 (diff)
downloadeclipse.platform.swt-d9d246eb364431120619874d4f6e316ef38fcc5d.tar.gz
eclipse.platform.swt-d9d246eb364431120619874d4f6e316ef38fcc5d.tar.xz
eclipse.platform.swt-d9d246eb364431120619874d4f6e316ef38fcc5d.zip
Bug 240817 - SWT Tree: in 3.4, DragSourceEvent gives higher x-coordinate than in 3.3
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java15
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java6
5 files changed, 26 insertions, 9 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java
index 7d7f64825e..2a8cc819a3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java
@@ -20,4 +20,6 @@ class DNDEvent extends Event {
public int operations;
public int feedback;
public Image image;
+ public int offsetX;
+ public int offsetY;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java
index bfc6a74b7b..5818f2d265 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java
@@ -74,6 +74,17 @@ public class DragSourceEvent extends TypedEvent {
*/
public Image image;
+ /**
+ * In dragStart, the x offset (relative to the image) where the drag source image will be displayed.
+ * @since 3.5
+ */
+ public int offsetX;
+ /**
+ * In dragStart, the y offset (relative to the image) where the drag source image will be displayed.
+ * @since 3.5
+ */
+ public int offsetY;
+
static final long serialVersionUID = 3257002142513770808L;
/**
@@ -91,6 +102,8 @@ public DragSourceEvent(DNDEvent e) {
this.x = e.x;
this.y = e.y;
this.image = e.image;
+ this.offsetX = e.offsetX;
+ this.offsetY = e.offsetY;
}
void updateEvent(DNDEvent e) {
e.widget = this.widget;
@@ -102,5 +115,7 @@ void updateEvent(DNDEvent e) {
e.x = this.x;
e.y = this.y;
e.image = this.image;
+ e.offsetX = this.offsetX;
+ e.offsetY = this.offsetY;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
index 528fc8fd6f..cc63a3b204 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
@@ -315,10 +315,10 @@ private void drag(Event dragEvent) {
* area and use it during the drag to prevent the image from being inverted.
* On XP if the shell is RTL, the image is not displayed.
*/
- int offset = event.x - dragEvent.x;
+ int offsetX = event.offsetX;
hwndDrag = topControl.handle;
if ((topControl.getStyle() & SWT.RIGHT_TO_LEFT) != 0) {
- offset = image.getBounds().width - offset;
+ offsetX = image.getBounds().width - offsetX;
RECT rect = new RECT ();
OS.GetClientRect (topControl.handle, rect);
hwndDrag = OS.CreateWindowEx (
@@ -334,7 +334,7 @@ private void drag(Event dragEvent) {
null);
OS.ShowWindow (hwndDrag, OS.SW_SHOW);
}
- OS.ImageList_BeginDrag(imagelist.getHandle(), 0, offset, event.y - dragEvent.y);
+ OS.ImageList_BeginDrag(imagelist.getHandle(), 0, offsetX, event.offsetY);
/*
* Feature in Windows. When ImageList_DragEnter() is called,
* it takes a snapshot of the screen If a drag is started
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java
index 727abc40d8..bc25bd33ae 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java
@@ -83,11 +83,11 @@ public class TableDragSourceEffect extends DragSourceEffect {
int DI_GETDRAGIMAGE = OS.RegisterWindowMessage (new TCHAR (0, "ShellGetDragImage", true)); //$NON-NLS-1$
if (OS.SendMessage (control.handle, DI_GETDRAGIMAGE, 0, shdi) != 0) {
if ((control.getStyle() & SWT.MIRRORED) != 0) {
- event.x += shdi.sizeDragImage.cx - shdi.ptOffset.x;
+ event.offsetX = shdi.sizeDragImage.cx - shdi.ptOffset.x;
} else {
- event.x += shdi.ptOffset.x;
+ event.offsetX = shdi.ptOffset.x;
}
- event.y += shdi.ptOffset.y;
+ event.offsetY = shdi.ptOffset.y;
int /*long*/ hImage = shdi.hbmpDragImage;
if (hImage != 0) {
BITMAP bm = new BITMAP ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java
index e39a75684a..645549a14f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java
@@ -82,11 +82,11 @@ public class TreeDragSourceEffect extends DragSourceEffect {
int DI_GETDRAGIMAGE = OS.RegisterWindowMessage (new TCHAR (0, "ShellGetDragImage", true)); //$NON-NLS-1$
if (OS.SendMessage (control.handle, DI_GETDRAGIMAGE, 0, shdi) != 0) {
if ((control.getStyle() & SWT.MIRRORED) != 0) {
- event.x += shdi.sizeDragImage.cx - shdi.ptOffset.x;
+ event.offsetX = shdi.sizeDragImage.cx - shdi.ptOffset.x;
} else {
- event.x += shdi.ptOffset.x;
+ event.offsetX = shdi.ptOffset.x;
}
- event.y += shdi.ptOffset.y;
+ event.offsetY = shdi.ptOffset.y;
int /*long*/ hImage = shdi.hbmpDragImage;
if (hImage != 0) {
BITMAP bm = new BITMAP ();