StandardSystemView.st
changeset 7263 9036d75c2799
parent 7140 9c2e17ff88f8
child 7286 c3b4c3c664d4
child 7398 6d085e759693
equal deleted inserted replaced
7262:cad293885151 7263:9036d75c2799
   701         maxExtent y isNil ifTrue:[
   701         maxExtent y isNil ifTrue:[
   702             maxExtent := maxExtent x @ 99999.
   702             maxExtent := maxExtent x @ 99999.
   703         ].
   703         ].
   704 
   704 
   705         (id := self drawableId) notNil ifTrue:[
   705         (id := self drawableId) notNil ifTrue:[
   706             self graphicsDevice setWindowMinExtent:nil maxExtent:max in:id
   706             device setWindowMinExtent:nil maxExtent:max in:id
   707         ].
   707         ].
   708 
   708 
   709         "/ if my current extent is larger than the new
   709         "/ if my current extent is larger than the new
   710         "/ maxExtent, adjust.
   710         "/ maxExtent, adjust.
   711 
   711 
   731     |id|
   731     |id|
   732 
   732 
   733     minExtent ~= min ifTrue:[
   733     minExtent ~= min ifTrue:[
   734         minExtent := min.
   734         minExtent := min.
   735         (id := self drawableId) notNil ifTrue:[
   735         (id := self drawableId) notNil ifTrue:[
   736             self graphicsDevice setWindowMinExtent:min maxExtent:nil in:id
   736             device setWindowMinExtent:min maxExtent:nil in:id
   737         ].
   737         ].
   738 
   738 
   739         "/ if my current extent is smaller than the new
   739         "/ if my current extent is smaller than the new
   740         "/ minExtent, adjust.
   740         "/ minExtent, adjust.
   741 
   741 
   763 
   763 
   764     icon := aFormOrImage.
   764     icon := aFormOrImage.
   765     iconValue := icon value.
   765     iconValue := icon value.
   766     iconValue notNil ifTrue:[
   766     iconValue notNil ifTrue:[
   767         self drawableId notNil ifTrue:[
   767         self drawableId notNil ifTrue:[
   768             i := self graphicsDevice convertedIcon:iconValue.
   768             i := device convertedIcon:iconValue.
   769             (i notNil and:[i id notNil]) ifTrue:[
   769             (i notNil and:[i id notNil]) ifTrue:[
   770                 (m := iconValue mask) notNil ifTrue:[
   770                 (m := iconValue mask) notNil ifTrue:[
   771                     m := self graphicsDevice convertedIconMask:m.
   771                     m := device convertedIconMask:m.
   772                 ].
   772                 ].
   773                 self graphicsDevice setWindowIcon:i mask:m in:self drawableId
   773                 device setWindowIcon:i mask:m in:self drawableId
   774             ]
   774             ]
   775         ]
   775         ]
   776     ]
   776     ]
   777 
   777 
   778     "Modified: / 30-10-2007 / 16:39:15 / cg"
   778     "Modified: / 30-10-2007 / 16:39:15 / cg"
   790     |newLabel|
   790     |newLabel|
   791 
   791 
   792     (newLabel := aString string) ~= iconLabel ifTrue:[
   792     (newLabel := aString string) ~= iconLabel ifTrue:[
   793         iconLabel := newLabel.
   793         iconLabel := newLabel.
   794         self drawableId notNil ifTrue:[
   794         self drawableId notNil ifTrue:[
   795             self graphicsDevice setIconName:newLabel in:self drawableId.
   795             device setIconName:newLabel in:self drawableId.
   796             "
   796             "
   797              unbuffered - to make it visible right NOW
   797              unbuffered - to make it visible right NOW
   798             "
   798             "
   799             self flush.
   799             self flush.
   800         ]
   800         ]
   810     |mask|
   810     |mask|
   811 
   811 
   812     "/ only images possibly have iconMasks
   812     "/ only images possibly have iconMasks
   813     icon notNil ifTrue:[
   813     icon notNil ifTrue:[
   814         (mask := icon value mask) notNil ifTrue:[
   814         (mask := icon value mask) notNil ifTrue:[
   815             ^ self graphicsDevice convertedIconMask:mask
   815             ^ device convertedIconMask:mask
   816         ]
   816         ]
   817     ].
   817     ].
   818 
   818 
   819     ^ nil
   819     ^ nil
   820 
   820 
   841      This may not be supported on all display types"
   841      This may not be supported on all display types"
   842 
   842 
   843     iconView := aView.
   843     iconView := aView.
   844     self drawableId notNil ifTrue:[
   844     self drawableId notNil ifTrue:[
   845         aView create.
   845         aView create.
   846         self graphicsDevice setWindowIconWindow:aView in:self drawableId.
   846         device setWindowIconWindow:aView in:self drawableId.
   847         aView setRealized:true.
   847         aView setRealized:true.
   848     ]
   848     ]
   849 
   849 
   850     "Modified: 4.4.1997 / 16:21:37 / cg"
   850     "Modified: 4.4.1997 / 16:21:37 / cg"
   851 !
   851 !
  1010         "/ there are situations where this does not happen;
  1010         "/ there are situations where this does not happen;
  1011         "/ I am not sure if that is a WM bug or an ST/X bug, but sometimes (with popups),
  1011         "/ I am not sure if that is a WM bug or an ST/X bug, but sometimes (with popups),
  1012         "/ I only get a focus in. Could be a race, when the loosing view is already destroyed,
  1012         "/ I only get a focus in. Could be a race, when the loosing view is already destroyed,
  1013         "/ at the time the focus event arrives.
  1013         "/ at the time the focus event arrives.
  1014         "/ Anyway: it should not matter to take it again...
  1014         "/ Anyway: it should not matter to take it again...
  1015         WindowGroup takeFocusFromDevice:self graphicsDevice.
  1015         WindowGroup takeFocusFromDevice:device.
  1016 
  1016 
  1017         windowGroup isInModalLoop ifTrue:[
  1017         windowGroup isInModalLoop ifTrue:[
  1018             windowGroup allTopViewsDo:[:t |
  1018             windowGroup allTopViewsDo:[:t |
  1019                 t ~~ self ifTrue:[
  1019                 t ~~ self ifTrue:[
  1020                     t focusIn.
  1020                     t focusIn.
  1165 
  1165 
  1166 initialize
  1166 initialize
  1167     super initialize.
  1167     super initialize.
  1168 
  1168 
  1169     "/ self setBorderWidth:2.         "- notice: many window managers ignore this"
  1169     "/ self setBorderWidth:2.         "- notice: many window managers ignore this"
  1170     self graphicsDevice isWindowsPlatform ifTrue:[
  1170     device isWindowsPlatform ifTrue:[
  1171         minExtent := 0 @ 0.
  1171         minExtent := 0 @ 0.
  1172     ] ifFalse:[
  1172     ] ifFalse:[
  1173         minExtent := 10 @ 10.
  1173         minExtent := 10 @ 10.
  1174     ].
  1174     ].
  1175 
  1175 
  1180     "Modified: / 27-10-2012 / 12:16:39 / cg"
  1180     "Modified: / 27-10-2012 / 12:16:39 / cg"
  1181 !
  1181 !
  1182 
  1182 
  1183 mapped
  1183 mapped
  1184     super mapped.
  1184     super mapped.
  1185     self graphicsDevice isWindowsPlatform ifTrue:[
  1185     device isWindowsPlatform ifTrue:[
  1186         "don't do this in X11 - switching between 
  1186         "don't do this in X11 - switching between 
  1187          virtual desktops would change the window stacking all the time"
  1187          virtual desktops would change the window stacking all the time"
  1188         self setForegroundWindow.
  1188         self setForegroundWindow.
  1189         self activate.
  1189         self activate.
  1190     ].
  1190     ].
  1197      when we come up on a smaller display,
  1197      when we come up on a smaller display,
  1198      make certain, that the receiver is visible"
  1198      make certain, that the receiver is visible"
  1199 
  1199 
  1200     |dX dY limitRight limitBottom graphicsDevice|
  1200     |dX dY limitRight limitBottom graphicsDevice|
  1201 
  1201 
  1202     graphicsDevice := self graphicsDevice.
  1202     graphicsDevice := device.
  1203     dX := (graphicsDevice horizontalPixelPerMillimeter * 20) rounded.
  1203     dX := (graphicsDevice horizontalPixelPerMillimeter * 20) rounded.
  1204     dY := (graphicsDevice verticalPixelPerMillimeter * 20) rounded.
  1204     dY := (graphicsDevice verticalPixelPerMillimeter * 20) rounded.
  1205 
  1205 
  1206     limitRight := graphicsDevice usableWidth - dX.
  1206     limitRight := graphicsDevice usableWidth - dX.
  1207     limitBottom := graphicsDevice usableHeight - dY.
  1207     limitBottom := graphicsDevice usableHeight - dY.
  1235 
  1235 
  1236     "physically create the view & subviews"
  1236     "physically create the view & subviews"
  1237     self recreate.
  1237     self recreate.
  1238 
  1238 
  1239     "if I was iconified (not realized), remap iconified"
  1239     "if I was iconified (not realized), remap iconified"
  1240     self graphicsDevice
  1240     device
  1241         mapView:self id:self drawableId iconified:(realized "shown" not)
  1241         mapView:self id:self drawableId iconified:(realized "shown" not)
  1242         atX:left y:top width:width height:height
  1242         atX:left y:top width:width height:height
  1243         minExtent:minExtent maxExtent:maxExtent.
  1243         minExtent:minExtent maxExtent:maxExtent.
  1244 
  1244 
  1245     "and restart the window-group process"
  1245     "and restart the window-group process"
  1297 convertedIcon
  1297 convertedIcon
  1298     "make certain, that the icon is compatible with my device;
  1298     "make certain, that the icon is compatible with my device;
  1299      this means converting it to a format (typically: monochrome) which
  1299      this means converting it to a format (typically: monochrome) which
  1300      the device supports. Return a compatible version of the icon."
  1300      the device supports. Return a compatible version of the icon."
  1301 
  1301 
  1302     ^ self graphicsDevice convertedIcon:icon
  1302     ^ device convertedIcon:icon
  1303 
  1303 
  1304     "Modified: / 30-10-2007 / 16:39:55 / cg"
  1304     "Modified: / 30-10-2007 / 16:39:55 / cg"
  1305 !
  1305 !
  1306 
  1306 
  1307 convertedIcon:iconArg
  1307 convertedIcon:iconArg
  1308     "make certain, that the image argument is compatible with my device;
  1308     "make certain, that the image argument is compatible with my device;
  1309      this means converting it to a format (typically: monochrome) which
  1309      this means converting it to a format (typically: monochrome) which
  1310      the device supports. Return a compatible version of the icon."
  1310      the device supports. Return a compatible version of the icon."
  1311 
  1311 
  1312     ^ self graphicsDevice convertedIcon:iconArg
  1312     ^ device convertedIcon:iconArg
  1313 
  1313 
  1314     "Modified: / 30-10-2007 / 16:37:31 / cg"
  1314     "Modified: / 30-10-2007 / 16:37:31 / cg"
  1315 !
  1315 !
  1316 
  1316 
  1317 convertedIconMask:aMask
  1317 convertedIconMask:aMask
  1318     "return a version of the argument which can be used as an iconMask
  1318     "return a version of the argument which can be used as an iconMask
  1319      on my device. Typically, this means conversion to a monochrome
  1319      on my device. Typically, this means conversion to a monochrome
  1320      mask - future versions may add alpha channel masks, if the device supports
  1320      mask - future versions may add alpha channel masks, if the device supports
  1321      them ..."
  1321      them ..."
  1322 
  1322 
  1323     ^ self graphicsDevice convertedIconMask:aMask
  1323     ^ device convertedIconMask:aMask
  1324 
  1324 
  1325     "Modified: / 30-10-2007 / 16:38:58 / cg"
  1325     "Modified: / 30-10-2007 / 16:38:58 / cg"
  1326 !
  1326 !
  1327 
  1327 
  1328 setWindowGroupFromApplication
  1328 setWindowGroupFromApplication
  1425 
  1425 
  1426     shown ifTrue:[
  1426     shown ifTrue:[
  1427         self unmap.
  1427         self unmap.
  1428 
  1428 
  1429         "if it was iconified, try to remap iconified"
  1429         "if it was iconified, try to remap iconified"
  1430         self graphicsDevice
  1430         device
  1431             mapView:self id:self drawableId iconified:true
  1431             mapView:self id:self drawableId iconified:true
  1432             atX:left y:top width:width height:height
  1432             atX:left y:top width:width height:height
  1433             minExtent:minExtent maxExtent:maxExtent.
  1433             minExtent:minExtent maxExtent:maxExtent.
  1434 
  1434 
  1435         shown ifTrue:[
  1435         shown ifTrue:[
  1458 
  1458 
  1459     super create.
  1459     super create.
  1460 
  1460 
  1461     iconView notNil ifTrue:[
  1461     iconView notNil ifTrue:[
  1462         iconView create.
  1462         iconView create.
  1463         self graphicsDevice setWindowIconWindow:iconView in:self drawableId.
  1463         device setWindowIconWindow:iconView in:self drawableId.
  1464         iconView setRealized:true.
  1464         iconView setRealized:true.
  1465     ].
  1465     ].
  1466     iconLabel notNil ifTrue:[
  1466     iconLabel notNil ifTrue:[
  1467         self graphicsDevice setIconName:iconLabel string in:self drawableId
  1467         device setIconName:iconLabel string in:self drawableId
  1468     ]
  1468     ]
  1469 
  1469 
  1470     "Modified: 10.6.1996 / 20:14:50 / cg"
  1470     "Modified: 10.6.1996 / 20:14:50 / cg"
  1471 !
  1471 !
  1472 
  1472 
  1475 
  1475 
  1476     shown ifFalse:[
  1476     shown ifFalse:[
  1477         self unmap.
  1477         self unmap.
  1478 
  1478 
  1479         "if it was iconified, try to remap non-iconified"
  1479         "if it was iconified, try to remap non-iconified"
  1480         self graphicsDevice
  1480         device
  1481             mapView:self id:self drawableId iconified:false
  1481             mapView:self id:self drawableId iconified:false
  1482             atX:left y:top width:width height:height
  1482             atX:left y:top width:width height:height
  1483             minExtent:minExtent maxExtent:maxExtent.
  1483             minExtent:minExtent maxExtent:maxExtent.
  1484     ].
  1484     ].
  1485 
  1485 
  1498 !
  1498 !
  1499 
  1499 
  1500 physicalCreate
  1500 physicalCreate
  1501     "common code for create & recreate"
  1501     "common code for create & recreate"
  1502 
  1502 
  1503     |dev lbl iconValue icn icnMask windowClassNameString org devBounds windowNameString|
  1503     |dev currentUserPrefs lbl iconValue icn icnMask windowClassNameString org devBounds windowNameString|
  1504 
  1504 
  1505     dev := self device.
  1505     dev := device.
  1506 
  1506     currentUserPrefs := UserPreferences current.
  1507     UserPreferences current forceWindowsIntoMonitorBounds ifTrue:[
  1507     currentUserPrefs forceWindowsIntoMonitorBounds ifTrue:[
  1508         "/ MULTI SCREEN support
  1508         "/ MULTI SCREEN support
  1509         devBounds := dev monitorBoundsAt:( left @ top ).
  1509         devBounds := dev monitorBoundsAt:( left @ top ).
  1510         "/ adjust origin, if too large
  1510         "/ adjust origin, if too large
  1511         left + width > devBounds right ifTrue:[
  1511         left + width > devBounds right ifTrue:[
  1512             left := devBounds right - width.
  1512             left := devBounds right - width.
  1592     "/               conformant should not hurt as St/X don't depend on X resources anyway :-)
  1592     "/               conformant should not hurt as St/X don't depend on X resources anyway :-)
  1593     "/               See:
  1593     "/               See:
  1594     "/  
  1594     "/  
  1595     "/               http://tronche.com/gui/x/icccm/sec-4.html
  1595     "/               http://tronche.com/gui/x/icccm/sec-4.html
  1596 
  1596 
  1597     (UserPreferences current icccm20Compliant == true) ifTrue:[
  1597     (currentUserPrefs icccm20Compliant == true) ifTrue:[
  1598         "/ICCCM 2.0 compliant name & class. See ICCCM 2.0 section 4.1.2.5.
  1598         "/ICCCM 2.0 compliant name & class. See ICCCM 2.0 section 4.1.2.5.
  1599 
  1599 
  1600         | commandName lastSepIndex |
  1600         | commandName lastSepIndex |
  1601 
  1601 
  1602         commandName := Smalltalk commandName.
  1602         commandName := Smalltalk commandName.
  1662 
  1662 
  1663     super recreate.
  1663     super recreate.
  1664 
  1664 
  1665     iconView notNil ifTrue:[
  1665     iconView notNil ifTrue:[
  1666         iconView recreate.
  1666         iconView recreate.
  1667         self graphicsDevice setWindowIconWindow:iconView in:self drawableId.
  1667         device setWindowIconWindow:iconView in:self drawableId.
  1668         iconView setRealized:true.
  1668         iconView setRealized:true.
  1669     ] ifFalse:[
  1669     ] ifFalse:[
  1670         icon notNil ifTrue:[
  1670         icon notNil ifTrue:[
  1671             self icon:(self graphicsDevice convertedIcon:icon).
  1671             self icon:(device convertedIcon:icon).
  1672         ].
  1672         ].
  1673     ].
  1673     ].
  1674 
  1674 
  1675     iconLabel notNil ifTrue:[
  1675     iconLabel notNil ifTrue:[
  1676         self graphicsDevice setIconName:iconLabel in:self drawableId
  1676         device setIconName:iconLabel in:self drawableId
  1677     ]
  1677     ]
  1678 
  1678 
  1679     "Modified: / 30-10-2007 / 16:39:42 / cg"
  1679     "Modified: / 30-10-2007 / 16:39:42 / cg"
  1680 ! !
  1680 ! !
  1681 
  1681