From f190df472a713e4ee1e3e6fe8f3450d1fef7923f Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 25 Nov 2020 20:19:35 +0000 Subject: [PATCH] e pointer limit hot cursors hot spots to bounds and track hot geom found hot spot was not being tracked right as callbacks for obj moves arent in sync with getting part geom - so get geom of the swallowed obj itself. then hot geom is right and the hot limitign ensures a bad theme design with out of bound hot geom wont lead to bland cursors @fix --- src/bin/e_pointer.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/bin/e_pointer.c b/src/bin/e_pointer.c index 82f928192..f0ce9adee 100644 --- a/src/bin/e_pointer.c +++ b/src/bin/e_pointer.c @@ -225,8 +225,7 @@ _e_pointer_cb_hot_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA if (!ptr->e_cursor) return; if (!evas_object_visible_get(ptr->o_ptr)) return; - edje_object_part_geometry_get(ptr->o_ptr, "e.swallow.hotspot", - &x, &y, NULL, NULL); + evas_object_geometry_get(ptr->o_hot, &x, &y, NULL, NULL); _e_pointer_hot_update(ptr, x, y); } @@ -237,8 +236,7 @@ _e_pointer_cb_hot_show(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA int x = 0, y = 0; if (!ptr->e_cursor) return; - edje_object_part_geometry_get(ptr->o_ptr, "e.swallow.hotspot", - &x, &y, NULL, NULL); + evas_object_geometry_get(ptr->o_hot, &x, &y, NULL, NULL); _e_pointer_hot_update(ptr, x, y); } @@ -792,9 +790,15 @@ e_pointer_idler_before(void) { #ifndef HAVE_WAYLAND_ONLY Ecore_X_Cursor cur; + int hotx = ptr->hot.x; + int hoty = ptr->hot.y; - cur = ecore_x_cursor_new(ptr->win, ptr->pixels, ptr->w, - ptr->h, ptr->hot.x, ptr->hot.y); + if (hotx < 0) hotx = 0; + else if (hotx >= ptr->w) hotx = ptr->w - 1; + if (hoty < 0) hoty = 0; + else if (hoty >= ptr->h) hoty = ptr->h - 1; + cur = ecore_x_cursor_new(ptr->win, ptr->pixels, + ptr->w, ptr->h, hotx, hoty); ecore_x_window_cursor_set(ptr->win, cur); ecore_x_cursor_free(cur); #endif