aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/types/wlr_seat.h6
-rw-r--r--types/seat/wlr_seat.c10
-rw-r--r--types/seat/wlr_seat_keyboard.c11
-rw-r--r--types/seat/wlr_seat_pointer.c12
-rw-r--r--types/seat/wlr_seat_touch.c11
5 files changed, 46 insertions, 4 deletions
diff --git a/include/types/wlr_seat.h b/include/types/wlr_seat.h
index c39889b6..844faba0 100644
--- a/include/types/wlr_seat.h
+++ b/include/types/wlr_seat.h
@@ -10,18 +10,24 @@ extern const struct wlr_touch_grab_interface default_touch_grab_impl;
void seat_client_create_pointer(struct wlr_seat_client *seat_client,
uint32_t version, uint32_t id);
+void seat_client_create_inert_pointer(struct wl_client *client,
+ uint32_t version, uint32_t id);
void seat_client_destroy_pointer(struct wl_resource *resource);
void seat_client_send_pointer_leave_raw(struct wlr_seat_client *seat_client,
struct wlr_surface *surface);
void seat_client_create_keyboard(struct wlr_seat_client *seat_client,
uint32_t version, uint32_t id);
+void seat_client_create_inert_keyboard(struct wl_client *client,
+ uint32_t version, uint32_t id);
void seat_client_destroy_keyboard(struct wl_resource *resource);
void seat_client_send_keyboard_leave_raw(struct wlr_seat_client *seat_client,
struct wlr_surface *surface);
void seat_client_create_touch(struct wlr_seat_client *seat_client,
uint32_t version, uint32_t id);
+void seat_client_create_inert_touch(struct wl_client *client,
+ uint32_t version, uint32_t id);
void seat_client_destroy_touch(struct wl_resource *resource);
#endif
diff --git a/types/seat/wlr_seat.c b/types/seat/wlr_seat.c
index 0b536d59..73758569 100644
--- a/types/seat/wlr_seat.c
+++ b/types/seat/wlr_seat.c
@@ -16,9 +16,12 @@
static void seat_handle_get_pointer(struct wl_client *client,
struct wl_resource *seat_resource, uint32_t id) {
+ uint32_t version = wl_resource_get_version(seat_resource);
struct wlr_seat_client *seat_client =
wlr_seat_client_from_resource(seat_resource);
if (!seat_client) {
+ // The client still needs a resource, so here's a dummy:
+ seat_client_create_inert_pointer(client, version, id);
return;
}
if (!(seat_client->seat->accumulated_capabilities & WL_SEAT_CAPABILITY_POINTER)) {
@@ -27,15 +30,16 @@ static void seat_handle_get_pointer(struct wl_client *client,
return;
}
- uint32_t version = wl_resource_get_version(seat_resource);
seat_client_create_pointer(seat_client, version, id);
}
static void seat_handle_get_keyboard(struct wl_client *client,
struct wl_resource *seat_resource, uint32_t id) {
+ uint32_t version = wl_resource_get_version(seat_resource);
struct wlr_seat_client *seat_client =
wlr_seat_client_from_resource(seat_resource);
if (!seat_client) {
+ seat_client_create_inert_keyboard(client, version, id);
return;
}
if (!(seat_client->seat->accumulated_capabilities & WL_SEAT_CAPABILITY_KEYBOARD)) {
@@ -44,15 +48,16 @@ static void seat_handle_get_keyboard(struct wl_client *client,
return;
}
- uint32_t version = wl_resource_get_version(seat_resource);
seat_client_create_keyboard(seat_client, version, id);
}
static void seat_handle_get_touch(struct wl_client *client,
struct wl_resource *seat_resource, uint32_t id) {
+ uint32_t version = wl_resource_get_version(seat_resource);
struct wlr_seat_client *seat_client =
wlr_seat_client_from_resource(seat_resource);
if (!seat_client) {
+ seat_client_create_inert_touch(client, version, id);
return;
}
if (!(seat_client->seat->accumulated_capabilities & WL_SEAT_CAPABILITY_TOUCH)) {
@@ -61,7 +66,6 @@ static void seat_handle_get_touch(struct wl_client *client,
return;
}
- uint32_t version = wl_resource_get_version(seat_resource);
seat_client_create_touch(seat_client, version, id);
}
diff --git a/types/seat/wlr_seat_keyboard.c b/types/seat/wlr_seat_keyboard.c
index 874e43ea..0d5a5145 100644
--- a/types/seat/wlr_seat_keyboard.c
+++ b/types/seat/wlr_seat_keyboard.c
@@ -438,6 +438,17 @@ void seat_client_create_keyboard(struct wlr_seat_client *seat_client,
}
}
+void seat_client_create_inert_keyboard(struct wl_client *client,
+ uint32_t version, uint32_t id) {
+ struct wl_resource *resource =
+ wl_resource_create(client, &wl_keyboard_interface, version, id);
+ if (!resource) {
+ wl_client_post_no_memory(client);
+ return;
+ }
+ wl_resource_set_implementation(resource, &keyboard_impl, NULL, NULL);
+}
+
void seat_client_destroy_keyboard(struct wl_resource *resource) {
struct wlr_seat_client *seat_client =
seat_client_from_keyboard_resource(resource);
diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c
index cc4fd441..686a7a03 100644
--- a/types/seat/wlr_seat_pointer.c
+++ b/types/seat/wlr_seat_pointer.c
@@ -487,7 +487,6 @@ bool wlr_seat_pointer_has_grab(struct wlr_seat *seat) {
return seat->pointer_state.grab->interface != &default_pointer_grab_impl;
}
-
void seat_client_create_pointer(struct wlr_seat_client *seat_client,
uint32_t version, uint32_t id) {
struct wl_resource *resource = wl_resource_create(seat_client->client,
@@ -531,6 +530,17 @@ void seat_client_create_pointer(struct wlr_seat_client *seat_client,
}
}
+void seat_client_create_inert_pointer(struct wl_client *client,
+ uint32_t version, uint32_t id) {
+ struct wl_resource *resource =
+ wl_resource_create(client, &wl_pointer_interface, version, id);
+ if (!resource) {
+ wl_client_post_no_memory(client);
+ return;
+ }
+ wl_resource_set_implementation(resource, &pointer_impl, NULL, NULL);
+}
+
void seat_client_destroy_pointer(struct wl_resource *resource) {
struct wlr_seat_client *seat_client =
wlr_seat_client_from_pointer_resource(resource);
diff --git a/types/seat/wlr_seat_touch.c b/types/seat/wlr_seat_touch.c
index a298cf28..764b58e5 100644
--- a/types/seat/wlr_seat_touch.c
+++ b/types/seat/wlr_seat_touch.c
@@ -442,6 +442,17 @@ void seat_client_create_touch(struct wlr_seat_client *seat_client,
}
}
+void seat_client_create_inert_touch(struct wl_client *client, uint32_t version,
+ uint32_t id) {
+ struct wl_resource *resource =
+ wl_resource_create(client, &wl_touch_interface, version, id);
+ if (!resource) {
+ wl_client_post_no_memory(client);
+ return;
+ }
+ wl_resource_set_implementation(resource, &touch_impl, NULL, NULL);
+}
+
void seat_client_destroy_touch(struct wl_resource *resource) {
struct wlr_seat_client *seat_client =
seat_client_from_touch_resource(resource);