ecore_imf/wayland: Fix IME hide -> show issue in case of focus-out and then focus-in
Change-Id: I1d3d7023dbd10b78f510380ff3c46087228f9180
This commit is contained in:
parent
a57d301f2a
commit
4b777ec184
1
AUTHORS
1
AUTHORS
|
@ -460,3 +460,4 @@ Viacheslav Lvov <v.lvov@samsung.com>
|
||||||
Vitaliy Venzak <v.venzak@samsung.com>
|
Vitaliy Venzak <v.venzak@samsung.com>
|
||||||
perepelits.m <perepelits.m@samsung.com>
|
perepelits.m <perepelits.m@samsung.com>
|
||||||
rustyBSD <rustyBSD@gmx.fr>
|
rustyBSD <rustyBSD@gmx.fr>
|
||||||
|
Haifeng Deng <haifeng.deng@samsung.com>
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
|
|
||||||
#include "wayland_imcontext.h"
|
#include "wayland_imcontext.h"
|
||||||
|
|
||||||
|
#define HIDE_TIMER_INTERVAL 0.05
|
||||||
|
|
||||||
|
static Eina_Bool _clear_hide_timer();
|
||||||
|
static Ecore_Timer *_hide_timer = NULL;
|
||||||
|
|
||||||
struct _WaylandIMContext
|
struct _WaylandIMContext
|
||||||
{
|
{
|
||||||
Ecore_IMF_Context *ctx;
|
Ecore_IMF_Context *ctx;
|
||||||
|
@ -137,6 +142,55 @@ update_state(WaylandIMContext *imcontext)
|
||||||
|
|
||||||
wl_text_input_commit_state(imcontext->text_input, ++imcontext->serial);
|
wl_text_input_commit_state(imcontext->text_input, ++imcontext->serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_clear_hide_timer();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool _clear_hide_timer()
|
||||||
|
{
|
||||||
|
if (_hide_timer)
|
||||||
|
{
|
||||||
|
ecore_timer_del(_hide_timer);
|
||||||
|
_hide_timer = NULL;
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _send_input_panel_hide_request(Ecore_IMF_Context *ctx)
|
||||||
|
{
|
||||||
|
WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
|
||||||
|
if (imcontext && imcontext->text_input)
|
||||||
|
wl_text_input_hide_input_panel(imcontext->text_input);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool _hide_timer_handler(void *data)
|
||||||
|
{
|
||||||
|
Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)data;
|
||||||
|
_send_input_panel_hide_request(ctx);
|
||||||
|
|
||||||
|
_hide_timer = NULL;
|
||||||
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _input_panel_hide_timer_start(void *data)
|
||||||
|
{
|
||||||
|
if (!_hide_timer)
|
||||||
|
_hide_timer = ecore_timer_add(HIDE_TIMER_INTERVAL, _hide_timer_handler, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _input_panel_hide(Ecore_IMF_Context *ctx, Eina_Bool instant)
|
||||||
|
{
|
||||||
|
if (instant || (_hide_timer && ecore_timer_pending_get(_hide_timer) <= 0.0))
|
||||||
|
{
|
||||||
|
_clear_hide_timer();
|
||||||
|
_send_input_panel_hide_request(ctx);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_input_panel_hide_timer_start(ctx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -311,6 +365,7 @@ show_input_panel(Ecore_IMF_Context *ctx)
|
||||||
|
|
||||||
if (ecore_imf_context_input_panel_enabled_get(ctx))
|
if (ecore_imf_context_input_panel_enabled_get(ctx))
|
||||||
{
|
{
|
||||||
|
_clear_hide_timer();
|
||||||
wl_text_input_show_input_panel(imcontext->text_input);
|
wl_text_input_show_input_panel(imcontext->text_input);
|
||||||
wl_text_input_activate(imcontext->text_input, seat,
|
wl_text_input_activate(imcontext->text_input, seat,
|
||||||
ecore_wl2_window_surface_get(imcontext->window));
|
ecore_wl2_window_surface_get(imcontext->window));
|
||||||
|
@ -715,7 +770,7 @@ wayland_im_context_focus_out(Ecore_IMF_Context *ctx)
|
||||||
if (imcontext->text_input)
|
if (imcontext->text_input)
|
||||||
{
|
{
|
||||||
if (ecore_imf_context_input_panel_enabled_get(ctx))
|
if (ecore_imf_context_input_panel_enabled_get(ctx))
|
||||||
wl_text_input_hide_input_panel(imcontext->text_input);
|
_input_panel_hide(ctx, EINA_FALSE);
|
||||||
|
|
||||||
wl_text_input_deactivate(imcontext->text_input,
|
wl_text_input_deactivate(imcontext->text_input,
|
||||||
ecore_wl2_input_seat_get(imcontext->input));
|
ecore_wl2_input_seat_get(imcontext->input));
|
||||||
|
@ -828,7 +883,10 @@ wayland_im_context_show(Ecore_IMF_Context *ctx)
|
||||||
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "context_show");
|
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "context_show");
|
||||||
|
|
||||||
if (imcontext->text_input)
|
if (imcontext->text_input)
|
||||||
|
{
|
||||||
|
_clear_hide_timer();
|
||||||
wl_text_input_show_input_panel(imcontext->text_input);
|
wl_text_input_show_input_panel(imcontext->text_input);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
|
Loading…
Reference in New Issue