summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2011-11-07 20:54:10 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2014-03-27 21:31:16 +0000
commit91aa32fcd49f558a78bb8fc17155da177ca09801 (patch)
tree3740f38c0d9e1b92b2a4185e10ae6ccfd79b768b
parente695be5854917eb6400efe2e6265c1f568a3a175 (diff)
Enhance -hostintitle
- Add '@<WM_CLIENT_MACHINE>' to window name when it's useful to do so - Don't add host if it's already in the title - Default to enabled - Provide -nohostintitle to disable if neeeded
-rw-r--r--hw/xwin/InitOutput.c2
-rw-r--r--hw/xwin/man/XWin.man3
-rw-r--r--hw/xwin/winglobals.c2
-rw-r--r--hw/xwin/winmultiwindowwm.c13
-rw-r--r--hw/xwin/winprocarg.c5
5 files changed, 16 insertions, 9 deletions
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index f187c88c2..7ca818c70 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -772,7 +772,7 @@ winUseMsg(void)
ErrorF("-fullscreen\n" "\tRun the server in fullscreen mode.\n");
- ErrorF("-hostintitle\n"
+ ErrorF("-[no]hostintitle\n"
"\tIn multiwindow mode, add remote host names to window titles.\n");
ErrorF("-ignoreinput\n" "\tIgnore keyboard and mouse input.\n");
diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man
index 9a046d930..738818ea5 100644
--- a/hw/xwin/man/XWin.man
+++ b/hw/xwin/man/XWin.man
@@ -170,9 +170,10 @@ on its own is equivalent to \fB\-resize=randr\fP
.SH OPTIONS FOR MULTIWINDOW MODE
.TP 8
-.B \-hostintitle
+.B \-[no]hostintitle
Add the host name to the window title for X applications which are running
on remote hosts, when that information is available and it's useful to do so.
+The default is enabled.
.SH OPTIONS CONTROLLING WINDOWS INTEGRATION
.TP 8
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index ad82b83f6..1382c8972 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -78,7 +78,7 @@ Bool g_fNoHelpMessageBox = FALSE;
Bool g_fSoftwareCursor = FALSE;
Bool g_fSilentDupError = FALSE;
Bool g_fNativeGl = TRUE;
-Bool g_fHostInTitle = FALSE;
+Bool g_fHostInTitle = TRUE;
pthread_mutex_t g_pmTerminating = PTHREAD_MUTEX_INITIALIZER;
#ifdef XWIN_CLIPBOARD
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 262f53830..75c9d6cc2 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -488,19 +488,20 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName)
/*
If we have a client machine name
- and it's not the local host 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)) {
- /* ... add ' (on <clientmachine>)' to end of window name */
+ strcmp(hostname, pszClientMachine) &&
+ (strstr(pszWindowName, pszClientMachine) == 0)) {
+ /* ... add '@<clientmachine>' to end of window name */
*ppWindowName =
malloc(strlen(pszWindowName) +
- strlen(pszClientMachine) + 7);
+ strlen(pszClientMachine) + 2);
strcpy(*ppWindowName, pszWindowName);
- strcat(*ppWindowName, " (on ");
+ strcat(*ppWindowName, "@");
strcat(*ppWindowName, pszClientMachine);
- strcat(*ppWindowName, ")");
free(pszWindowName);
free(pszClientMachine);
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index bb6efc3da..bff3fead9 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -1112,6 +1112,11 @@ ddxProcessArgument(int argc, char *argv[], int i)
return 1;
}
+ if (IS_OPTION("-nohostintitle")) {
+ g_fHostInTitle = FALSE;
+ return 1;
+ }
+
return 0;
}