XWorkstation.st
changeset 4127 2be685c11752
parent 4119 a770b7e08c72
child 4153 a6d682af620b
--- a/XWorkstation.st	Mon Mar 29 15:44:37 2004 +0200
+++ b/XWorkstation.st	Tue Mar 30 15:59:06 2004 +0200
@@ -9588,6 +9588,12 @@
      (in xterm) - the PRIMARY selection"
 
     ^ #(clipboard selection)
+!
+
+supportsUTF8WindowLabels
+    "answer true, if window labels are to be utf-8 encoded"
+
+    ^ false
 ! !
 
 !XWorkstation methodsFor:'resources'!
@@ -10789,6 +10795,25 @@
     "
 !
 
+primSetWindowName:aString in:aWindowId
+    "define a windows name"
+
+    <context: #return>
+%{  
+
+    if (ISCONNECTED
+     && __isNonNilObject(aString)
+     && (__qIsString(aString) || __qIsSymbol(aString))
+     && __isExternalAddress(aWindowId)) {
+        ENTER_XLIB();
+        XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString));
+        LEAVE_XLIB();
+        RETURN ( self );
+    }
+%}.
+    self primitiveFailedOrClosedConnection
+!
+
 raiseWindow:aWindowId
     "bring a window to front"
 
@@ -11361,20 +11386,18 @@
 setWindowName:aString in:aWindowId
     "define a windows name"
 
-    <context: #return>
-%{  
-
-    if (ISCONNECTED
-     && __isNonNilObject(aString)
-     && (__qIsString(aString) || __qIsSymbol(aString))
-     && __isExternalAddress(aWindowId)) {
-	ENTER_XLIB();
-	XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString));
-	LEAVE_XLIB();
-	RETURN ( self );
-    }
-%}.
-    self primitiveFailedOrClosedConnection
+    |stringUsed|
+
+    stringUsed := aString.
+    self supportsUTF8WindowLabels ifTrue:[
+        stringUsed := aString utf8Encoded.
+    ] ifFalse:[
+        aString bitsPerCharacter > 8 ifTrue:[
+            stringUsed := aString utf8Encoded.
+        ].
+    ].
+
+    self primSetWindowName:stringUsed in:aWindowId
 !
 
 setWindowShape:aPixmapId in:aWindowId
@@ -11470,7 +11493,7 @@
 !XWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.456 2004-03-20 15:35:39 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.457 2004-03-30 13:59:06 mb Exp $'
 ! !
 
 XWorkstation initialize!