aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-07-07 22:45:16 +0100
committeremersion <contact@emersion.fr>2018-07-07 22:45:16 +0100
commit33db4263a0706df90946112d34a927103bf26ff9 (patch)
tree294298ed46a1f24396a403117ee6f0a071ddaef7 /include
parentbe54278207f5099b77a538e3043758aa59e5c998 (diff)
surface: replace wlr_surface_set_role_committed with wlr_surface_role
Diffstat (limited to 'include')
-rw-r--r--include/types/wlr_data_device.h2
-rw-r--r--include/types/wlr_xdg_shell.h5
-rw-r--r--include/types/wlr_xdg_shell_v6.h5
-rw-r--r--include/wlr/types/wlr_layer_shell.h2
-rw-r--r--include/wlr/types/wlr_seat.h2
-rw-r--r--include/wlr/types/wlr_surface.h24
-rw-r--r--include/wlr/types/wlr_wl_shell.h4
-rw-r--r--include/wlr/types/wlr_xdg_shell.h3
-rw-r--r--include/wlr/types/wlr_xdg_shell_v6.h3
9 files changed, 27 insertions, 23 deletions
diff --git a/include/types/wlr_data_device.h b/include/types/wlr_data_device.h
index ee423f80..972294ff 100644
--- a/include/types/wlr_data_device.h
+++ b/include/types/wlr_data_device.h
@@ -13,6 +13,8 @@ struct wlr_client_data_source {
struct wl_resource *resource;
};
+extern const struct wlr_surface_role drag_icon_surface_role;
+
struct wlr_data_offer *data_offer_create(struct wl_client *client,
struct wlr_data_source *source, uint32_t version);
void data_offer_update_action(struct wlr_data_offer *offer);
diff --git a/include/types/wlr_xdg_shell.h b/include/types/wlr_xdg_shell.h
index 74f13bbe..7a17d286 100644
--- a/include/types/wlr_xdg_shell.h
+++ b/include/types/wlr_xdg_shell.h
@@ -10,8 +10,8 @@ struct wlr_xdg_positioner_resource {
struct wlr_xdg_positioner attrs;
};
-#define XDG_TOPLEVEL_ROLE "xdg_toplevel"
-#define XDG_POPUP_ROLE "xdg_popup"
+extern const struct wlr_surface_role xdg_toplevel_surface_role;
+extern const struct wlr_surface_role xdg_popup_surface_role;
uint32_t schedule_xdg_surface_configure(struct wlr_xdg_surface *surface);
struct wlr_xdg_surface *create_xdg_surface(
@@ -19,6 +19,7 @@ struct wlr_xdg_surface *create_xdg_surface(
uint32_t id);
void unmap_xdg_surface(struct wlr_xdg_surface *surface);
void destroy_xdg_surface(struct wlr_xdg_surface *surface);
+void handle_xdg_surface_committed(struct wlr_surface *wlr_surface);
void create_xdg_positioner(struct wlr_xdg_client *client, uint32_t id);
struct wlr_xdg_positioner_resource *get_xdg_positioner_from_resource(
diff --git a/include/types/wlr_xdg_shell_v6.h b/include/types/wlr_xdg_shell_v6.h
index b5325998..030c10e4 100644
--- a/include/types/wlr_xdg_shell_v6.h
+++ b/include/types/wlr_xdg_shell_v6.h
@@ -10,8 +10,8 @@ struct wlr_xdg_positioner_v6_resource {
struct wlr_xdg_positioner_v6 attrs;
};
-#define XDG_TOPLEVEL_V6_ROLE "xdg_toplevel_v6"
-#define XDG_POPUP_V6_ROLE "xdg_popup_v6"
+extern const struct wlr_surface_role xdg_toplevel_v6_surface_role;
+extern const struct wlr_surface_role xdg_popup_v6_surface_role;
uint32_t schedule_xdg_surface_v6_configure(struct wlr_xdg_surface_v6 *surface);
struct wlr_xdg_surface_v6 *create_xdg_surface_v6(
@@ -19,6 +19,7 @@ struct wlr_xdg_surface_v6 *create_xdg_surface_v6(
uint32_t id);
void unmap_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface);
void destroy_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface);
+void handle_xdg_surface_v6_committed(struct wlr_surface *wlr_surface);
void create_xdg_positioner_v6(struct wlr_xdg_client_v6 *client, uint32_t id);
struct wlr_xdg_positioner_v6_resource *get_xdg_positioner_v6_from_resource(
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;