Fix dwl crashing when a new client spawns, isn't viewed, and then a new Popup is spawned

This commit is contained in:
Palanix 2022-01-18 17:46:02 +01:00
parent 7b2b910c57
commit a2bb0b3bf1

11
dwl.c
View File

@ -885,12 +885,15 @@ createnotify(struct wl_listener *listener, void *data)
* client, either a toplevel (application window) or popup. */ * client, either a toplevel (application window) or popup. */
struct wlr_xdg_surface *xdg_surface = data; struct wlr_xdg_surface *xdg_surface = data;
Client *c; Client *c;
Arg tags;
Arg oldtags;
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
Client *sel = selclient(); Client *sel = selclient();
Monitor *selmo = xytomon(cursor->x, cursor->y);
struct wlr_box pop_box = { struct wlr_box pop_box = {
.x = sel->geom.x - selmon->m.x, .x = sel->geom.x - selmo->m.x,
.y = sel->geom.y - selmon->m.y, .y = sel->geom.y - selmo->m.y,
.width = sel->geom.width, .width = sel->geom.width,
.height = sel->geom.height, .height = sel->geom.height,
}; };
@ -914,6 +917,10 @@ createnotify(struct wl_listener *listener, void *data)
LISTEN(&xdg_surface->toplevel->events.request_fullscreen, &c->fullscreen, LISTEN(&xdg_surface->toplevel->events.request_fullscreen, &c->fullscreen,
fullscreennotify); fullscreennotify);
c->isfullscreen = 0; c->isfullscreen = 0;
oldtags.ui = c->tags;
tags.ui = c->tags;
view(&tags);
view(&oldtags);
} }
void void