I build an application which takes between 1 and 12 hours to
build, depending on how fast the build platform is.  I use mrxvt
to make windows on 30 or so unix boxes, by which I mean Solaris,
AIX, Irix, several linux flavors.  Today I was in broadcast mode
when I thought I was not, and I succeeded in deleting my build
trees on all thirty platforms, and I had to start again.  This
made me angry enough (at myself) to try to fix this problem.

Some one recently sent a patch which put a string "[B]" in each
window title.  This apparently was not put into the mrxvt tree,
because people thought it took up too much tab space.  So, I
applied this patch to the svn head, but changed it so that instead
of changing the window title, it changed one of the buttons.  I
made it change the term_xpm button.  I then created an xpm file
with the Gimp that looks different from the existing term_xpm button.
I also created an xbm file, but I have not tried it, and I
may not actually have hooked it up properly.

The artistry of these buttons is really lacking.  Somebody with
more graphical skills than I have should really think about
what the right picture should be.  But simply replacing the
files broadcast_term.xpm and broadcast_term.xbm with better ones
should do the trick.

I am attaching a patch file.  The patch file was created by:
  1.) checking out the svn head as of this evening (2007-10-31T0100)
  2.) Making my changes.
  3.) Running "svn diff -x -u" in the mrxvt05b directory.
I did this several times, on different linux platforms, so step
(2) was sometimes applying the patch.  I can't seem to get the
patch to apply cleanly.  It seems that patch can't find the
files, though when I type the name of the file which patch
tells me the diff contains the patch applies.  Maybe someone
who understands this bit of release engineering knows the right
incantation.

I am also attaching the two icon files - broadcast_term.xpm and
broadcast_term.xbm.  When broadcast mode is entered, these are
the icons displayed to create a new terminal - the first icon in
the list of buttons.  This is not exactly right, but it's close
enough, and it takes up no extra screen real estate.

Ĝuu, as we say in Esperantoland.
Index: src/tabbar.c
===================================================================
--- src/tabbar.c	(revision 254)
+++ src/tabbar.c	(working copy)
@@ -37,6 +37,7 @@
 #include "left.xpm"
 #include "close_term_d.xpm"
 #include "term_d.xpm"
+#include "broadcast_term.xpm"
 #include "right_d.xpm"
 #include "left_d.xpm"
 
@@ -46,7 +47,7 @@
 #include "term.xbm"
 #include "right.xbm"
 #include "left.xbm"
-
+#include "broadcast_term.xbm"
 #endif /* HAVE_LIBXPM */
 
 
@@ -58,6 +59,7 @@
 # define    FWIDTH  fwidth
 #endif
 
+#define USE_ICON_FOR_BROADCAST
 /* border between the tabs */
 #define TAB_BORDER	((int) 1)
 /* margin around the text of the tab */
@@ -1543,6 +1545,18 @@
      */
     if (NULL != n_title)
     {
+#if   !defined(USE_ICON_FOR_BROADCAST)
+    if (ISSET_OPTION(r, Opt2_broadcast))
+    	{ /* with broadcast mode [B] is added before tab title */
+	    char new_title[MAX_TAB_TXT];
+		
+	    strcpy(new_title, "[B]");
+	    strncat(new_title, n_title, MAX_TAB_TXT-4);
+		
+	    free(n_title);
+	    n_title = STRNDUP (new_title, MAX_TAB_TXT);
+	}
+#endif  /* !defined(USE_ICON_FOR_BROADCAST) */
 	rxvt_free (PVTS(r, page)->tab_title);
 	PVTS(r, page)->tab_title = n_title;
 
@@ -1946,17 +1960,14 @@
 
 
 /*
- * Create the tab bar window
+ * Create the pixmaps.
  */
 /* EXTPROTO */
-void
-rxvt_tabbar_create (rxvt_t* r)
+static void
+rxvt_tabbar_create_buttonic_pictures(rxvt_t* r)
 {
-    XColor	    color, bgcolor;
-    XGCValues	    gcvalue;
-    unsigned long   gcmask;
-    register int    i;
-    int		    sx, sy;
+    register int i;
+
 #ifdef HAVE_LIBXPM
     XpmAttributes   xpm_attr;
     /*
@@ -1964,9 +1975,48 @@
      * background color so that the buttons look transparent.
      */
     XpmColorSymbol  xpm_color_sym = {"background", NULL, 0};
+    xpm_color_sym.pixel = r->tabBar.bg;
+    xpm_attr.colorsymbols = &xpm_color_sym;
+    xpm_attr.numsymbols = 1;
+    xpm_attr.visual = XVISUAL;
+    xpm_attr.colormap = XCMAP;
+    xpm_attr.depth = XDEPTH;
+    xpm_attr.closeness = 65535;
+    xpm_attr.valuemask = XpmVisual | XpmColormap | XpmDepth |
+	XpmCloseness | XpmReturnPixels | XpmColorSymbols;
+
 #endif
+    for (i = 0; i < NB_XPM; i++)
+    {
+#ifdef HAVE_LIBXPM
+    	XpmCreatePixmapFromData (r->Xdisplay, r->tabBar.win,
+	    xpm_name[i], &img_e[i], &img_emask[i], &xpm_attr);
+	assert (IS_PIXMAP(img_e[i]));
+	XpmCreatePixmapFromData (r->Xdisplay, r->tabBar.win,
+	    xpm_d_name[i], &img_d[i], &img_dmask[i], &xpm_attr);
+	assert (IS_PIXMAP(img_d[i]));
+#else
+	img[i] = XCreatePixmapFromBitmapData (r->Xdisplay,
+	    r->tabBar.win, (char *) xbm_name[i], BTN_WIDTH, BTN_HEIGHT,
+	    r->tabBar.fg, r->tabBar.bg, XDEPTH);
+	assert (IS_PIXMAP(img[i]));
+#endif
+    }
+}
 
+/*
+ * Create the tab bar window
+ */
+/* EXTPROTO */
+void
+rxvt_tabbar_create (rxvt_t* r)
+{
+    XColor	    color, bgcolor;
+    XGCValues	    gcvalue;
+    unsigned long   gcmask;
+    int		    sx, sy;
 
+
     init_tabbar (r);
     rxvt_dbgmsg ((DBG_VERBOSE, DBG_TABBAR,"Creating tabbar\n"));
 
@@ -2202,68 +2252,20 @@
     XSetFont (r->Xdisplay, r->tabBar.gc, r->TermWin.font->fid);
 
 
-#ifdef HAVE_LIBXPM
-    xpm_color_sym.pixel = r->tabBar.bg;
-    xpm_attr.colorsymbols = &xpm_color_sym;
-    xpm_attr.numsymbols = 1;
-    xpm_attr.visual = XVISUAL;
-    xpm_attr.colormap = XCMAP;
-    xpm_attr.depth = XDEPTH;
-    xpm_attr.closeness = 65535;
-    xpm_attr.valuemask = XpmVisual | XpmColormap | XpmDepth |
-	XpmCloseness | XpmReturnPixels | XpmColorSymbols;
-#endif
-
     /* now, create the buttons */
-    for (i = 0; i < NB_XPM; i++)
-    {
-#ifdef HAVE_LIBXPM
-	XpmCreatePixmapFromData (r->Xdisplay, r->tabBar.win,
-	    xpm_name[i], &img_e[i], &img_emask[i], &xpm_attr);
-	assert (IS_PIXMAP(img_e[i]));
-	XpmCreatePixmapFromData (r->Xdisplay, r->tabBar.win,
-	    xpm_d_name[i], &img_d[i], &img_dmask[i], &xpm_attr);
-	assert (IS_PIXMAP(img_d[i]));
-#else
-	img[i] = XCreatePixmapFromBitmapData (r->Xdisplay,
-	    r->tabBar.win, (char *) xbm_name[i], BTN_WIDTH, BTN_HEIGHT,
-	    r->tabBar.fg, r->tabBar.bg, XDEPTH);
-	assert (IS_PIXMAP(img[i]));
-#endif
-    }
+    rxvt_tabbar_create_buttonic_pictures(r);
 
     rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR, "TXT_XOFF=%d, TXT_YOFF=%d, ATAB_EXTRA=%d, TAB_RADIUS=%d\n", TXT_XOFF, TXT_YOFF, ATAB_EXTRA, TAB_RADIUS));
 }
 
 
 /*
- * Create the tab bar window
+ * Deallocate the pixmaps or bitmaps.
  */
-/* EXTPROTO */
-void
-rxvt_tabbar_clean_exit (rxvt_t* r)
+static void
+rxvt_tabbar_deallocate_buttonic_pictures(rxvt_t *r)
 {
-    register int    i;
-
-
-    UNSET_WIN(r->tabBar.win);	/* destroyed by XDestroySubwindows */
-
-    /* free resource strings */
-    if (r->tabBar.rsfg)
-	rxvt_free ((void*) r->h->rs[Rs_tabfg]);
-    if (r->tabBar.rsbg)
-	rxvt_free ((void*) r->h->rs[Rs_tabbg]);
-    if (r->tabBar.rsifg)
-	rxvt_free ((void*) r->h->rs[Rs_itabfg]);
-    if (r->tabBar.rsibg)
-	rxvt_free ((void*) r->h->rs[Rs_itabbg]);
-
-    if (IS_GC(r->tabBar.gc))
-    {
-	XFreeGC (r->Xdisplay, r->tabBar.gc);
-	UNSET_GC(r->tabBar.gc);
-    }
-
+    int i;
     for (i = 0; i < NB_XPM; i ++)
     {
 #ifdef HAVE_LIBXPM
@@ -2295,7 +2297,35 @@
     }	/* for */
 }
 
+/*
+ * Create the tab bar window
+ */
+/* EXTPROTO */
+void
+rxvt_tabbar_clean_exit (rxvt_t* r)
+{
+    UNSET_WIN(r->tabBar.win);	/* destroyed by XDestroySubwindows */
 
+    /* free resource strings */
+    if (r->tabBar.rsfg)
+	rxvt_free ((void*) r->h->rs[Rs_tabfg]);
+    if (r->tabBar.rsbg)
+	rxvt_free ((void*) r->h->rs[Rs_tabbg]);
+    if (r->tabBar.rsifg)
+	rxvt_free ((void*) r->h->rs[Rs_itabfg]);
+    if (r->tabBar.rsibg)
+	rxvt_free ((void*) r->h->rs[Rs_itabbg]);
+
+    if (IS_GC(r->tabBar.gc))
+    {
+	XFreeGC (r->Xdisplay, r->tabBar.gc);
+	UNSET_GC(r->tabBar.gc);
+    }
+
+    rxvt_tabbar_deallocate_buttonic_pictures(r);
+}
+
+
 /* EXTPROTO */
 unsigned short
 rxvt_tabbar_height (rxvt_t* r)
@@ -2586,4 +2616,72 @@
 	rxvt_set_term_title( r, (unsigned char*) wintitle );
 }
 
+/*
+ * Update titles of all tabs to inform about broadcast state
+ */
+void
+rxvt_tabbar_update_broadcast (rxvt_t* r)
+{
+#if   defined(USE_ICON_FOR_BROADCAST)
+        rxvt_tabbar_deallocate_buttonic_pictures(r);
+#ifdef  HAVE_LIBXPM
+        if (ISSET_OPTION(r, Opt2_broadcast))
+          xpm_name[XPM_TERM] = broadcast_term_xpm;
+        else
+          xpm_name[XPM_TERM] = term_xpm;
+#else
+        if (ISSET_OPTION(r, Opt2_broadcast))
+
+          xbm_name[XPM_TERM] = broadcast_term_xbm;
+        else
+          xbm_name[XPM_TERM] = term_xbm;
+#endif
+        rxvt_tabbar_create_buttonic_pictures(r);
+        rxvt_tabbar_draw_buttons(r);
+#else /* defined(USE_ICON_FOR_BROADCAST) */
+	int page = 0;
+
+	for ( page = 0 ; page <= LTAB(r) ; page++ )
+	{
+      if (ISSET_OPTION(r, Opt2_broadcast))
+    	        { // add [B] to a title
+			char new_title[MAX_TAB_TXT];
+			char * old_title;
+			char * n_title;
+		
+			old_title = PVTS(r, page)->tab_title;
+
+			strcpy(new_title, "[B]");
+			strncat(new_title, old_title, MAX_TAB_TXT-4);
+
+			free (PVTS(r, page)->tab_title);
+			n_title = STRNDUP (new_title, MAX_TAB_TXT);
+
+			PVTS(r, page)->tab_title = n_title;
+			PVTS(r, page)->tab_width = rxvt_tab_width (r, n_title);
+		}
+		else
+		{ // remove [B] from a title
+			char * old_title;
+			char * n_title;
+			
+			old_title = PVTS(r, page)->tab_title;
+			n_title = STRNDUP (old_title+3, MAX_TAB_TXT);
+			free (PVTS(r, page)->tab_title);
+
+			PVTS(r, page)->tab_title = n_title;
+			PVTS(r, page)->tab_width = rxvt_tab_width (r, n_title);
+		}
+		
+		
+p    		if (page >= FVTAB(r) && page <= LVTAB(r))
+		{
+			/* adjust visible tabs */
+			rxvt_tabbar_set_visible_tabs (r, True);
+			refresh_tabbar_tab(r, page);
+		}
+	}
+#endif  /* defined(USE_ICON_FOR_BROADCAST) */
+}
+
 /*----------------------- end-of-file (C source) -----------------------*/
Index: src/macros.c
===================================================================
--- src/macros.c	(revision 254)
+++ src/macros.c	(working copy)
@@ -1079,6 +1079,7 @@
 	    }
 	    else
 		TOGGLE_OPTION(r, Opt2_broadcast);
+            rxvt_tabbar_update_broadcast(r);
 	    break;
 
 	case MacroFnToggleHold:
Index: src/protos.h
===================================================================
--- src/protos.h	(revision 254)
+++ src/protos.h	(working copy)
@@ -456,6 +456,7 @@
 void             rxvt_tabbar_highlight_tab      __PROTO((rxvt_t*, short, Bool));
 void             rxvt_tabbar_move_tab           __PROTO((rxvt_t*, short));
 void		 sync_tab_title		        __PROTO((rxvt_t*, int));
+void		 rxvt_tabbar_update_broadcast	__PROTO((rxvt_t*));
 /* End prototypes of tabbar.c */
 
 /* Begin prototypes of session.c */
Index: configure.ac
===================================================================
--- configure.ac	(revision 254)
+++ configure.ac	(working copy)
@@ -174,7 +174,7 @@
     [support_everything=no]
 )
 if test "x$support_everything" = "xyes"; then
-    support_debug=yes
+    support_debug=no
     support_ourstrings=no
     support_frills=yes
     support_keepscrolling=yes

<<inline: broadcast_term.xbm>>

<<inline: broadcast_term.xpm>>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Materm-devel mailing list
Materm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/materm-devel
mrxvt home page: http://materm.sourceforge.net

Reply via email to