Merge remote-tracking branch 'upstream/main' into wlroots-next

This commit is contained in:
Leonardo Hernández Hernández 2022-12-30 15:29:12 -06:00
commit cf9c5745e5
No known key found for this signature in database
GPG key ID: E538897EE11B9624
2 changed files with 21 additions and 17 deletions

View file

@ -1,5 +1,5 @@
_VERSION = 0.4-rc3 _VERSION = 0.4
VERSION = `git describe --long --tags --dirty 2>/dev/null || echo $(_VERSION)` VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)`
PKG_CONFIG = pkg-config PKG_CONFIG = pkg-config

34
dwl.c
View file

@ -770,9 +770,7 @@ commitnotify(struct wl_listener *listener, void *data)
c->isfloating ? resize(c, c->geom, 1) : arrange(c->mon); c->isfloating ? resize(c, c->geom, 1) : arrange(c->mon);
/* mark a pending resize as completed */ /* mark a pending resize as completed */
if (c->resize && (c->resize <= c->surface.xdg->current.configure_serial 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)))
c->resize = 0; c->resize = 0;
} }
@ -1173,12 +1171,12 @@ Monitor *
dirtomon(enum wlr_direction dir) dirtomon(enum wlr_direction dir)
{ {
struct wlr_output *next; struct wlr_output *next;
if (wlr_output_layout_get(output_layout, selmon->wlr_output) if (!wlr_output_layout_get(output_layout, selmon->wlr_output))
&& (next = wlr_output_layout_adjacent_output(output_layout, return selmon;
if ((next = wlr_output_layout_adjacent_output(output_layout,
dir, selmon->wlr_output, selmon->m.x, selmon->m.y))) dir, selmon->wlr_output, selmon->m.x, selmon->m.y)))
return next->data; return next->data;
if (wlr_output_layout_get(output_layout, selmon->wlr_output) if ((next = wlr_output_layout_farthest_output(output_layout,
&& (next = wlr_output_layout_farthest_output(output_layout,
dir ^ (WLR_DIRECTION_LEFT|WLR_DIRECTION_RIGHT), dir ^ (WLR_DIRECTION_LEFT|WLR_DIRECTION_RIGHT),
selmon->wlr_output, selmon->m.x, selmon->m.y))) selmon->wlr_output, selmon->m.x, selmon->m.y)))
return next->data; 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 /* Render if no XDG clients have an outstanding resize and are visible on
* this monitor. */ * this monitor. */
wl_list_for_each(c, &clients, link) 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; goto skip;
if (!wlr_scene_output_commit(m->scene_output)) if (!wlr_scene_output_commit(m->scene_output))
return; 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[2]->node, 0, c->bw);
wlr_scene_node_set_position(&c->border[3]->node, c->geom.width - c->bw, 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->resize = client_set_size(c, c->geom.width - 2 * c->bw,
c->geom.height - 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 if (m->wlr_output->enabled
&& !wlr_output_layout_get(output_layout, m->wlr_output)) && !wlr_output_layout_get(output_layout, m->wlr_output))
wlr_output_layout_add_auto(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 */ /* Now that we update the output layout we can get its box */
wlr_output_layout_get_box(output_layout, NULL, &sgeom); 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); wlr_scene_rect_set_size(locked_bg, sgeom.width, sgeom.height);
wl_list_for_each(m, &mons, link) { wl_list_for_each(m, &mons, link) {
if (!m->wlr_output->enabled) if (!m->wlr_output->enabled)
continue; 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->m));
wlr_output_layout_get_box(output_layout, m->wlr_output, &(m->w)); 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); 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_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); 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); 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.enabled = 1;
config_head->state.mode = m->wlr_output->current_mode; config_head->state.mode = m->wlr_output->current_mode;
config_head->state.x = m->m.x; 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; struct wlr_xdg_activation_v1_request_activate_event *event = data;
Client *c = NULL; Client *c = NULL;
int type = toplevel_from_wlr_surface(event->surface, &c, NULL); toplevel_from_wlr_surface(event->surface, &c, NULL);
if (type >= 0 && type != LayerShell && c != focustop(selmon)) { if (c && c != focustop(selmon)) {
c->isurgent = 1; c->isurgent = 1;
printstatus(); printstatus();
} }