ecore-imf-wayland: Port ecore_imf_wayland to use Ecore_Wl2

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-10-09 12:22:08 -04:00
parent 6d78355ccc
commit da260bd5a5
4 changed files with 48 additions and 35 deletions

View File

@ -139,15 +139,15 @@ modules/ecore_imf/wayland/text-protocol.c
modules_ecore_imf_wayland_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
@ECORE_IMF_CFLAGS@ \
@ECORE_EVAS_CFLAGS@ \
@ECORE_WAYLAND_CFLAGS@
@ECORE_WL2_CFLAGS@
modules_ecore_imf_wayland_module_la_LIBADD = \
@USE_ECORE_IMF_LIBS@ \
@USE_ECORE_EVAS_LIBS@ \
@USE_ECORE_WAYLAND_LIBS@
@USE_ECORE_WL2_LIBS@
modules_ecore_imf_wayland_module_la_DEPENDENCIES = \
@USE_ECORE_IMF_INTERNAL_LIBS@ \
@USE_ECORE_EVAS_INTERNAL_LIBS@ \
@USE_ECORE_WAYLAND_INTERNAL_LIBS@
@USE_ECORE_WL2_INTERNAL_LIBS@
modules_ecore_imf_wayland_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
modules_ecore_imf_wayland_module_la_LIBTOOLFLAGS = --tag=disable-static
endif

View File

@ -27,7 +27,7 @@
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Ecore_Input.h>
#include <Ecore_Wayland.h>
#include <Ecore_Wl2.h>
#include "wayland_imcontext.h"
@ -38,9 +38,9 @@ struct _WaylandIMContext
struct wl_text_input_manager *text_input_manager;
struct wl_text_input *text_input;
Ecore_Wl_Window *window;
Ecore_Wl_Input *input;
Evas *canvas;
Ecore_Wl2_Window *window;
Ecore_Wl2_Input *input;
Evas *canvas;
char *preedit_text;
char *preedit_commit;
@ -292,17 +292,17 @@ static Eina_Bool
show_input_panel(Ecore_IMF_Context *ctx)
{
WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
Ecore_Wl_Input *input;
Ecore_Wl2_Input *input;
struct wl_seat *seat;
if ((!imcontext) || (!imcontext->window) || (!imcontext->text_input))
return EINA_FALSE;
input = ecore_wl_window_keyboard_get(imcontext->window);
input = ecore_wl2_window_input_get(imcontext->window);
if (!input)
return EINA_FALSE;
seat = ecore_wl_input_seat_get(input);
seat = ecore_wl2_input_seat_get(input);
if (!seat)
return EINA_FALSE;
@ -312,7 +312,7 @@ show_input_panel(Ecore_IMF_Context *ctx)
{
wl_text_input_show_input_panel(imcontext->text_input);
wl_text_input_activate(imcontext->text_input, seat,
ecore_wl_window_surface_get(imcontext->window));
ecore_wl2_window_surface_get(imcontext->window));
wl_text_input_set_content_type(imcontext->text_input,
imcontext->content_hint,
@ -531,8 +531,8 @@ text_input_keysym(void *data,
strcpy((char *)e->key, key);
strcpy((char *)e->string, string);
e->window = ecore_wl_window_id_get(imcontext->window);
e->event_window = ecore_wl_window_id_get(imcontext->window);
e->window = ecore_wl2_window_id_get(imcontext->window);
e->event_window = ecore_wl2_window_id_get(imcontext->window);
e->timestamp = time;
e->modifiers = 0;
@ -692,7 +692,7 @@ wayland_im_context_focus_out(Ecore_IMF_Context *ctx)
wl_text_input_hide_input_panel(imcontext->text_input);
wl_text_input_deactivate(imcontext->text_input,
ecore_wl_input_seat_get(imcontext->input));
ecore_wl2_input_seat_get(imcontext->input));
}
imcontext->input = NULL;
@ -776,7 +776,7 @@ wayland_im_context_client_window_set(Ecore_IMF_Context *ctx,
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "client window set (window: %p)", window);
if (window != NULL)
imcontext->window = ecore_wl_window_find((Ecore_Window)window);
imcontext->window = ecore_wl2_window_find(ewd, (Ecore_Window)window);
}
EAPI void

View File

@ -24,8 +24,12 @@
#define __WAYLAND_IM_CONTEXT_H_
#include <Ecore_IMF.h>
#include <Ecore_Wl2.h>
#include "text-client-protocol.h"
extern Ecore_Wl2_Display *ewd;
typedef struct _WaylandIMContext WaylandIMContext;
EAPI void wayland_im_context_add (Ecore_IMF_Context *ctx);

View File

@ -26,13 +26,14 @@
#include <Ecore.h>
#include <Ecore_IMF.h>
#include <Ecore_Wayland.h>
#include <Ecore_Wl2.h>
#include <stdio.h>
#include "wayland_imcontext.h"
#include "text-client-protocol.h"
int _ecore_imf_wayland_log_dom = -1;
Ecore_Wl2_Display *ewd;
static const Ecore_IMF_Context_Info wayland_im_info =
{
@ -100,27 +101,28 @@ im_module_create()
if (!text_input_manager)
{
Ecore_Wl_Global *global;
struct wl_registry *registry;
Eina_Inlist *globals;
Eina_Iterator *itr;
if (!(registry = ecore_wl_registry_get()))
return NULL;
if (!(globals = ecore_wl_globals_get()))
return NULL;
EINA_INLIST_FOREACH(globals, global)
itr = ecore_wl2_display_globals_get(ewd);
if (itr)
{
if (!strcmp(global->interface, "wl_text_input_manager"))
Ecore_Wl2_Global *global;
struct wl_registry *registry;
registry = ecore_wl2_display_registry_get(ewd);
EINA_ITERATOR_FOREACH(itr, global)
{
text_input_manager =
wl_registry_bind(registry, global->id,
&wl_text_input_manager_interface, 1);
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom,
"bound wl_text_input_manager interface");
break;
if (!strcmp(global->interface, "wl_text_input_manager"))
{
text_input_manager =
wl_registry_bind(registry, global->id,
&wl_text_input_manager_interface, 1);
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom,
"bound wl_text_input_manager interface");
break;
}
}
eina_iterator_free(itr);
}
if (!text_input_manager)
@ -156,21 +158,28 @@ im_module_init(void)
if (strcmp(s, "wl")) return EINA_FALSE;
}
if (!ecore_wl_init(NULL))
if (!ecore_wl2_init())
return EINA_FALSE;
ewd = ecore_wl2_display_connect(NULL);
if (!ewd) goto err;
ecore_imf_module_register(&wayland_im_info, im_module_create,
im_module_exit);
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "im module initalized");
return EINA_TRUE;
err:
ecore_wl2_shutdown();
return EINA_FALSE;
}
static void
im_module_shutdown(void)
{
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "im module shutdown");
ecore_wl_shutdown();
ecore_wl2_shutdown();
}
EINA_MODULE_INIT(im_module_init);