xwayland: move override-redirect assignmend to map handler

Some surfaces set their coordinates only when they're mapped, such as
current Firefox's menu popup. Hence, we accomodate such clients.
This commit is contained in:
Jente Hidskes 2019-01-31 18:31:14 +01:00
parent c47eb031c6
commit 75b0f832ed
No known key found for this signature in database
GPG key ID: 04BE5A29F32D91EA
2 changed files with 6 additions and 6 deletions

2
view.c
View file

@ -106,7 +106,7 @@ view_map(struct cg_view *view, struct wlr_surface *surface)
#if CAGE_HAS_XWAYLAND
/* We shouldn't position override-redirect windows. They set
their own (x,y) coordinates in handle_wayland_surface_new. */
their own (x,y) coordinates in handle_wayland_surface_map. */
if (view->type != CAGE_XWAYLAND_VIEW || xwayland_view_should_manage(view))
#endif
{

View file

@ -122,6 +122,11 @@ handle_xwayland_surface_map(struct wl_listener *listener, void *data)
struct cg_xwayland_view *xwayland_view = wl_container_of(listener, xwayland_view, map);
struct cg_view *view = &xwayland_view->view;
if (!xwayland_view_should_manage(view)) {
view->x = xwayland_view->xwayland_surface->x;
view->y = xwayland_view->xwayland_surface->y;
}
xwayland_view->ever_been_mapped = true;
view_map(view, xwayland_view->xwayland_surface->surface);
}
@ -166,11 +171,6 @@ handle_xwayland_surface_new(struct wl_listener *listener, void *data)
view_init(&xwayland_view->view, server, CAGE_XWAYLAND_VIEW, &xwayland_view_impl);
xwayland_view->xwayland_surface = xwayland_surface;
if (xwayland_surface->override_redirect) {
struct cg_view *view = &xwayland_view->view;
view->x = xwayland_surface->x;
view->y = xwayland_surface->y;
}
xwayland_view->map.notify = handle_xwayland_surface_map;
wl_signal_add(&xwayland_surface->events.map, &xwayland_view->map);