Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-01-21 10:29:39 -0500
committerEric Williams2019-01-21 10:29:39 -0500
commit5970d5d79cf7605de4826347008adda9cf67a2ef (patch)
tree1975d331ca4973f12ea0066089016495a8b185be
parent40f7197e84e1765cf84cd942450450493a358661 (diff)
downloadeclipse.platform.swt-5970d5d79cf7605de4826347008adda9cf67a2ef.tar.gz
eclipse.platform.swt-5970d5d79cf7605de4826347008adda9cf67a2ef.tar.xz
eclipse.platform.swt-5970d5d79cf7605de4826347008adda9cf67a2ef.zip
Bug 543644: Device#getScreenDPI(): division by zero leads to very high
DPI Return the default DPI if the width of the monitor is 0. Change-Id: I204ea604f646087704823f3f574580c31150dd03 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index 42920e0b03..c15869c6b9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -481,6 +481,7 @@ Point getScreenDPI () {
pMonitor = GDK.gdk_display_get_monitor(display, 0);
}
int widthMM = GDK.gdk_monitor_get_width_mm(pMonitor);
+ if (widthMM == 0) return new Point (dpi, dpi);
int scaleFactor = GDK.gdk_monitor_get_scale_factor(pMonitor);
GdkRectangle monitorGeometry = new GdkRectangle ();
GDK.gdk_monitor_get_geometry(pMonitor, monitorGeometry);

Back to the top