Skip to content

Commit

Permalink
RandR: avoid segfault with one screen
Browse files Browse the repository at this point in the history
When two monitors go to one monitor (undocking a laptop with one
external display, for example), don't set the previous monitor if it's
the same as the current monitor.

Fixes #947
  • Loading branch information
ThomasAdam committed Feb 22, 2024
1 parent 61fec78 commit cb8cce5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fvwm/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -2295,6 +2295,12 @@ void HandleEnterNotify(const evh_args_t *ea)
pfm = monitor_resolve_name(prev_focused_monitor);
this_m = monitor_get_current();

/* Don't toggle the previous monitor if there isn't one, or
* the two monitors are the same.
*/
if ((pfm == NULL) || (pfm == this_m))
return;

/* Send MX_MONITOR_FOCUS event. */
toggle_prev_monitor_state(this_m, pfm, NULL);

Expand Down

0 comments on commit cb8cce5

Please sign in to comment.