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
|
||||||
|
@ -439,37 +441,25 @@ GetWindowName (Display *pDisplay, Window iWin, char **ppName)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
if (Xutf8TextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
|
||||||
if (xtpName.encoding == XA_STRING)
|
|
||||||
{
|
{
|
||||||
/* */
|
iLen = 0;
|
||||||
if (xtpName.value)
|
for (i = 0; i < nNum; i++) iLen += strlen(ppList[i]);
|
||||||
{
|
pszReturnData = (char *) malloc (iLen + 1);
|
||||||
int size = xtpName.nitems * (xtpName.format >> 3);
|
pszReturnData[0] = '\0';
|
||||||
*ppName = malloc(size + 1);
|
for (i = 0; i < nNum; i++) strcat (pszReturnData, ppList[i]);
|
||||||
strncpy(*ppName, xtpName.value, size);
|
if (ppList) XFreeStringList (ppList);
|
||||||
(*ppName)[size] = 0;
|
|
||||||
XFree (xtpName.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CYGMULTIWINDOW_DEBUG
|
|
||||||
ErrorF ("GetWindowName - XA_STRING %s\n", *ppName);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (XmbTextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
|
pszReturnData = (char *) malloc (1);
|
||||||
{
|
pszReturnData[0] = '\0';
|
||||||
*ppName = strdup (*ppList);
|
|
||||||
XFreeStringList (ppList);
|
|
||||||
}
|
}
|
||||||
|
iLen = MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, NULL, 0);
|
||||||
|
*ppName = (wchar_t*)malloc(sizeof(wchar_t)*(iLen + 1));
|
||||||
|
MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, *ppName, iLen);
|
||||||
XFree (xtpName.value);
|
XFree (xtpName.value);
|
||||||
|
free (pszReturnData);
|
||||||
#if CYGMULTIWINDOW_DEBUG
|
|
||||||
ErrorF ("GetWindowName - %s %s\n",
|
|
||||||
XGetAtomName (pDisplay, xtpName.encoding), *ppName);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#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