Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2016-02-22 07:10:19 +0000
committerNiraj Modi2016-02-22 07:10:19 +0000
commit98d6cbd5163bea0daae0df0ca8e27d99f604b114 (patch)
tree8d12b407bf24d1785013e7bf69aeb951f1bc528a
parent4f1f70d09023dd1e0c2e1ec1090d5cdae406c822 (diff)
downloadeclipse.platform.swt-nmodi/NeonhiDpiWork2.tar.gz
eclipse.platform.swt-nmodi/NeonhiDpiWork2.tar.xz
eclipse.platform.swt-nmodi/NeonhiDpiWork2.zip
Win32 (Part 10): Changing API's coordinate system from Pixels to Points.nmodi/NeonhiDpiWork2
- Updated Combo, Canvas, Composite, Display classes - Moved DPIUtil to Internal package. Change-Id: Ia0e8d3867173131c82752fe2865dbb9cd020c660 Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEffect.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java (renamed from bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/DPIUtil.java)21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java2
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java2
40 files changed, 167 insertions, 52 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java
index 63c33e8c5b..c7f6d3a37d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java
@@ -329,7 +329,7 @@ int ShowContextMenu(int dwID, long /*int*/ ppt, long /*int*/ pcmdtReserved, long
Menu menu = browser.getMenu();
if (menu != null && !menu.isDisposed ()) {
if (pt.x != event.x || pt.y != event.y) {
- menu.setLocation (event.x, event.y);
+ menu.setLocationInPixels (event.x, event.y);
}
menu.setVisible (true);
return COM.S_OK;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
index ee9193a53b..b17e095025 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
@@ -1037,7 +1037,7 @@ void initAccessible() {
getAccessible().addAccessibleControlListener (new AccessibleControlAdapter() {
@Override
public void getChildAtPoint (AccessibleControlEvent e) {
- Point testPoint = toControl (e.x, e.y);
+ Point testPoint = toControlInPixels (e.x, e.y);
if (getBoundsInPixels ().contains (testPoint)) {
e.childID = ACC.CHILDID_SELF;
}
@@ -1046,7 +1046,7 @@ void initAccessible() {
@Override
public void getLocation (AccessibleControlEvent e) {
Rectangle location = getBoundsInPixels ();
- Point pt = getParent().toDisplay (location.x, location.y);
+ Point pt = getParent().toDisplayInPixels (location.x, location.y);
e.x = pt.x;
e.y = pt.y;
e.width = location.width;
@@ -1143,7 +1143,7 @@ void listEvent (Event event) {
* show it again. To prevent the popup from showing again, we will detect
* this case and let the selection event of the arrow button hide the popup.
*/
- Point point = arrow.toControl(getDisplay().getCursorLocationInPixels());
+ Point point = arrow.toControlInPixels(getDisplay().getCursorLocationInPixels());
Point size = arrow.getSizeInPixels();
Rectangle rect = new Rectangle(0, 0, size.x, size.y);
if (rect.contains(point)) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
index db56d5b679..6eef8beafc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
@@ -14,6 +14,7 @@ import org.eclipse.swt.*;
import org.eclipse.swt.accessibility.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.widgets.*;
/**
@@ -1406,7 +1407,7 @@ void initAccessible() {
accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
@Override
public void getChildAtPoint(AccessibleControlEvent e) {
- Point testPoint = toControl(e.x, e.y);
+ Point testPoint = toControlInPixels(e.x, e.y);
int childID = ACC.CHILDID_NONE;
for (int i = 0; i < items.length; i++) {
if (items[i].getBoundsInPixels().contains(testPoint)) {
@@ -1432,13 +1433,13 @@ void initAccessible() {
int childID = e.childID;
if (childID == ACC.CHILDID_SELF) {
location = getBoundsInPixels();
- pt = getParent().toDisplay(location.x, location.y);
+ pt = getParent().toDisplayInPixels(location.x, location.y);
} else {
if (childID >= 0 && childID < items.length && items[childID].showing) {
location = items[childID].getBoundsInPixels();
}
if (location != null) {
- pt = toDisplay(location.x, location.y);
+ pt = toDisplayInPixels(location.x, location.y);
}
}
if (location != null && pt != null) {
@@ -3671,7 +3672,7 @@ void showList (Rectangle rect) {
int x = rect.x;
int y = rect.y + rect.height;
Point location = getDisplay().mapInPixels(this, null, x, y);
- showMenu.setLocation(location.x, location.y);
+ showMenu.setLocationInPixels(location.x, location.y);
showMenu.setVisible(true);
}
/**
@@ -3777,7 +3778,7 @@ boolean updateItems (int showIndex) {
changed |= showChevron != oldShowChevron;
if (changed && getToolTipText() != null) {
Point pt = getDisplay().getCursorLocationInPixels();
- pt = toControl(pt);
+ pt = toControlInPixels(pt);
_setToolTipText(pt.x, pt.y);
}
gc.dispose();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java
index 37a93b8d88..41c72c8243 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.custom;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.widgets.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
index 758fb997b5..f54ca00fa6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
@@ -6154,7 +6154,7 @@ void handlePaint(Event event) {
}
if (y < endY) {
gc.setBackground(background);
- drawBackground(gc, 0, y, clientAreaWidth, endY - y);
+ drawBackgroundInPixels(gc, 0, y, clientAreaWidth, endY - y);
}
}
if (blockSelection && blockXLocation != -1) {
@@ -6172,16 +6172,16 @@ void handlePaint(Event event) {
// fill the margin background
gc.setBackground(marginColor != null ? marginColor : background);
if (topMargin > 0) {
- drawBackground(gc, 0, 0, clientAreaWidth, topMargin);
+ drawBackgroundInPixels(gc, 0, 0, clientAreaWidth, topMargin);
}
if (bottomMargin > 0) {
- drawBackground(gc, 0, clientAreaHeight - bottomMargin, clientAreaWidth, bottomMargin);
+ drawBackgroundInPixels(gc, 0, clientAreaHeight - bottomMargin, clientAreaWidth, bottomMargin);
}
if (leftMargin - alignmentMargin > 0) {
- drawBackground(gc, 0, 0, leftMargin - alignmentMargin, clientAreaHeight);
+ drawBackgroundInPixels(gc, 0, 0, leftMargin - alignmentMargin, clientAreaHeight);
}
if (rightMargin > 0) {
- drawBackground(gc, clientAreaWidth - rightMargin, 0, rightMargin, clientAreaHeight);
+ drawBackgroundInPixels(gc, clientAreaWidth - rightMargin, 0, rightMargin, clientAreaHeight);
}
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java
index f96580c376..66098bdb26 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java
@@ -374,7 +374,7 @@ int drawLine(int lineIndex, int paintX, int paintY, GC gc, Color widgetBackgroun
gc.fillRectangleInPixels(client.x, paintY, client.width, height);
} else {
gc.setBackground(widgetBackground);
- styledText.drawBackground(gc, client.x, paintY, client.width, height);
+ styledText.drawBackgroundInPixels(gc, client.x, paintY, client.width, height);
}
gc.setForeground(widgetForeground);
if (selectionStart == selectionEnd || (selectionEnd <= 0 && selectionStart > lineLength - 1)) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEffect.java
index 06f4496e8a..8cc6a3ce3c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEffect.java
@@ -97,7 +97,7 @@ public class DropTargetEffect extends DropTargetAdapter {
Widget getItem(Table table, int x, int y) {
Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
+ coordinates = table.toControlInPixels(coordinates);
TableItem item = table.getItem(coordinates);
if (item != null) return item;
Rectangle area = table.getClientAreaInPixels();
@@ -116,7 +116,7 @@ public class DropTargetEffect extends DropTargetAdapter {
Widget getItem(Tree tree, int x, int y) {
Point point = new Point(x, y);
- point = tree.toControl(point);
+ point = tree.toControlInPixels(point);
TreeItem item = tree.getItem(point);
if (item == null) {
Rectangle area = tree.getClientAreaInPixels();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java
index 6eb6b288ad..287ea129c9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java
@@ -151,7 +151,7 @@ public class TableDropTargetEffect extends DropTargetEffect {
int effect = checkEffect(event.feedback);
long /*int*/ handle = table.handle;
Point coordinates = new Point(event.x, event.y);
- coordinates = table.toControl(coordinates);
+ coordinates = table.toControlInPixels(coordinates);
LVHITTESTINFO pinfo = new LVHITTESTINFO();
pinfo.x = coordinates.x;
pinfo.y = coordinates.y;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java
index 16897d918f..8c24c1ce8b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java
@@ -162,7 +162,7 @@ public class TreeDropTargetEffect extends DropTargetEffect {
int effect = checkEffect(event.feedback);
long /*int*/ handle = tree.handle;
Point coordinates = new Point(event.x, event.y);
- coordinates = tree.toControl(coordinates);
+ coordinates = tree.toControlInPixels(coordinates);
TVHITTESTINFO lpht = new TVHITTESTINFO ();
lpht.x = coordinates.x;
lpht.y = coordinates.y;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
index edd816a4ba..732760c144 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
@@ -4702,7 +4702,7 @@ int OnShowContextMenu (int aContextFlags, long /*int*/ aEvent, long /*int*/ aNod
Menu menu = browser.getMenu ();
if (menu != null && !menu.isDisposed ()) {
if (aScreenX[0] != event.x || aScreenY[0] != event.y) {
- menu.setLocation (event.x, event.y);
+ menu.setLocationInPixels (event.x, event.y);
}
menu.setVisible (true);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java
index af8f998ad6..059aff005e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java
@@ -57,7 +57,7 @@ int contextMenuItemsForElement (long /*int*/ sender, long /*int*/ element, long
Menu menu = browser.getMenu ();
if (menu != null && !menu.isDisposed ()) {
if (event.x != pt.x || event.y != pt.y) {
- menu.setLocation (event.x, event.y);
+ menu.setLocationInPixels (event.x, event.y);
}
menu.setVisible (true);
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/DPIUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java
index 0adbb9c379..91e24b1f2b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/DPIUtil.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java
@@ -8,9 +8,10 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.swt.graphics;
+package org.eclipse.swt.internal;
import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
/**
* This class hold common constants and utility functions w.r.t. to SWT high DPI
@@ -180,18 +181,18 @@ public static boolean getAutoScale () {
/**
* Returns an <code>ImageData</code> for specified zoom.
*/
-static ImageData getImageData (Image image, int source_zoom, int target_zoom) {
+public static ImageData getImageData (Image image, int source_zoom, int target_zoom) {
if (source_zoom == target_zoom) return image.getImageDataInPixels ();
ImageData imageData = null;
- if (image.imageDataProvider != null) {
+ if (image.getImageDataProvider() != null) {
boolean[] found = new boolean[1];
- imageData = DPIUtil.validateAndGetImageDataAtZoom (image.imageDataProvider, target_zoom, found);
+ imageData = DPIUtil.validateAndGetImageDataAtZoom (image.getImageDataProvider(), target_zoom, found);
if (!found[0]) {
imageData = DPIUtil.autoScaleImageData (imageData, target_zoom, 100);
}
- } else if (image.imageFileNameProvider != null) {
+ } else if (image.getImageFileNameProvider() != null) {
boolean[] found = new boolean[1];
- String filename = DPIUtil.validateAndGetImagePathAtZoom (image.imageFileNameProvider, target_zoom, found);
+ String filename = DPIUtil.validateAndGetImagePathAtZoom (image.getImageFileNameProvider(), target_zoom, found);
if (!found[0]) {
imageData = DPIUtil.autoScaleImageData (new ImageData(filename), target_zoom, 100);
} else {
@@ -236,7 +237,7 @@ public static float getScalingFactor () {
*
* @return zoom
*/
-static int mapDPIToZoom (int dpi) {
+public static int mapDPIToZoom (int dpi) {
int zoom;
if (dpi >= DPI_ZOOM_200) {
zoom = 200;
@@ -250,7 +251,7 @@ static int mapDPIToZoom (int dpi) {
/**
* Returns a new rectangle as per the scaleFactor.
*/
-static Rectangle scale (Rectangle rect, int targetZoom, int currentZoom) {
+public static Rectangle scale (Rectangle rect, int targetZoom, int currentZoom) {
if (rect == null || targetZoom == currentZoom) return rect;
float scaleFactor = ((float)targetZoom) / (float)currentZoom;
Rectangle returnRect = new Rectangle (0,0,0,0);
@@ -266,7 +267,7 @@ static Rectangle scale (Rectangle rect, int targetZoom, int currentZoom) {
* fall-back to 100% image. If provider or fall-back image is not available,
* throw error.
*/
-static ImageData validateAndGetImageDataAtZoom (ImageDataProvider provider, int zoom, boolean[] found) {
+public static ImageData validateAndGetImageDataAtZoom (ImageDataProvider provider, int zoom, boolean[] found) {
if (provider == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
ImageData data = provider.getImageData (zoom);
found [0] = (data != null);
@@ -281,7 +282,7 @@ static ImageData validateAndGetImageDataAtZoom (ImageDataProvider provider, int
* fall-back to 100% image. If provider or fall-back image is not available,
* throw error.
*/
-static String validateAndGetImagePathAtZoom (ImageFileNameProvider provider, int zoom, boolean[] found) {
+public static String validateAndGetImagePathAtZoom (ImageFileNameProvider provider, int zoom, boolean[] found) {
if (provider == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
String filename = provider.getImagePath (zoom);
found [0] = (filename != null);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java
index 547bd5bad0..f40e7f7e18 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java
@@ -91,7 +91,7 @@ public final class GridData {
*
* The default value is SWT.DEFAULT.
*
- * @see Control#computeSizeInPixels(int, int, boolean)
+ * @see Control#computeSize(int, int, boolean)
*/
public int widthHint = SWT.DEFAULT;
@@ -102,7 +102,7 @@ public final class GridData {
*
* The default value is SWT.DEFAULT.
*
- * @see Control#computeSizeInPixels(int, int, boolean)
+ * @see Control#computeSize(int, int, boolean)
*/
public int heightHint = SWT.DEFAULT;
@@ -212,7 +212,7 @@ public final class GridData {
* The default value is 0.
*
* @since 3.1
- * @see Control#computeSizeInPixels(int, int, boolean)
+ * @see Control#computeSize(int, int, boolean)
* @see GridData#widthHint
*/
public int minimumWidth = 0;
@@ -227,7 +227,7 @@ public final class GridData {
* The default value is 0.
*
* @since 3.1
- * @see Control#computeSizeInPixels(int, int, boolean)
+ * @see Control#computeSize(int, int, boolean)
* @see GridData#heightHint
*/
public int minimumHeight = 0;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java
index 6ba21a5a3f..ac61ac18db 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java
@@ -41,7 +41,7 @@ public final class RowData {
*
* The default value is SWT.DEFAULT.
*
- * @see org.eclipse.swt.widgets.Control#computeSizeInPixels(int, int, boolean)
+ * @see org.eclipse.swt.widgets.Control#computeSize(int, int, boolean)
*/
public int width = SWT.DEFAULT;
/**
@@ -51,7 +51,7 @@ public final class RowData {
*
* The default value is SWT.DEFAULT.
*
- * @see org.eclipse.swt.widgets.Control#computeSizeInPixels(int, int, boolean)
+ * @see org.eclipse.swt.widgets.Control#computeSize(int, int, boolean)
*/
public int height = SWT.DEFAULT;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
index d7bc59b17d..bf25f950e6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.graphics;
import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gdip.*;
import org.eclipse.swt.internal.win32.*;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
index 3b2ffe676e..3b3afc9f8a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
@@ -14,6 +14,7 @@ package org.eclipse.swt.graphics;
import java.io.*;
import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gdip.*;
import org.eclipse.swt.internal.win32.*;
@@ -126,12 +127,12 @@ public final class Image extends Resource implements Drawable {
/**
* ImageFileNameProvider to provide file names at various Zoom levels
*/
- ImageFileNameProvider imageFileNameProvider;
+ private ImageFileNameProvider imageFileNameProvider;
/**
* ImageDataProvider to provide ImageData at various Zoom levels
*/
- ImageDataProvider imageDataProvider;
+ private ImageDataProvider imageDataProvider;
/**
* Attribute to cache current device zoom level
@@ -1829,6 +1830,22 @@ public ImageData getImageData (int zoom) {
}
/**
+* @return the imageDataProvider
+* @since 3.105
+*/
+public ImageDataProvider getImageDataProvider() {
+ return imageDataProvider;
+}
+
+/**
+* @return the imageFileNameProvider
+* @since 3.105
+*/
+public ImageFileNameProvider getImageFileNameProvider() {
+ return imageFileNameProvider;
+}
+
+/**
* Returns an integer hash code for the receiver. Any two
* objects that return <code>true</code> when passed to
=======
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java
index 934170fd2d..ff310b9d7a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java
@@ -11,6 +11,7 @@
package org.eclipse.swt.graphics;
import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gdip.*;
import org.eclipse.swt.internal.win32.*;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java
index 90cea3d1fd..24c582b95b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.graphics;
import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
index ee818a41ba..972d92f17b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
@@ -110,7 +111,18 @@ void clearArea (int x, int y, int width, int height) {
* @since 3.2
*/
public void drawBackground (GC gc, int x, int y, int width, int height) {
- drawBackground(gc, x, y, width, height, 0, 0);
+ x = DPIUtil.autoScaleUp(x);
+ y = DPIUtil.autoScaleUp(y);
+ width = DPIUtil.autoScaleUp(width);
+ height = DPIUtil.autoScaleUp(height);
+ drawBackgroundInPixels(gc, x, y, width, height);
+}
+
+/**
+* @noreference This method is not intended to be referenced by clients.
+*/
+public void drawBackgroundInPixels (GC gc, int x, int y, int width, int height) {
+ drawBackgroundInPixels(gc, x, y, width, height, 0, 0);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java
index 6b76610b9c..c566702e02 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
index 75db967ab9..674287737c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
@@ -947,6 +947,12 @@ boolean dragDetect (long /*int*/ hwnd, int x, int y, boolean filter, boolean []
* @since 3.8
*/
public Point getCaretLocation () {
+ return DPIUtil.autoScaleDown(getCaretLocationInPixels());
+}
+/**
+* @noreference This method is not intended to be referenced by clients.
+*/
+public Point getCaretLocationInPixels () {
checkWidget ();
/*
* Bug in Windows. For some reason, Windows is unable
@@ -1390,6 +1396,12 @@ public String getText () {
* </ul>
*/
public int getTextHeight () {
+ return DPIUtil.autoScaleDown(getTextHeightInPixels());
+}
+/**
+* @noreference This method is not intended to be referenced by clients.
+*/
+public int getTextHeightInPixels () {
checkWidget ();
COMBOBOXINFO pcbi = new COMBOBOXINFO ();
pcbi.cbSize = COMBOBOXINFO.sizeof;
@@ -2005,7 +2017,7 @@ void setBoundsInPixels (int x, int y, int width, int height, int flags) {
*/
if ((style & SWT.DROP_DOWN) != 0) {
int visibleCount = getItemCount() == 0 ? VISIBLE_COUNT : this.visibleCount;
- height = getTextHeight () + (getItemHeightInPixels () * visibleCount) + 2;
+ height = getTextHeightInPixels () + (getItemHeightInPixels () * visibleCount) + 2;
/*
* Feature in Windows. When a drop down combo box is resized,
* the combo box resizes the height of the text field and uses
@@ -2271,6 +2283,12 @@ void setScrollWidth (int newWidth, boolean grow) {
* </ul>
*/
public void setSelection (Point selection) {
+ setSelectionInPixels(DPIUtil.autoScaleUp(selection));
+}
+/**
+* @noreference This method is not intended to be referenced by clients.
+*/
+public void setSelectionInPixels (Point selection) {
checkWidget ();
if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
int start = translateOffset (selection.x), end = translateOffset (selection.y);
@@ -2491,7 +2509,7 @@ void updateDropDownHeight () {
RECT rect = new RECT ();
OS.SendMessage (handle, OS.CB_GETDROPPEDCONTROLRECT, 0, rect);
int visibleCount = getItemCount() == 0 ? VISIBLE_COUNT : this.visibleCount;
- int height = getTextHeight () + (getItemHeightInPixels () * visibleCount) + 2;
+ int height = getTextHeightInPixels () + (getItemHeightInPixels () * visibleCount) + 2;
if (height != (rect.bottom - rect.top)) {
forceResize ();
OS.GetWindowRect (handle, rect);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
index bf8351ab6d..8da009c84f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
@@ -365,7 +365,19 @@ int applyThemeBackground () {
*
* @since 3.6
*/
-public void drawBackground(GC gc, int x, int y, int width, int height, int offsetX, int offsetY) {
+public void drawBackground (GC gc, int x, int y, int width, int height, int offsetX, int offsetY) {
+ x = DPIUtil.autoScaleUp(x);
+ y = DPIUtil.autoScaleUp(y);
+ width = DPIUtil.autoScaleUp(width);
+ height = DPIUtil.autoScaleUp(height);
+ offsetX = DPIUtil.autoScaleUp(offsetX);
+ offsetY = DPIUtil.autoScaleUp(offsetY);
+ drawBackgroundInPixels(gc, x, y, width, height, offsetX, offsetY);
+}
+/**
+* @noreference This method is not intended to be referenced by clients.
+*/
+public void drawBackgroundInPixels(GC gc, int x, int y, int width, int height, int offsetX, int offsetY) {
checkWidget ();
if (gc == null) error (SWT.ERROR_NULL_ARGUMENT);
if (gc.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index 691f997308..33a7fc5c40 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
@@ -16,6 +16,7 @@ import org.eclipse.swt.*;
import org.eclipse.swt.accessibility.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gdip.*;
import org.eclipse.swt.internal.win32.*;
@@ -2977,7 +2978,7 @@ boolean sendGestureEvent (GESTUREINFO gi) {
Event event = new Event ();
int type = 0;
Point globalPt = new Point(gi.x, gi.y);
- Point point = toControl(globalPt);
+ Point point = toControlInPixels(globalPt);
event.x = point.x;
event.y = point.y;
switch (gi.dwID) {
@@ -4032,6 +4033,12 @@ void subclass () {
* @since 2.1
*/
public Point toControl (int x, int y) {
+ return DPIUtil.autoScaleDown(toControlInPixels(DPIUtil.autoScaleUp(x), DPIUtil.autoScaleUp(y)));
+}
+/**
+* @noreference This method is not intended to be referenced by clients.
+*/
+public Point toControlInPixels (int x, int y) {
checkWidget ();
POINT pt = new POINT ();
pt.x = x; pt.y = y;
@@ -4060,9 +4067,15 @@ public Point toControl (int x, int y) {
* </ul>
*/
public Point toControl (Point point) {
+ return DPIUtil.autoScaleDown(toControlInPixels(DPIUtil.autoScaleUp(point)));
+}
+/**
+* @noreference This method is not intended to be referenced by clients.
+*/
+public Point toControlInPixels (Point point) {
checkWidget ();
if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
- return toControl (point.x, point.y);
+ return toControlInPixels (point.x, point.y);
}
/**
@@ -4086,6 +4099,12 @@ public Point toControl (Point point) {
* @since 2.1
*/
public Point toDisplay (int x, int y) {
+ return DPIUtil.autoScaleDown(toDisplayInPixels(DPIUtil.autoScaleUp(x), DPIUtil.autoScaleUp(y)));
+}
+/**
+* @noreference This method is not intended to be referenced by clients.
+*/
+public Point toDisplayInPixels (int x, int y) {
checkWidget ();
POINT pt = new POINT ();
pt.x = x; pt.y = y;
@@ -4114,9 +4133,15 @@ public Point toDisplay (int x, int y) {
* </ul>
*/
public Point toDisplay (Point point) {
+ return DPIUtil.autoScaleDown(toDisplayInPixels(DPIUtil.autoScaleUp(point)));
+}
+/**
+* @noreference This method is not intended to be referenced by clients.
+*/
+public Point toDisplayInPixels (Point point) {
checkWidget ();
if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
- return toDisplay (point.x, point.y);
+ return toDisplayInPixels (point.x, point.y);
}
long /*int*/ topHandle () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java
index a7b51684a0..de6695f217 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java
index 96b6df980f..8b64cfa661 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
index 17ce785e74..2d91231977 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
@@ -1563,7 +1563,7 @@ void updateMenuLocation (Event event) {
y = Math.max (y, rect.bottom);
y = Math.min (y, clientArea.y + clientArea.height);
}
- Point pt = toDisplay (x, y);
+ Point pt = toDisplayInPixels (x, y);
event.x = pt.x;
event.y = pt.y;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
index b4aaa45896..1193d7b6af 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
@@ -1445,6 +1445,12 @@ public void setEnabled (boolean enabled) {
* </ul>
*/
public void setLocation (int x, int y) {
+ setLocationInPixels(DPIUtil.autoScaleUp(x), DPIUtil.autoScaleUp(y));
+}
+/**
+* @noreference This method is not intended to be referenced by clients.
+*/
+public void setLocationInPixels (int x, int y) {
checkWidget ();
if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
this.x = x;
@@ -1477,9 +1483,16 @@ public void setLocation (int x, int y) {
* @since 2.1
*/
public void setLocation (Point location) {
+ setLocationInPixels(DPIUtil.autoScaleUp(location));
+}
+
+/**
+* @noreference This method is not intended to be referenced by clients.
+*/
+public void setLocationInPixels (Point location) {
checkWidget ();
if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocation (location.x, location.y);
+ setLocationInPixels (location.x, location.y);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java
index 1882531a83..2bc4c1d966 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java
@@ -14,6 +14,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java
index 7c86834ee5..2abf438c0c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
index 297b3e63d8..a618680b8e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
@@ -14,6 +14,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java
index 61741c25be..339a001cde 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index 115b45ea01..6db3763a90 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -5735,7 +5735,7 @@ void updateMenuLocation (Event event) {
y = Math.max (y, bounds.y + bounds.height);
y = Math.min (y, clientArea.y + clientArea.height);
}
- Point pt = toDisplay (x, y);
+ Point pt = toDisplayInPixels (x, y);
event.x = pt.x;
event.y = pt.y;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
index 34ac667ba7..5c1dc5c597 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
@@ -14,6 +14,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
index 358a3de7c0..66f7690189 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java
index 20f8448ad3..01939f1f17 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java
@@ -14,6 +14,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
index 5b190e88a5..fa3b60c370 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
@@ -5667,7 +5667,7 @@ void updateMenuLocation (Event event) {
y = Math.max (y, bounds.y + bounds.height);
y = Math.min (y, clientArea.y + clientArea.height);
}
- Point pt = toDisplay (x, y);
+ Point pt = toDisplayInPixels (x, y);
event.x = pt.x;
event.y = pt.y;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java
index 779b1953b8..d72dd7638e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java
@@ -14,6 +14,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
index 8d11ee0862..096fd7ece9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
index 15ef21aa4c..bee7d7f72f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
@@ -1510,7 +1510,7 @@ boolean showMenu (int x, int y, int detail) {
Menu menu = getMenu ();
if (menu != null && !menu.isDisposed ()) {
if (x != event.x || y != event.y) {
- menu.setLocation (event.x, event.y);
+ menu.setLocationInPixels (event.x, event.y);
}
menu.setVisible (true);
return true;
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
index a15fabd35d..fc5ff6d726 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
@@ -28,7 +28,6 @@ import java.net.URL;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.DPIUtil;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
@@ -37,6 +36,7 @@ import org.eclipse.swt.graphics.ImageFileNameProvider;
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.internal.DPIUtil;
import org.eclipse.swt.widgets.Display;
import org.junit.Before;
import org.junit.Test;

Back to the top