From 2ec16fbf3239f91f05882ca0b4f3bc18a92bd431 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 4 Apr 2018 13:50:43 -0500 Subject: [PATCH] elm_win: Improve wayland cursor change race When changing cursors under wayland sometimes we'll see the old cursor moved to the new hotspot briefly before the cursor changes. This makes that suck less often. A proper fix would involve creating a new wayland surface for every cursor change (actual change, not just a new frame of an animated cursor). Given the current internals this is invasive. Do the easy thing for now. --- src/lib/elementary/efl_ui_win.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index ebe7224e77..6fe7c16fc6 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -3196,6 +3196,18 @@ _elm_win_wl_cursor_set(Evas_Object *obj, const char *cursor) Ecore_Wl2_Input *input; Eina_Iterator *it; + /* FIXME: Here be dragons... + pointer_set_cursor is totally unsynchronized, and on a cursor + change we get here before the new cursor is rendered. So + the cursor frequently moves to its new hotspot with the old + cursor image, causing an ugly jump. + Forcing manual render causes us to render first then set the + cursor, which is still racey but far more likely to win the + race. + The right way to do this is to create an entirely new surface + on every cursor change. + */ + ecore_evas_manual_render(sd->pointer.ee); it = ecore_wl2_display_inputs_get(ecore_wl2_window_display_get(sd->wl.win)); EINA_ITERATOR_FOREACH(it, input) ecore_wl2_input_pointer_set(input, sd->pointer.surf, sd->pointer.hot_x, sd->pointer.hot_y);