From 33db4263a0706df90946112d34a927103bf26ff9 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 7 Jul 2018 22:45:16 +0100 Subject: surface: replace wlr_surface_set_role_committed with wlr_surface_role --- include/wlr/types/wlr_layer_shell.h | 2 +- include/wlr/types/wlr_seat.h | 2 ++ include/wlr/types/wlr_surface.h | 24 ++++++++++-------------- include/wlr/types/wlr_wl_shell.h | 4 ++-- include/wlr/types/wlr_xdg_shell.h | 3 ++- include/wlr/types/wlr_xdg_shell_v6.h | 3 ++- 6 files changed, 19 insertions(+), 19 deletions(-) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_layer_shell.h b/include/wlr/types/wlr_layer_shell.h index 1477989d..8f69cbbb 100644 --- a/include/wlr/types/wlr_layer_shell.h +++ b/include/wlr/types/wlr_layer_shell.h @@ -76,7 +76,7 @@ struct wlr_layer_surface { struct wlr_layer_surface_state server_pending; struct wlr_layer_surface_state current; - struct wl_listener surface_destroy_listener; + struct wl_listener surface_destroy; struct { struct wl_signal destroy; diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 5e04003d..11fd9e15 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -540,4 +540,6 @@ bool wlr_seat_validate_grab_serial(struct wlr_seat *seat, uint32_t serial); struct wlr_seat_client *wlr_seat_client_from_resource( struct wl_resource *resource); +bool wlr_surface_is_pointer_cursor(struct wlr_surface *surface); + #endif diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index b89da87a..93f456cd 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -36,6 +36,11 @@ struct wlr_surface_state { struct wl_listener buffer_destroy; }; +struct wlr_surface_role { + const char *name; + void (*commit)(struct wlr_surface *surface); +}; + struct wlr_surface { struct wl_resource *resource; struct wlr_renderer *renderer; @@ -68,7 +73,9 @@ struct wlr_surface { * the previous commit. */ struct wlr_surface_state current, pending, previous; - const char *role; // the lifetime-bound role or null + + const struct wlr_surface_role *role; // the lifetime-bound role or NULL + void *role_data; // role-specific data struct { struct wl_signal commit; @@ -76,10 +83,6 @@ struct wlr_surface { struct wl_signal destroy; } events; - // surface commit callback for the role that runs before all others - void (*role_committed)(struct wlr_surface *surface, void *role_data); - void *role_data; - struct wl_list subsurfaces; // wlr_subsurface::parent_link // wlr_subsurface::parent_pending_link @@ -137,7 +140,8 @@ struct wlr_surface *wlr_surface_create(struct wl_client *client, * Set the lifetime role for this surface. Returns 0 on success or -1 if the * role cannot be set. */ -int wlr_surface_set_role(struct wlr_surface *surface, const char *role, +bool wlr_surface_set_role(struct wlr_surface *surface, + const struct wlr_surface_role *role, void *role_data, struct wl_resource *error_resource, uint32_t error_code); /** @@ -200,14 +204,6 @@ struct wlr_box; */ void wlr_surface_get_extends(struct wlr_surface *surface, struct wlr_box *box); -/** - * Set a callback for surface commit that runs before all the other callbacks. - * This is intended for use by the surface role. - */ -void wlr_surface_set_role_committed(struct wlr_surface *surface, - void (*role_committed)(struct wlr_surface *surface, void *role_data), - void *role_data); - struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource); /** diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h index b60a0ddd..226b27a0 100644 --- a/include/wlr/types/wlr_wl_shell.h +++ b/include/wlr/types/wlr_wl_shell.h @@ -69,7 +69,7 @@ struct wlr_wl_shell_surface { char *title; char *class; - struct wl_listener surface_destroy_listener; + struct wl_listener surface_destroy; struct wlr_wl_shell_surface *parent; struct wl_list popup_link; @@ -152,7 +152,7 @@ struct wlr_surface *wlr_wl_shell_surface_surface_at( bool wlr_surface_is_wl_shell_surface(struct wlr_surface *surface); -struct wlr_wl_surface *wlr_wl_shell_surface_from_wlr_surface( +struct wlr_wl_shell_surface *wlr_wl_shell_surface_from_wlr_surface( struct wlr_surface *surface); /** diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index d2dfaacb..7b1c8f13 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -163,7 +163,8 @@ struct wlr_xdg_surface { struct wlr_box next_geometry; struct wlr_box geometry; - struct wl_listener surface_destroy_listener; + struct wl_listener surface_destroy; + struct wl_listener surface_commit; struct { struct wl_signal destroy; diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index 38f85635..dfefb58b 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -161,7 +161,8 @@ struct wlr_xdg_surface_v6 { struct wlr_box next_geometry; struct wlr_box geometry; - struct wl_listener surface_destroy_listener; + struct wl_listener surface_destroy; + struct wl_listener surface_commit; struct { struct wl_signal destroy; -- cgit v1.2.3