Package: x2x
Version: 1.27-8
Severity: wishlist

x2x currently has a '-label' option which lets you specify the text that
goes inside the x2x window. However, it doesn't allow you to specify the
window title (ie the text displayed by your window manager).

I had a need for this feature, so I added it. (if you care, I was running
x2x to display on a Cygwin X server on a windows machine with a voice
recognition application which used the title of the window to identify
an application...)

Anyway, it's a trivial patch and it might be useful in other situations
so here it is; feel free to forward it upstream if x2x still has an
upstream...

NB: this patch fixes in passing a missing blank line in the manpage.

-- PMM

===begin patch===
diff -ur x2x-1.27/x2x.1 x2x-1.27-patched/x2x.1
--- x2x-1.27/x2x.1      2006-04-21 22:04:22.552039110 +0100
+++ x2x-1.27-patched/x2x.1      2006-04-21 22:13:32.963034144 +0100
@@ -155,7 +155,14 @@
 (remove the leading XK_).
 .TP
 .B \-label \fIlabel\fP
+.IP
+Override the label of the control window (useful when running over ssh).
+The label is the text displayed within the control window.
+.TP
+.B \-title \fItitle\fP
+.IP
 Override the title of the control window (useful when running over ssh).
+The title is usually displayed by the window manager.
 .IP 
 .SH AUTHOR
 David Chaiken
diff -ur x2x-1.27/x2x.c x2x-1.27-patched/x2x.c
--- x2x-1.27/x2x.c      2006-04-21 22:04:22.557038301 +0100
+++ x2x-1.27-patched/x2x.c      2006-02-24 19:45:34.986143344 +0000
@@ -221,6 +221,7 @@
 static char    *defaultFN   = "-*-times-bold-r-*-*-*-180-*-*-*-*-*-*";
 static char    *fontName    = "-*-times-bold-r-*-*-*-180-*-*-*-*-*-*";
 static char    *label       = NULL;
+static char    *title       = NULL;
 static char    *pingStr     = "PING"; /* atom for ping request */
 static char    *geomStr     = NULL;
 static Bool    waitDpy      = False;
@@ -370,6 +371,13 @@
 #ifdef DEBUG
       printf ("label = %s\n", label);
 #endif
+    } else if (!strcasecmp(argv[arg], "-title")) {
+      if (++arg >= argc) Usage();
+      title = argv[arg];
+
+#ifdef DEBUG
+      printf ("title = %s\n", title);
+#endif
     } else if (!strcasecmp(argv[arg], "-geometry")) {
       if (++arg >= argc) Usage();
       geomStr = argv[arg];
@@ -524,6 +532,7 @@
   printf("       -shadow <DISPLAY>\n");
   printf("       -sticky <sticky key>\n");
   printf("       -label <LABEL>\n");
+  printf("       -title <TITLE>\n");
   printf("       -buttonmap <button#> \"<keysym> ...\"\n");
   exit(4);
 
@@ -760,10 +769,14 @@
   xsh->flags       = (PPosition|PBaseSize|PWinGravity);
   XSetWMNormalHints(fromDpy, trigger, xsh);
 
-  windowName = (char *)malloc(strlen(programStr) + strlen(toDpyName) + 2);
-  strcpy(windowName, programStr);
-  strcat(windowName, " ");
-  strcat(windowName, toDpyName);
+  if (title) {
+    windowName = title;
+  } else {
+    windowName = (char *)malloc(strlen(programStr) + strlen(toDpyName) + 2);
+    strcpy(windowName, programStr);
+    strcat(windowName, " ");
+    strcat(windowName, toDpyName);
+  }
   XStoreName(fromDpy, trigger, windowName);
   XSetIconName(fromDpy, trigger, windowName);
 
@@ -793,7 +806,8 @@
   }
 
   XFree((char *) xsh);
-  free(windowName);
+  if (windowName != title)
+    free(windowName);
 
   /* conversion stuff */
   pDpyInfo->toScreen = (doEdge == EDGE_WEST || doEdge == EDGE_NORTH)
===endit===


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to