class: DeviceGraphicsContext
authorStefan Vogel <sv@exept.de>
Tue, 04 Feb 2014 16:50:16 +0100
changeset 6234 404d91662d49
parent 6233 b746fb9ba0e3
child 6235 7cdc094296b2
class: DeviceGraphicsContext added: #createGCForBitmap #createRootWindow
DeviceGraphicsContext.st
--- a/DeviceGraphicsContext.st	Tue Feb 04 16:49:51 2014 +0100
+++ b/DeviceGraphicsContext.st	Tue Feb 04 16:50:16 2014 +0100
@@ -3527,6 +3527,18 @@
     "Modified: 19.3.1997 / 11:07:52 / cg"
 !
 
+createGCForBitmap
+    "physically create a device GC.
+     Since we do not need a gc-object for the drawable until something is
+     really drawn, none is created up to the first draw.
+     This method is sent, when the first drawing happens.
+     Redefined here to create a bitmap GC (some devices (i.e. windows) require
+     different GC's for different canvases."
+
+    gcId := device gcForBitmap:drawableId.
+    Lobby registerChange:self.
+!
+
 destroy
     "I am abstract"
 
@@ -3675,7 +3687,7 @@
     super initialize.
 
     "/ just in case, someone redefined new without setting device
-    device isNil ifTrue:[device := Screen current].
+    (device isNil and:[Screen notNil]) ifTrue:[device := Screen current].
 
     foreground isNil ifTrue:[foreground := Black].
     background isNil ifTrue:[background := White].
@@ -3906,6 +3918,10 @@
     drawableId := device createPixmapWidth:w height:h depth:d.
 !
 
+createRootWindow
+    drawableId := self rootWindowFor:self.
+!
+
 createWindowFor:aView type:typeSymbol origin:org extent:ext minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv style:styleSymbol inputOnly:inp label:label owner:owner icon:icn iconMask:icnM iconView:icnV 
     "create a window and set the drawableId"
     
@@ -4022,11 +4038,11 @@
 !DeviceGraphicsContext class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.130 2014-02-04 13:26:24 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.131 2014-02-04 15:50:16 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.130 2014-02-04 13:26:24 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.131 2014-02-04 15:50:16 stefan Exp $'
 ! !