Subject: Patch to FvwmEvent to use hex

From: Tim Phipps <[email-masked]>
Date: Tue, 08 May 2001 14:34:54 +0100

Attached is a patch to make FvwmEvent pass the window-id in hex. The
reason is that Fvwm uses hex when it expands $w so this makes matching
$w with FvwmEvent strings simpler (I used to have to use PipeRead "bash
-c '(( $w = $0 )) && echo got_it'").

Low priority so after 2.4 probably.

Cheers,
Tim.

Index: modules/ChangeLog
===================================================================
RCS file: /u/phippst/cvsroot/fvwm/modules/ChangeLog,v
retrieving revision 1.5
diff -u -r1.5 ChangeLog
--- modules/ChangeLog	2001/05/08 10:54:17	1.5
+++ modules/ChangeLog	2001/05/08 13:25:57
@@ -1,3 +1,7 @@
+2001-05-08  Hippo
+
+	* FvwmEvent/FvwmEvent.[c1]: New config option *FvwmEventPassHexID
+
 2001-05-06  Dominik Vogt  <[email-masked]>
 
 	* FvwmButtons/draw.c (RedrawButton):
Index: modules/FvwmEvent/FvwmEvent.1
===================================================================
RCS file: /u/phippst/cvsroot/fvwm/modules/FvwmEvent/FvwmEvent.1,v
retrieving revision 1.1
diff -u -r1.1 FvwmEvent.1
--- modules/FvwmEvent/FvwmEvent.1	2001/05/08 10:48:02	1.1
+++ modules/FvwmEvent/FvwmEvent.1	2001/05/08 10:25:47
@@ -131,6 +131,9 @@
 of the command line. Most events will have the windowID of the window that the
 event refers to, new_desk will have the new desk number.
 
+.IP "*FvwmEventPassHexID"
+Similar to *FvwmEventPassID but the windowID is a hexadecimal number preceded
+by 0x.
 
 .IP "*FvwmEvent \fIwindow-manager-event action-or-filename\fP"
 Binds particular actions to window manager events.
Index: modules/FvwmEvent/FvwmEvent.c
===================================================================
RCS file: /u/phippst/cvsroot/fvwm/modules/FvwmEvent/FvwmEvent.c,v
retrieving revision 1.1
diff -u -r1.1 FvwmEvent.c
--- modules/FvwmEvent/FvwmEvent.c	2001/05/08 10:48:02	1.1
+++ modules/FvwmEvent/FvwmEvent.c	2001/05/08 11:44:32
@@ -127,6 +127,7 @@
         now,
         start_audio_delay = 0;
 Bool	PassID = False;	/* don't tag on the windowID by default */
+Bool	PassHex = False;
 Bool	audio_compat = False;
 char   *audio_play_dir = NULL;
 
@@ -396,6 +397,9 @@
 	    if(PassID && (event_table[event].action_arg != -1))
 	      sprintf(buf,"%s %s %ld", cmd_line, action_table[event],
 		      body[event_table[event].action_arg]);
+	    else if(PassHex && (event_table[event].action_arg != -1))
+	      sprintf(buf,"%s %s 0x%lx", cmd_line, action_table[event],
+		      body[event_table[event].action_arg]);
 	    else
 	      sprintf(buf,"%s %s", cmd_line, action_table[event]);
 	    INFO(buf);
@@ -420,6 +424,7 @@
   "Cmd",
   "Delay",
   "Dir",
+  "PassHexID",
   "PassID",
   "PlayCmd",
   "RplayHost",
@@ -475,7 +480,7 @@
 	switch (e - (char**)table)
 	{
 	case 0:	       /* Cmd */
-	case 4:
+	case 5:
 	  if (! audio_compat && e - (char**)table == 4) /* PlayCmd */
 	  {
 	    fprintf(stderr,
@@ -534,11 +539,17 @@
 	  break;
 
 	case 3:
+	  PassID = False;
+	  PassHex = True;
+	  break; /* PassHex */
+
+	case 4:
 	  PassID = True;
+	  PassHex = False;
 	  break; /* PassID */
 
 #ifdef HAVE_RPLAY
-	case 5:
+	case 6:
 	  if (token && (*token == '$'))		       /* RPlayHost */
 	  {			 /* Check for $HOSTDISPLAY */
 	    char *c1= (char *)getenv(token+1), *c2= host;
@@ -550,18 +561,18 @@
 	    strcpy(host, token);
 	  break;
 
-	case 6:
+	case 7:
 	  if (token)
 	    priority = atoi(token);
 	  break; /* RplayPriority */
 
-	case 7:
+	case 8:
 	  if (token)
 	    volume = atoi(token);
 	  break; /* RplayVolume */
 #endif
 
-	case 8:
+	case 9:
 	  if (token)
 	    start_audio_delay = atoi(token);
 	  break; /* StartDelay */

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 9 May 2001 23:14:07 +0000

On 08 May 2001 14:34:54 +0100, Tim Phipps wrote:
> 
> Attached is a patch to make FvwmEvent pass the window-id in hex.

Maybe just pass a heximal id in PassId instead of additional PassHexId?
I think it is safe.

Regards,
Mikhael.
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Tim Phipps <[email-masked]>
Date: Thu, 10 May 2001 10:29:19 +0100

> Maybe just pass a heximal id in PassId instead of additional PassHexId?

Fine by me, I didn't want to upset anyone. Attached is a patch to do it,
[de]windowshade now returns a window-id too.

Cheers,
Tim.

Index: modules/ChangeLog
===================================================================
RCS file: /u/phippst/cvsroot/fvwm/modules/ChangeLog,v
retrieving revision 1.7
diff -u -r1.7 ChangeLog
--- modules/ChangeLog	2001/05/09 11:53:55	1.7
+++ modules/ChangeLog	2001/05/10 09:27:18
@@ -1,3 +1,7 @@
+2001-05-10  Hippo
+
+	* FvwmEvent/FvwmEvent.[c1]: PassId returns a hex number
+
 2001-05-08  Mikhael Goikhman  <[email-masked]>
 
 	* FvwmCommand/FvwmCommand.c:
Index: modules/FvwmEvent/FvwmEvent.1
===================================================================
RCS file: /u/phippst/cvsroot/fvwm/modules/FvwmEvent/FvwmEvent.1,v
retrieving revision 1.1
diff -u -r1.1 FvwmEvent.1
--- modules/FvwmEvent/FvwmEvent.1	2001/05/08 10:48:02	1.1
+++ modules/FvwmEvent/FvwmEvent.1	2001/05/10 08:41:31
@@ -129,8 +129,8 @@
 .IP "*FvwmEventPassID"
 Specifies that the event action will have an ID parameter added to the end
 of the command line. Most events will have the windowID of the window that the
-event refers to, new_desk will have the new desk number.
-
+event refers to, new_desk will have the new desk number. The windowID is a
+hexadecimal string preceded by 0x, desk numbers are decimal.
 
 .IP "*FvwmEvent \fIwindow-manager-event action-or-filename\fP"
 Binds particular actions to window manager events.
Index: modules/FvwmEvent/FvwmEvent.c
===================================================================
RCS file: /u/phippst/cvsroot/fvwm/modules/FvwmEvent/FvwmEvent.c,v
retrieving revision 1.1
diff -u -r1.1 FvwmEvent.c
--- modules/FvwmEvent/FvwmEvent.c	2001/05/08 10:48:02	1.1
+++ modules/FvwmEvent/FvwmEvent.c	2001/05/10 09:24:07
@@ -173,8 +173,8 @@
   { "default_icon", -1 },
   { "string", -1 },
   { "mini_icon", -1 },
-  { "windowshade", -1 },
-  { "dewindowshade", -1 },
+  { "windowshade", 0 },
+  { "dewindowshade", 0 },
   { "lockonsend", -1 },
   { "sendconfig", -1 },
   { "restack", -1 },
@@ -394,8 +394,14 @@
 	else
 	  {
 	    if(PassID && (event_table[event].action_arg != -1))
-	      sprintf(buf,"%s %s %ld", cmd_line, action_table[event],
-		      body[event_table[event].action_arg]);
+	    {
+	      if (M_NEW_DESK == (1 << event))
+		sprintf(buf,"%s %s %ld", cmd_line, action_table[event],
+			body[event_table[event].action_arg]);
+	      else
+		sprintf(buf,"%s %s 0x%lx", cmd_line, action_table[event],
+			body[event_table[event].action_arg]);
+	    }
 	    else
 	      sprintf(buf,"%s %s", cmd_line, action_table[event]);
 	    INFO(buf);