mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-01 22:58:38 -04:00
compositor: add wlr_surface_role.no_object
This commit allows to make a role as not represented by an object,
which fixes calling role commit handlers for roles like cursor
surfaces.
Fixes: 099b9de752
This commit is contained in:
parent
2d9659d765
commit
753f3cc4fa
5 changed files with 18 additions and 1 deletions
|
|
@ -365,6 +365,7 @@ static void drag_icon_surface_role_commit(struct wlr_surface *surface) {
|
|||
|
||||
const struct wlr_surface_role drag_icon_surface_role = {
|
||||
.name = "wl_data_device-icon",
|
||||
.no_object = true,
|
||||
.commit = drag_icon_surface_role_commit,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ static void pointer_cursor_surface_handle_commit(struct wlr_surface *surface) {
|
|||
|
||||
static const struct wlr_surface_role pointer_cursor_surface_role = {
|
||||
.name = "wl_pointer-cursor",
|
||||
.no_object = true,
|
||||
.commit = pointer_cursor_surface_handle_commit,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ static void tablet_tool_cursor_surface_handle_commit(struct wlr_surface *surface
|
|||
|
||||
static const struct wlr_surface_role tablet_tool_cursor_surface_role = {
|
||||
.name = "wp_tablet_tool-cursor",
|
||||
.no_object = true,
|
||||
.commit = tablet_tool_cursor_surface_handle_commit,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -491,7 +491,8 @@ static void surface_commit_state(struct wlr_surface *surface,
|
|||
surface->pending.seq++;
|
||||
}
|
||||
|
||||
if (surface->role_data != NULL && surface->role->commit != NULL) {
|
||||
if (surface->role != NULL && surface->role->commit != NULL &&
|
||||
(surface->role_data != NULL || surface->role->no_object)) {
|
||||
surface->role->commit(surface);
|
||||
}
|
||||
|
||||
|
|
@ -768,6 +769,7 @@ 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) {
|
||||
assert(role != NULL);
|
||||
assert((role_data == NULL) == role->no_object);
|
||||
|
||||
if (surface->role != NULL && surface->role != role) {
|
||||
if (error_resource != NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue