Hello,
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
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)
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/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.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 },