diff options
author | Chris Michael <cp.michael@samsung.com> | 2015-10-14 14:54:54 -0400 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2015-10-14 14:54:54 -0400 |
commit | bd83d4c03ab9f6f6ae225976b9595a1dfde61237 (patch) | |
tree | b4c37608da6c7a2c56ab19d35c32fb4a4954aa41 /src/lib/ecore_wayland/ecore_wl_window.c | |
parent | c4117cdae4ad0f03d3b4d4683ad93511423f65eb (diff) |
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>
Diffstat (limited to 'src/lib/ecore_wayland/ecore_wl_window.c')
-rw-r--r-- | src/lib/ecore_wayland/ecore_wl_window.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c index 8250e78338..9f60e884c0 100644 --- a/src/lib/ecore_wayland/ecore_wl_window.c +++ b/src/lib/ecore_wayland/ecore_wl_window.c | |||
@@ -16,6 +16,7 @@ static void _ecore_xdg_handle_surface_configure(void *data, struct xdg_surface * | |||
16 | static void _ecore_xdg_handle_surface_delete(void *data, struct xdg_surface *xdg_surface); | 16 | static void _ecore_xdg_handle_surface_delete(void *data, struct xdg_surface *xdg_surface); |
17 | static void _ecore_xdg_handle_popup_done(void *data, struct xdg_popup *xdg_popup); | 17 | static void _ecore_xdg_handle_popup_done(void *data, struct xdg_popup *xdg_popup); |
18 | static void _ecore_session_recovery_uuid(void *data, struct session_recovery *session_recovery, const char *uuid); | 18 | static void _ecore_session_recovery_uuid(void *data, struct session_recovery *session_recovery, const char *uuid); |
19 | static void _anim_cb_animate(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED); | ||
19 | 20 | ||
20 | /* local variables */ | 21 | /* local variables */ |
21 | static Eina_Hash *_windows = NULL; | 22 | static Eina_Hash *_windows = NULL; |
@@ -44,6 +45,44 @@ static const struct session_recovery_listener _ecore_session_recovery_listener = | |||
44 | _ecore_session_recovery_uuid, | 45 | _ecore_session_recovery_uuid, |
45 | }; | 46 | }; |
46 | 47 | ||
48 | static const struct wl_callback_listener _anim_listener = | ||
49 | { | ||
50 | _anim_cb_animate | ||
51 | }; | ||
52 | |||
53 | static void | ||
54 | _anim_cb_animate(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED) | ||
55 | { | ||
56 | Ecore_Wl_Window *win; | ||
57 | |||
58 | win = data; | ||
59 | if (!win) return; | ||
60 | |||
61 | if ((win->anim_callback) && (callback != win->anim_callback)) return; | ||
62 | |||
63 | wl_callback_destroy(callback); | ||
64 | win->anim_callback = NULL; | ||
65 | } | ||
66 | |||
67 | static Eina_Bool | ||
68 | _ecore_wl_window_cb_animate(void *data) | ||
69 | { | ||
70 | Ecore_Wl_Window *win; | ||
71 | |||
72 | win = data; | ||
73 | if (!win->visible) return ECORE_CALLBACK_CANCEL; | ||
74 | |||
75 | if (!win->anim_callback) | ||
76 | { | ||
77 | win->anim_callback = wl_surface_frame(win->surface); | ||
78 | wl_callback_add_listener(win->anim_callback, &_anim_listener, win); | ||
79 | } | ||
80 | |||
81 | wl_surface_commit(win->surface); | ||
82 | |||
83 | return ECORE_CALLBACK_RENEW; | ||
84 | } | ||
85 | |||
47 | /* internal functions */ | 86 | /* internal functions */ |
48 | void | 87 | void |
49 | _ecore_wl_window_init(void) | 88 | _ecore_wl_window_init(void) |
@@ -405,6 +444,11 @@ ecore_wl_window_show(Ecore_Wl_Window *win) | |||
405 | default: | 444 | default: |
406 | break; | 445 | break; |
407 | } | 446 | } |
447 | |||
448 | win->visible = EINA_TRUE; | ||
449 | |||
450 | if (!win->animator) | ||
451 | win->animator = ecore_animator_add(_ecore_wl_window_cb_animate, win); | ||
408 | } | 452 | } |
409 | 453 | ||
410 | EAPI void | 454 | EAPI void |
@@ -414,6 +458,14 @@ ecore_wl_window_hide(Ecore_Wl_Window *win) | |||
414 | 458 | ||
415 | if (!win) return; | 459 | if (!win) return; |
416 | 460 | ||
461 | win->visible = EINA_FALSE; | ||
462 | |||
463 | if (win->anim_callback) wl_callback_destroy(win->anim_callback); | ||
464 | win->anim_callback = NULL; | ||
465 | |||
466 | if (win->animator) ecore_animator_del(win->animator); | ||
467 | win->animator = NULL; | ||
468 | |||
417 | if (win->xdg_surface) xdg_surface_destroy(win->xdg_surface); | 469 | if (win->xdg_surface) xdg_surface_destroy(win->xdg_surface); |
418 | win->xdg_surface = NULL; | 470 | win->xdg_surface = NULL; |
419 | 471 | ||