[gtk/wip/ebassi/animations: 5/5] WIP: Create an animation manager for GtkWindow
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/ebassi/animations: 5/5] WIP: Create an animation manager for GtkWindow
- Date: Wed, 24 Jul 2019 15:47:11 +0000 (UTC)
commit b2bd7f64f0f6347b6dd6224de02182a3be333bf4
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Jul 24 16:41:55 2019 +0100
WIP: Create an animation manager for GtkWindow
gtk/gtkroot.c | 19 ++++++++++++++++++-
gtk/gtkrootprivate.h | 5 ++++-
gtk/gtkwindow.c | 20 ++++++++++++++++++++
3 files changed, 42 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkroot.c b/gtk/gtkroot.c
index dce284a57f..08970362f6 100644
--- a/gtk/gtkroot.c
+++ b/gtk/gtkroot.c
@@ -50,18 +50,24 @@ gtk_root_default_get_display (GtkRoot *self)
return gdk_display_get_default ();
}
-
static GtkConstraintSolver *
gtk_root_default_get_constraint_solver (GtkRoot *self)
{
return NULL;
}
+static GtkAnimationManager *
+gtk_root_default_get_animation_manager (GtkRoot *self)
+{
+ return NULL;
+}
+
static void
gtk_root_default_init (GtkRootInterface *iface)
{
iface->get_display = gtk_root_default_get_display;
iface->get_constraint_solver = gtk_root_default_get_constraint_solver;
+ iface->get_animation_manager = gtk_root_default_get_animation_manager;
g_object_interface_install_property (iface,
g_param_spec_object ("focus-widget",
@@ -101,6 +107,17 @@ gtk_root_get_constraint_solver (GtkRoot *self)
return iface->get_constraint_solver (self);
}
+GtkAnimationManager *
+gtk_root_get_animation_manager (GtkRoot *self)
+{
+ GtkRootInterface *iface;
+
+ g_return_val_if_fail (GTK_IS_ROOT (self), NULL);
+
+ iface = GTK_ROOT_GET_IFACE (self);
+ return iface->get_animation_manager (self);
+}
+
/**
* gtk_root_set_focus:
* @self: a #GtkRoot
diff --git a/gtk/gtkrootprivate.h b/gtk/gtkrootprivate.h
index aae7a674a5..c77402eadf 100644
--- a/gtk/gtkrootprivate.h
+++ b/gtk/gtkrootprivate.h
@@ -3,11 +3,12 @@
#include "gtkroot.h"
+#include "gtkanimationmanagerprivate.h"
#include "gtkconstraintsolverprivate.h"
G_BEGIN_DECLS
-/**
+/*< private >
* GtkRootIface:
*
* The list of functions that must be implemented for the #GtkRoot interface.
@@ -21,9 +22,11 @@ struct _GtkRootInterface
GdkDisplay * (* get_display) (GtkRoot *self);
GtkConstraintSolver * (* get_constraint_solver) (GtkRoot *self);
+ GtkAnimationManager * (* get_animation_manager) (GtkRoot *self);
};
GtkConstraintSolver * gtk_root_get_constraint_solver (GtkRoot *self);
+GtkAnimationManager * gtk_root_get_animation_manager (GtkRoot *self);
enum {
GTK_ROOT_PROP_FOCUS_WIDGET,
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index dab50be990..1b5d10bf89 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -283,6 +283,7 @@ typedef struct
GList *foci;
GtkConstraintSolver *constraint_solver;
+ GtkAnimationManager *animation_manager;
} GtkWindowPrivate;
#ifdef GDK_WINDOWING_X11
@@ -2367,6 +2368,23 @@ gtk_window_root_get_constraint_solver (GtkRoot *root)
return priv->constraint_solver;
}
+static GtkAnimationManager *
+gtk_window_root_get_animation_manager (GtkRoot *root)
+{
+ GtkWindow *self = GTK_WINDOW (root);
+ GtkWindowPrivate *priv = gtk_window_get_instance_private (self);
+ GdkFrameClock *frame_clock;
+
+ if (priv->animation_manager == NULL)
+ priv->animation_manager = gtk_animation_manager_new ();
+
+ frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (self));
+ if (frame_clock != NULL)
+ gtk_animation_manager_set_frame_clock (priv->animation_manager, frame_clock);
+
+ return priv->animation_manager;
+}
+
static void
gtk_window_native_get_surface_transform (GtkNative *native,
int *x,
@@ -2396,6 +2414,7 @@ gtk_window_root_interface_init (GtkRootInterface *iface)
{
iface->get_display = gtk_window_root_get_display;
iface->get_constraint_solver = gtk_window_root_get_constraint_solver;
+ iface->get_animation_manager = gtk_window_root_get_animation_manager;
}
static void
@@ -4738,6 +4757,7 @@ gtk_window_finalize (GObject *object)
priv->mnemonics_display_timeout_id = 0;
}
+ g_clear_object (&priv->animation_manager);
g_clear_object (&priv->constraint_solver);
g_clear_object (&priv->renderer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]