summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-10-14 14:54:54 -0400
committerChris Michael <cp.michael@samsung.com>2015-10-14 14:54:54 -0400
commitbd83d4c03ab9f6f6ae225976b9595a1dfde61237 (patch)
treeb4c37608da6c7a2c56ab19d35c32fb4a4954aa41 /src
parentc4117cdae4ad0f03d3b4d4683ad93511423f65eb (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')
-rw-r--r--src/lib/ecore_wayland/ecore_wl_private.h2
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c52
2 files changed, 54 insertions, 0 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_private.h b/src/lib/ecore_wayland/ecore_wl_private.h
index 3493472..872409f 100644
--- a/src/lib/ecore_wayland/ecore_wl_private.h
+++ b/src/lib/ecore_wayland/ecore_wl_private.h
@@ -157,6 +157,7 @@ struct _Ecore_Wl_Window
157 Eina_Bool alpha : 1; 157 Eina_Bool alpha : 1;
158 Eina_Bool transparent : 1; 158 Eina_Bool transparent : 1;
159 Eina_Bool has_buffer : 1; 159 Eina_Bool has_buffer : 1;
160 Eina_Bool visible : 1;
160 161
161 Ecore_Wl_Window_Type type; 162 Ecore_Wl_Window_Type type;
162 Ecore_Wl_Window_Buffer_Type buffer_type; 163 Ecore_Wl_Window_Buffer_Type buffer_type;
@@ -164,6 +165,7 @@ struct _Ecore_Wl_Window
164 Ecore_Wl_Input *pointer_device; 165 Ecore_Wl_Input *pointer_device;
165 Ecore_Wl_Input *keyboard_device; 166 Ecore_Wl_Input *keyboard_device;
166 167
168 Ecore_Animator *animator;
167 Eina_Bool anim_pending : 1; 169 Eina_Bool anim_pending : 1;
168 struct wl_callback *anim_callback; 170 struct wl_callback *anim_callback;
169 171
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c
index 8250e78..9f60e88 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 *
16static void _ecore_xdg_handle_surface_delete(void *data, struct xdg_surface *xdg_surface); 16static void _ecore_xdg_handle_surface_delete(void *data, struct xdg_surface *xdg_surface);
17static void _ecore_xdg_handle_popup_done(void *data, struct xdg_popup *xdg_popup); 17static void _ecore_xdg_handle_popup_done(void *data, struct xdg_popup *xdg_popup);
18static void _ecore_session_recovery_uuid(void *data, struct session_recovery *session_recovery, const char *uuid); 18static void _ecore_session_recovery_uuid(void *data, struct session_recovery *session_recovery, const char *uuid);
19static void _anim_cb_animate(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED);
19 20
20/* local variables */ 21/* local variables */
21static Eina_Hash *_windows = NULL; 22static 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
48static const struct wl_callback_listener _anim_listener =
49{
50 _anim_cb_animate
51};
52
53static 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
67static 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 */
48void 87void
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
410EAPI void 454EAPI 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