diff options
author | marha <marha@users.sourceforge.net> | 2014-03-25 17:56:10 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-03-25 17:56:10 +0100 |
commit | ba6115f56f066621a20fa545ddd67721afd35523 (patch) | |
tree | 418b724d4f318d24dc8e5183e6b252922f85f149 /xorg-server/hw/xwin/winmultiwindowwm.c | |
parent | eb71c0f23999d1cc156e1821d73634ec79621fc2 (diff) | |
parent | e0927d908a12c9c140458c355b29b884a7705f2d (diff) | |
download | vcxsrv-ba6115f56f066621a20fa545ddd67721afd35523.tar.gz vcxsrv-ba6115f56f066621a20fa545ddd67721afd35523.tar.bz2 vcxsrv-ba6115f56f066621a20fa545ddd67721afd35523.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/hw/xwin/InitInput.c
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/winglobals.c
xorg-server/hw/xwin/winglobals.h
xorg-server/hw/xwin/winmsgwindow.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
Diffstat (limited to 'xorg-server/hw/xwin/winmultiwindowwm.c')
-rw-r--r-- | xorg-server/hw/xwin/winmultiwindowwm.c | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 8518147a6..0fd63312e 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -64,6 +64,7 @@ typedef int pid_t; #include "winmsg.h" #include "windowstr.h" #include "winmultiwindowclass.h" +#include "winglobals.h" #ifdef XWIN_MULTIWINDOWEXTWM #define _WINDOWSWM_SERVER_ @@ -74,6 +75,10 @@ typedef int pid_t; #define WINDOWSWM_NATIVE_HWND "_WINDOWSWM_NATIVE_HWND" #endif +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif + extern void winDebug(const char *format, ...); extern void winReshapeMultiWindow(WindowPtr pWin); extern void winUpdateRgnMultiWindow(WindowPtr pWin); @@ -397,7 +402,10 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName) { int nResult; XTextProperty xtpWindowName; + XTextProperty xtpClientMachine; char *pszWindowName; + char *pszClientMachine; + char hostname[HOST_NAME_MAX + 1]; winDebug ("GetWindowName\n"); @@ -413,6 +421,41 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName) pszWindowName = Xutf8TextPropertyToString(pDisplay, &xtpWindowName); XFree(xtpWindowName.value); + + if (g_fHostInTitle) { + /* Try to get client machine name */ + nResult = XGetWMClientMachine(pDisplay, iWin, &xtpClientMachine); + if (nResult && xtpClientMachine.value && xtpClientMachine.nitems) { + pszClientMachine = + Xutf8TextPropertyToString(pDisplay, &xtpClientMachine); + XFree(xtpClientMachine.value); + + /* + If we have a client machine name + and it's not the local host name + and it's not already in the window title... + */ + if (strlen(pszClientMachine) && + !gethostname(hostname, HOST_NAME_MAX + 1) && + strcmp(hostname, pszClientMachine) && + (strstr(pszWindowName, pszClientMachine) == 0)) { + /* ... add '@<clientmachine>' to end of window name */ + *ppWindowName = + malloc(strlen(pszWindowName) + + strlen(pszClientMachine) + 2); + strcpy(*ppWindowName, pszWindowName); + strcat(*ppWindowName, "@"); + strcat(*ppWindowName, pszClientMachine); + + free(pszWindowName); + free(pszClientMachine); + + return; + } + } + } + + /* otherwise just return the window name */ *ppWindowName = pszWindowName; } @@ -1576,10 +1619,10 @@ winDeinitMultiWindowWM(void) } /* Windows window styles */ -#define HINT_NOFRAME (1l<<0) +#define HINT_NOFRAME (1L<<0) #define HINT_BORDER (1L<<1) -#define HINT_SIZEBOX (1l<<2) -#define HINT_CAPTION (1l<<3) +#define HINT_SIZEBOX (1L<<2) +#define HINT_CAPTION (1L<<3) #define HINT_NOMAXIMIZE (1L<<4) #define HINT_NOMINIMIZE (1L<<5) #define HINT_NOSYSMENU (1L<<6) |