Event forwarder
authorZbigniew Kosinski <z.kosinski@samsung.com>
Fri, 12 Sep 2014 13:40:24 +0000 (15:40 +0200)
committerZbigniew Kosinski <z.kosinski@samsung.com>
Fri, 12 Sep 2014 13:40:24 +0000 (15:40 +0200)
CMakeLists.txt
packaging/org.tizen.etest.spec
src/border.c
src/etest.c

index 67d27ea..7a4a837 100755 (executable)
@@ -16,6 +16,7 @@ pkg_check_modules(pkgs REQUIRED
        ecore
        atspi-2
        gobject-2.0
+        ecore-x
 )
 
 
index 9bc7e63..1bdc233 100755 (executable)
@@ -17,6 +17,9 @@ BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  at-spi2-core
 BuildRequires:  at-spi2-core-devel
 BuildRequires:  cmake
+BuildRequires:  pkgconfig(ecore-x)
+
+
 
 
 %description
index 7f73d56..9e14c31 100644 (file)
@@ -1,11 +1,11 @@
 #include <string.h>
+#include <Ecore_X.h>
 #include "border.h"
 
 #define BOUNDS_CHANGED "object:bounds-changed"
 #define WIDTH 720
 #define HEIGHT 1280
 
-static Evas* evas = NULL;
 static Evas_Object *r1 = NULL;
 static Evas_Object *r2 = NULL;
 static Evas_Object *r3 = NULL;
@@ -43,6 +43,47 @@ static void _bounds_changed(const AtspiEvent *event, void *user_data)
       draw_border(event->source);
 }
 
+Ecore_X_Window _get_win_below(int x, int y)
+{
+   int num;
+   Ecore_X_Window win = ecore_x_window_at_xy_get(x, y);
+   ecore_x_window_ignore_set(win, 1);
+   Ecore_X_Window *skip = ecore_x_window_ignore_list(&num);
+   fprintf(stderr, "win_below:%d\n", ecore_x_window_at_xy_with_skip_get(x, y, skip, num));
+   fprintf(stderr, "win_top:%d\n", win);
+   return ecore_x_window_at_xy_with_skip_get(x, y, skip, num);
+}
+
+Eina_Bool _mouse_up(void    *data,
+             int      type,
+             void    *event)
+{
+   Ecore_Event_Mouse_Button *ev = event;
+   ecore_x_mouse_up_send(_get_win_below(ev->x, ev->y), ev->x, ev->y, 1);
+   fprintf(stderr, "mouse_up\n");
+   return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool _mouse_down(void    *data,
+             int      type,
+             void    *event)
+{
+   Ecore_Event_Mouse_Button *ev = event;
+   ecore_x_mouse_down_send(_get_win_below(ev->x, ev->y), ev->x, ev->y, 1);
+   fprintf(stderr, "mouse_down\n");
+   return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool _mouse_move(void    *data,
+             int      type,
+             void    *event)
+{
+   Ecore_Event_Mouse_Button *ev = event;
+   ecore_x_mouse_move_send(_get_win_below(ev->x, ev->y), ev->x, ev->y);
+   fprintf(stderr, "mouse_move\n");
+   return ECORE_CALLBACK_PASS_ON;
+}
+
 Eina_Bool border_init(void)
 {
    GError *error = NULL;
@@ -50,7 +91,9 @@ Eina_Bool border_init(void)
       return EINA_TRUE;
 
    win = elm_win_add(NULL, "highlight", ELM_WIN_BASIC);
+
    elm_win_alpha_set(win, EINA_TRUE);
+   elm_win_override_set(win, EINA_TRUE);
    evas_object_resize(win, WIDTH, HEIGHT);
    evas_object_move(win, 0, 0);
    evas_object_layer_set(win, 6);
@@ -69,6 +112,12 @@ Eina_Bool border_init(void)
    evas_object_show(r4);
    evas_object_show(win);
 
+   ecore_event_init();
+   ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _mouse_down, NULL);
+   ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _mouse_up, NULL);
+   ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _mouse_move, NULL);
+
+
    listener = atspi_event_listener_new (_bounds_changed, NULL, NULL);
    atspi_event_listener_register (listener, BOUNDS_CHANGED, &error);
 
@@ -103,10 +152,6 @@ void border_shutdown(void)
       evas_object_del(r4);
       r4 = NULL;
    }
-   if(win) {
-      evas_object_del(win);
-      win = NULL;
-   }
 
    initialized = EINA_FALSE;
 }
index 48d1a69..0971ad5 100755 (executable)
@@ -117,6 +117,7 @@ static void _get_gestures(void *data, const Eldbus_Message *msg, Eldbus_Pending
 
 static bool create_dbus_connection(void *data)
 {
+/**
     Eldbus_Message *msg = NULL;
 
     eldbus_init();
@@ -165,6 +166,7 @@ static bool create_dbus_connection(void *data)
     eldbus_proxy_signal_handler_add(proxy, GESTURE_DETECTED, gesture_detected_signal_handler, NULL);
 
     _detector_initialize();
+**/
     border_init();
     border_set_on_event(FOCUS_EVENT);
     return 1;