Merge jv
authorHG Automerge
Sat, 26 Nov 2016 22:00:53 +0000
branchjv
changeset 7723 620e91f9b082
parent 7722 1387e5aedc55 (current diff)
parent 7713 5e4be080979a (diff)
child 7724 2d687a2107f8
Merge
GraphicsContext.st
GraphicsMedium.st
SimpleView.st
ViewStyle.st
WindowSensor.st
XWorkstation.st
XftFontDescription.st
--- a/DeviceWorkstation.st	Sat Nov 26 21:38:57 2016 +0000
+++ b/DeviceWorkstation.st	Sat Nov 26 22:00:53 2016 +0000
@@ -3010,6 +3010,12 @@
 
 !DeviceWorkstation methodsFor:'accessing-misc'!
 
+asPseudoDeviceWithoutXFTSupport
+    "hack - see XWorkstation"
+    
+    ^ self
+!
+
 defaultEventMask
     "return a mask to enable some events by default."
 
--- a/Font.st	Sat Nov 26 21:38:57 2016 +0000
+++ b/Font.st	Sat Nov 26 22:00:53 2016 +0000
@@ -481,7 +481,12 @@
     ].
 
     "receiver was already associated to another device - need a new font"
-    ^ super onDevice:aDevice ifAbsent:exceptionBlock
+    ^ super 
+        onDevice:aDevice 
+        xFontsOnly:xFontsOnly xftFontsOnly:xftFontsOnly 
+        ifAbsent:exceptionBlock
+
+    "Modified: / 24-11-2016 / 16:53:36 / cg"
 !
 
 replacementFontOnDevice:aDevice
--- a/GraphicsContext.st	Sat Nov 26 21:38:57 2016 +0000
+++ b/GraphicsContext.st	Sat Nov 26 22:00:53 2016 +0000
@@ -984,6 +984,10 @@
     "Modified: 12.5.1996 / 19:40:43 / cg"
 !
 
+setDevice:aDevice
+    device := aDevice
+!
+
 viewOrigin
     "return the drawables visible origin (for scrolling)"
 
--- a/GraphicsMedium.st	Sat Nov 26 21:38:57 2016 +0000
+++ b/GraphicsMedium.st	Sat Nov 26 22:00:53 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -1063,6 +1061,13 @@
     gc setClippingBounds:aRectangleOrNil
 !
 
+setDevice:aDevice
+    "set the device"
+
+    device := aDevice.
+    gc setDevice:aDevice
+!
+
 setGraphicsExposures:aBoolean
     "want to if aBoolean is true - or don't want to be notified
      of graphics exposures"
--- a/SimpleView.st	Sat Nov 26 21:38:57 2016 +0000
+++ b/SimpleView.st	Sat Nov 26 22:00:53 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -1252,31 +1250,36 @@
     |defStyle|
 
     true "DefaultStyle isNil" ifTrue:[
-	defStyle := OperatingSystem getEnvironment:'STX_VIEWSTYLE'.
-	defStyle notNil ifTrue:[
-	    DefaultStyle := defStyle asSymbol.
-	] ifFalse:[
-	    "/ use XP for both linux and older windows systems;
-	    DefaultStyle := ViewStyle msWindowsXP.
-
-	    OperatingSystem isMSWINDOWSlike ifTrue:[
-		"/ use Vista for vista and newer systems;
-		OperatingSystem isVistaLike ifTrue:[
-		    DefaultStyle := ViewStyle msWindowsVista.
-		    OperatingSystem isWin8Like ifTrue:[
-			"/ use win8 for 8 and newer systems;
-			DefaultStyle := ViewStyle msWindows8
-		    ].
-		].
-	    ] ifFalse:[
-		OperatingSystem isOSXlike ifTrue:[
-		    DefaultStyle := #macosx
-		].
-	    ].
-	].
-    ].
-
-    "Modified: / 03-02-2011 / 21:41:35 / cg"
+        defStyle := OperatingSystem getEnvironment:'STX_VIEWSTYLE'.
+        defStyle isNil ifTrue:[
+            defStyle := UserPreferences current viewStyle
+        ].
+        defStyle notNil ifTrue:[
+            DefaultStyle := defStyle asSymbol.
+        ] ifFalse:[
+            "/ use XP for both linux and older windows systems;
+            DefaultStyle := ViewStyle msWindowsXP.
+
+            OperatingSystem isMSWINDOWSlike ifTrue:[
+                "/ use Vista for vista and newer systems;
+                OperatingSystem isVistaLike ifTrue:[
+                    DefaultStyle := ViewStyle msWindowsVista.
+                    OperatingSystem isWin8Like ifTrue:[
+                        "/ use win8 for 8 and newer systems;
+                        DefaultStyle := ViewStyle msWindows8
+                    ].
+                ].
+            ] ifFalse:[
+                OperatingSystem isOSXlike ifTrue:[
+                    DefaultStyle := ViewStyle macosx_yosemite
+                ] ifFalse:[
+                    DefaultStyle := ViewStyle adwaita
+                ]
+            ].
+        ].
+    ].
+
+    "Modified: / 24-11-2016 / 18:00:43 / cg"
 !
 
 styleSheet
--- a/ViewStyle.st	Sat Nov 26 21:38:57 2016 +0000
+++ b/ViewStyle.st	Sat Nov 26 22:00:53 2016 +0000
@@ -101,6 +101,18 @@
 
 !ViewStyle class methodsFor:'constants'!
 
+adwaita
+    ^ #Adwaita
+
+    "Created: / 24-11-2016 / 17:54:58 / cg"
+!
+
+macosx_yosemite
+    ^ #'macosx_yosemite'
+
+    "Created: / 24-11-2016 / 17:55:46 / cg"
+!
+
 msWindows8
     ^ #mswindows8
 !
--- a/WindowGroup.st	Sat Nov 26 21:38:57 2016 +0000
+++ b/WindowGroup.st	Sat Nov 26 22:00:53 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -76,13 +74,15 @@
     The event queues are filled with incoming events as arriving from the physical display.
     This is done by a separate process (so called event-dispatcher) which runs at a higher
     priority. The event dispatcher determines the queue into which an event has to be placed,
-    by asking the view for which the event is destined (via the views sensor).
-    There may be multiple event dispatchers running (to support multiple displays);
-    see the documentation/examples in DeviceWorkstation/XWorkstation on how this is done.
+    by asking the view for which the event is destined (via the view's sensor).
+    There may be multiple event dispatchers running (to support multiple displays simultaneously),
+    there may also be multiple input device readers running 
+    (to suppert tablet/pen input, or other input devices).
+    See the documentation/examples in DeviceWorkstation/XWorkstation on how this is done.
 
     Except for modal boxes, a separate process is created for each windowGroup 
     which waits for events to arrive and processes them, by sending corresponding
-    event messages to the views controller or the view (*). 
+    event messages to the view's controller or the view (*). 
     The controller is determined by asking the view (for which the event is destined);
     if the returned controller is nil, the event is sent directly to the view.
     This allows for simple views to work without a controller.
@@ -286,7 +286,7 @@
 leaveSignal
     "return the signal which is used to exit a modal loop.
      This private signal, is always caught while a modalbox is active.
-     Raising it will exit the modal loop and return from the views #openModal
+     Raising it will exit the modal loop and return from the view's #openModal
      method."
 
     ^ LeaveSignal
--- a/WindowSensor.st	Sat Nov 26 21:38:57 2016 +0000
+++ b/WindowSensor.st	Sat Nov 26 22:00:53 2016 +0000
@@ -80,7 +80,7 @@
     A listener may return true to signal that it has handled the event and that the
     event should NOT be enqueued. 
     Likewise, if it returns false, the event is processed as usual 
-    (i.e. enqueued and forwarded to the views controller).
+    (i.e. enqueued and forwarded to the view's controller).
     If there are multiple listeners, all of them get a chance to process the event,
     but it will not be enqueued, if any returned true.
 
@@ -2099,7 +2099,7 @@
 basicAddDamage:newRectangle view:aView
     "{ Pragma: +optSpeed }"
 
-    "Add newRectangle to the views update region.
+    "Add newRectangle to the view's update region.
      Must be careful, if the damage queue contains an event pattern such as:
         damage  map     
      in this case, a new damage event is required to be added AFTER the map event,
@@ -2141,11 +2141,11 @@
     oldDamageEventIndex notNil ifTrue:[
         "/ there is already a damage for this view in the queue
         "/ (which will wake up the WG, if currently sleeping).
-        "/ so all we have to do is to add the reactangle to the views updateRegion.
+        "/ so all we have to do is to add the reactangle to the view's updateRegion.
         "/ However, if the view was unmapped, and there is
         "/ a mapped event AFTER the expose, we MUST perform the expose
         "/ after we have handled the mapped event.
-        "/ (otherwise, the expose-rect would be added to the views expose region,
+        "/ (otherwise, the expose-rect would be added to the view's expose region,
         "/  and handed at a time when the view thinks it's still unmapped and therefore
         "/  ignore the exposes.)
         "/ Therefore, clear the old damage event and add a new one at the end,
@@ -2593,7 +2593,7 @@
      or asynchronous communication between view applications.
      The view will perform a method as specified by aSelector,
      when it performs event processing; this is different than sending
-     this message directly, since the execution is done by the views process,
+     this message directly, since the execution is done by the view's process,
      not by the current process (which is especially worthwhile, if that method 
      shows a modal box or similar)."
 
@@ -2608,7 +2608,7 @@
      or asynchronous communication between view applications.
      anyObject will perform a method as specified by aSelector,
      when the windogroup dispatches this event. This is different than sending
-     this message directly, since the execution is done by the views process,
+     this message directly, since the execution is done by the view's process,
      not by the current process (which is especially worthwhile, if that method 
      shows a modal box or similar)."
 
@@ -2621,7 +2621,7 @@
      or asynchronous communication between view applications.
      anyObject will perform a method as specified by aSelector,
      when the windogroup dispatches this event. This is different than sending
-     this message directly, since the execution is done by the views process,
+     this message directly, since the execution is done by the view's process,
      not by the current process (which is especially worthwhile, if that method 
      shows a modal box or similar)."
 
--- a/XWorkstation.st	Sat Nov 26 21:38:57 2016 +0000
+++ b/XWorkstation.st	Sat Nov 26 22:00:53 2016 +0000
@@ -39,6 +39,13 @@
 	category:'Interface-Graphics'
 !
 
+Object subclass:#PseudoDeviceWithoutXFTSupport
+	instanceVariableNames:'realDevice'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:XWorkstation
+!
+
 Object subclass:#SelectionFetcher
 	instanceVariableNames:'sema message display drawableID selectionID propertyID targetID
 		buffer done incremental'
@@ -1041,6 +1048,15 @@
     ^ nil
 !
 
+asPseudoDeviceWithoutXFTSupport
+    "return a pseudo device to be used when drawing into pixmaps
+     on a device where xft-drawing into pixmaps is broken.
+     This is a temporary hack, to be removed when that problem is fixed in xft;
+     then, we should return self here."
+     
+    ^ PseudoDeviceWithoutXFTSupport basicNew realDevice:self
+!
+
 blackpixel
     "return the colornumber of black"
 
@@ -13404,6 +13420,45 @@
     ^ false "/ or true or what ?
 ! !
 
+!XWorkstation::PseudoDeviceWithoutXFTSupport class methodsFor:'documentation'!
+
+documentation
+"
+    this is a proxy device, which forwards its messages to a real device,
+    possibly overriding some messages.
+    It is currently only used as a hack (workaround) a bug in the XWindows
+    interface, which cannot draw strings into pixmaps using XFT fonts.
+    For this, a pseudoDevice instance is set as device into the pixmap's GC,
+    so it will draw using non-xft fonts.
+    This should vanish, once the xft drawing works.
+    
+    [author:]
+        cg
+"
+! !
+
+!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'accessing'!
+
+realDevice:aDevice
+    realDevice := aDevice.
+! !
+
+!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'message forwarding'!
+
+doesNotUnderstand:aMessage
+    ^ aMessage sendTo:realDevice
+! !
+
+!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'queries'!
+
+deviceFonts
+    ^ realDevice deviceFonts keys reject:[:f | f isXftFont ]
+!
+
+supportsXftFonts
+    ^ false.
+! !
+
 !XWorkstation::SelectionFetcher class methodsFor:'documentation'!
 
 documentation
--- a/XftFontDescription.st	Sat Nov 26 21:38:57 2016 +0000
+++ b/XftFontDescription.st	Sat Nov 26 22:00:53 2016 +0000
@@ -444,13 +444,13 @@
 asNonXftFont
     |newFont|
 
-    newFont := FontDescription
-		    family:family
-		    face:face
-		    style:style
-		    size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size])
-		    sizeUnit:sizeUnit
-		    encoding:encoding.
+    newFont := Font
+                    family:family
+                    face:face
+                    style:style
+                    size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size])
+                    sizeUnit:sizeUnit
+                    encoding:encoding.
 
     ^ newFont
 ! !