diff --git a/clients/editor.c b/clients/editor.c
index 348041c3..24ccace3 100644
--- a/clients/editor.c
+++ b/clients/editor.c
@@ -361,10 +361,20 @@ text_model_preedit_styling(void *data,
}
static void
-text_model_key(void *data,
- struct text_model *text_model,
- uint32_t key,
- uint32_t state)
+text_model_modifiers_map(void *data,
+ struct text_model *text_model,
+ struct wl_array *map)
+{
+}
+
+static void
+text_model_keysym(void *data,
+ struct text_model *text_model,
+ uint32_t serial,
+ uint32_t time,
+ uint32_t key,
+ uint32_t state,
+ uint32_t modifiers)
{
struct text_entry *entry = data;
const char *state_label;
@@ -454,7 +464,8 @@ static const struct text_model_listener text_model_listener = {
text_model_preedit_string,
text_model_delete_surrounding_text,
text_model_preedit_styling,
- text_model_key,
+ text_model_modifiers_map,
+ text_model_keysym,
text_model_selection_replacement,
text_model_direction,
text_model_locale,
diff --git a/clients/keyboard.c b/clients/keyboard.c
index 1b2a9ba7..d1e5dbff 100644
--- a/clients/keyboard.c
+++ b/clients/keyboard.c
@@ -234,7 +234,7 @@ virtual_keyboard_commit_preedit(struct virtual_keyboard *keyboard)
}
static void
-keyboard_handle_key(struct keyboard *keyboard, const struct key *key)
+keyboard_handle_key(struct keyboard *keyboard, uint32_t time, const struct key *key)
{
const char *label = keyboard->state == keyboardstate_default ? key->label : key->alt;
@@ -259,8 +259,10 @@ keyboard_handle_key(struct keyboard *keyboard, const struct key *key)
break;
case keytype_enter:
virtual_keyboard_commit_preedit(keyboard->keyboard);
- input_method_context_key(keyboard->keyboard->context,
- XKB_KEY_KP_Enter, WL_KEYBOARD_KEY_STATE_PRESSED);
+ input_method_context_keysym(keyboard->keyboard->context,
+ display_get_serial(keyboard->keyboard->display),
+ time,
+ XKB_KEY_KP_Enter, WL_KEYBOARD_KEY_STATE_PRESSED, 0);
break;
case keytype_space:
keyboard->keyboard->preedit_string = strcat(keyboard->keyboard->preedit_string,
@@ -277,28 +279,38 @@ keyboard_handle_key(struct keyboard *keyboard, const struct key *key)
break;
case keytype_tab:
virtual_keyboard_commit_preedit(keyboard->keyboard);
- input_method_context_key(keyboard->keyboard->context,
- XKB_KEY_Tab, WL_KEYBOARD_KEY_STATE_PRESSED);
+ input_method_context_keysym(keyboard->keyboard->context,
+ display_get_serial(keyboard->keyboard->display),
+ time,
+ XKB_KEY_Tab, WL_KEYBOARD_KEY_STATE_PRESSED, 0);
break;
case keytype_arrow_up:
virtual_keyboard_commit_preedit(keyboard->keyboard);
- input_method_context_key(keyboard->keyboard->context,
- XKB_KEY_Up, WL_KEYBOARD_KEY_STATE_PRESSED);
+ input_method_context_keysym(keyboard->keyboard->context,
+ display_get_serial(keyboard->keyboard->display),
+ time,
+ XKB_KEY_Up, WL_KEYBOARD_KEY_STATE_PRESSED, 0);
break;
case keytype_arrow_left:
virtual_keyboard_commit_preedit(keyboard->keyboard);
- input_method_context_key(keyboard->keyboard->context,
- XKB_KEY_Left, WL_KEYBOARD_KEY_STATE_PRESSED);
+ input_method_context_keysym(keyboard->keyboard->context,
+ display_get_serial(keyboard->keyboard->display),
+ time,
+ XKB_KEY_Left, WL_KEYBOARD_KEY_STATE_PRESSED, 0);
break;
case keytype_arrow_right:
virtual_keyboard_commit_preedit(keyboard->keyboard);
- input_method_context_key(keyboard->keyboard->context,
- XKB_KEY_Right, WL_KEYBOARD_KEY_STATE_PRESSED);
+ input_method_context_keysym(keyboard->keyboard->context,
+ display_get_serial(keyboard->keyboard->display),
+ time,
+ XKB_KEY_Right, WL_KEYBOARD_KEY_STATE_PRESSED, 0);
break;
case keytype_arrow_down:
virtual_keyboard_commit_preedit(keyboard->keyboard);
- input_method_context_key(keyboard->keyboard->context,
- XKB_KEY_Down, WL_KEYBOARD_KEY_STATE_PRESSED);
+ input_method_context_keysym(keyboard->keyboard->context,
+ display_get_serial(keyboard->keyboard->display),
+ time,
+ XKB_KEY_Down, WL_KEYBOARD_KEY_STATE_PRESSED, 0);
break;
}
}
@@ -330,7 +342,7 @@ button_handler(struct widget *widget,
for (i = 0; i < sizeof(keys) / sizeof(*keys); ++i) {
col -= keys[i].width;
if (col < 0) {
- keyboard_handle_key(keyboard, &keys[i]);
+ keyboard_handle_key(keyboard, time, &keys[i]);
break;
}
}
diff --git a/protocol/input-method.xml b/protocol/input-method.xml
index 09ab10ce..69b1277a 100644
--- a/protocol/input-method.xml
+++ b/protocol/input-method.xml
@@ -53,9 +53,22 @@
-
-
+
+
+
+
+
+ Notify when a key event was sent. Key events should not be used
+ for normal text input operations, which should be done with
+ commit_string, delete_surrounfing_text, etc. The key event follows
+ the wl_keyboard key event convention. State is a XKB keysym, state a
+ wl_keyboard key_state.
+
+
+
+
+
diff --git a/protocol/text.xml b/protocol/text.xml
index 1b3a4b56..4701f7d0 100644
--- a/protocol/text.xml
+++ b/protocol/text.xml
@@ -113,16 +113,28 @@
-
-
+
+
+ Transfer an array of 0-terminated modifiers names. The position in
+ the array is the index of the modifier as used in the modifiers
+ bitmask in the keysym event.
+
+
+
+
+
Notify when a key event was sent. Key events should not be used
for normal text input operations, which should be done with
commit_string, delete_surrounfing_text, etc. The key event follows
- the wl_keyboard key event convention. Key is a XKB keycode, state a
- wl_keyboard key_state.
+ the wl_keyboard key event convention. State is a XKB keysym, state a
+ wl_keyboard key_state. Modifiers are a mask for effective modifiers
+ (where the modfier indices are set by the modifiers_map event)
-
+
+
+
+
diff --git a/src/text-backend.c b/src/text-backend.c
index ae1f16ce..ece89bb9 100644
--- a/src/text-backend.c
+++ b/src/text-backend.c
@@ -350,14 +350,28 @@ input_method_context_delete_surrounding_text(struct wl_client *client,
}
static void
-input_method_context_key(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t key,
- uint32_t state)
+input_method_context_modifiers_map(struct wl_client *client,
+ struct wl_resource *resource,
+ struct wl_array *map)
{
struct input_method_context *context = resource->data;
- text_model_send_key(&context->model->resource, key, state);
+ text_model_send_modifiers_map(&context->model->resource, map);
+}
+
+static void
+input_method_context_keysym(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t serial,
+ uint32_t time,
+ uint32_t sym,
+ uint32_t state,
+ uint32_t modifiers)
+{
+ struct input_method_context *context = resource->data;
+
+ text_model_send_keysym(&context->model->resource, serial, time,
+ sym, state, modifiers);
}
static const struct input_method_context_interface input_method_context_implementation = {
@@ -365,7 +379,8 @@ static const struct input_method_context_interface input_method_context_implemen
input_method_context_commit_string,
input_method_context_preedit_string,
input_method_context_delete_surrounding_text,
- input_method_context_key
+ input_method_context_modifiers_map,
+ input_method_context_keysym
};
static void