Commit 35db9a41 authored by Guido Gunther's avatar Guido Gunther
Browse files

rootston: Implement phosh-private's close request

parent 6cdd6813
Pipeline #3983 passed with stage
in 1 minute and 15 seconds
......@@ -12,7 +12,7 @@
#include "rootston/desktop.h"
#include "rootston/phosh.h"
#define PHOSH_PRIVATE_VERSION 2
#define PHOSH_PRIVATE_VERSION 3
static void xdg_switcher_handle_list_xdg_surfaces(struct wl_client *client,
struct wl_resource *resource) {
......@@ -95,6 +95,44 @@ static void xdg_switcher_handle_raise_xdg_surfaces(struct wl_client *client,
}
}
static void xdg_switcher_handle_close_xdg_surfaces(struct wl_client *client,
struct wl_resource *resource,
const char *app_id,
const char *title) {
struct phosh_private_xdg_switcher *xdg_switcher =
phosh_private_xdg_switcher_from_resource(resource);
struct phosh_private *phosh = xdg_switcher->phosh;
struct roots_desktop *desktop = phosh->desktop;
struct roots_view *view, *found_view;
wlr_log(WLR_DEBUG, "will close view %s", app_id);
wl_list_for_each(view, &desktop->views, link) {
switch (view->type) {
case ROOTS_XDG_SHELL_VIEW:
if (view->xdg_surface->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL)
continue;
if (!strcmp(app_id, view->xdg_surface->toplevel->app_id) &&
!strcmp(title, view->xdg_surface->toplevel->title))
found_view = view;
break;
case ROOTS_XDG_SHELL_V6_VIEW:
if (view->xdg_surface_v6->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL)
continue;
if (!strcmp(app_id, view->xdg_surface_v6->toplevel->app_id) &&
!strcmp(title, view->xdg_surface_v6->toplevel->title))
found_view = view;
break;
default:
/* other surface types would go here */
break;
}
}
if (found_view) {
view_close(found_view);
}
}
static void xdg_switcher_handle_destroy(struct wl_client *client,
struct wl_resource *resource) {
......@@ -117,6 +155,7 @@ static const struct phosh_private_xdg_switcher_interface phosh_private_xdg_switc
.destroy = xdg_switcher_handle_destroy,
.list_xdg_surfaces = xdg_switcher_handle_list_xdg_surfaces,
.raise_xdg_surface = xdg_switcher_handle_raise_xdg_surfaces,
.close_xdg_surface = xdg_switcher_handle_close_xdg_surfaces,
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment