summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJihoon Kim <jihoon48.kim@samsung.com>2018-01-11 09:23:17 +0900
committerJi-hoon Lee <dalton.lee@samsung.com>2018-03-19 17:50:16 +0900
commit7569da998751d88da0db901340f3625f262e53eb (patch)
treedbd1a00e2deb67d103c4fecdefae8bf54aa28f1b
parent50a8064a9f9e37d05944852b1556f9aefce28ded (diff)
downloadisf-7569da998751d88da0db901340f3625f262e53eb.tar.gz
isf-7569da998751d88da0db901340f3625f262e53eb.tar.bz2
isf-7569da998751d88da0db901340f3625f262e53eb.zip
Add code to connect to wl display
Change-Id: I53ecc97b94f2a061f6cd652a4ac9ecc5ed269dfb Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
-rw-r--r--ism/extras/wayland_immodule/wayland_module.c29
-rw-r--r--ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp15
2 files changed, 29 insertions, 15 deletions
diff --git a/ism/extras/wayland_immodule/wayland_module.c b/ism/extras/wayland_immodule/wayland_module.c
index 72cfacf0..8af86b6e 100644
--- a/ism/extras/wayland_immodule/wayland_module.c
+++ b/ism/extras/wayland_immodule/wayland_module.c
@@ -25,12 +25,19 @@
#define EFL_BETA_API_SUPPORT
#include <Ecore_Wl2.h>
#include <stdio.h>
+#include <dlog.h>
#include "wayland_imcontext.h"
#include <text-client-protocol.h>
+#ifdef LOG_TAG
+# undef LOG_TAG
+#endif
+#define LOG_TAG "IMMODULE"
+
int _ecore_imf_wayland_log_dom = -1;
static int ecore_wl2_init_count = 0;
+static Ecore_Wl2_Display *ewd = NULL;
static const Ecore_IMF_Context_Info wayland_im_info =
{
@@ -106,17 +113,21 @@ im_module_create()
Eina_Iterator *globals;
ecore_wl2_init_count = ecore_wl2_init();
- if (!ecore_wl2_init_count)
+ if (!ecore_wl2_init_count) {
+ LOGE("Could not initialize ecore_wl2");
return NULL;
+ }
- Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL);
- if (!wl2_display)
+ ewd = ecore_wl2_display_connect(NULL);
+ if (!ewd) {
+ LOGE("Could not connect to Wayland Display");
goto err;
+ }
- if (!(registry = ecore_wl2_display_registry_get(wl2_display)))
+ if (!(registry = ecore_wl2_display_registry_get(ewd)))
goto err;
- if (!(globals = ecore_wl2_display_globals_get(wl2_display)))
+ if (!(globals = ecore_wl2_display_globals_get(ewd)))
goto err;
EINA_ITERATOR_FOREACH(globals, global)
@@ -151,6 +162,11 @@ im_module_create()
err:
ecore_wl2_init_count = 0;
+ if (ewd) {
+ ecore_wl2_display_disconnect(ewd);
+ ewd = NULL;
+ }
+
ecore_wl2_shutdown();
return NULL;
}
@@ -187,6 +203,9 @@ im_module_shutdown(void)
//
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "im module shutdown");
+ if (ewd)
+ ecore_wl2_display_disconnect(ewd);
+
if (ecore_wl2_init_count > 0)
ecore_wl2_shutdown();
}
diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp
index f79c4695..612ecabe 100644
--- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp
+++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp
@@ -78,7 +78,7 @@ using namespace scim;
struct _WSCContextISFImpl {
WSCContextISF *parent;
- Ecore_Wl2_Window *client_window;
+ Ecore_Wl2_Window *client_window;
Ecore_IMF_Input_Mode input_mode;
WideString surrounding_text;
WideString preedit_string;
@@ -209,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_wl2_init_count = 0;
+static int _ecore_wl2_init_count = 0;
#define WAYLAND_MODULE_CLIENT_ID (0)
#define MAX_PREEDIT_BUFSIZE 4000
@@ -905,15 +905,10 @@ _wsc_setup (struct weescim *wsc)
if (!wsc) return false;
- Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get (NULL);
+ Ecore_Wl2_Display *wl2_display = ecore_wl2_display_connect (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;
- }
+ LOGW ("failed to connect");
+ return false;
}
if (!(registry = ecore_wl2_display_registry_get (wl2_display))) {