diff options
| author | Niraj Modi | 2016-10-17 07:11:33 +0000 |
|---|---|---|
| committer | Niraj Modi | 2016-10-18 08:20:22 +0000 |
| commit | a03291e0159f92b9c708b24c20ea125f02b88412 (patch) | |
| tree | 84c96baecb59c6d8b9c31ac748646895b4393419 | |
| parent | e0ebbdf73a7f169aead702612bcf9f8edfa101be (diff) | |
| download | eclipse.platform.swt-a03291e0159f92b9c708b24c20ea125f02b88412.tar.gz eclipse.platform.swt-a03291e0159f92b9c708b24c20ea125f02b88412.tar.xz eclipse.platform.swt-a03291e0159f92b9c708b24c20ea125f02b88412.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>
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 84a362b364..1398b779f2 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 @@ -783,7 +783,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; |
