diff options
Diffstat (limited to '')
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | src/modules/ecore_imf/wayland/wayland_imcontext.c | 62 |
2 files changed, 61 insertions, 2 deletions
@@ -460,3 +460,4 @@ Viacheslav Lvov <v.lvov@samsung.com> | |||
460 | Vitaliy Venzak <v.venzak@samsung.com> | 460 | Vitaliy Venzak <v.venzak@samsung.com> |
461 | perepelits.m <perepelits.m@samsung.com> | 461 | perepelits.m <perepelits.m@samsung.com> |
462 | rustyBSD <rustyBSD@gmx.fr> | 462 | rustyBSD <rustyBSD@gmx.fr> |
463 | Haifeng Deng <haifeng.deng@samsung.com> | ||
diff --git a/src/modules/ecore_imf/wayland/wayland_imcontext.c b/src/modules/ecore_imf/wayland/wayland_imcontext.c index f2a2dce92e..cecd275e86 100644 --- a/src/modules/ecore_imf/wayland/wayland_imcontext.c +++ b/src/modules/ecore_imf/wayland/wayland_imcontext.c | |||
@@ -31,6 +31,11 @@ | |||
31 | 31 | ||
32 | #include "wayland_imcontext.h" | 32 | #include "wayland_imcontext.h" |
33 | 33 | ||
34 | #define HIDE_TIMER_INTERVAL 0.05 | ||
35 | |||
36 | static Eina_Bool _clear_hide_timer(); | ||
37 | static Ecore_Timer *_hide_timer = NULL; | ||
38 | |||
34 | struct _WaylandIMContext | 39 | struct _WaylandIMContext |
35 | { | 40 | { |
36 | Ecore_IMF_Context *ctx; | 41 | Ecore_IMF_Context *ctx; |
@@ -137,6 +142,55 @@ update_state(WaylandIMContext *imcontext) | |||
137 | 142 | ||
138 | wl_text_input_commit_state(imcontext->text_input, ++imcontext->serial); | 143 | wl_text_input_commit_state(imcontext->text_input, ++imcontext->serial); |
139 | } | 144 | } |
145 | |||
146 | _clear_hide_timer(); | ||
147 | } | ||
148 | |||
149 | static Eina_Bool _clear_hide_timer() | ||
150 | { | ||
151 | if (_hide_timer) | ||
152 | { | ||
153 | ecore_timer_del(_hide_timer); | ||
154 | _hide_timer = NULL; | ||
155 | return EINA_TRUE; | ||
156 | } | ||
157 | |||
158 | return EINA_FALSE; | ||
159 | } | ||
160 | |||
161 | static void _send_input_panel_hide_request(Ecore_IMF_Context *ctx) | ||
162 | { | ||
163 | WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx); | ||
164 | if (imcontext && imcontext->text_input) | ||
165 | wl_text_input_hide_input_panel(imcontext->text_input); | ||
166 | } | ||
167 | |||
168 | static Eina_Bool _hide_timer_handler(void *data) | ||
169 | { | ||
170 | Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)data; | ||
171 | _send_input_panel_hide_request(ctx); | ||
172 | |||
173 | _hide_timer = NULL; | ||
174 | return ECORE_CALLBACK_CANCEL; | ||
175 | } | ||
176 | |||
177 | static void _input_panel_hide_timer_start(void *data) | ||
178 | { | ||
179 | if (!_hide_timer) | ||
180 | _hide_timer = ecore_timer_add(HIDE_TIMER_INTERVAL, _hide_timer_handler, data); | ||
181 | } | ||
182 | |||
183 | static void _input_panel_hide(Ecore_IMF_Context *ctx, Eina_Bool instant) | ||
184 | { | ||
185 | if (instant || (_hide_timer && ecore_timer_pending_get(_hide_timer) <= 0.0)) | ||
186 | { | ||
187 | _clear_hide_timer(); | ||
188 | _send_input_panel_hide_request(ctx); | ||
189 | } | ||
190 | else | ||
191 | { | ||
192 | _input_panel_hide_timer_start(ctx); | ||
193 | } | ||
140 | } | 194 | } |
141 | 195 | ||
142 | static Eina_Bool | 196 | static Eina_Bool |
@@ -311,6 +365,7 @@ show_input_panel(Ecore_IMF_Context *ctx) | |||
311 | 365 | ||
312 | if (ecore_imf_context_input_panel_enabled_get(ctx)) | 366 | if (ecore_imf_context_input_panel_enabled_get(ctx)) |
313 | { | 367 | { |
368 | _clear_hide_timer(); | ||
314 | wl_text_input_show_input_panel(imcontext->text_input); | 369 | wl_text_input_show_input_panel(imcontext->text_input); |
315 | wl_text_input_activate(imcontext->text_input, seat, | 370 | wl_text_input_activate(imcontext->text_input, seat, |
316 | ecore_wl2_window_surface_get(imcontext->window)); | 371 | ecore_wl2_window_surface_get(imcontext->window)); |
@@ -715,7 +770,7 @@ wayland_im_context_focus_out(Ecore_IMF_Context *ctx) | |||
715 | if (imcontext->text_input) | 770 | if (imcontext->text_input) |
716 | { | 771 | { |
717 | if (ecore_imf_context_input_panel_enabled_get(ctx)) | 772 | if (ecore_imf_context_input_panel_enabled_get(ctx)) |
718 | wl_text_input_hide_input_panel(imcontext->text_input); | 773 | _input_panel_hide(ctx, EINA_FALSE); |
719 | 774 | ||
720 | wl_text_input_deactivate(imcontext->text_input, | 775 | wl_text_input_deactivate(imcontext->text_input, |
721 | ecore_wl2_input_seat_get(imcontext->input)); | 776 | ecore_wl2_input_seat_get(imcontext->input)); |
@@ -828,7 +883,10 @@ wayland_im_context_show(Ecore_IMF_Context *ctx) | |||
828 | EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "context_show"); | 883 | EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "context_show"); |
829 | 884 | ||
830 | if (imcontext->text_input) | 885 | if (imcontext->text_input) |
831 | wl_text_input_show_input_panel(imcontext->text_input); | 886 | { |
887 | _clear_hide_timer(); | ||
888 | wl_text_input_show_input_panel(imcontext->text_input); | ||
889 | } | ||
832 | } | 890 | } |
833 | 891 | ||
834 | EAPI void | 892 | EAPI void |