mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-11-11 15:43:13 +00:00
don't keep outputs unplugged while off in offmons
When an output was unplugged while turned off (e.g. by swayidle), only the remaining ones were turned on again, and the unplugged one stayed in offmons, so it stayed off when plugged in again. Forget the outputs that are no longer connected whenever one is turned on.
This commit is contained in:
@@ -320,6 +320,7 @@ static void focusclient(Client *c, LayerSurface *l, int lift);
|
||||
static void focusmon(const Arg *arg);
|
||||
static void focusstack(const Arg *arg);
|
||||
static Client *focustop(Monitor *m);
|
||||
static void forgetoffmons(void);
|
||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
static void gpureset(struct wl_listener *listener, void *data);
|
||||
static void handlesig(int signo);
|
||||
@@ -1760,6 +1761,26 @@ focustop(Monitor *m)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
forgetoffmons(void)
|
||||
{
|
||||
/* Forget the outputs that were unplugged while off, or they would stay
|
||||
* off when plugged in again */
|
||||
char **name, **kept = offmons.data;
|
||||
Monitor *m;
|
||||
|
||||
wl_array_for_each(name, &offmons) {
|
||||
wl_list_for_each(m, &mons, link)
|
||||
if (!strcmp(*name, m->wlr_output->name))
|
||||
break;
|
||||
if (&m->link != &mons)
|
||||
*kept++ = *name;
|
||||
else
|
||||
free(*name);
|
||||
}
|
||||
offmons.size = (char *)kept - (char *)offmons.data;
|
||||
}
|
||||
|
||||
void
|
||||
fullscreennotify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
@@ -2451,6 +2472,8 @@ powermgrsetmode(struct wl_listener *listener, void *data)
|
||||
if (!m)
|
||||
return;
|
||||
|
||||
if (event->mode)
|
||||
forgetoffmons();
|
||||
m->gamma_lut_changed = 1; /* Reapply gamma LUT when re-enabling the output */
|
||||
wlr_output_state_set_enabled(&state, event->mode);
|
||||
/* The output was reconnected while off and was never modeset */
|
||||
|
||||
Reference in New Issue
Block a user