#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Sun, 05 Mar 2017 11:44:33 +0100
changeset 21625 026eecef148d
parent 21624 af43e7ea1bf4
child 21626 e4578e01f37f
#BUGFIX by cg class: OSXOperatingSystem added: #screenBounds: hack for OSX, which does not include the dock's height in the screen dimension returned by XQuartz.
OSXOperatingSystem.st
--- a/OSXOperatingSystem.st	Fri Mar 03 19:37:15 2017 +0100
+++ b/OSXOperatingSystem.st	Sun Mar 05 11:44:33 2017 +0100
@@ -788,6 +788,33 @@
 
     "Created: / 25-02-2017 / 09:49:07 / cg"
     "Modified (comment): / 28-02-2017 / 15:22:17 / cg"
+!
+
+screenBounds:displayNr
+    "returns the bounds of the screen.
+     This is needed, because the dimension of the XQuartz screen does not include the dock."
+
+    |rx ry rwidth rheight|
+
+%{
+#ifndef NO_COCOA
+    CGDirectDisplayID targetDisplay = 0;
+
+    rx = ry = __MKSMALLINT(0);
+    rwidth = __MKUINT( CGDisplayPixelsWide(targetDisplay) );
+    rheight = __MKUINT( CGDisplayPixelsHigh(targetDisplay) );
+#endif // NO_COCOA
+%}.
+    (rwidth isNil) ifTrue:[
+        ^ self primitiveFailed
+    ].
+    ^ rx@ry extent:(rwidth@rheight)
+
+    "
+     self screenBounds:0
+    "
+
+    "Created: / 05-03-2017 / 11:10:08 / cg"
 ! !
 
 !OSXOperatingSystem class methodsFor:'documentation'!