Xming: Always update the Windows title Unicode (wide-character) in -multiwindow mode.
Apply the Windows title wide-character in -multiwindow mode. Windows should now display correct client X Window titles for locales with wide characters. Copyright (C) Colin Harrison 2005-2008 http://www.straightrunning.com/XmingNotes/ http://sourceforge.net/projects/xming/ Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
This commit is contained in:
		
							parent
							
								
									db687f718f
								
							
						
					
					
						commit
						bad41bdfd4
					
				| 
						 | 
					@ -153,7 +153,7 @@ static Bool
 | 
				
			||||||
InitQueue (WMMsgQueuePtr pQueue);
 | 
					InitQueue (WMMsgQueuePtr pQueue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
GetWindowName (Display * pDpy, Window iWin, char **ppName);
 | 
					GetWindowName (Display * pDpy, Window iWin, wchar_t **ppName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData);
 | 
					SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData);
 | 
				
			||||||
| 
						 | 
					@ -416,10 +416,12 @@ InitQueue (WMMsgQueuePtr pQueue)
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
GetWindowName (Display *pDisplay, Window iWin, char **ppName)
 | 
					GetWindowName (Display *pDisplay, Window iWin, wchar_t **ppName)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  int			nResult, nNum;
 | 
					  int			nResult, nNum;
 | 
				
			||||||
  char			**ppList;
 | 
					  char			**ppList;
 | 
				
			||||||
 | 
					  char			*pszReturnData;
 | 
				
			||||||
 | 
					  int			iLen, i;
 | 
				
			||||||
  XTextProperty		xtpName;
 | 
					  XTextProperty		xtpName;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
#if CYGMULTIWINDOW_DEBUG
 | 
					#if CYGMULTIWINDOW_DEBUG
 | 
				
			||||||
| 
						 | 
					@ -438,38 +440,26 @@ GetWindowName (Display *pDisplay, Window iWin, char **ppName)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /* */
 | 
					 | 
				
			||||||
  if (xtpName.encoding == XA_STRING)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      /* */
 | 
					 | 
				
			||||||
      if (xtpName.value)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
	  int size = xtpName.nitems * (xtpName.format >> 3);
 | 
					 | 
				
			||||||
	  *ppName = malloc(size + 1);
 | 
					 | 
				
			||||||
	  strncpy(*ppName, xtpName.value, size);
 | 
					 | 
				
			||||||
	  (*ppName)[size] = 0;
 | 
					 | 
				
			||||||
	  XFree (xtpName.value);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CYGMULTIWINDOW_DEBUG
 | 
					   if (Xutf8TextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
 | 
				
			||||||
      ErrorF ("GetWindowName - XA_STRING %s\n", *ppName);
 | 
					   {
 | 
				
			||||||
#endif
 | 
					 	iLen = 0;
 | 
				
			||||||
    }
 | 
					 	for (i = 0; i < nNum; i++) iLen += strlen(ppList[i]);
 | 
				
			||||||
  else
 | 
					 	pszReturnData = (char *) malloc (iLen + 1);
 | 
				
			||||||
    {
 | 
					 	pszReturnData[0] = '\0';
 | 
				
			||||||
      if (XmbTextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
 | 
					 	for (i = 0; i < nNum; i++) strcat (pszReturnData, ppList[i]);
 | 
				
			||||||
	{
 | 
					 	if (ppList) XFreeStringList (ppList);
 | 
				
			||||||
	  *ppName = strdup (*ppList);
 | 
					   }
 | 
				
			||||||
	  XFreeStringList (ppList);
 | 
					   else
 | 
				
			||||||
	}
 | 
					   {
 | 
				
			||||||
      XFree (xtpName.value);
 | 
					 	pszReturnData = (char *) malloc (1);
 | 
				
			||||||
 | 
					 	pszReturnData[0] = '\0';
 | 
				
			||||||
#if CYGMULTIWINDOW_DEBUG
 | 
					   }
 | 
				
			||||||
      ErrorF ("GetWindowName - %s %s\n",
 | 
					   iLen = MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, NULL, 0);
 | 
				
			||||||
	      XGetAtomName (pDisplay, xtpName.encoding), *ppName);
 | 
					   *ppName = (wchar_t*)malloc(sizeof(wchar_t)*(iLen + 1));
 | 
				
			||||||
#endif
 | 
					   MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, *ppName, iLen);
 | 
				
			||||||
    }
 | 
					   XFree (xtpName.value);
 | 
				
			||||||
 | 
					   free (pszReturnData);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CYGMULTIWINDOW_DEBUG
 | 
					#if CYGMULTIWINDOW_DEBUG
 | 
				
			||||||
  ErrorF ("GetWindowName - Returning\n");
 | 
					  ErrorF ("GetWindowName - Returning\n");
 | 
				
			||||||
| 
						 | 
					@ -506,7 +496,7 @@ SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData)
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
UpdateName (WMInfoPtr pWMInfo, Window iWindow)
 | 
					UpdateName (WMInfoPtr pWMInfo, Window iWindow)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  char			*pszName;
 | 
					  wchar_t		*pszName;
 | 
				
			||||||
  Atom			atmType;
 | 
					  Atom			atmType;
 | 
				
			||||||
  int			fmtRet;
 | 
					  int			fmtRet;
 | 
				
			||||||
  unsigned long		items, remain;
 | 
					  unsigned long		items, remain;
 | 
				
			||||||
| 
						 | 
					@ -550,7 +540,7 @@ UpdateName (WMInfoPtr pWMInfo, Window iWindow)
 | 
				
			||||||
			    &attr);
 | 
								    &attr);
 | 
				
			||||||
      if (!attr.override_redirect)
 | 
					      if (!attr.override_redirect)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	  SetWindowText (hWnd, pszName);
 | 
						  SetWindowTextW (hWnd, pszName);
 | 
				
			||||||
	  winUpdateIcon (iWindow);
 | 
						  winUpdateIcon (iWindow);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue