aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2019-01-15 09:09:08 +0100
committerGitHub <noreply@github.com>2019-01-15 09:09:08 +0100
commitdc9c91b0a4a973f100ead0c2b1dad9f0699a8a69 (patch)
tree38cc7d876636852c44fedb5d0c7f9e2831099d96
parent10a2c4edec5e4f0877ff4afc83178c3f08b4f063 (diff)
parentb1cdd2b4b3d5bb0eac47bd040df47717a66ee7d9 (diff)
Merge pull request #1461 from c-edw/feature/WLRToplevelAndPopup
Remove wlr_xdg_surface_send_close.
-rw-r--r--include/wlr/types/wlr_xdg_shell.h9
-rw-r--r--rootston/xdg_shell.c4
-rw-r--r--types/xdg_shell/wlr_xdg_surface.c26
3 files changed, 19 insertions, 20 deletions
diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h
index 1bca9ef3..14100fda 100644
--- a/include/wlr/types/wlr_xdg_shell.h
+++ b/include/wlr/types/wlr_xdg_shell.h
@@ -296,9 +296,14 @@ uint32_t wlr_xdg_toplevel_set_tiled(struct wlr_xdg_surface *surface,
uint32_t tiled_edges);
/**
- * Request that this xdg surface closes.
+ * Request that this xdg toplevel closes.
*/
-void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface);
+void wlr_xdg_toplevel_send_close(struct wlr_xdg_surface *surface);
+
+/**
+ * Request that this xdg popup closes.
+ **/
+void wlr_xdg_popup_destroy(struct wlr_xdg_surface *surface);
/**
* Get the geometry for this positioner based on the anchor rect, gravity, and
diff --git a/rootston/xdg_shell.c b/rootston/xdg_shell.c
index da8909ba..918f90ab 100644
--- a/rootston/xdg_shell.c
+++ b/rootston/xdg_shell.c
@@ -248,9 +248,9 @@ static void close(struct roots_view *view) {
struct wlr_xdg_surface *surface = view->xdg_surface;
struct wlr_xdg_popup *popup = NULL;
wl_list_for_each(popup, &surface->popups, link) {
- wlr_xdg_surface_send_close(popup->base);
+ wlr_xdg_popup_destroy(popup->base);
}
- wlr_xdg_surface_send_close(surface);
+ wlr_xdg_toplevel_send_close(surface);
}
static void destroy(struct roots_view *view) {
diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c
index 17edbe47..0e98155a 100644
--- a/types/xdg_shell/wlr_xdg_surface.c
+++ b/types/xdg_shell/wlr_xdg_surface.c
@@ -517,22 +517,16 @@ void wlr_xdg_surface_ping(struct wlr_xdg_surface *surface) {
surface->client->ping_serial);
}
-void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface) {
- switch (surface->role) {
- case WLR_XDG_SURFACE_ROLE_NONE:
- assert(0 && "not reached");
- break;
- case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
- if (surface->toplevel) {
- xdg_toplevel_send_close(surface->toplevel->resource);
- }
- break;
- case WLR_XDG_SURFACE_ROLE_POPUP:
- if (surface->popup) {
- xdg_popup_send_popup_done(surface->popup->resource);
- }
- break;
- }
+void wlr_xdg_toplevel_send_close(struct wlr_xdg_surface *surface) {
+ assert(surface->toplevel);
+ assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
+ xdg_toplevel_send_close(surface->toplevel->resource);
+}
+
+void wlr_xdg_popup_destroy(struct wlr_xdg_surface *surface) {
+ assert(surface->popup);
+ assert(surface->role == WLR_XDG_SURFACE_ROLE_POPUP);
+ xdg_popup_send_popup_done(surface->popup->resource);
}
static void xdg_popup_get_position(struct wlr_xdg_popup *popup,