imservice: Call show/hide directly

This commit is contained in:
Dorota Czaplejewicz
2019-07-22 16:00:59 +00:00
parent c5d2d76ab1
commit 7e939c36cc
2 changed files with 7 additions and 11 deletions

View File

@ -28,15 +28,11 @@ struct imservice* get_imservice(EekboardContextService *context,
return imservice; return imservice;
} }
void imservice_make_visible(EekboardContextService *context, void imservice_make_visible(EekboardContextService *context) {
struct zwp_input_method_v2 *im) {
(void)im;
eekboard_context_service_show_keyboard (context); eekboard_context_service_show_keyboard (context);
} }
void imservice_try_hide(EekboardContextService *context, void imservice_try_hide(EekboardContextService *context) {
struct zwp_input_method_v2 *im) {
(void)im;
eekboard_context_service_hide_keyboard (context); eekboard_context_service_hide_keyboard (context);
} }

View File

@ -31,10 +31,10 @@ pub mod c {
#[no_mangle] #[no_mangle]
extern "C" { extern "C" {
fn imservice_make_visible(imservice: *const UIManager);
fn imservice_try_hide(imservice: *const UIManager);
fn imservice_destroy_im(im: *mut c::InputMethod); fn imservice_destroy_im(im: *mut c::InputMethod);
fn eekboard_context_service_set_hint_purpose(imservice: *const UIManager, hint: u32, purpose: u32); fn eekboard_context_service_set_hint_purpose(imservice: *const UIManager, hint: u32, purpose: u32);
fn eekboard_context_service_show_keyboard(imservice: *const UIManager);
fn eekboard_context_service_hide_keyboard(imservice: *const UIManager);
} }
// The following defined in Rust. TODO: wrap naked pointers to Rust data inside RefCells to prevent multiple writers // The following defined in Rust. TODO: wrap naked pointers to Rust data inside RefCells to prevent multiple writers
@ -152,13 +152,13 @@ pub mod c {
}; };
if active_changed { if active_changed {
if imservice.current.active { if imservice.current.active {
imservice_make_visible(imservice.ui_manager); eekboard_context_service_show_keyboard(imservice.ui_manager);
eekboard_context_service_set_hint_purpose( eekboard_context_service_set_hint_purpose(
imservice.ui_manager, imservice.ui_manager,
imservice.current.content_hint.bits(), imservice.current.content_hint.bits(),
imservice.current.content_purpose.as_num()); imservice.current.content_purpose.as_num());
} else { } else {
imservice_try_hide(imservice.ui_manager); eekboard_context_service_hide_keyboard(imservice.ui_manager);
} }
} }
} }
@ -176,7 +176,7 @@ pub mod c {
// the keyboard is already decommissioned // the keyboard is already decommissioned
imservice.current.active = false; imservice.current.active = false;
imservice_try_hide(imservice.ui_manager); eekboard_context_service_hide_keyboard(imservice.ui_manager);
} }
// FIXME: destroy and deallocate // FIXME: destroy and deallocate