From 50a8064a9f9e37d05944852b1556f9aefce28ded Mon Sep 17 00:00:00 2001 From: InHong Han Date: Tue, 9 Jan 2018 18:32:23 +0900 Subject: [PATCH] Update Ecore_Wayland API to EFL 1.20 Change-Id: I0dae10c2998eaa2cb628994ac641a6bd14a04a76 --- configure.ac | 4 +- ism/extras/efl_panel/isf_panel_efl.cpp | 20 ++-- ism/extras/efl_panel/remote_input.cpp | 15 +-- ism/extras/wayland_immodule/wayland_imcontext.c | 113 ++++++++++++--------- ism/extras/wayland_immodule/wayland_module.c | 32 +++--- .../panelagent/wayland/isf_wsc_control_ui.cpp | 4 +- .../wayland/wayland_panel_agent_module.cpp | 55 +++++++--- packaging/isf.spec | 4 +- 8 files changed, 148 insertions(+), 99 deletions(-) diff --git a/configure.ac b/configure.ac index 8d7b9c7..6b9ab07 100644 --- a/configure.ac +++ b/configure.ac @@ -258,12 +258,12 @@ fi PKG_CHECK_MODULES(XKBCOMMON, [xkbcommon]) # Check ECORE WAYLAND library -PKG_CHECK_MODULES(ECORE_WL, [ecore-wayland], +PKG_CHECK_MODULES(ECORE_WL, [ecore-wl2], [ISF_HAS_ECOREWL=yes], [ISF_HAS_ECOREWL=no]) if test "$ISF_HAS_ECOREWL" = "yes"; then - AC_DEFINE(HAVE_ECOREWL,1,[Have ecore-wayland functions.]) + AC_DEFINE(HAVE_ECOREWL,1,[Have ecore-wl2 functions.]) fi # Check WAYLAND TEXT INPUT library diff --git a/ism/extras/efl_panel/isf_panel_efl.cpp b/ism/extras/efl_panel/isf_panel_efl.cpp index 14067b3..8370a33 100644 --- a/ism/extras/efl_panel/isf_panel_efl.cpp +++ b/ism/extras/efl_panel/isf_panel_efl.cpp @@ -2272,13 +2272,13 @@ static void ui_candidate_window_resize (int new_width, int new_height) 270, 0, 0, land_height, land_width); */ #else - ecore_wl_window_rotation_geometry_set (elm_win_wl_window_get (_candidate_window), + ecore_wl2_window_rotation_geometry_set ((Ecore_Wl2_Window *)elm_win_wl_window_get (_candidate_window), 0, 0, 0, port_width, port_height); - ecore_wl_window_rotation_geometry_set (elm_win_wl_window_get (_candidate_window), + ecore_wl2_window_rotation_geometry_set ((Ecore_Wl2_Window *)elm_win_wl_window_get (_candidate_window), 90, 0, 0, land_height, land_width); - ecore_wl_window_rotation_geometry_set (elm_win_wl_window_get (_candidate_window), + ecore_wl2_window_rotation_geometry_set ((Ecore_Wl2_Window *)elm_win_wl_window_get (_candidate_window), 180, 0, 0, port_width, port_height); - ecore_wl_window_rotation_geometry_set (elm_win_wl_window_get (_candidate_window), + ecore_wl2_window_rotation_geometry_set ((Ecore_Wl2_Window *)elm_win_wl_window_get (_candidate_window), 270, 0, 0, land_height, land_width); #endif } @@ -3455,13 +3455,13 @@ static void ui_create_native_candidate_window (void) 270, 0, 0, _candidate_land_height_min, _candidate_land_width); */ #else - ecore_wl_window_rotation_geometry_set (elm_win_wl_window_get (_candidate_window), + ecore_wl2_window_rotation_geometry_set ((Ecore_Wl2_Window *)elm_win_wl_window_get (_candidate_window), 0, 0, 0, _candidate_port_width, _candidate_port_height_min); - ecore_wl_window_rotation_geometry_set (elm_win_wl_window_get (_candidate_window), + ecore_wl2_window_rotation_geometry_set ((Ecore_Wl2_Window *)elm_win_wl_window_get (_candidate_window), 90, 0, 0, _candidate_land_height_min, _candidate_land_width); - ecore_wl_window_rotation_geometry_set (elm_win_wl_window_get (_candidate_window), + ecore_wl2_window_rotation_geometry_set ((Ecore_Wl2_Window *)elm_win_wl_window_get (_candidate_window), 180, 0, 0, _candidate_port_width, _candidate_port_height_min); - ecore_wl_window_rotation_geometry_set (elm_win_wl_window_get (_candidate_window), + ecore_wl2_window_rotation_geometry_set ((Ecore_Wl2_Window *)elm_win_wl_window_get (_candidate_window), 270, 0, 0, _candidate_land_height_min, _candidate_land_width); #endif /* Add dim background */ @@ -4217,7 +4217,9 @@ static void efl_get_screen_resolution (int &width, int &height) ecore_x_window_size_get (ecore_x_window_root_first_get (), &scr_w, &scr_h); } #else - ecore_wl_screen_size_get(&scr_w, &scr_h); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + if (wl2_display) + ecore_wl2_display_screen_size_get(wl2_display, &scr_w, &scr_h); #endif } diff --git a/ism/extras/efl_panel/remote_input.cpp b/ism/extras/efl_panel/remote_input.cpp index 67d4467..385be8a 100644 --- a/ism/extras/efl_panel/remote_input.cpp +++ b/ism/extras/efl_panel/remote_input.cpp @@ -28,7 +28,8 @@ #include "remote_input_keycode.h" #include #include -#include +#define EFL_BETA_API_SUPPORT +#include #include #include "isf_debug.h" @@ -99,7 +100,9 @@ static int keycode_get_from_string(char *name) xkb_keysym_t keysym = 0x0; int keycode = 0; - keymap = ecore_wl_input_keymap_get(ecore_wl_input_get()); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + EINA_SAFETY_ON_NULL_GOTO(wl2_display, finish); + keymap = ecore_wl2_input_keymap_get(ecore_wl2_input_default_input_get(wl2_display)); EINA_SAFETY_ON_NULL_GOTO(keymap, finish); keysym = xkb_keysym_from_name(name, XKB_KEYSYM_NO_FLAGS); @@ -205,10 +208,10 @@ void Remote_Input::exit() } static Eina_Bool -_ecore_wl_keymap_update_cb (void *data, int ev_type, void *event) +_ecore_wl2_keymap_update_cb (void *data, int ev_type, void *event) { - Ecore_Wl_Event_Keymap_Update *ev = NULL; - ev = (Ecore_Wl_Event_Keymap_Update *) event; + Ecore_Wl2_Event_Seat_Keymap_Changed *ev = NULL; + ev = (Ecore_Wl2_Event_Seat_Keymap_Changed *) event; if (!ev) { LOGW ("Failed to get keymap event"); @@ -271,7 +274,7 @@ _ecore_wl_keymap_update_cb (void *data, int ev_type, void *event) bool Remote_Input::init_uinput_keyboard_device() { - keymap_update_handler = ecore_event_handler_add (ECORE_WL_EVENT_KEYMAP_UPDATE, _ecore_wl_keymap_update_cb, NULL); + keymap_update_handler = ecore_event_handler_add (ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, _ecore_wl2_keymap_update_cb, NULL); if (!keymap_update_handler) { LOGD ("Add keymap update callback failed"); diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index 61ee1b5..99b64d2 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -26,7 +26,8 @@ #include #include #include -#include +#define EFL_BETA_API_SUPPORT +#include #include #include #include @@ -186,8 +187,8 @@ struct _WaylandIMContext struct wl_text_input_manager *text_input_manager; struct wl_text_input *text_input; - Ecore_Wl_Window *window; - Ecore_Wl_Input *input; + Ecore_Wl2_Window *window; + Ecore_Wl2_Input *input; Evas *canvas; char *preedit_text; @@ -264,9 +265,10 @@ static Eina_Bool show_input_panel(Ecore_IMF_Context *ctx); static void reset_keyboard_geometry () { - if (g_scr_w == 0 || g_scr_h == 0) { - ecore_wl_sync(); - ecore_wl_screen_size_get(&g_scr_w, &g_scr_h); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + if (wl2_display && (g_scr_w == 0 || g_scr_h == 0)) { + ecore_wl2_sync(); + ecore_wl2_display_screen_size_get(wl2_display, &g_scr_w, &g_scr_h); } _keyboard_geometry.x = 0; _keyboard_geometry.y = g_scr_h; @@ -912,20 +914,20 @@ _send_input_panel_hide_request(Ecore_IMF_Context *ctx) static void _conformant_area_free (void *data EINA_UNUSED, void *ev) { - Ecore_Wl_Event_Conformant_Change *e = ev; + Ecore_Wl2_Event_Conformant_Change *e = ev; free(e); e = NULL; } -static void add_conformant_change_event(Ecore_Wl_Window *window) +static void add_conformant_change_event(Ecore_Wl2_Window *window) { - Ecore_Wl_Event_Conformant_Change *ev; - ev = calloc(1, sizeof(Ecore_Wl_Event_Conformant_Change)); + Ecore_Wl2_Event_Conformant_Change *ev; + ev = calloc(1, sizeof(Ecore_Wl2_Event_Conformant_Change)); if (ev) { - ev->win = ecore_wl_window_id_get(window); + ev->win = ecore_wl2_window_id_get(window); ev->part_type = 1; ev->state = 0; - ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, _conformant_area_free, NULL); + ecore_event_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, ev, _conformant_area_free, NULL); } } @@ -934,7 +936,7 @@ static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx) { Eina_Bool reset = EINA_FALSE; Eina_Bool has_conformant = EINA_FALSE; - Ecore_Wl_Window *window = NULL; + Ecore_Wl2_Window *window = NULL; if (!ctx) return EINA_FALSE; @@ -946,7 +948,7 @@ static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx) if (window) { int x = 0, y = 0, w = 0, h = 0; - Eina_Bool result = ecore_wl_window_keyboard_geometry_get(window, &x, &y, &w, &h); + Eina_Bool result = ecore_wl2_window_keyboard_geometry_get(window, &x, &y, &w, &h); if (result) { if (ecore_imf_context_client_canvas_get(ctx) && has_conformant && (w != 0 || h != 0)) { @@ -960,7 +962,7 @@ static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx) } LOGD("reset %d", reset); if (reset) { - ecore_wl_window_keyboard_geometry_set(window, 0, 0, 0, 0); + ecore_wl2_window_keyboard_geometry_set(window, 0, 0, 0, 0); add_conformant_change_event(window); @@ -974,7 +976,7 @@ static void restore_conformant_area(Ecore_IMF_Context *ctx) { Eina_Bool restore = EINA_FALSE; Eina_Bool has_conformant = EINA_FALSE; - Ecore_Wl_Window *window = NULL; + Ecore_Wl2_Window *window = NULL; if (!ctx) return; @@ -986,7 +988,7 @@ static void restore_conformant_area(Ecore_IMF_Context *ctx) if (window) { int x = 0, y = 0, w = 0, h = 0; - Eina_Bool result = ecore_wl_window_keyboard_geometry_get(window, &x, &y, &w, &h); + Eina_Bool result = ecore_wl2_window_keyboard_geometry_get(window, &x, &y, &w, &h); if (result) { if (ecore_imf_context_client_canvas_get(ctx) && has_conformant && (w == 0 || h == 0)) { @@ -996,7 +998,7 @@ static void restore_conformant_area(Ecore_IMF_Context *ctx) } LOGD("restore %d", restore); if (restore) { - ecore_wl_window_keyboard_geometry_set(window, + ecore_wl2_window_keyboard_geometry_set(window, _conformant_area_backup.x, _conformant_area_backup.y, _conformant_area_backup.w, _conformant_area_backup.h); @@ -1283,13 +1285,13 @@ set_focus(Ecore_IMF_Context *ctx) return EINA_FALSE; } - Ecore_Wl_Input *input = ecore_wl_window_keyboard_get(imcontext->window); + Ecore_Wl2_Input *input = ecore_wl2_window_input_get(imcontext->window); if (!input) { LOGW("ctx : %p, Can't get Wl_Input", ctx); return EINA_FALSE; } - struct wl_seat *seat = ecore_wl_input_seat_get(input); + struct wl_seat *seat = ecore_wl2_input_seat_get(input); if (!seat) { LOGW("ctx : %p, Can't get Wl_seat", ctx); return EINA_FALSE; @@ -1299,7 +1301,7 @@ set_focus(Ecore_IMF_Context *ctx) _focused_ctx = ctx; wl_text_input_activate(imcontext->text_input, seat, - ecore_wl_window_surface_get(imcontext->window)); + ecore_wl2_window_surface_get(imcontext->window)); return EINA_TRUE; } @@ -1323,7 +1325,7 @@ set_focus_out(Ecore_IMF_Context *ctx) // deactivate if (imcontext->text_input) wl_text_input_deactivate(imcontext->text_input, - ecore_wl_input_seat_get(imcontext->input)); + ecore_wl2_input_seat_get(imcontext->input)); if (ctx == _focused_ctx) _focused_ctx = NULL; @@ -1360,19 +1362,19 @@ static void send_get_hide_permission(WaylandIMContext *imcontext) static Eina_Bool _client_window_focus_out_cb(void *data, int ev_type, void *ev) { - Ecore_Wl_Event_Focus_Out *e = (Ecore_Wl_Event_Focus_Out *)ev; + Ecore_Wl2_Event_Focus_Out *e = (Ecore_Wl2_Event_Focus_Out *)ev; Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)data; if (!ctx || !e) return ECORE_CALLBACK_PASS_ON; WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get (ctx); if (!imcontext || !imcontext->window) return ECORE_CALLBACK_PASS_ON; - unsigned int client_win_id = ecore_wl_window_id_get (imcontext->window); + unsigned int client_win_id = ecore_wl2_window_id_get (imcontext->window); - LOGD ("ctx : %p, client_window id : %#x, focus-out win : %#x", ctx, client_win_id, e->win); + LOGD ("ctx : %p, client_window id : %#x, focus-out win : %#x", ctx, client_win_id, e->window); if (client_win_id > 0) { - if (e->win == client_win_id) { + if (e->window == client_win_id) { LOGD ("window focus out"); if (_focused_ctx == ctx) { @@ -1458,7 +1460,7 @@ static void _render_post_cb(void *data, Evas *e, void *event_info) static Eina_Bool _conformant_change_cb(void *data, int ev_type, void *ev) { - Ecore_Wl_Event_Conformant_Change *e = (Ecore_Wl_Event_Conformant_Change *)ev; + Ecore_Wl2_Event_Conformant_Change *e = (Ecore_Wl2_Event_Conformant_Change *)ev; Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)data; if (!e || !ctx) return ECORE_CALLBACK_PASS_ON; @@ -1467,13 +1469,16 @@ static Eina_Bool _conformant_change_cb(void *data, int ev_type, void *ev) if (_active_context_window_id != e->win) return ECORE_CALLBACK_PASS_ON; - Ecore_Wl_Window *window = ecore_wl_window_find(e->win); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + if (!wl2_display) return ECORE_CALLBACK_PASS_ON; + + Ecore_Wl2_Window *window = ecore_wl2_display_window_find(wl2_display, e->win); if (!window) return ECORE_CALLBACK_PASS_ON; if (!(e->state)) { LOGD("_conformant_reset_done = 0, registering _render_post_cb : %p %p", _active_context_canvas, window); _conformant_reset_done = EINA_FALSE; - if (_active_context_canvas && ecore_wl_window_conformant_get(window) && !_custom_conformant_event) { + if (_active_context_canvas && ecore_wl2_window_conformant_get(window) && !_custom_conformant_event) { evas_event_callback_del(_active_context_canvas, EVAS_CALLBACK_RENDER_POST, _render_post_cb); evas_event_callback_add(_active_context_canvas, EVAS_CALLBACK_RENDER_POST, _render_post_cb, ctx); } @@ -1487,22 +1492,24 @@ static Eina_Bool _conformant_change_cb(void *data, int ev_type, void *ev) int x = 0, y = 0, w = 0, h = 0; if (_TV) { - /* TV IME consists of two or three windows, so ecore_wl_window_keyboard_geometry_get() may return wrong size. */ + /* TV IME consists of two or three windows, so ecore_wl2_window_keyboard_geometry_get() may return wrong size. */ x = _keyboard_geometry.x, y = _keyboard_geometry.y, w = _keyboard_geometry.w, h = _keyboard_geometry.h; if (_keyboard_geometry.w == 0 || _keyboard_geometry.h == 0) { - result = ecore_wl_window_keyboard_geometry_get(window, &x, &y, &w, &h); + result = ecore_wl2_window_keyboard_geometry_get(window, &x, &y, &w, &h); } } else { /* Since the input_panel_geometry is not delivered right at the moment, we use conformant geometry instead */ x = 0, y = 0, w = 0, h = 0; - result = ecore_wl_window_keyboard_geometry_get(window, &x, &y, &w, &h); + result = ecore_wl2_window_keyboard_geometry_get(window, &x, &y, &w, &h); } if (result) { Evas_Coord scr_w = 0, scr_h = 0; - ecore_wl_sync(); - ecore_wl_screen_size_get(&scr_w, &scr_h); - int rot = ecore_wl_window_rotation_get(window); + ecore_wl2_sync(); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + if (wl2_display) + ecore_wl2_display_screen_size_get(wl2_display ,&scr_w, &scr_h); + int rot = ecore_wl2_window_rotation_get(window); /* Assume we are using keyboard that has the same width to the screen width*/ switch (rot) { case 90: @@ -1631,9 +1638,9 @@ show_input_panel(Ecore_IMF_Context *ctx) ignore_hide = EINA_TRUE; - _win_focus_out_handler = ecore_event_handler_add (ECORE_WL_EVENT_FOCUS_OUT, _client_window_focus_out_cb, ctx); + _win_focus_out_handler = ecore_event_handler_add (ECORE_WL2_EVENT_FOCUS_OUT, _client_window_focus_out_cb, ctx); _conformant_change_handler_del (); - _conformant_change_handler = ecore_event_handler_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, _conformant_change_cb, ctx); + _conformant_change_handler = ecore_event_handler_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, _conformant_change_cb, ctx); // TIZEN_ONLY(20160217): ignore the duplicate show request if ((_show_req_ctx == ctx) && _compare_context(_show_req_ctx, ctx) && (!will_hide)) { @@ -1651,8 +1658,8 @@ show_input_panel(Ecore_IMF_Context *ctx) _active_context_canvas = ecore_imf_context_client_canvas_get(ctx); if (imcontext->window) { - _active_context_window_id = ecore_wl_window_id_get(imcontext->window); - imcontext->has_conformant = ecore_wl_window_conformant_get(imcontext->window); + _active_context_window_id = ecore_wl2_window_id_get(imcontext->window); + imcontext->has_conformant = ecore_wl2_window_conformant_get(imcontext->window); } else { imcontext->has_conformant = EINA_FALSE; } @@ -1977,8 +1984,8 @@ text_input_keysym(void *data, strncpy((char *)e->key, key, strlen(key)); strncpy((char *)e->string, string, strlen(string)); - e->window = (Ecore_Window)ecore_wl_window_id_get(imcontext->window); - e->event_window = (Ecore_Window)ecore_wl_window_id_get(imcontext->window); + e->window = (Ecore_Window)ecore_wl2_window_id_get(imcontext->window); + e->event_window = (Ecore_Window)ecore_wl2_window_id_get(imcontext->window); e->dev = _ime_device; e->timestamp = 0; /* For distinguishing S/W keyboard event */ @@ -2176,7 +2183,7 @@ text_input_private_command(void *data, LOGD("Checking command : %s", command); if (strncmp(command, szConformantReset, strlen(szConformantReset)) == 0) { - Ecore_Wl_Window *window = imcontext->window; + Ecore_Wl2_Window *window = imcontext->window; if (!window) return; if (!reset_conformant_area(imcontext->ctx) && !_conformant_reset_started) { @@ -2187,7 +2194,7 @@ text_input_private_command(void *data, _send_will_hide_ack(imcontext); } } else if (strncmp(command, szConformantRestore, strlen(szConformantRestore)) == 0) { - Ecore_Wl_Window *window = imcontext->window; + Ecore_Wl2_Window *window = imcontext->window; if (!window) return; restore_conformant_area(imcontext->ctx); @@ -2983,10 +2990,13 @@ wayland_im_context_client_window_set(Ecore_IMF_Context *ctx, LOGD("client window set (window: %p)", window); if (imcontext && window) { - imcontext->window = ecore_wl_window_find((Ecore_Window)window); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + + if (wl2_display) + imcontext->window = ecore_wl2_display_window_find(wl2_display, (Ecore_Window)window); if (_ime_device && imcontext->window) - _device_info_send (ecore_wl_window_id_get (imcontext->window), EINA_TRUE); + _device_info_send (ecore_wl2_window_id_get (imcontext->window), EINA_TRUE); } } @@ -2999,13 +3009,14 @@ wayland_im_context_client_canvas_set(Ecore_IMF_Context *ctx, LOGD("client canvas set (canvas: %p)", canvas); if (imcontext && canvas) { + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); imcontext->canvas = canvas; - if (!imcontext->window) - imcontext->window = ecore_wl_window_find(ecore_evas_window_get(ecore_evas_ecore_evas_get(canvas))); + if (wl2_display && !imcontext->window) + imcontext->window = ecore_wl2_display_window_find(wl2_display, ecore_evas_window_get(ecore_evas_ecore_evas_get(canvas))); if (_ime_device && imcontext->window) - _device_info_send (ecore_wl_window_id_get (imcontext->window), EINA_TRUE); + _device_info_send (ecore_wl2_window_id_get (imcontext->window), EINA_TRUE); } } @@ -3181,7 +3192,11 @@ wayland_im_context_filter_event(Ecore_IMF_Context *ctx, modifiers, (key_dev_name ? key_dev_name : ""), key_dev_class, key_dev_subclass); //Waiting for filter_key_event_done from IME. //This function should return IME filtering result with boolean type. - struct wl_display *display = ecore_wl_display_get(); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + struct wl_display *display = NULL; + if (wl2_display) + display = ecore_wl2_display_get(wl2_display); + if (display) { while (ecore_time_get() - start_time < WAIT_FOR_FILTER_DONE_SECOND && _focused_ctx == ctx && wl_display_roundtrip(display) != -1) { if (imcontext->last_key_event_filter.serial == serial) { diff --git a/ism/extras/wayland_immodule/wayland_module.c b/ism/extras/wayland_immodule/wayland_module.c index b681b3d..72cfacf 100644 --- a/ism/extras/wayland_immodule/wayland_module.c +++ b/ism/extras/wayland_immodule/wayland_module.c @@ -22,14 +22,15 @@ #include #include -#include +#define EFL_BETA_API_SUPPORT +#include #include #include "wayland_imcontext.h" #include int _ecore_imf_wayland_log_dom = -1; -static int ecore_wl_init_count = 0; +static int ecore_wl2_init_count = 0; static const Ecore_IMF_Context_Info wayland_im_info = { @@ -100,21 +101,25 @@ im_module_create() WaylandIMContext *ctxd = NULL; if (!text_input_manager) { - Ecore_Wl_Global *global; + Ecore_Wl2_Global *global; struct wl_registry *registry; - Eina_Inlist *globals; + Eina_Iterator *globals; - ecore_wl_init_count = ecore_wl_init(NULL); - if (!ecore_wl_init_count) + ecore_wl2_init_count = ecore_wl2_init(); + if (!ecore_wl2_init_count) return NULL; - if (!(registry = ecore_wl_registry_get())) + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + if (!wl2_display) goto err; - if (!(globals = ecore_wl_globals_get())) + if (!(registry = ecore_wl2_display_registry_get(wl2_display))) goto err; - EINA_INLIST_FOREACH(globals, global) + if (!(globals = ecore_wl2_display_globals_get(wl2_display))) + goto err; + + EINA_ITERATOR_FOREACH(globals, global) { if (!strcmp(global->interface, "wl_text_input_manager")) { text_input_manager = @@ -125,6 +130,7 @@ im_module_create() break; } } + eina_iterator_free (globals); if (!text_input_manager) goto err; @@ -144,8 +150,8 @@ im_module_create() return ctx; err: - ecore_wl_init_count = 0; - ecore_wl_shutdown(); + ecore_wl2_init_count = 0; + ecore_wl2_shutdown(); return NULL; } @@ -181,8 +187,8 @@ im_module_shutdown(void) // EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "im module shutdown"); - if (ecore_wl_init_count > 0) - ecore_wl_shutdown(); + if (ecore_wl2_init_count > 0) + ecore_wl2_shutdown(); } EINA_MODULE_INIT(im_module_init); diff --git a/ism/modules/panelagent/wayland/isf_wsc_control_ui.cpp b/ism/modules/panelagent/wayland/isf_wsc_control_ui.cpp index ef45a26..e42cf11 100644 --- a/ism/modules/panelagent/wayland/isf_wsc_control_ui.cpp +++ b/ism/modules/panelagent/wayland/isf_wsc_control_ui.cpp @@ -27,8 +27,8 @@ /* IM control UI part */ #include "scim_private.h" - -#include +#define EFL_BETA_API_SUPPORT +#include #include #ifdef HAVE_VCONF #include diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp index c24902a..f79c469 100644 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -46,7 +46,8 @@ #include #include -#include +#define EFL_BETA_API_SUPPORT +#include #include #include #include @@ -77,7 +78,7 @@ using namespace scim; struct _WSCContextISFImpl { WSCContextISF *parent; - Ecore_Wl_Window *client_window; + Ecore_Wl2_Window *client_window; Ecore_IMF_Input_Mode input_mode; WideString surrounding_text; WideString preedit_string; @@ -208,7 +209,7 @@ static Ecore_Timer *_resource_check_timer static bool _need_wl_im_init = false; static struct _wl_im *_wl_im_ctx = NULL; -static int _ecore_wl_init_count = 0; +static int _ecore_wl2_init_count = 0; #define WAYLAND_MODULE_CLIENT_ID (0) #define MAX_PREEDIT_BUFSIZE 4000 @@ -898,26 +899,38 @@ static const struct wl_input_method_listener wsc_im_listener = { static bool _wsc_setup (struct weescim *wsc) { - Eina_Inlist *globals; + Eina_Iterator *globals; struct wl_registry *registry; - Ecore_Wl_Global *global; + Ecore_Wl2_Global *global; if (!wsc) return false; - if (!(registry = ecore_wl_registry_get ())) { + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get (NULL); + if (!wl2_display) { + LOGW ("failed to get wl2_display, try connecting"); + wl2_display = ecore_wl2_display_connect (NULL); + + if (!wl2_display) { + LOGW ("failed to connect"); + return false; + } + } + + if (!(registry = ecore_wl2_display_registry_get (wl2_display))) { LOGW ("failed to get wl_registry"); return false; } - if (!(globals = ecore_wl_globals_get ())) { + if (!(globals = ecore_wl2_display_globals_get (wl2_display))) { LOGW ("failed to get wl_globals"); return false; } - EINA_INLIST_FOREACH(globals, global) { + EINA_ITERATOR_FOREACH(globals, global) { if (strcmp (global->interface, "wl_input_method") == 0) wsc->im = (wl_input_method*)wl_registry_bind (registry, global->id, &wl_input_method_interface, 1); } + eina_iterator_free (globals); if (wsc->im == NULL) { LOGW ("Failed because wl_input_method is null"); @@ -1180,8 +1193,8 @@ isf_wsc_context_init (void) LOGD (""); if (!_scim_initialized) { - _ecore_wl_init_count = ecore_wl_init (NULL); - if (_ecore_wl_init_count > 0) { + _ecore_wl2_init_count = ecore_wl2_init (); + if (_ecore_wl2_init_count > 0) { initialize (); _scim_initialized = true; isf_wsc_input_panel_init (); @@ -1204,9 +1217,13 @@ isf_wsc_context_shutdown (void) isf_wsc_input_panel_shutdown (); finalize (); - if (_ecore_wl_init_count > 0) { - ecore_wl_shutdown (); - _ecore_wl_init_count = 0; + if (_ecore_wl2_init_count > 0) { + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get (NULL); + if (wl2_display) { + ecore_wl2_display_disconnect (wl2_display); + } + ecore_wl2_shutdown (); + _ecore_wl2_init_count = 0; } } } @@ -2065,7 +2082,9 @@ remote_surrounding_get (WSCContextISF *wsc_ctx) LOGD("%d,%d", filedes[0], filedes[1]); if (wsc_ctx && wsc_ctx->im_ctx) { wl_input_method_context_get_surrounding_text (wsc_ctx->im_ctx, UINT_MAX, UINT_MAX, filedes[1]); - ecore_wl_flush (); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get (NULL); + if (wl2_display) + ecore_wl2_display_flush (wl2_display); } close (filedes[1]); @@ -3245,7 +3264,9 @@ public: if (ic->im_ctx) wl_input_method_context_get_surrounding_text (ic->im_ctx, maxlen_before, maxlen_after, filedes[1]); - ecore_wl_flush (); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get (NULL); + if (wl2_display) + ecore_wl2_display_flush (wl2_display); close (filedes[1]); if (ic->surrounding_text_fd_read_handler) { @@ -3377,7 +3398,9 @@ public: if (!ic) return; wl_input_method_context_get_selection_text (ic->im_ctx, filedes[1]); - ecore_wl_flush (); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get (NULL); + if (wl2_display) + ecore_wl2_display_flush (wl2_display); close (filedes[1]); if (ic->selection_text_fd_read_handler) { diff --git a/packaging/isf.spec b/packaging/isf.spec index de054aa..bb1fc2a 100644 --- a/packaging/isf.spec +++ b/packaging/isf.spec @@ -14,7 +14,7 @@ BuildRequires: gettext-tools BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(vconf) %if %{with wayland} -BuildRequires: pkgconfig(ecore-wayland) +BuildRequires: pkgconfig(ecore-wl2) BuildRequires: pkgconfig(xkbcommon) >= 0.3.0 BuildRequires: pkgconfig(text-client) BuildRequires: pkgconfig(input-method-client) @@ -118,7 +118,7 @@ mkdir -p %{buildroot}/usr/share/upgrade/scripts/ cat scim.lang > isf.lang %post -ln -sf "module.so" %{_libdir}/ecore_imf/modules/wayland/v-1.16/libwltextinputmodule.so +ln -sf "module.so" %{_libdir}/ecore_imf/modules/wayland/v-1.20/libwltextinputmodule.so /sbin/ldconfig -- 2.7.4