Files
gjdwebserver-overlay/gui-libs/wlroots/files/0003-text-input-v3-Add-version-2-requests.patch
T
2026-10-26 18:55:23 +01:00

133 lines
4.9 KiB
Diff

From c2e4c357708b8879ed33a3f991765358fa29102f Mon Sep 17 00:00:00 2001
Message-ID: <c2e4c357708b8879ed33a3f991765358fa29102f.1789130119.git.agx@sigxcpu.org>
In-Reply-To: <48f2eeff1bd020877b9c14c2b84e1a94bf79f3d8.1789130119.git.agx@sigxcpu.org>
References: <48f2eeff1bd020877b9c14c2b84e1a94bf79f3d8.1789130119.git.agx@sigxcpu.org>
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Fri, 11 Sep 2026 12:18:31 +0200
Subject: [PATCH 3/4] text-input-v3: Add version 2 requests
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
include/wlr/types/wlr_text_input_v3.h | 4 ++
types/wlr_text_input_v3.c | 58 +++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
diff --git a/include/wlr/types/wlr_text_input_v3.h b/include/wlr/types/wlr_text_input_v3.h
index 14285688c..d176457c7 100644
--- a/include/wlr/types/wlr_text_input_v3.h
+++ b/include/wlr/types/wlr_text_input_v3.h
@@ -38,6 +38,7 @@ struct wlr_text_input_v3_state {
} content_type;
struct wlr_box cursor_rectangle;
+ enum zwp_text_input_v3_action available_actions;
// Tracks which features were used in the current commit.
// Useful in the enabling commit, where usage means support.
@@ -63,6 +64,9 @@ struct wlr_text_input_v3 {
struct wl_signal commit;
struct wl_signal disable;
struct wl_signal destroy;
+ // v2 additions
+ struct wl_signal show_input_panel;
+ struct wl_signal hide_input_panel;
} events;
struct {
diff --git a/types/wlr_text_input_v3.c b/types/wlr_text_input_v3.c
index 5ec84e120..3fba5bc35 100644
--- a/types/wlr_text_input_v3.c
+++ b/types/wlr_text_input_v3.c
@@ -100,6 +100,8 @@ static void wlr_text_input_destroy(struct wlr_text_input_v3 *text_input) {
assert(wl_list_empty(&text_input->events.commit.listener_list));
assert(wl_list_empty(&text_input->events.disable.listener_list));
assert(wl_list_empty(&text_input->events.destroy.listener_list));
+ assert(wl_list_empty(&text_input->events.show_input_panel.listener_list));
+ assert(wl_list_empty(&text_input->events.hide_input_panel.listener_list));
text_input_clear_focused_surface(text_input);
wl_list_remove(&text_input->seat_destroy.link);
@@ -231,6 +233,56 @@ static void text_input_commit(struct wl_client *client,
}
}
+static void text_input_show_input_panel(struct wl_client *client,
+ struct wl_resource *resource) {
+ struct wlr_text_input_v3 *text_input = text_input_from_resource(resource);
+ if (!text_input) {
+ return;
+ }
+ wl_signal_emit_mutable(&text_input->events.show_input_panel, NULL);
+}
+
+static void text_input_hide_input_panel(struct wl_client *client,
+ struct wl_resource *resource) {
+ struct wlr_text_input_v3 *text_input = text_input_from_resource(resource);
+ if (!text_input) {
+ return;
+ }
+ wl_signal_emit_mutable(&text_input->events.hide_input_panel, NULL);
+}
+
+static void text_input_set_available_actions(struct wl_client *client,
+ struct wl_resource *resource, struct wl_array *actions) {
+ struct wlr_text_input_v3 *text_input = text_input_from_resource(resource);
+ if (!text_input) {
+ return;
+ }
+
+ enum zwp_text_input_v3_action available = ZWP_TEXT_INPUT_V3_ACTION_NONE;
+ uint32_t *action;
+ wl_array_for_each(action, actions) {
+ switch (*action) {
+ case ZWP_TEXT_INPUT_V3_ACTION_SUBMIT:
+ if (available & ZWP_TEXT_INPUT_V3_ACTION_SUBMIT) {
+ wl_resource_post_error(resource,
+ ZWP_TEXT_INPUT_V3_ERROR_INVALID_ACTION,
+ "Duplicate submit action");
+ return;
+ }
+ available |= ZWP_TEXT_INPUT_V3_ACTION_SUBMIT;
+ break;
+ case ZWP_TEXT_INPUT_V3_ACTION_NONE:
+ wl_resource_post_error(resource,
+ ZWP_TEXT_INPUT_V3_ERROR_INVALID_ACTION,
+ "Invalid none action");
+ return;
+ default:
+ wlr_log(WLR_DEBUG, "Unknown action %u", *action);
+ }
+ }
+ text_input->pending.available_actions = available;
+}
+
static const struct zwp_text_input_v3_interface text_input_impl = {
.destroy = text_input_destroy,
.enable = text_input_enable,
@@ -240,6 +292,10 @@ static const struct zwp_text_input_v3_interface text_input_impl = {
.set_content_type = text_input_set_content_type,
.set_cursor_rectangle = text_input_set_cursor_rectangle,
.commit = text_input_commit,
+ // v2 additions
+ .show_input_panel = text_input_show_input_panel,
+ .hide_input_panel = text_input_hide_input_panel,
+ .set_available_actions = text_input_set_available_actions,
};
static const struct zwp_text_input_manager_v3_interface text_input_manager_impl;
@@ -299,6 +355,8 @@ static void text_input_manager_get_text_input(struct wl_client *client,
wl_signal_init(&text_input->events.commit);
wl_signal_init(&text_input->events.disable);
wl_signal_init(&text_input->events.destroy);
+ wl_signal_init(&text_input->events.show_input_panel);
+ wl_signal_init(&text_input->events.hide_input_panel);
text_input->resource = text_input_resource;
wl_resource_set_user_data(text_input_resource, text_input);
--
2.53.0