ecore-wayland: Redo window animators to not use Custom source animators

Summary: This moves window animators (for frame callbacks) to not use
a custom animator source but rather use a timer-based source. This
also moves animators to be per-window based (in that an animator is
created per-window).

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-10-14 14:54:54 -04:00
parent c4117cdae4
commit bd83d4c03a
2 changed files with 54 additions and 0 deletions

View File

@ -157,6 +157,7 @@ struct _Ecore_Wl_Window
Eina_Bool alpha : 1;
Eina_Bool transparent : 1;
Eina_Bool has_buffer : 1;
Eina_Bool visible : 1;
Ecore_Wl_Window_Type type;
Ecore_Wl_Window_Buffer_Type buffer_type;
@ -164,6 +165,7 @@ struct _Ecore_Wl_Window
Ecore_Wl_Input *pointer_device;
Ecore_Wl_Input *keyboard_device;
Ecore_Animator *animator;
Eina_Bool anim_pending : 1;
struct wl_callback *anim_callback;

View File

@ -16,6 +16,7 @@ static void _ecore_xdg_handle_surface_configure(void *data, struct xdg_surface *
static void _ecore_xdg_handle_surface_delete(void *data, struct xdg_surface *xdg_surface);
static void _ecore_xdg_handle_popup_done(void *data, struct xdg_popup *xdg_popup);
static void _ecore_session_recovery_uuid(void *data, struct session_recovery *session_recovery, const char *uuid);
static void _anim_cb_animate(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED);
/* local variables */
static Eina_Hash *_windows = NULL;
@ -44,6 +45,44 @@ static const struct session_recovery_listener _ecore_session_recovery_listener =
_ecore_session_recovery_uuid,
};
static const struct wl_callback_listener _anim_listener =
{
_anim_cb_animate
};
static void
_anim_cb_animate(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED)
{
Ecore_Wl_Window *win;
win = data;
if (!win) return;
if ((win->anim_callback) && (callback != win->anim_callback)) return;
wl_callback_destroy(callback);
win->anim_callback = NULL;
}
static Eina_Bool
_ecore_wl_window_cb_animate(void *data)
{
Ecore_Wl_Window *win;
win = data;
if (!win->visible) return ECORE_CALLBACK_CANCEL;
if (!win->anim_callback)
{
win->anim_callback = wl_surface_frame(win->surface);
wl_callback_add_listener(win->anim_callback, &_anim_listener, win);
}
wl_surface_commit(win->surface);
return ECORE_CALLBACK_RENEW;
}
/* internal functions */
void
_ecore_wl_window_init(void)
@ -405,6 +444,11 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
default:
break;
}
win->visible = EINA_TRUE;
if (!win->animator)
win->animator = ecore_animator_add(_ecore_wl_window_cb_animate, win);
}
EAPI void
@ -414,6 +458,14 @@ ecore_wl_window_hide(Ecore_Wl_Window *win)
if (!win) return;
win->visible = EINA_FALSE;
if (win->anim_callback) wl_callback_destroy(win->anim_callback);
win->anim_callback = NULL;
if (win->animator) ecore_animator_del(win->animator);
win->animator = NULL;
if (win->xdg_surface) xdg_surface_destroy(win->xdg_surface);
win->xdg_surface = NULL;