gdk/auto/frame_timings.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::translate::*;
7
8glib::wrapper! {
9 /// A [`FrameTimings`][crate::FrameTimings] object holds timing information for a single frame
10 /// of the application’s displays. To retrieve [`FrameTimings`][crate::FrameTimings] objects,
11 /// use [`FrameClock::timings()`][crate::FrameClock::timings()] or [`FrameClock::current_timings()`][crate::FrameClock::current_timings()].
12 /// The information in [`FrameTimings`][crate::FrameTimings] is useful for precise synchronization
13 /// of video with the event or audio streams, and for measuring
14 /// quality metrics for the application’s display, such as latency and jitter.
15 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
16 pub struct FrameTimings(Shared<ffi::GdkFrameTimings>);
17
18 match fn {
19 ref => |ptr| ffi::gdk_frame_timings_ref(ptr),
20 unref => |ptr| ffi::gdk_frame_timings_unref(ptr),
21 type_ => || ffi::gdk_frame_timings_get_type(),
22 }
23}
24
25impl FrameTimings {
26 /// The timing information in a [`FrameTimings`][crate::FrameTimings] is filled in
27 /// incrementally as the frame as drawn and passed off to the
28 /// window system for processing and display to the user. The
29 /// accessor functions for [`FrameTimings`][crate::FrameTimings] can return 0 to
30 /// indicate an unavailable value for two reasons: either because
31 /// the information is not yet available, or because it isn't
32 /// available at all. Once [`is_complete()`][Self::is_complete()] returns
33 /// [`true`] for a frame, you can be certain that no further values
34 /// will become available and be stored in the [`FrameTimings`][crate::FrameTimings].
35 ///
36 /// # Returns
37 ///
38 /// [`true`] if all information that will be available
39 /// for the frame has been filled in.
40 #[doc(alias = "gdk_frame_timings_get_complete")]
41 #[doc(alias = "get_complete")]
42 pub fn is_complete(&self) -> bool {
43 unsafe { from_glib(ffi::gdk_frame_timings_get_complete(self.to_glib_none().0)) }
44 }
45
46 /// Gets the frame counter value of the [`FrameClock`][crate::FrameClock] when this
47 /// this frame was drawn.
48 ///
49 /// # Returns
50 ///
51 /// the frame counter value for this frame
52 #[doc(alias = "gdk_frame_timings_get_frame_counter")]
53 #[doc(alias = "get_frame_counter")]
54 pub fn frame_counter(&self) -> i64 {
55 unsafe { ffi::gdk_frame_timings_get_frame_counter(self.to_glib_none().0) }
56 }
57
58 /// Returns the frame time for the frame. This is the time value
59 /// that is typically used to time animations for the frame. See
60 /// [`FrameClock::frame_time()`][crate::FrameClock::frame_time()].
61 ///
62 /// # Returns
63 ///
64 /// the frame time for the frame, in the timescale
65 /// of `g_get_monotonic_time()`
66 #[doc(alias = "gdk_frame_timings_get_frame_time")]
67 #[doc(alias = "get_frame_time")]
68 pub fn frame_time(&self) -> i64 {
69 unsafe { ffi::gdk_frame_timings_get_frame_time(self.to_glib_none().0) }
70 }
71}