Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2016-10-17 07:11:33 +0000
committerNiraj Modi2016-11-08 07:22:45 +0000
commit04020a9328de0da8485a46d59da26b1f658fef10 (patch)
treed92506522c7cec559d7a0d149c06f9fb5bac8e42
parent3ea5b27b8153d573524ad0db9c7d0df3665dfa80 (diff)
downloadeclipse.platform.swt-04020a9328de0da8485a46d59da26b1f658fef10.tar.gz
eclipse.platform.swt-04020a9328de0da8485a46d59da26b1f658fef10.tar.xz
eclipse.platform.swt-04020a9328de0da8485a46d59da26b1f658fef10.zip
Bug 500694 - [HiDPI][GTK] Drag and Drop not working properly on high
resolution displays with scaling factor Change-Id: I45da51ea0d4cc1f5578cd644968844fb16d15adf Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java5
3 files changed, 5 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
index d8aef1e7e8..f22dfdd1b1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
@@ -794,7 +794,7 @@ boolean setEventData(long /*int*/ context, int x, int y, int time, DNDEvent even
long /*int*/ window = OS.gtk_widget_get_window (control.handle);
int [] origin_x = new int[1], origin_y = new int[1];
OS.gdk_window_get_origin(window, origin_x, origin_y);
- Point coordinates = new Point(origin_x[0] + x, origin_y[0] + y);
+ Point coordinates = DPIUtil.autoScaleDown(new Point(origin_x[0] + x, origin_y[0] + y));
event.widget = this;
event.x = coordinates.x;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java
index 7dbb5dfc6b..a7470282ce 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java
@@ -135,7 +135,7 @@ public class TableDropTargetEffect extends DropTargetEffect {
long /*int*/ handle = table.handle;
int effect = checkEffect(event.feedback);
Point coordinates = new Point(event.x, event.y);
- coordinates = table.toControl(coordinates);
+ coordinates = DPIUtil.autoScaleUp(table.toControl(coordinates));
long /*int*/ [] path = new long /*int*/ [1];
OS.gtk_tree_view_get_path_at_pos (handle, coordinates.x, coordinates.y, path, null, null, null);
int index = -1;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java
index 34d4df2c29..5bfde4d3b9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
package org.eclipse.swt.dnd;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.widgets.*;
@@ -147,7 +148,7 @@ public class TreeDropTargetEffect extends DropTargetEffect {
long /*int*/ handle = tree.handle;
Point coordinates = new Point(event.x, event.y);
- coordinates = tree.toControl(coordinates);
+ coordinates = DPIUtil.autoScaleUp(tree.toControl(coordinates));
long /*int*/ [] path = new long /*int*/ [1];
OS.gtk_tree_view_get_path_at_pos (handle, coordinates.x, coordinates.y, path, null, null, null);
int index = -1;

Back to the top