diff options
author | Jihoon Kim <jihoon48.kim@samsung.com> | 2015-06-09 14:30:07 +0900 |
---|---|---|
committer | Jihoon Kim <jihoon48.kim@samsung.com> | 2015-06-09 14:30:07 +0900 |
commit | b8bcc35f7a5ac2c65323ca4ed500c8de11df23f2 (patch) | |
tree | 5fca54815968476c047510dae2b6e03c89e6c747 | |
parent | 0c386dbb160b4c04916c1e386e0a911872b9b079 (diff) |
ecore_imf/wayland: support on-demand show mode
In on-demand show mode, input panel will be shown in case of only an user's explicit Mouse Up event.
It doesn't request to show the input panel even though the Input Method Context has focus.
-rw-r--r-- | src/modules/ecore_imf/wayland/wayland_imcontext.c | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/src/modules/ecore_imf/wayland/wayland_imcontext.c b/src/modules/ecore_imf/wayland/wayland_imcontext.c index c47e647c41..760147465a 100644 --- a/src/modules/ecore_imf/wayland/wayland_imcontext.c +++ b/src/modules/ecore_imf/wayland/wayland_imcontext.c | |||
@@ -272,6 +272,40 @@ commit_preedit(WaylandIMContext *imcontext) | |||
272 | (void *)imcontext->preedit_commit); | 272 | (void *)imcontext->preedit_commit); |
273 | } | 273 | } |
274 | 274 | ||
275 | static Eina_Bool | ||
276 | show_input_panel(Ecore_IMF_Context *ctx) | ||
277 | { | ||
278 | WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx); | ||
279 | Ecore_Wl_Input *input; | ||
280 | struct wl_seat *seat; | ||
281 | |||
282 | if ((!imcontext) || (!imcontext->window) || (!imcontext->text_input)) | ||
283 | return EINA_FALSE; | ||
284 | |||
285 | input = ecore_wl_window_keyboard_get(imcontext->window); | ||
286 | if (!input) | ||
287 | return EINA_FALSE; | ||
288 | |||
289 | seat = ecore_wl_input_seat_get(input); | ||
290 | if (!seat) | ||
291 | return EINA_FALSE; | ||
292 | |||
293 | imcontext->input = input; | ||
294 | |||
295 | if (ecore_imf_context_input_panel_enabled_get(ctx)) | ||
296 | { | ||
297 | wl_text_input_show_input_panel(imcontext->text_input); | ||
298 | wl_text_input_activate(imcontext->text_input, seat, | ||
299 | ecore_wl_window_surface_get(imcontext->window)); | ||
300 | |||
301 | wl_text_input_set_content_type(imcontext->text_input, | ||
302 | imcontext->content_hint, | ||
303 | imcontext->content_purpose); | ||
304 | } | ||
305 | |||
306 | return EINA_TRUE; | ||
307 | } | ||
308 | |||
275 | static void | 309 | static void |
276 | text_input_preedit_string(void *data, | 310 | text_input_preedit_string(void *data, |
277 | struct wl_text_input *text_input EINA_UNUSED, | 311 | struct wl_text_input *text_input EINA_UNUSED, |
@@ -621,35 +655,10 @@ wayland_im_context_reset(Ecore_IMF_Context *ctx) | |||
621 | EAPI void | 655 | EAPI void |
622 | wayland_im_context_focus_in(Ecore_IMF_Context *ctx) | 656 | wayland_im_context_focus_in(Ecore_IMF_Context *ctx) |
623 | { | 657 | { |
624 | WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx); | ||
625 | Ecore_Wl_Input *input; | ||
626 | struct wl_seat *seat; | ||
627 | |||
628 | EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "focus-in"); | 658 | EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "focus-in"); |
629 | 659 | ||
630 | if (!imcontext->window) return; | 660 | if (!ecore_imf_context_input_panel_show_on_demand_get (ctx)) |
631 | 661 | show_input_panel(ctx); | |
632 | input = ecore_wl_window_keyboard_get(imcontext->window); | ||
633 | if (!input) | ||
634 | return; | ||
635 | |||
636 | seat = ecore_wl_input_seat_get(input); | ||
637 | if (!seat) | ||
638 | return; | ||
639 | |||
640 | imcontext->input = input; | ||
641 | |||
642 | if ((imcontext->text_input) && | ||
643 | (ecore_imf_context_input_panel_enabled_get(ctx))) | ||
644 | { | ||
645 | wl_text_input_show_input_panel(imcontext->text_input); | ||
646 | wl_text_input_activate(imcontext->text_input, seat, | ||
647 | ecore_wl_window_surface_get(imcontext->window)); | ||
648 | |||
649 | wl_text_input_set_content_type(imcontext->text_input, | ||
650 | imcontext->content_hint, | ||
651 | imcontext->content_purpose); | ||
652 | } | ||
653 | } | 662 | } |
654 | 663 | ||
655 | EAPI void | 664 | EAPI void |
@@ -791,10 +800,14 @@ wayland_im_context_hide(Ecore_IMF_Context *ctx) | |||
791 | } | 800 | } |
792 | 801 | ||
793 | EAPI Eina_Bool | 802 | EAPI Eina_Bool |
794 | wayland_im_context_filter_event(Ecore_IMF_Context *ctx EINA_UNUSED, | 803 | wayland_im_context_filter_event(Ecore_IMF_Context *ctx, |
795 | Ecore_IMF_Event_Type type EINA_UNUSED, | 804 | Ecore_IMF_Event_Type type, |
796 | Ecore_IMF_Event *event EINA_UNUSED) | 805 | Ecore_IMF_Event *event EINA_UNUSED) |
797 | { | 806 | { |
807 | |||
808 | if (type == ECORE_IMF_EVENT_MOUSE_UP) | ||
809 | show_input_panel(ctx); | ||
810 | |||
798 | return EINA_FALSE; | 811 | return EINA_FALSE; |
799 | } | 812 | } |
800 | 813 | ||