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