~ruther/dwl

2902df94d6e3da04b7abc92f846b0da7d40ff4ea — David Donahue 1 year, 9 days ago 9b1f35e
Prevent updatemons() from removing monitors that have been put to sleep from the layout
1 files changed, 7 insertions(+), 1 deletions(-)

M dwl.c
M dwl.c => dwl.c +7 -1
@@ 207,6 207,7 @@ struct Monitor {
	int gamma_lut_changed;
	int nmaster;
	char ltsymbol[16];
	int asleep;
};

typedef struct {


@@ 962,6 963,8 @@ createmon(struct wl_listener *listener, void *data)
	LISTEN(&wlr_output->events.destroy, &m->destroy, cleanupmon);
	LISTEN(&wlr_output->events.request_state, &m->request_state, requestmonstate);

	m->asleep = 0;

	wlr_output_state_set_enabled(&state, 1);
	wlr_output_commit_state(wlr_output, &state);
	wlr_output_state_finish(&state);


@@ 2018,8 2021,11 @@ void
powermgrsetmodenotify(struct wl_listener *listener, void *data)
{
	struct wlr_output_power_v1_set_mode_event *event = data;

	wlr_output_enable(event->output, event->mode);
	wlr_output_commit(event->output);

	((Monitor *)(event->output->data))->asleep = !event->mode;
}

void


@@ 2755,7 2761,7 @@ updatemons(struct wl_listener *listener, void *data)

	/* First remove from the layout the disabled monitors */
	wl_list_for_each(m, &mons, link) {
		if (m->wlr_output->enabled)
		if (m->wlr_output->enabled || m->asleep)
			continue;
		config_head = wlr_output_configuration_head_v1_create(config, m->wlr_output);
		config_head->state.enabled = 0;

Do not follow this link