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.
This commit is contained in:
Derek Foreman 2018-04-04 13:50:43 -05:00
parent c6ce04e48f
commit 2ec16fbf32
1 changed files with 12 additions and 0 deletions

View File

@ -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);