From 771f71e6a9db7b33d955d63e03cabbfcc5516af7 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 13 Jun 2016 12:00:09 -0400 Subject: [PATCH] add separate mouse in/out handlers for internal wins internal wayland windows are windows with ssd, meaning they can only receive pointer events on the contents of the window and not the entire window including decoration regions ref T3819 --- src/bin/e_comp_object.c | 23 +++++++++++++++ src/bin/e_comp_wl.c | 62 +++++++++++++++++++++++++++++++---------- 2 files changed, 71 insertions(+), 14 deletions(-) diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index 1bead67cf..a9432a979 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -991,6 +991,24 @@ _e_comp_object_pixels_get(void *data, Evas_Object *obj) ///////////////////////////////////////////// +static void +_e_comp_object_internal_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + E_Comp_Object *cw = data; + + evas_object_smart_callback_call(cw->smart_obj, "mouse_in", event_info); +} + +static void +_e_comp_object_internal_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + E_Comp_Object *cw = data; + + evas_object_smart_callback_call(cw->smart_obj, "mouse_out", event_info); +} + +///////////////////////////////////////////// + static void _e_comp_object_client_pending_resize_add(E_Client *ec, int w, @@ -1715,6 +1733,11 @@ _e_comp_intercept_show(void *data, Evas_Object *obj EINA_UNUSED) evas_object_name_set(cw->obj, "cw->obj"); evas_object_image_colorspace_set(cw->obj, EVAS_COLORSPACE_ARGB8888); _e_comp_object_alpha_set(cw); + if (cw->ec->internal) + { + evas_object_event_callback_add(cw->obj, EVAS_CALLBACK_MOUSE_IN, _e_comp_object_internal_mouse_in, cw); + evas_object_event_callback_add(cw->obj, EVAS_CALLBACK_MOUSE_OUT, _e_comp_object_internal_mouse_out, cw); + } #ifdef BORDER_ZOOMAPS e_comp_object_zoomap_set(o, 1); #else diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 13c715dae..855f549d6 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -134,17 +134,13 @@ _e_comp_wl_evas_cb_hide(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EIN } static void -_e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) +_e_comp_wl_mouse_in(E_Client *ec, Evas_Event_Mouse_In *ev) { - E_Client *ec; - Evas_Event_Mouse_In *ev; struct wl_resource *res; struct wl_client *wc; Eina_List *l; uint32_t serial; - ev = event; - if (!(ec = data)) return; if (e_object_is_del(E_OBJECT(ec))) return; if (!ec->comp_data->surface) return; @@ -169,15 +165,25 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj } static void -_e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) +_e_comp_wl_evas_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + _e_comp_wl_mouse_in(data, event_info); +} + +static void +_e_comp_wl_cb_internal_mouse_in(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + _e_comp_wl_mouse_in(data, event_info); +} + +static void +_e_comp_wl_mouse_out(E_Client *ec, Evas_Event_Mouse_Out *ev EINA_UNUSED) { - E_Client *ec; struct wl_resource *res; struct wl_client *wc; Eina_List *l; uint32_t serial; - if (!(ec = data)) return; if (ec->cur_mouse_action && e_grabinput_mouse_win_get()) return; /* FIXME? this is a hack to just reset the cursor whenever we mouse out. not sure if accurate */ { @@ -209,6 +215,18 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob } } +static void +_e_comp_wl_evas_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + _e_comp_wl_mouse_out(data, event_info); +} + +static void +_e_comp_wl_cb_internal_mouse_out(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + _e_comp_wl_mouse_out(data, event_info); +} + static void _e_comp_wl_send_mouse_move(E_Client *ec, int x, int y, unsigned int timestamp) { @@ -234,6 +252,7 @@ _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o Evas_Event_Mouse_Move *ev = event; if (ec->cur_mouse_action) return; + if (!ec->mouse.in) return; if (e_object_is_del(E_OBJECT(ec))) return; if (ec->ignored) return; if (!ec->comp_data->surface) return; @@ -278,6 +297,7 @@ _e_comp_wl_evas_cb_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object * if (ec->cur_mouse_action) return; if (e_object_is_del(E_OBJECT(ec))) return; if (ec->ignored) return; + if (!ec->mouse.in) return; if (ev->direction == 0) axis = WL_POINTER_AXIS_VERTICAL_SCROLL; @@ -313,6 +333,7 @@ _e_comp_wl_evas_cb_multi_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *o if (e_object_is_del(E_OBJECT(ec))) return; if (!ec->comp_data->surface) return; + if (!ec->mouse.in) return; wc = wl_resource_get_client(ec->comp_data->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); @@ -341,6 +362,7 @@ _e_comp_wl_evas_cb_multi_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj if (e_object_is_del(E_OBJECT(ec))) return; if (!ec->comp_data->surface) return; + if (!ec->mouse.in) return; wc = wl_resource_get_client(ec->comp_data->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); @@ -365,6 +387,7 @@ _e_comp_wl_evas_cb_multi_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o if (e_object_is_del(E_OBJECT(ec))) return; if (!ec->comp_data->surface) return; + if (!ec->mouse.in) return; wc = wl_resource_get_client(ec->comp_data->surface); @@ -826,12 +849,22 @@ _e_comp_wl_client_evas_init(E_Client *ec) _e_comp_wl_evas_cb_hide, ec); /* setup input callbacks */ - evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_IN, - EVAS_CALLBACK_PRIORITY_AFTER, - _e_comp_wl_evas_cb_mouse_in, ec); - evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_OUT, - EVAS_CALLBACK_PRIORITY_AFTER, - _e_comp_wl_evas_cb_mouse_out, ec); + if (ec->internal) + { + evas_object_smart_callback_add(ec->frame, "mouse_in", + (Evas_Smart_Cb)_e_comp_wl_cb_internal_mouse_in, ec); + evas_object_smart_callback_add(ec->frame, "mouse_out", + (Evas_Smart_Cb)_e_comp_wl_cb_internal_mouse_out, ec); + } + else + { + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_IN, + EVAS_CALLBACK_PRIORITY_AFTER, + (Evas_Object_Event_Cb)_e_comp_wl_evas_cb_mouse_in, ec); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_OUT, + EVAS_CALLBACK_PRIORITY_AFTER, + (Evas_Object_Event_Cb)_e_comp_wl_evas_cb_mouse_out, ec); + } evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_MOVE, EVAS_CALLBACK_PRIORITY_AFTER, _e_comp_wl_evas_cb_mouse_move, ec); @@ -3049,6 +3082,7 @@ e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t bu return EINA_FALSE; if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; if (ec->ignored) return EINA_FALSE; + if (!ec->mouse.in) return EINA_FALSE; switch (button_id) {