--- /dev/null
+/*
+ * Copyright © 2012, 2013 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this
+ * software and its documentation for any purpose is hereby granted
+ * without fee, provided that the above copyright notice appear in
+ * all copies and that both that copyright notice and this permission
+ * notice appear in supporting documentation, and that the name of
+ * the copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+
+#ifndef INPUT_METHOD_CLIENT_PROTOCOL_H
+#define INPUT_METHOD_CLIENT_PROTOCOL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-client.h"
+
+struct wl_client;
+struct wl_resource;
+
+struct wl_input_method_context;
+struct wl_input_method;
+struct wl_input_panel;
+struct wl_input_panel_surface;
+
+extern const struct wl_interface wl_input_method_context_interface;
+extern const struct wl_interface wl_input_method_interface;
+extern const struct wl_interface wl_input_panel_interface;
+extern const struct wl_interface wl_input_panel_surface_interface;
+
+/**
+ * wl_input_method_context - input method context
+ * @surrounding_text: surrounding text event
+ * @reset: (none)
+ * @content_type: (none)
+ * @invoke_action: (none)
+ * @commit_state: (none)
+ * @preferred_language: (none)
+ *
+ * Corresponds to a text model on input method side. An input method
+ * context is created on text mode activation on the input method side. It
+ * allows to receive information about the text model from the application
+ * via events. Input method contexts do not keep state after deactivation
+ * and should be destroyed after deactivation is handled.
+ *
+ * Text is generally UTF-8 encoded, indices and lengths are in bytes.
+ *
+ * Serials are used to synchronize the state between the text input and an
+ * input method. New serials are sent by the text input in the commit_state
+ * request and are used by the input method to indicate the known text
+ * input state in events like preedit_string, commit_string, and keysym.
+ * The text input can then ignore events from the input method which are
+ * based on an outdated state (for example after a reset).
+ */
+struct wl_input_method_context_listener {
+ /**
+ * surrounding_text - surrounding text event
+ * @text: (none)
+ * @cursor: (none)
+ * @anchor: (none)
+ *
+ * The plain surrounding text around the input position. Cursor
+ * is the position in bytes within the surrounding text relative to
+ * the beginning of the text. Anchor is the position in bytes of
+ * the selection anchor within the surrounding text relative to the
+ * beginning of the text. If there is no selected text anchor is
+ * the same as cursor.
+ */
+ void (*surrounding_text)(void *data,
+ struct wl_input_method_context *wl_input_method_context,
+ const char *text,
+ uint32_t cursor,
+ uint32_t anchor);
+ /**
+ * reset - (none)
+ */
+ void (*reset)(void *data,
+ struct wl_input_method_context *wl_input_method_context);
+ /**
+ * content_type - (none)
+ * @hint: (none)
+ * @purpose: (none)
+ */
+ void (*content_type)(void *data,
+ struct wl_input_method_context *wl_input_method_context,
+ uint32_t hint,
+ uint32_t purpose);
+ /**
+ * invoke_action - (none)
+ * @button: (none)
+ * @index: (none)
+ */
+ void (*invoke_action)(void *data,
+ struct wl_input_method_context *wl_input_method_context,
+ uint32_t button,
+ uint32_t index);
+ /**
+ * commit_state - (none)
+ * @serial: serial of text input state
+ */
+ void (*commit_state)(void *data,
+ struct wl_input_method_context *wl_input_method_context,
+ uint32_t serial);
+ /**
+ * preferred_language - (none)
+ * @language: (none)
+ */
+ void (*preferred_language)(void *data,
+ struct wl_input_method_context *wl_input_method_context,
+ const char *language);
+};
+
+static inline int
+wl_input_method_context_add_listener(struct wl_input_method_context *wl_input_method_context,
+ const struct wl_input_method_context_listener *listener, void *data)
+{
+ return wl_proxy_add_listener((struct wl_proxy *) wl_input_method_context,
+ (void (**)(void)) listener, data);
+}
+
+#define WL_INPUT_METHOD_CONTEXT_DESTROY 0
+#define WL_INPUT_METHOD_CONTEXT_COMMIT_STRING 1
+#define WL_INPUT_METHOD_CONTEXT_PREEDIT_STRING 2
+#define WL_INPUT_METHOD_CONTEXT_PREEDIT_STYLING 3
+#define WL_INPUT_METHOD_CONTEXT_PREEDIT_CURSOR 4
+#define WL_INPUT_METHOD_CONTEXT_DELETE_SURROUNDING_TEXT 5
+#define WL_INPUT_METHOD_CONTEXT_CURSOR_POSITION 6
+#define WL_INPUT_METHOD_CONTEXT_MODIFIERS_MAP 7
+#define WL_INPUT_METHOD_CONTEXT_KEYSYM 8
+#define WL_INPUT_METHOD_CONTEXT_GRAB_KEYBOARD 9
+#define WL_INPUT_METHOD_CONTEXT_KEY 10
+#define WL_INPUT_METHOD_CONTEXT_MODIFIERS 11
+#define WL_INPUT_METHOD_CONTEXT_LANGUAGE 12
+#define WL_INPUT_METHOD_CONTEXT_TEXT_DIRECTION 13
+
+static inline void
+wl_input_method_context_set_user_data(struct wl_input_method_context *wl_input_method_context, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) wl_input_method_context, user_data);
+}
+
+static inline void *
+wl_input_method_context_get_user_data(struct wl_input_method_context *wl_input_method_context)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) wl_input_method_context);
+}
+
+static inline void
+wl_input_method_context_destroy(struct wl_input_method_context *wl_input_method_context)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_DESTROY);
+
+ wl_proxy_destroy((struct wl_proxy *) wl_input_method_context);
+}
+
+static inline void
+wl_input_method_context_commit_string(struct wl_input_method_context *wl_input_method_context, uint32_t serial, const char *text)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_COMMIT_STRING, serial, text);
+}
+
+static inline void
+wl_input_method_context_preedit_string(struct wl_input_method_context *wl_input_method_context, uint32_t serial, const char *text, const char *commit)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_PREEDIT_STRING, serial, text, commit);
+}
+
+static inline void
+wl_input_method_context_preedit_styling(struct wl_input_method_context *wl_input_method_context, uint32_t index, uint32_t length, uint32_t style)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_PREEDIT_STYLING, index, length, style);
+}
+
+static inline void
+wl_input_method_context_preedit_cursor(struct wl_input_method_context *wl_input_method_context, int32_t index)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_PREEDIT_CURSOR, index);
+}
+
+static inline void
+wl_input_method_context_delete_surrounding_text(struct wl_input_method_context *wl_input_method_context, int32_t index, uint32_t length)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_DELETE_SURROUNDING_TEXT, index, length);
+}
+
+static inline void
+wl_input_method_context_cursor_position(struct wl_input_method_context *wl_input_method_context, int32_t index, int32_t anchor)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_CURSOR_POSITION, index, anchor);
+}
+
+static inline void
+wl_input_method_context_modifiers_map(struct wl_input_method_context *wl_input_method_context, struct wl_array *map)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_MODIFIERS_MAP, map);
+}
+
+static inline void
+wl_input_method_context_keysym(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_KEYSYM, serial, time, sym, state, modifiers);
+}
+
+static inline struct wl_keyboard *
+wl_input_method_context_grab_keyboard(struct wl_input_method_context *wl_input_method_context)
+{
+ struct wl_proxy *keyboard;
+
+ keyboard = wl_proxy_create((struct wl_proxy *) wl_input_method_context,
+ &wl_keyboard_interface);
+ if (!keyboard)
+ return NULL;
+
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_GRAB_KEYBOARD, keyboard);
+
+ return (struct wl_keyboard *) keyboard;
+}
+
+static inline void
+wl_input_method_context_key(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_KEY, serial, time, key, state);
+}
+
+static inline void
+wl_input_method_context_modifiers(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_MODIFIERS, serial, mods_depressed, mods_latched, mods_locked, group);
+}
+
+static inline void
+wl_input_method_context_language(struct wl_input_method_context *wl_input_method_context, uint32_t serial, const char *language)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_LANGUAGE, serial, language);
+}
+
+static inline void
+wl_input_method_context_text_direction(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t direction)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_method_context,
+ WL_INPUT_METHOD_CONTEXT_TEXT_DIRECTION, serial, direction);
+}
+
+/**
+ * wl_input_method - input method
+ * @activate: activate event
+ * @deactivate: activate event
+ *
+ * An input method object is responsible to compose text in response to
+ * input from hardware or virtual keyboards. There is one input method
+ * object per seat. On activate there is a new input method context object
+ * created which allows the input method to communicate with the text
+ * model.
+ */
+struct wl_input_method_listener {
+ /**
+ * activate - activate event
+ * @id: (none)
+ *
+ * A text model was activated. Creates an input method context
+ * object which allows communication with the text model.
+ */
+ void (*activate)(void *data,
+ struct wl_input_method *wl_input_method,
+ struct wl_input_method_context *id);
+ /**
+ * deactivate - activate event
+ * @context: (none)
+ *
+ * The text model corresponding to the context argument was
+ * deactivated. The input method context should be destroyed after
+ * deactivation is handled.
+ */
+ void (*deactivate)(void *data,
+ struct wl_input_method *wl_input_method,
+ struct wl_input_method_context *context);
+};
+
+static inline int
+wl_input_method_add_listener(struct wl_input_method *wl_input_method,
+ const struct wl_input_method_listener *listener, void *data)
+{
+ return wl_proxy_add_listener((struct wl_proxy *) wl_input_method,
+ (void (**)(void)) listener, data);
+}
+
+static inline void
+wl_input_method_set_user_data(struct wl_input_method *wl_input_method, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) wl_input_method, user_data);
+}
+
+static inline void *
+wl_input_method_get_user_data(struct wl_input_method *wl_input_method)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) wl_input_method);
+}
+
+static inline void
+wl_input_method_destroy(struct wl_input_method *wl_input_method)
+{
+ wl_proxy_destroy((struct wl_proxy *) wl_input_method);
+}
+
+#define WL_INPUT_PANEL_GET_INPUT_PANEL_SURFACE 0
+
+static inline void
+wl_input_panel_set_user_data(struct wl_input_panel *wl_input_panel, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) wl_input_panel, user_data);
+}
+
+static inline void *
+wl_input_panel_get_user_data(struct wl_input_panel *wl_input_panel)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) wl_input_panel);
+}
+
+static inline void
+wl_input_panel_destroy(struct wl_input_panel *wl_input_panel)
+{
+ wl_proxy_destroy((struct wl_proxy *) wl_input_panel);
+}
+
+static inline struct wl_input_panel_surface *
+wl_input_panel_get_input_panel_surface(struct wl_input_panel *wl_input_panel, struct wl_surface *surface)
+{
+ struct wl_proxy *id;
+
+ id = wl_proxy_create((struct wl_proxy *) wl_input_panel,
+ &wl_input_panel_surface_interface);
+ if (!id)
+ return NULL;
+
+ wl_proxy_marshal((struct wl_proxy *) wl_input_panel,
+ WL_INPUT_PANEL_GET_INPUT_PANEL_SURFACE, id, surface);
+
+ return (struct wl_input_panel_surface *) id;
+}
+
+#ifndef WL_INPUT_PANEL_SURFACE_POSITION_ENUM
+#define WL_INPUT_PANEL_SURFACE_POSITION_ENUM
+enum wl_input_panel_surface_position {
+ WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM = 0,
+};
+#endif /* WL_INPUT_PANEL_SURFACE_POSITION_ENUM */
+
+struct wl_input_panel_surface_listener {
+ /**
+ * cursor_rectangle - cursor rectangle
+ * @x: (none)
+ * @y: (none)
+ * @width: (none)
+ * @height: (none)
+ *
+ * Notify when the cursor rectangle relative to the input panel
+ * surface change.
+ */
+ void (*cursor_rectangle)(void *data,
+ struct wl_input_panel_surface *wl_input_panel_surface,
+ int32_t x,
+ int32_t y,
+ int32_t width,
+ int32_t height);
+};
+
+static inline int
+wl_input_panel_surface_add_listener(struct wl_input_panel_surface *wl_input_panel_surface,
+ const struct wl_input_panel_surface_listener *listener, void *data)
+{
+ return wl_proxy_add_listener((struct wl_proxy *) wl_input_panel_surface,
+ (void (**)(void)) listener, data);
+}
+
+#define WL_INPUT_PANEL_SURFACE_SET_TOPLEVEL 0
+#define WL_INPUT_PANEL_SURFACE_SET_OVERLAY_PANEL 1
+
+static inline void
+wl_input_panel_surface_set_user_data(struct wl_input_panel_surface *wl_input_panel_surface, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) wl_input_panel_surface, user_data);
+}
+
+static inline void *
+wl_input_panel_surface_get_user_data(struct wl_input_panel_surface *wl_input_panel_surface)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) wl_input_panel_surface);
+}
+
+static inline void
+wl_input_panel_surface_destroy(struct wl_input_panel_surface *wl_input_panel_surface)
+{
+ wl_proxy_destroy((struct wl_proxy *) wl_input_panel_surface);
+}
+
+static inline void
+wl_input_panel_surface_set_toplevel(struct wl_input_panel_surface *wl_input_panel_surface, struct wl_output *output, uint32_t position)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_panel_surface,
+ WL_INPUT_PANEL_SURFACE_SET_TOPLEVEL, output, position);
+}
+
+static inline void
+wl_input_panel_surface_set_overlay_panel(struct wl_input_panel_surface *wl_input_panel_surface)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_input_panel_surface,
+ WL_INPUT_PANEL_SURFACE_SET_OVERLAY_PANEL);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/*
+ * Copyright © 2012, 2013 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this
+ * software and its documentation for any purpose is hereby granted
+ * without fee, provided that the above copyright notice appear in
+ * all copies and that both that copyright notice and this permission
+ * notice appear in supporting documentation, and that the name of
+ * the copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+//#ifdef __cplusplus
+#pragma message("extern C-----")
+//extern "C" {
+//#endif
+
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+extern const struct wl_interface wl_keyboard_interface;
+extern const struct wl_interface wl_input_method_context_interface;
+extern const struct wl_interface wl_input_method_context_interface;
+extern const struct wl_interface wl_input_panel_surface_interface;
+extern const struct wl_interface wl_surface_interface;
+extern const struct wl_interface wl_output_interface;
+
+static const struct wl_interface *types[] = {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ &wl_keyboard_interface,
+ &wl_input_method_context_interface,
+ &wl_input_method_context_interface,
+ &wl_input_panel_surface_interface,
+ &wl_surface_interface,
+ &wl_output_interface,
+ NULL,
+};
+
+static const struct wl_message wl_input_method_context_requests[] = {
+ { "destroy", "", types + 0 },
+ { "commit_string", "us", types + 0 },
+ { "preedit_string", "uss", types + 0 },
+ { "preedit_styling", "uuu", types + 0 },
+ { "preedit_cursor", "i", types + 0 },
+ { "delete_surrounding_text", "iu", types + 0 },
+ { "cursor_position", "ii", types + 0 },
+ { "modifiers_map", "a", types + 0 },
+ { "keysym", "uuuuu", types + 0 },
+ { "grab_keyboard", "n", types + 5 },
+ { "key", "uuuu", types + 0 },
+ { "modifiers", "uuuuu", types + 0 },
+ { "language", "us", types + 0 },
+ { "text_direction", "uu", types + 0 },
+};
+
+static const struct wl_message wl_input_method_context_events[] = {
+ { "surrounding_text", "suu", types + 0 },
+ { "reset", "", types + 0 },
+ { "content_type", "uu", types + 0 },
+ { "invoke_action", "uu", types + 0 },
+ { "commit_state", "u", types + 0 },
+ { "preferred_language", "s", types + 0 },
+};
+
+WL_EXPORT const struct wl_interface wl_input_method_context_interface = {
+ "wl_input_method_context", 1,
+ 14, wl_input_method_context_requests,
+ 6, wl_input_method_context_events,
+};
+
+static const struct wl_message wl_input_method_events[] = {
+ { "activate", "n", types + 6 },
+ { "deactivate", "o", types + 7 },
+};
+
+WL_EXPORT const struct wl_interface wl_input_method_interface = {
+ "wl_input_method", 1,
+ 0, NULL,
+ 2, wl_input_method_events,
+};
+
+static const struct wl_message wl_input_panel_requests[] = {
+ { "get_input_panel_surface", "no", types + 8 },
+};
+
+WL_EXPORT const struct wl_interface wl_input_panel_interface = {
+ "wl_input_panel", 1,
+ 1, wl_input_panel_requests,
+ 0, NULL,
+};
+
+static const struct wl_message wl_input_panel_surface_requests[] = {
+ { "set_toplevel", "ou", types + 10 },
+ { "set_overlay_panel", "", types + 0 },
+};
+
+static const struct wl_message wl_input_panel_surface_events[] = {
+ { "cursor_rectangle", "iiii", types + 0 },
+};
+
+WL_EXPORT const struct wl_interface wl_input_panel_surface_interface = {
+ "wl_input_panel_surface", 1,
+ 2, wl_input_panel_surface_requests,
+ 1, wl_input_panel_surface_events,
+};
+
+//#ifdef __cplusplus
+//}
+//#endif
#include <glib.h>
#ifdef WAYLAND
#include <Ecore_Wayland.h>
+#include "input-method-client-protocol.h"
#else
#include <Ecore_X.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif
+#ifdef WAYLAND
+struct WaylandKeyboard
+{
+ Ecore_Evas *ee;
+ Ecore_Wl_Window *wl_win;
+ const char *ee_engine;
+
+ struct wl_surface *surface;
+ struct wl_input_panel *ip;
+ struct wl_output *output;
+};
+
+struct WaylandKeyboard wlkb = {0};
+#endif
using namespace scl;
elm_exit();
}
+#ifdef WAYLAND
+static bool
+_wayland_setup(struct WaylandKeyboard *wlkb, Evas_Object *main_window)
+{
+ Eina_Inlist *globals;
+ struct wl_registry *registry;
+ Ecore_Wl_Global *global;
+ struct wl_input_panel_surface *ips;
+
+ if (!(registry = ecore_wl_registry_get()))
+ return false;
+
+ if (!(globals = ecore_wl_globals_get()))
+ return false;
+
+ EINA_INLIST_FOREACH(globals, global)
+ {
+ if (strcmp(global->interface, "wl_input_panel") == 0)
+ wlkb->ip = (wl_input_panel *)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
+ else if (strcmp(global->interface, "wl_output") == 0)
+ wlkb->output = (wl_output *)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
+ }
+
+ if (!wlkb->ip) {
+ LOGW ("Can't get wayland input panel interface\n");
+ return false;
+ }
+
+ if (!wlkb->output) {
+ LOGW ("Can't get wayland output interface\n");
+ return false;
+ }
+
+ wlkb->ee = ecore_evas_ecore_evas_get(evas_object_evas_get(main_window));
+ if (!wlkb->ee) {
+ LOGW ("ERROR: Unable to create Ecore_Evas object");
+ return false;
+ }
+
+ /* Set input panel surface */
+ LOGD ("Setting up input panel\n");
+ wlkb->wl_win = ecore_evas_wayland_window_get(wlkb->ee);
+ if (!wlkb->wl_win) {
+ LOGW ("Couldn't get wayland window\n");
+ return false;
+ }
+
+ ecore_wl_window_type_set(wlkb->wl_win, ECORE_WL_WINDOW_TYPE_NONE);
+ wlkb->surface = ecore_wl_window_surface_create(wlkb->wl_win);
+ if (!wlkb->surface) {
+ LOGW ("Couldn't create surface\n");
+ return false;
+ }
+
+ ips = wl_input_panel_get_input_panel_surface(wlkb->ip, wlkb->surface);
+ if (!ips) {
+ LOGW ("Couldn't get input panel surface\n");
+ return false;
+ }
+
+ wl_input_panel_surface_set_toplevel(ips, wlkb->output, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
+
+ return true;
+}
+
+static Eina_Bool
+check_evas_engine(struct WaylandKeyboard *wlkb)
+{
+ Eina_Bool ret = EINA_FALSE;
+ char *env = getenv("ECORE_EVAS_ENGINE");
+
+ if (!env) {
+ if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_WAYLAND_SHM))
+ env = "wayland_shm";
+ else if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_WAYLAND_EGL))
+ env = "wayland_egl";
+ else {
+ LOGW ("ERROR: Ecore_Evas does must be compiled with support for Wayland engines\n");
+ goto err;
+ }
+ }
+ else if (strcmp(env, "wayland_shm") != 0 && strcmp(env, "wayland_egl") != 0) {
+ LOGW ("ERROR: ECORE_EVAS_ENGINE must be set to either 'wayland_shm' or 'wayland_egl'\n");
+ goto err;
+ }
+
+ wlkb->ee_engine = env;
+ ret = EINA_TRUE;
+
+err:
+ return ret;
+}
+#endif
+
void CSCLCoreUIEFL::run(const sclchar *display)
{
char *argv[4];
elm_init(argc, argv);
+#ifdef WAYLAND
+ if (!check_evas_engine(&wlkb)) {
+ LOGW ("_wlkb_check_evas_engine error!\n");
+ elm_shutdown ();
+ return;
+ }
+ LOGD ("Selected engine: '%s'\n", wlkb.ee_engine);
+#endif
+
elm_policy_set(ELM_POLICY_THROTTLE, ELM_POLICY_THROTTLE_NEVER);
Evas_Object *main_window = elm_win_add(NULL, uuid, ELM_WIN_UTILITY);
+ if (!main_window) {
+ LOGE("Failed to create main window\n");
+ return;
+ }
+
m_main_window = SCL_WINDOW_CAST(main_window);
+#ifdef WAYLAND
+ if (!_wayland_setup(&wlkb, main_window)) {
+ LOGW ("ERROR: Unable to setup input panel.\n");
+ elm_shutdown();
+ return;
+ }
+#endif
+
elm_win_borderless_set(main_window, EINA_TRUE);
elm_win_keyboard_win_set(main_window, EINA_TRUE);
elm_win_autodel_set(main_window, EINA_TRUE);
signal(SIGINT, signal_handler);
signal(SIGHUP, signal_handler);
+ evas_object_show(main_window);
+
elm_run();
impl->fini();