Enable Wayland in libscl. 88/22588/7
authorYan Wang <yan.wang@linux.intel.com>
Mon, 9 Jun 2014 05:47:24 +0000 (13:47 +0800)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 4 Mar 2015 14:30:44 +0000 (23:30 +0900)
Change-Id: I609ba89ce31bf94166e0f1bcf46f83f7cb505a88

CMakeLists.txt
packaging/libscl-ui.spec
scl/gwes/efl/sclevents-efl.cpp
scl/gwes/efl/sclwindows-efl.cpp
scl/sclkeyfocushandler.cpp
scl/scluibuilder.cpp
scl/scluiimpl.cpp
scl/utils/linux/sclutils-linux.cpp

index b67bf87..8278f40 100644 (file)
@@ -88,18 +88,26 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src
                     ${CMAKE_SOURCE_DIR}/res )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED
+SET(PKGS_CHECK_MODULES
         elementary
         feedback
         sensor
         dlog
         ecore-imf
         libxml-2.0
-        utilX
         tts
         vconf
         )
 
+IF (with_x)
+        pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} utilX)
+ENDIF(with_x)
+
+IF (with_wayland)
+        ADD_DEFINITIONS("-DWAYLAND")
+        pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES})
+ENDIF(with_wayland)
+
 FOREACH(flag ${pkgs_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
index e975dbb..d57b03e 100644 (file)
@@ -1,3 +1,6 @@
+%bcond_with x
+%bcond_with wayland
+
 %define _optdir /opt
 %define _appdir %{_optdir}/apps
 
@@ -11,12 +14,15 @@ Source0:    libscl-ui-%{version}.tar.gz
 BuildRequires:  gettext-tools
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(elementary)
+%if %{with wayland}
+%else
 BuildRequires:  pkgconfig(utilX)
+BuildRequires:  pkgconfig(x11)
+%endif
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(feedback)
 BuildRequires:  pkgconfig(sensor)
 BuildRequires:  pkgconfig(dlog)
-BuildRequires:  pkgconfig(x11)
 BuildRequires:  pkgconfig(libxml-2.0)
 BuildRequires:  pkgconfig(tts)
 
@@ -55,7 +61,11 @@ CFLAGS+=" -D_TV";
 CXXFLAGS+=" -D_TV";
 %endif
 
+%if %{with wayland}
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIB_INSTALL_DIR:PATH=%{_libdir} -Dwith_wayland=TRUE
+%else
 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIB_INSTALL_DIR:PATH=%{_libdir}
+%endif
 make %{?jobs:-j%jobs}
 
 %install
index 10e24a2..77816bb 100644 (file)
 #include "sclres_manager.h"
 
 #include <Elementary.h>
-#include <Ecore_X.h>
 #include <dlog.h>
+#ifdef WAYLAND
+#include <Ecore_Wayland.h>
+#else
+#include <Ecore_X.h>
 #include <utilX.h>
+#endif
 
 #include "sclkeyfocushandler.h"
 
@@ -87,7 +91,9 @@ void CSCLEventsImplEfl::init()
     m_mouse_move_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, mouse_move, NULL);
     m_mouse_up_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, mouse_release, NULL);
 
+#ifndef WAYLAND
     m_xclient_msg_handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, client_message_cb, NULL);
+#endif
 #ifdef HANDLE_KEY_EVENTS
     m_key_pressed_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, key_pressed, NULL);
 #endif
@@ -205,6 +211,11 @@ SclPoint get_rotated_local_coords(sclint x, sclint y, SCLRotation rotation, SclR
 Eina_Bool mouse_press(void *data, int type, void *event_info)
 {
     SCL_DEBUG();
+#ifdef WAYLAND
+    Ecore_Wl_Window *wl_base_window;
+    Ecore_Wl_Window *wl_magnifier_window;
+    Ecore_Wl_Window *wl_window;
+#endif
 
     Evas_Event_Mouse_Down *ev1 = (Evas_Event_Mouse_Down*)event_info;
     LOGD("mouse_press : %d %d\n", ev1->output.x, ev1->output.y);
@@ -222,6 +233,7 @@ Eina_Bool mouse_press(void *data, int type, void *event_info)
         sclboolean processed = FALSE;
         sclwindow window = SCLWINDOW_INVALID;
 
+#ifndef WAYLAND
         Ecore_X_Window inputWindow = 0;
         Ecore_X_Atom inputAtom = ecore_x_atom_get ("DeviceMgr Input Window");
         ecore_x_window_prop_xid_get (ecore_x_window_root_first_get(),
@@ -243,12 +255,23 @@ Eina_Bool mouse_press(void *data, int type, void *event_info)
                 adjustment->enable_touch_offset(FALSE);
             }
         }
-
+#endif
         sclboolean is_scl_window = FALSE;
+#ifdef WAYLAND
+        sclwindow evwin = (sclwindow)(ev->window);
+        wl_base_window = elm_win_wl_window_get(static_cast<Evas_Object*>(windows->get_base_window()));
+        if (wl_base_window) {
+            if ((unsigned int)ecore_wl_window_id_get(wl_base_window) == ev->window)
+                is_scl_window = TRUE;
+        } else if ((wl_magnifier_window = (elm_win_wl_window_get(static_cast<Evas_Object*>(windows->get_magnifier_window()))))) {
+            if ((unsigned int)ecore_wl_window_id_get(wl_magnifier_window) == ev->window)
+                is_scl_window = TRUE;
+#else
         if (elm_win_xwindow_get(static_cast<Evas_Object*>(windows->get_base_window())) == ev->window) {
             is_scl_window = TRUE;
         } else if (elm_win_xwindow_get(static_cast<Evas_Object*>(windows->get_magnifier_window())) == ev->window) {
             is_scl_window = TRUE;
+#endif
         } else {
             do {
                 window = windows->get_nth_window_in_Z_order_list(index);
@@ -256,8 +279,14 @@ Eina_Bool mouse_press(void *data, int type, void *event_info)
                 if (window_context) {
                     if (window_context->is_virtual) {
                         is_scl_window  = TRUE;
+#ifdef WAYLAND
+                    } else if ((wl_window = elm_win_wl_window_get(static_cast<Evas_Object*>(window)))) {
+                        if ((unsigned int)ecore_wl_window_id_get(wl_window) == ev->window)
+                            is_scl_window = TRUE;
+#else
                     } else if (elm_win_xwindow_get(static_cast<Evas_Object*>(window)) == ev->window) {
                         is_scl_window = TRUE;
+#endif
                     }
                 }
                 index++;
@@ -276,8 +305,13 @@ Eina_Bool mouse_press(void *data, int type, void *event_info)
                 if (window_context) {
                     windows->get_window_rect(window, &(window_context->geometry));
                     if (get_window_rect(window, &rect)) {
+#ifdef WAYLAND
+                        int adjustx = ev->x;
+                        int adjusty = ev->y;
+#else
                         int adjustx = ev->root.x;
                         int adjusty = ev->root.y;
+#endif
 
                         SclResParserManager *sclres_manager = SclResParserManager::get_instance();
                         PSclDefaultConfigure default_configure = NULL;
@@ -306,7 +340,11 @@ Eina_Bool mouse_press(void *data, int type, void *event_info)
                         if (process_event)
                         {
                             // Now convert the global coordinate to appropriate local coordinate
+#ifdef WAYLAND
+                            SclPoint coords = get_rotated_local_coords(ev->x, ev->y, context->get_rotation(), &rect);
+#else
                             SclPoint coords = get_rotated_local_coords(ev->root.x, ev->root.y, context->get_rotation(), &rect);
+#endif
                             controller->mouse_press(window, coords.x, coords.y, ev->multi.device);
                             mouse_pressed = TRUE;
                             processed = TRUE;
@@ -328,7 +366,11 @@ Eina_Bool mouse_press(void *data, int type, void *event_info)
                 }
 
                 // Now convert the global coordinate to appropriate local coordinate
+#ifdef WAYLAND
+                SclPoint coords = get_rotated_local_coords(ev->x, ev->y, context->get_rotation(), &rect);
+#else
                 SclPoint coords = get_rotated_local_coords(ev->root.x, ev->root.y, context->get_rotation(), &rect);
+#endif
                 controller->mouse_press(window, coords.x, coords.y, ev->multi.device);
                 mouse_pressed = TRUE;
                 processed = TRUE;
@@ -376,7 +418,11 @@ Eina_Bool mouse_release (void *data, int type, void *event_info)
             }
         }
         if (dimwinevent) {
+#ifdef WAYLAND
+            controller->mouse_press(windows->get_dim_window(), ev->x, ev->y, ev->multi.device);
+#else
             controller->mouse_press(windows->get_dim_window(), ev->root.x, ev->root.y, ev->multi.device);
+#endif
         } else {
             do {
                 window = windows->get_nth_window_in_Z_order_list(index);
@@ -385,8 +431,13 @@ Eina_Bool mouse_release (void *data, int type, void *event_info)
                     if (window_context) {
                         windows->get_window_rect(window, &(window_context->geometry));
                         if (get_window_rect(window, &rect)) {
+#ifdef WAYLAND
+                            int adjustx = ev->x;
+                            int adjusty = ev->y;
+#else
                             int adjustx = ev->root.x;
                             int adjusty = ev->root.y;
+#endif
 
                             SclResParserManager *sclres_manager = SclResParserManager::get_instance();
                             PSclDefaultConfigure default_configure = NULL;
@@ -416,7 +467,11 @@ Eina_Bool mouse_release (void *data, int type, void *event_info)
                             if (process_event)
                             {
                                 /* Now convert the global coordinate to appropriate local coordinate */
+#ifdef WAYLAND
+                                SclPoint coords = get_rotated_local_coords(ev->x, ev->y, context->get_rotation(), &rect);
+#else
                                 SclPoint coords = get_rotated_local_coords(ev->root.x, ev->root.y, context->get_rotation(), &rect);
+#endif
                                 controller->mouse_release(window, coords.x, coords.y, ev->multi.device);
                                 processed = TRUE;
                             }
@@ -437,7 +492,11 @@ Eina_Bool mouse_release (void *data, int type, void *event_info)
                 }
 
                 /* Now convert the global coordinate to appropriate local coordinate */
+#ifdef WAYLAND
+                SclPoint coords = get_rotated_local_coords(ev->x, ev->y, context->get_rotation(), &rect);
+#else
                 SclPoint coords = get_rotated_local_coords(ev->root.x, ev->root.y, context->get_rotation(), &rect);
+#endif
                 controller->mouse_release(window, coords.x, coords.y, ev->multi.device);
                 processed = TRUE;
             }
@@ -574,7 +633,11 @@ Eina_Bool mouse_move (void *data, int type, void *event_info)
                 rect.height = winwidth;
                 rect.width = winheight;
             }
+#ifdef WAYLAND
+            SclPoint coords = get_rotated_local_coords(ev->x, ev->y, context->get_rotation(), &rect);
+#else
             SclPoint coords = get_rotated_local_coords(ev->root.x, ev->root.y, context->get_rotation(), &rect);
+#endif
 
             controller->mouse_move(context->get_cur_pressed_window(ev->multi.device), coords.x, coords.y, ev->multi.device);
             processed = TRUE;
@@ -586,8 +649,13 @@ Eina_Bool mouse_move (void *data, int type, void *event_info)
                     if (window_context) {
                         windows->get_window_rect(window, &(window_context->geometry));
                         if (get_window_rect(window, &rect)) {
+#ifdef WAYLAND
+                            int adjustx = ev->x;
+                            int adjusty = ev->y;
+#else
                             int adjustx = ev->root.x;
                             int adjusty = ev->root.y;
+#endif
 
                             SclResParserManager *sclres_manager = SclResParserManager::get_instance();
                             PSclDefaultConfigure default_configure = NULL;
@@ -626,7 +694,11 @@ Eina_Bool mouse_move (void *data, int type, void *event_info)
                             if (process_event)
                             {
                                 /* Now convert the global coordinate to appropriate local coordinate */
+#ifdef WAYLAND
+                                SclPoint coords = get_rotated_local_coords(ev->x, ev->y, context->get_rotation(), &rect);
+#else
                                 SclPoint coords = get_rotated_local_coords(ev->root.x, ev->root.y, context->get_rotation(), &rect);
+#endif
 
                                 controller->mouse_move(window, coords.x, coords.y, ev->multi.device);
                                 processed = TRUE;
@@ -642,7 +714,11 @@ Eina_Bool mouse_move (void *data, int type, void *event_info)
             window = pressed_window;
             if (get_window_rect(window, &rect)) {
                 /* Now convert the global coordinate to appropriate local coordinate */
+#ifdef WAYLAND
+                SclPoint coords = get_rotated_local_coords(ev->x, ev->y, context->get_rotation(), &rect);
+#else
                 SclPoint coords = get_rotated_local_coords(ev->root.x, ev->root.y, context->get_rotation(), &rect);
+#endif
                 controller->mouse_move(window, coords.x, coords.y, ev->multi.device);
                 processed = TRUE;
             }
@@ -678,6 +754,7 @@ CSCLEventsImplEfl::connect_window_events(const sclwindow wnd, const sclint evt)
 Eina_Bool
 client_message_cb(void *data, int type, void *event)
 {
+#ifndef WAYLAND
     Ecore_X_Event_Client_Message *ev = (Ecore_X_Event_Client_Message *)event;
     if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL) {
         CSCLWindows *windows = CSCLWindows::get_instance();
@@ -705,6 +782,7 @@ client_message_cb(void *data, int type, void *event)
             }
         }
     }
+#endif
     return ECORE_CALLBACK_PASS_ON;
 }
 
@@ -805,7 +883,14 @@ CSCLEventsImplEfl::generate_mouse_event(SCLMouseEvent type, scl16 x, scl16 y)
                     if (pressed[loop] != TRUE) {
                         pressed[loop] = TRUE;
                         Ecore_Event_Mouse_Button evt;
+#ifdef WAYLAND
+                        Ecore_Wl_Window *wl_base_window;
+                        wl_base_window = elm_win_wl_window_get(static_cast<Evas_Object*>(windows->get_base_window()));
+                        if (wl_base_window)
+                            evt.window = (unsigned int)ecore_wl_window_id_get(wl_base_window);
+#else
                         evt.window = elm_win_xwindow_get(static_cast<Evas_Object*>(windows->get_base_window()));
+#endif
                         //window_context = windows->get_window_context(windows->get_base_window(), FALSE);
                         window_context = windows->get_window_context(windows->get_base_window());
                         if (window_context) {
@@ -826,7 +911,14 @@ CSCLEventsImplEfl::generate_mouse_event(SCLMouseEvent type, scl16 x, scl16 y)
                     if (pressed[loop] == TRUE) {
                         pressed[loop] = FALSE;
                         Ecore_Event_Mouse_Button evt;
+#ifdef WAYLAND
+                        Ecore_Wl_Window *wl_base_window;
+                        wl_base_window = elm_win_wl_window_get(static_cast<Evas_Object*>(windows->get_base_window()));
+                        if (wl_base_window)
+                            evt.window = (unsigned int)ecore_wl_window_id_get(wl_base_window);
+#else
                         evt.window = elm_win_xwindow_get(static_cast<Evas_Object*>(windows->get_base_window()));
+#endif
                         //window_context = windows->get_window_context(windows->get_base_window(), FALSE);
                         window_context = windows->get_window_context(windows->get_base_window());
                         if (window_context) {
@@ -846,7 +938,14 @@ CSCLEventsImplEfl::generate_mouse_event(SCLMouseEvent type, scl16 x, scl16 y)
                 for (sclint loop = 0; !generated && loop < MAX_DEVICES; loop++) {
                     if (pressed[loop] == TRUE) {
                         Ecore_Event_Mouse_Move evt;
+#ifdef WAYLAND
+                        Ecore_Wl_Window *wl_base_window;
+                        wl_base_window = elm_win_wl_window_get(static_cast<Evas_Object*>(windows->get_base_window()));
+                        if(wl_base_window)
+                            evt.window = (unsigned int)ecore_wl_window_id_get(wl_base_window);
+#else
                         evt.window = elm_win_xwindow_get(static_cast<Evas_Object*>(windows->get_base_window()));
+#endif
                         //window_context = windows->get_window_context(windows->get_base_window(), FALSE);
                         window_context = windows->get_window_context(windows->get_base_window());
                         if (window_context) {
index 45e5ec4..c60debf 100644 (file)
 
 #include <glib.h>
 #include <Elementary.h>
-#include <Ecore_X.h>
 #include <malloc.h>
+#ifndef WAYLAND
+#include <Ecore_X.h>
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 #include <X11/Xutil.h>
 #include <utilX.h>
+#endif
 #include <dlog.h>
 #include "sclkeyfocushandler.h"
 
 using namespace scl;
 
+#ifndef WAYLAND
 static Ecore_X_Atom ATOM_WM_CLASS = 0;
 static Ecore_X_Window app_window = 0;
+#endif
 
 const sclint rotation_values_EFL[ROTATION_MAX] = {
     0, // ROTATION_0
@@ -49,7 +53,6 @@ const sclint rotation_values_EFL[ROTATION_MAX] = {
 void release_all(Evas_Object *win);
 
 #include "sclgraphics-efl.h"
-#include <utilX.h>
 #ifdef TEST_NEWBACKEND
 #include <Ecore_Evas.h>
 #include <Ecore.h>
@@ -65,8 +68,10 @@ extern std::vector<TextCache> g_TextCache;
 CSCLWindowsImplEfl::CSCLWindowsImplEfl()
 {
     SCL_DEBUG();
+#ifndef WAYLAND
     /* Initializes all window resources */
     ATOM_WM_CLASS = ecore_x_atom_get("WM_CLASS");
+#endif
 }
 
 /**
@@ -79,6 +84,7 @@ CSCLWindowsImplEfl::~CSCLWindowsImplEfl()
 
 static Ecore_Event_Handler *_candidate_show_handler         = NULL;
 
+#ifndef WAYLAND
 static Eina_Bool x_event_window_show_cb (void *data, int ev_type, void *event)
 {
     CSCLWindows *windows = CSCLWindows::get_instance();
@@ -94,6 +100,7 @@ static Eina_Bool x_event_window_show_cb (void *data, int ev_type, void *event)
     }
     return ECORE_CALLBACK_RENEW;
 }
+#endif
 
 
 void CSCLWindowsImplEfl::init()
@@ -120,13 +127,17 @@ CSCLWindowsImplEfl::create_base_window(const sclwindow parent, SclWindowContext
         window_context->etc_info = NULL;
         window_context->window = parent;
 
-    //Adding window show event handler
-    _candidate_show_handler = ecore_event_handler_add (ECORE_X_EVENT_WINDOW_SHOW, x_event_window_show_cb, NULL);
+        //Adding window show event handler
+#ifndef WAYLAND
+        _candidate_show_handler = ecore_event_handler_add (ECORE_X_EVENT_WINDOW_SHOW, x_event_window_show_cb, NULL);
+#endif
 
 #ifndef APPLY_WINDOW_MANAGER_CHANGE
+#ifndef WAYLAND
         ecore_x_icccm_name_class_set(elm_win_xwindow_get(static_cast<Evas_Object*>(parent)), "Virtual Keyboard", "ISF" );
 
         set_window_accepts_focus(parent, FALSE);
+#endif
 #else
         if (parent) {
             evas_object_show((Evas_Object*)parent);
@@ -140,12 +151,13 @@ CSCLWindowsImplEfl::create_base_window(const sclwindow parent, SclWindowContext
     int rots[4] = {0, 90, 180, 270};
     elm_win_wm_rotation_available_rotations_set(static_cast<Evas_Object*>(parent), rots, 4);
 
+#ifndef WAYLAND
     CSCLUtils *utils = CSCLUtils::get_instance();
     if (utils) {
         utils->log("WinEfl_createbasewin %p %p, %d %d\n",
                 parent, elm_win_xwindow_get(static_cast<Evas_Object*>(parent)), width, height);
     }
-
+#endif
     return ret;
 }
 
@@ -175,6 +187,7 @@ CSCLWindowsImplEfl::create_window(const sclwindow parent, SclWindowContext *wind
         new_height = height;
     }
 
+#ifndef WAYLAND
     ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(win),
         rotation_values_EFL[ROTATION_0], 0, 0, new_width, new_height);
     ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(win),
@@ -219,7 +232,7 @@ CSCLWindowsImplEfl::create_window(const sclwindow parent, SclWindowContext *wind
         utils->log("WinEfl_createwin %p %p, %d %d\n",
                 win, elm_win_xwindow_get(static_cast<Evas_Object*>(win)), width, height);
     }
-
+#endif
     return win;
 }
 
@@ -247,11 +260,14 @@ CSCLWindowsImplEfl::create_magnifier_window(const sclwindow parent, SclWindowCon
     SclWindowContext *window_context = windows->get_window_context(windows->get_base_window());
     evas_object_resize(win, scrx, height + window_context->height);
 #else
-    //evas_object_resize(win, width, height);
+#ifdef WAYLAND
+    evas_object_resize(win, width, height);
+#endif
 #endif
 
     elm_win_profile_set(win, "mobile");
 
+#ifndef WAYLAND
     ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(win),
         rotation_values_EFL[ROTATION_0], 0, 0, width, height);
     ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(win),
@@ -297,7 +313,7 @@ CSCLWindowsImplEfl::create_magnifier_window(const sclwindow parent, SclWindowCon
         utils->log("WinEfl_createmagwin %p %p, %d %d\n",
             win, elm_win_xwindow_get(static_cast<Evas_Object*>(win)), width, height);
     }
-
+#endif
     return win;
 }
 
@@ -321,6 +337,7 @@ CSCLWindowsImplEfl::create_dim_window(const sclwindow parent, SclWindowContext *
     int rots[4] = {0,90,180,270};
     elm_win_wm_rotation_available_rotations_set(win, rots, 4);
 
+#ifndef WAYLAND
 #ifndef APPLY_WINDOW_MANAGER_CHANGE
     ecore_x_icccm_name_class_set(elm_win_xwindow_get(static_cast<Evas_Object*>(win)), "ISF Popup", "ISF");
 
@@ -339,6 +356,7 @@ CSCLWindowsImplEfl::create_dim_window(const sclwindow parent, SclWindowContext *
         }
     }
 #endif
+#endif
 
     elm_win_profile_set(win, "mobile");
 
@@ -355,11 +373,12 @@ CSCLWindowsImplEfl::create_dim_window(const sclwindow parent, SclWindowContext *
 
     hide_window(win);
 
+#ifndef WAYLAND
     if (utils) {
         utils->log("WinEfl_createdimwin %p %p, %d %d\n",
             win, elm_win_xwindow_get(static_cast<Evas_Object*>(win)), width, height);
     }
-
+#endif
     return win;
 }
 
@@ -372,10 +391,12 @@ CSCLWindowsImplEfl::set_parent(const sclwindow parent, const sclwindow window)
 {
     SCL_DEBUG();
 
+#ifndef WAYLAND
     if (parent && window) {
         ecore_x_icccm_transient_for_set(elm_win_xwindow_get(static_cast<Evas_Object*>(window)),
                 elm_win_xwindow_get(static_cast<Evas_Object*>(parent)));
     }
+#endif
 }
 
 Eina_Bool destroy_later(void *data)
@@ -465,9 +486,11 @@ CSCLWindowsImplEfl::destroy_window(sclwindow window)
                     evas_object_del(win);
                 }
             }
+#ifndef WAYLAND
             utils->log("WinEfl_destroywin %p %p (basewin %p mag %p)\n", window,
                 (window_context && !(window_context->is_virtual)) ? elm_win_xwindow_get(static_cast<Evas_Object*>(window)) : 0x01,
                 windows->get_base_window(), windows->get_magnifier_window());
+#endif
         }
     }
 
@@ -501,6 +524,7 @@ CSCLWindowsImplEfl::show_window(const sclwindow window, sclboolean queue)
                 }
             }
         }
+#ifndef WAYLAND
 #ifndef APPLY_WINDOW_MANAGER_CHANGE
         if (windows->get_base_window() == window) {
             int  ret = 0;
@@ -545,6 +569,7 @@ CSCLWindowsImplEfl::show_window(const sclwindow window, sclboolean queue)
             window,
             (window_context && !(window_context->is_virtual)) ? elm_win_xwindow_get(static_cast<Evas_Object*>(window)) : 0x01,
             windows->get_base_window(), windows->get_magnifier_window());
+#endif
     }
 }
 
@@ -660,10 +685,12 @@ CSCLWindowsImplEfl::hide_window(const sclwindow window,  sclboolean fForce)
             elm_cache_all_flush();
             malloc_trim(0);
         }
+#ifndef WAYLAND
         utils->log("WinEfl_hidewin %p %p (basewin %p mag %p)\n",
             window,
             (window_context && !(window_context->is_virtual)) ? elm_win_xwindow_get(static_cast<Evas_Object*>(window)) : 0x01,
             windows->get_base_window(), windows->get_magnifier_window());
+#endif
     }
 }
 
@@ -751,11 +778,13 @@ CSCLWindowsImplEfl::move_window(const sclwindow window, scl16 x, scl16 y)
         //Evas *evas = evas_object_evas_get(window_object);
         //evas_render_idle_flush(evas);
 
+#ifndef WAYLAND
         utils->log("WinEfl_movewin %p %p %d %d %d %d (basewin %p mag %p)\n",
             window,
             (window_context && !(window_context->is_virtual)) ? elm_win_xwindow_get(static_cast<Evas_Object*>(window)) : 0x01,
             x, y, rotatex, rotatey,
             windows->get_base_window(), windows->get_magnifier_window());
+#endif
     }
 }
 
@@ -791,10 +820,12 @@ CSCLWindowsImplEfl::resize_window(const sclwindow window, scl16 width, scl16 hei
 #ifndef FULL_SCREEN_TEST
     if (windows && utils && window) {
         SclWindowContext *window_context = windows->get_window_context(window);
+#ifndef WAYLAND
         utils->log("WinEfl_resizewin %p %p %d %d (basewin %p mag %p)\n",
             window,
             (window_context && !(window_context->is_virtual)) ? elm_win_xwindow_get(static_cast<Evas_Object*>(window)) : 0x01,
             windows->get_base_window(), windows->get_magnifier_window());
+#endif
     }
 #endif
     //Evas_Object *window_object = (Evas_Object*)window;
@@ -998,10 +1029,13 @@ CSCLWindowsImplEfl::get_window_rect(const sclwindow window, SclRectangle *rect)
     CSCLContext *context = CSCLContext::get_instance();
 
     if (utils && context && rect && window) {
-        Window junkwin;
-        Ecore_X_Window_Attributes attrs;
         int x, y, width, height;
         sclint scr_w, scr_h;
+#ifdef WAYLAND
+        evas_object_geometry_get(static_cast<Evas_Object*>(window), &x, &y, &width, &height);
+#else
+        Window junkwin;
+        Ecore_X_Window_Attributes attrs;
         //CSCLWindows *windows = CSCLWindows::get_instance();
         ecore_x_window_geometry_get(elm_win_xwindow_get(static_cast<Evas_Object*>(window)), &x, &y, &width, &height);
         ecore_x_window_attributes_get(elm_win_xwindow_get(static_cast<Evas_Object*>(window)), &attrs);
@@ -1011,6 +1045,7 @@ CSCLWindowsImplEfl::get_window_rect(const sclwindow window, SclRectangle *rect)
         utils->log("WinEfl_getwinrect %p %p, %d %d %d %d\n",
             window, elm_win_xwindow_get(static_cast<Evas_Object*>(window)),
             x, y, width, height);
+#endif
 
         /* get window size */
         utils->get_screen_resolution(&scr_w, &scr_h);
@@ -1055,7 +1090,9 @@ CSCLWindowsImplEfl::get_window_rect(const sclwindow window, SclRectangle *rect)
     return TRUE;
 }
 
+#ifndef WAYLAND
 #include <X11/Xutil.h>
+#endif
 /**
  * Sets rotation
  */
@@ -1064,6 +1101,7 @@ CSCLWindowsImplEfl::set_window_rotation(const sclwindow window, SCLRotation rota
 {
     SCL_DEBUG();
 
+#ifndef WAYLAND
     CSCLWindows *windows = CSCLWindows::get_instance();
     SclWindowContext *window_context = NULL;
 
@@ -1095,6 +1133,7 @@ CSCLWindowsImplEfl::set_window_rotation(const sclwindow window, SCLRotation rota
           windows->resize_window(window_context->window, window_context->width, winctx->height);
           }*/
     }
+#endif
 }
 
 
@@ -1199,19 +1238,6 @@ void release_all(Evas_Object *win)
 #ifndef APPLY_WINDOW_MANAGER_CHANGE
 void CSCLWindowsImplEfl::set_window_accepts_focus(const sclwindow window, sclboolean acceptable)
 {
-    Eina_Bool accepts_focus;
-    Ecore_X_Window_State_Hint initial_state;
-    Ecore_X_Pixmap icon_pixmap;
-    Ecore_X_Pixmap icon_mask;
-    Ecore_X_Window icon_window;
-    Ecore_X_Window window_group;
-    Eina_Bool is_urgent;
-
-    if (window) {
-        ecore_x_icccm_hints_get(elm_win_xwindow_get(static_cast<Evas_Object*>(window)),
-            &accepts_focus, &initial_state, &icon_pixmap, &icon_mask, &icon_window, &window_group, &is_urgent);
-        ecore_x_icccm_hints_set(elm_win_xwindow_get(static_cast<Evas_Object*>(window)),
-            acceptable, initial_state, icon_pixmap, icon_mask, icon_window, window_group, is_urgent);
-    }
+    elm_win_prop_focus_skip_set(static_cast<Evas_Object*>(window), !acceptable);
 }
 #endif
index 7b7f3d1..a13a595 100644 (file)
 #include <Elementary.h>
 #include <Evas.h>
 #include <dlog.h>
+#ifndef WAYLAND
 #include <Ecore_X.h>
 #include <utilX.h>
+#endif
 #include "sclres_type.h"
 #include "scldebug.h"
 #include "sclcontext.h"
@@ -70,6 +72,7 @@ CSCLKeyFocusHandler::get_instance()
 bool
 CSCLKeyFocusHandler::grab_keyboard(const sclwindow parent)
 {
+#ifndef WAYLAND
     Evas_Object *window = (Evas_Object *)parent;
     Ecore_X_Window x_window = elm_win_xwindow_get(window);
 
@@ -84,6 +87,7 @@ CSCLKeyFocusHandler::grab_keyboard(const sclwindow parent)
     } else {
         LOGD("Failed to Grab Return key\n");
     }
+#endif
     m_keyboard_grabbed = TRUE;
     return TRUE;
 }
@@ -94,6 +98,7 @@ CSCLKeyFocusHandler::grab_keyboard(const sclwindow parent)
 void
 CSCLKeyFocusHandler::ungrab_keyboard(const sclwindow parent)
 {
+#ifndef WAYLAND
     Evas_Object *window = (Evas_Object *)parent;
     Ecore_X_Window x_window = elm_win_xwindow_get(window);
     Display *x_display = (Display *)ecore_x_display_get();
@@ -104,6 +109,7 @@ CSCLKeyFocusHandler::ungrab_keyboard(const sclwindow parent)
     } else {
         LOGD("Failed to UnGrab Return key\n");
     }
+#endif
     m_keyboard_grabbed = FALSE;
 }
 
@@ -760,9 +766,9 @@ static void delete_sniffer_win_show_handler (void)
 /**
  * callback for window show event (sniffer window)
  */
+#ifndef WAYLAND
 static Eina_Bool x_event_sniffer_window_show_cb (void *data, int ev_type, void *event)
 {
-
     Evas_Object *evas_window = (Evas_Object *)data;
     Ecore_X_Window x_window = elm_win_xwindow_get(evas_window);
     Ecore_X_Event_Window_Show *e = (Ecore_X_Event_Window_Show*)event;
@@ -783,6 +789,7 @@ static Eina_Bool x_event_sniffer_window_show_cb (void *data, int ev_type, void *
     LOGD("Wrong window .. renewing callback\n");
     return ECORE_CALLBACK_RENEW;
 }
+#endif
 
 /**
  * sniffer window creation function, the keyboard would be grabbed by this window in case of Tizen Emulator
@@ -803,26 +810,15 @@ CSCLKeyFocusHandler::create_sniffer_window(void)
     evas_object_show(win);
     evas_object_resize(win, 100, 100);
     m_sniffer = win;
+#ifndef WAYLAND
     _sniffer_win_show_handler = ecore_event_handler_add (ECORE_X_EVENT_WINDOW_SHOW, x_event_sniffer_window_show_cb, m_sniffer);
+#endif
 }
 
 void
 CSCLKeyFocusHandler::set_window_accepts_focus(const sclwindow window, sclboolean acceptable)
 {
-    Eina_Bool accepts_focus;
-    Ecore_X_Window_State_Hint initial_state;
-    Ecore_X_Pixmap icon_pixmap;
-    Ecore_X_Pixmap icon_mask;
-    Ecore_X_Window icon_window;
-    Ecore_X_Window window_group;
-    Eina_Bool is_urgent;
-
-    if (window) {
-        ecore_x_icccm_hints_get(elm_win_xwindow_get(static_cast<Evas_Object*>(window)),
-            &accepts_focus, &initial_state, &icon_pixmap, &icon_mask, &icon_window, &window_group, &is_urgent);
-        ecore_x_icccm_hints_set(elm_win_xwindow_get(static_cast<Evas_Object*>(window)),
-            acceptable, initial_state, icon_pixmap, icon_mask, icon_window, window_group, is_urgent);
-    }
+    elm_win_prop_focus_skip_set(static_cast<Evas_Object*>(window), !acceptable);
 }
 
 
index c67d7f0..6753b92 100644 (file)
@@ -116,6 +116,7 @@ CSCLUIBuilder::init(sclwindow parent)
         sclwindow window = m_gwes->m_windows->get_base_window();
         cache->recompute_layout(window);
 
+#ifndef WAYLAND
         /* Creates the magnifier window */
         if (default_configure && magnifier_configure) {
             if (default_configure->use_magnifier_window) {
@@ -129,6 +130,7 @@ CSCLUIBuilder::init(sclwindow parent)
         /* FIXME */
         //if (scl_check_arrindex(defaultLayoutIdx, MAX_LAYOUT)) {
         m_gwes->m_windows->create_dim_window(window, NULL, sclres_layout[layout].width, sclres_layout[layout].height);
+#endif
 
         /* m_gwes->m_events->set_touch_event_offset(scl_default_configure.touch_offset);*/
         /*Moved to Show Layout*/
index 76512c6..8385cd7 100644 (file)
@@ -78,12 +78,12 @@ sclboolean CSCLUIImpl::init(sclwindow parent, const SCLParserType parser_type, c
         cache->init();
         builder->init(parent);
 
+        m_initialized = TRUE;
+
         PSclDefaultConfigure default_configure = sclres_manager->get_default_configure();
         if (default_configure) {
             set_cur_sublayout(default_configure->default_sub_layout);
         }
-
-        m_initialized = TRUE;
     }
 
     SCL_DEBUG_ELAPASED_TIME_END();
index e739576..d553e13 100644 (file)
 #include <stdarg.h>
 
 #include <Ecore.h>
+#ifdef WAYLAND
+#include <Ecore_Wayland.h>
+#else
 #include <Ecore_X.h>
+#endif
 #include <Ecore_Evas.h>
 #include <feedback.h>
 #include <Elementary.h>
@@ -37,6 +41,7 @@
 using namespace scl;
 
 static tts_h tts = NULL;
+#ifndef WAYLAND
 static Eina_Bool _get_default_zone_geometry_info (Ecore_X_Window root, scluint *x, scluint *y, scluint *w, scluint *h)
 {
     Ecore_X_Atom zone_geometry_atom;
@@ -76,7 +81,7 @@ static Eina_Bool _get_default_zone_geometry_info (Ecore_X_Window root, scluint *
 
     return ret;
 }
-
+#endif
 void accessibility_changed_cb(keynode_t *key, void* data)
 {
     int r;
@@ -158,6 +163,14 @@ CSCLUtilsImplLinux::get_screen_resolution(sclint *x, sclint *y) {
 
     static Evas_Coord scr_w = 0, scr_h = 0;
     if (scr_w == 0 || scr_h == 0) {
+#ifdef WAYLAND
+        ecore_wl_sync();
+        ecore_wl_screen_size_get(&scr_w, &scr_h);
+        if (scr_w >= 720)
+            scr_w = 720;
+        else
+            scr_w = 600;
+#else
         scluint w, h;
         w = h = 0;
         if (_get_default_zone_geometry_info(ecore_x_window_root_first_get(), NULL, NULL, &w, &h)) {
@@ -166,6 +179,7 @@ CSCLUtilsImplLinux::get_screen_resolution(sclint *x, sclint *y) {
         } else {
             ecore_x_window_size_get(ecore_x_window_root_first_get(), &scr_w, &scr_h);
         }
+#endif
     }
     if (context && x && y) {
         if (context->get_display_mode() == DISPLAYMODE_LANDSCAPE) {