@ -35,9 +35,9 @@
struct keyboard ;
struct keyboard ;
struct virtual_keyboard {
struct virtual_keyboard {
struct input_panel * input_panel ;
struct wl_ input_panel * input_panel ;
struct input_method * input_method ;
struct wl_ input_method * input_method ;
struct input_method_context * context ;
struct wl_ input_method_context * context ;
struct display * display ;
struct display * display ;
struct output * output ;
struct output * output ;
char * preedit_string ;
char * preedit_string ;
@ -387,9 +387,9 @@ virtual_keyboard_commit_preedit(struct virtual_keyboard *keyboard)
strlen ( keyboard - > preedit_string ) = = 0 )
strlen ( keyboard - > preedit_string ) = = 0 )
return ;
return ;
input_method_context_cursor_position ( keyboard - > context ,
wl_ input_method_context_cursor_position( keyboard - > context ,
0 , 0 ) ;
0 , 0 ) ;
input_method_context_commit_string ( keyboard - > context ,
wl_ input_method_context_commit_string( keyboard - > context ,
keyboard - > serial ,
keyboard - > serial ,
keyboard - > preedit_string ) ;
keyboard - > preedit_string ) ;
free ( keyboard - > preedit_string ) ;
free ( keyboard - > preedit_string ) ;
@ -403,15 +403,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 )
input_method_context_preedit_styling ( keyboard - > context ,
wl_ input_method_context_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 ;
input_method_context_preedit_cursor ( keyboard - > context ,
wl_ input_method_context_preedit_cursor( keyboard - > context ,
index ) ;
index ) ;
input_method_context_preedit_string ( keyboard - > context ,
wl_ input_method_context_preedit_string( keyboard - > context ,
keyboard - > serial ,
keyboard - > serial ,
keyboard - > preedit_string ,
keyboard - > preedit_string ,
keyboard - > preedit_string ) ;
keyboard - > preedit_string ) ;
@ -438,9 +438,9 @@ keyboard_handle_key(struct keyboard *keyboard, uint32_t time, const struct key *
break ;
break ;
if ( strlen ( keyboard - > keyboard - > preedit_string ) = = 0 ) {
if ( strlen ( keyboard - > keyboard - > preedit_string ) = = 0 ) {
input_method_context_delete_surrounding_text ( keyboard - > keyboard - > context ,
wl_ input_method_context_delete_surrounding_text( keyboard - > keyboard - > context ,
- 1 , 1 ) ;
- 1 , 1 ) ;
input_method_context_commit_string ( keyboard - > keyboard - > context ,
wl_ input_method_context_commit_string( keyboard - > keyboard - > context ,
keyboard - > keyboard - > serial ,
keyboard - > keyboard - > serial ,
" " ) ;
" " ) ;
} else {
} else {
@ -450,7 +450,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 ) ;
input_method_context_keysym ( keyboard - > keyboard - > context ,
wl_ input_method_context_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 ) ;
@ -476,35 +476,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 ) ;
input_method_context_keysym ( keyboard - > keyboard - > context ,
wl_ input_method_context_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 ) ;
input_method_context_keysym ( keyboard - > keyboard - > context ,
wl_ input_method_context_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 ) ;
input_method_context_keysym ( keyboard - > keyboard - > context ,
wl_ input_method_context_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 ) ;
input_method_context_keysym ( keyboard - > keyboard - > context ,
wl_ input_method_context_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 ) ;
input_method_context_keysym ( keyboard - > keyboard - > context ,
wl_ input_method_context_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 ) ;
@ -558,7 +558,7 @@ button_handler(struct widget *widget,
static void
static void
handle_surrounding_text ( void * data ,
handle_surrounding_text ( void * data ,
struct input_method_context * context ,
struct wl_ input_method_context * context ,
const char * text ,
const char * text ,
uint32_t cursor ,
uint32_t cursor ,
uint32_t anchor )
uint32_t anchor )
@ -571,7 +571,7 @@ handle_surrounding_text(void *data,
static void
static void
handle_reset ( void * data ,
handle_reset ( void * data ,
struct input_method_context * context )
struct wl_ input_method_context * context )
{
{
struct virtual_keyboard * keyboard = data ;
struct virtual_keyboard * keyboard = data ;
@ -585,7 +585,7 @@ handle_reset(void *data,
static void
static void
handle_content_type ( void * data ,
handle_content_type ( void * data ,
struct input_method_context * context ,
struct wl_ input_method_context * context ,
uint32_t hint ,
uint32_t hint ,
uint32_t purpose )
uint32_t purpose )
{
{
@ -597,7 +597,7 @@ handle_content_type(void *data,
static void
static void
handle_invoke_action ( void * data ,
handle_invoke_action ( void * data ,
struct input_method_context * context ,
struct wl_ input_method_context * context ,
uint32_t button ,
uint32_t button ,
uint32_t index )
uint32_t index )
{
{
@ -611,7 +611,7 @@ handle_invoke_action(void *data,
static void
static void
handle_commit_state ( void * data ,
handle_commit_state ( void * data ,
struct input_method_context * context ,
struct wl_ input_method_context * context ,
uint32_t serial )
uint32_t serial )
{
{
struct virtual_keyboard * keyboard = data ;
struct virtual_keyboard * keyboard = data ;
@ -628,15 +628,15 @@ handle_commit_state(void *data,
layout - > columns * key_width ,
layout - > columns * key_width ,
layout - > rows * key_height ) ;
layout - > rows * key_height ) ;
input_method_context_language ( context , keyboard - > serial , layout - > language ) ;
wl_ input_method_context_language( context , keyboard - > serial , layout - > language ) ;
input_method_context_text_direction ( context , keyboard - > serial , layout - > text_direction ) ;
wl_ input_method_context_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 input_method_context * context ,
struct wl_ input_method_context * context ,
const char * language )
const char * language )
{
{
struct virtual_keyboard * keyboard = data ;
struct virtual_keyboard * keyboard = data ;
@ -650,7 +650,7 @@ handle_preferred_language(void *data,
keyboard - > preferred_language = strdup ( language ) ;
keyboard - > preferred_language = strdup ( language ) ;
}
}
static const struct input_method_context_listener input_method_context_listener = {
static const struct wl_ input_method_context_listener input_method_context_listener = {
handle_surrounding_text ,
handle_surrounding_text ,
handle_reset ,
handle_reset ,
handle_content_type ,
handle_content_type ,
@ -661,8 +661,8 @@ static const struct input_method_context_listener input_method_context_listener
static void
static void
input_method_activate ( void * data ,
input_method_activate ( void * data ,
struct input_method * input_method ,
struct wl_ input_method * input_method ,
struct input_method_context * context )
struct wl_ input_method_context * context )
{
{
struct virtual_keyboard * keyboard = data ;
struct virtual_keyboard * keyboard = data ;
struct wl_array modifiers_map ;
struct wl_array modifiers_map ;
@ -671,7 +671,7 @@ input_method_activate(void *data,
keyboard - > keyboard - > state = keyboardstate_default ;
keyboard - > keyboard - > state = keyboardstate_default ;
if ( keyboard - > context )
if ( keyboard - > context )
input_method_context_destroy ( keyboard - > context ) ;
wl_ input_method_context_destroy( keyboard - > context ) ;
if ( keyboard - > preedit_string )
if ( keyboard - > preedit_string )
free ( keyboard - > preedit_string ) ;
free ( keyboard - > preedit_string ) ;
@ -687,7 +687,7 @@ input_method_activate(void *data,
keyboard - > serial = 0 ;
keyboard - > serial = 0 ;
keyboard - > context = context ;
keyboard - > context = context ;
input_method_context_add_listener ( context ,
wl_ input_method_context_add_listener( context ,
& input_method_context_listener ,
& input_method_context_listener ,
keyboard ) ;
keyboard ) ;
@ -695,7 +695,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 " ) ;
input_method_context_modifiers_map ( context , & modifiers_map ) ;
wl_ input_method_context_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 ) ;
@ -705,27 +705,27 @@ input_method_activate(void *data,
layout - > columns * key_width ,
layout - > columns * key_width ,
layout - > rows * key_height ) ;
layout - > rows * key_height ) ;
input_method_context_language ( context , keyboard - > serial , layout - > language ) ;
wl_ input_method_context_language( context , keyboard - > serial , layout - > language ) ;
input_method_context_text_direction ( context , keyboard - > serial , layout - > text_direction ) ;
wl_ input_method_context_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 input_method * input_method ,
struct wl_ input_method * input_method ,
struct input_method_context * context )
struct wl_ input_method_context * context )
{
{
struct virtual_keyboard * keyboard = data ;
struct virtual_keyboard * keyboard = data ;
if ( ! keyboard - > context )
if ( ! keyboard - > context )
return ;
return ;
input_method_context_destroy ( keyboard - > context ) ;
wl_ input_method_context_destroy( keyboard - > context ) ;
keyboard - > context = NULL ;
keyboard - > context = NULL ;
}
}
static const struct input_method_listener input_method_listener = {
static const struct wl_ input_method_listener input_method_listener = {
input_method_activate ,
input_method_activate ,
input_method_deactivate
input_method_deactivate
} ;
} ;
@ -736,14 +736,14 @@ global_handler(struct display *display, uint32_t name,
{
{
struct virtual_keyboard * keyboard = data ;
struct virtual_keyboard * keyboard = data ;
if ( ! strcmp ( interface , " input_panel " ) ) {
if ( ! strcmp ( interface , " wl_ input_panel" ) ) {
keyboard - > input_panel =
keyboard - > input_panel =
display_bind ( display , name , & input_panel_interface , 1 ) ;
display_bind ( display , name , & wl_ input_panel_interface, 1 ) ;
} else if ( ! strcmp ( interface , " input_method " ) ) {
} else if ( ! strcmp ( interface , " wl_ input_method" ) ) {
keyboard - > input_method =
keyboard - > input_method =
display_bind ( display , name ,
display_bind ( display , name ,
& input_method_interface , 1 ) ;
& wl_ input_method_interface, 1 ) ;
input_method_add_listener ( keyboard - > input_method , & input_method_listener , keyboard ) ;
wl_ input_method_add_listener( keyboard - > input_method , & input_method_listener , keyboard ) ;
}
}
}
}
@ -752,7 +752,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 input_panel_surface * ips ;
struct wl_ input_panel_surface * ips ;
layout = get_current_layout ( virtual_keyboard ) ;
layout = get_current_layout ( virtual_keyboard ) ;
@ -777,12 +777,12 @@ keyboard_create(struct output *output, struct virtual_keyboard *virtual_keyboard
layout - > rows * key_height ) ;
layout - > rows * key_height ) ;
ips = input_panel_get_input_panel_surface ( virtual_keyboard - > input_panel ,
ips = wl_ input_panel_get_input_panel_surface( virtual_keyboard - > input_panel ,
window_get_wl_surface ( keyboard - > window ) ) ;
window_get_wl_surface ( keyboard - > window ) ) ;
input_panel_surface_set_toplevel ( ips ,
wl_ input_panel_surface_set_toplevel( ips ,
output_get_wl_output ( output ) ,
output_get_wl_output ( output ) ,
INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM ) ;
WL_ INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM) ;
}
}
int
int