Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RandR: support RandRFunc for screen changes #525

Merged
merged 1 commit into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/fvwm3/fvwm3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,17 @@ output will be moved to the next active output (the output which
contains the mouse pointer). If the same output reappears, Fvwm will
move those windows back again.

In addition to specific *FvwmEvent* conditions which can be used to track a
monitor's change, there is a function called _RandRFunc_ which the user can
define to be run when a screen event occurs (such as
enabling/disabling/resolution change):

....
DestroyFunc RandRFunc
AddToFunc RandRFunc
+ I Exec exec xmessage "A screen changed"
....

== DESKTOP BEHAVIOUR

Because Fvwm has the capability to track outputs, Fvwm can be told how
Expand Down
13 changes: 13 additions & 0 deletions fvwm/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -1814,18 +1814,31 @@ void
monitor_emit_broadcast(void)
{
struct monitor *m;
const char *randrfunc = "RandRFunc";

TAILQ_FOREACH (m, &monitor_q, entry) {
if (m->emit & MONITOR_CHANGED) {
BroadcastName(MX_MONITOR_CHANGED, -1, -1, -1, m->si->name);
m->emit &= ~MONITOR_ALL;
m->flags &= ~MONITOR_CHANGED;

/* Run the RandRFunc in case a user has set it. */
execute_function_override_window(NULL, NULL, randrfunc,
0, NULL);
}
if (m->emit & MONITOR_ENABLED) {
BroadcastName(MX_MONITOR_ENABLED, -1, -1, -1, m->si->name);

/* Run the RandRFunc in case a user has set it. */
execute_function_override_window(NULL, NULL, randrfunc,
0, NULL);
}
if (m->emit & MONITOR_DISABLED) {
BroadcastName(MX_MONITOR_DISABLED, -1, -1, -1, m->si->name);

/* Run the RandRFunc in case a user has set it. */
execute_function_override_window(NULL, NULL, randrfunc,
0, NULL);
}
}
}
Expand Down