#FEATURE by stefan
class: XWorkstation
#newGraphicsContextFor:
method will be used for detached graphicsContext
--- a/XWorkstation.st Thu Jul 14 20:51:37 2016 +0200
+++ b/XWorkstation.st Fri Jul 15 17:59:22 2016 +0200
@@ -6883,15 +6883,15 @@
if (ISCONNECTED
&& __isStringLike(aFontName)) {
- ENTER_XLIB();
- newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
- LEAVE_XLIB();
+ ENTER_XLIB();
+ newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
+ LEAVE_XLIB();
#ifdef COUNT_RESOURCES
- if (newFont)
- __cnt_font++;
-#endif
-
- RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil );
+ if (newFont)
+ __cnt_font++;
+#endif
+
+ RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil );
}
%}.
"/ --- disabled due to UNLIMITEDSTACK -- self primitiveFailedOrClosedConnection.
@@ -7562,7 +7562,7 @@
!
getFontWithFamily:familyString face:faceString
- style:styleArgString size:sizeArgOrNil sizeUnit:sizeUnit encoding:encoding
+ style:styleArgString size:sizeArgOrNil sizeUnit:sizeUnit encoding:encoding
"try to get the specified font, if not available, try next smaller
font. Access to X-fonts by name is possible, by passing the X font name
@@ -7575,28 +7575,28 @@
styleString := styleArgString.
sizeArgOrNil notNil ifTrue:[
- roundedSize := sizeArgOrNil rounded asInteger.
- sizeUnit == #px ifTrue:[
- pixelSize := roundedSize.
- ] ifFalse:[
- pointSize := roundedSize.
- ].
+ roundedSize := sizeArgOrNil rounded asInteger.
+ sizeUnit == #px ifTrue:[
+ pixelSize := roundedSize.
+ ] ifFalse:[
+ pointSize := roundedSize.
+ ].
].
"special: if face is nil, allow access to X-fonts"
faceString isNil ifTrue:[
- roundedSize notNil ifTrue:[
- theName := familyString , '-' , roundedSize printString
- ] ifFalse:[
- theName := familyString
- ].
- theName notNil ifTrue:[
- theId := self createFontFor:theName.
- ].
- theId isNil ifTrue:[
- theId := self getDefaultFontWithEncoding:encoding
- ].
- ^ theId
+ roundedSize notNil ifTrue:[
+ theName := familyString , '-' , roundedSize printString
+ ] ifFalse:[
+ theName := familyString
+ ].
+ theName notNil ifTrue:[
+ theId := self createFontFor:theName.
+ ].
+ theId isNil ifTrue:[
+ theId := self getDefaultFontWithEncoding:encoding
+ ].
+ ^ theId
].
"/ spacing other than 'normal' is contained as last component
@@ -7604,67 +7604,67 @@
(styleString notNil
and:[(styleString endsWith:'-narrow')
- or:[styleString endsWith:'-semicondensed']]) ifTrue:[
- |i|
- i := styleString lastIndexOf:$-.
- spacing := styleString copyFrom:(i+1).
- styleString := styleString copyTo:(i-1).
+ or:[styleString endsWith:'-semicondensed']]) ifTrue:[
+ |i|
+ i := styleString lastIndexOf:$-.
+ spacing := styleString copyFrom:(i+1).
+ styleString := styleString copyTo:(i-1).
] ifFalse:[
- spacing := 'normal'.
+ spacing := 'normal'.
].
xlatedStyle := styleString.
xlatedStyle notNil ifTrue:[
- xlatedStyle := xlatedStyle first asString
+ xlatedStyle := xlatedStyle first asString
].
encoding isNil ifTrue:[
- encodingMatch := '*-*'.
+ encodingMatch := '*-*'.
] ifFalse:[
- idx := encoding indexOf:$-.
- idx ~~ 0 ifTrue:[
- encodingMatch := encoding
- ] ifFalse:[
- encodingMatch := encoding , '-*'.
- ].
+ idx := encoding indexOf:$-.
+ idx ~~ 0 ifTrue:[
+ encodingMatch := encoding
+ ] ifFalse:[
+ encodingMatch := encoding , '-*'.
+ ].
].
id := self
- getFontWithFoundry:'*'
- family:familyString asLowercase
- weight:faceString
- slant:xlatedStyle
- spacing:spacing
- pixelSize:pixelSize
- size:pointSize
- encoding:encodingMatch.
+ getFontWithFoundry:'*'
+ family:familyString asLowercase
+ weight:faceString
+ slant:xlatedStyle
+ spacing:spacing
+ pixelSize:pixelSize
+ size:pointSize
+ encoding:encodingMatch.
id isNil ifTrue:[
- (encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[
- "/ too stupid: registries come in both cases
- "/ and X does not ignore case
- "/
- id := self
- getFontWithFoundry:'*'
- family:familyString asLowercase
- weight:faceString
- slant:xlatedStyle
- spacing:spacing
- pixelSize:nil
- size:roundedSize
- encoding:encodingMatch asUppercase.
- id isNil ifTrue:[
- id := self
- getFontWithFoundry:'*'
- family:familyString asLowercase
- weight:faceString
- slant:xlatedStyle
- spacing:spacing
- pixelSize:nil
- size:roundedSize
- encoding:encodingMatch asLowercase.
- ]
- ]
+ (encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[
+ "/ too stupid: registries come in both cases
+ "/ and X does not ignore case
+ "/
+ id := self
+ getFontWithFoundry:'*'
+ family:familyString asLowercase
+ weight:faceString
+ slant:xlatedStyle
+ spacing:spacing
+ pixelSize:nil
+ size:roundedSize
+ encoding:encodingMatch asUppercase.
+ id isNil ifTrue:[
+ id := self
+ getFontWithFoundry:'*'
+ family:familyString asLowercase
+ weight:faceString
+ slant:xlatedStyle
+ spacing:spacing
+ pixelSize:nil
+ size:roundedSize
+ encoding:encodingMatch asLowercase.
+ ]
+ ]
].
^ id
@@ -11084,15 +11084,15 @@
atomSymbol := aStringOrSymbol asSymbol.
(atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:[nil]) notNil]) ifTrue:[
- ^ atom.
+ ^ atom.
].
atom := self primAtomIDOf:atomSymbol create:create.
atom notNil ifTrue:[
- atoms isNil ifTrue:[
- atoms := IdentityDictionary new.
- ].
- atoms at:atomSymbol put:atom.
+ atoms isNil ifTrue:[
+ atoms := IdentityDictionary new.
+ ].
+ atoms at:atomSymbol put:atom.
].
^ atom
@@ -12513,6 +12513,16 @@
self primitiveFailedOrClosedConnection
!
+newGraphicsContextFor:aGraphicsMedium
+ "Redefined to use my own device specific graphics context"
+
+ |gc|
+
+ gc := X11GraphicsContext onDevice:self.
+ gc font:aGraphicsMedium class defaultFont.
+ ^ gc.
+!
+
parentWindowIdOf:aWindowId
"return a windows parent-window id.
Useful with getGeometryOf:, to compute information about the decoration."
@@ -13857,10 +13867,6 @@
version_CVS
^ '$Header$'
-!
-
-version_SVN
- ^ '$ Id $'
! !