Tk Source Code

Artifact [90a066e9]
Login

Artifact 90a066e97b26b9e7e9af383efa383a975e32f30d:

Attachment "tkUnixWm.c.diff" to ticket [959973ff] added by oskin 2004-05-25 15:53:39.
--- tk8.4.6/unix/tkUnixWm.c.orig	2002-12-28 00:23:04.000000000 +0300
+++ tk8.4.6/unix/tkUnixWm.c	2004-05-25 12:12:19.000000000 +0400
@@ -606,6 +606,7 @@
     register WmInfo *wmPtr = winPtr->wmInfoPtr;
     XTextProperty textProp;
     Tk_Uid string;
+    Atom utf8_string = 0;
 
     if (wmPtr->flags & WM_NEVER_MAPPED) {
 	Tcl_DString ds;
@@ -632,6 +633,10 @@
 	string = Tcl_DStringValue(&ds);
 	if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
 		&textProp)  != 0) {
+	    if (strncmp(Tcl_GetEncodingName(NULL), "utf-8", 5) == 0) {
+		utf8_string = XInternAtom(winPtr->display, "UTF8_STRING", True);
+		if (utf8_string != None) textProp.encoding = utf8_string;
+	    }
 	    XSetWMName(winPtr->display, wmPtr->wrapperPtr->window, &textProp);
 	    XFree((char *) textProp.value);
 	}
@@ -641,8 +646,16 @@
 
 	if (wmPtr->iconName != NULL) {
 	    Tcl_UtfToExternalDString(NULL, wmPtr->iconName, -1, &ds);
-	    XSetIconName(winPtr->display, wmPtr->wrapperPtr->window,
-		    Tcl_DStringValue(&ds));
+	    if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
+		    &textProp)  != 0) {
+		if (strncmp(Tcl_GetEncodingName(NULL), "utf-8", 5) == 0) {
+		    utf8_string = XInternAtom(winPtr->display, "UTF8_STRING", True);
+		    if (utf8_string != None) textProp.encoding = utf8_string;
+	    	}
+		XSetWMIconName(winPtr->display, wmPtr->wrapperPtr->window,
+			&textProp);
+		XFree((char *) textProp.value);
+	    }
 	    Tcl_DStringFree(&ds);
 	}
 
@@ -670,6 +683,10 @@
 	    Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, -1, &ds);
 	    if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
 		    &textProp) != 0) {
+		if (strncmp(Tcl_GetEncodingName(NULL), "utf-8", 5) == 0) {
+		    utf8_string = XInternAtom(winPtr->display, "UTF8_STRING", True);
+		    if (utf8_string != None) textProp.encoding = utf8_string;
+		}
 		XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window,
 			&textProp);
 		XFree((char *) textProp.value);
@@ -1233,6 +1250,7 @@
     register WmInfo *wmPtr = winPtr->wmInfoPtr;
     char *argv3;
     int length;
+    Atom utf8_string = 0;
 
     if ((objc != 3) && (objc != 4)) {
 	Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
@@ -1270,6 +1288,10 @@
 	Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, -1, &ds);
 	if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
 		&textProp) != 0) {
+	    if (strncmp(Tcl_GetEncodingName(NULL), "utf-8", 5) == 0) {
+		utf8_string = XInternAtom(winPtr->display, "UTF8_STRING", True);
+		if (utf8_string != None) textProp.encoding = utf8_string;
+	    }
 	    XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window,
 		    &textProp);
 	    XFree((char *) textProp.value);
@@ -2026,6 +2048,7 @@
     register WmInfo *wmPtr = winPtr->wmInfoPtr;
     char *argv3;
     int length;
+    Atom utf8_string = 0;
 
     if (objc > 4) {
 	Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?");
@@ -2045,10 +2068,19 @@
 	strcpy(wmPtr->iconName, argv3);
 	if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
 	    Tcl_DString ds;
+	    XTextProperty textProp;
 
 	    Tcl_UtfToExternalDString(NULL, wmPtr->iconName, -1, &ds);
-	    XSetIconName(winPtr->display, wmPtr->wrapperPtr->window,
-		    Tcl_DStringValue(&ds));
+	    if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
+		    &textProp)  != 0) {
+		if (strncmp(Tcl_GetEncodingName(NULL), "utf-8", 5) == 0) {
+		    utf8_string = XInternAtom(winPtr->display, "UTF8_STRING", True);
+		    if (utf8_string != None) textProp.encoding = utf8_string;
+	    	}
+		XSetWMIconName(winPtr->display, wmPtr->wrapperPtr->window,
+			&textProp);
+		XFree((char *) textProp.value);
+	    }
 	    Tcl_DStringFree(&ds);
 	}
     }
@@ -2916,6 +2948,7 @@
     register WmInfo *wmPtr = winPtr->wmInfoPtr;
     char *argv3;
     int length;
+    Atom utf8_string = 0;
 
     if (objc > 4) {
 	Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?");
@@ -2941,6 +2974,10 @@
 	    Tcl_UtfToExternalDString(NULL, wmPtr->title, -1, &ds);
 	    if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
 		    &textProp)  != 0) {
+		if (strncmp(Tcl_GetEncodingName(NULL), "utf-8", 5) == 0) {
+		    utf8_string = XInternAtom(winPtr->display, "UTF8_STRING", True);
+		    if (utf8_string != None) textProp.encoding = utf8_string;
+		}
 		XSetWMName(winPtr->display, wmPtr->wrapperPtr->window,
 			&textProp);
 		XFree((char *) textProp.value);