Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2018-08-27 14:37:25 +0000
committerEric Williams2018-09-10 17:17:44 +0000
commitf18822ba0a908eca14702cd1bb430358b57f9f12 (patch)
treede45cacea243797b17c0e42e88096848557d266f
parentdcc893248e05ba3a9b117a96002660b421ddb94c (diff)
downloadeclipse.platform.swt-f18822ba0a908eca14702cd1bb430358b57f9f12.tar.gz
eclipse.platform.swt-f18822ba0a908eca14702cd1bb430358b57f9f12.tar.xz
eclipse.platform.swt-f18822ba0a908eca14702cd1bb430358b57f9f12.zip
Bug 33659: Display.getClientArea() includes toolbar on Linux
Query the window manager to get the _NET_WORKAREA dimensions. This relies on Xorg being used (not x11 on Wayland). Otherwise, return Display.getBounds() as the current implementation has been doing. Tested on GTK3.22 with X11 - Wayland behaviour is unaffected. Snippet42 now returns the correct bounds (taking into account the size of the taskbar). Multi-monitor cases work as well -- the dimensions returned will account for orientation of various monitors. Change-Id: I390ebd8b70b8444f305701eb2cc9c2f0a9489e45 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java14
1 files changed, 14 insertions, 0 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 9d4587f40b..f333b51941 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
@@ -1607,6 +1607,20 @@ public Rectangle getBounds () {
return DPIUtil.autoScaleDown (getBoundsInPixels ());
}
+@Override
+public Rectangle getClientArea () {
+ if (OS.isX11()) {
+ Rectangle workArea = getWorkArea();
+ /*
+ * getWorkArea() can return null if the WM isn't running Xorg (i.e. x11 on Wayland).
+ * To workaround these cases, return the workArea only if getWorkArea() succeeds,
+ * otherwise call super.getClientArea(). See bug 33659.
+ */
+ if (workArea != null) return workArea;
+ }
+ return super.getClientArea();
+}
+
Rectangle getBoundsInPixels () {
checkDevice ();
return new Rectangle (0, 0, GDK.gdk_screen_width (), GDK.gdk_screen_height ());

Back to the top