gdk4/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 /// s display, such as latency and jitter.
10 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
11 pub struct FrameTimings(Shared<ffi::GdkFrameTimings>);
12
13 match fn {
14 ref => |ptr| ffi::gdk_frame_timings_ref(ptr),
15 unref => |ptr| ffi::gdk_frame_timings_unref(ptr),
16 type_ => || ffi::gdk_frame_timings_get_type(),
17 }
18}
19
20impl FrameTimings {
21 /// Returns whether @self are complete.
22 ///
23 /// The timing information in a [`FrameTimings`][crate::FrameTimings] is filled in
24 /// incrementally as the frame as drawn and passed off to the
25 /// window system for processing and display to the user. The
26 /// accessor functions for [`FrameTimings`][crate::FrameTimings] can return 0 to
27 /// indicate an unavailable value for two reasons: either because
28 /// the information is not yet available, or because it isn't
29 /// available at all.
30 ///
31 /// Once this function returns [`true`] for a frame, you can be
32 /// certain that no further values will become available and be
33 /// 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
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.
58 ///
59 /// This is the time value that is typically used to time
60 /// animations for the frame. See [`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
72 /// Gets the predicted time at which this frame will be displayed.
73 ///
74 /// Although no predicted time may be available, if one is available,
75 /// it will be available while the frame is being generated, in contrast
76 /// to [`presentation_time()`][Self::presentation_time()], which is only
77 /// available after the frame has been presented.
78 ///
79 /// In general, if you are simply animating, you should use
80 /// [`FrameClock::frame_time()`][crate::FrameClock::frame_time()] rather than this function,
81 /// but this function is useful for applications that want exact control
82 /// over latency. For example, a movie player may want this information
83 /// for Audio/Video synchronization.
84 ///
85 /// # Returns
86 ///
87 /// The predicted time at which the frame will be presented,
88 /// in the timescale of g_get_monotonic_time(), or 0 if no predicted
89 /// presentation time is available.
90 #[doc(alias = "gdk_frame_timings_get_predicted_presentation_time")]
91 #[doc(alias = "get_predicted_presentation_time")]
92 pub fn predicted_presentation_time(&self) -> i64 {
93 unsafe { ffi::gdk_frame_timings_get_predicted_presentation_time(self.to_glib_none().0) }
94 }
95
96 /// Reurns the presentation time.
97 ///
98 /// This is the time at which the frame became visible to the user.
99 ///
100 /// # Returns
101 ///
102 /// the time the frame was displayed to the user, in the
103 /// timescale of g_get_monotonic_time(), or 0 if no presentation
104 /// time is available. See [`is_complete()`][Self::is_complete()]
105 #[doc(alias = "gdk_frame_timings_get_presentation_time")]
106 #[doc(alias = "get_presentation_time")]
107 pub fn presentation_time(&self) -> i64 {
108 unsafe { ffi::gdk_frame_timings_get_presentation_time(self.to_glib_none().0) }
109 }
110
111 /// .
112 ///
113 /// # Returns
114 ///
115 /// the refresh interval of the display, in microseconds,
116 /// or 0 if the refresh interval is not available.
117 /// See [`is_complete()`][Self::is_complete()].
118 #[doc(alias = "gdk_frame_timings_get_refresh_interval")]
119 #[doc(alias = "get_refresh_interval")]
120 pub fn refresh_interval(&self) -> i64 {
121 unsafe { ffi::gdk_frame_timings_get_refresh_interval(self.to_glib_none().0) }
122 }
123}