don't send configure events to uninitialized xdg-popups
This commit is contained in:
parent
05c263de45
commit
c222468887
45
dwl.c
45
dwl.c
|
@ -245,6 +245,7 @@ static void cleanupmon(struct wl_listener *listener, void *data);
|
||||||
static void closemon(Monitor *m);
|
static void closemon(Monitor *m);
|
||||||
static void commitlayersurfacenotify(struct wl_listener *listener, void *data);
|
static void commitlayersurfacenotify(struct wl_listener *listener, void *data);
|
||||||
static void commitnotify(struct wl_listener *listener, void *data);
|
static void commitnotify(struct wl_listener *listener, void *data);
|
||||||
|
static void commitpopup(struct wl_listener *listener, void *data);
|
||||||
static void createdecoration(struct wl_listener *listener, void *data);
|
static void createdecoration(struct wl_listener *listener, void *data);
|
||||||
static void createidleinhibitor(struct wl_listener *listener, void *data);
|
static void createidleinhibitor(struct wl_listener *listener, void *data);
|
||||||
static void createkeyboard(struct wlr_keyboard *keyboard);
|
static void createkeyboard(struct wlr_keyboard *keyboard);
|
||||||
|
@ -753,6 +754,33 @@ commitnotify(struct wl_listener *listener, void *data)
|
||||||
c->resize = 0;
|
c->resize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
commitpopup(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
struct wlr_surface *surface = data;
|
||||||
|
struct wlr_xdg_popup *popup = wlr_xdg_popup_try_from_wlr_surface(surface);
|
||||||
|
LayerSurface *l = NULL;
|
||||||
|
Client *c = NULL;
|
||||||
|
struct wlr_box box;
|
||||||
|
int type = -1;
|
||||||
|
|
||||||
|
if (!popup->base->initial_commit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
type = toplevel_from_wlr_surface(popup->base->surface, &c, &l);
|
||||||
|
if (!popup->parent || type < 0)
|
||||||
|
return;
|
||||||
|
popup->base->surface->data = wlr_scene_xdg_surface_create(
|
||||||
|
popup->parent->data, popup->base);
|
||||||
|
if ((l && !l->mon) || (c && !c->mon))
|
||||||
|
return;
|
||||||
|
box = type == LayerShell ? l->mon->m : c->mon->w;
|
||||||
|
box.x -= (type == LayerShell ? l->geom.x : c->geom.x);
|
||||||
|
box.y -= (type == LayerShell ? l->geom.y : c->geom.y);
|
||||||
|
wlr_xdg_popup_unconstrain_from_box(popup, &box);
|
||||||
|
wl_list_remove(&listener->link);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
createdecoration(struct wl_listener *listener, void *data)
|
createdecoration(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
@ -989,22 +1017,7 @@ createpopup(struct wl_listener *listener, void *data)
|
||||||
/* This event is raised when a client (either xdg-shell or layer-shell)
|
/* This event is raised when a client (either xdg-shell or layer-shell)
|
||||||
* creates a new popup. */
|
* creates a new popup. */
|
||||||
struct wlr_xdg_popup *popup = data;
|
struct wlr_xdg_popup *popup = data;
|
||||||
LayerSurface *l = NULL;
|
LISTEN_STATIC(&popup->base->surface->events.commit, commitpopup);
|
||||||
Client *c = NULL;
|
|
||||||
struct wlr_box box;
|
|
||||||
|
|
||||||
int type = toplevel_from_wlr_surface(popup->base->surface, &c, &l);
|
|
||||||
if (!popup->parent || type < 0)
|
|
||||||
return;
|
|
||||||
popup->base->surface->data = wlr_scene_xdg_surface_create(
|
|
||||||
popup->parent->data, popup->base);
|
|
||||||
if ((l && !l->mon) || (c && !c->mon))
|
|
||||||
return;
|
|
||||||
box = type == LayerShell ? l->mon->m : c->mon->w;
|
|
||||||
box.x -= (type == LayerShell ? l->geom.x : c->geom.x);
|
|
||||||
box.y -= (type == LayerShell ? l->geom.y : c->geom.y);
|
|
||||||
/* FIXME: this send a configure event to a uninitialized wlr_xdg_surface */
|
|
||||||
wlr_xdg_popup_unconstrain_from_box(popup, &box);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue