Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Pun2017-04-19 16:27:08 +0000
committerLeo Ufimtsev2017-04-28 13:40:33 +0000
commit3bb3b5532c82baf0ebcb40260a99166a7b682d9e (patch)
treef72e8d2703242969492cd75538f124402e2521d8 /bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
parentfe35d840c6ce9d9c6de566e6f6ed5cae2d38a7fc (diff)
downloadeclipse.platform.swt-3bb3b5532c82baf0ebcb40260a99166a7b682d9e.tar.gz
eclipse.platform.swt-3bb3b5532c82baf0ebcb40260a99166a7b682d9e.tar.xz
eclipse.platform.swt-3bb3b5532c82baf0ebcb40260a99166a7b682d9e.zip
Bug 515035 - [Wayland] DnD on text causes null pointer exception
Fixed a potential issue that would cause both SWT and GTK to fight over who sets the drag first. Patch will make sure all DND will be done over at GTKText level and then referenced back to SWT. This can be tested through DnDExample -> Text. Previously it would fail on certain occasions (if the drag effect is a text vs. a file icon). The patch now forces it to be through GTK3 DnD which is the text icon, and in turn, will signal back to SWT that a drag is occurring. Text is set to SWT.MULTI in DnDExample so I swapped it to SWT.SINGLE as well for testing as they call either GTKText or GTKEntry respectively. Also tested through AllBrowserTests on GTK2, 3.14,3.16,3.18,3.20, Wayland with no additional errors. Change-Id: Id3bfef03f0ef84e6e341782124ae4bda40f5984e Signed-off-by: Ian Pun <ipun@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
index 6a29692981..569d57e906 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
@@ -120,8 +120,8 @@ public class DragSource extends Widget {
static Callback DragEnd;
static Callback DragDataDelete;
static {
- DragBegin = new Callback(DragSource.class, "DragBegin", 2);
- if (DragBegin.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); //$NON-NLS-1$
+ DragBegin = new Callback(DragSource.class, "DragBegin", 2); //$NON-NLS-1$
+ if (DragBegin.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS);
DragGetData = new Callback(DragSource.class, "DragGetData", 5); //$NON-NLS-1$
if (DragGetData.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS);
DragEnd = new Callback(DragSource.class, "DragEnd", 2); //$NON-NLS-1$
@@ -334,8 +334,12 @@ void dragBegin(long /*int*/ widget, long /*int*/ context) {
*/
if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0) && this.control instanceof Text) {
DNDEvent event = new DNDEvent();
+ Display display = Display.getCurrent();
+ Point loc = display.getCursorLocation();
event.widget = this;
event.doit = true;
+ event.x = loc.x;
+ event.y = loc.y;
notifyListeners(DND.DragStart, event);
if (!event.doit || transferAgents == null || transferAgents.length == 0) return;
if (targetList == 0) return;

Back to the top