Refactor for wayland environment 90/39390/1
authorMinJeong Kim <minjjj.kim@samsung.com>
Thu, 14 May 2015 07:28:25 +0000 (16:28 +0900)
committerMinJeong Kim <minjjj.kim@samsung.com>
Thu, 14 May 2015 07:46:09 +0000 (16:46 +0900)
1. Enable build with wayland
2. Add HAVE_WAYLAND/HAVE_X macro
3. Recover request for change of window stack
4. Calculate window id with surface id and pid for wayland

Change-Id: Ifbdc77f89996c54c5bc133153eb628b0a162b738
Signed-off-by: MinJeong Kim <minjjj.kim@samsung.com>
configure.ac
packaging/e-tizen-testcase.spec
src/0200_transient_for.c
src/e_test_runner.c
src/e_test_runner.h

index 74928e2..9d25352 100644 (file)
@@ -20,12 +20,37 @@ AC_USE_SYSTEM_EXTENSIONS
 AM_PROG_CC_STDC
 AM_PROG_CC_C_O
 
+## X11
+AC_ARG_WITH([x11],
+            AC_HELP_STRING([--with-x11], [use x11]),
+            [WITH_X="yes"
+            AC_SUBST([WITH_X])], [WITH_X="no"])
+if test "x${WITH_X}" = x"yes"; then
+  AC_DEFINE_UNQUOTED([HAVE_X],[1],[define HAVE_X])
+fi
+AM_CONDITIONAL(HAVE_X, [test "${WITH_X}" = x"yes"])
+
+## Wayland
+AC_ARG_WITH([wayland],
+            AC_HELP_STRING([--with-wayland], [use wayland]),
+            [WITH_WAYLAND="yes"
+             AC_SUBST([WIHT_WAYLAND])], [WITH_WAYLAND="no"])
+if test "x${WITH_WAYLAND}" = x"yes"; then
+  AC_DEFINE_UNQUOTED([HAVE_WAYLAND],[1],[define HAVE_WAYLAND])
+fi
+AM_CONDITIONAL(HAVE_WAYLAND, [test "${WITH_WAYLAND}" = x"yes"])
+
 requirements="\
    elementary \
    eldbus \
    enlightenment \
-   capi-ui-efl-util \
-   "
+   capi-ui-efl-util"
+
+if test "x$WITH_WAYLAND" = x"yes"; then
+requirements="$requirements \
+              wayland-client \
+              ecore-wayland"
+fi
 
 PKG_CHECK_MODULES(E_TEST_RUNNER, [${requirements}])
 
index 5f76913..33b49c2 100644 (file)
@@ -1,3 +1,4 @@
+%bcond_with wayland
 %bcond_with x
 
 Name: e-tizen-testcase
@@ -13,10 +14,6 @@ BuildRequires: pkgconfig(eldbus)
 BuildRequires: pkgconfig(capi-ui-efl-util)
 BuildRequires:  gettext
 
-%if !%{with x}
-ExclusiveArch:
-%endif
-
 %description
 This package is a test case runner for enlightenment.
 
@@ -30,7 +27,13 @@ export CFLAGS+=" -Wall -g -fPIC -rdynamic ${GC_SECTIONS_FLAGS}"
 export LDFLAGS+=" -Wl,--hash-style=both -Wl,--as-needed -Wl,--rpath=/usr/lib"
 
 %autogen
-%configure --prefix=/usr
+%configure --prefix=/usr \
+%if %{with x}
+      --with-x11
+%endif
+%if %{with wayland}
+      --with-wayland
+%endif
 make %{?_smp_mflags}
 
 %install
index 054cfdf..cb909e3 100644 (file)
@@ -146,7 +146,7 @@ tc_0201_transient_for_raise(E_TC *tc)
 
    tw = tc->data->tw;
 
-   e_tc_win_stack_change(tw, NULL, EINA_TRUE);
+   e_test_runner_req_win_stack_set(tc->runner, tw, NULL, EINA_TRUE);
 
    res = e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE);
    EINA_SAFETY_ON_FALSE_GOTO(res, cleanup);
@@ -184,7 +184,7 @@ tc_0202_transient_for_lower(E_TC *tc)
 
    tw = tc->data->tw;
 
-   e_tc_win_stack_change(tw, NULL, EINA_FALSE);
+   e_test_runner_req_win_stack_set(tc->runner, tw, NULL, EINA_FALSE);
 
    res = e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_LOWER);
    EINA_SAFETY_ON_FALSE_GOTO(res, cleanup);
@@ -225,7 +225,7 @@ tc_0203_transient_for_stack_above(E_TC *tc)
    tw_parent = tc->data->tw_parent;
    tw_child = tc->data->tw_child;
 
-   e_tc_win_stack_change(tw_parent, tw, EINA_TRUE);
+   e_test_runner_req_win_stack_set(tc->runner, tw_parent, tw, EINA_TRUE);
 
    res = e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_ABOVE);
    EINA_SAFETY_ON_FALSE_GOTO(res, cleanup);
@@ -278,7 +278,7 @@ tc_0204_transient_for_stack_below(E_TC *tc)
    tw_parent = tc->data->tw_parent;
    tw_child = tc->data->tw_child;
 
-   e_tc_win_stack_change(tw_parent, tw, EINA_FALSE);
+   e_test_runner_req_win_stack_set(tc->runner, tw_parent, tw, EINA_FALSE);
 
    res = e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_BELOW);
    EINA_SAFETY_ON_FALSE_GOTO(res, cleanup);
index 1ea270e..8d6124e 100644 (file)
@@ -227,6 +227,27 @@ e_test_runner_req_win_deregister(E_Test_Runner *runner,
    return allowed;
 }
 
+Eina_Bool
+e_test_runner_req_win_stack_set(E_Test_Runner *runner,
+                                E_TC_Win *tw,
+                                E_TC_Win *sibling,
+                                Eina_Bool above)
+{
+   Eldbus_Pending *p;
+   p = eldbus_proxy_call(runner->dbus.proxy,
+                         "SetWindowStack",
+                         NULL,
+                         NULL,
+                         -1,
+                         "uui",
+                         tw->native_win,
+                         sibling? sibling->native_win : 0,
+                         above);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE);
+
+   return EINA_TRUE;
+}
+
 Eina_List *
 e_test_runner_req_win_info_list_get(E_Test_Runner *runner)
 {
@@ -343,7 +364,7 @@ e_tc_win_add(E_TC_Win *parent,
    EINA_SAFETY_ON_NULL_RETURN_VAL(tw, NULL);
 
    tw->elm_win = elm_win;
-   tw->native_win = elm_win_xwindow_get(elm_win); // TODO: wayland
+   tw->native_win = elm_win_window_id_get(elm_win);
    tw->name = eina_stringshare_add(name);
    tw->x = x;
    tw->y = y;
@@ -352,6 +373,10 @@ e_tc_win_add(E_TC_Win *parent,
    tw->layer = layer;
    tw->alpha = alpha;
 
+#if HAVE_WAYLAND
+   tw->native_win = ((uint64_t)tw->native_win << 32) + getpid();
+#endif
+
    return tw;
 
 err:
@@ -420,34 +445,6 @@ e_tc_win_hide(E_TC_Win *tw)
    evas_object_hide(tw->elm_win);
 }
 
-void
-e_tc_win_stack_change(E_TC_Win *tw, E_TC_Win *sibling, Eina_Bool above)
-{
-   /* TODO */
-   if (sibling)
-     {
-        if (above)
-          {
-             ; // stack above: window is placed above sibling window.
-          }
-        else
-          {
-             ; // stack below: window is placed below sibling window.
-          }
-     }
-   else
-     {
-        if (above)
-          {
-             ; // raise: window is placed at the top of stack.
-          }
-        else
-          {
-             ; // lower: window is placed at the bottom of stack.
-          }
-     }
-}
-
 static E_TC *
 _e_tc_add(unsigned int num,
           const char *name,
index 613fb98..ff2fcc7 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef E_TC_MAIN_H
 #define E_TC_MAIN_H
 
+#include "config.h"
 #include <Eldbus.h>
 #include <Elementary.h>
 
@@ -117,6 +118,7 @@ struct _E_TC
 Eina_Bool  e_test_runner_req_win_register(E_Test_Runner *runner, E_TC_Win *tw);
 Eina_Bool  e_test_runner_req_win_deregister(E_Test_Runner *runner, E_TC_Win *tw);
 Eina_List *e_test_runner_req_win_info_list_get(E_Test_Runner *runner);
+Eina_Bool  e_test_runner_req_win_stack_set(E_Test_Runner *runner, E_TC_Win *tw, E_TC_Win *sibling, Eina_Bool above);
 Eina_Bool  e_test_runner_ev_wait(E_Test_Runner *runner, E_TC_Event_Type ev);
 
 E_TC_Win  *e_tc_win_add(E_TC_Win *parent, Elm_Win_Type type, Eina_Bool alpha, const char *name, int x, int y, int w, int h, int layer);
@@ -125,7 +127,6 @@ void       e_tc_win_del(E_TC_Win *tw);
 void       e_tc_win_geom_update(E_TC_Win *tw);
 void       e_tc_win_show(E_TC_Win *tw);
 void       e_tc_win_hide(E_TC_Win *tw);
-void       e_tc_win_stack_change(E_TC_Win *tw, E_TC_Win *sibling, Eina_Bool above);
 
 /* test cases */
 Eina_Bool  tc_0000_base_pass(E_TC *tc);