aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_wayland
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/lib/ecore_wayland
parentecore: fix usage eina_condition_timedwait to use relative time instead of abs... (diff)
downloadefl-bd83d4c03ab9f6f6ae225976b9595a1dfde61237.tar.gz
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')
-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 349347203f..872409f8fb 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
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;
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 *
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;