#BUGFIX by stefan
class: XWorkstation
changed:
#initializeScreenBounds
#monitorBounds
https://expeccoalm.exept.de/D248319
Do noot initialze widthMM and heightMM to nil if Display could not be
opened on Linux.
--- a/XWorkstation.st Tue Mar 20 12:53:24 2018 +0100
+++ b/XWorkstation.st Tue Mar 20 12:56:13 2018 +0100
@@ -1567,7 +1567,7 @@
!
monitorBounds
- "ask the X server via the Xinerama extension about the available minitors.
+ "ask the X server via the Xinerama extension about the available monitors.
The first monitor returned is the primary monitor"
|numberOfMonitors resultArray bounds|
@@ -1575,52 +1575,52 @@
%{
#ifdef XINERAMA
if (ISCONNECTED && __INST(hasXineramaExtension) == true) {
- Display *dpy = myDpy;
- XineramaScreenInfo *screenInfo;
- int numDisplays;
- OBJ *cResultArray;
- int i, ci;
-
- screenInfo = XineramaQueryScreens (dpy, &numDisplays);
- if (screenInfo == 0) {
- goto out;
- }
-
- numberOfMonitors = __mkSmallInteger(numDisplays);
- resultArray = __ARRAY_NEW_INT(numDisplays * 5);
- cResultArray = __ArrayInstPtr(resultArray)->a_element;
-
- for (i=0, ci=0; i < numDisplays; i++, ci+=5) {
- cResultArray[ci] = __mkSmallInteger(screenInfo[i].screen_number);
- cResultArray[ci+1] = __mkSmallInteger(screenInfo[i].x_org);
- cResultArray[ci+2] = __mkSmallInteger(screenInfo[i].y_org);
- cResultArray[ci+3] = __mkSmallInteger(screenInfo[i].width);
- cResultArray[ci+4] = __mkSmallInteger(screenInfo[i].height);
- }
-
- XFree(screenInfo);
+ Display *dpy = myDpy;
+ XineramaScreenInfo *screenInfo;
+ int numDisplays;
+ OBJ *cResultArray;
+ int i, ci;
+
+ screenInfo = XineramaQueryScreens (dpy, &numDisplays);
+ if (screenInfo == 0) {
+ goto out;
+ }
+
+ numberOfMonitors = __mkSmallInteger(numDisplays);
+ resultArray = __ARRAY_NEW_INT(numDisplays * 5);
+ cResultArray = __ArrayInstPtr(resultArray)->a_element;
+
+ for (i=0, ci=0; i < numDisplays; i++, ci+=5) {
+ cResultArray[ci] = __mkSmallInteger(screenInfo[i].screen_number);
+ cResultArray[ci+1] = __mkSmallInteger(screenInfo[i].x_org);
+ cResultArray[ci+2] = __mkSmallInteger(screenInfo[i].y_org);
+ cResultArray[ci+3] = __mkSmallInteger(screenInfo[i].width);
+ cResultArray[ci+4] = __mkSmallInteger(screenInfo[i].height);
+ }
+
+ XFree(screenInfo);
}
#endif
out:;
%}.
numberOfMonitors isNil ifTrue:[
- "no xinerama - the display is the only monitor"
- ^ Array with:self bounds.
+ "no xinerama - the display is the only monitor"
+ ^ Array with:self bounds.
].
rawMonitorBounds = resultArray ifTrue:[
- ^ monitorBounds.
+ ^ monitorBounds.
].
bounds := Array new:numberOfMonitors.
1 to:numberOfMonitors do:[:idx|
- |rect baseIdx|
- baseIdx := (idx-1) * 5.
- rect := Rectangle
- left:(resultArray at:baseIdx+2)
- top:(resultArray at:baseIdx+3)
- width:(resultArray at:baseIdx+4)
- height:(resultArray at:baseIdx+5).
- bounds at:idx put:rect.
+ |rect baseIdx|
+ baseIdx := (idx-1) * 5.
+ rect := Rectangle
+ left:(resultArray at:baseIdx+2)
+ top:(resultArray at:baseIdx+3)
+ width:(resultArray at:baseIdx+4)
+ height:(resultArray at:baseIdx+5).
+ bounds at:idx put:rect.
].
rawMonitorBounds := resultArray.
@@ -1636,6 +1636,8 @@
"
Display monitorBounds
"
+
+ "Modified: / 20-03-2018 / 12:20:18 / stefan"
!
monitorBoundsAt:aPoint
@@ -9363,26 +9365,30 @@
!
initializeScreenBounds
+ self isOpen ifFalse:[
+ "queries answer nil if not open"
+ ^ self.
+ ].
self isXineramaActive ifTrue:[
- |rect|
-
- self monitorBounds do:[:eachRect|
- rect isNil ifTrue:[
- rect := eachRect.
- ] ifFalse:[
- rect := rect merge:eachRect.
- ]
- ].
- width := rect width.
- height := rect height.
-
- "propagate possible size changes to our rottView"
- rootView notNil ifTrue:[
- rootView initialize.
- ].
+ |rect|
+
+ self monitorBounds do:[:eachRect|
+ rect isNil ifTrue:[
+ rect := eachRect.
+ ] ifFalse:[
+ rect := rect merge:eachRect.
+ ]
+ ].
+ width := rect width.
+ height := rect height.
+
+ "propagate possible size changes to our rootView"
+ rootView notNil ifTrue:[
+ rootView initialize.
+ ].
] ifFalse:[
- width := self queryWidth.
- height := self queryHeight.
+ width := self queryWidth.
+ height := self queryHeight.
].
widthMM := self queryWidthMM.
heightMM := self queryHeightMM.
@@ -9390,6 +9396,8 @@
"
Display initializeScreenBounds
"
+
+ "Modified (format): / 20-03-2018 / 12:18:31 / stefan"
!
initializeScreenProperties