X11 window title fix

This commit is contained in:
Armin Novak 2017-10-31 18:00:15 +01:00
parent 5416c2724b
commit afb08c9dfb
2 changed files with 17 additions and 12 deletions

View File

@ -105,6 +105,16 @@ struct _PropMotifWmHints
};
typedef struct _PropMotifWmHints PropMotifWmHints;
static void xf_SetWindowTitleText(xfContext* xfc, Window window, const char* name)
{
const size_t i = strlen(name);
XStoreName(xfc->display, window, name);
Atom wm_Name = xfc->_NET_WM_NAME;
Atom utf8Str = xfc->UTF8_STRING;
XChangeProperty(xfc->display, window, wm_Name, utf8Str, 8,
PropModeReplace, (const unsigned char*)name, (int)i);
}
/**
* Post an event from the client to the X server
*/
@ -328,7 +338,7 @@ static void xf_SetWindowPID(xfContext* xfc, Window window, pid_t pid)
32, PropModeReplace, (BYTE*) &pid, 1);
}
static const char* get_shm_id()
static const char* get_shm_id(void)
{
static char shm_id[64];
sprintf_s(shm_id, sizeof(shm_id), "/com.freerdp.xfreerdp.tsmf_%016X",
@ -462,7 +472,7 @@ xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width,
settings->DesktopPosY);
}
XStoreName(xfc->display, window->handle, name);
xf_SetWindowTitleText(xfc, window->handle, name);
return window;
}
@ -576,17 +586,12 @@ void xf_SetWindowStyle(xfContext* xfc, xfAppWindow* appWindow, UINT32 style,
XA_ATOM, 32, PropModeReplace, (BYTE*) &window_type, 1);
}
void xf_SetWindowText(xfContext* xfc, xfAppWindow* appWindow, char* name)
void xf_SetWindowText(xfContext* xfc, xfAppWindow* appWindow, const char* name)
{
const size_t i = strlen(name);
XStoreName(xfc->display, appWindow->handle, name);
Atom wm_Name = xfc->_NET_WM_NAME;
Atom utf8Str = xfc->UTF8_STRING;
XChangeProperty(xfc->display, appWindow->handle, wm_Name, utf8Str, 8,
PropModeReplace, (unsigned char*)name, i);
xf_SetWindowTitleText(xfc, appWindow->handle, name);
}
void xf_FixWindowCoordinates(xfContext* xfc, int* x, int* y, int* width,
static void xf_FixWindowCoordinates(xfContext* xfc, int* x, int* y, int* width,
int* height)
{
int vscreen_width;
@ -615,7 +620,7 @@ void xf_FixWindowCoordinates(xfContext* xfc, int* x, int* y, int* width,
{
*height = vscreen_height;
}
if (*width < 1)
{
*width = 1;

View File

@ -158,7 +158,7 @@ BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property, int leng
void xf_SendClientEvent(xfContext* xfc, Window window, Atom atom, unsigned int numArgs, ...);
int xf_AppWindowInit(xfContext* xfc, xfAppWindow* appWindow);
void xf_SetWindowText(xfContext* xfc, xfAppWindow* appWindow, char* name);
void xf_SetWindowText(xfContext* xfc, xfAppWindow* appWindow, const char* name);
void xf_MoveWindow(xfContext* xfc, xfAppWindow* appWindow, int x, int y, int width, int height);
void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state);
//void xf_SetWindowIcon(xfContext* xfc, xfAppWindow* appWindow, rdpIcon* icon);