forked from enlightenment/efl
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:
parent
6d78355ccc
commit
da260bd5a5
|
@ -139,15 +139,15 @@ modules/ecore_imf/wayland/text-protocol.c
|
||||||
modules_ecore_imf_wayland_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
modules_ecore_imf_wayland_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||||
@ECORE_IMF_CFLAGS@ \
|
@ECORE_IMF_CFLAGS@ \
|
||||||
@ECORE_EVAS_CFLAGS@ \
|
@ECORE_EVAS_CFLAGS@ \
|
||||||
@ECORE_WAYLAND_CFLAGS@
|
@ECORE_WL2_CFLAGS@
|
||||||
modules_ecore_imf_wayland_module_la_LIBADD = \
|
modules_ecore_imf_wayland_module_la_LIBADD = \
|
||||||
@USE_ECORE_IMF_LIBS@ \
|
@USE_ECORE_IMF_LIBS@ \
|
||||||
@USE_ECORE_EVAS_LIBS@ \
|
@USE_ECORE_EVAS_LIBS@ \
|
||||||
@USE_ECORE_WAYLAND_LIBS@
|
@USE_ECORE_WL2_LIBS@
|
||||||
modules_ecore_imf_wayland_module_la_DEPENDENCIES = \
|
modules_ecore_imf_wayland_module_la_DEPENDENCIES = \
|
||||||
@USE_ECORE_IMF_INTERNAL_LIBS@ \
|
@USE_ECORE_IMF_INTERNAL_LIBS@ \
|
||||||
@USE_ECORE_EVAS_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_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
|
||||||
modules_ecore_imf_wayland_module_la_LIBTOOLFLAGS = --tag=disable-static
|
modules_ecore_imf_wayland_module_la_LIBTOOLFLAGS = --tag=disable-static
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
#include <Ecore_Evas.h>
|
#include <Ecore_Evas.h>
|
||||||
#include <Ecore_Input.h>
|
#include <Ecore_Input.h>
|
||||||
#include <Ecore_Wayland.h>
|
#include <Ecore_Wl2.h>
|
||||||
|
|
||||||
#include "wayland_imcontext.h"
|
#include "wayland_imcontext.h"
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@ struct _WaylandIMContext
|
||||||
struct wl_text_input_manager *text_input_manager;
|
struct wl_text_input_manager *text_input_manager;
|
||||||
struct wl_text_input *text_input;
|
struct wl_text_input *text_input;
|
||||||
|
|
||||||
Ecore_Wl_Window *window;
|
Ecore_Wl2_Window *window;
|
||||||
Ecore_Wl_Input *input;
|
Ecore_Wl2_Input *input;
|
||||||
Evas *canvas;
|
Evas *canvas;
|
||||||
|
|
||||||
char *preedit_text;
|
char *preedit_text;
|
||||||
char *preedit_commit;
|
char *preedit_commit;
|
||||||
|
@ -292,17 +292,17 @@ static Eina_Bool
|
||||||
show_input_panel(Ecore_IMF_Context *ctx)
|
show_input_panel(Ecore_IMF_Context *ctx)
|
||||||
{
|
{
|
||||||
WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
|
WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
|
||||||
Ecore_Wl_Input *input;
|
Ecore_Wl2_Input *input;
|
||||||
struct wl_seat *seat;
|
struct wl_seat *seat;
|
||||||
|
|
||||||
if ((!imcontext) || (!imcontext->window) || (!imcontext->text_input))
|
if ((!imcontext) || (!imcontext->window) || (!imcontext->text_input))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
input = ecore_wl_window_keyboard_get(imcontext->window);
|
input = ecore_wl2_window_input_get(imcontext->window);
|
||||||
if (!input)
|
if (!input)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
seat = ecore_wl_input_seat_get(input);
|
seat = ecore_wl2_input_seat_get(input);
|
||||||
if (!seat)
|
if (!seat)
|
||||||
return EINA_FALSE;
|
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_show_input_panel(imcontext->text_input);
|
||||||
wl_text_input_activate(imcontext->text_input, seat,
|
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,
|
wl_text_input_set_content_type(imcontext->text_input,
|
||||||
imcontext->content_hint,
|
imcontext->content_hint,
|
||||||
|
@ -531,8 +531,8 @@ text_input_keysym(void *data,
|
||||||
strcpy((char *)e->key, key);
|
strcpy((char *)e->key, key);
|
||||||
strcpy((char *)e->string, string);
|
strcpy((char *)e->string, string);
|
||||||
|
|
||||||
e->window = ecore_wl_window_id_get(imcontext->window);
|
e->window = ecore_wl2_window_id_get(imcontext->window);
|
||||||
e->event_window = ecore_wl_window_id_get(imcontext->window);
|
e->event_window = ecore_wl2_window_id_get(imcontext->window);
|
||||||
e->timestamp = time;
|
e->timestamp = time;
|
||||||
|
|
||||||
e->modifiers = 0;
|
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_hide_input_panel(imcontext->text_input);
|
||||||
|
|
||||||
wl_text_input_deactivate(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;
|
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);
|
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "client window set (window: %p)", window);
|
||||||
|
|
||||||
if (window != NULL)
|
if (window != NULL)
|
||||||
imcontext->window = ecore_wl_window_find((Ecore_Window)window);
|
imcontext->window = ecore_wl2_window_find(ewd, (Ecore_Window)window);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
|
|
@ -24,8 +24,12 @@
|
||||||
#define __WAYLAND_IM_CONTEXT_H_
|
#define __WAYLAND_IM_CONTEXT_H_
|
||||||
|
|
||||||
#include <Ecore_IMF.h>
|
#include <Ecore_IMF.h>
|
||||||
|
#include <Ecore_Wl2.h>
|
||||||
|
|
||||||
#include "text-client-protocol.h"
|
#include "text-client-protocol.h"
|
||||||
|
|
||||||
|
extern Ecore_Wl2_Display *ewd;
|
||||||
|
|
||||||
typedef struct _WaylandIMContext WaylandIMContext;
|
typedef struct _WaylandIMContext WaylandIMContext;
|
||||||
|
|
||||||
EAPI void wayland_im_context_add (Ecore_IMF_Context *ctx);
|
EAPI void wayland_im_context_add (Ecore_IMF_Context *ctx);
|
||||||
|
|
|
@ -26,13 +26,14 @@
|
||||||
|
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
#include <Ecore_IMF.h>
|
#include <Ecore_IMF.h>
|
||||||
#include <Ecore_Wayland.h>
|
#include <Ecore_Wl2.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "wayland_imcontext.h"
|
#include "wayland_imcontext.h"
|
||||||
#include "text-client-protocol.h"
|
#include "text-client-protocol.h"
|
||||||
|
|
||||||
int _ecore_imf_wayland_log_dom = -1;
|
int _ecore_imf_wayland_log_dom = -1;
|
||||||
|
Ecore_Wl2_Display *ewd;
|
||||||
|
|
||||||
static const Ecore_IMF_Context_Info wayland_im_info =
|
static const Ecore_IMF_Context_Info wayland_im_info =
|
||||||
{
|
{
|
||||||
|
@ -100,27 +101,28 @@ im_module_create()
|
||||||
|
|
||||||
if (!text_input_manager)
|
if (!text_input_manager)
|
||||||
{
|
{
|
||||||
Ecore_Wl_Global *global;
|
Eina_Iterator *itr;
|
||||||
struct wl_registry *registry;
|
|
||||||
Eina_Inlist *globals;
|
|
||||||
|
|
||||||
if (!(registry = ecore_wl_registry_get()))
|
itr = ecore_wl2_display_globals_get(ewd);
|
||||||
return NULL;
|
if (itr)
|
||||||
|
|
||||||
if (!(globals = ecore_wl_globals_get()))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
EINA_INLIST_FOREACH(globals, global)
|
|
||||||
{
|
{
|
||||||
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 =
|
if (!strcmp(global->interface, "wl_text_input_manager"))
|
||||||
wl_registry_bind(registry, global->id,
|
{
|
||||||
&wl_text_input_manager_interface, 1);
|
text_input_manager =
|
||||||
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom,
|
wl_registry_bind(registry, global->id,
|
||||||
"bound wl_text_input_manager interface");
|
&wl_text_input_manager_interface, 1);
|
||||||
break;
|
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom,
|
||||||
|
"bound wl_text_input_manager interface");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
eina_iterator_free(itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!text_input_manager)
|
if (!text_input_manager)
|
||||||
|
@ -156,21 +158,28 @@ im_module_init(void)
|
||||||
if (strcmp(s, "wl")) return EINA_FALSE;
|
if (strcmp(s, "wl")) return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ecore_wl_init(NULL))
|
if (!ecore_wl2_init())
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
ewd = ecore_wl2_display_connect(NULL);
|
||||||
|
if (!ewd) goto err;
|
||||||
|
|
||||||
ecore_imf_module_register(&wayland_im_info, im_module_create,
|
ecore_imf_module_register(&wayland_im_info, im_module_create,
|
||||||
im_module_exit);
|
im_module_exit);
|
||||||
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "im module initalized");
|
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "im module initalized");
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
|
||||||
|
err:
|
||||||
|
ecore_wl2_shutdown();
|
||||||
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
im_module_shutdown(void)
|
im_module_shutdown(void)
|
||||||
{
|
{
|
||||||
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "im module shutdown");
|
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "im module shutdown");
|
||||||
ecore_wl_shutdown();
|
ecore_wl2_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_MODULE_INIT(im_module_init);
|
EINA_MODULE_INIT(im_module_init);
|
||||||
|
|
Loading…
Reference in New Issue