Skip to content

Commit

Permalink
FvwmEvent: don't special-case monitor extended events
Browse files Browse the repository at this point in the history
The monitor_* events used to be special-cased in that there would be an
attempt to pass arguments to calling functions.

Don't do this any longer, and treat these events the same as any other
without a window context.

Fixes #604
  • Loading branch information
ThomasAdam committed Sep 28, 2022
1 parent 9eb0253 commit f85c4dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
12 changes: 1 addition & 11 deletions doc/FvwmEvent.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,7 @@ needed.
The monitor_* events do not operate in a window context (as there isn't
one), but react to when a monitor is plugged in (enabled), unplugged
(disabled), focused (focus) or changed (resized/rotated, etc., which
will only be true if the monitor is already active). In all cases, the
monitor name is is passed through to the command, hence the following
example prints out the changed monitor's name, and width/height values:
+
....
DestroyFunc MonitorExample
AddToFunc MonitorExample
+ I Echo "Monitor $0 changed ($[monitor.$0.width] x $[monitor.$0.height])
*FvwmEvent: monitor_changed MonitorExample
....
will only be true if the monitor is already active).
+
The echo event is generated whenever Fvwm receives an Echo command.
+
Expand Down
16 changes: 5 additions & 11 deletions modules/FvwmEvent/FvwmEvent.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ static Bool audio_compat = False;
static char *audio_play_dir = NULL;

#define ARG_NO_WINID 1024 /* just a large number */
#define ARG_EXPECTS_CHAR 1025

#define EVENT_ENTRY(name,action_arg) { name, action_arg, {NULL} }
static event_entry message_event_table[] =
Expand Down Expand Up @@ -139,11 +138,11 @@ static event_entry extended_message_event_table[] =
EVENT_ENTRY( "enter_window", 0 ),
EVENT_ENTRY( "leave_window", 0 ),
EVENT_ENTRY( "property_change", 0),
EVENT_ENTRY( "monitor_enabled", 0 | ARG_EXPECTS_CHAR),
EVENT_ENTRY( "monitor_disabled", 0 | ARG_EXPECTS_CHAR),
EVENT_ENTRY( "monitor_changed", 0 | ARG_EXPECTS_CHAR),
EVENT_ENTRY( "monitor_focus", 0 | ARG_EXPECTS_CHAR),
EVENT_ENTRY( "echo", 0 | ARG_EXPECTS_CHAR),
EVENT_ENTRY( "monitor_enabled", 0 | ARG_NO_WINID),
EVENT_ENTRY( "monitor_disabled", 0 | ARG_NO_WINID),
EVENT_ENTRY( "monitor_changed", 0 | ARG_NO_WINID),
EVENT_ENTRY( "monitor_focus", 0 | ARG_NO_WINID),
EVENT_ENTRY( "echo", 0),
EVENT_ENTRY( "reply", 0), /* FvwmEvent will never receive MX_REPLY */
EVENT_ENTRY(NULL,0)
};
Expand Down Expand Up @@ -469,11 +468,6 @@ void execute_event(event_entry *event_table, short event, unsigned long *body)
action, body[action_arg]);
}
}
/* monitor_* events. */
else if (action_arg != -1 && (action_arg & ARG_EXPECTS_CHAR)) {
sprintf(buf, "%s %s %s", cmd_line, action,
(char *)(&body[3]));
}
else
{
sprintf(buf,"%s %s", cmd_line, action);
Expand Down

0 comments on commit f85c4dc

Please sign in to comment.