From 0b290a260c4984f8de2f2f8d61cbd92df480e8ea Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Tue, 25 Oct 2016 10:50:43 -0400 Subject: [PATCH] Revert "elementary: Provide EFL mouse pointers for Wayland Client applications" This reverts commit 0a46096337dcbde7b18e093518e3b0846a425053. Reverting these changes as we need to handle mouse pointer differently. --- src/lib/elementary/efl_ui_win.c | 158 +++++++++++----------------------------- src/lib/elementary/els_cursor.c | 33 +++++---- 2 files changed, 64 insertions(+), 127 deletions(-) diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 6d750b3..6008828 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -919,23 +919,8 @@ _elm_win_mouse_in(Ecore_Evas *ee) _elm_win_throttle_ok = EINA_TRUE; if (sd->resizing) sd->resizing = EINA_FALSE; #ifdef HAVE_ELEMENTARY_WL2 - if (sd->wl.win) + if (sd->wl.win && (!sd->frame_obj)) ecore_wl2_window_cursor_from_name_set(sd->wl.win, NULL); - - ecore_evas_object_cursor_set(sd->ee, sd->pointer.obj, - ELM_OBJECT_LAYER_CURSOR, - sd->pointer.hot_x, sd->pointer.hot_y); -#endif -} - -static void -_elm_win_mouse_out(Ecore_Evas *ee) -{ - Efl_Ui_Win_Data *sd = _elm_win_associate_get(ee); - if (!sd) return; - -#ifdef HAVE_ELEMENTARY_WL2 - sd->pointer.obj = ecore_evas_cursor_unset(sd->ee); #endif } @@ -3518,15 +3503,10 @@ _elm_win_frame_cb_move_start(void *data, if (!sd) return; #ifdef HAVE_ELEMENTARY_WL2 - if (sd->wl.win) - ecore_wl2_window_cursor_from_name_set(sd->wl.win, NULL); - if (!strcmp(source, "elm")) - _elm_theme_object_set(sd->obj, sd->pointer.obj, - "pointer", "base", "move"); + ecore_wl2_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_HAND1); else - _elm_theme_object_set(sd->obj, sd->pointer.obj, - "pointer", "base", "default"); + ecore_wl2_window_cursor_from_name_set(sd->wl.win, NULL); #else (void)source; #endif @@ -3555,7 +3535,6 @@ _elm_win_frame_cb_move_stop(void *data, #ifdef HAVE_ELEMENTARY_WL2 if (sd->wl.win) ecore_wl2_window_cursor_from_name_set(sd->wl.win, NULL); - _elm_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", "default"); #endif } @@ -3584,6 +3563,19 @@ static struct _resize_info _border_corner[4] = #endif static void +_elm_win_frame_obj_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ +#ifdef HAVE_ELEMENTARY_WL2 + Efl_Ui_Win_Data *sd = data; + + if (sd->wl.win) + ecore_wl2_window_cursor_from_name_set(sd->wl.win, NULL); +#else + (void)data; +#endif +} + +static void _elm_win_frame_obj_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, @@ -3623,44 +3615,34 @@ _elm_win_frame_cb_resize_show(void *data, if (sd->resizing) return; #ifdef HAVE_ELEMENTARY_WL2 - Evas_Coord mw = 1, mh = 1, hx = 0, hy = 0; int i; - i = sd->rot / 90; if (!strcmp(source, "elm.event.resize.t")) - _elm_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", - _border_side[(0 + i) % 4].name); + ecore_wl2_window_cursor_from_name_set(sd->wl.win, + _border_side[(0 + i) % 4].name); else if (!strcmp(source, "elm.event.resize.b")) - _elm_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", - _border_side[(2 + i) % 4].name); + ecore_wl2_window_cursor_from_name_set(sd->wl.win, + _border_side[(2 + i) % 4].name); else if (!strcmp(source, "elm.event.resize.l")) - _elm_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", - _border_side[(1 + i) % 4].name); + ecore_wl2_window_cursor_from_name_set(sd->wl.win, + _border_side[(1 + i) % 4].name); else if (!strcmp(source, "elm.event.resize.r")) - _elm_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", - _border_side[(3 + i) % 4].name); + ecore_wl2_window_cursor_from_name_set(sd->wl.win, + _border_side[(3 + i) % 4].name); else if (!strcmp(source, "elm.event.resize.tl")) - _elm_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", - _border_corner[(0 + i) % 4].name); + ecore_wl2_window_cursor_from_name_set(sd->wl.win, + _border_corner[(0 + i) % 4].name); else if (!strcmp(source, "elm.event.resize.tr")) - _elm_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", - _border_corner[(3 + i) % 4].name); + ecore_wl2_window_cursor_from_name_set(sd->wl.win, + _border_corner[(3 + i) % 4].name); else if (!strcmp(source, "elm.event.resize.bl")) - _elm_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", - _border_corner[(1 + i) % 4].name); + ecore_wl2_window_cursor_from_name_set(sd->wl.win, + _border_corner[(1 + i) % 4].name); else if (!strcmp(source, "elm.event.resize.br")) - _elm_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", - _border_corner[(2 + i) % 4].name); + ecore_wl2_window_cursor_from_name_set(sd->wl.win, + _border_corner[(2 + i) % 4].name); else - _elm_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", "default"); - - edje_object_size_min_calc(sd->pointer.obj, &mw, &mh); - evas_object_resize(sd->pointer.obj, mw, mh); - edje_object_part_geometry_get(sd->pointer.obj, "elm.swallow.hotspot", - &hx, &hy, NULL, NULL); - sd->pointer.hot_x = hx; - sd->pointer.hot_y = hy; - + ecore_wl2_window_cursor_from_name_set(sd->wl.win, NULL); #else (void)source; #endif @@ -3678,7 +3660,7 @@ _elm_win_frame_cb_resize_hide(void *data, if (sd->resizing) return; #ifdef HAVE_ELEMENTARY_WL2 - _elm_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", "default"); + ecore_wl2_window_cursor_from_name_set(sd->wl.win, NULL); #endif } @@ -3837,39 +3819,6 @@ _elm_win_frame_pre_render(void *data, Evas *e EINA_UNUSED, void *ev EINA_UNUSED) #endif static void -_elm_win_frame_cb_mouse_down(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Efl_Ui_Win_Data *sd; - - if (!(sd = data)) return; - if (!sd->pointer.obj) return; - edje_object_signal_emit(sd->pointer.obj, "elm,action,mouse,down", "elm"); -} - -static void -_elm_win_frame_cb_mouse_up(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Efl_Ui_Win_Data *sd; - - if (!(sd = data)) return; - if (!sd->pointer.obj) return; - edje_object_signal_emit(sd->pointer.obj, "elm,action,mouse,up", "elm"); -} - -static void -_elm_win_frame_cb_mouse_move(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Efl_Ui_Win_Data *sd; - - if (!(sd = data)) return; - if (!sd->pointer.obj) return; - edje_object_signal_emit(sd->pointer.obj, "elm,action,mouse,move", "elm"); -} - -static void _elm_win_frame_add(Efl_Ui_Win_Data *sd, const char *style) { Evas_Object *obj = sd->obj; @@ -3913,18 +3862,15 @@ _elm_win_frame_add(Efl_Ui_Win_Data *sd, const char *style) } } - edje_object_part_swallow(sd->frame_obj, "elm.swallow.icon", sd->icon); + edje_object_part_swallow(sd->frame_obj, "elm.swallow.icon", + sd->icon); evas_object_event_callback_add + (sd->frame_obj, EVAS_CALLBACK_MOUSE_IN, _elm_win_frame_obj_mouse_in, sd); + evas_object_event_callback_add (sd->frame_obj, EVAS_CALLBACK_MOVE, _elm_win_frame_obj_move, sd); evas_object_event_callback_add (sd->frame_obj, EVAS_CALLBACK_RESIZE, _elm_win_frame_obj_resize, sd); - evas_object_event_callback_add - (sd->frame_obj, EVAS_CALLBACK_MOUSE_DOWN, _elm_win_frame_cb_mouse_down, sd); - evas_object_event_callback_add - (sd->frame_obj, EVAS_CALLBACK_MOUSE_UP, _elm_win_frame_cb_mouse_up, sd); - evas_object_event_callback_add - (sd->frame_obj, EVAS_CALLBACK_MOUSE_MOVE, _elm_win_frame_cb_mouse_move, sd); /* NB: Do NOT remove these calls !! Needed to calculate proper * framespace on initial show of the window */ @@ -4042,6 +3988,7 @@ _debug_key_down(void *data EINA_UNUSED, INF("Tree graph generated."); elm_object_tree_dot_dump(obj, "./dump.dot"); } + #endif static void @@ -4707,11 +4654,7 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Elm_W ecore_evas_callback_move_set(sd->ee, _elm_win_move); ecore_evas_callback_pre_render_set(sd->ee, _elm_win_pre_render); if (type != ELM_WIN_FAKE) - { - ecore_evas_callback_mouse_in_set(sd->ee, _elm_win_mouse_in); - ecore_evas_callback_mouse_out_set(sd->ee, _elm_win_mouse_out); - } - + ecore_evas_callback_mouse_in_set(sd->ee, _elm_win_mouse_in); evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_win_cb_hide, NULL); evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _elm_win_cb_show, NULL); @@ -4765,16 +4708,10 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Elm_W if (type != ELM_WIN_FAKE) { - /* NB: As we do not want to use standard X/FDO cursors for EFL - * Wayland Client Apps, we can use Elm Softcursor to provide an - * EFL mouse pointer for Wayland Client Apps */ if ((_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_ON) || ((_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_AUTO) && - ((engine) && - ((!strcmp(engine, ELM_SOFTWARE_FB)) || - (!strcmp(engine, ELM_DRM)) || - (!strcmp(engine, ELM_WAYLAND_SHM)) || - (!strcmp(engine, ELM_WAYLAND_EGL)))))) + ((engine) && + ((!strcmp(engine, ELM_SOFTWARE_FB)) || (!strcmp(engine, ELM_DRM)))))) { Evas_Object *o; Evas_Coord mw = 1, mh = 1, hx = 0, hy = 0; @@ -4787,15 +4724,8 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Elm_W &hx, &hy, NULL, NULL); sd->pointer.hot_x = hx; sd->pointer.hot_y = hy; - - /* NB: Sadly we have to mark pointer as a frame object now due - * to the recent changes in evas_render wrt framespace & context - * clipping...if we do not, then the pointer never gets drawn - * over the frame object due to clipping */ - evas_object_is_frame_object_set(sd->pointer.obj, EINA_TRUE); - - ecore_evas_object_cursor_set(tmp_sd.ee, o, - ELM_OBJECT_LAYER_CURSOR, hx, hy); + evas_object_show(o); + ecore_evas_object_cursor_set(tmp_sd.ee, o, EVAS_LAYER_MAX, hx, hy); } else if (_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_OFF) { diff --git a/src/lib/elementary/els_cursor.c b/src/lib/elementary/els_cursor.c index d321053..f25ba35 100644 --- a/src/lib/elementary/els_cursor.c +++ b/src/lib/elementary/els_cursor.c @@ -282,7 +282,6 @@ _elm_cursor_set(Elm_Cursor *cur) if (cur->visible) return; evas_event_freeze(cur->evas); - if (!cur->use_engine) { if (!cur->obj) @@ -306,6 +305,10 @@ _elm_cursor_set(Elm_Cursor *cur) if (cur->x.win) ecore_x_window_cursor_set(cur->x.win, cur->x.cursor); #endif +#ifdef HAVE_ELEMENTARY_WL2 + if (cur->wl.win) + ecore_wl2_window_cursor_from_name_set(cur->wl.win, cur->cursor_name); +#endif #ifdef HAVE_ELEMENTARY_COCOA if (cur->cocoa.win) @@ -362,15 +365,18 @@ _elm_cursor_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_ } if (!cur->use_engine) - cur->obj = ecore_evas_cursor_unset(cur->ee); - /* ecore_evas_object_cursor_set(cur->ee, NULL, ELM_OBJECT_LAYER_CURSOR, */ - /* cur->hot_x, cur->hot_y); */ + ecore_evas_object_cursor_set(cur->ee, NULL, ELM_OBJECT_LAYER_CURSOR, + cur->hot_x, cur->hot_y); else { #ifdef HAVE_ELEMENTARY_X if (cur->x.win) ecore_x_window_cursor_set(cur->x.win, ECORE_X_CURSOR_X); #endif +#ifdef HAVE_ELEMENTARY_WL2 + if (cur->wl.win) + ecore_wl2_window_cursor_from_name_set(cur->wl.win, NULL); +#endif #ifdef HAVE_ELEMENTARY_COCOA if (cur->cocoa.win) @@ -421,15 +427,12 @@ _elm_cursor_cur_set(Elm_Cursor *cur) cur->use_engine = EINA_TRUE; } -#if defined (HAVE_ELEMENTARY_DRM) || defined(HAVE_ELEMENTARY_WL2) +#ifdef HAVE_ELEMENTARY_DRM const char *engine_name; engine_name = ecore_evas_engine_name_get(cur->ee); - if ((engine_name) && - ((!strcmp(engine_name, ELM_DRM)) || - (!strcmp(engine_name, ELM_WAYLAND_SHM)) || - (!strcmp(engine_name, ELM_WAYLAND_EGL)))) - cur->use_engine = EINA_FALSE; + if ((engine_name) && (!strcmp(engine_name, ELM_DRM))) + cur->use_engine = EINA_FALSE; #endif if (cur->use_engine) @@ -478,9 +481,9 @@ _elm_cursor_cur_set(Elm_Cursor *cur) } #endif -/* #ifdef HAVE_ELEMENTARY_WL2 */ -/* cur->wl.win = elm_win_wl_window_get(top); */ -/* #endif */ +#ifdef HAVE_ELEMENTARY_WL2 + cur->wl.win = elm_win_wl_window_get(top); +#endif #ifdef HAVE_ELEMENTARY_WIN32 cur->win32.win = elm_win_win32_window_get(top); if (cur->win32.win) @@ -624,6 +627,10 @@ elm_object_cursor_unset(Evas_Object *obj) else if (cur->cocoa.win) ecore_cocoa_window_cursor_set(cur->cocoa.win, ECORE_COCOA_CURSOR_DEFAULT); #endif +#ifdef HAVE_ELEMENTARY_WL2 + else if (cur->wl.win) + ecore_wl2_window_cursor_from_name_set(cur->wl.win, NULL); +#endif #ifdef HAVE_ELEMENTARY_WIN32 else ecore_win32_window_cursor_set(cur->win32.win, ecore_win32_cursor_shaped_new(ECORE_WIN32_CURSOR_SHAPE_ARROW)); -- 2.7.4