aboutsummaryrefslogtreecommitdiff
path: root/debian/patches-pending-evaluation/fix-icon-and-clipboard.patch
blob: d6ecf8f19f819e547b19bf1ba956630603938d5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
From: Boris Savelev <boris@altlinux.org>
Date: Fri, 11 Jul 2008 13:50:46 +0000 (+0400)
Subject: fix icons and clipboard (thanks to dimbor)
X-Git-Tag: 3.3.0-alt2~24
X-Git-Url: http://git.etersoft.ru?p=rx%2Fnx.git;a=commitdiff_plain;h=c51ec5f4afcbf6199da5343f52241f6ef8edbbfb

fix icons and clipboard (thanks to dimbor)
---

diff --git a/nxwin/programs/Xserver/hw/nxwin/wincutpaste.c b/nxwin/programs/Xserver/hw/nxwin/wincutpaste.c
index 862f75a..5405568 100644
--- a/nxwin/programs/Xserver/hw/nxwin/wincutpaste.c
+++ b/nxwin/programs/Xserver/hw/nxwin/wincutpaste.c
@@ -78,6 +78,8 @@
 
 #define MIN(a,b) ((a) < (b) ? (a) : (b))
 
+/*#define NXWIN_CLIPBOARD_DEBUG*/
+
 extern          WindowPtr *WindowTable;
 extern          Selection *CurrentSelections;
 extern int      NumCurrentSelections;
@@ -96,6 +98,8 @@ Atom            clientTARGETS;
 Atom            clientTEXT;
 Atom            clientCutProperty;
 Atom            clientCLIPBOARD;
+Atom		UTF8_STRING;
+Atom		COMPOUND_TEXT;
 
 Bool            windowsOwner = FALSE;
 Bool            clientOwner  = FALSE;
@@ -119,7 +123,7 @@ void nxwinClearSelection(void)
      return;
 
 #ifdef NXWIN_CLIPBOARD_DEBUG
-   ErrorF("ClearSelection\n");
+   ErrorF("%d nxwinClearSelection: ClearSelection\n",GetTickCount());
 #endif
 
 for (i = 0; i < MIN(MaxSelections, NumCurrentSelections); i++)
@@ -155,8 +159,16 @@ void nxwinInitSelection(HWND hwnd)
    clientTEXT           = MakeAtom("TEXT", strlen("TEXT"), TRUE);
    clientCutProperty    = MakeAtom("NX_CUT_BUFFER_CLIENT", strlen("NX_CUT_BUFFER_CLIENT"), TRUE);
    clientCLIPBOARD      = MakeAtom("CLIPBOARD", strlen("CLIPBOARD"), TRUE);
+/* */
+   UTF8_STRING		= MakeAtom("UTF8_STRING", strlen("UTF8_STRING"), TRUE);
+   COMPOUND_TEXT        = MakeAtom("COMPOUND_TEXT", strlen("COMPOUND_TEXT"), TRUE);
+/* */
    nxwinClipboardStatus = TRUE;
    windowsOwner         = TRUE;
+#ifdef NXWIN_CLIPBOARD_DEBUG
+/*   ErrorF("%d nxwinInitSelection\n",GetTickCount()); 
+*/
+#endif
 /*   nxwinSetWindowClipboard(" ");*/
 }
 
@@ -165,15 +177,17 @@ void nxwinSetSelectionOwner(Selection *pSelection)
    if (!nxwinClipboardStatus)
      return;
 
-#ifdef NXWIN_CLIPBOARD_DEBUG
-   ErrorF("SetSelectionOwner\n");
-#endif
 
    lastOwnerWindowPtr = pSelection->pWin;
    lastOwnerWindow    = pSelection->window;
    lastOwnerClientPtr = pSelection->client;
    
    nxwinSelection = TRUE;
+
+#ifdef NXWIN_CLIPBOARD_DEBUG
+/*   ErrorF("%d nxwinSetSelectionOwner:  window [%p], pWin [%p]\n",GetTickCount(),pSelection->window,pSelection->pWin);
+*/
+#endif
 /*
     if (pSelection->selection == XA_PRIMARY)
     {
@@ -194,21 +208,67 @@ void nxwinSetSelectionOwner(Selection *pSelection)
                                 NoEventMask, NoEventMask ,
                                 NullGrab);
 #ifdef NXWIN_CLIPBOARD_DEBUG
-       ErrorF("SetSelectionOwner XA_PRIMARY \n");
+       ErrorF(" nxwinSetSelectionOwner: SetSelectionOwner XA_PRIMARY \n");
 #endif
 
        windowsOwner = FALSE;   
      }
 */
+
+}
+
+/* ------------------ My  ------------------------------------------- */
+char * unicode_to_some_cp(wchar_t *unicode_string, int CP)
+{
+	int err;
+	char * res;
+	int res_len = WideCharToMultiByte(
+		CP,				// Code page
+		0,					// Default replacement of illegal chars
+		unicode_string,		// Multibyte characters string
+		-1,					// Number of unicode chars is not known
+		NULL,				// No buffer yet, allocate it later
+		0,					// No buffer
+		NULL,				// Use system default
+		NULL				// We are not interested whether the default char was used
+		);
+	if (res_len == 0) 
+	{
+		return NULL;
+	}
+	res = malloc(res_len);
+	if (res == NULL) 
+	{
+		return NULL;
+	}
+	err = WideCharToMultiByte(
+		CP,				// Code page
+		0,					// Default replacement of illegal chars
+		unicode_string,		// Multibyte characters string
+		-1,					// Number of unicode chars is not known
+		res,				// Output buffer
+		res_len,			// buffer size
+		NULL,				// Use system default
+		NULL				// We are not interested whether the default char was used
+		);
+	if (err == 0)
+	{
+		free(res);
+		return NULL;
+	}
+	return res;
 }
 
+
+/* ------------------ My ------------------------------------------- */
+
 Bool nxwinConvertSelection(ClientPtr client ,WindowPtr pWin, Atom selection, Window requestor, Atom property, Atom target, Time time)
 {
    if (!nxwinClipboardStatus)
      return 0;
 
 #ifdef NXWIN_CLIPBOARD_DEBUG
-   ErrorF("ConvertSelection\n");
+   ErrorF("%d nxwinConvertSelection: pWin [%p], selection [%s], target [%s]\n",GetTickCount(),pWin,NameForAtom(selection),NameForAtom(target));
 #endif
 
    if (!windowsOwner) /* there is a X client owner, let normal stuff happens */
@@ -236,20 +296,25 @@ Bool nxwinConvertSelection(ClientPtr client ,WindowPtr pWin, Atom selection, Win
       return 1;
    }
 
-#ifdef NXWIN_CLIPBOARD_DEBUG
-   ErrorF("ConvertSelection converting...\n");
-#endif
 
-   if ((target == clientTEXT) || (target == XA_STRING))
+   if ((target == clientTEXT) || (target == XA_STRING) || (target == UTF8_STRING))
    {
       HGLOBAL hGlobal;
       char *pszGlobalData;
       xEvent x;
 
+      char *pszData=NULL;
+
       /* Access the clipboard */
       if (!OpenClipboard (lastHwnd)) return 0;
-
-      hGlobal = GetClipboardData (CF_TEXT);
+      if (target == UTF8_STRING)
+      {
+        hGlobal = GetClipboardData (CF_UNICODETEXT);
+      }
+      else
+      {
+        hGlobal = GetClipboardData (CF_TEXT);
+      }
       if (!hGlobal)
       {
         CloseClipboard();
@@ -264,10 +329,29 @@ Bool nxwinConvertSelection(ClientPtr client ,WindowPtr pWin, Atom selection, Win
         return 1;
       }
       pszGlobalData = (char *) GlobalLock (hGlobal);
-
-      /* Convert DOS string to UNIX string */
-      DOStoUNIX (pszGlobalData, strlen (pszGlobalData));
-
+			
+      if (target == UTF8_STRING)
+      {
+         /* Convert DOS string to UNIX string */
+         DOStoUNIX (pszGlobalData, strlen (pszGlobalData));
+         pszData = unicode_to_some_cp((wchar_t *) pszGlobalData,CP_UTF8);
+#ifdef NXWIN_CLIPBOARD_DEBUG
+        ErrorF("  Set sel [%s], target [%s], prop [%s] to UTF-8 string [%s]\n",NameForAtom(selection),NameForAtom(target),NameForAtom(property),pszData);
+#endif
+      /* Copy the clipboard text to the requesting window */
+        ChangeWindowProperty(pWin,
+                             property,
+                             target,
+                             8,
+                             PropModeReplace,
+                             strlen(pszData),
+                             pszData, 1);
+      }
+      else
+      {
+#ifdef NXWIN_CLIPBOARD_DEBUG
+      ErrorF("  Set sel [%s], target [%s], prop [%s] to CP-1251 string [%s]\n",NameForAtom(selection),NameForAtom(target),NameForAtom(property),pszGlobalData);
+#endif
       /* Copy the clipboard text to the requesting window */
       ChangeWindowProperty(pWin,
                            property,
@@ -276,12 +360,16 @@ Bool nxwinConvertSelection(ClientPtr client ,WindowPtr pWin, Atom selection, Win
                            PropModeReplace,
                            strlen(pszGlobalData),
                            pszGlobalData, 1);
+      }
 
       /* Release the clipboard data */
       GlobalUnlock (hGlobal);
       pszGlobalData = NULL;
       CloseClipboard ();
 
+      if (pszData != NULL)
+	free (pszData);
+
       x.u.u.type = SelectionNotify;
       x.u.selectionNotify.time = time;
       x.u.selectionNotify.requestor = requestor;
@@ -370,6 +458,7 @@ UNIXtoDOS (char **ppszData, int iLength)
 }
 
 
+
 void
 DOStoUNIX (char *pszSrc, int iLength)
 {
@@ -401,8 +490,11 @@ void nxwinSetWindowClipboard(char *text, int iLength)
   char          *pszGlobalData;
   char          *pszTemp;
 
+
   if (!nxwinClipboardStatus)
+  {
      return;
+  }
 
   if (OpenClipboard(lastHwnd))
   {
@@ -440,6 +532,9 @@ void nxwinSetWindowClipboard(char *text, int iLength)
       /* free the allocated memory */
       xfree(pszTemp);
 
+#ifdef NXWIN_CLIPBOARD_DEBUG
+   ErrorF("%d nxwinSetWindowClipboard: [%s].\n",GetTickCount(),pszGlobalData);
+#endif
       /* Release the pointer to the global memory */
       GlobalUnlock (hGlobal);
       pszGlobalData = NULL;
@@ -466,10 +561,14 @@ Bool nxwinSendNotify(xEvent* x)
  int iReturn;
 
 #ifdef NXWIN_CLIPBOARD_DEBUG
-  ErrorF("SendNotify\n");
+  ErrorF("%d nxwinSendNotify: pwin [%p];",GetTickCount(),lastOwnerWindowPtr);
+  ErrorF(" x->u.u.type [%s]; x->u.selectionNotify: property [%s]; target [%s]; selection [%s]",NameForAtom(x->u.u.type),NameForAtom(x->u.selectionNotify.property),NameForAtom(x->u.selectionNotify.target),NameForAtom(x->u.selectionNotify.selection)); 
 #endif
   if (x->u.selectionNotify.property == clientCutProperty)
   {
+#ifdef NXWIN_CLIPBOARD_DEBUG
+     ErrorF("\n");
+#endif
      Atom       atomReturnType;
      int     iReturnFormat;
      unsigned long   ulReturnItems;
@@ -479,13 +578,26 @@ Bool nxwinSendNotify(xEvent* x)
                                 AnyPropertyType, &atomReturnType, &iReturnFormat,
                                 &ulReturnItems, &ulReturnBytesLeft, &pszReturnData);
 
+/*
+#ifdef NXWIN_CLIPBOARD_DEBUG
+     ErrorF("nxwinSendNotify: called 1-st GetWindowProperty - status = %d, ulReturnBytesLeft = %d\n",Success,ulReturnBytesLeft);
+#endif
+*/
      if ((iReturn == Success) && (ulReturnBytesLeft > 0))
      {
         iReturn = GetWindowProperty(lastOwnerWindowPtr,clientCutProperty,0,ulReturnBytesLeft, FALSE,
                                         AnyPropertyType, &atomReturnType, &iReturnFormat,
                                         &ulReturnItems, &ulReturnBytesLeft, &pszReturnData);
+/*
+#ifdef NXWIN_CLIPBOARD_DEBUG
+	ErrorF("nxwinSendNotify: called 2-nd GetWindowProperty - status=%d, ulReturnItems=%d\n",Success,ulReturnItems);
+#endif
+*/
         if ((iReturn == Success) && (ulReturnItems > 0))
         {
+#ifdef NXWIN_CLIPBOARD_DEBUG
+  	  ErrorF("  AtomReturnType [%s]\n",NameForAtom(atomReturnType));
+#endif
           nxwinSetWindowClipboard(pszReturnData, ulReturnItems);
 
           clientOwner = TRUE;
@@ -495,6 +607,9 @@ Bool nxwinSendNotify(xEvent* x)
         }
      }
   }
+#ifdef NXWIN_CLIPBOARD_DEBUG
+  else ErrorF(" !! MISSED !!\n");
+#endif
   return FALSE;
 }
 
@@ -512,19 +627,27 @@ void nxwinLostFocus(void)
    if (lastOwnerWindowPtr)
    {
       xEvent x;
+#ifdef NXWIN_CLIPBOARD_DEBUG
+   ErrorF("%d nxwinLostFocus: lastOwnerWindow [%p]; pWin [%p]; target [%s]; prop [%s]\n",GetTickCount(),lastOwnerWindow,lastOwnerWindowPtr,NameForAtom(XA_STRING),NameForAtom(clientCutProperty));
+#endif
 
       x.u.u.type = SelectionRequest;
       x.u.selectionRequest.time = GetTimeInMillis();
       x.u.selectionRequest.owner = lastOwnerWindow;
       x.u.selectionRequest.requestor = screenInfo.screens[0]->root->drawable.id;
-      x.u.selectionRequest.selection = XA_PRIMARY;
+/* My changes */
+/*
+      x.u.selectionRequest.selection =  XA_PRIMARY; 
+*/
+      x.u.selectionRequest.selection = clientCLIPBOARD;  
+/* My changes */
       x.u.selectionRequest.target = XA_STRING;
       x.u.selectionRequest.property = clientCutProperty;
-
       (void) TryClientEvents (lastOwnerClientPtr, &x, 1,
                                NoEventMask, NoEventMask /* CantBeFiltered */,
                                NullGrab);
       SetCriticalOutputPending();
+
    }
 }
 
diff --git a/nxwin/programs/Xserver/hw/nxwin/winmultiwindowwm.c b/nxwin/programs/Xserver/hw/nxwin/winmultiwindowwm.c
index e8149c7..a09d227 100644
--- a/nxwin/programs/Xserver/hw/nxwin/winmultiwindowwm.c
+++ b/nxwin/programs/Xserver/hw/nxwin/winmultiwindowwm.c
@@ -408,7 +408,9 @@ privateGetWindowName(void *pWin, char **ppName, Atom atom)
    if( (retValue = GetWindowProperty(pWin, atom, 0L, 0L, False,
                         AnyPropertyType, &retType, &retFormat, 
                         &nItems, &bytesLeft, (unsigned char**)NULL)) != Success){
-       ErrorF("GetWindowName: GetWindowProperty failed\n");
+#ifdef NXWIN_MULTIWINDOW_DEBUG
+       ErrorF("GetWindowName: GetWindowProperty /length/ failed\n");
+#endif
        return retValue; 
    }
    origLen = bytesLeft;
@@ -417,7 +419,9 @@ privateGetWindowName(void *pWin, char **ppName, Atom atom)
    if( (retValue = GetWindowProperty(pWin, atom, 0L, bytesLeft, False,
                         AnyPropertyType, &retType, &retFormat, 
                         &nItems, &bytesLeft, (unsigned char**)ppName)) != Success){
-       ErrorF("GetWindowName: GetWindowProperty failed\n");
+#ifdef NXWIN_MULTIWINDOW_DEBUG
+       ErrorF("GetWindowName: GetWindowProperty /value/ failed\n");
+#endif
        free(strName);
        return retValue;
    }
@@ -448,8 +452,16 @@ GetWindowName (void *pWin, char **ppName)
 
    /* TRY with ATOM WM_NAME */
    reqAtom = XA_WM_NAME;
-   if( privateGetWindowName(pWin, ppName, reqAtom) == Success )
+   if( privateGetWindowName(pWin, ppName, reqAtom) == Success ) 
+/* ------------------ My crooked additions ------------------------------------------- */
+/* sometimes *ppName is present and zero length - anyway need to try second atom */
+   { if (strlen(*ppName) > 0)
+     {
       return;
+     }
+     else free(*ppName);
+   }
+/* ------------------ My crooked additions ------------------------------------------- */
    reqAtom = MakeAtom(atom_NET_WM_NAME, sizeof(atom_NET_WM_NAME) - 1, True);
    privateGetWindowName(pWin, ppName, reqAtom);
 }
@@ -537,6 +549,98 @@ winMultStackWindow(pWin, val)
     return 1;
 }
 
+/* ------------------ My crooked additions ------------------------------------------- */
+wchar_t * utf8_to_unicode(char *utf8_string)
+{
+	int err;
+	wchar_t * res;
+	int res_len = 1000;
+	res = malloc(res_len);
+	err = MultiByteToWideChar(
+		CP_UTF8,		// Code page
+		0,			// No flags
+		utf8_string,		// Multibyte characters string
+		-1,			// The string is NULL terminated
+		res,			// Output buffer
+		res_len			// buffer size
+		);
+	if (err == 0)
+	{
+//		printf("Failed to convert to unicode\n");
+		free(res);
+		return NULL;
+	}
+	return res;
+}
+
+void 
+winSetWinName (WMMsgNodePtr pNode)
+{
+  {
+    /*XWindowAttributes		attr;*/
+    char			*pszName;
+    wchar_t 			*pszWName;
+#if 0
+    XWMHints			*pHints;
+#endif
+    /* Get the window attributes */
+    /*
+    XGetWindowAttributes (pWMInfo->pDisplay,
+			  pNode->msg.iWindow,
+			  &attr);
+    */
+    if (!winGetOverrideRedirectPriv(pNode->msg.pWin))
+     {
+#ifdef NXWIN_MULTIWINDOW
+#ifdef NXWIN_MULTIWINDOW_DEBUG
+	if(nxwinMultiwindow)
+             ErrorF("winMultiWindowWMProc: LOCK before GetWindowName\n");
+	else
+	     ErrorF("winMultiWindowWMProc: before GetWindowName\n");	
+#endif
+             if(nxwinMultiwindow && pthread_mutex_lock(&nxwinMultiwindowMutex))
+                     ErrorF("winMultiWindowWMProc: pthread_mutex_lock failed\n");
+#endif
+	/* Set the Windows window name */
+	GetWindowName(pNode->msg.pWin, &pszName);
+#ifdef NXWIN_MULTIWINDOW
+#ifdef NXWIN_MULTIWINDOW_DEBUG
+	if(nxwinMultiwindow)
+             ErrorF("winMultiWindowWMProc: UNLOCK after GetWindowName\n");
+	else
+	     ErrorF("winMultiWindowWMProc: after GetWindowName\n");
+#endif
+        if(nxwinMultiwindow && pthread_mutex_unlock(&nxwinMultiwindowMutex) != 0)
+             ErrorF("winMultiWindowWMProc: !!! pthread_mutex_unlock failed\n");
+#endif
+	if(!pszName){
+	     ErrorF("winMultiWindowWMProc: GetWindowName failed\n");	
+	     return;
+		}
+
+#ifdef NXWIN_MULTIWINDOW_DEBUG
+	ErrorF("winMultiWindowWMProc!!!: Window title before converting - %s\n",pszName);
+#endif
+/* if you know, how to get system charset from server, tell me about them */
+	pszWName = utf8_to_unicode(pszName);
+#ifdef NXWIN_MULTIWINDOW_DEBUG
+	ErrorF("winMultiWindowWMProc!!!: Window title after converting  - %s\n",pszWName);
+#endif
+	SetWindowTextW (pNode->msg.hwndWindow, pszWName); 
+//	SetWindowText (pNode->msg.hwndWindow, pszName);
+
+#ifdef NXWIN_MULTIWINDOW_DEBUG
+	ErrorF("winMultiWindowWMProc: Insert here LoadIcon\n");
+#endif
+	free (pszName);
+        if (pszWName != NULL)
+		free (pszWName);
+      }
+  }
+}
+/* -----------End of my crooked additions ------------------------------------------- */
+
+
 static void *
 winMultiWindowWMProc (void *pArg)
 {
@@ -599,6 +703,10 @@ winMultiWindowWMProc (void *pArg)
      /*
      XRaiseWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
      */
+
+/* ------------------ My crooked additions ------------------------------------------- */
+	  winSetWinName (pNode);
+/* -----------End of my crooked additions ------------------------------------------- */
      break;
 
    case WM_WM_LOWER:
@@ -617,54 +725,9 @@ winMultiWindowWMProc (void *pArg)
 #if CYGMULTIWINDOW_DEBUG
      ErrorF ("\tWM_WM_MAP\n");
 #endif
-	  {
-	    /*XWindowAttributes		attr;*/
-	    char			*pszName;
-#if 0
-	    XWMHints			*pHints;
-#endif
-
-	    /* Get the window attributes */
-	    /*
-	    XGetWindowAttributes (pWMInfo->pDisplay,
-				  pNode->msg.iWindow,
-				  &attr);
-             */
-	    if (!winGetOverrideRedirectPriv(pNode->msg.pWin))
-	      {
-#ifdef NXWIN_MULTIWINDOW
-#ifdef NXWIN_MULTIWINDOW_DEBUG
-		if(nxwinMultiwindow)
-	             ErrorF("winMultiWindowWMProc: LOCK before GetWindowName\n");
-		else
-		     ErrorF("winMultiWindowWMProc: before GetWindowName\n");	
-#endif
-                if(nxwinMultiwindow && pthread_mutex_lock(&nxwinMultiwindowMutex))
-	                     ErrorF("winMultiWindowWMProc: pthread_mutex_lock failed\n");
-#endif
-		/* Set the Windows window name */
-		GetWindowName(pNode->msg.pWin, &pszName);
-#ifdef NXWIN_MULTIWINDOW
-#ifdef NXWIN_MULTIWINDOW_DEBUG
-		if(nxwinMultiwindow)
-	             ErrorF("winMultiWindowWMProc: UNLOCK after GetWindowName\n");
-		else
-		     ErrorF("winMultiWindowWMProc: after GetWindowName\n");
-#endif
-                if(nxwinMultiwindow && pthread_mutex_unlock(&nxwinMultiwindowMutex) != 0)
-	             ErrorF("winMultiWindowWMProc: !!! pthread_mutex_unlock failed\n");
-#endif
-		if(!pszName){
-		     ErrorF("winMultiWindowWMProc: GetWindowName failed\n");	
-		     break;
-		}
-		SetWindowText (pNode->msg.hwndWindow, pszName);
-#ifdef NXWIN_MULTIWINDOW_DEBUG
-		ErrorF("winMultiWindowWMProc: Insert here LoadIcon\n");
-#endif
-		free (pszName);
-	      }
-	  }
+/* ------------------ My crooked additions ------------------------------------------- */
+	  winSetWinName (pNode);
+/* -----------End of my crooked additions ------------------------------------------- */
      break;
 
    case WM_WM_UNMAP:
@@ -904,6 +967,9 @@ winMultiWindowWMProc (void *pArg)
      if(nxwinMultiwindow && pthread_mutex_unlock(&nxwinMultiwindowMutex))
                ErrorF("!!! pthread_mutex_unlock failed\n");
 #endif
+/* ------------------ My crooked additions ------------------------------------------- */
+	  winSetWinName (pNode);
+/* -----------End of my crooked additions ------------------------------------------- */
      break;
 #if 0
    case WM_WM_X_EVENT: