}
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;
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,
}
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;
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,
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;
}
}
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;
}
}
<arg name="index" type="int"/>
<arg name="length" type="uint"/>
</request>
- <request name="key">
- <arg name="key" type="uint"/>
+ <request name="modifiers_map">
+ <arg name="map" type="array"/>
+ </request>
+ <request name="keysym">
+ <description summary="keysym">
+ 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.
+ </description>
+ <arg name="serial" type="uint"/>
+ <arg name="time" type="uint"/>
+ <arg name="sym" type="uint"/>
<arg name="state" type="uint"/>
+ <arg name="modifiers" type="uint"/>
</request>
<event name="surrounding_text">
<description summary="surrounding text event">
<arg name="length" type="uint"/>
</event>
<event name="preedit_styling"/>
- <event name="key">
- <description summary="key">
+ <event name="modifiers_map">
+ <description summary="modifiers map">
+ 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.
+ </description>
+ <arg name="map" type="array"/>
+ </event>
+ <event name="keysym">
+ <description summary="keysym">
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)
</description>
- <arg name="key" type="uint"/>
+ <arg name="serial" type="uint"/>
+ <arg name="time" type="uint"/>
+ <arg name="sym" type="uint"/>
<arg name="state" type="uint"/>
+ <arg name="modifiers" type="uint"/>
</event>
<event name="selection_replacement"/>
<event name="direction"/>
}
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_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_key(&context->model->resource, key, state);
+ text_model_send_keysym(&context->model->resource, serial, time,
+ sym, state, modifiers);
}
static const struct input_method_context_interface input_method_context_implementation = {
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