From aeb7c1642a60c85c15389d49788768db47cc7dcc Mon Sep 17 00:00:00 2001 From: Viktor Kojouharov Date: Fri, 30 May 2008 22:30:57 +0000 Subject: [PATCH] ecore_x: * in ecore_x_pointer_xy_get, fill x & y with '-1', if the pointer is not in the same screen as the given window * add 'same_screen' and 'root_win' information for the XEvents dealing with keyboard and mouse events e: * make sure e_manager_current_get returns the correct manager for the current screen * fix various modules to use the correct window, when dealing with events SVN revision: 34705 --- src/bin/e_manager.c | 28 +++++++++++++++++++++++----- src/modules/exebuf/e_exebuf.c | 10 +++++----- src/modules/pager/e_mod_main.c | 8 ++++---- src/modules/winlist/e_winlist.c | 10 +++++----- 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/src/bin/e_manager.c b/src/bin/e_manager.c index 0ad85c8ce..569acdb4c 100644 --- a/src/bin/e_manager.c +++ b/src/bin/e_manager.c @@ -17,6 +17,7 @@ static int _e_manager_cb_screensaver_notify(void *data, int ev_type, void *ev); static Evas_Bool _e_manager_frame_extents_free_cb(const Evas_Hash *hash __UNUSED__, const char *key __UNUSED__, void *data, void *fdata __UNUSED__); +static E_Manager *_e_manager_get_for_root(Ecore_X_Window root); #if 0 /* use later - maybe */ static int _e_manager_cb_window_destroy(void *data, int ev_type, void *ev); static int _e_manager_cb_window_hide(void *data, int ev_type, void *ev); @@ -456,6 +457,8 @@ e_manager_current_get(void) { man = l->data; ecore_x_pointer_xy_get(man->win, &x, &y); + if (x == -1 && y == -1) + continue; if (E_INSIDE(x, y, man->x, man->y, man->w, man->h)) return man; } @@ -584,7 +587,9 @@ _e_manager_cb_key_down(void *data, int ev_type __UNUSED__, void *ev) man = data; e = ev; + if (e->event_win != man->root) return 1; + if (e->root_win != man->root) man = _e_manager_get_for_root(e->root_win); if (e_bindings_key_down_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(man), ev)) return 0; return 1; @@ -593,11 +598,6 @@ _e_manager_cb_key_down(void *data, int ev_type __UNUSED__, void *ev) static int _e_manager_cb_key_up(void *data, int ev_type __UNUSED__, void *ev) { - E_Manager *man; - Ecore_X_Event_Key_Up *e; - - man = data; - e = ev; return 1; } @@ -783,6 +783,24 @@ _e_manager_frame_extents_free_cb(const Evas_Hash *hash __UNUSED__, const char *k return 1; } +static E_Manager * +_e_manager_get_for_root(Ecore_X_Window root) +{ + Evas_List *l; + E_Manager *man; + int x, y; + + if (!managers) return NULL; + for (l = managers; l; l = l->next) + { + man = l->data; + if (man->root == root) + return man; + } + return managers->data; +} + + #if 0 /* use later - maybe */ static int _e_manager_cb_window_destroy(void *data, int ev_type, void *ev){return 1;} static int _e_manager_cb_window_hide(void *data, int ev_type, void *ev){return 1;} diff --git a/src/modules/exebuf/e_exebuf.c b/src/modules/exebuf/e_exebuf.c index 06d6f92a4..66167d62f 100644 --- a/src/modules/exebuf/e_exebuf.c +++ b/src/modules/exebuf/e_exebuf.c @@ -1242,7 +1242,7 @@ _e_exebuf_cb_key_down(void *data, int type, void *event) ev_last_is_mouse = 0; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; if (!strcmp(ev->keysymbol, "Up")) _e_exebuf_prev(); else if (!strcmp(ev->keysymbol, "Down")) @@ -1295,7 +1295,7 @@ _e_exebuf_cb_mouse_down(void *data, int type, void *event) Ecore_X_Event_Mouse_Button_Down *ev; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; if (ev_last_mouse_exe && (exe_sel != ev_last_mouse_exe)) { @@ -1313,7 +1313,7 @@ _e_exebuf_cb_mouse_up(void *data, int type, void *event) Ecore_X_Event_Mouse_Button_Up *ev; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; if (ev->button == 1) _e_exebuf_exec(); else if (ev->button == 2) @@ -1328,7 +1328,7 @@ _e_exebuf_cb_mouse_move(void *data, int type, void *event) Ecore_X_Event_Mouse_Move *ev; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; if (!ev_last_is_mouse) { @@ -1358,7 +1358,7 @@ _e_exebuf_cb_mouse_wheel(void *data, int type, void *event) Ecore_X_Event_Mouse_Wheel *ev; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; ev_last_is_mouse = 0; diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index 0db41b5ef..1bba1b626 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -2526,7 +2526,7 @@ _pager_popup_cb_mouse_down(void *data, int type, void *event) Pager_Popup *pp = act_popup; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; evas_event_feed_mouse_down(pp->popup->evas, ev->button, 0, ev->time, NULL); @@ -2540,7 +2540,7 @@ _pager_popup_cb_mouse_up(void *data, int type, void *event) Pager_Popup *pp = act_popup; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; evas_event_feed_mouse_up(pp->popup->evas, ev->button, 0, ev->time, NULL); @@ -2554,7 +2554,7 @@ _pager_popup_cb_mouse_move(void *data, int type, void *event) Pager_Popup *pp = act_popup; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; evas_event_feed_mouse_move(pp->popup->evas, ev->x - pp->popup->x + pp->pager->zone->x, @@ -2588,7 +2588,7 @@ _pager_popup_cb_key_down(void *data, int type, void *event) Ecore_X_Event_Key_Down *ev; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; if (!strcmp(ev->keysymbol, "Up")) _pager_popup_desk_switch(0, -1); else if (!strcmp(ev->keysymbol, "Down")) diff --git a/src/modules/winlist/e_winlist.c b/src/modules/winlist/e_winlist.c index 7f2f2e393..0d5764463 100644 --- a/src/modules/winlist/e_winlist.c +++ b/src/modules/winlist/e_winlist.c @@ -748,7 +748,7 @@ _e_winlist_cb_key_down(void *data, int type, void *event) Ecore_X_Event_Key_Down *ev; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; if (!strcmp(ev->keysymbol, "Up")) e_winlist_prev(); else if (!strcmp(ev->keysymbol, "Down")) @@ -890,7 +890,7 @@ _e_winlist_cb_mouse_down(void *data, int type, void *event) Ecore_X_Event_Mouse_Button_Down *ev; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_WINLIST, E_OBJECT(winlist->zone), ev); return 1; @@ -902,7 +902,7 @@ _e_winlist_cb_mouse_up(void *data, int type, void *event) Ecore_X_Event_Mouse_Button_Up *ev; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_WINLIST, E_OBJECT(winlist->zone), ev); return 1; @@ -914,7 +914,7 @@ _e_winlist_cb_mouse_wheel(void *data, int type, void *event) Ecore_X_Event_Mouse_Wheel *ev; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; e_bindings_wheel_event_handle(E_BINDING_CONTEXT_WINLIST, E_OBJECT(winlist->zone), ev); if (ev->z < 0) /* up */ @@ -938,7 +938,7 @@ _e_winlist_cb_mouse_move(void *data, int type, void *event) Ecore_X_Event_Mouse_Move *ev; ev = event; - if (ev->win != input_window) return 1; + if (ev->event_win != input_window) return 1; evas_event_feed_mouse_move(winlist->evas, ev->x - winlist->x + winlist->zone->x, ev->y - winlist->y + winlist->zone->y, ev->time, NULL);