diff --git a/config.mk b/config.mk index 01aad14..f50156f 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ -_VERSION = 0.4-rc3 -VERSION = `git describe --long --tags --dirty 2>/dev/null || echo $(_VERSION)` +_VERSION = 0.4 +VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)` PKG_CONFIG = pkg-config diff --git a/dwl.c b/dwl.c index 73e5f70..360708f 100644 --- a/dwl.c +++ b/dwl.c @@ -770,9 +770,7 @@ commitnotify(struct wl_listener *listener, void *data) c->isfloating ? resize(c, c->geom, 1) : arrange(c->mon); /* mark a pending resize as completed */ - if (c->resize && (c->resize <= c->surface.xdg->current.configure_serial - || (c->surface.xdg->current.geometry.width == c->surface.xdg->pending.geometry.width - && c->surface.xdg->current.geometry.height == c->surface.xdg->pending.geometry.height))) + if (c->resize && c->resize <= c->surface.xdg->current.configure_serial) c->resize = 0; } @@ -1173,12 +1171,12 @@ Monitor * dirtomon(enum wlr_direction dir) { struct wlr_output *next; - if (wlr_output_layout_get(output_layout, selmon->wlr_output) - && (next = wlr_output_layout_adjacent_output(output_layout, + if (!wlr_output_layout_get(output_layout, selmon->wlr_output)) + return selmon; + if ((next = wlr_output_layout_adjacent_output(output_layout, dir, selmon->wlr_output, selmon->m.x, selmon->m.y))) return next->data; - if (wlr_output_layout_get(output_layout, selmon->wlr_output) - && (next = wlr_output_layout_farthest_output(output_layout, + if ((next = wlr_output_layout_farthest_output(output_layout, dir ^ (WLR_DIRECTION_LEFT|WLR_DIRECTION_RIGHT), selmon->wlr_output, selmon->m.x, selmon->m.y))) return next->data; @@ -1839,7 +1837,7 @@ rendermon(struct wl_listener *listener, void *data) /* Render if no XDG clients have an outstanding resize and are visible on * this monitor. */ wl_list_for_each(c, &clients, link) - if (client_is_rendered_on_mon(c, m) && (!c->isfloating && c->resize) && !client_is_stopped(c)) + if (c->resize && !c->isfloating && client_is_rendered_on_mon(c, m) && !client_is_stopped(c)) goto skip; if (!wlr_scene_output_commit(m->scene_output)) return; @@ -1888,7 +1886,7 @@ resize(Client *c, struct wlr_box geo, int interact) wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw); wlr_scene_node_set_position(&c->border[3]->node, c->geom.width - c->bw, c->bw); - /* wlroots makes this a no-op if size hasn't changed */ + /* this is a no-op if size hasn't changed */ c->resize = client_set_size(c, c->geom.width - 2 * c->bw, c->geom.height - 2 * c->bw); } @@ -2472,9 +2470,14 @@ updatemons(struct wl_listener *listener, void *data) if (m->wlr_output->enabled && !wlr_output_layout_get(output_layout, m->wlr_output)) wlr_output_layout_add_auto(output_layout, m->wlr_output); + /* Now that we update the output layout we can get its box */ wlr_output_layout_get_box(output_layout, NULL, &sgeom); + + /* Make sure the clients are hidden when dwl is locked */ + wlr_scene_node_set_position(&locked_bg->node, sgeom.x, sgeom.y); wlr_scene_rect_set_size(locked_bg, sgeom.width, sgeom.height); + wl_list_for_each(m, &mons, link) { if (!m->wlr_output->enabled) continue; @@ -2484,10 +2487,6 @@ updatemons(struct wl_listener *listener, void *data) wlr_output_layout_get_box(output_layout, m->wlr_output, &(m->m)); wlr_output_layout_get_box(output_layout, m->wlr_output, &(m->w)); wlr_scene_output_set_position(m->scene_output, m->m.x, m->m.y); - /* Calculate the effective monitor geometry to use for clients */ - arrangelayers(m); - /* Don't move clients to the left output when plugging monitors */ - arrange(m); wlr_scene_node_set_position(&m->fullscreen_bg->node, m->m.x, m->m.y); wlr_scene_rect_set_size(m->fullscreen_bg, m->m.width, m->m.height); @@ -2499,6 +2498,11 @@ updatemons(struct wl_listener *listener, void *data) m->m.height); } + /* Calculate the effective monitor geometry to use for clients */ + arrangelayers(m); + /* Don't move clients to the left output when plugging monitors */ + arrange(m); + config_head->state.enabled = 1; config_head->state.mode = m->wlr_output->current_mode; config_head->state.x = m->m.x; @@ -2530,8 +2534,8 @@ urgent(struct wl_listener *listener, void *data) { struct wlr_xdg_activation_v1_request_activate_event *event = data; Client *c = NULL; - int type = toplevel_from_wlr_surface(event->surface, &c, NULL); - if (type >= 0 && type != LayerShell && c != focustop(selmon)) { + toplevel_from_wlr_surface(event->surface, &c, NULL); + if (c && c != focustop(selmon)) { c->isurgent = 1; printstatus(); }