Hello,

Here is my second version of the layer_change event patch, hopefully
addressing the points raised in reply to the first one.  The core code is
unchanged, only changes to perllib and doc/changelog files have been
added.

We needed to trace and hook some actions to layer changes for e-Sidor[1],
so here is the functionnality to do so.

This patch also:
    * declare "restack" event to FvwmCommand
    * declare "reply" event to FvwmEvent
    * stop filtering out most extended messages for FvwmCommandS
    * minor whitespace cleanup
    * regenerate perllib's Constants.pm
    * declare MX_LAYER_CHANGE arguments to perllib

We hope you'll find it useful.

Best regards,
-- 
Yann Dirson - Linagora http://linagora.com/

[1] http://e-sidor.com/ (sorry, the website is still in french only, but
you can still get an idea of the product)
commit 5b249faf5a2c0e81d06f4ec6cadb7b24dbfec4bd
Author: Yann Dirson <[email protected]>
Date:   Wed Dec 17 18:02:21 2008 +0100

    Add layer_change event, and support it in FvwmEvent and FvwmCommand.
    
    Also:
    * declare "restack" event to FvwmCommand
    * declare "reply" event to FvwmEvent
    * stop filtering out most extended messages for FvwmCommandS
    * minor whitespace cleanup
    * regenerate perllib's Constants.pm
    * declare MX_LAYER_CHANGE arguments to perllib

diff --git a/ChangeLog b/ChangeLog
index c67264a..209ab97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-16  Yann Dirson  <ydirson(at)linagora(dot)com>
+
+	* libs/Module.h:
+	* fvwm/stack.c (new_layer):
+	add support for MX_LAYER_CHANGE event
+
 2009-03-17  Mikhael Goikhman  <[email protected]>
 
 	* fvwm/externs.h:
diff --git a/fvwm/stack.c b/fvwm/stack.c
index 06384b7..db7f32e 100644
--- a/fvwm/stack.c
+++ b/fvwm/stack.c
@@ -1960,6 +1960,11 @@ void new_layer(FvwmWindow *fw, int layer)
 	{
 		return;
 	}
+
+	BroadcastPacket(
+		MX_LAYER_CHANGE, 5, (long)FW_W(fw), (long)FW_W_FRAME(fw),
+		(unsigned long)fw, (unsigned long)fw->layer, (unsigned long)layer);
+
 	old_layer = fw->layer;
 	list_head.stack_next = &list_head;
 	list_head.stack_prev = &list_head;
diff --git a/libs/Module.h b/libs/Module.h
index e7acdad..ef36826 100644
--- a/libs/Module.h
+++ b/libs/Module.h
@@ -118,10 +118,11 @@ typedef struct
 #define MX_ENTER_WINDOW           ((1<<1) | M_EXTENDED_MSG)
 #define MX_LEAVE_WINDOW           ((1<<2) | M_EXTENDED_MSG)
 #define MX_PROPERTY_CHANGE        ((1<<3) | M_EXTENDED_MSG)
-#define MX_REPLY		  ((1<<4) | M_EXTENDED_MSG)
-#define MAX_EXTENDED_MESSAGES     5
+#define MX_REPLY                  ((1<<4) | M_EXTENDED_MSG)
+#define MX_LAYER_CHANGE           ((1<<5) | M_EXTENDED_MSG)
+#define MAX_EXTENDED_MESSAGES     6
 #define DEFAULT_XMSG_MASK         0x00000000
-#define MAX_XMSG_MASK             0x0000001f
+#define MAX_XMSG_MASK             0x0000003f
 
 #define MAX_TOTAL_MESSAGES   (MAX_MESSAGES + MAX_EXTENDED_MESSAGES)
 
diff --git a/modules/ChangeLog b/modules/ChangeLog
index b1a8e51..a7187d5 100644
--- a/modules/ChangeLog
+++ b/modules/ChangeLog
@@ -1,3 +1,13 @@
+2009-04-16  Yann Dirson  <ydirson(at)linagora(dot)com>
+
+	* FvwmEvent/FvwmEvent.c:
+	* FvwmEvent/FvwmEvent.1.in:
+	* FvwmCommand/FvwmCommandS.c (process_message):
+	(server):
+	* FvwmCommand/FvwmCommand.c (process_message):
+	(list_layer_change):
+	add support for MX_LAYER_CHANGE event
+
 2009-03-22  Mikhael Goikhman  <[email protected]>
 
 	* FvwmDebug/Makefile.am:
diff --git a/modules/FvwmCommand/FvwmCommand.c b/modules/FvwmCommand/FvwmCommand.c
index 1e0aaab..585da9a 100644
--- a/modules/FvwmCommand/FvwmCommand.c
+++ b/modules/FvwmCommand/FvwmCommand.c
@@ -670,6 +670,12 @@ void process_message( void )
 	    case M_DEWINDOWSHADE:
 	      list_header(body, "dewindowshade");
 	      break;
+	    case M_RESTACK:
+	      list_header(body, "restack");
+	      break;
+	    case MX_LAYER_CHANGE:
+	      list_layer_change( body );
+	      break;
 	    default:
 	      printf("0x%lx type 0x%lx\n", body[0], type );
 	    }
@@ -977,3 +983,14 @@ void list_iconify(unsigned long *body)
   printf( "0x%08lx %-20s x %ld, y %ld, width %ld, hight %ld\n",
 	  body[0], "iconify", body[3], body[4], body[5], body[6] );
 }
+
+/*
+ *
+ * print info layer change
+ *
+ */
+void list_layer_change(unsigned long *body)
+{
+  printf( "0x%08lx %-20s from %ld to %ld\n",
+	  body[0], "layer change", body[3], body[4] );
+}
diff --git a/modules/FvwmCommand/FvwmCommandS.c b/modules/FvwmCommand/FvwmCommandS.c
index 2e7d456..865f4df 100644
--- a/modules/FvwmCommand/FvwmCommandS.c
+++ b/modules/FvwmCommand/FvwmCommandS.c
@@ -182,8 +182,6 @@ void server (char *name)
 
   cix = 0;
 
-  /*Accept reply-messages */
-  SetMessageMask(Fd, MX_REPLY);
   /* tell fvwm we're running */
   SendFinishedStartupNotification(Fd);
 
@@ -495,6 +493,7 @@ void process_message(unsigned long type,unsigned long *body)
     break;
 
   case M_NEW_PAGE:
+  case MX_LAYER_CHANGE:
     relay_packet(type, 5 * SOL, body);
     break;
 
diff --git a/modules/FvwmEvent/FvwmEvent.1.in b/modules/FvwmEvent/FvwmEvent.1.in
index 2cda6da..751eed8 100644
--- a/modules/FvwmEvent/FvwmEvent.1.in
+++ b/modules/FvwmEvent/FvwmEvent.1.in
@@ -188,6 +188,8 @@ e.g. for audio-events:
 	*FvwmEvent: enter_window beep.au
 	*FvwmEvent: leave_window beep.au
 	*FvwmEvent: property_change beep.au
+
+	*FvwmEvent: layer_change beep.au
 .sp
 .fi
 The window related event handlers are executed within a window
diff --git a/modules/FvwmEvent/FvwmEvent.c b/modules/FvwmEvent/FvwmEvent.c
index 5222263..853a2c0 100644
--- a/modules/FvwmEvent/FvwmEvent.c
+++ b/modules/FvwmEvent/FvwmEvent.c
@@ -151,6 +151,8 @@ static event_entry event_table[MAX_TOTAL_MESSAGES+MAX_BUILTIN] =
 	{ "enter_window", 0 },
 	{ "leave_window", 0 },
 	{ "property_change", 0},
+	{ "reply", 0},
+	{ "layer_change", 0 },
 	/* built in events */
 #ifdef M_BELL
 	{ "beep", -1 },
diff --git a/perllib/ChangeLog b/perllib/ChangeLog
index 6e5379a..5baa872 100644
--- a/perllib/ChangeLog
+++ b/perllib/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-16  Yann Dirson  <ydirson(at)linagora(dot)com>
+
+	* FVWM/Constants.pm:
+	* FVWM/EventNames.pm:
+	add support for MX_LAYER_CHANGE event
+
 2009-03-18  Mikhael Goikhman  <[email protected]>
 
 	* FVWM/Module.pm.in:
diff --git a/perllib/FVWM/Constants.pm b/perllib/FVWM/Constants.pm
index dcfbf9f..6cd83b9 100644
--- a/perllib/FVWM/Constants.pm
+++ b/perllib/FVWM/Constants.pm
@@ -42,11 +42,12 @@ use constant MX_ENTER_WINDOW => ((1<<1)|M_EXTENDED_MSG);
 use constant MX_LEAVE_WINDOW => ((1<<2)|M_EXTENDED_MSG);
 use constant MX_PROPERTY_CHANGE => ((1<<3)|M_EXTENDED_MSG);
 use constant MX_REPLY => ((1<<4)|M_EXTENDED_MSG);
+use constant MX_LAYER_CHANGE => ((1<<5)|M_EXTENDED_MSG);
 use constant MX_PROPERTY_CHANGE_NONE => 0;
 use constant MX_PROPERTY_CHANGE_BACKGROUND => 1;
 use constant MX_PROPERTY_CHANGE_SWALLOW => 2;
 use constant MAX_MSG_MASK => 0x7fffffff;
-use constant MAX_XMSG_MASK => 0x0000001f;
+use constant MAX_XMSG_MASK => 0x0000003f;
 use constant HEADER_SIZE => 4;
 use constant START_FLAG => 0xffffffff;
 use constant RESPONSE_READY => "NOP FINISHED STARTUP";
@@ -91,6 +92,7 @@ use constant INTSIZE => $Config{longsize};
   MX_LEAVE_WINDOW
   MX_PROPERTY_CHANGE
   MX_REPLY
+  MX_LAYER_CHANGE
   MX_PROPERTY_CHANGE_NONE
   MX_PROPERTY_CHANGE_BACKGROUND
   MX_PROPERTY_CHANGE_SWALLOW
@@ -165,6 +167,7 @@ For more information, see L<FVWM::Module>.
   MX_LEAVE_WINDOW
   MX_PROPERTY_CHANGE
   MX_REPLY
+  MX_LAYER_CHANGE
   MX_PROPERTY_CHANGE_NONE
   MX_PROPERTY_CHANGE_BACKGROUND
   MX_PROPERTY_CHANGE_SWALLOW
diff --git a/perllib/FVWM/EventNames.pm b/perllib/FVWM/EventNames.pm
index ba33c2d..cd5ec42 100644
--- a/perllib/FVWM/EventNames.pm
+++ b/perllib/FVWM/EventNames.pm
@@ -451,6 +451,17 @@ $EVENTS_INFO = {
 		],
 	},
 
+	&MX_LAYER_CHANGE        => {
+		format => "L!5",
+		fields => [
+			win_id       => window,
+			frame_id     => window,
+			ptr          => number,
+			old_layer    => number,
+			new_layer    => number,
+		],
+	},
+
 	"faked"                 => {
 		format => "",
 		fields => [

Reply via email to