]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xwayland: Add mapped argument to xwayland_view_create()
authorJohn Lindgren <john@jlindgren.net>
Wed, 19 Apr 2023 22:10:07 +0000 (18:10 -0400)
committerJohn Lindgren <john@jlindgren.net>
Sat, 6 May 2023 16:12:13 +0000 (12:12 -0400)
This is a trivial cleanup to make xwayland_view_create() symmetrical with
xwayland_unmanaged_create(), and avoid the need to access view->impl from
xwayland-unmanaged.c.

The return value of xwayland_view_create() is no longer user, so return void.

No functional change.

include/xwayland.h
src/xwayland-unmanaged.c
src/xwayland.c

index a3493038f98b8a5ff14e665af1adfe108dbd8cb5..4626ece1d2af46ea07a685624a38569692141880 100644 (file)
@@ -43,8 +43,8 @@ struct xwayland_view {
 void xwayland_unmanaged_create(struct server *server,
        struct wlr_xwayland_surface *xsurface, bool mapped);
 
-struct xwayland_view *xwayland_view_create(struct server *server,
-       struct wlr_xwayland_surface *xsurface);
+void xwayland_view_create(struct server *server,
+       struct wlr_xwayland_surface *xsurface, bool mapped);
 
 struct wlr_xwayland_surface *xwayland_surface_from_view(struct view *view);
 
index 9aaf42d6fa6631f41885322886524ec7884aa843..d9e71c6e6a12a69ea0e115b0a74b1c989a1347c3 100644 (file)
@@ -146,13 +146,7 @@ unmanaged_handle_override_redirect(struct wl_listener *listener, void *data)
        unmanaged_handle_destroy(&unmanaged->destroy, NULL);
        xsurface->data = NULL;
 
-       struct xwayland_view *xwayland_view = xwayland_view_create(server, xsurface);
-       if (mapped) {
-               struct view *view = &xwayland_view->base;
-               if (view->impl->map) {
-                       view->impl->map(view);
-               }
-       }
+       xwayland_view_create(server, xsurface, mapped);
 }
 
 static void
index 2684263e6aa51f69b0f7c4e127cd30cef97140c9..6cf77420f80dee84c9e6f3efcecceb381778b3b6 100644 (file)
@@ -608,8 +608,9 @@ static const struct view_impl xwayland_view_impl = {
        .move_to_back = xwayland_view_move_to_back,
 };
 
-struct xwayland_view *
-xwayland_view_create(struct server *server, struct wlr_xwayland_surface *xsurface)
+void
+xwayland_view_create(struct server *server,
+               struct wlr_xwayland_surface *xsurface, bool mapped)
 {
        struct xwayland_view *xwayland_view = znew(*xwayland_view);
        struct view *view = &xwayland_view->base;
@@ -669,7 +670,10 @@ xwayland_view_create(struct server *server, struct wlr_xwayland_surface *xsurfac
        wl_signal_add(&xsurface->events.set_override_redirect, &xwayland_view->override_redirect);
 
        wl_list_insert(&view->server->views, &view->link);
-       return xwayland_view;
+
+       if (mapped) {
+               xwayland_view_map(view);
+       }
 }
 
 static void
@@ -686,9 +690,9 @@ handle_new_surface(struct wl_listener *listener, void *data)
         */
        if (xsurface->override_redirect) {
                xwayland_unmanaged_create(server, xsurface, /* mapped */ false);
-               return;
+       } else {
+               xwayland_view_create(server, xsurface, /* mapped */ false);
        }
-       xwayland_view_create(server, xsurface);
 }
 
 static void