1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /*
19  * Modified by the GTK+ Team and others 1997-2010.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24 
25 /* Uninstalled header, internal to GDK */
26 
27 #ifndef __GDK_FRAME_CLOCK_PRIVATE_H__
28 #define __GDK_FRAME_CLOCK_PRIVATE_H__
29 
30 #include <gdk/gdkframeclock.h>
31 #include <gdk/gdkprofilerprivate.h>
32 
33 G_BEGIN_DECLS
34 
35 /**
36  * GdkFrameClock:
37  * @parent_instance: The parent instance.
38  */
39 struct _GdkFrameClock
40 {
41   GObject parent_instance;
42 
43   /*< private >*/
44   GdkFrameClockPrivate *priv;
45 };
46 
47 /**
48  * GdkFrameClockClass:
49  * @parent_class: The parent class.
50 
51  * @get_frame_time: Gets the time that should currently be used for
52  *    animations.
53  * @request_phase: Asks the frame clock to run a particular phase.
54  * @begin_updating: Starts updates for an animation.
55  * @end_updating: Stops updates for an animation.
56  * @freeze:
57  * @thaw:
58  */
59 struct _GdkFrameClockClass
60 {
61   GObjectClass parent_class;
62 
63   /*< public >*/
64 
65   gint64   (* get_frame_time) (GdkFrameClock *clock);
66 
67   void     (* request_phase)  (GdkFrameClock      *clock,
68                                GdkFrameClockPhase  phase);
69   void     (* begin_updating) (GdkFrameClock      *clock);
70   void     (* end_updating)   (GdkFrameClock      *clock);
71 
72   void     (* freeze)         (GdkFrameClock *clock);
73   void     (* thaw)           (GdkFrameClock *clock);
74 
75   /* signals */
76   /* void (* flush_events)       (GdkFrameClock *clock); */
77   /* void (* before_paint)       (GdkFrameClock *clock); */
78   /* void (* update)             (GdkFrameClock *clock); */
79   /* void (* layout)             (GdkFrameClock *clock); */
80   /* void (* paint)              (GdkFrameClock *clock); */
81   /* void (* after_paint)        (GdkFrameClock *clock); */
82   /* void (* resume_events)      (GdkFrameClock *clock); */
83 };
84 
85 struct _GdkFrameTimings
86 {
87   /*< private >*/
88   guint ref_count;
89 
90   gint64 frame_counter;
91   guint64 cookie;
92   gint64 frame_time;
93   gint64 smoothed_frame_time;
94   gint64 drawn_time;
95   gint64 presentation_time;
96   gint64 refresh_interval;
97   gint64 predicted_presentation_time;
98 
99 #ifdef G_ENABLE_DEBUG
100   gint64 layout_start_time;
101   gint64 paint_start_time;
102   gint64 frame_end_time;
103 #endif /* G_ENABLE_DEBUG */
104 
105   guint complete : 1;
106   guint slept_before : 1;
107 };
108 
109 void _gdk_frame_clock_inhibit_freeze (GdkFrameClock *clock);
110 void _gdk_frame_clock_uninhibit_freeze (GdkFrameClock *clock);
111 
112 void _gdk_frame_clock_begin_frame         (GdkFrameClock   *clock);
113 void _gdk_frame_clock_debug_print_timings (GdkFrameClock   *clock,
114                                            GdkFrameTimings *timings);
115 void _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *frame_clock,
116                                                GdkFrameTimings *timings);
117 
118 GdkFrameTimings *_gdk_frame_timings_new   (gint64           frame_counter);
119 gboolean         _gdk_frame_timings_steal (GdkFrameTimings *timings,
120                                            gint64           frame_counter);
121 
122 void _gdk_frame_clock_emit_flush_events  (GdkFrameClock *frame_clock);
123 void _gdk_frame_clock_emit_before_paint  (GdkFrameClock *frame_clock);
124 void _gdk_frame_clock_emit_update        (GdkFrameClock *frame_clock);
125 void _gdk_frame_clock_emit_layout        (GdkFrameClock *frame_clock);
126 void _gdk_frame_clock_emit_paint         (GdkFrameClock *frame_clock);
127 void _gdk_frame_clock_emit_after_paint   (GdkFrameClock *frame_clock);
128 void _gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock);
129 
130 G_END_DECLS
131 
132 #endif /* __GDK_FRAME_CLOCK_PRIVATE_H__ */
133