#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 =
{
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)
err:
ecore_wl2_init_count = 0;
+ if (ewd) {
+ ecore_wl2_display_disconnect(ewd);
+ ewd = NULL;
+ }
+
ecore_wl2_shutdown();
return NULL;
}
//
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();
}
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;
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
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))) {