diff --git a/src/bin/e_comp_canvas.c b/src/bin/e_comp_canvas.c index f0e28f808..1d42e5137 100644 --- a/src/bin/e_comp_canvas.c +++ b/src/bin/e_comp_canvas.c @@ -98,7 +98,7 @@ _e_comp_canvas_cb_mouse_wheel(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Obj } static Eina_Bool -_e_comp_cb_key_down(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_Event_Key *ev) +_key_down(int ctx, Ecore_Event_Key *ev) { e_screensaver_notidle(); if (e_menu_grab_window_get()) @@ -120,7 +120,7 @@ _e_comp_cb_key_down(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_Event */ if ((!ec) || (ev->event_window != e_comp->ee_win)) return ECORE_CALLBACK_RENEW; } - return !e_bindings_key_down_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(e_comp), ev) + return !e_bindings_key_down_event_handle(ctx, E_OBJECT(e_comp), ev) #ifdef HAVE_WAYLAND && !e_comp_wl_key_down(ev) #endif @@ -128,7 +128,19 @@ _e_comp_cb_key_down(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_Event } static Eina_Bool -_e_comp_cb_key_up(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_Event_Key *ev) +_e_comp_canvas_cb_key_down(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_Event_Key *ev) +{ + return _key_down(E_BINDING_CONTEXT_COMPOSITOR, ev); +} + +static Eina_Bool +_e_comp_cb_key_down(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_Event_Key *ev) +{ + return _key_down(E_BINDING_CONTEXT_MANAGER, ev); +} + +static Eina_Bool +_key_up(int ctx, Ecore_Event_Key *ev) { e_screensaver_notidle(); if (e_menu_grab_window_get()) @@ -139,13 +151,49 @@ _e_comp_cb_key_up(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_Event_K return ECORE_CALLBACK_RENEW; } if ((e_comp->comp_type == E_PIXMAP_TYPE_X) && (ev->event_window != e_comp->root)) return ECORE_CALLBACK_PASS_ON; - return !e_bindings_key_up_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(e_comp), ev) + return !e_bindings_key_up_event_handle(ctx, E_OBJECT(e_comp), ev) #ifdef HAVE_WAYLAND && !e_comp_wl_key_up(ev) #endif ; } +static Eina_Bool +_e_comp_canvas_cb_key_up(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_Event_Key *ev) +{ + return _key_up(E_BINDING_CONTEXT_COMPOSITOR, ev); +} + +static Eina_Bool +_e_comp_cb_key_up(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_Event_Key *ev) +{ + return _key_up(E_BINDING_CONTEXT_MANAGER, ev); +} + +static Eina_Bool +_e_comp_cb_mouse_up(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Button *ev) +{ + if ((e_comp->comp_type == E_PIXMAP_TYPE_X) && (ev->event_window != e_comp->root)) + return ECORE_CALLBACK_PASS_ON; + return !e_bindings_mouse_down_ecore_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(e_comp), ev); +} + +static Eina_Bool +_e_comp_cb_mouse_down(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Button *ev) +{ + if ((e_comp->comp_type == E_PIXMAP_TYPE_X) && (ev->event_window != e_comp->root)) + return ECORE_CALLBACK_PASS_ON; + return !e_bindings_mouse_down_ecore_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(e_comp), ev); +} + +static Eina_Bool +_e_comp_cb_mouse_wheel(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Wheel *ev) +{ + if ((e_comp->comp_type == E_PIXMAP_TYPE_X) && (ev->event_window != e_comp->root)) + return ECORE_CALLBACK_PASS_ON; + return !e_bindings_wheel_ecore_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(e_comp), ev); +} + //////////////////////////////////// static Eina_Bool @@ -280,8 +328,8 @@ e_comp_canvas_init(int w, int h) E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_MOVE_RESIZE, _e_comp_cb_zone_change, NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_ADD, _e_comp_cb_zone_change, NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DEL, _e_comp_cb_zone_change, NULL); - E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_DOWN, _e_comp_cb_key_down, NULL); - E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_UP, _e_comp_cb_key_up, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_DOWN, _e_comp_canvas_cb_key_down, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_UP, _e_comp_canvas_cb_key_up, NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _e_comp_cb_screensaver_on, NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_OFF, _e_comp_cb_screensaver_off, NULL); @@ -738,3 +786,14 @@ e_comp_canvas_feed_mouse_up(unsigned int activate_time) evas_event_feed_mouse_up(e_comp->evas, i + 1, EVAS_BUTTON_NONE, activate_time, NULL); } } + +EINTERN void +e_comp_canvas_intercept(void) +{ + ecore_event_init(); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_comp_cb_mouse_down, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_comp_cb_mouse_up, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_WHEEL, _e_comp_cb_mouse_wheel, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_DOWN, _e_comp_cb_key_down, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_UP, _e_comp_cb_key_up, NULL); +} diff --git a/src/bin/e_comp_canvas.h b/src/bin/e_comp_canvas.h index 69ce721f7..911b8d8e6 100644 --- a/src/bin/e_comp_canvas.h +++ b/src/bin/e_comp_canvas.h @@ -29,6 +29,8 @@ E_API void e_comp_canvas_keys_grab(void); E_API void e_comp_canvas_keys_ungrab(void); E_API void e_comp_canvas_feed_mouse_up(unsigned int activate_time); +EINTERN void e_comp_canvas_intercept(void); + /* the following functions are used for adjusting root window coordinates * to/from canvas coordinates. * this ensures correct positioning when running E as a nested compositor diff --git a/src/bin/e_main.c b/src/bin/e_main.c index b62406c05..772e119e3 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -365,7 +365,7 @@ main(int argc, char **argv) } TS("Ecore Init Done"); _e_main_shutdown_push(ecore_shutdown); - + e_comp_canvas_intercept(); e_first_frame = getenv("E_FIRST_FRAME"); if (e_first_frame && e_first_frame[0]) e_first_frame_start_time = ecore_time_get();