]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: add functions view_{un,}minimize
authorJohan Malm <jgm323@gmail.com>
Tue, 8 Sep 2020 19:51:33 +0000 (20:51 +0100)
committerJohan Malm <jgm323@gmail.com>
Tue, 8 Sep 2020 19:51:33 +0000 (20:51 +0100)
include/labwc.h
src/cursor.c
src/dbg.c
src/view.c

index 3f9f124377cb320a7b2cbf0dd71ab1b4abd27636..b30e45b69790c68b580e52954fe3dd8384892762 100644 (file)
@@ -178,6 +178,8 @@ void view_init_position(struct view *view);
 struct wlr_box view_get_surface_geometry(struct view *view);
 struct wlr_box view_geometry(struct view *view);
 void view_resize(struct view *view, struct wlr_box geo);
+void view_minimize(struct view *view);
+void view_unminimize(struct view *view);
 void view_focus(struct view *view);
 struct view *view_next(struct server *server, struct view *current);
 bool view_hasfocus(struct view *view);
index 5298ad7d34e7be2562fd6a8d1e5551a8a051429a..f2098a01a138a5b4b94d60126ecd918a6af23ac4 100644 (file)
@@ -202,7 +202,7 @@ void cursor_button(struct wl_listener *listener, void *data)
                        view->impl->close(view);
                        break;
                case LAB_DECO_BUTTON_ICONIFY:
-                       view->impl->unmap(view);
+                       view_minimize(view);
                        break;
                case LAB_DECO_PART_TITLE:
                        interactive_begin(view, LAB_CURSOR_MOVE, 0);
index cd9c9db77fcbaf07cae12883064571e1ab2db790..a605a6711cd1e524e200946141ea36bb836f5df6 100644 (file)
--- a/src/dbg.c
+++ b/src/dbg.c
@@ -50,7 +50,7 @@ static void show_one_xwl_view(struct view *view)
        } else {
                fprintf(stderr, "-");
        }
-       fprintf(stderr, "      %p.4 %s {%d,%d,%d,%d}\n", (void *)view,
+       fprintf(stderr, "      %p %s {%d,%d,%d,%d}\n", (void *)view,
                view->xwayland_surface->class, view->xwayland_surface->x,
                view->xwayland_surface->y, view->xwayland_surface->width,
                view->xwayland_surface->height);
index 01ff35963cac1c993df80e282e17bfcd7f0080b2..712260468b0236ed8fddc18e1e1fccf167bc0ad4 100644 (file)
@@ -69,6 +69,22 @@ void view_resize(struct view *view, struct wlr_box geo)
        view->impl->configure(view, box);
 }
 
+void view_minimize(struct view *view)
+{
+       if (view->minimized == true)
+               return;
+       view->minimized = true;
+       view->impl->unmap(view);
+}
+
+void view_unminimize(struct view *view)
+{
+       if (view->minimized == false)
+               return;
+       view->minimized = false;
+       view->impl->map(view);
+}
+
 static void move_to_front(struct view *view)
 {
        wl_list_remove(&view->link);
@@ -135,8 +151,8 @@ void view_focus(struct view *view)
                return;
 
        /* TODO: messy - sort out */
-       if (!view->mapped) {
-               view->impl->map(view);
+       if (!view->mapped && view->minimized) {
+               view_unminimize(view);
                return;
        }
 
@@ -270,6 +286,8 @@ struct view *view_at(struct server *server, double lx, double ly,
         */
        struct view *view;
        wl_list_for_each (view, &server->views, link) {
+               if (!view->mapped)
+                       continue;
                if (_view_at(view, lx, ly, surface, sx, sy))
                        return view;
                if (!view->show_server_side_deco)