]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xwl.c: only add surfaces to view-list on first map
authorJohan Malm <jgm323@gmail.com>
Mon, 31 Aug 2020 07:33:23 +0000 (08:33 +0100)
committerJohan Malm <jgm323@gmail.com>
Mon, 31 Aug 2020 07:33:23 +0000 (08:33 +0100)
X11 apps produce surfaces which are never mapped. Excluding these from
the view-list simplifices the code.

src/debug/dbg.c
src/deco.c
src/view.c
src/xwl.c

index caafcb9c7ae9f66f45943aaf95cc4a56e716ee16..9e26e6020eb8051667bf38f74a63edfb976b4d69 100644 (file)
@@ -44,11 +44,7 @@ static void show_one_xdg_view(struct view *view)
 static void show_one_xwl_view(struct view *view)
 {
        fprintf(stderr, "XWL  ");
-       if (!view->been_mapped) {
-               fprintf(stderr, "- ");
-       } else {
-               fprintf(stderr, "%d ", xwl_nr_parents(view));
-       }
+       fprintf(stderr, "%d ", xwl_nr_parents(view));
        fprintf(stderr, "     %d      ",
                wl_list_length(&view->xwayland_surface->children));
        if (view->mapped) {
@@ -64,7 +60,6 @@ static void show_one_xwl_view(struct view *view)
         * Other variables to consider printing:
         *
         * view->mapped,
-        * view->been_mapped,
         * view->xwayland_surface->override_redirect,
         * wlr_xwayland_or_surface_wants_focus(view->xwayland_surface));
         * view->xwayland_surface->saved_width,
index f24cb2b0ae4ae4d603213347aca7e85bb711bbfb..33c26350b1e386495cb14ac6097131e08e7ba1a5 100644 (file)
@@ -29,11 +29,6 @@ struct wlr_box deco_box(struct view *view, enum deco_part deco_part)
 
        struct wlr_box box = { .x = 0, .y = 0, .width = 0, .height = 0 };
        BUG_ON(!view);
-       BUG_ON(!view->surface);
-       if (!view || !view->surface)
-               return box;
-       BUG_ON(!view->been_mapped);
-       BUG_ON(!view->show_server_side_deco);
        if ((view->w < 1) || (view->h < 1)) {
                warn("view (%p) has no width/height", view);
                return box;
index a9bab272eb924ac68ae5aedf7a3ee570aac3285a..5809b9ec80cab55648fec70f1caba6c4961f9df2 100644 (file)
@@ -3,7 +3,7 @@
 
 static bool is_toplevel(struct view *view)
 {
-       if (!view || !view->been_mapped)
+       if (!view)
                return false;
        switch (view->type) {
        case LAB_XDG_SHELL_VIEW:
@@ -128,9 +128,7 @@ static struct wlr_xwayland_surface *top_parent(struct view *view)
 
 static void move_xwayland_decendants_to_front(struct view *parent)
 {
-       if (parent->type != LAB_XWAYLAND_VIEW)
-               return;
-       if (!parent || !parent->been_mapped)
+       if (!parent || parent->type != LAB_XWAYLAND_VIEW)
                return;
        struct view *view, *next;
        wl_list_for_each_reverse_safe(view, next, &parent->server->views, link)
@@ -140,7 +138,7 @@ static void move_xwayland_decendants_to_front(struct view *parent)
                        break;
                if (view->type != LAB_XWAYLAND_VIEW)
                        continue;
-               if (!view->been_mapped || !view->mapped)
+               if (!view->mapped)
                        continue;
                if (top_parent(view) != parent->xwayland_surface)
                        continue;
@@ -254,8 +252,6 @@ struct view *view_at(struct server *server, double lx, double ly,
         */
        struct view *view;
        wl_list_for_each (view, &server->views, link) {
-               if (!view->been_mapped)
-                       continue;
                if (_view_at(view, lx, ly, surface, sx, sy))
                        return view;
                if (!view->show_server_side_deco)
index 274a590cdb58048ebd9ed0efde0996f55607ce1e..db950c3840eb325769e91cb2c1a6c6a6bf045cde 100644 (file)
--- a/src/xwl.c
+++ b/src/xwl.c
@@ -32,6 +32,7 @@ void xwl_surface_map(struct wl_listener *listener, void *data)
        if (!view->been_mapped) {
                view->show_server_side_deco = has_ssd(view);
                view_init_position(view);
+               wl_list_insert(&view->server->views, &view->link);
        }
        view->been_mapped = true;
 
@@ -62,7 +63,8 @@ void xwl_surface_unmap(struct wl_listener *listener, void *data)
 void xwl_surface_destroy(struct wl_listener *listener, void *data)
 {
        struct view *view = wl_container_of(listener, view, destroy);
-       wl_list_remove(&view->link);
+       if (view->been_mapped)
+               wl_list_remove(&view->link);
        wl_list_remove(&view->map.link);
        wl_list_remove(&view->unmap.link);
        wl_list_remove(&view->destroy.link);
@@ -99,6 +101,4 @@ void xwl_surface_new(struct wl_listener *listener, void *data)
        view->request_configure.notify = xwl_surface_configure;
        wl_signal_add(&xwayland_surface->events.request_configure,
                      &view->request_configure);
-
-       wl_list_insert(&server->views, &view->link);
 }