some attempts at multi-platform full-screen mode;
authorwenzelm
Sun, 03 Jan 2021 23:01:16 +0100
changeset 73038 3b14f7315dd2
parent 73037 473509b160d9
child 73039 4b1cfbf96e36
some attempts at multi-platform full-screen mode;
src/Pure/GUI/gui.scala
--- a/src/Pure/GUI/gui.scala	Sun Jan 03 22:06:19 2021 +0100
+++ b/src/Pure/GUI/gui.scala	Sun Jan 03 23:01:16 2021 +0100
@@ -204,14 +204,24 @@
 
   sealed case class Screen_Size(bounds: Rectangle, insets: Insets)
   {
-    def x0: Int = bounds.x
-    def y0: Int = bounds.y
-    def w0: Int = bounds.width
-    def h0: Int = bounds.height
-    def x: Int = x0 + insets.left
-    def y: Int = y0 + insets.top
-    def w: Int = w0 - insets.left - insets.right
-    def h: Int = h0 - insets.top - insets.bottom
+    def full_screen_bounds: Rectangle =
+      if (Platform.is_linux) {
+        // avoid menu bar and docking areas
+        new Rectangle(
+          bounds.x + insets.left,
+          bounds.y + insets.top,
+          bounds.width - insets.left - insets.right,
+          bounds.height - insets.top - insets.bottom)
+      }
+      else if (Platform.is_macos) {
+        // avoid menu bar, but ignore docking areas
+        new Rectangle(
+          bounds.x,
+          bounds.y + insets.top,
+          bounds.width,
+          bounds.height - insets.top)
+      }
+      else bounds
   }
 
   def screen_size(component: Component): Screen_Size =