2 * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "sclcoreui-efl.h"
19 #include "sclcoreimpl.h"
20 #include <Elementary.h>
22 #include <appcore-efl.h>
25 #include <vconf-keys.h>
30 #define EFL_BETA_API_SUPPORT
31 #include <Ecore_Wl2.h>
32 #include <input-method-client-protocol.h>
36 #include <X11/Xatom.h>
40 /* This websocket agent is for supporting Tizen 2.X legacy web IMEs that uses websocket */
41 CWebHelperAgentWebSocket g_websocket;
44 static struct appcore_ops ops;
47 struct WaylandKeyboard
50 Ecore_Wl2_Window *wl_win;
52 struct wl_surface *surface;
53 struct wl_input_panel *ip;
54 struct wl_output *output;
55 struct wl_input_panel_surface *ips;
58 struct WaylandKeyboard wlkb = {0};
60 #define RENDER_PRE_TIMEOUT 1.0f
61 static Ecore_Timer *_render_pre_timer = NULL;
62 static void delete_render_pre_timer()
64 if (_render_pre_timer) {
65 ecore_timer_del(_render_pre_timer);
66 _render_pre_timer = NULL;
73 CSCLCoreUIEFL::CSCLCoreUIEFL()
75 m_initialized = FALSE;
77 m_backend_identifier = "EFL";
79 m_rotation_degree = 0;
80 m_main_window = SCLWINDOW_INVALID;
83 m_portrait_size.width = 0;
84 m_portrait_size.height = 0;
85 m_landscape_size.width = 0;
86 m_landscape_size.height = 0;
88 memset(m_option_window_info, 0x00, sizeof(m_option_window_info));
91 CSCLCoreUIEFL::~CSCLCoreUIEFL()
95 sclboolean CSCLCoreUIEFL::init()
98 m_rotation_degree = -1;
100 for (int loop = 0;loop < OPTION_WINDOW_TYPE_MAX;loop++) {
101 m_option_window_info[loop].window = SCLWINDOW_INVALID;
111 void CSCLCoreUIEFL::fini()
113 m_initialized = FALSE;
120 sclwindow CSCLCoreUIEFL::get_main_window()
123 return m_main_window;
129 void CSCLCoreUIEFL::set_keyboard_size_hints(SclSize portrait, SclSize landscape)
131 Evas_Object *main_window = NATIVE_WINDOW_CAST(m_main_window);
134 Ecore_Wl2_Window *wl_window = (Ecore_Wl2_Window *)elm_win_wl_window_get(main_window);
135 ecore_wl2_window_rotation_geometry_set(wl_window, 0, 0, 0, portrait.width, portrait.height);
136 ecore_wl2_window_rotation_geometry_set(wl_window, 90, 0, 0, landscape.height, landscape.width);
137 ecore_wl2_window_rotation_geometry_set(wl_window, 180, 0, 0, portrait.width, portrait.height);
138 ecore_wl2_window_rotation_geometry_set(wl_window, 270, 0, 0, landscape.height, landscape.width);
141 ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(main_window), 0, 0, 0, portrait.width, portrait.height);
142 ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(main_window), 90, 0, 0, landscape.height, landscape.width);
143 ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(main_window), 180, 0, 0, portrait.width, portrait.height);
144 ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(main_window), 270, 0, 0, landscape.height, landscape.width);
147 LOGD("%d %d %d %d", portrait.width, portrait.height, landscape.width, landscape.height);
149 m_portrait_size = portrait;
150 m_landscape_size = landscape;
153 void CSCLCoreUIEFL::set_floating_mode(sclboolean floating_mode)
156 wl_input_panel_surface_set_floating_panel(wlkb.ips, floating_mode);
159 void CSCLCoreUIEFL::set_floating_drag_enabled(sclboolean enabled)
162 wl_input_panel_surface_set_floating_drag_enabled(wlkb.ips, enabled);
165 void CSCLCoreUIEFL::update_keyboard_geometry(SclSize portrait, SclSize landscape)
167 Evas_Object *main_window = NATIVE_WINDOW_CAST(m_main_window);
168 Evas_Coord win_w = 0, win_h = 0;
169 elm_win_screen_size_get(main_window, NULL, NULL, &win_w, &win_h);
170 int degree = m_rotation_degree;
171 LOGD("rotation : %d", degree);
174 snprintf(geometry, sizeof(geometry), "%d,%d,%d,%d", (win_w - portrait.width) / 2, win_h - portrait.height, portrait.width, portrait.height);
175 vconf_set_str(VCONFKEY_ISF_INPUT_PANEL_PORT_GEOMETRY, geometry);
176 snprintf(geometry, sizeof(geometry), "%d,%d,%d,%d", (win_h - landscape.width) / 2, win_w - landscape.height, landscape.width, landscape.height);
177 vconf_set_str(VCONFKEY_ISF_INPUT_PANEL_LAND_GEOMETRY, geometry);
179 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
181 if (degree == 0 || degree == 180)
182 impl->update_geometry((win_w - portrait.width) / 2, win_h - portrait.height, portrait.width, portrait.height);
184 impl->update_geometry((win_h - landscape.width) / 2, win_w - landscape.height, landscape.width, landscape.height);
188 void CSCLCoreUIEFL::get_keyboard_size(SclSize *portrait, SclSize *landscape)
190 *portrait = m_portrait_size;
191 *landscape = m_landscape_size;
195 static int language_changed_cb(void *event_info, void* data)
197 char clang[_POSIX_PATH_MAX] = {0};
198 char *vconf_str = vconf_get_str(VCONFKEY_LANGSET);
200 snprintf(clang, sizeof(clang), "%s", vconf_str);
203 LOGD("current language is %s\n", clang);
205 setenv("LC_ALL", clang, 1);
206 char *r = setlocale(LC_ALL, "");
208 setlocale(LC_ALL, "en_US.UTF-8");
211 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
213 ISCLCoreEventCallback *callback = impl->get_core_event_callback();
215 callback->on_set_display_language(clang);
222 static void accessibility_changed_cb(keynode_t *key, void* data)
225 if (vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &vconf_value) == 0) {
226 LOGD("accessibility state : %d\n", vconf_value);
228 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
230 ISCLCoreEventCallback *callback = impl->get_core_event_callback();
232 callback->on_set_accessibility_state(vconf_value);
238 static void win_rotation_changed_cb(void *data, Evas_Object *obj, void *event)
240 int degree = elm_win_rotation_get(obj);
241 LOGD("elm_win_rotation_get angle : %d\n", degree);
243 CSCLCoreUIEFL *coreui = static_cast<CSCLCoreUIEFL*>(data);
245 coreui->set_screen_rotation_degree(degree);
249 static Eina_Bool _client_message_cb(void *data, int type, void *event)
251 Ecore_X_Event_Client_Message *ev = (Ecore_X_Event_Client_Message *)event;
253 ISCLCoreEventCallback *callback = NULL;
254 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
255 Evas_Object *main_window = NULL;
257 callback = impl->get_core_event_callback();
258 main_window = NATIVE_WINDOW_CAST(impl->get_main_window());
261 #ifndef APPLY_WINDOW_MANAGER_CHANGE
263 if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE) {
264 LOGD("ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE , %d %d\n", ev->data.l[0], gFHiddenState);
265 angle = ev->data.l[0];
266 ise_set_screen_direction(angle);
267 if (!gFHiddenState) {
270 } else if (ev->message_type == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE) {
271 LOGD("ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE , %d\n", ev->data.l[0]);
272 elm_win_keyboard_mode_set(main_window, (Elm_Win_Keyboard_Mode)(ev->data.l[0]));
273 gFHiddenState = !(ev->data.l[0]);
277 if (ev->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST) {
278 if (ev->win == elm_win_xwindow_get(main_window)) {
279 int degree = ev->data.l[1];
280 CSCLCoreUIEFL *coreui = static_cast<CSCLCoreUIEFL*>(data);
282 coreui->set_screen_rotation_degree(degree);
284 LOGD("_ECORE_X_ATOM_E_WINDOW_ROTATION_REQUEST, %d\n", degree);
286 callback->on_set_rotation_degree(degree);
288 Ecore_X_Window control_window = 0;
289 Ecore_X_Atom atom = ecore_x_atom_get("_ISF_CONTROL_WINDOW");
290 Ecore_X_Window root = ecore_x_window_root_first_get();
291 if (ecore_x_window_prop_xid_get(root, atom, ECORE_X_ATOM_WINDOW, &control_window, 1) == 1) {
292 ecore_x_client_message32_send(control_window, ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST,
293 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
294 ev->data.l[0], ev->data.l[1], ev->data.l[2], ev->data.l[3], ev->data.l[4]);
299 return ECORE_CALLBACK_RENEW;
303 int CSCLCoreUIEFL::get_screen_rotation_degree()
308 if (m_rotation_degree == -1) {
309 m_rotation_degree = elm_win_rotation_get(NATIVE_WINDOW_CAST(m_main_window));
311 LOGD("m_rotation_degree : %d", m_rotation_degree);
312 angle = m_rotation_degree;
314 if (m_rotation_degree == -1) {
318 unsigned long nitems_return;
319 unsigned long bytes_after_return;
320 unsigned char *data_window = NULL;
321 unsigned char *data_angle = NULL;
323 Ecore_X_Window app_window = 0;
325 Evas_Object *keypad_win = NATIVE_WINDOW_CAST(m_main_window);
327 LOGD("Trying to get app window degree for %p\n", keypad_win);
328 Ecore_X_Window win = elm_win_xwindow_get(NATIVE_WINDOW_CAST(keypad_win));
329 ret = XGetWindowProperty((Display *)ecore_x_display_get(),
330 ecore_x_window_root_get(win),
331 ecore_x_atom_get("_ISF_ACTIVE_WINDOW"),
332 0, G_MAXLONG, False, XA_WINDOW, &type_return,
333 &format_return, &nitems_return, &bytes_after_return,
336 if (ret == Success) {
337 if ((type_return == XA_WINDOW) && (format_return == 32) && (data_window)) {
338 app_window = *(Window *)data_window;
340 ret = XGetWindowProperty((Display *)ecore_x_display_get(), app_window,
341 ecore_x_atom_get("_E_ILLUME_ROTATE_WINDOW_ANGLE"),
342 0, G_MAXLONG, False, XA_CARDINAL, &type_return,
343 &format_return, &nitems_return, &bytes_after_return,
346 LOGD("app_window : %p, ret %d, %d, %p\n", app_window, ret, type_return, data_angle);
347 if (ret == Success) {
349 if (type_return == XA_CARDINAL) {
350 angle = *(unsigned int*)data_angle;
351 LOGD("current rotation angle is %p %d\n", app_window, angle);
361 angle = m_rotation_degree;
368 static void signal_handler(int sig) {
374 _wayland_setup(struct WaylandKeyboard *wlkb, Evas_Object *main_window)
376 Eina_Iterator *globals;
377 struct wl_registry *registry;
378 Ecore_Wl2_Global *global;
379 Ecore_Wl2_Display *ewd;
381 if (!(ewd = ecore_wl2_connected_display_get(NULL)))
384 if (!(registry = ecore_wl2_display_registry_get(ewd)))
387 if (!(globals = ecore_wl2_display_globals_get(ewd)))
390 EINA_ITERATOR_FOREACH(globals, global)
392 if (strcmp(global->interface, "wl_input_panel") == 0)
393 wlkb->ip = (wl_input_panel *)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
394 else if (strcmp(global->interface, "wl_output") == 0)
395 wlkb->output = (wl_output *)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
399 LOGW("Can't get wayland input panel interface\n");
404 LOGW("Can't get wayland output interface\n");
408 wlkb->ee = ecore_evas_ecore_evas_get(evas_object_evas_get(main_window));
410 LOGW("ERROR: Unable to create Ecore_Evas object\n");
414 /* Set input panel surface */
415 LOGD("Setting up input panel\n");
416 wlkb->wl_win = ecore_evas_wayland2_window_get(wlkb->ee);
418 LOGW("Couldn't get wayland window\n");
422 ecore_wl2_window_type_set(wlkb->wl_win, ECORE_WL2_WINDOW_TYPE_NONE);
423 Ecore_Wl2_Surface *surface = ecore_wl2_surface_create(wlkb->wl_win, EINA_TRUE);
425 LOGW("Couldn't create surface\n");
429 wlkb->surface = ecore_wl2_window_surface_get(wlkb->wl_win);
430 if (!wlkb->surface) {
431 LOGW("Couldn't get surface\n");
435 wlkb->ips = wl_input_panel_get_input_panel_surface(wlkb->ip, wlkb->surface);
437 LOGW("Couldn't get input panel surface\n");
441 wl_input_panel_surface_set_toplevel(wlkb->ips, wlkb->output, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
447 sclboolean CSCLCoreUIEFL::create_main_window()
449 elm_config_accel_preference_set("3d");
450 elm_policy_set(ELM_POLICY_THROTTLE, ELM_POLICY_THROTTLE_NEVER);
452 Evas_Object *main_window = elm_win_add(NULL, m_appid, ELM_WIN_UTILITY);
454 LOGE("Failed to create main window\n");
458 m_main_window = SCL_WINDOW_CAST(main_window);
461 if (!_wayland_setup(&wlkb, main_window)) {
462 LOGW("ERROR: Unable to setup input panel.\n");
467 elm_win_borderless_set(main_window, EINA_TRUE);
468 elm_win_keyboard_win_set(main_window, EINA_TRUE);
469 elm_win_autodel_set(main_window, EINA_TRUE);
470 elm_win_title_set(main_window, m_appid);
471 elm_atspi_accessible_name_set(main_window, "Keyboard");
472 elm_atspi_accessible_role_set(main_window, ELM_ATSPI_ROLE_INPUT_METHOD_WINDOW);
473 elm_win_prop_focus_skip_set(main_window, EINA_TRUE);
474 int rots[] = { 0, 90, 180, 270 };
475 elm_win_wm_rotation_available_rotations_set(main_window, rots, (sizeof(rots) / sizeof(int)));
478 unsigned int set = 1;
479 ecore_x_window_prop_card32_set(elm_win_xwindow_get(main_window),
480 ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
483 ecore_x_icccm_name_class_set(elm_win_xwindow_get(main_window), "Virtual Keyboard", "ISF");
485 evas_object_show(main_window);
488 Evas_Coord win_w = 0, win_h = 0;
489 elm_win_screen_size_get(main_window, NULL, NULL, &win_w, &win_h);
491 portrait.width = win_w;
492 portrait.height = win_h / 3;
494 landscape.width = win_h;
495 landscape.height = win_w / 3;
496 set_keyboard_size_hints(portrait, landscape);
499 appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, language_changed_cb, NULL);
501 vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, accessibility_changed_cb, NULL);
503 evas_object_smart_callback_add(main_window, "wm,rotation,changed", win_rotation_changed_cb, this);
504 evas_object_show(main_window);
506 Ecore_Event_Handler *XClientMsgHandler =
507 ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _client_message_cb, this);
512 int CSCLCoreUIEFL::create(void *data)
516 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
518 if (!impl->prepare()) {
524 /* Should we call these callback functions here? */
525 language_changed_cb(NULL, NULL);
526 accessibility_changed_cb(NULL, NULL);
528 signal(SIGQUIT, signal_handler);
529 signal(SIGTERM, signal_handler);
530 signal(SIGINT, signal_handler);
531 signal(SIGHUP, signal_handler);
536 int CSCLCoreUIEFL::terminate(void *data)
538 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
543 if (XClientMsgHandler) {
544 ecore_event_handler_del(XClientMsgHandler);
545 XClientMsgHandler = NULL;
552 static int app_create_cb(void *data)
554 LOGD("app_create_cb() is called");
555 CSCLCoreUIEFL *sclui = static_cast<CSCLCoreUIEFL *>(data);
557 int ret = sclui->create(data);
558 elm_cache_all_flush();
566 static int app_terminate_cb(void *data)
568 CSCLCoreUIEFL *sclui = static_cast<CSCLCoreUIEFL *>(data);
570 return sclui->terminate(data);
575 void CSCLCoreUIEFL::run(const sclchar *display)
577 char **argv = new char*[4];
579 const sclchar *appid = NULL;
581 ops.create = app_create_cb;
582 ops.terminate = app_terminate_cb;
588 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
590 appid = impl->get_uuid();
599 argv[0] = const_cast<char *> (appid);
600 argv[1] = (char *)"--display";
601 argv[2] = const_cast<char *> (display);
604 LOGD("name : %s\n", appid);
607 if (g_websocket.initialized()) {
612 appcore_efl_main(appid, &argc, (char ***)&argv, &ops);
617 static void focus_out_cb(void *data, Evas *e, void *event)
619 OptionWindowInfo *info = static_cast<OptionWindowInfo*>(data);
622 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
624 ISCLCoreEventCallback *callback = impl->get_core_event_callback();
626 callback->on_destroy_option_window(info->window);
630 evas_object_hide(NATIVE_WINDOW_CAST(info->window));
631 evas_object_del(NATIVE_WINDOW_CAST(info->window));
638 set_transient_for_app_window(Evas_Object *window)
640 /* Set a transient window for window stack */
641 /* Gets the current XID of the active window into the root window property */
644 unsigned long nitems_return;
645 unsigned long bytes_after_return;
647 unsigned char *data = NULL;
648 Ecore_X_Window xAppWindow;
649 Ecore_X_Window xWindow = elm_win_xwindow_get(window);
652 ret = XGetWindowProperty((Display *)ecore_x_display_get(), ecore_x_window_root_get(xWindow),
653 ecore_x_atom_get("_ISF_ACTIVE_WINDOW"),
654 0, G_MAXLONG, False, XA_WINDOW, &type_return,
655 &format_return, &nitems_return, &bytes_after_return,
658 if (ret == Success) {
660 if (type_return == XA_WINDOW) {
661 xAppWindow = *(Window *)data;
662 LOGD("TRANSIENT_FOR SET : %x , %x\n", xAppWindow, xWindow);
663 ecore_x_icccm_transient_for_set(xWindow, xAppWindow);
672 set_transient_for_isf_setting_window(Evas_Object *window)
674 /* Set a transient window for window stack */
675 /* Gets the current XID of the active window into the root window property */
678 unsigned long nitems_return;
679 unsigned long bytes_after_return;
681 unsigned char *data = NULL;
682 Ecore_X_Window xControlWindow, xSettingWindow;
683 Ecore_X_Window xWindow = elm_win_xwindow_get(window);
686 ret = XGetWindowProperty((Display *)ecore_x_display_get(), ecore_x_window_root_get(xWindow),
687 ecore_x_atom_get("_ISF_CONTROL_WINDOW"),
688 0, G_MAXLONG, False, XA_WINDOW, &type_return,
689 &format_return, &nitems_return, &bytes_after_return,
692 if (ret == Success) {
694 if (type_return == XA_WINDOW) {
695 xControlWindow = *(Window *)data;
697 ecore_x_window_prop_xid_get(xControlWindow, ecore_x_atom_get("ISF Setting window"),
698 ECORE_X_ATOM_WINDOW, &xSettingWindow, 1);
700 LOGD("TRANSIENT_FOR SET : %x , %x\n", xSettingWindow, xWindow);
701 ecore_x_icccm_transient_for_set(xWindow, xSettingWindow);
709 sclwindow CSCLCoreUIEFL::create_option_window(SCLOptionWindowType type)
711 if (type >= OPTION_WINDOW_TYPE_MAX) {
712 return SCLWINDOW_INVALID;
715 ISCLCoreEventCallback *callback = NULL;
716 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
718 callback = impl->get_core_event_callback();
720 sclboolean ret = false;
721 callback->on_check_option_window_availability(&ret);
723 LOGW("option_window not available\n");
724 return SCLWINDOW_INVALID;
727 return SCLWINDOW_INVALID;
731 /* Just in case the previous option window for setting application exists */
732 if (type == OPTION_WINDOW_TYPE_SETTING_APPLICATION) {
733 if (m_option_window_info[type].window != SCLWINDOW_INVALID) {
734 destroy_option_window(m_option_window_info[type].window);
738 Evas_Object *window, *bg;
740 window = elm_win_add(NATIVE_WINDOW_CAST(m_main_window), "Option window", ELM_WIN_BASIC);
741 if (!window) return NULL;
743 elm_win_title_set(window, "Option window");
744 bg = elm_bg_add(window);
746 evas_object_del(window);
750 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
751 elm_win_resize_object_add(window, bg);
752 evas_object_show(bg);
755 Evas_Coord win_w = 0, win_h = 0;
756 elm_win_screen_size_get(window, NULL, NULL, &win_w, &win_h);
757 int degree = get_screen_rotation_degree();
758 if (degree == 90 || degree == 270) {
759 evas_object_resize(window, win_h, win_w);
761 evas_object_resize(window, win_w, win_h);
765 int rots[] = { 0, 90, 180, 270 };
766 elm_win_wm_rotation_available_rotations_set(window, rots, (sizeof(rots) / sizeof(int)));
768 elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW);
771 callback->on_create_option_window(window, type);
774 if (type == OPTION_WINDOW_TYPE_NORMAL) {
775 Evas *evas = evas_object_evas_get(window);
776 evas_event_callback_add(evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, focus_out_cb, &m_option_window_info[type]);
777 set_transient_for_app_window(window);
778 } else if (type == OPTION_WINDOW_TYPE_SETTING_APPLICATION) {
779 set_transient_for_isf_setting_window(window);
782 m_option_window_info[type].window = window;
787 bool CSCLCoreUIEFL::show_option_window(SCLOptionWindowType type)
789 if (type >= OPTION_WINDOW_TYPE_MAX) {
790 return SCLWINDOW_INVALID;
793 ISCLCoreEventCallback *callback = NULL;
794 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
796 callback = impl->get_core_event_callback();
798 sclboolean ret = false;
799 callback->on_check_option_window_availability(&ret);
801 LOGW("option_window not available\n");
809 if (m_option_window_info[type].window != SCLWINDOW_INVALID) {
810 evas_object_show(static_cast<Evas_Object*>(m_option_window_info[type].window));
811 elm_win_raise(static_cast<Evas_Object*>(m_option_window_info[type].window));
818 void CSCLCoreUIEFL::destroy_option_window(sclwindow window)
820 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
822 ISCLCoreEventCallback *callback = impl->get_core_event_callback();
824 callback->on_destroy_option_window(window);
828 for (int loop = 0;loop < OPTION_WINDOW_TYPE_MAX;loop++) {
829 if (m_option_window_info[loop].window == window) {
830 evas_object_del(NATIVE_WINDOW_CAST(window));
831 m_option_window_info[loop].window = SCLWINDOW_INVALID;
836 void CSCLCoreUIEFL::set_screen_rotation_degree(int degree)
838 m_rotation_degree = degree;
840 ISCLCoreEventCallback *callback = NULL;
841 CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
843 callback = impl->get_core_event_callback();
846 callback->on_set_rotation_degree(degree);
849 LOGD("rotation value set : %d", degree);
853 static void _render_pre_cb(void *data, Evas *e, void *event_info)
855 LOGD("_render_pre_cb() called, now invoking wl_input_panel_surface_set_ready()");
857 wl_input_panel_surface_set_ready(wlkb.ips, 1);
859 Evas_Object *main_window = NATIVE_WINDOW_CAST(data);
860 evas_event_callback_del_full(evas_object_evas_get(main_window),
861 EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, main_window);
863 delete_render_pre_timer();
866 static Eina_Bool _render_pre_timeout(void *data)
868 LOGD("_render_pre_timer expired, forcing to call _render_pre_cb() callback");
870 _render_pre_cb(data, NULL, NULL);
872 return ECORE_CALLBACK_CANCEL;
876 void CSCLCoreUIEFL::process_keyboard_ui_state_change(KEYBOARD_UI_STATE state)
879 if (state == KEYBOARD_UI_STATE_WILL_SHOW) {
880 evas_event_callback_add(evas_object_evas_get(NATIVE_WINDOW_CAST(m_main_window)),
881 EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, (void*)m_main_window);
882 _render_pre_timer = ecore_timer_add(RENDER_PRE_TIMEOUT, _render_pre_timeout, (void*)m_main_window);
883 LOGD("Registered RENDER_PRE callback, _render_pre_cb() and a timer callback");
884 } else if (state == KEYBOARD_UI_STATE_DID_SHOW) {
885 LOGD("Forcing keyboard window to render");
886 evas_render(evas_object_evas_get(NATIVE_WINDOW_CAST(m_main_window)));