Replace all `self graphicsDevice` with `device` jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sun, 03 Apr 2016 19:22:51 +0100
branchjv
changeset 7287 1e2a3258dd8a
parent 7286 c3b4c3c664d4
child 7290 a8acc06e57e4
Replace all `self graphicsDevice` with `device` ...i.e., by direct access to `device` instvar. According to Claus the system feels snappier. In any case, upstream also accesses `device` instvar directly so at least this reduces the divergence.
DeviceGraphicsContext.st
DisplayRootView.st
DisplaySurface.st
Form.st
GraphicsMedium.st
ShadowView.st
SimpleView.st
XEmbedContainerView.st
--- a/DeviceGraphicsContext.st	Sun Apr 03 17:09:29 2016 +0100
+++ b/DeviceGraphicsContext.st	Sun Apr 03 19:22:51 2016 +0100
@@ -3653,10 +3653,10 @@
 executor
     drawableType == #window ifTrue:[
         ^ DeviceWindowGCHandle basicNew
-            setDevice:self graphicsDevice id:self drawableId gcId:self gcId parentId:parentId.
+            setDevice:device id:self drawableId gcId:self gcId parentId:parentId.
     ] ifFalse:[
         ^ DevicePixmapGCHandle basicNew
-            setDevice:self graphicsDevice id:self drawableId gcId:self gcId.
+            setDevice:device id:self drawableId gcId:self gcId.
     ].
 !
 
--- a/DisplayRootView.st	Sun Apr 03 17:09:29 2016 +0100
+++ b/DisplayRootView.st	Sun Apr 03 19:22:51 2016 +0100
@@ -165,7 +165,7 @@
     "/ (such as GNOME shell or KWM), window contents ir rendered to an
     "/ off-screen pixmap so expose events are lot less common and may
     "/ not arrive.
-    self graphicsDevice isX11Platform ifTrue:[ 
+    device isX11Platform ifTrue:[ 
         ^ self.
     ].
     super waitForExpose.
--- a/DisplaySurface.st	Sun Apr 03 17:09:29 2016 +0100
+++ b/DisplaySurface.st	Sun Apr 03 19:22:51 2016 +0100
@@ -185,7 +185,7 @@
      but support for mixed depth views is being prepared.
      (especially useful on SGI, with 24bit view)"
 
-    ^ self graphicsDevice depth
+    ^ device depth
 !
 
 insideColor:aColor
@@ -200,7 +200,7 @@
      However, subclasses may redefine this, to return their own
      keyboard map (for example a terminalView may want treat CTRL-C as regular key)"
 
-    ^ self graphicsDevice keyboardMap
+    ^ device keyboardMap
 !
 
 renderer
@@ -228,13 +228,13 @@
 
     self drawableId notNil ifTrue:[
 	viewBackground isColor ifTrue:[
-	    viewBackground := viewBackground onDevice:self graphicsDevice.
+	    viewBackground := viewBackground onDevice:device.
 	    id := viewBackground colorId.
 	    "
 	     a real color (i.e. one supported by the device) ?
 	    "
 	    id notNil ifTrue:[
-		self graphicsDevice setWindowBackground:id in:self drawableId.
+		device setWindowBackground:id in:self drawableId.
 		^ self
 	    ].
 	    "
@@ -252,7 +252,7 @@
 		"
 		 assume, it can convert itself to a form
 		"
-		bgPixmap := viewBackground asFormOn:self graphicsDevice.
+		bgPixmap := viewBackground asFormOn:device.
 		bgPixmap isNil ifTrue:[
 		    "/ assume it knows how to draw itself
 		    ^ self
@@ -277,13 +277,13 @@
 	"/ (in contrast, the pixmap filling is done by the
 	"/ window itself in its expose event handler)
 
-	(self graphicsDevice supportsViewBackgroundPixmap:bgPixmap) ifFalse:[
+	(device supportsViewBackgroundPixmap:bgPixmap) ifFalse:[
 	    defBG := View defaultViewBackgroundColor.
 	    defBG isColor ifTrue:[
-		defBG := defBG onDevice:self graphicsDevice.
+		defBG := defBG onDevice:device.
 		id := defBG colorId.
 		id notNil ifTrue:[
-		    self graphicsDevice setWindowBackground:id in:self drawableId.
+		    device setWindowBackground:id in:self drawableId.
 		].
 	    ].
 	    ^ self
@@ -305,7 +305,7 @@
 	     convert it into a deep form
 	    "
 	    colorMap := bgPixmap colorMap.
-	    devBgPixmap := Form width:w height:h depth:deviceDepth onDevice:self graphicsDevice.
+	    devBgPixmap := Form width:w height:h depth:deviceDepth onDevice:device.
 	    devBgPixmap isNil ifTrue:[
 		'DisplaySurface [warning]: could not create a device form for viewBackground' infoPrintCR.
 		^ self
@@ -323,12 +323,12 @@
 		 colormap, which is not always the same as blackpixel/whitepixel ...
 		"
 		colorMap := bgPixmap colorMap.
-		(colorMap at:1) colorId == self graphicsDevice whitepixel ifTrue:[
-		    (colorMap at:2) colorId == self graphicsDevice blackpixel ifTrue:[
+		(colorMap at:1) colorId == device whitepixel ifTrue:[
+		    (colorMap at:2) colorId == device blackpixel ifTrue:[
 			"
 			 ok, can use it
 			"
-			self graphicsDevice setWindowBackgroundPixmap:(bgPixmap id) in:self drawableId.
+			device setWindowBackgroundPixmap:(bgPixmap id) in:self drawableId.
 			^ self
 		    ]
 		].
@@ -336,13 +336,13 @@
 		"
 		 no, must invert it
 		"
-		devBgPixmap := Form width:w height:h depth:deviceDepth onDevice:self graphicsDevice.
+		devBgPixmap := Form width:w height:h depth:deviceDepth onDevice:device.
 		devBgPixmap paint:(colorMap at:2) on:(colorMap at:1).
 		devBgPixmap copyPlaneFrom:bgPixmap x:0 y:0 toX:0 y:0 width:w height:h.
 		bgPixmap := devBgPixmap.
 	    ]
 	].
-	self graphicsDevice setWindowBackgroundPixmap:(bgPixmap id) in:self drawableId.
+	device setWindowBackgroundPixmap:(bgPixmap id) in:self drawableId.
     ]
 
     "Modified: / 23-01-2011 / 01:44:38 / cg"
@@ -693,7 +693,7 @@
     "tell the Display to assign keyboard focus to the receiver"
 
     self shown ifTrue:[
-	self graphicsDevice setInputFocusTo:self drawableId.
+	device setInputFocusTo:self drawableId.
     ].
 
     "Modified: / 15.3.1999 / 08:25:10 / cg"
@@ -750,7 +750,7 @@
 setPointerPosition:aRelativePoint
     "set the pointer to aRelativePoint relative to the views origin"
 
-    self graphicsDevice setPointerPosition:aRelativePoint in:self drawableId.
+    device setPointerPosition:aRelativePoint in:self drawableId.
 
     "
 	Transcript setPointerPosition:Transcript extent // 2.
@@ -916,7 +916,7 @@
     "return the object selection
      - either the local one, or the displays clipBoard buffer."
 
-    ^ self graphicsDevice getClipboardObjectFor:self drawableId.
+    ^ device getClipboardObjectFor:self drawableId.
 
     "Modified: 13.2.1997 / 13:18:50 / cg"
 !
@@ -937,7 +937,7 @@
 
      Return aString or nil if there is no selection"
 
-    ^ self graphicsDevice getClipboardText:selectionBufferSymbol for:self drawableId.
+    ^ device getClipboardText:selectionBufferSymbol for:self drawableId.
 !
 
 getSelection
@@ -975,14 +975,14 @@
     "set the object selection - both the local one, and tell the display
      that we have changed it (i.e. place it into the clipBoard)."
 
-    self graphicsDevice setClipboardObject:something ownerView:self.
+    device setClipboardObject:something ownerView:self.
 !
 
 setClipboardText:something
     "set the text selection - both the local one, and tell the display
      that we have changed it (i.e. place it into the clipBoard)."
 
-    self graphicsDevice setClipboardText:something ownerView:self
+    device setClipboardText:something ownerView:self
 !
 
 setSelection:something
@@ -992,7 +992,7 @@
     <resource: #obsolete>
 
     self obsoleteMethodWarning:'use setClipboardObject:'.
-    self graphicsDevice setClipboardObject:something ownerView:self.
+    device setClipboardObject:something ownerView:self.
 !
 
 setTextSelection:something
@@ -1002,7 +1002,7 @@
     <resource: #obsolete>
 
     self obsoleteMethodWarning:'use setClipboardText:'.
-    self graphicsDevice setClipboardText:something ownerView:self
+    device setClipboardText:something ownerView:self
 ! !
 
 !DisplaySurface methodsFor:'drawing'!
@@ -1316,9 +1316,9 @@
      this is a private (internal) method not to be used externally.
      for a list of allowed event symbols see Workstation class"
 
-    eventMask := eventMask bitAnd:(self graphicsDevice eventMaskFor:anEventSymbol) bitInvert.
+    eventMask := eventMask bitAnd:(device eventMaskFor:anEventSymbol) bitInvert.
     self drawableId notNil ifTrue:[
-	self graphicsDevice setEventMask:eventMask in:self drawableId
+	device setEventMask:eventMask in:self drawableId
     ]
 !
 
@@ -1377,9 +1377,9 @@
      this is a private (internal) method not to be used externally.
      for a list of allowed event symbols see Workstation class"
 
-    eventMask := (eventMask ? 0) bitOr:(self graphicsDevice eventMaskFor:anEventSymbol).
+    eventMask := (eventMask ? 0) bitOr:(device eventMaskFor:anEventSymbol).
     self drawableId notNil ifTrue:[
-	self graphicsDevice setEventMask:eventMask in:self drawableId
+	device setEventMask:eventMask in:self drawableId
     ]
 !
 
@@ -1775,7 +1775,7 @@
 
     |wg|
 
-    self graphicsDevice scrollsAsynchronous ifFalse:[
+    device scrollsAsynchronous ifFalse:[
 	self setGotExposeFlag.
 	^ self
     ].
@@ -2192,7 +2192,7 @@
 
     |wg endPollTime pollDelay graphicsDevice|
 
-    graphicsDevice := self graphicsDevice.
+    graphicsDevice := device.
     graphicsDevice scrollsAsynchronous ifFalse:[
 	self setGotExposeFlag.
 	^ self
@@ -2263,7 +2263,7 @@
 
     (id := self drawableId) notNil ifTrue:[
 	self setId:nil.
-	self graphicsDevice removeKnownView:self withId:id.
+	device removeKnownView:self withId:id.
 	realized := false.
     ].
     self destroy
@@ -2289,8 +2289,8 @@
     super initialize.
 
     eventMask := 0.
-    self graphicsDevice notNil ifTrue:[
-	eventMask := self graphicsDevice defaultEventMask.
+    device notNil ifTrue:[
+	eventMask := device defaultEventMask.
     ].
     viewBackground := self background.
     backed := false.
@@ -2316,11 +2316,11 @@
     "recreate (i.e. tell X about me) after a snapin or a migration"
 
     viewBackground isColor ifTrue:[
-	viewBackground := viewBackground onDevice:self graphicsDevice
+	viewBackground := viewBackground onDevice:device
     ].
     super recreate.
     cursor notNil ifTrue:[
-	cursor := cursor onDevice:self graphicsDevice.
+	cursor := cursor onDevice:device.
     ].
 
     "Modified: 28.3.1997 / 13:48:06 / cg"
@@ -2376,8 +2376,8 @@
      but goes directly to the device instead.
      Actually, its a historical leftover"
 
-    self graphicsDevice flush.
-    ^ self graphicsDevice eventPending:#buttonMotion for:self drawableId
+    device flush.
+    ^ device eventPending:#buttonMotion for:self drawableId
 !
 
 buttonReleaseEventPending
@@ -2386,8 +2386,8 @@
      goes directly to the device instead.
      Actually, its a historical leftover"
 
-    self graphicsDevice flush.
-    ^ self graphicsDevice eventPending:#buttonRelease for:self drawableId
+    device flush.
+    ^ device eventPending:#buttonRelease for:self drawableId
 !
 
 exposeEventPending
@@ -2399,7 +2399,7 @@
     windowGroup notNil ifTrue:[
 	(windowGroup sensor hasExposeEventFor:self) ifTrue:[^ true].
     ].
-    ^ self graphicsDevice eventPending:#expose for:self drawableId
+    ^ device eventPending:#expose for:self drawableId
 
     "Modified: / 15.9.1998 / 23:18:16 / cg"
 !
@@ -2497,7 +2497,7 @@
 beep
     "output an audible beep or bell on my screen device"
 
-    self graphicsDevice beep; flush
+    device beep; flush
 
     "Created: 28.5.1996 / 16:16:13 / cg"
     "Modified: 28.5.1996 / 16:58:25 / cg"
--- a/Form.st	Sun Apr 03 17:09:29 2016 +0100
+++ b/Form.st	Sun Apr 03 19:22:51 2016 +0100
@@ -925,7 +925,7 @@
 !
 
 magnify:aRectangle by:scale smoothing:smooth
-    ^ ((Image fromSubForm:aRectangle in:self) magnifiedBy:scale) asFormOn:self graphicsDevice.
+    ^ ((Image fromSubForm:aRectangle in:self) magnifiedBy:scale) asFormOn:device.
 ! !
 
 !Form methodsFor:'accessing'!
@@ -967,7 +967,7 @@
 
     bytesPerLine := (width * spaceBitsPerPixel + 31) // 32 * 4.
     inData := ByteArray uninitializedNew:(bytesPerLine * height).
-    info := self graphicsDevice getBitsFromPixmapId:self drawableId x:0 y:0 width:width height:height into:inData. 
+    info := device getBitsFromPixmapId:self drawableId x:0 y:0 width:width height:height into:inData. 
     bytesPerLineIn := (info at:#bytesPerLine).                    "what I got"
     bytesPerLine := (width * depth + 7) // 8.                     "what I want"
     (bytesPerLine ~~ bytesPerLineIn) ifTrue:[
@@ -1298,7 +1298,7 @@
      and associate it to a device (i.e. download its bits).
      Added for protocol compatibility with Image."
 
-    aDevice == self graphicsDevice ifTrue:[
+    aDevice == device ifTrue:[
         ^ self
     ].
     ^ self onDevice:aDevice
@@ -1311,7 +1311,7 @@
     "added for protocol compatiblity with Image"
 
     depth == 1 ifTrue:[
-        aDevice == self graphicsDevice ifTrue:[
+        aDevice == device ifTrue:[
             ^ self
         ].
         ^ self onDevice:aDevice
@@ -1362,7 +1362,7 @@
     "associate the receiver to a device (i.e. download its bits);
      return a deviceForm (possibly different from the receiver)."
 
-    aDevice == self graphicsDevice ifTrue:[
+    aDevice == device ifTrue:[
         ^ self
     ].
     aDevice isNil ifTrue:[^ self].
@@ -1469,7 +1469,7 @@
 
     |dstX newForm |
 
-    newForm := (self class onDevice:self graphicsDevice)
+    newForm := (self class onDevice:device)
                                 width:width
                                 height:height
                                 depth:depth.
@@ -1511,7 +1511,7 @@
 
     |dstY newForm |
 
-    newForm := (self class onDevice:self graphicsDevice)
+    newForm := (self class onDevice:device)
                                 width:width
                                 height:height
                                 depth:depth.
@@ -1557,7 +1557,7 @@
      and this operation is slow anyway, use the implementation
      in Image for this."
 
-    ^ ((Image fromForm:self) magnifiedBy:extent) asFormOn:self graphicsDevice.
+    ^ ((Image fromForm:self) magnifiedBy:extent) asFormOn:device.
 
     "
      (Form fromFile:'OutputOn.64') magnifiedBy:0.5@0.5
@@ -1591,7 +1591,7 @@
         ^ self hardMagnifiedBy:ext
     ].
 
-    newForm := (self class onDevice:self graphicsDevice)
+    newForm := (self class onDevice:device)
                                 width:(width * mX)
                                 height:(height * mY)
                                 depth:depth.
@@ -1659,13 +1659,13 @@
 recreate
     "reconstruct the form after a snapin or a migration"
 
-    self graphicsDevice isNil ifTrue:[^ self].
+    device isNil ifTrue:[^ self].
 
     data notNil ifTrue:[
         "
          create one from data
         "
-        (depth == 1 or:[depth == self graphicsDevice depth]) ifTrue:[
+        (depth == 1 or:[depth == device depth]) ifTrue:[
             gc createBitmapFromArray:data width:width height:height.
             gc drawableId notNil ifTrue:[
                 ^ self
@@ -1680,9 +1680,9 @@
 "/     create an empty one
 "/    "
 "/    depth == 1 ifTrue:[
-"/        drawableId := self graphicsDevice createBitmapWidth:width height:height
+"/        drawableId := device createBitmapWidth:width height:height
 "/    ] ifFalse:[
-"/        drawableId := self graphicsDevice createPixmapWidth:width height:height depth:self graphicsDevice depth
+"/        drawableId := device createPixmapWidth:width height:height depth:device depth
 "/    ].
 
     "Modified: 15.6.1996 / 16:18:12 / cg"
@@ -1745,7 +1745,7 @@
 flushDeviceHandles
     "flush device handles (sent after a restart)"
 
-    self setDevice:self graphicsDevice id:nil gcId:nil.
+    self setDevice:device id:nil gcId:nil.
     gc notNil ifTrue:[
         gc registerChange.
     ].
--- a/GraphicsMedium.st	Sun Apr 03 17:09:29 2016 +0100
+++ b/GraphicsMedium.st	Sun Apr 03 19:22:51 2016 +0100
@@ -1949,7 +1949,7 @@
     tempForm := Form width:(xMax-xMin+1+aForm width)
                      height:(yMax-yMin+1+aForm height)
                      depth:aForm depth
-                     onDevice:self graphicsDevice.
+                     onDevice:device.
     tempForm clear.
     tempForm paint:(Color colorId:1) on:(Color colorId:0).
     tempForm function:#or.
--- a/ShadowView.st	Sun Apr 03 17:09:29 2016 +0100
+++ b/ShadowView.st	Sun Apr 03 19:22:51 2016 +0100
@@ -127,7 +127,7 @@
 
     "the length of the shadow from myView"
     shadowLength := device pixelPerMillimeter.
-    "/ shadowLength := (self graphicsDevice pixelPerMillimeter * 2.0) rounded.
+    "/ shadowLength := (device pixelPerMillimeter * 2.0) rounded.
 !
 
 realize
--- a/SimpleView.st	Sun Apr 03 17:09:29 2016 +0100
+++ b/SimpleView.st	Sun Apr 03 19:22:51 2016 +0100
@@ -3170,7 +3170,7 @@
 
     |extent shapeForm borderForm w h f|
 
-"/    self graphicsDevice supportsPolygonShapedViews ifTrue:[
+"/    device supportsPolygonShapedViews ifTrue:[
 "/        "/ TODO: add code for mswin
 "/    ].
 
--- a/XEmbedContainerView.st	Sun Apr 03 17:09:29 2016 +0100
+++ b/XEmbedContainerView.st	Sun Apr 03 19:22:51 2016 +0100
@@ -196,7 +196,7 @@
 createWindowX:x y:y width:w height:h
     |childWindowIds|
 
-    childWindowIds := self graphicsDevice childIdsOf:self drawableId.
+    childWindowIds := device childIdsOf:self drawableId.
     childWindowIds size == 1 
         ifFalse:[ self error:'I should have exactly one child'. ].
     clientViewId := childWindowIds first.
@@ -217,9 +217,9 @@
 
     | childWindowIds |
 
-    childWindowIds := self graphicsDevice childIdsOf: self drawableId.  
+    childWindowIds := device childIdsOf: self drawableId.  
     childWindowIds size == 0 ifTrue:[
-        self graphicsDevice removeKnownView: clientView withId: clientViewId.
+        device removeKnownView: clientView withId: clientViewId.
         clientViewId := nil.
         clientView := nil.        
     ].
@@ -265,8 +265,8 @@
 
     clientViewId ifNil:[^self].
 
-    (self graphicsDevice 
-        sendClientEvent: (self graphicsDevice atomIDOf:'_XEMBED') 
+    (device 
+        sendClientEvent: (device atomIDOf:'_XEMBED') 
         format:32 
         to:clientViewId 
         propagate:false 
@@ -354,17 +354,17 @@
 !
 
 propertyChange:propertyId state:state 
-    propertyId == (self graphicsDevice atomIDOf:'_XEMBED_INFO') ifTrue:[ 
+    propertyId == (device atomIDOf:'_XEMBED_INFO') ifTrue:[ 
         self mapUnmapAccordingToXEmbedInfo. 
         ^self.
     ].
 
     (superView notNil and:[superView hasWorkaround: #uzbl]) ifTrue:[
-        propertyId == (self graphicsDevice atomIDOf:'WM_NORMAL_HINTS') ifTrue:[         
-            self graphicsDevice
+        propertyId == (device atomIDOf:'WM_NORMAL_HINTS') ifTrue:[         
+            device
                 resizeWindow:self drawableId 
                 width: 0  height: 0.
-            self graphicsDevice
+            device
                 resizeWindow:self drawableId 
                 width: self width - 1  height: self height - 1.
         ]
@@ -382,8 +382,8 @@
         superView removeSubView:self.
     ].
     self drawableId notNil ifTrue:[
-        self graphicsDevice
-           reparentWindow: self drawableId to: self graphicsDevice rootWindowId;
+        device
+           reparentWindow: self drawableId to: device rootWindowId;
            removeKnownView:self withId:self drawableId.
     ]
 
@@ -394,7 +394,7 @@
 initEvents
     |graphicsDevice|
 
-    graphicsDevice := self graphicsDevice.
+    graphicsDevice := device.
 
     graphicsDevice
         setEventMask:
@@ -410,7 +410,7 @@
     self setDevice:container device id:wid gcId:nil.
     superView := container.
     windowGroup := container windowGroup.
-    self graphicsDevice addKnownView: self withId: wid.
+    device addKnownView: self withId: wid.
     container add: self.
     self initEvents.
     self origin: 0.0@0.0 corner: 1.0@1.0.
@@ -424,8 +424,8 @@
 mapUnmapAccordingToXEmbedInfo
     |val|
 
-    val := self graphicsDevice 
-                getProperty:(self graphicsDevice atomIDOf:'_XEMBED_INFO')
+    val := device 
+                getProperty:(device atomIDOf:'_XEMBED_INFO')
                 from:self drawableId
                 delete:false.
     val ifNil: