XWorkstation.st
changeset 8313 0fcbc07d8f35
parent 8266 55f8a8196020
child 8341 4ff8b5be757e
equal deleted inserted replaced
8312:31d9c10d010e 8313:0fcbc07d8f35
  1565 
  1565 
  1566     ignoreBackingStore := aBoolean
  1566     ignoreBackingStore := aBoolean
  1567 !
  1567 !
  1568 
  1568 
  1569 monitorBounds
  1569 monitorBounds
  1570     "ask the X server via the Xinerama extension about the available minitors.
  1570     "ask the X server via the Xinerama extension about the available monitors.
  1571      The first monitor returned is the primary monitor"
  1571      The first monitor returned is the primary monitor"
  1572 
  1572 
  1573     |numberOfMonitors resultArray bounds|
  1573     |numberOfMonitors resultArray bounds|
  1574 
  1574 
  1575 %{
  1575 %{
  1576 #ifdef XINERAMA
  1576 #ifdef XINERAMA
  1577     if (ISCONNECTED && __INST(hasXineramaExtension) == true) {
  1577     if (ISCONNECTED && __INST(hasXineramaExtension) == true) {
  1578 	Display *dpy = myDpy;
  1578         Display *dpy = myDpy;
  1579 	XineramaScreenInfo *screenInfo;
  1579         XineramaScreenInfo *screenInfo;
  1580 	int numDisplays;
  1580         int numDisplays;
  1581 	OBJ *cResultArray;
  1581         OBJ *cResultArray;
  1582 	int i, ci;
  1582         int i, ci;
  1583 
  1583 
  1584 	screenInfo = XineramaQueryScreens (dpy, &numDisplays);
  1584         screenInfo = XineramaQueryScreens (dpy, &numDisplays);
  1585 	if (screenInfo == 0) {
  1585         if (screenInfo == 0) {
  1586 	    goto out;
  1586             goto out;
  1587 	}
  1587         }
  1588 
  1588 
  1589 	numberOfMonitors = __mkSmallInteger(numDisplays);
  1589         numberOfMonitors = __mkSmallInteger(numDisplays);
  1590 	resultArray = __ARRAY_NEW_INT(numDisplays * 5);
  1590         resultArray = __ARRAY_NEW_INT(numDisplays * 5);
  1591 	cResultArray = __ArrayInstPtr(resultArray)->a_element;
  1591         cResultArray = __ArrayInstPtr(resultArray)->a_element;
  1592 
  1592 
  1593 	for (i=0, ci=0; i < numDisplays; i++, ci+=5) {
  1593         for (i=0, ci=0; i < numDisplays; i++, ci+=5) {
  1594 	    cResultArray[ci] = __mkSmallInteger(screenInfo[i].screen_number);
  1594             cResultArray[ci] = __mkSmallInteger(screenInfo[i].screen_number);
  1595 	    cResultArray[ci+1] = __mkSmallInteger(screenInfo[i].x_org);
  1595             cResultArray[ci+1] = __mkSmallInteger(screenInfo[i].x_org);
  1596 	    cResultArray[ci+2] = __mkSmallInteger(screenInfo[i].y_org);
  1596             cResultArray[ci+2] = __mkSmallInteger(screenInfo[i].y_org);
  1597 	    cResultArray[ci+3] = __mkSmallInteger(screenInfo[i].width);
  1597             cResultArray[ci+3] = __mkSmallInteger(screenInfo[i].width);
  1598 	    cResultArray[ci+4] = __mkSmallInteger(screenInfo[i].height);
  1598             cResultArray[ci+4] = __mkSmallInteger(screenInfo[i].height);
  1599 	}
  1599         }
  1600 
  1600 
  1601 	XFree(screenInfo);
  1601         XFree(screenInfo);
  1602     }
  1602     }
  1603 #endif
  1603 #endif
  1604 out:;
  1604 out:;
  1605 %}.
  1605 %}.
  1606     numberOfMonitors isNil ifTrue:[
  1606     numberOfMonitors isNil ifTrue:[
  1607 	"no xinerama - the display is the only monitor"
  1607         "no xinerama - the display is the only monitor"
  1608 	^ Array with:self bounds.
  1608         ^ Array with:self bounds.
  1609     ].
  1609     ].
  1610     rawMonitorBounds = resultArray ifTrue:[
  1610     rawMonitorBounds = resultArray ifTrue:[
  1611 	^ monitorBounds.
  1611         ^ monitorBounds.
  1612     ].
  1612     ].
  1613 
  1613 
  1614     bounds := Array new:numberOfMonitors.
  1614     bounds := Array new:numberOfMonitors.
  1615     1 to:numberOfMonitors do:[:idx|
  1615     1 to:numberOfMonitors do:[:idx|
  1616 	|rect baseIdx|
  1616         |rect baseIdx|
  1617 	baseIdx := (idx-1) * 5.
  1617         baseIdx := (idx-1) * 5.
  1618 	rect := Rectangle
  1618         rect := Rectangle
  1619 		    left:(resultArray at:baseIdx+2)
  1619                     left:(resultArray at:baseIdx+2)
  1620 		    top:(resultArray at:baseIdx+3)
  1620                     top:(resultArray at:baseIdx+3)
  1621 		    width:(resultArray at:baseIdx+4)
  1621                     width:(resultArray at:baseIdx+4)
  1622 		    height:(resultArray at:baseIdx+5).
  1622                     height:(resultArray at:baseIdx+5).
  1623 	bounds at:idx put:rect.
  1623         bounds at:idx put:rect.
  1624     ].
  1624     ].
  1625 
  1625 
  1626     rawMonitorBounds := resultArray.
  1626     rawMonitorBounds := resultArray.
  1627     monitorBounds := bounds.
  1627     monitorBounds := bounds.
  1628 
  1628 
  1634     ^ bounds
  1634     ^ bounds
  1635 
  1635 
  1636     "
  1636     "
  1637      Display monitorBounds
  1637      Display monitorBounds
  1638     "
  1638     "
       
  1639 
       
  1640     "Modified: / 20-03-2018 / 12:20:18 / stefan"
  1639 !
  1641 !
  1640 
  1642 
  1641 monitorBoundsAt:aPoint
  1643 monitorBoundsAt:aPoint
  1642     |bounds|
  1644     |bounds|
  1643 
  1645 
  9361 
  9363 
  9362     "Modified: 1.12.1995 / 23:44:40 / stefan"
  9364     "Modified: 1.12.1995 / 23:44:40 / stefan"
  9363 !
  9365 !
  9364 
  9366 
  9365 initializeScreenBounds
  9367 initializeScreenBounds
       
  9368     self isOpen ifFalse:[
       
  9369         "queries answer nil if not open"
       
  9370         ^ self.
       
  9371     ].
  9366     self isXineramaActive ifTrue:[
  9372     self isXineramaActive ifTrue:[
  9367 	|rect|
  9373         |rect|
  9368 
  9374 
  9369 	self monitorBounds do:[:eachRect|
  9375         self monitorBounds do:[:eachRect|
  9370 	    rect isNil ifTrue:[
  9376             rect isNil ifTrue:[
  9371 		rect := eachRect.
  9377                 rect := eachRect.
  9372 	    ] ifFalse:[
  9378             ] ifFalse:[
  9373 		rect := rect merge:eachRect.
  9379                 rect := rect merge:eachRect.
  9374 	    ]
  9380             ]
  9375 	].
  9381         ].
  9376 	width := rect width.
  9382         width := rect width.
  9377 	height := rect height.
  9383         height := rect height.
  9378 
  9384 
  9379 	"propagate possible size changes to our rottView"
  9385         "propagate possible size changes to our rootView"
  9380 	rootView notNil ifTrue:[
  9386         rootView notNil ifTrue:[
  9381 	    rootView initialize.
  9387             rootView initialize.
  9382 	].
  9388         ].
  9383     ] ifFalse:[
  9389     ] ifFalse:[
  9384 	width := self queryWidth.
  9390         width := self queryWidth.
  9385 	height := self queryHeight.
  9391         height := self queryHeight.
  9386     ].
  9392     ].
  9387     widthMM := self queryWidthMM.
  9393     widthMM := self queryWidthMM.
  9388     heightMM := self queryHeightMM.
  9394     heightMM := self queryHeightMM.
  9389 
  9395 
  9390     "
  9396     "
  9391       Display initializeScreenBounds
  9397       Display initializeScreenBounds
  9392     "
  9398     "
       
  9399 
       
  9400     "Modified (format): / 20-03-2018 / 12:18:31 / stefan"
  9393 !
  9401 !
  9394 
  9402 
  9395 initializeScreenProperties
  9403 initializeScreenProperties
  9396     |masks|
  9404     |masks|
  9397 
  9405