Use input method protocol from wayland-protocols

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Jonas Ådahl 9 years ago committed by Pekka Paalanen
parent 3bcba347a2
commit b57f472c84
  1. 17
      Makefile.am
  2. 102
      clients/keyboard.c
  3. 82
      clients/weston-simple-im.c
  4. 14
      desktop-shell/input-panel.c
  5. 14
      ivi-shell/input-panel-ivi.c
  6. 291
      protocol/input-method.xml
  7. 29
      src/text-backend.c

@ -119,8 +119,8 @@ nodist_weston_SOURCES = \
protocol/text-cursor-position-server-protocol.h \ protocol/text-cursor-position-server-protocol.h \
protocol/text-input-unstable-v1-protocol.c \ protocol/text-input-unstable-v1-protocol.c \
protocol/text-input-unstable-v1-server-protocol.h \ protocol/text-input-unstable-v1-server-protocol.h \
protocol/input-method-protocol.c \ protocol/input-method-unstable-v1-protocol.c \
protocol/input-method-server-protocol.h \ protocol/input-method-unstable-v1-server-protocol.h \
protocol/workspaces-protocol.c \ protocol/workspaces-protocol.c \
protocol/workspaces-server-protocol.h \ protocol/workspaces-server-protocol.h \
protocol/presentation_timing-protocol.c \ protocol/presentation_timing-protocol.c \
@ -696,15 +696,15 @@ weston_keyboard_SOURCES = clients/keyboard.c
nodist_weston_keyboard_SOURCES = \ nodist_weston_keyboard_SOURCES = \
protocol/desktop-shell-client-protocol.h \ protocol/desktop-shell-client-protocol.h \
protocol/desktop-shell-protocol.c \ protocol/desktop-shell-protocol.c \
protocol/input-method-protocol.c \ protocol/input-method-unstable-v1-protocol.c \
protocol/input-method-client-protocol.h protocol/input-method-unstable-v1-client-protocol.h
weston_keyboard_LDADD = libtoytoolkit.la weston_keyboard_LDADD = libtoytoolkit.la
weston_keyboard_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) weston_keyboard_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
weston_simple_im_SOURCES = clients/weston-simple-im.c weston_simple_im_SOURCES = clients/weston-simple-im.c
nodist_weston_simple_im_SOURCES = \ nodist_weston_simple_im_SOURCES = \
protocol/input-method-protocol.c \ protocol/input-method-unstable-v1-protocol.c \
protocol/input-method-client-protocol.h protocol/input-method-unstable-v1-client-protocol.h
weston_simple_im_LDADD = $(CLIENT_LIBS) weston_simple_im_LDADD = $(CLIENT_LIBS)
weston_simple_im_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) weston_simple_im_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
@ -755,8 +755,8 @@ BUILT_SOURCES += \
protocol/text-cursor-position-protocol.c \ protocol/text-cursor-position-protocol.c \
protocol/text-input-unstable-v1-protocol.c \ protocol/text-input-unstable-v1-protocol.c \
protocol/text-input-unstable-v1-client-protocol.h \ protocol/text-input-unstable-v1-client-protocol.h \
protocol/input-method-protocol.c \ protocol/input-method-unstable-v1-protocol.c \
protocol/input-method-client-protocol.h \ protocol/input-method-unstable-v1-client-protocol.h \
protocol/desktop-shell-client-protocol.h \ protocol/desktop-shell-client-protocol.h \
protocol/desktop-shell-protocol.c \ protocol/desktop-shell-protocol.c \
protocol/scaler-client-protocol.h \ protocol/scaler-client-protocol.h \
@ -1342,7 +1342,6 @@ BUILT_SOURCES += \
EXTRA_DIST += \ EXTRA_DIST += \
protocol/desktop-shell.xml \ protocol/desktop-shell.xml \
protocol/screenshooter.xml \ protocol/screenshooter.xml \
protocol/input-method.xml \
protocol/workspaces.xml \ protocol/workspaces.xml \
protocol/text-cursor-position.xml \ protocol/text-cursor-position.xml \
protocol/weston-test.xml \ protocol/weston-test.xml \

@ -32,15 +32,15 @@
#include <cairo.h> #include <cairo.h>
#include "window.h" #include "window.h"
#include "input-method-client-protocol.h" #include "input-method-unstable-v1-client-protocol.h"
#include "text-input-unstable-v1-client-protocol.h" #include "text-input-unstable-v1-client-protocol.h"
struct keyboard; struct keyboard;
struct virtual_keyboard { struct virtual_keyboard {
struct wl_input_panel *input_panel; struct zwp_input_panel_v1 *input_panel;
struct wl_input_method *input_method; struct zwp_input_method_v1 *input_method;
struct wl_input_method_context *context; struct zwp_input_method_context_v1 *context;
struct display *display; struct display *display;
struct output *output; struct output *output;
char *preedit_string; char *preedit_string;
@ -427,9 +427,9 @@ virtual_keyboard_commit_preedit(struct virtual_keyboard *keyboard)
strlen(keyboard->preedit_string) == 0) strlen(keyboard->preedit_string) == 0)
return; return;
wl_input_method_context_cursor_position(keyboard->context, zwp_input_method_context_v1_cursor_position(keyboard->context,
0, 0); 0, 0);
wl_input_method_context_commit_string(keyboard->context, zwp_input_method_context_v1_commit_string(keyboard->context,
keyboard->serial, keyboard->serial,
keyboard->preedit_string); keyboard->preedit_string);
@ -456,15 +456,15 @@ virtual_keyboard_send_preedit(struct virtual_keyboard *keyboard,
uint32_t index = strlen(keyboard->preedit_string); uint32_t index = strlen(keyboard->preedit_string);
if (keyboard->preedit_style) if (keyboard->preedit_style)
wl_input_method_context_preedit_styling(keyboard->context, zwp_input_method_context_v1_preedit_styling(keyboard->context,
0, 0,
strlen(keyboard->preedit_string), strlen(keyboard->preedit_string),
keyboard->preedit_style); keyboard->preedit_style);
if (cursor > 0) if (cursor > 0)
index = cursor; index = cursor;
wl_input_method_context_preedit_cursor(keyboard->context, zwp_input_method_context_v1_preedit_cursor(keyboard->context,
index); index);
wl_input_method_context_preedit_string(keyboard->context, zwp_input_method_context_v1_preedit_string(keyboard->context,
keyboard->serial, keyboard->serial,
keyboard->preedit_string, keyboard->preedit_string,
keyboard->preedit_string); keyboard->preedit_string);
@ -499,10 +499,10 @@ delete_before_cursor(struct virtual_keyboard *keyboard)
end = keyboard->surrounding_text + keyboard->surrounding_cursor; end = keyboard->surrounding_text + keyboard->surrounding_cursor;
wl_input_method_context_delete_surrounding_text(keyboard->context, zwp_input_method_context_v1_delete_surrounding_text(keyboard->context,
(start - keyboard->surrounding_text) - keyboard->surrounding_cursor, (start - keyboard->surrounding_text) - keyboard->surrounding_cursor,
end - start); end - start);
wl_input_method_context_commit_string(keyboard->context, zwp_input_method_context_v1_commit_string(keyboard->context,
keyboard->serial, keyboard->serial,
""); "");
@ -571,7 +571,7 @@ keyboard_handle_key(struct keyboard *keyboard, uint32_t time, const struct key *
break; break;
case keytype_enter: case keytype_enter:
virtual_keyboard_commit_preedit(keyboard->keyboard); virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context, zwp_input_method_context_v1_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display), display_get_serial(keyboard->keyboard->display),
time, time,
XKB_KEY_Return, key_state, mod_mask); XKB_KEY_Return, key_state, mod_mask);
@ -615,35 +615,35 @@ keyboard_handle_key(struct keyboard *keyboard, uint32_t time, const struct key *
break; break;
case keytype_tab: case keytype_tab:
virtual_keyboard_commit_preedit(keyboard->keyboard); virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context, zwp_input_method_context_v1_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display), display_get_serial(keyboard->keyboard->display),
time, time,
XKB_KEY_Tab, key_state, mod_mask); XKB_KEY_Tab, key_state, mod_mask);
break; break;
case keytype_arrow_up: case keytype_arrow_up:
virtual_keyboard_commit_preedit(keyboard->keyboard); virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context, zwp_input_method_context_v1_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display), display_get_serial(keyboard->keyboard->display),
time, time,
XKB_KEY_Up, key_state, mod_mask); XKB_KEY_Up, key_state, mod_mask);
break; break;
case keytype_arrow_left: case keytype_arrow_left:
virtual_keyboard_commit_preedit(keyboard->keyboard); virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context, zwp_input_method_context_v1_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display), display_get_serial(keyboard->keyboard->display),
time, time,
XKB_KEY_Left, key_state, mod_mask); XKB_KEY_Left, key_state, mod_mask);
break; break;
case keytype_arrow_right: case keytype_arrow_right:
virtual_keyboard_commit_preedit(keyboard->keyboard); virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context, zwp_input_method_context_v1_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display), display_get_serial(keyboard->keyboard->display),
time, time,
XKB_KEY_Right, key_state, mod_mask); XKB_KEY_Right, key_state, mod_mask);
break; break;
case keytype_arrow_down: case keytype_arrow_down:
virtual_keyboard_commit_preedit(keyboard->keyboard); virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context, zwp_input_method_context_v1_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display), display_get_serial(keyboard->keyboard->display),
time, time,
XKB_KEY_Down, key_state, mod_mask); XKB_KEY_Down, key_state, mod_mask);
@ -750,7 +750,7 @@ touch_up_handler(struct widget *widget, struct input *input,
static void static void
handle_surrounding_text(void *data, handle_surrounding_text(void *data,
struct wl_input_method_context *context, struct zwp_input_method_context_v1 *context,
const char *text, const char *text,
uint32_t cursor, uint32_t cursor,
uint32_t anchor) uint32_t anchor)
@ -765,7 +765,7 @@ handle_surrounding_text(void *data,
static void static void
handle_reset(void *data, handle_reset(void *data,
struct wl_input_method_context *context) struct zwp_input_method_context_v1 *context)
{ {
struct virtual_keyboard *keyboard = data; struct virtual_keyboard *keyboard = data;
@ -779,7 +779,7 @@ handle_reset(void *data,
static void static void
handle_content_type(void *data, handle_content_type(void *data,
struct wl_input_method_context *context, struct zwp_input_method_context_v1 *context,
uint32_t hint, uint32_t hint,
uint32_t purpose) uint32_t purpose)
{ {
@ -791,7 +791,7 @@ handle_content_type(void *data,
static void static void
handle_invoke_action(void *data, handle_invoke_action(void *data,
struct wl_input_method_context *context, struct zwp_input_method_context_v1 *context,
uint32_t button, uint32_t button,
uint32_t index) uint32_t index)
{ {
@ -805,7 +805,7 @@ handle_invoke_action(void *data,
static void static void
handle_commit_state(void *data, handle_commit_state(void *data,
struct wl_input_method_context *context, struct zwp_input_method_context_v1 *context,
uint32_t serial) uint32_t serial)
{ {
struct virtual_keyboard *keyboard = data; struct virtual_keyboard *keyboard = data;
@ -822,15 +822,19 @@ handle_commit_state(void *data,
layout->columns * key_width, layout->columns * key_width,
layout->rows * key_height); layout->rows * key_height);
wl_input_method_context_language(context, keyboard->serial, layout->language); zwp_input_method_context_v1_language(context,
wl_input_method_context_text_direction(context, keyboard->serial, layout->text_direction); keyboard->serial,
layout->language);
zwp_input_method_context_v1_text_direction(context,
keyboard->serial,
layout->text_direction);
widget_schedule_redraw(keyboard->keyboard->widget); widget_schedule_redraw(keyboard->keyboard->widget);
} }
static void static void
handle_preferred_language(void *data, handle_preferred_language(void *data,
struct wl_input_method_context *context, struct zwp_input_method_context_v1 *context,
const char *language) const char *language)
{ {
struct virtual_keyboard *keyboard = data; struct virtual_keyboard *keyboard = data;
@ -844,7 +848,7 @@ handle_preferred_language(void *data,
keyboard->preferred_language = strdup(language); keyboard->preferred_language = strdup(language);
} }
static const struct wl_input_method_context_listener input_method_context_listener = { static const struct zwp_input_method_context_v1_listener input_method_context_listener = {
handle_surrounding_text, handle_surrounding_text,
handle_reset, handle_reset,
handle_content_type, handle_content_type,
@ -855,8 +859,8 @@ static const struct wl_input_method_context_listener input_method_context_listen
static void static void
input_method_activate(void *data, input_method_activate(void *data,
struct wl_input_method *input_method, struct zwp_input_method_v1 *input_method,
struct wl_input_method_context *context) struct zwp_input_method_context_v1 *context)
{ {
struct virtual_keyboard *keyboard = data; struct virtual_keyboard *keyboard = data;
struct wl_array modifiers_map; struct wl_array modifiers_map;
@ -865,7 +869,7 @@ input_method_activate(void *data,
keyboard->keyboard->state = KEYBOARD_STATE_DEFAULT; keyboard->keyboard->state = KEYBOARD_STATE_DEFAULT;
if (keyboard->context) if (keyboard->context)
wl_input_method_context_destroy(keyboard->context); zwp_input_method_context_v1_destroy(keyboard->context);
if (keyboard->preedit_string) if (keyboard->preedit_string)
free(keyboard->preedit_string); free(keyboard->preedit_string);
@ -881,7 +885,7 @@ input_method_activate(void *data,
keyboard->serial = 0; keyboard->serial = 0;
keyboard->context = context; keyboard->context = context;
wl_input_method_context_add_listener(context, zwp_input_method_context_v1_add_listener(context,
&input_method_context_listener, &input_method_context_listener,
keyboard); keyboard);
@ -889,7 +893,7 @@ input_method_activate(void *data,
keysym_modifiers_add(&modifiers_map, "Shift"); keysym_modifiers_add(&modifiers_map, "Shift");
keysym_modifiers_add(&modifiers_map, "Control"); keysym_modifiers_add(&modifiers_map, "Control");
keysym_modifiers_add(&modifiers_map, "Mod1"); keysym_modifiers_add(&modifiers_map, "Mod1");
wl_input_method_context_modifiers_map(context, &modifiers_map); zwp_input_method_context_v1_modifiers_map(context, &modifiers_map);
keyboard->keysym.shift_mask = keysym_modifiers_get_mask(&modifiers_map, "Shift"); keyboard->keysym.shift_mask = keysym_modifiers_get_mask(&modifiers_map, "Shift");
wl_array_release(&modifiers_map); wl_array_release(&modifiers_map);
@ -899,27 +903,31 @@ input_method_activate(void *data,
layout->columns * key_width, layout->columns * key_width,
layout->rows * key_height); layout->rows * key_height);
wl_input_method_context_language(context, keyboard->serial, layout->language); zwp_input_method_context_v1_language(context,
wl_input_method_context_text_direction(context, keyboard->serial, layout->text_direction); keyboard->serial,
layout->language);
zwp_input_method_context_v1_text_direction(context,
keyboard->serial,
layout->text_direction);
widget_schedule_redraw(keyboard->keyboard->widget); widget_schedule_redraw(keyboard->keyboard->widget);
} }
static void static void
input_method_deactivate(void *data, input_method_deactivate(void *data,
struct wl_input_method *input_method, struct zwp_input_method_v1 *input_method,
struct wl_input_method_context *context) struct zwp_input_method_context_v1 *context)
{ {
struct virtual_keyboard *keyboard = data; struct virtual_keyboard *keyboard = data;
if (!keyboard->context) if (!keyboard->context)
return; return;
wl_input_method_context_destroy(keyboard->context); zwp_input_method_context_v1_destroy(keyboard->context);
keyboard->context = NULL; keyboard->context = NULL;
} }
static const struct wl_input_method_listener input_method_listener = { static const struct zwp_input_method_v1_listener input_method_listener = {
input_method_activate, input_method_activate,
input_method_deactivate input_method_deactivate
}; };
@ -930,14 +938,16 @@ global_handler(struct display *display, uint32_t name,
{ {
struct virtual_keyboard *keyboard = data; struct virtual_keyboard *keyboard = data;
if (!strcmp(interface, "wl_input_panel")) { if (!strcmp(interface, "zwp_input_panel_v1")) {
keyboard->input_panel = keyboard->input_panel =
display_bind(display, name, &wl_input_panel_interface, 1); display_bind(display, name, &zwp_input_panel_v1_interface, 1);
} else if (!strcmp(interface, "wl_input_method")) { } else if (!strcmp(interface, "zwp_input_method_v1")) {
keyboard->input_method = keyboard->input_method =
display_bind(display, name, display_bind(display, name,
&wl_input_method_interface, 1); &zwp_input_method_v1_interface, 1);
wl_input_method_add_listener(keyboard->input_method, &input_method_listener, keyboard); zwp_input_method_v1_add_listener(keyboard->input_method,
&input_method_listener,
keyboard);
} }
} }
@ -946,7 +956,7 @@ keyboard_create(struct output *output, struct virtual_keyboard *virtual_keyboard
{ {
struct keyboard *keyboard; struct keyboard *keyboard;
const struct layout *layout; const struct layout *layout;
struct wl_input_panel_surface *ips; struct zwp_input_panel_surface_v1 *ips;
layout = get_current_layout(virtual_keyboard); layout = get_current_layout(virtual_keyboard);
@ -971,12 +981,12 @@ keyboard_create(struct output *output, struct virtual_keyboard *virtual_keyboard
layout->rows * key_height); layout->rows * key_height);
ips = wl_input_panel_get_input_panel_surface(virtual_keyboard->input_panel, ips = zwp_input_panel_v1_get_input_panel_surface(virtual_keyboard->input_panel,
window_get_wl_surface(keyboard->window)); window_get_wl_surface(keyboard->window));
wl_input_panel_surface_set_toplevel(ips, zwp_input_panel_surface_v1_set_toplevel(ips,
output_get_wl_output(output), output_get_wl_output(output),
WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM); ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
} }
int int

@ -33,7 +33,7 @@
#include <linux/input.h> #include <linux/input.h>
#include "window.h" #include "window.h"
#include "input-method-client-protocol.h" #include "input-method-unstable-v1-client-protocol.h"
enum compose_state { enum compose_state {
state_normal, state_normal,
@ -54,8 +54,8 @@ typedef void (*keyboard_input_key_handler_t)(struct simple_im *keyboard,
enum wl_keyboard_key_state state); enum wl_keyboard_key_state state);
struct simple_im { struct simple_im {
struct wl_input_method *input_method; struct zwp_input_method_v1 *input_method;
struct wl_input_method_context *context; struct zwp_input_method_context_v1 *context;
struct wl_display *display; struct wl_display *display;
struct wl_registry *registry; struct wl_registry *registry;
struct wl_keyboard *keyboard; struct wl_keyboard *keyboard;
@ -105,7 +105,7 @@ static const uint32_t ignore_keys_on_compose[] = {
static void static void
handle_surrounding_text(void *data, handle_surrounding_text(void *data,
struct wl_input_method_context *context, struct zwp_input_method_context_v1 *context,
const char *text, const char *text,
uint32_t cursor, uint32_t cursor,
uint32_t anchor) uint32_t anchor)
@ -115,7 +115,7 @@ handle_surrounding_text(void *data,
static void static void
handle_reset(void *data, handle_reset(void *data,
struct wl_input_method_context *context) struct zwp_input_method_context_v1 *context)
{ {
struct simple_im *keyboard = data; struct simple_im *keyboard = data;
@ -126,7 +126,7 @@ handle_reset(void *data,
static void static void
handle_content_type(void *data, handle_content_type(void *data,
struct wl_input_method_context *context, struct zwp_input_method_context_v1 *context,
uint32_t hint, uint32_t hint,
uint32_t purpose) uint32_t purpose)
{ {
@ -134,7 +134,7 @@ handle_content_type(void *data,
static void static void
handle_invoke_action(void *data, handle_invoke_action(void *data,
struct wl_input_method_context *context, struct zwp_input_method_context_v1 *context,
uint32_t button, uint32_t button,
uint32_t index) uint32_t index)
{ {
@ -142,7 +142,7 @@ handle_invoke_action(void *data,
static void static void
handle_commit_state(void *data, handle_commit_state(void *data,
struct wl_input_method_context *context, struct zwp_input_method_context_v1 *context,
uint32_t serial) uint32_t serial)
{ {
struct simple_im *keyboard = data; struct simple_im *keyboard = data;
@ -152,12 +152,12 @@ handle_commit_state(void *data,
static void static void
handle_preferred_language(void *data, handle_preferred_language(void *data,
struct wl_input_method_context *context, struct zwp_input_method_context_v1 *context,
const char *language) const char *language)
{ {
} }
static const struct wl_input_method_context_listener input_method_context_listener = { static const struct zwp_input_method_context_v1_listener input_method_context_listener = {
handle_surrounding_text, handle_surrounding_text,
handle_reset, handle_reset,
handle_content_type, handle_content_type,
@ -256,7 +256,7 @@ input_method_keyboard_modifiers(void *data,
uint32_t group) uint32_t group)
{ {
struct simple_im *keyboard = data; struct simple_im *keyboard = data;
struct wl_input_method_context *context = keyboard->context; struct zwp_input_method_context_v1 *context = keyboard->context;
xkb_mod_mask_t mask; xkb_mod_mask_t mask;
xkb_state_update_mask(keyboard->state, mods_depressed, xkb_state_update_mask(keyboard->state, mods_depressed,
@ -273,7 +273,7 @@ input_method_keyboard_modifiers(void *data,
if (mask & keyboard->shift_mask) if (mask & keyboard->shift_mask)
keyboard->modifiers |= MOD_SHIFT_MASK; keyboard->modifiers |= MOD_SHIFT_MASK;
wl_input_method_context_modifiers(context, serial, zwp_input_method_context_v1_modifiers(context, serial,
mods_depressed, mods_depressed, mods_depressed, mods_depressed,
mods_latched, group); mods_latched, group);
} }
@ -288,23 +288,23 @@ static const struct wl_keyboard_listener input_method_keyboard_listener = {
static void static void
input_method_activate(void *data, input_method_activate(void *data,
struct wl_input_method *input_method, struct zwp_input_method_v1 *input_method,
struct wl_input_method_context *context) struct zwp_input_method_context_v1 *context)
{ {
struct simple_im *keyboard = data; struct simple_im *keyboard = data;
if (keyboard->context) if (keyboard->context)
wl_input_method_context_destroy(keyboard->context); zwp_input_method_context_v1_destroy(keyboard->context);
keyboard->compose_state = state_normal; keyboard->compose_state = state_normal;
keyboard->serial = 0; keyboard->serial = 0;
keyboard->context = context; keyboard->context = context;
wl_input_method_context_add_listener(context, zwp_input_method_context_v1_add_listener(context,
&input_method_context_listener, &input_method_context_listener,
keyboard); keyboard);
keyboard->keyboard = wl_input_method_context_grab_keyboard(context); keyboard->keyboard = zwp_input_method_context_v1_grab_keyboard(context);
wl_keyboard_add_listener(keyboard->keyboard, wl_keyboard_add_listener(keyboard->keyboard,
&input_method_keyboard_listener, &input_method_keyboard_listener,
keyboard); keyboard);
@ -312,19 +312,19 @@ input_method_activate(void *data,
static void static void
input_method_deactivate(void *data, input_method_deactivate(void *data,
struct wl_input_method *input_method, struct zwp_input_method_v1 *input_method,
struct wl_input_method_context *context) struct zwp_input_method_context_v1 *context)
{ {
struct simple_im *keyboard = data; struct simple_im *keyboard = data;
if (!keyboard->context) if (!keyboard->context)
return; return;
wl_input_method_context_destroy(keyboard->context); zwp_input_method_context_v1_destroy(keyboard->context);
keyboard->context = NULL; keyboard->context = NULL;
} }
static const struct wl_input_method_listener input_method_listener = { static const struct zwp_input_method_v1_listener input_method_listener = {
input_method_activate, input_method_activate,
input_method_deactivate input_method_deactivate
}; };
@ -335,11 +335,11 @@ registry_handle_global(void *data, struct wl_registry *registry,
{ {
struct simple_im *keyboard = data; struct simple_im *keyboard = data;
if (!strcmp(interface, "wl_input_method")) { if (!strcmp(interface, "zwp_input_method_v1")) {
keyboard->input_method = keyboard->input_method =
wl_registry_bind(registry, name, wl_registry_bind(registry, name,
&wl_input_method_interface, 1); &zwp_input_method_v1_interface, 1);
wl_input_method_add_listener(keyboard->input_method, zwp_input_method_v1_add_listener(keyboard->input_method,
&input_method_listener, keyboard); &input_method_listener, keyboard);
} }
} }
@ -379,7 +379,7 @@ simple_im_key_handler(struct simple_im *keyboard,
uint32_t serial, uint32_t time, uint32_t key, uint32_t sym, uint32_t serial, uint32_t time, uint32_t key, uint32_t sym,
enum wl_keyboard_key_state state) enum wl_keyboard_key_state state)
{ {
struct wl_input_method_context *context = keyboard->context; struct zwp_input_method_context_v1 *context = keyboard->context;
char text[64]; char text[64];
if (sym == XKB_KEY_Multi_key && if (sym == XKB_KEY_Multi_key &&
@ -399,7 +399,11 @@ simple_im_key_handler(struct simple_im *keyboard,
for (i = 0; i < sizeof(ignore_keys_on_compose) / sizeof(ignore_keys_on_compose[0]); i++) { for (i = 0; i < sizeof(ignore_keys_on_compose) / sizeof(ignore_keys_on_compose[0]); i++) {
if (sym == ignore_keys_on_compose[i]) { if (sym == ignore_keys_on_compose[i]) {
wl_input_method_context_key(context, keyboard->serial, time, key, state); zwp_input_method_context_v1_key(context,
keyboard->serial,
time,
key,
state);
return; return;
} }
} }
@ -414,14 +418,14 @@ simple_im_key_handler(struct simple_im *keyboard,
if (cs) { if (cs) {
if (cs->keys[i + 1] == 0) { if (cs->keys[i + 1] == 0) {
wl_input_method_context_preedit_cursor(keyboard->context, zwp_input_method_context_v1_preedit_cursor(keyboard->context,
0); 0);
wl_input_method_context_preedit_string(keyboard->context, zwp_input_method_context_v1_preedit_string(keyboard->context,
keyboard->serial, keyboard->serial,
"", ""); "", "");
wl_input_method_context_cursor_position(keyboard->context, zwp_input_method_context_v1_cursor_position(keyboard->context,
0, 0); 0, 0);
wl_input_method_context_commit_string(keyboard->context, zwp_input_method_context_v1_commit_string(keyboard->context,
keyboard->serial, keyboard->serial,
cs->text); cs->text);
keyboard->compose_state = state_normal; keyboard->compose_state = state_normal;
@ -432,9 +436,9 @@ simple_im_key_handler(struct simple_im *keyboard,
idx += xkb_keysym_to_utf8(cs->keys[j], text + idx, sizeof(text) - idx); idx += xkb_keysym_to_utf8(cs->keys[j], text + idx, sizeof(text) - idx);
} }
wl_input_method_context_preedit_cursor(keyboard->context, zwp_input_method_context_v1_preedit_cursor(keyboard->context,
strlen(text)); strlen(text));
wl_input_method_context_preedit_string(keyboard->context, zwp_input_method_context_v1_preedit_string(keyboard->context,
keyboard->serial, keyboard->serial,
text, text,
text); text);
@ -445,14 +449,14 @@ simple_im_key_handler(struct simple_im *keyboard,
for (; j <= i; j++) { for (; j <= i; j++) {
idx += xkb_keysym_to_utf8(keyboard->compose_seq.keys[j], text + idx, sizeof(text) - idx); idx += xkb_keysym_to_utf8(keyboard->compose_seq.keys[j], text + idx, sizeof(text) - idx);
} }
wl_input_method_context_preedit_cursor(keyboard->context, zwp_input_method_context_v1_preedit_cursor(keyboard->context,
0); 0);
wl_input_method_context_preedit_string(keyboard->context, zwp_input_method_context_v1_preedit_string(keyboard->context,
keyboard->serial, keyboard->serial,
"", ""); "", "");
wl_input_method_context_cursor_position(keyboard->context, zwp_input_method_context_v1_cursor_position(keyboard->context,
0, 0); 0, 0);
wl_input_method_context_commit_string(keyboard->context, zwp_input_method_context_v1_commit_string(keyboard->context,
keyboard->serial, keyboard->serial,
text); text);
keyboard->compose_state = state_normal; keyboard->compose_state = state_normal;
@ -461,16 +465,16 @@ simple_im_key_handler(struct simple_im *keyboard,
} }
if (xkb_keysym_to_utf8(sym, text, sizeof(text)) <= 0) { if (xkb_keysym_to_utf8(sym, text, sizeof(text)) <= 0) {
wl_input_method_context_key(context, serial, time, key, state); zwp_input_method_context_v1_key(context, serial, time, key, state);
return; return;
} }
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
return; return;
wl_input_method_context_cursor_position(keyboard->context, zwp_input_method_context_v1_cursor_position(keyboard->context,
0, 0); 0, 0);
wl_input_method_context_commit_string(keyboard->context, zwp_input_method_context_v1_commit_string(keyboard->context,
keyboard->serial, keyboard->serial,
text); text);
} }

@ -31,7 +31,7 @@
#include "shell.h" #include "shell.h"
#include "desktop-shell-server-protocol.h" #include "desktop-shell-server-protocol.h"
#include "input-method-server-protocol.h" #include "input-method-unstable-v1-server-protocol.h"
#include "shared/helpers.h" #include "shared/helpers.h"
struct input_panel_surface { struct input_panel_surface {
@ -290,7 +290,7 @@ input_panel_surface_set_overlay_panel(struct wl_client *client,
input_panel_surface->panel = 1; input_panel_surface->panel = 1;
} }
static const struct wl_input_panel_surface_interface input_panel_surface_implementation = { static const struct zwp_input_panel_surface_v1_interface input_panel_surface_implementation = {
input_panel_surface_set_toplevel, input_panel_surface_set_toplevel,
input_panel_surface_set_overlay_panel input_panel_surface_set_overlay_panel
}; };
@ -332,14 +332,16 @@ input_panel_get_input_panel_surface(struct wl_client *client,
ipsurf->resource = ipsurf->resource =
wl_resource_create(client, wl_resource_create(client,
&wl_input_panel_surface_interface, 1, id); &zwp_input_panel_surface_v1_interface,
1,
id);
wl_resource_set_implementation(ipsurf->resource, wl_resource_set_implementation(ipsurf->resource,
&input_panel_surface_implementation, &input_panel_surface_implementation,
ipsurf, ipsurf,
destroy_input_panel_surface_resource); destroy_input_panel_surface_resource);
} }
static const struct wl_input_panel_interface input_panel_implementation = { static const struct zwp_input_panel_v1_interface input_panel_implementation = {
input_panel_get_input_panel_surface input_panel_get_input_panel_surface
}; };
@ -359,7 +361,7 @@ bind_input_panel(struct wl_client *client,
struct wl_resource *resource; struct wl_resource *resource;
resource = wl_resource_create(client, resource = wl_resource_create(client,
&wl_input_panel_interface, 1, id); &zwp_input_panel_v1_interface, 1, id);
if (shell->input_panel.binding == NULL) { if (shell->input_panel.binding == NULL) {
wl_resource_set_implementation(resource, wl_resource_set_implementation(resource,
@ -398,7 +400,7 @@ input_panel_setup(struct desktop_shell *shell)
wl_list_init(&shell->input_panel.surfaces); wl_list_init(&shell->input_panel.surfaces);
if (wl_global_create(shell->compositor->wl_display, if (wl_global_create(shell->compositor->wl_display,
&wl_input_panel_interface, 1, &zwp_input_panel_v1_interface, 1,
shell, bind_input_panel) == NULL) shell, bind_input_panel) == NULL)
return -1; return -1;

@ -32,7 +32,7 @@
#include <string.h> #include <string.h>
#include "ivi-shell.h" #include "ivi-shell.h"
#include "input-method-server-protocol.h" #include "input-method-unstable-v1-server-protocol.h"
#include "ivi-layout-private.h" #include "ivi-layout-private.h"
#include "shared/helpers.h" #include "shared/helpers.h"
@ -282,7 +282,7 @@ input_panel_surface_set_overlay_panel(struct wl_client *client,
input_panel_surface->panel = 1; input_panel_surface->panel = 1;
} }
static const struct wl_input_panel_surface_interface input_panel_surface_implementation = { static const struct zwp_input_panel_surface_v1_interface input_panel_surface_implementation = {
input_panel_surface_set_toplevel, input_panel_surface_set_toplevel,
input_panel_surface_set_overlay_panel input_panel_surface_set_overlay_panel
}; };
@ -324,14 +324,16 @@ input_panel_get_input_panel_surface(struct wl_client *client,
ipsurf->resource = ipsurf->resource =
wl_resource_create(client, wl_resource_create(client,
&wl_input_panel_surface_interface, 1, id); &zwp_input_panel_surface_v1_interface,
1,
id);
wl_resource_set_implementation(ipsurf->resource, wl_resource_set_implementation(ipsurf->resource,
&input_panel_surface_implementation, &input_panel_surface_implementation,
ipsurf, ipsurf,
destroy_input_panel_surface_resource); destroy_input_panel_surface_resource);
} }
static const struct wl_input_panel_interface input_panel_implementation = { static const struct zwp_input_panel_v1_interface input_panel_implementation = {
input_panel_get_input_panel_surface input_panel_get_input_panel_surface
}; };
@ -351,7 +353,7 @@ bind_input_panel(struct wl_client *client,
struct wl_resource *resource; struct wl_resource *resource;
resource = wl_resource_create(client, resource = wl_resource_create(client,
&wl_input_panel_interface, 1, id); &zwp_input_panel_v1_interface, 1, id);
if (shell->input_panel.binding == NULL) { if (shell->input_panel.binding == NULL) {
wl_resource_set_implementation(resource, wl_resource_set_implementation(resource,
@ -390,7 +392,7 @@ input_panel_setup(struct ivi_shell *shell)
wl_list_init(&shell->input_panel.surfaces); wl_list_init(&shell->input_panel.surfaces);
if (wl_global_create(shell->compositor->wl_display, if (wl_global_create(shell->compositor->wl_display,
&wl_input_panel_interface, 1, &zwp_input_panel_v1_interface, 1,
shell, bind_input_panel) == NULL) shell, bind_input_panel) == NULL)
return -1; return -1;

@ -1,291 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="input_method">
<copyright>
Copyright © 2012, 2013 Intel Corporation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="wl_input_method_context" version="1">
<description summary="input method context">
Corresponds to a text input on input method side. An input method context
is created on text input activation on the input method side. It allows to
receive information about the text input from the application via events.
Input method contexts do not keep state after deactivation and should be
destroyed after deactivation is handled.
Text is generally UTF-8 encoded, indices and lengths are in bytes.
Serials are used to synchronize the state between the text input and
an input method. New serials are sent by the text input in the
commit_state request and are used by the input method to indicate
the known text input state in events like preedit_string, commit_string,
and keysym. The text input can then ignore events from the input method
which are based on an outdated state (for example after a reset).
</description>
<request name="destroy" type="destructor"/>
<request name="commit_string">
<description summary="commit string">
Send the commit string text for insertion to the application.
The text to commit could be either just a single character after a key
press or the result of some composing (pre-edit). It could be also an
empty text when some text should be removed (see
delete_surrounding_text) or when the input cursor should be moved (see
cursor_position).
Any previously set composing text will be removed.
</description>
<arg name="serial" type="uint" summary="serial of the latest known text input state"/>
<arg name="text" type="string"/>
</request>
<request name="preedit_string">
<description summary="pre-edit string">
Send the pre-edit string text to the application text input.
The commit text can be used to replace the preedit text on reset (for
example on unfocus).
Also previously sent preedit_style and preedit_cursor requests are
processed bt the text_input also.
</description>
<arg name="serial" type="uint" summary="serial of the latest known text input state"/>
<arg name="text" type="string"/>
<arg name="commit" type="string"/>
</request>
<request name="preedit_styling">
<description summary="pre-edit styling">
Sets styling information on composing text. The style is applied for
length in bytes from index relative to the beginning of
the composing text (as byte offset). Multiple styles can
be applied to a composing text.
This request should be sent before sending preedit_string request.
</description>
<arg name="index" type="uint"/>
<arg name="length" type="uint"/>
<arg name="style" type="uint"/>
</request>
<request name="preedit_cursor">
<description summary="pre-edit cursor">
Sets the cursor position inside the composing text (as byte offset)
relative to the start of the composing text.
When index is negative no cursor should be displayed.
This request should be sent before sending preedit_string request.
</description>
<arg name="index" type="int"/>
</request>
<request name="delete_surrounding_text">
<description summary="delete text">
This request will be handled on text_input side as part of a directly
following commit_string request.
</description>
<arg name="index" type="int"/>
<arg name="length" type="uint"/>
</request>
<request name="cursor_position">
<description summary="set cursor to a new position">
Sets the cursor and anchor to a new position. Index is the new cursor
position in bytes (when >= 0 relative to the end of inserted text
else relative to beginning of inserted text). Anchor is the new anchor
position in bytes (when >= 0 relative to the end of inserted text, else
relative to beginning of inserted text). When there should be no
selected text anchor should be the same as index.
This request will be handled on text_input side as part of a directly
following commit_string request.
</description>
<arg name="index" type="int"/>
<arg name="anchor" type="int"/>
</request>
<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. Sym is a XKB keysym, state a wl_keyboard key_state.
</description>
<arg name="serial" type="uint" summary="serial of the latest known text input state"/>
<arg name="time" type="uint"/>
<arg name="sym" type="uint"/>
<arg name="state" type="uint"/>
<arg name="modifiers" type="uint"/>
</request>
<request name="grab_keyboard">
<description summary="grab hardware keyboard">
Allows an input method to receive hardware keyboard input and process
key events to generate text events (with pre-edit) over the wire. This
allows input methods which compose multiple key events for inputting
text like it is done for CJK languages.
</description>
<arg name="keyboard" type="new_id" interface="wl_keyboard"/>
</request>
<request name="key">
<description summary="forward key event">
Should be used when filtering key events with grab_keyboard.
When the wl_keyboard::key event is not processed by the input
method itself and should be sent to the client instead, forward it
with this request. The arguments should be the ones from the
wl_keyboard::key event.
For generating custom key events use the keysym request instead.
</description>
<arg name="serial" type="uint" summary="serial from wl_keyboard::key"/>
<arg name="time" type="uint" summary="time from wl_keyboard::key"/>
<arg name="key" type="uint" summary="key from wl_keyboard::key"/>
<arg name="state" type="uint" summary="state from wl_keyboard::key"/>
</request>
<request name="modifiers">
<description summary="forward modifiers event">
Should be used when filtering key events with grab_keyboard.
When the wl_keyboard::modifiers event should be also send to the
client, forward it with this request. The arguments should be the ones
from the wl_keyboard::modifiers event.
</description>
<arg name="serial" type="uint" summary="serial from wl_keyboard::modifiers"/>
<arg name="mods_depressed" type="uint" summary="mods_depressed from wl_keyboard::modifiers"/>
<arg name="mods_latched" type="uint" summary="mods_latched from wl_keyboard::modifiers"/>
<arg name="mods_locked" type="uint" summary="mods_locked from wl_keyboard::modifiers"/>
<arg name="group" type="uint" summary="group from wl_keyboard::modifiers"/>
</request>
<request name="language">
<arg name="serial" type="uint" summary="serial of the latest known text input state"/>
<arg name="language" type="string"/>
</request>
<request name="text_direction">
<arg name="serial" type="uint" summary="serial of the latest known text input state"/>
<arg name="direction" type="uint"/>
</request>
<event name="surrounding_text">
<description summary="surrounding text event">
The plain surrounding text around the input position. Cursor is the
position in bytes within the surrounding text relative to the beginning
of the text. Anchor is the position in bytes of the selection anchor
within the surrounding text relative to the beginning of the text. If
there is no selected text anchor is the same as cursor.
</description>
<arg name="text" type="string"/>
<arg name="cursor" type="uint"/>
<arg name="anchor" type="uint"/>
</event>
<event name="reset">
</event>
<event name="content_type">
<arg name="hint" type="uint"/>
<arg name="purpose" type="uint"/>
</event>
<event name="invoke_action">
<arg name="button" type="uint"/>
<arg name="index" type="uint"/>
</event>
<event name="commit_state">
<arg name="serial" type="uint" summary="serial of text input state"/>
</event>
<event name="preferred_language">
<arg name="language" type="string"/>
</event>
</interface>
<interface name="wl_input_method" version="1">
<description summary="input method">
An input method object is responsible to compose text in response to
input from hardware or virtual keyboards. There is one input method
object per seat. On activate there is a new input method context object
created which allows the input method to communicate with the text input.
</description>
<event name="activate">
<description summary="activate event">
A text input was activated. Creates an input method context object
which allows communication with the text input.
</description>
<arg name="id" type="new_id" interface="wl_input_method_context"/>
</event>
<event name="deactivate">
<description summary="deactivate event">
The text input corresponding to the context argument was deactivated.
The input method context should be destroyed after deactivation is
handled.
</description>
<arg name="context" type="object" interface="wl_input_method_context"/>
</event>
</interface>
<interface name="wl_input_panel" version="1">
<description summary="interface for implementing keyboards">
Only one client can bind this interface at a time.
</description>
<request name="get_input_panel_surface">
<arg name="id" type="new_id" interface="wl_input_panel_surface"/>
<arg name="surface" type="object" interface="wl_surface"/>
</request>
</interface>
<interface name="wl_input_panel_surface" version="1">
<enum name="position">
<entry name="center_bottom" value="0"/>
</enum>
<request name="set_toplevel">
<description summary="set the surface type as a keyboard">
A keyboard surface is only shown when a text input is active.
</description>
<arg name="output" type="object" interface="wl_output"/>
<arg name="position" type="uint"/>
</request>
<request name="set_overlay_panel">
<description summary="set the surface type as an overlay panel">
An overlay panel is shown near the input cursor above the application
window when a text input is active.
</description>
</request>
</interface>
</protocol>

@ -34,7 +34,7 @@
#include "compositor.h" #include "compositor.h"
#include "text-input-unstable-v1-server-protocol.h" #include "text-input-unstable-v1-server-protocol.h"
#include "input-method-server-protocol.h" #include "input-method-unstable-v1-server-protocol.h"
#include "shared/helpers.h" #include "shared/helpers.h"
struct text_input_manager; struct text_input_manager;
@ -127,7 +127,7 @@ deactivate_input_method(struct input_method *input_method)
if (input_method->context && input_method->input_method_binding) { if (input_method->context && input_method->input_method_binding) {
input_method_context_end_keyboard_grab(input_method->context); input_method_context_end_keyboard_grab(input_method->context);
wl_input_method_send_deactivate( zwp_input_method_v1_send_deactivate(
input_method->input_method_binding, input_method->input_method_binding,
input_method->context->resource); input_method->context->resource);
} }
@ -172,7 +172,7 @@ text_input_set_surrounding_text(struct wl_client *client,
&text_input->input_methods, link) { &text_input->input_methods, link) {
if (!input_method->context) if (!input_method->context)
continue; continue;
wl_input_method_context_send_surrounding_text( zwp_input_method_context_v1_send_surrounding_text(
input_method->context->resource, text, cursor, anchor); input_method->context->resource, text, cursor, anchor);
} }
} }
@ -245,7 +245,7 @@ text_input_reset(struct wl_client *client,
&text_input->input_methods, link) { &text_input->input_methods, link) {
if (!input_method->context) if (!input_method->context)
continue; continue;
wl_input_method_context_send_reset( zwp_input_method_context_v1_send_reset(
input_method->context->resource); input_method->context->resource);
} }
} }
@ -283,7 +283,7 @@ text_input_set_content_type(struct wl_client *client,
&text_input->input_methods, link) { &text_input->input_methods, link) {
if (!input_method->context) if (!input_method->context)
continue; continue;
wl_input_method_context_send_content_type( zwp_input_method_context_v1_send_content_type(
input_method->context->resource, hint, purpose); input_method->context->resource, hint, purpose);
} }
} }
@ -301,7 +301,7 @@ text_input_invoke_action(struct wl_client *client,
&text_input->input_methods, link) { &text_input->input_methods, link) {
if (!input_method->context) if (!input_method->context)
continue; continue;
wl_input_method_context_send_invoke_action( zwp_input_method_context_v1_send_invoke_action(
input_method->context->resource, button, index); input_method->context->resource, button, index);
} }
} }
@ -318,7 +318,7 @@ text_input_commit_state(struct wl_client *client,
&text_input->input_methods, link) { &text_input->input_methods, link) {
if (!input_method->context) if (!input_method->context)
continue; continue;
wl_input_method_context_send_commit_state( zwp_input_method_context_v1_send_commit_state(
input_method->context->resource, serial); input_method->context->resource, serial);
} }
} }
@ -368,7 +368,7 @@ text_input_set_preferred_language(struct wl_client *client,
&text_input->input_methods, link) { &text_input->input_methods, link) {
if (!input_method->context) if (!input_method->context)
continue; continue;
wl_input_method_context_send_preferred_language( zwp_input_method_context_v1_send_preferred_language(
input_method->context->resource, language); input_method->context->resource, language);
} }
} }
@ -745,7 +745,7 @@ input_method_context_text_direction(struct wl_client *client,
} }
static const struct wl_input_method_context_interface context_implementation = { static const struct zwp_input_method_context_v1_interface context_implementation = {
input_method_context_destroy, input_method_context_destroy,
input_method_context_commit_string, input_method_context_commit_string,
input_method_context_preedit_string, input_method_context_preedit_string,
@ -794,7 +794,8 @@ input_method_context_create(struct text_input *input,
binding = input_method->input_method_binding; binding = input_method->input_method_binding;
context->resource = context->resource =
wl_resource_create(wl_resource_get_client(binding), wl_resource_create(wl_resource_get_client(binding),
&wl_input_method_context_interface, 1, 0); &zwp_input_method_context_v1_interface,
1, 0);
wl_resource_set_implementation(context->resource, wl_resource_set_implementation(context->resource,
&context_implementation, &context_implementation,
context, destroy_input_method_context); context, destroy_input_method_context);
@ -804,7 +805,7 @@ input_method_context_create(struct text_input *input,
input_method->context = context; input_method->context = context;
wl_input_method_send_activate(binding, context->resource); zwp_input_method_v1_send_activate(binding, context->resource);
} }
static void static void
@ -848,7 +849,8 @@ bind_input_method(struct wl_client *client,
struct wl_resource *resource; struct wl_resource *resource;
resource = resource =
wl_resource_create(client, &wl_input_method_interface, 1, id); wl_resource_create(client,
&zwp_input_method_v1_interface, 1, id);
if (input_method->input_method_binding != NULL) { if (input_method->input_method_binding != NULL) {
wl_resource_post_error(resource, wl_resource_post_error(resource,
@ -999,7 +1001,8 @@ text_backend_seat_created(struct text_backend *text_backend,
input_method->text_backend = text_backend; input_method->text_backend = text_backend;
input_method->input_method_global = input_method->input_method_global =
wl_global_create(ec->wl_display, &wl_input_method_interface, 1, wl_global_create(ec->wl_display,
&zwp_input_method_v1_interface, 1,
input_method, bind_input_method); input_method, bind_input_method);
input_method->destroy_listener.notify = input_method_notifier_destroy; input_method->destroy_listener.notify = input_method_notifier_destroy;

Loading…
Cancel
Save