Removing X references and calls 02/2802/1 accepted/2.0alpha-wayland/20130304.233201 submit/2.0alpha-wayland/20130304.213804
authorbrianjjones <brian.j.jones@intel.com>
Mon, 4 Mar 2013 21:37:36 +0000 (13:37 -0800)
committerbrianjjones <brian.j.jones@intel.com>
Mon, 4 Mar 2013 21:37:36 +0000 (13:37 -0800)
CMakeLists.txt
src/appcore-efl.c
src/appcore-rotation.c
src/appcore.c

index 44f491e..5bf46b0 100644 (file)
@@ -24,14 +24,12 @@ SET(CMAKE_SKIP_BUILD_RPATH TRUE)
 SET(APPCORE_COMMON "appcore-common")
 SET(SRCS_common src/appcore.c src/appcore-i18n.c src/appcore-measure.c
 #              src/appcore-noti.c src/appcore-pmcontrol.c 
-               src/appcore-rotation.c
-#              src/appcore-util.c
-               src/appcore-X.c)
+               src/appcore-rotation.c)
 SET(HEADERS_common appcore-common.h)
 
 INCLUDE(FindPkgConfig)
-#pkg_check_modules(pkg_common REQUIRED pmapi vconf sensor aul rua dlog x11)
-pkg_check_modules(pkg_common REQUIRED vconf sensor aul dlog x11 ecore-x)
+#pkg_check_modules(pkg_common REQUIRED pmapi vconf sensor aul rua dlog)
+pkg_check_modules(pkg_common REQUIRED vconf sensor aul dlog)
 FOREACH(flag ${pkg_common_CFLAGS})
        SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} ${flag}")
 ENDFOREACH(flag)
index 162619f..ea43f11 100755 (executable)
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
+
+#if HAVE_X
 #include <X11/Xatom.h>
 #include <X11/Xlib.h>
 #include <Ecore_X.h>
+#endif
+
 #include <Elementary.h>
+#include <Ecore_Wayland.h>
 #include <glib-object.h>
 #include <malloc.h>
 #include <sysman.h>
@@ -350,11 +355,18 @@ static bool __update_win(unsigned int win, bool bfobscured)
 
 }
 
+#if HAVE_X
 Ecore_X_Atom atom_parent;
+#endif
 
 static Eina_Bool __show_cb(void *data, int type, void *event)
 {
+
+#if HAVE_X
+       //There is no Wayland equivelent show event yet, this is stubbed out until there is
+
        Ecore_X_Event_Window_Show *ev;
+       Ecore_Wl_Event_Window_Configure *ev;            //there is no Window_Show for wayland
        int ret;
        Ecore_X_Window parent;
 
@@ -374,12 +386,17 @@ static Eina_Bool __show_cb(void *data, int type, void *event)
        else
                __update_win((unsigned int)ev->win, FALSE);
 
+#endif
        return ECORE_CALLBACK_RENEW;
 }
 
 static Eina_Bool __hide_cb(void *data, int type, void *event)
 {
+
+#if HAVE_X      
+       //There is no Wayland equivelent for hide event yet, this is stubbed out until there is 
        Ecore_X_Event_Window_Hide *ev;
+       Ecore_Wl_Event_Window_Configure *ev;
        int bvisibility = 0;
 
        ev = event;
@@ -397,11 +414,15 @@ static Eina_Bool __hide_cb(void *data, int type, void *event)
                }
        }
 
+#endif
        return ECORE_CALLBACK_RENEW;
 }
 
 static Eina_Bool __visibility_cb(void *data, int type, void *event)
 {
+
+#if HAVE_X
+       //There is no Wayland equivelent for visibility event yet, this is stubbed out until there is
        Ecore_X_Event_Window_Visibility_Change *ev;
        int bvisibility = 0;
 
@@ -421,13 +442,15 @@ static Eina_Bool __visibility_cb(void *data, int type, void *event)
                __do_app(AE_PAUSE, data, NULL);
        } else
                _DBG(" No change state \n");
-
+#endif
        return ECORE_CALLBACK_RENEW;
 
 }
 
 static void __add_climsg_cb(struct ui_priv *ui)
 {
+
+#if HAVE_X
        _ret_if(ui == NULL);
 
        atom_parent = ecore_x_atom_get("_E_PARENT_BORDER_WINDOW");
@@ -443,7 +466,7 @@ static void __add_climsg_cb(struct ui_priv *ui)
        ui->hvchange =
            ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE,
                                    __visibility_cb, ui);
-
+#endif
 }
 
 static int __before_loop(struct ui_priv *ui, int *argc, char ***argv)
index 78b60ba..1e789e4 100755 (executable)
 
 #include <sensor.h>
 #include <vconf.h>
+
+#if HAVE_X
 #include <Ecore_X.h>
 #include <Ecore.h>
 #include <X11/Xlib.h>
+#endif
 
+#include <Ecore_Wayland.h>
 #include "appcore-internal.h"
 
+#if HAVE_X
 #define _MAKE_ATOM(a, s)                              \
    do {                                               \
         a = ecore_x_atom_get(s);                      \
         if (!a)                                       \
           _ERR("##s creation failed.\n");             \
    } while(0)
+#endif
 
 #define STR_ATOM_ROTATION_LOCK                "_E_ROTATION_LOCK"
 
-static Ecore_X_Atom ATOM_ROTATION_LOCK = 0;
+
+static int ATOM_ROTATION_LOCK = 0;
+
+#if HAVE_X
 static Ecore_X_Window root;
+#endif
 
 struct rot_s {
        int handle;
@@ -102,12 +112,12 @@ static enum appcore_rm __get_mode(int event_data)
 
 static Eina_Bool __property(void *data, int type, void *event)
 {
-       Ecore_X_Event_Window_Property *ev = event;
+       Ecore_Wl_Event_Window_Configure *ev =event;
 
        if (!ev)
                return ECORE_CALLBACK_PASS_ON;
 
-       if (ev->atom == ATOM_ROTATION_LOCK) {
+       if (ev->event_win == ATOM_ROTATION_LOCK) {
                _DBG("[APP %d] Rotation: %d -> %d, cb_set : %d", getpid(), rot.mode, changed_m, rot.cb_set);
                if (rot.cb_set && rot.mode != changed_m) {
                        rot.callback(changed_m, changed_data);
@@ -143,6 +153,8 @@ static void __changed_cb(unsigned int event_type, sensor_event_data_t *event,
 
        _DBG("[APP %d] Rotation: %d -> %d", getpid(), rot.mode, m);
 
+#if HAVE_X
+       //Missing wayland equivelent
        if (rot.callback) {
                if (rot.cb_set && rot.mode != m) {
                        ret = ecore_x_window_prop_card32_get(root, ATOM_ROTATION_LOCK, &val, 1);
@@ -162,6 +174,7 @@ static void __changed_cb(unsigned int event_type, sensor_event_data_t *event,
                }
                changed_m = m;
        }
+#endif
 }
 
 static void __lock_cb(keynode_t *node, void *data)
@@ -194,7 +207,7 @@ static void __lock_cb(keynode_t *node, void *data)
                                                 ecore_event_handler_del(changed_handle);
                                                 changed_handle = NULL;
                                        }
-                                       changed_handle = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, __property, NULL);
+                                       changed_handle = ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, __property, NULL);
                                }
                        }
 
@@ -277,10 +290,11 @@ EXPORT_API int appcore_set_rotation_cb(int (*cb) (enum appcore_rm, void *),
        rot.handle = handle;
        __add_rotlock(data);
 
+#if HAVE_X
        _MAKE_ATOM(ATOM_ROTATION_LOCK, STR_ATOM_ROTATION_LOCK );
        root =  ecore_x_window_root_first_get();
        XSelectInput(ecore_x_display_get(), root, PropertyChangeMask);
-
+#endif
        return 0;
 }
 
index fa316b8..da73801 100755 (executable)
@@ -194,7 +194,9 @@ static int __app_reset(void *data, bundle * k)
 
 static int __app_resume(void *data)
 {
+       #if HAVE_X
        x_raise_win(getpid());
+       #endif
        return 0;
 }