Hi All,
        Here's a patch to make FvwmButtons understand this:

FvwmCommand "SendToModule FvwmButtons Title 5 You have Mail!"

Buttons are numbered from 0 and are in the order in your config file (containers don't count). It only works with buttons that have a title in the config file (could be " ") and I haven't tested it with anything other than a simple button (just a title, no icon or swallows).

I've stuffed the new code into FvwmButtons.c which is probably the wrong place.

Cheers,
Tim.

PS I think I can get rid of all my swallowed (non-fvwm) apps except xload with this.
Index: modules/FvwmButtons/FvwmButtons.c
===================================================================
RCS file: /u/phippst/share/cvsroot/fvwm/modules/FvwmButtons/FvwmButtons.c,v
retrieving revision 1.18
diff -u -r1.18 FvwmButtons.c
--- modules/FvwmButtons/FvwmButtons.c   2002/02/01 14:28:11     1.18
+++ modules/FvwmButtons/FvwmButtons.c   2002/02/01 16:01:53
@@ -110,6 +110,7 @@
 void process_message(unsigned long type,unsigned long *body);
 extern void send_clientmessage (Display *disp, Window w, Atom a,
                                Time timestamp);
+void parse_message_line(char *line);
 void CheckForHangon(unsigned long*);
 static Window GetRealGeometry(
   Display*,Window,int*,int*,unsigned int*,unsigned int*, unsigned int*,
@@ -936,7 +937,7 @@
 
   SetMessageMask(fd, M_NEW_DESK | M_END_WINDOWLIST | M_MAP | M_WINDOW_NAME
                 | M_RES_CLASS | M_CONFIG_INFO | M_END_CONFIG_INFO | M_RES_NAME
-                | M_SENDCONFIG | M_ADD_WINDOW | M_CONFIGURE_WINDOW);
+                | M_SENDCONFIG | M_ADD_WINDOW | M_CONFIGURE_WINDOW | M_STRING);
   SetMessageMask(fd, MX_PROPERTY_CHANGE);
 
   /* request a window list, since this triggers a response which
@@ -2618,6 +2619,9 @@
       swallowed = body[1];
     }
     break;
+  case M_STRING:
+    parse_message_line((char *)&body[3]);
+    break;
   default:
     break;
   }
@@ -3076,5 +3080,54 @@
       }
       break;
     }
+  }
+}
+
+/* SendToModule options */
+static void parse_title(char *line)
+{
+  int n, count, i;
+  button_info *b, *ub = UberButton;
+
+  /* find out which button */
+  if (GetIntegerArguments(line, &line, &n, 1) != 1)
+    return;
+  if (n < 0)
+  {
+    fprintf(stderr, "%s: button number must not be negative\n", MyName);
+    return;
+  }
+  i = count = -1;
+  /* find the button */
+  while (NextButton(&ub, &b, &i, 0)) {
+    if (++count == n)
+      break;
+  }
+  if (count != n) {
+    fprintf(stderr, "%s: button number %d not found\n", MyName, n);
+    return;
+  }
+  if (b) {
+    if (!b->flags & b_Title) {
+      fprintf(stderr, "%s: cannot create a title, only change one\n", MyName);
+      return;
+    }
+    free(b->title);
+    CopyString(&b->title, line);
+    RedrawButton(b, 2);
+  }
+  return;  
+}
+
+static char *message_options[] = {"Title", NULL};
+
+void parse_message_line(char *line)
+{
+  char *rest;
+
+  switch(GetTokenIndex(line, message_options, -1, &rest)) {
+  case 0:
+    parse_title(rest);
+    break;
   }
 }

Reply via email to