aboutsummaryrefslogtreecommitdiff
path: root/rootston/xwayland.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-13 08:48:01 -0400
committerGitHub <noreply@github.com>2018-04-13 08:48:01 -0400
commitbcf5da5cd7ea61679309c871e52468b335f57cb5 (patch)
treeef1e02c3983669ccdea1b0ae58083bd3599bc3ce /rootston/xwayland.c
parent7433d2f1dedc2caaf85ab96cddb20d3051c6bf1b (diff)
parentfa02e30adf06e5b2ff661c1271b93851f13337ce (diff)
Merge pull request #866 from emersion/xwayland-unmapped-on-create
xwayland: emit new_surface when unmapped
Diffstat (limited to 'rootston/xwayland.c')
-rw-r--r--rootston/xwayland.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/rootston/xwayland.c b/rootston/xwayland.c
index 27a27b65..b7dbab54 100644
--- a/rootston/xwayland.c
+++ b/rootston/xwayland.c
@@ -228,19 +228,31 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
static void handle_map(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, map);
- struct wlr_xwayland_surface *xsurface = data;
+ struct wlr_xwayland_surface *surface = data;
struct roots_view *view = roots_surface->view;
- view->x = xsurface->x;
- view->y = xsurface->y;
- view->width = xsurface->surface->current->width;
- view->height = xsurface->surface->current->height;
-
- view_map(view, xsurface->surface);
+ view->x = surface->x;
+ view->y = surface->y;
+ view->width = surface->surface->current->width;
+ view->height = surface->surface->current->height;
roots_surface->surface_commit.notify = handle_surface_commit;
- wl_signal_add(&xsurface->surface->events.commit,
+ wl_signal_add(&surface->surface->events.commit,
&roots_surface->surface_commit);
+
+ view_map(view, surface->surface);
+
+ if (!surface->override_redirect) {
+ if (surface->decorations == WLR_XWAYLAND_SURFACE_DECORATIONS_ALL) {
+ view->decorated = true;
+ view->border_width = 4;
+ view->titlebar_height = 12;
+ }
+
+ view_setup(view);
+ } else {
+ view_initial_focus(view);
+ }
}
static void handle_unmap(struct wl_listener *listener, void *data) {
@@ -289,10 +301,6 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
wl_signal_add(&surface->events.request_fullscreen,
&roots_surface->request_fullscreen);
- roots_surface->surface_commit.notify = handle_surface_commit;
- wl_signal_add(&surface->surface->events.commit,
- &roots_surface->surface_commit);
-
struct roots_view *view = view_create(desktop);
if (view == NULL) {
free(roots_surface);
@@ -301,8 +309,6 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
view->type = ROOTS_XWAYLAND_VIEW;
view->x = (double)surface->x;
view->y = (double)surface->y;
- view->width = surface->surface->current->width;
- view->height = surface->surface->current->height;
view->xwayland_surface = surface;
view->roots_xwayland_surface = roots_surface;
@@ -315,18 +321,4 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
view->close = close;
view->destroy = destroy;
roots_surface->view = view;
-
- view_map(view, surface->surface);
-
- if (!surface->override_redirect) {
- if (surface->decorations == WLR_XWAYLAND_SURFACE_DECORATIONS_ALL) {
- view->decorated = true;
- view->border_width = 4;
- view->titlebar_height = 12;
- }
-
- view_setup(view);
- } else {
- view_initial_focus(view);
- }
}