Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-09-18 05:42:24 +0000
committerAlexander Kurtakov2018-09-18 05:42:24 +0000
commiteb8619f8a50ace3efe1d4fbc3fe8a0a383e82636 (patch)
tree2eb2a34ba8566f7e270498e95d42e50d7af49e16
parent16900c00c36161704b2240a1b483ba6b1d25644d (diff)
downloadeclipse.platform.swt-eb8619f8a50ace3efe1d4fbc3fe8a0a383e82636.tar.gz
eclipse.platform.swt-eb8619f8a50ace3efe1d4fbc3fe8a0a383e82636.tar.xz
eclipse.platform.swt-eb8619f8a50ace3efe1d4fbc3fe8a0a383e82636.zip
Bug 530841: [GTK2] Remove GTK 2.x support
Remove useless version checks as SWT already requires Gtk 3.4+. Change-Id: Ib9b6fc1dc42c96729f606a50f694c64483db802d Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java41
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java8
2 files changed, 10 insertions, 39 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index ce3be01fe9..c4340189b2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -2602,40 +2602,13 @@ public Monitor [] getMonitors () {
monitor.zoom = Display._getDeviceZoom(monitor.handle);
}
- if (GTK.GTK_VERSION >= OS.VERSION (3, 4, 0)) {
- // workarea was defined in GTK 3.4. If present, it will return the best results
- // since it takes into account per-monitor trim
- GDK.gdk_screen_get_monitor_workarea (screen, i, dest);
- monitor.clientX = DPIUtil.autoScaleDown (dest.x);
- monitor.clientY = DPIUtil.autoScaleDown (dest.y);
- monitor.clientWidth = DPIUtil.autoScaleDown (dest.width);
- monitor.clientHeight = DPIUtil.autoScaleDown (dest.height);
- } else {
- // If we're on an older version of gtk without the workarea function, see if we can use
- // the getWorkArea function. In the case of multi-monitors, this will return something that
- // is approximately a bounding rectangle for the work areas of all the monitors, so intersecting
- // that rectangle with the monitor boundaries will provide an approximation of the per-monitor
- // work area.
- if (workArea != null) {
- monitor.clientX = Math.max (monitor.x, workArea.x);
- monitor.clientY = Math.max (monitor.y, workArea.y);
- monitor.clientHeight = Math
- .max(Math.min (monitor.y + monitor.height, workArea.y + workArea.height)
- - monitor.clientY, 0);
- monitor.clientWidth = Math.max (
- Math.min (monitor.x + monitor.width, workArea.x + workArea.width) - monitor.clientX,
- 0);
- }
-
- // If getWorkArea is not available or it did not return a rectangle that intersects the monitor
- // bounds, then use the monitor bounds itself as the work area.
- if (workArea == null || monitor.clientWidth == 0 || monitor.clientHeight == 0) {
- monitor.clientX = monitor.x;
- monitor.clientY = monitor.y;
- monitor.clientHeight = monitor.height;
- monitor.clientWidth = monitor.width;
- }
- }
+ // workarea was defined in GTK 3.4. If present, it will return the best results
+ // since it takes into account per-monitor trim
+ GDK.gdk_screen_get_monitor_workarea (screen, i, dest);
+ monitor.clientX = DPIUtil.autoScaleDown (dest.x);
+ monitor.clientY = DPIUtil.autoScaleDown (dest.y);
+ monitor.clientWidth = DPIUtil.autoScaleDown (dest.width);
+ monitor.clientHeight = DPIUtil.autoScaleDown (dest.height);
monitors [i] = monitor;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
index 8ab786c0fd..69853fc578 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
@@ -193,11 +193,9 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
GTK.gtk_notebook_set_scrollable (handle, false);
Point notebookSize = computeNativeSize (handle, wHint, hHint, changed);
GTK.gtk_notebook_set_scrollable (handle, scrollable);
- if (GTK.GTK_VERSION >= OS.VERSION (3, 4, 0)) {
- int[] initialGap = new int[1];
- GTK.gtk_widget_style_get (handle, OS.initial_gap, initialGap, 0);
- notebookSize.x += initialGap[0]*2;
- }
+ int[] initialGap = new int[1];
+ GTK.gtk_widget_style_get (handle, OS.initial_gap, initialGap, 0);
+ notebookSize.x += initialGap[0]*2;
size.x = Math.max (notebookSize.x, size.x);
size.y = Math.max (notebookSize.y, size.y);
return size;

Back to the top