forked from mirror/dwl
cleanup on aisle createmon()
This commit is contained in:
parent
48ef5e8bd2
commit
a5210f7d77
1 changed files with 12 additions and 15 deletions
27
dwl.c
27
dwl.c
|
@ -818,18 +818,12 @@ createmon(struct wl_listener *listener, void *data)
|
|||
* monitor) becomes available. */
|
||||
struct wlr_output *wlr_output = data;
|
||||
const MonitorRule *r;
|
||||
size_t nlayers;
|
||||
Monitor *m, *moni, *insertmon = NULL;
|
||||
|
||||
/* The mode is a tuple of (width, height, refresh rate), and each
|
||||
* monitor supports only a specific set of modes. We just pick the
|
||||
* monitor's preferred mode; a more sophisticated compositor would let
|
||||
* the user configure it. */
|
||||
wlr_output_set_mode(wlr_output, wlr_output_preferred_mode(wlr_output));
|
||||
|
||||
/* Allocates and configures monitor state using configured rules */
|
||||
m = wlr_output->data = calloc(1, sizeof(*m));
|
||||
Monitor *m = wlr_output->data = calloc(1, sizeof(*m));
|
||||
m->wlr_output = wlr_output;
|
||||
|
||||
/* Initialize monitor state using configured rules */
|
||||
for (size_t i = 0; i < LENGTH(m->layers); ++i)
|
||||
wl_list_init(&m->layers[i]);
|
||||
m->tagset[0] = m->tagset[1] = 1;
|
||||
for (r = monrules; r < END(monrules); r++) {
|
||||
if (!r->name || strstr(wlr_output->name, r->name)) {
|
||||
|
@ -842,7 +836,14 @@ createmon(struct wl_listener *listener, void *data)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The mode is a tuple of (width, height, refresh rate), and each
|
||||
* monitor supports only a specific set of modes. We just pick the
|
||||
* monitor's preferred mode; a more sophisticated compositor would let
|
||||
* the user configure it. */
|
||||
wlr_output_set_mode(wlr_output, wlr_output_preferred_mode(wlr_output));
|
||||
wlr_output_enable_adaptive_sync(wlr_output, 1);
|
||||
|
||||
/* Set up event listeners */
|
||||
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
|
||||
LISTEN(&wlr_output->events.destroy, &m->destroy, cleanupmon);
|
||||
|
@ -861,10 +862,6 @@ createmon(struct wl_listener *listener, void *data)
|
|||
wlr_output_layout_add(output_layout, wlr_output, r->x, r->y);
|
||||
sgeom = *wlr_output_layout_get_box(output_layout, NULL);
|
||||
|
||||
nlayers = LENGTH(m->layers);
|
||||
for (size_t i = 0; i < nlayers; ++i)
|
||||
wl_list_init(&m->layers[i]);
|
||||
|
||||
/* When adding monitors, the geometries of all monitors must be updated */
|
||||
updatemons();
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
|
|
Loading…
Reference in a new issue