Support build in wayland environment 38/41138/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 10 Jun 2015 08:07:03 +0000 (17:07 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 11 Jun 2015 08:54:05 +0000 (17:54 +0900)
Change-Id: Ibeafeb0f9d4f69608686cbb051739779d107e148

CMakeLists.txt
packaging/libscl-core.spec
src/sclconnection-isf.cpp
src/sclcoreui-efl.cpp

index a9ff9c4..4bb3989 100644 (file)
@@ -25,15 +25,23 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src
                    )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED
+
+SET(PKGS_CHECK_MODULES
         elementary
         dlog
         isf
         vconf
-        ecore-x
+
         libscl-common
         )
 
+IF (with_wayland)
+        ADD_DEFINITIONS("-DWAYLAND")
+        pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES})
+ELSE (with_wayland)
+        pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-x)
+ENDIF(with_wayland)
+
 FOREACH(flag ${pkgs_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
index c2d29c3..c346554 100644 (file)
@@ -1,3 +1,6 @@
+%bcond_with x
+%bcond_with wayland
+
 %define _optdir /opt
 %define _appdir %{_optdir}/apps
 
@@ -14,7 +17,10 @@ BuildRequires:  pkgconfig(elementary)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(isf)
+%if %{with wayland}
+%else
 BuildRequires:  pkgconfig(ecore-x)
+%endif
 BuildRequires:  pkgconfig(libscl-common)
 
 
@@ -40,7 +46,12 @@ export FFLAGS+=" -DTIZEN_DEBUG_ENABLE"
 
 rm -rf CMakeFiles
 rm -rf CMakeCache.txt
+
+%if %{with wayland}
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -Dwith_wayland=TRUE
+%else
 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+%endif
 make %{?jobs:-j%jobs}
 
 %install
index 4a11f22..96bbb22 100644 (file)
@@ -625,6 +625,7 @@ void CSCLConnectionISF::open_connection(const sclchar *display)
             if (impl) {
                 main_window = NATIVE_WINDOW_CAST(impl->get_main_window());
             }
+#ifndef WAYLAND
             Ecore_X_Window xwindow = elm_win_xwindow_get(main_window);
             char xid[255];
             snprintf(xid, 255, "%d", xwindow);
@@ -632,6 +633,7 @@ void CSCLConnectionISF::open_connection(const sclchar *display)
             scim::PropertyList props;
             props.push_back(prop);
             m_helper_agent.register_properties(props);
+#endif
 
             m_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, input_handler, &m_helper_agent, NULL, NULL);
         }
index a89f99d..4ffd69d 100644 (file)
 #include <vconf-keys.h>
 
 #include <glib.h>
+#ifdef WAYLAND
+#include <Ecore_Wayland.h>
+#else
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
+#endif
 
 
 using namespace scl;
@@ -74,10 +78,15 @@ sclwindow CSCLCoreUIEFL::get_main_window()
 void CSCLCoreUIEFL::set_keyboard_size_hints(SclSize portrait, SclSize landscape)
 {
     Evas_Object *main_window = NATIVE_WINDOW_CAST(m_main_window);
+
+#ifdef WAYLAND
+    evas_object_resize(main_window, portrait.width, portrait.height);
+#else
     ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(main_window),   0, 0, 0, portrait.width, portrait.height);
     ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(main_window),  90, 0, 0, landscape.height, landscape.width);
     ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(main_window), 180, 0, 0, portrait.width, portrait.height);
     ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(main_window), 270, 0, 0, landscape.height, landscape.width);
+#endif
 }
 
 const char * extract_themename_from_theme_file_path(const char *filepath) {
@@ -145,6 +154,7 @@ void accessibility_changed_cb(keynode_t *key, void* data)
     }
 }
 
+#ifndef WAYLAND
 static Eina_Bool _client_message_cb(void *data, int type, void *event)
 {
     Ecore_X_Event_Client_Message *ev = (Ecore_X_Event_Client_Message *)event;
@@ -197,10 +207,13 @@ static Eina_Bool _client_message_cb(void *data, int type, void *event)
 
     return ECORE_CALLBACK_RENEW;
 }
+#endif
 
 int CSCLCoreUIEFL::get_screen_rotation_degree()
 {
     int angle = 0;
+
+#ifndef WAYLAND
     if (m_rotation_degree == -1) {
         int  ret = 0;
         Atom type_return;
@@ -250,6 +263,7 @@ int CSCLCoreUIEFL::get_screen_rotation_degree()
     } else {
         angle = m_rotation_degree;
     }
+#endif
 
     return angle;
 }
@@ -289,12 +303,14 @@ void CSCLCoreUIEFL::run(const sclchar *display)
         int rots[] = { 0, 90, 180, 270 };
         elm_win_wm_rotation_available_rotations_set(main_window, rots, (sizeof(rots) / sizeof(int)));
 
+#ifndef WAYLAND
         unsigned int set = 1;
         ecore_x_window_prop_card32_set(elm_win_xwindow_get(main_window),
             ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
             &set, 1);
 
         ecore_x_icccm_name_class_set(elm_win_xwindow_get(main_window), "Virtual Keyboard", "ISF");
+#endif
 
         vconf_notify_key_changed(VCONFKEY_LANGSET, language_changed_cb, NULL);
         vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, accessibility_changed_cb, NULL);
@@ -305,8 +321,10 @@ void CSCLCoreUIEFL::run(const sclchar *display)
 
         impl->init(display);
 
+#ifndef WAYLAND
         Ecore_Event_Handler *XClientMsgHandler =
             ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _client_message_cb, this);
+#endif
 
         signal(SIGQUIT, signal_handler);
         signal(SIGTERM, signal_handler);
@@ -320,10 +338,12 @@ void CSCLCoreUIEFL::run(const sclchar *display)
         vconf_ignore_key_changed(VCONFKEY_LANGSET, language_changed_cb);
         vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, accessibility_changed_cb);
 
+#ifndef WAYLAND
         if (XClientMsgHandler) {
             ecore_event_handler_del(XClientMsgHandler);
             XClientMsgHandler = NULL;
         }
+#endif
 
         elm_shutdown();
     }
@@ -360,6 +380,7 @@ set_transient_for_app_window(Evas_Object *window)
 {
     /* Set a transient window for window stack */
     /* Gets the current XID of the active window into the root window property  */
+#ifndef WAYLAND
     Atom type_return;
     unsigned long nitems_return;
     unsigned long bytes_after_return;
@@ -385,6 +406,7 @@ set_transient_for_app_window(Evas_Object *window)
             XFree(data);
         }
     }
+#endif
 }
 
 static void
@@ -392,6 +414,7 @@ set_transient_for_isf_setting_window(Evas_Object *window)
 {
     /* Set a transient window for window stack */
     /* Gets the current XID of the active window into the root window property  */
+#ifndef WAYLAND
     Atom type_return;
     unsigned long nitems_return;
     unsigned long bytes_after_return;
@@ -421,6 +444,7 @@ set_transient_for_isf_setting_window(Evas_Object *window)
             XFree(data);
         }
     }
+#endif
 }
 
 sclwindow CSCLCoreUIEFL::create_option_window(SCLOptionWindowType type)
@@ -476,7 +500,11 @@ sclwindow CSCLCoreUIEFL::create_option_window(SCLOptionWindowType type)
 
     Ecore_Event_Handler *handler = NULL;
     if (type == OPTION_WINDOW_TYPE_NORMAL) {
+#ifdef WAYLAND
+        handler = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, focus_out_cb, &m_option_window_info[type]);
+#else
         handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, focus_out_cb, &m_option_window_info[type]);
+#endif
         set_transient_for_app_window(window);
     } else if (type == OPTION_WINDOW_TYPE_SETTING_APPLICATION) {
         set_transient_for_isf_setting_window(window);