package Gdk_Frame_Clock_Phase_Properties is new Generic_Internal_Discrete_Property (Gdk_Frame_Clock_Phase);
type Gdk_Frame_Clock_Record is new GObject_Record with null record;
type Gdk_Frame_Clock is access all Gdk_Frame_Clock_Record'Class;
type Property_Gdk_Frame_Clock_Phase is new Gdk_Frame_Clock_Phase_Properties.Property;
type Cb_Gdk_Frame_Clock_Void is not null access procedure (Self : access Gdk_Frame_Clock_Record'Class);
type Cb_GObject_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class);
Gdk_Frame_Clock_Phase_None : constant Gdk_Frame_Clock_Phase := 0;
Gdk_Frame_Clock_Phase_Flush_Events : constant Gdk_Frame_Clock_Phase := 1;
Gdk_Frame_Clock_Phase_Before_Paint : constant Gdk_Frame_Clock_Phase := 2;
Gdk_Frame_Clock_Phase_Update : constant Gdk_Frame_Clock_Phase := 4;
Gdk_Frame_Clock_Phase_Layout : constant Gdk_Frame_Clock_Phase := 8;
Gdk_Frame_Clock_Phase_Paint : constant Gdk_Frame_Clock_Phase := 16;
Gdk_Frame_Clock_Phase_Resume_Events : constant Gdk_Frame_Clock_Phase := 32;
Gdk_Frame_Clock_Phase_After_Paint : constant Gdk_Frame_Clock_Phase := 64;
Signal_After_Paint : constant Glib.Signal_Name := "after-paint";
Signal_Before_Paint : constant Glib.Signal_Name := "before-paint";
Signal_Flush_Events : constant Glib.Signal_Name := "flush-events";
Signal_Layout : constant Glib.Signal_Name := "layout";
Signal_Paint : constant Glib.Signal_Name := "paint";
Signal_Resume_Events : constant Glib.Signal_Name := "resume-events";
Signal_Update : constant Glib.Signal_Name := "update";
function Get_Type return Glib.GType;
procedure Begin_Updating
( | Self | : not null access Gdk_Frame_Clock_Record); |
procedure End_Updating
( | Self | : not null access Gdk_Frame_Clock_Record); |
function Get_Current_Timings
( | Self | : not null access Gdk_Frame_Clock_Record) return Gdk.Frame_Timings.Gdk_Frame_Timings; |
function Get_Frame_Counter
( | Self | : not null access Gdk_Frame_Clock_Record) return Gint64; |
function Get_Frame_Time
( | Self | : not null access Gdk_Frame_Clock_Record) return Gint64; |
function Get_History_Start
( | Self | : not null access Gdk_Frame_Clock_Record) return Gint64; |
procedure Get_Refresh_Info
( | Self | : not null access Gdk_Frame_Clock_Record; |
Base_Time | : Gint64; | |
Refresh_Interval_Return | : in out Gint64; | |
Presentation_Time_Return | : in out Gint64); |
function Get_Timings
( | Self | : not null access Gdk_Frame_Clock_Record; |
Frame_Counter | : Gint64) return Gdk.Frame_Timings.Gdk_Frame_Timings; |
procedure Request_Phase
( | Self | : not null access Gdk_Frame_Clock_Record; |
Phase | : Gdk_Frame_Clock_Phase); |
procedure On_After_Paint
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_Gdk_Frame_Clock_Void; | |
After | : Boolean := False); |
procedure On_After_Paint
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Before_Paint
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_Gdk_Frame_Clock_Void; | |
After | : Boolean := False); |
procedure On_Before_Paint
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Flush_Events
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_Gdk_Frame_Clock_Void; | |
After | : Boolean := False); |
procedure On_Flush_Events
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Layout
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_Gdk_Frame_Clock_Void; | |
After | : Boolean := False); |
procedure On_Layout
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Paint
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_Gdk_Frame_Clock_Void; | |
After | : Boolean := False); |
procedure On_Paint
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Resume_Events
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_Gdk_Frame_Clock_Void; | |
After | : Boolean := False); |
procedure On_Resume_Events
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Update
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_Gdk_Frame_Clock_Void; | |
After | : Boolean := False); |
procedure On_Update
( | Self | : not null access Gdk_Frame_Clock_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
A Gdk.Frame_Clock.Gdk_Frame_Clock tells the application when to update and repaint a window. This may be synced to the vertical refresh rate of the monitor, for example. Even when the frame clock uses a simple timer rather than a hardware-based vertical sync, the frame clock helps because it ensures everything paints at the same time (reducing the total number of frames). The frame clock can also automatically stop painting when it knows the frames will not be visible, or scale back animation framerates.
Gdk.Frame_Clock.Gdk_Frame_Clock is designed to be compatible with an OpenGL-based implementation or with mozRequestAnimationFrame in Firefox, for example.
A frame clock is idle until someone requests a frame with Gdk.Frame_Clock.Request_Phase. At some later point that makes sense for the synchronization being implemented, the clock will process a frame and emit signals for each phase that has been requested. (See the signals of the Gdk.Frame_Clock.Gdk_Frame_Clock class for documentation of the phases.
Gdk.Frame_Clock.Gdk_Frame_Clock_Phase_Update and the Gdk.Frame_Clock.Gdk_Frame_Clock::update signal are most interesting for application writers, and are used to update the animations, using the frame time given by Gdk.Frame_Clock.Get_Frame_Time.
The frame time is reported in microseconds and generally in the same timescale as g_get_monotonic_time, however, it is not the same as g_get_monotonic_time. The frame time does not advance during the time a frame is being painted, and outside of a frame, an attempt is made so that all calls to Gdk.Frame_Clock.Get_Frame_Time that are called at a "similar" time get the same value. This means that if different animations are timed by looking at the difference in time between an initial value from Gdk.Frame_Clock.Get_Frame_Time and the value inside the Gdk.Frame_Clock.Gdk_Frame_Clock::update signal of the clock, they will stay exactly synchronized.