diff --git a/include/labwc.h b/include/labwc.h index 3f9f1243..b30e45b6 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -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); diff --git a/src/cursor.c b/src/cursor.c index 5298ad7d..f2098a01 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -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); diff --git a/src/dbg.c b/src/dbg.c index cd9c9db7..a605a671 100644 --- 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); diff --git a/src/view.c b/src/view.c index 01ff3596..71226046 100644 --- a/src/view.c +++ b/src/view.c @@ -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)