view: add functions view_{un,}minimize

This commit is contained in:
Johan Malm 2020-09-08 20:51:33 +01:00
parent d782e48204
commit 49e499d255
4 changed files with 24 additions and 4 deletions

View 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);

View 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);

View file

@ -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);

View 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)