imservice: Handle unavailable message
This commit is contained in:
@ -5,9 +5,6 @@
|
||||
#include "eekboard/eekboard-context-service.h"
|
||||
|
||||
|
||||
void imservice_handle_unavailable(void *data, struct zwp_input_method_v2 *input_method) {}
|
||||
|
||||
|
||||
static const struct zwp_input_method_v2_listener input_method_listener = {
|
||||
.activate = imservice_handle_input_method_activate,
|
||||
.deactivate = imservice_handle_input_method_deactivate,
|
||||
@ -42,3 +39,9 @@ void imservice_try_hide(EekboardContextService *context,
|
||||
(void)im;
|
||||
eekboard_context_service_hide_keyboard (context);
|
||||
}
|
||||
|
||||
/// Declared explicitly because _destroy is inline,
|
||||
/// making it unavailable in Rust
|
||||
void imservice_destroy_im(struct zwp_input_method_v2 *im) {
|
||||
zwp_input_method_v2_destroy(im);
|
||||
}
|
||||
|
||||
@ -20,5 +20,6 @@ void imservice_handle_surrounding_text(void *data, struct zwp_input_method_v2 *i
|
||||
void imservice_handle_commit_state(void *data, struct zwp_input_method_v2 *input_method);
|
||||
void imservice_handle_content_type(void *data, struct zwp_input_method_v2 *input_method, uint32_t hint, uint32_t purpose);
|
||||
void imservice_handle_text_change_cause(void *data, struct zwp_input_method_v2 *input_method, uint32_t cause);
|
||||
void imservice_handle_unavailable(void *data, struct zwp_input_method_v2 *input_method);
|
||||
|
||||
#endif
|
||||
|
||||
@ -33,6 +33,7 @@ pub mod 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 eekboard_context_service_set_hint_purpose(imservice: *const UIManager, hint: u32, purpose: u32);
|
||||
}
|
||||
|
||||
@ -162,6 +163,22 @@ pub mod c {
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C"
|
||||
fn imservice_handle_unavailable(imservice: *mut IMService,
|
||||
im: *mut InputMethod)
|
||||
{
|
||||
imservice_destroy_im(im);
|
||||
|
||||
let imservice = &mut *imservice;
|
||||
|
||||
// no need to care about proper double-buffering,
|
||||
// the keyboard is already decommissioned
|
||||
imservice.current.active = false;
|
||||
|
||||
imservice_try_hide(imservice.ui_manager);
|
||||
}
|
||||
|
||||
// FIXME: destroy and deallocate
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user