diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-03-22 20:06:53 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-03-22 20:06:53 -0400 |
commit | 30b8fb5572cd59c096b00a26c7a41cd674e9337b (patch) | |
tree | 2a7de55685259200422f2bf23cab909fa788db54 /rootston/xwayland.c | |
parent | 8836b167bf0ff152de951f7fdabb1deae85f6e93 (diff) | |
parent | 77d3be66eaabca4309794536984c54a5e94e9eb5 (diff) |
Merge branch 'master' into xdg-positioner
Diffstat (limited to 'rootston/xwayland.c')
-rw-r--r-- | rootston/xwayland.c | 55 |
1 files changed, 15 insertions, 40 deletions
diff --git a/rootston/xwayland.c b/rootston/xwayland.c index 56f068ea..53331b1f 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -106,11 +106,9 @@ static void set_fullscreen(struct roots_view *view, bool fullscreen) { wlr_xwayland_surface_set_fullscreen(view->xwayland_surface, fullscreen); } -static void handle_destroy(struct wl_listener *listener, void *data) { - struct roots_xwayland_surface *roots_surface = - wl_container_of(listener, roots_surface, destroy); - struct wlr_xwayland_surface *xwayland_surface = - roots_surface->view->xwayland_surface; +static void destroy(struct roots_view *view) { + assert(view->type == ROOTS_XWAYLAND_VIEW); + struct roots_xwayland_surface *roots_surface = view->roots_xwayland_surface; wl_list_remove(&roots_surface->destroy.link); wl_list_remove(&roots_surface->request_configure.link); wl_list_remove(&roots_surface->request_move.link); @@ -118,14 +116,15 @@ static void handle_destroy(struct wl_listener *listener, void *data) { wl_list_remove(&roots_surface->request_maximize.link); wl_list_remove(&roots_surface->map_notify.link); wl_list_remove(&roots_surface->unmap_notify.link); - if (xwayland_surface->mapped) { - wl_list_remove(&roots_surface->view->link); - } - view_finish(roots_surface->view); - free(roots_surface->view); free(roots_surface); } +static void handle_destroy(struct wl_listener *listener, void *data) { + struct roots_xwayland_surface *roots_surface = + wl_container_of(listener, roots_surface, destroy); + view_destroy(roots_surface->view); +} + static void handle_request_configure(struct wl_listener *listener, void *data) { struct roots_xwayland_surface *roots_surface = wl_container_of(listener, roots_surface, request_configure); @@ -231,22 +230,13 @@ static void handle_map_notify(struct wl_listener *listener, void *data) { wl_container_of(listener, roots_surface, map_notify); struct wlr_xwayland_surface *xsurface = data; struct roots_view *view = roots_surface->view; - struct roots_desktop *desktop = view->desktop; - view->wlr_surface = xsurface->surface; view->x = xsurface->x; view->y = xsurface->y; view->width = xsurface->surface->current->width; view->height = xsurface->surface->current->height; - wl_list_insert(&desktop->views, &view->link); - struct wlr_subsurface *subsurface; - wl_list_for_each(subsurface, &view->wlr_surface->subsurface_list, - parent_link) { - subsurface_create(view, subsurface); - } - - view_damage_whole(view); + view_map(view, xsurface->surface); roots_surface->surface_commit.notify = handle_surface_commit; wl_signal_add(&xsurface->surface->events.commit, @@ -260,22 +250,7 @@ static void handle_unmap_notify(struct wl_listener *listener, void *data) { wl_list_remove(&roots_surface->surface_commit.link); - view_damage_whole(view); - - struct roots_view_child *child, *tmp; - wl_list_for_each_safe(child, tmp, &view->children, link) { - child->destroy(child); - } - - if (view->fullscreen_output != NULL) { - output_damage_whole(view->fullscreen_output); - view->fullscreen_output->fullscreen_view = NULL; - view->fullscreen_output = NULL; - } - - view->wlr_surface = NULL; - view->width = view->height = 0; - wl_list_remove(&view->link); + view_unmap(view); } void handle_xwayland_surface(struct wl_listener *listener, void *data) { @@ -317,7 +292,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { wl_signal_add(&surface->surface->events.commit, &roots_surface->surface_commit); - struct roots_view *view = view_create(); + struct roots_view *view = view_create(desktop); if (view == NULL) { free(roots_surface); return; @@ -330,7 +305,6 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { view->xwayland_surface = surface; view->roots_xwayland_surface = roots_surface; - view->wlr_surface = surface->surface; view->activate = activate; view->resize = resize; view->move = move; @@ -338,9 +312,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { view->maximize = maximize; view->set_fullscreen = set_fullscreen; view->close = close; + view->destroy = destroy; roots_surface->view = view; - view_init(view, desktop); - wl_list_insert(&desktop->views, &view->link); + + view_map(view, surface->surface); if (!surface->override_redirect) { if (surface->decorations == WLR_XWAYLAND_SURFACE_DECORATIONS_ALL) { |