Revert "stop trying resize clients during commitnotify()"

This reverts commit 2d9d758c8d.

wasn't meant to be pushed to main
This commit is contained in:
Leonardo Hernández Hernández 2022-10-15 18:19:43 -05:00
parent 110cde8f67
commit e9826de295
No known key found for this signature in database
GPG Key ID: E538897EE11B9624

28
dwl.c
View File

@ -836,6 +836,12 @@ void
commitnotify(struct wl_listener *listener, void *data) commitnotify(struct wl_listener *listener, void *data)
{ {
Client *c = wl_container_of(listener, c, commit); Client *c = wl_container_of(listener, c, commit);
struct wlr_box box = {0};
client_get_geometry(c, &box);
if (c->mon && !wlr_box_empty(&box) && (box.width != c->geom.width - 2 * c->bw
|| box.height != c->geom.height - 2 * c->bw))
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
@ -1027,7 +1033,6 @@ createnotify(struct wl_listener *listener, void *data)
LISTEN(&xdg_surface->events.map, &c->map, mapnotify); LISTEN(&xdg_surface->events.map, &c->map, mapnotify);
LISTEN(&xdg_surface->events.unmap, &c->unmap, unmapnotify); LISTEN(&xdg_surface->events.unmap, &c->unmap, unmapnotify);
LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify); LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify);
LISTEN(&xdg_surface->surface->events.commit, &c->commit, commitnotify);
LISTEN(&xdg_surface->toplevel->events.set_title, &c->set_title, updatetitle); LISTEN(&xdg_surface->toplevel->events.set_title, &c->set_title, updatetitle);
LISTEN(&xdg_surface->toplevel->events.request_fullscreen, &c->fullscreen, LISTEN(&xdg_surface->toplevel->events.request_fullscreen, &c->fullscreen,
fullscreennotify); fullscreennotify);
@ -1134,9 +1139,8 @@ destroynotify(struct wl_listener *listener, void *data)
wl_list_remove(&c->configure.link); wl_list_remove(&c->configure.link);
wl_list_remove(&c->set_hints.link); wl_list_remove(&c->set_hints.link);
wl_list_remove(&c->activate.link); wl_list_remove(&c->activate.link);
} else }
#endif #endif
{ wl_list_remove(&c->commit.link); }
free(c); free(c);
} }
@ -1423,8 +1427,14 @@ mapnotify(struct wl_listener *listener, void *data)
c->scene_surface = c->type == XDGShell c->scene_surface = c->type == XDGShell
? wlr_scene_xdg_surface_create(c->scene, c->surface.xdg) ? wlr_scene_xdg_surface_create(c->scene, c->surface.xdg)
: wlr_scene_subsurface_tree_create(c->scene, client_surface(c)); : wlr_scene_subsurface_tree_create(c->scene, client_surface(c));
if (client_surface(c)) if (client_surface(c)) {
client_surface(c)->data = c->scene; client_surface(c)->data = c->scene;
/* Ideally we should do this in createnotify{,x11} but at that moment
* wlr_xwayland_surface doesn't have wlr_surface yet
*/
LISTEN(&client_surface(c)->events.commit, &c->commit, commitnotify);
}
c->scene->data = c->scene_surface->data = c; c->scene->data = c->scene_surface->data = c;
#ifdef XWAYLAND #ifdef XWAYLAND
@ -2405,6 +2415,7 @@ unmapnotify(struct wl_listener *listener, void *data)
wl_list_remove(&c->flink); wl_list_remove(&c->flink);
} }
wl_list_remove(&c->commit.link);
wlr_scene_node_destroy(c->scene); wlr_scene_node_destroy(c->scene);
printstatus(); printstatus();
motionnotify(0); motionnotify(0);
@ -2580,12 +2591,9 @@ void
configurex11(struct wl_listener *listener, void *data) configurex11(struct wl_listener *listener, void *data)
{ {
Client *c = wl_container_of(listener, c, configure); Client *c = wl_container_of(listener, c, configure);
struct wlr_xwayland_surface_configure_event *e = data; struct wlr_xwayland_surface_configure_event *event = data;
if (c->isfloating) wlr_xwayland_surface_configure(c->surface.xwayland,
resize(c, (struct wlr_box){.x = e->x, .y = e->y, event->x, event->y, event->width, event->height);
.width = e->width, .height = e->height}, 0);
else
arrange(c->mon);
} }
void void