Gdk.Frame_Clock

Entities

Simple Types

Tagged Types

Access Types

Constants

Subprograms

Generic Instantiations

Description

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.

Begin_Updating

procedure Begin_Updating (Self : not null access Gdk_Frame_Clock_Record)

Starts updates for an animation. Until a matching call to Gdk.Frame_Clock.End_Updating is made, the frame clock will continually request a new frame with the Gdk.Frame_Clock.Gdk_Frame_Clock_Phase_Update phase. This function may be called multiple times and frames will be requested until Gdk.Frame_Clock.End_Updating is called the same number of times. Since: gtk+ 3.8

Parameters
Self

Cb_Gdk_Frame_Clock_Void

type Cb_Gdk_Frame_Clock_Void is not null access procedure
  (Self : access Gdk_Frame_Clock_Record'Class);
Parameters
Self

Cb_GObject_Void

type Cb_GObject_Void is not null access procedure
  (Self : access Glib.Object.GObject_Record'Class);
Parameters
Self

End_Updating

procedure End_Updating (Self : not null access Gdk_Frame_Clock_Record)

Stops updates for an animation. See the documentation for Gdk.Frame_Clock.Begin_Updating. Since: gtk+ 3.8

Parameters
Self

Gdk_Frame_Clock

type Gdk_Frame_Clock is access all Gdk_Frame_Clock_Record'Class;

Gdk_Frame_Clock_Phase

type Gdk_Frame_Clock_Phase is mod 2 ** Integer'Size;

Gdk.Frame_Clock.Gdk_Frame_Clock_Phase is used to represent the different paint clock phases that can be requested. The elements of the enumeration correspond to the signals of Gdk.Frame_Clock.Gdk_Frame_Clock.

Gdk_Frame_Clock_Phase_After_Paint

Gdk_Frame_Clock_Phase_After_Paint : constant Gdk_Frame_Clock_Phase := 64;

Gdk_Frame_Clock_Phase_Before_Paint

Gdk_Frame_Clock_Phase_Before_Paint : constant Gdk_Frame_Clock_Phase := 2;

Gdk_Frame_Clock_Phase_Flush_Events

Gdk_Frame_Clock_Phase_Flush_Events : constant Gdk_Frame_Clock_Phase := 1;

Gdk_Frame_Clock_Phase_Layout

Gdk_Frame_Clock_Phase_Layout : constant Gdk_Frame_Clock_Phase := 8;

Gdk_Frame_Clock_Phase_None

Gdk_Frame_Clock_Phase_None : constant Gdk_Frame_Clock_Phase := 0;

Gdk_Frame_Clock_Phase_Paint

Gdk_Frame_Clock_Phase_Paint : constant Gdk_Frame_Clock_Phase := 16;

Gdk_Frame_Clock_Phase_Properties

package Gdk_Frame_Clock_Phase_Properties is
   new Generic_Internal_Discrete_Property (Gdk_Frame_Clock_Phase);

Gdk_Frame_Clock_Phase_Resume_Events

Gdk_Frame_Clock_Phase_Resume_Events : constant Gdk_Frame_Clock_Phase := 32;

Gdk_Frame_Clock_Phase_Update

Gdk_Frame_Clock_Phase_Update : constant Gdk_Frame_Clock_Phase := 4;

Gdk_Frame_Clock_Record

type Gdk_Frame_Clock_Record is new GObject_Record with null record;

Get_Current_Timings

function Get_Current_Timings
   (Self : not null access Gdk_Frame_Clock_Record)
    return Gdk.Frame_Timings.Gdk_Frame_Timings

Gets the frame timings for the current frame. Since: gtk+ 3.8

Parameters
Self
Return Value

the Gdk.Frame_Timings.Gdk_Frame_Timings for the frame currently being processed, or even no frame is being processed, for the previous frame. Before any frames have been processed, returns null.

Get_Frame_Counter

function Get_Frame_Counter
   (Self : not null access Gdk_Frame_Clock_Record) return Gint64

A Gdk.Frame_Clock.Gdk_Frame_Clock maintains a 64-bit counter that increments for each frame drawn. Since: gtk+ 3.8

Parameters
Self
Return Value

inside frame processing, the value of the frame counter for the current frame. Outside of frame processing, the frame counter for the last frame.

Get_Frame_Time

function Get_Frame_Time
   (Self : not null access Gdk_Frame_Clock_Record) return Gint64

Gets the time that should currently be used for animations. Inside the processing of a frame, it's the time used to compute the animation position of everything in a frame. Outside of a frame, it's the time of the conceptual "previous frame," which may be either the actual previous frame time, or if that's too old, an updated time. Since: gtk+ 3.8

Parameters
Self
Return Value

a timestamp in microseconds, in the timescale of of g_get_monotonic_time.

Get_History_Start

function Get_History_Start
   (Self : not null access Gdk_Frame_Clock_Record) return Gint64

Gdk.Frame_Clock.Gdk_Frame_Clock internally keeps a history of Gdk.Frame_Timings.Gdk_Frame_Timings objects for recent frames that can be retrieved with Gdk.Frame_Clock.Get_Timings. The set of stored frames is the set from the counter values given by Gdk.Frame_Clock.Get_History_Start and Gdk.Frame_Clock.Get_Frame_Counter, inclusive. Since: gtk+ 3.8

Parameters
Self
Return Value

the frame counter value for the oldest frame that is available in the internal frame history of the Gdk.Frame_Clock.Gdk_Frame_Clock.

Get_Refresh_Info

procedure Get_Refresh_Info
   (Self                     : not null access Gdk_Frame_Clock_Record;
    Base_Time                : Gint64;
    Refresh_Interval_Return  : out Gint64;
    Presentation_Time_Return : out Gint64)

Using the frame history stored in the frame clock, finds the last known presentation time and refresh interval, and assuming that presentation times are separated by the refresh interval, predicts a presentation time that is a multiple of the refresh interval after the last presentation time, and later than Base_Time. Since: gtk+ 3.8

Parameters
Self
Base_Time

base time for determining a presentaton time

Refresh_Interval_Return

a location to store the determined refresh interval, or null. A default refresh interval of 1/60th of a second will be stored if no history is present.

Presentation_Time_Return

a location to store the next candidate presentation time after the given base time. 0 will be will be stored if no history is present.

Get_Timings

function Get_Timings
   (Self          : not null access Gdk_Frame_Clock_Record;
    Frame_Counter : Gint64) return Gdk.Frame_Timings.Gdk_Frame_Timings

Retrieves a Gdk.Frame_Timings.Gdk_Frame_Timings object holding timing information for the current frame or a recent frame. The Gdk.Frame_Timings.Gdk_Frame_Timings object may not yet be complete: see Gdk.Frame_Timings.Get_Complete. Since: gtk+ 3.8

Parameters
Self
Frame_Counter

the frame counter value identifying the frame to be received.

Return Value

the Gdk.Frame_Timings.Gdk_Frame_Timings object for the specified frame, or null if it is not available. See Gdk.Frame_Clock.Get_History_Start.

Get_Type

function Get_Type return Glib.GType
Return Value

On_After_Paint

procedure On_After_Paint
   (Self  : not null access Gdk_Frame_Clock_Record;
    Call  : Cb_Gdk_Frame_Clock_Void;
    After : Boolean := False)

This signal ends processing of the frame. Applications should generally not handle this signal.

Parameters
Self
Call
After

On_After_Paint

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)

This signal ends processing of the frame. Applications should generally not handle this signal.

Parameters
Self
Call
Slot
After

On_Before_Paint

procedure On_Before_Paint
   (Self  : not null access Gdk_Frame_Clock_Record;
    Call  : Cb_Gdk_Frame_Clock_Void;
    After : Boolean := False)

This signal begins processing of the frame. Applications should generally not handle this signal.

Parameters
Self
Call
After

On_Before_Paint

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)

This signal begins processing of the frame. Applications should generally not handle this signal.

Parameters
Self
Call
Slot
After

On_Flush_Events

procedure On_Flush_Events
   (Self  : not null access Gdk_Frame_Clock_Record;
    Call  : Cb_Gdk_Frame_Clock_Void;
    After : Boolean := False)

This signal is used to flush pending motion events that are being batched up and compressed together. Applications should not handle this signal.

Parameters
Self
Call
After

On_Flush_Events

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)

This signal is used to flush pending motion events that are being batched up and compressed together. Applications should not handle this signal.

Parameters
Self
Call
Slot
After

On_Layout

procedure On_Layout
   (Self  : not null access Gdk_Frame_Clock_Record;
    Call  : Cb_Gdk_Frame_Clock_Void;
    After : Boolean := False)

This signal is emitted as the second step of toolkit and application processing of the frame. Any work to update sizes and positions of application elements should be performed. GTK+ normally handles this internally.

Parameters
Self
Call
After

On_Layout

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)

This signal is emitted as the second step of toolkit and application processing of the frame. Any work to update sizes and positions of application elements should be performed. GTK+ normally handles this internally.

Parameters
Self
Call
Slot
After

On_Paint

procedure On_Paint
   (Self  : not null access Gdk_Frame_Clock_Record;
    Call  : Cb_Gdk_Frame_Clock_Void;
    After : Boolean := False)

This signal is emitted as the third step of toolkit and application processing of the frame. The frame is repainted. GDK normally handles this internally and produces expose events, which are turned into GTK+ Gtk.Widget.Gtk_Widget::draw signals.

Parameters
Self
Call
After

On_Paint

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)

This signal is emitted as the third step of toolkit and application processing of the frame. The frame is repainted. GDK normally handles this internally and produces expose events, which are turned into GTK+ Gtk.Widget.Gtk_Widget::draw signals.

Parameters
Self
Call
Slot
After

On_Resume_Events

procedure On_Resume_Events
   (Self  : not null access Gdk_Frame_Clock_Record;
    Call  : Cb_Gdk_Frame_Clock_Void;
    After : Boolean := False)

This signal is emitted after processing of the frame is finished, and is handled internally by GTK+ to resume normal event processing. Applications should not handle this signal.

Parameters
Self
Call
After

On_Resume_Events

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)

This signal is emitted after processing of the frame is finished, and is handled internally by GTK+ to resume normal event processing. Applications should not handle this signal.

Parameters
Self
Call
Slot
After

On_Update

procedure On_Update
   (Self  : not null access Gdk_Frame_Clock_Record;
    Call  : Cb_Gdk_Frame_Clock_Void;
    After : Boolean := False)

This signal is emitted as the first step of toolkit and application processing of the frame. Animations should be updated using Gdk.Frame_Clock.Get_Frame_Time. Applications can connect directly to this signal, or use Gtk.Widget.Add_Tick_Callback as a more convenient interface.

Parameters
Self
Call
After

On_Update

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)

This signal is emitted as the first step of toolkit and application processing of the frame. Animations should be updated using Gdk.Frame_Clock.Get_Frame_Time. Applications can connect directly to this signal, or use Gtk.Widget.Add_Tick_Callback as a more convenient interface.

Parameters
Self
Call
Slot
After

Property_Gdk_Frame_Clock_Phase

type Property_Gdk_Frame_Clock_Phase is new Gdk_Frame_Clock_Phase_Properties.Property;

Request_Phase

procedure Request_Phase
   (Self  : not null access Gdk_Frame_Clock_Record;
    Phase : Gdk_Frame_Clock_Phase)

Asks the frame clock to run a particular phase. The signal corresponding the requested phase will be emitted the next time the frame clock processes. Multiple calls to Gdk.Frame_Clock.Request_Phase will be combined together and only one frame processed. If you are displaying animated content and want to continually request the Gdk.Frame_Clock.Gdk_Frame_Clock_Phase_Update phase for a period of time, you should use Gdk.Frame_Clock.Begin_Updating instead, since this allows GTK+ to adjust system parameters to get maximally smooth animations. Since: gtk+ 3.8

Parameters
Self
Phase

the phase that is requested

Signal_After_Paint

Signal_After_Paint : constant Glib.Signal_Name := "after-paint";

This signal ends processing of the frame. Applications should generally not handle this signal.

Signal_Before_Paint

Signal_Before_Paint : constant Glib.Signal_Name := "before-paint";

This signal begins processing of the frame. Applications should generally not handle this signal.

Signal_Flush_Events

Signal_Flush_Events : constant Glib.Signal_Name := "flush-events";

This signal is used to flush pending motion events that are being batched up and compressed together. Applications should not handle this signal.

Signal_Layout

Signal_Layout : constant Glib.Signal_Name := "layout";

This signal is emitted as the second step of toolkit and application processing of the frame. Any work to update sizes and positions of application elements should be performed. GTK+ normally handles this internally.

Signal_Paint

Signal_Paint : constant Glib.Signal_Name := "paint";

This signal is emitted as the third step of toolkit and application processing of the frame. The frame is repainted. GDK normally handles this internally and produces expose events, which are turned into GTK+ Gtk.Widget.Gtk_Widget::draw signals.

Signal_Resume_Events

Signal_Resume_Events : constant Glib.Signal_Name := "resume-events";

This signal is emitted after processing of the frame is finished, and is handled internally by GTK+ to resume normal event processing. Applications should not handle this signal.

Signal_Update

Signal_Update : constant Glib.Signal_Name := "update";

This signal is emitted as the first step of toolkit and application processing of the frame. Animations should be updated using Gdk.Frame_Clock.Get_Frame_Time. Applications can connect directly to this signal, or use Gtk.Widget.Add_Tick_Callback as a more convenient interface.