Skip to main content

gdk4/auto/
monitor.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::{Display, Rectangle, SubpixelLayout, ffi};
6use glib::{
7    object::ObjectType as _,
8    prelude::*,
9    signal::{SignalHandlerId, connect_raw},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// Represents the individual outputs that are associated with a [`Display`][crate::Display].
16    ///
17    /// [`Display`][crate::Display] keeps a `GListModel` to enumerate and monitor
18    /// monitors with [`DisplayExt::monitors()`][crate::prelude::DisplayExt::monitors()]. You can use
19    /// [`DisplayExt::monitor_at_surface()`][crate::prelude::DisplayExt::monitor_at_surface()] to find a particular
20    /// monitor.
21    ///
22    /// ## Properties
23    ///
24    ///
25    /// #### `connector`
26    ///  The connector name.
27    ///
28    /// Readable
29    ///
30    ///
31    /// #### `description`
32    ///  A short description of the monitor, meant for display to the user.
33    ///
34    /// Readable
35    ///
36    ///
37    /// #### `display`
38    ///  The [`Display`][crate::Display] of the monitor.
39    ///
40    /// Readable | Writeable | Construct Only
41    ///
42    ///
43    /// #### `geometry`
44    ///  The geometry of the monitor.
45    ///
46    /// Readable
47    ///
48    ///
49    /// #### `height-mm`
50    ///  The height of the monitor, in millimeters.
51    ///
52    /// Readable
53    ///
54    ///
55    /// #### `manufacturer`
56    ///  The manufacturer name.
57    ///
58    /// Readable
59    ///
60    ///
61    /// #### `model`
62    ///  The model name.
63    ///
64    /// Readable
65    ///
66    ///
67    /// #### `refresh-rate`
68    ///  The refresh rate, in milli-Hertz.
69    ///
70    /// Readable
71    ///
72    ///
73    /// #### `scale`
74    ///  The scale of the monitor.
75    ///
76    /// Readable
77    ///
78    ///
79    /// #### `scale-factor`
80    ///  The scale factor.
81    ///
82    /// The scale factor is the next larger integer,
83    /// compared to [`scale`][struct@crate::Surface#scale].
84    ///
85    /// Readable
86    ///
87    ///
88    /// #### `subpixel-layout`
89    ///  The subpixel layout.
90    ///
91    /// Readable
92    ///
93    ///
94    /// #### `valid`
95    ///  Whether the object is still valid.
96    ///
97    /// Readable
98    ///
99    ///
100    /// #### `width-mm`
101    ///  The width of the monitor, in millimeters.
102    ///
103    /// Readable
104    ///
105    /// ## Signals
106    ///
107    ///
108    /// #### `invalidate`
109    ///  Emitted when the output represented by @monitor gets disconnected.
110    ///
111    ///
112    ///
113    /// # Implements
114    ///
115    /// [`MonitorExt`][trait@crate::prelude::MonitorExt]
116    #[doc(alias = "GdkMonitor")]
117    pub struct Monitor(Object<ffi::GdkMonitor, ffi::GdkMonitorClass>);
118
119    match fn {
120        type_ => || ffi::gdk_monitor_get_type(),
121    }
122}
123
124impl Monitor {
125    pub const NONE: Option<&'static Monitor> = None;
126}
127
128/// Trait containing all [`struct@Monitor`] methods.
129///
130/// # Implementors
131///
132/// [`Monitor`][struct@crate::Monitor]
133pub trait MonitorExt: IsA<Monitor> + 'static {
134    /// Gets the name of the monitor's connector, if available.
135    ///
136    /// These are strings such as "eDP-1", or "HDMI-2". They depend
137    /// on software and hardware configuration, and should not be
138    /// relied on as stable identifiers of a specific monitor.
139    ///
140    /// # Returns
141    ///
142    /// the name of the connector
143    #[doc(alias = "gdk_monitor_get_connector")]
144    #[doc(alias = "get_connector")]
145    fn connector(&self) -> Option<glib::GString> {
146        unsafe {
147            from_glib_none(ffi::gdk_monitor_get_connector(
148                self.as_ref().to_glib_none().0,
149            ))
150        }
151    }
152
153    /// Gets a string describing the monitor, if available.
154    ///
155    /// This can be used to identify a monitor in the UI.
156    ///
157    /// # Returns
158    ///
159    /// the monitor description
160    #[cfg(feature = "v4_10")]
161    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
162    #[doc(alias = "gdk_monitor_get_description")]
163    #[doc(alias = "get_description")]
164    fn description(&self) -> Option<glib::GString> {
165        unsafe {
166            from_glib_none(ffi::gdk_monitor_get_description(
167                self.as_ref().to_glib_none().0,
168            ))
169        }
170    }
171
172    /// Gets the display that this monitor belongs to.
173    ///
174    /// # Returns
175    ///
176    /// the display
177    #[doc(alias = "gdk_monitor_get_display")]
178    #[doc(alias = "get_display")]
179    fn display(&self) -> Display {
180        unsafe { from_glib_none(ffi::gdk_monitor_get_display(self.as_ref().to_glib_none().0)) }
181    }
182
183    /// Retrieves the size and position of the monitor within the
184    /// display coordinate space.
185    ///
186    /// The returned geometry is in  ”application pixels”, not in
187    /// ”device pixels” (see [`scale()`][Self::scale()]).
188    ///
189    /// # Returns
190    ///
191    ///
192    /// ## `geometry`
193    /// a [`Rectangle`][crate::Rectangle] to be filled with the monitor geometry
194    #[doc(alias = "gdk_monitor_get_geometry")]
195    #[doc(alias = "get_geometry")]
196    fn geometry(&self) -> Rectangle {
197        unsafe {
198            let mut geometry = Rectangle::uninitialized();
199            ffi::gdk_monitor_get_geometry(
200                self.as_ref().to_glib_none().0,
201                geometry.to_glib_none_mut().0,
202            );
203            geometry
204        }
205    }
206
207    /// Gets the height in millimeters of the monitor.
208    ///
209    /// # Returns
210    ///
211    /// the physical height of the monitor
212    #[doc(alias = "gdk_monitor_get_height_mm")]
213    #[doc(alias = "get_height_mm")]
214    #[doc(alias = "height-mm")]
215    fn height_mm(&self) -> i32 {
216        unsafe { ffi::gdk_monitor_get_height_mm(self.as_ref().to_glib_none().0) }
217    }
218
219    /// Gets the name or PNP ID of the monitor's manufacturer.
220    ///
221    /// Note that this value might also vary depending on actual
222    /// display backend.
223    ///
224    /// The PNP ID registry is located at
225    /// [https://uefi.org/pnp_id_list](https://uefi.org/pnp_id_list).
226    ///
227    /// # Returns
228    ///
229    /// the name of the manufacturer
230    #[doc(alias = "gdk_monitor_get_manufacturer")]
231    #[doc(alias = "get_manufacturer")]
232    fn manufacturer(&self) -> Option<glib::GString> {
233        unsafe {
234            from_glib_none(ffi::gdk_monitor_get_manufacturer(
235                self.as_ref().to_glib_none().0,
236            ))
237        }
238    }
239
240    /// Gets the string identifying the monitor model, if available.
241    ///
242    /// # Returns
243    ///
244    /// the monitor model
245    #[doc(alias = "gdk_monitor_get_model")]
246    #[doc(alias = "get_model")]
247    fn model(&self) -> Option<glib::GString> {
248        unsafe { from_glib_none(ffi::gdk_monitor_get_model(self.as_ref().to_glib_none().0)) }
249    }
250
251    /// Gets the refresh rate of the monitor, if available.
252    ///
253    /// The value is in milli-Hertz, so a refresh rate of 60Hz
254    /// is returned as 60000.
255    ///
256    /// # Returns
257    ///
258    /// the refresh rate in milli-Hertz, or 0
259    #[doc(alias = "gdk_monitor_get_refresh_rate")]
260    #[doc(alias = "get_refresh_rate")]
261    #[doc(alias = "refresh-rate")]
262    fn refresh_rate(&self) -> i32 {
263        unsafe { ffi::gdk_monitor_get_refresh_rate(self.as_ref().to_glib_none().0) }
264    }
265
266    /// Gets the internal scale factor that maps from monitor coordinates
267    /// to device pixels.
268    ///
269    /// This can be used if you want to create pixel based data for a
270    /// particular monitor, but most of the time you’re drawing to a surface
271    /// where it is better to use [`SurfaceExt::scale()`][crate::prelude::SurfaceExt::scale()] instead.
272    ///
273    /// # Returns
274    ///
275    /// the scale
276    #[cfg(feature = "v4_14")]
277    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
278    #[doc(alias = "gdk_monitor_get_scale")]
279    #[doc(alias = "get_scale")]
280    fn scale(&self) -> f64 {
281        unsafe { ffi::gdk_monitor_get_scale(self.as_ref().to_glib_none().0) }
282    }
283
284    /// Gets the internal scale factor that maps from monitor coordinates
285    /// to device pixels.
286    ///
287    /// On traditional systems this is 1, but on very high density outputs
288    /// it can be a higher value (often 2).
289    ///
290    /// This can be used if you want to create pixel based data for a
291    /// particular monitor, but most of the time you’re drawing to a surface
292    /// where it is better to use [`SurfaceExt::scale_factor()`][crate::prelude::SurfaceExt::scale_factor()] instead.
293    ///
294    /// # Returns
295    ///
296    /// the scale factor
297    #[doc(alias = "gdk_monitor_get_scale_factor")]
298    #[doc(alias = "get_scale_factor")]
299    #[doc(alias = "scale-factor")]
300    fn scale_factor(&self) -> i32 {
301        unsafe { ffi::gdk_monitor_get_scale_factor(self.as_ref().to_glib_none().0) }
302    }
303
304    /// Gets information about the layout of red, green and blue
305    /// primaries for pixels.
306    ///
307    /// # Returns
308    ///
309    /// the subpixel layout
310    #[doc(alias = "gdk_monitor_get_subpixel_layout")]
311    #[doc(alias = "get_subpixel_layout")]
312    #[doc(alias = "subpixel-layout")]
313    fn subpixel_layout(&self) -> SubpixelLayout {
314        unsafe {
315            from_glib(ffi::gdk_monitor_get_subpixel_layout(
316                self.as_ref().to_glib_none().0,
317            ))
318        }
319    }
320
321    /// Gets the width in millimeters of the monitor.
322    ///
323    /// # Returns
324    ///
325    /// the physical width of the monitor
326    #[doc(alias = "gdk_monitor_get_width_mm")]
327    #[doc(alias = "get_width_mm")]
328    #[doc(alias = "width-mm")]
329    fn width_mm(&self) -> i32 {
330        unsafe { ffi::gdk_monitor_get_width_mm(self.as_ref().to_glib_none().0) }
331    }
332
333    /// Returns [`true`] if the @self object corresponds to a
334    /// physical monitor.
335    ///
336    /// The @self becomes invalid when the physical monitor
337    /// is unplugged or removed.
338    ///
339    /// # Returns
340    ///
341    /// [`true`] if the object corresponds to a physical monitor
342    #[doc(alias = "gdk_monitor_is_valid")]
343    #[doc(alias = "valid")]
344    fn is_valid(&self) -> bool {
345        unsafe { from_glib(ffi::gdk_monitor_is_valid(self.as_ref().to_glib_none().0)) }
346    }
347
348    /// Emitted when the output represented by @monitor gets disconnected.
349    #[doc(alias = "invalidate")]
350    fn connect_invalidate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
351        unsafe extern "C" fn invalidate_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
352            this: *mut ffi::GdkMonitor,
353            f: glib::ffi::gpointer,
354        ) {
355            unsafe {
356                let f: &F = &*(f as *const F);
357                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
358            }
359        }
360        unsafe {
361            let f: Box_<F> = Box_::new(f);
362            connect_raw(
363                self.as_ptr() as *mut _,
364                c"invalidate".as_ptr() as *const _,
365                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
366                    invalidate_trampoline::<Self, F> as *const (),
367                )),
368                Box_::into_raw(f),
369            )
370        }
371    }
372
373    #[doc(alias = "connector")]
374    fn connect_connector_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
375        unsafe extern "C" fn notify_connector_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
376            this: *mut ffi::GdkMonitor,
377            _param_spec: glib::ffi::gpointer,
378            f: glib::ffi::gpointer,
379        ) {
380            unsafe {
381                let f: &F = &*(f as *const F);
382                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
383            }
384        }
385        unsafe {
386            let f: Box_<F> = Box_::new(f);
387            connect_raw(
388                self.as_ptr() as *mut _,
389                c"notify::connector".as_ptr() as *const _,
390                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
391                    notify_connector_trampoline::<Self, F> as *const (),
392                )),
393                Box_::into_raw(f),
394            )
395        }
396    }
397
398    #[cfg(feature = "v4_10")]
399    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
400    #[doc(alias = "description")]
401    fn connect_description_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
402        unsafe extern "C" fn notify_description_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
403            this: *mut ffi::GdkMonitor,
404            _param_spec: glib::ffi::gpointer,
405            f: glib::ffi::gpointer,
406        ) {
407            unsafe {
408                let f: &F = &*(f as *const F);
409                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
410            }
411        }
412        unsafe {
413            let f: Box_<F> = Box_::new(f);
414            connect_raw(
415                self.as_ptr() as *mut _,
416                c"notify::description".as_ptr() as *const _,
417                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
418                    notify_description_trampoline::<Self, F> as *const (),
419                )),
420                Box_::into_raw(f),
421            )
422        }
423    }
424
425    #[doc(alias = "geometry")]
426    fn connect_geometry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
427        unsafe extern "C" fn notify_geometry_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
428            this: *mut ffi::GdkMonitor,
429            _param_spec: glib::ffi::gpointer,
430            f: glib::ffi::gpointer,
431        ) {
432            unsafe {
433                let f: &F = &*(f as *const F);
434                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
435            }
436        }
437        unsafe {
438            let f: Box_<F> = Box_::new(f);
439            connect_raw(
440                self.as_ptr() as *mut _,
441                c"notify::geometry".as_ptr() as *const _,
442                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
443                    notify_geometry_trampoline::<Self, F> as *const (),
444                )),
445                Box_::into_raw(f),
446            )
447        }
448    }
449
450    #[doc(alias = "height-mm")]
451    fn connect_height_mm_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
452        unsafe extern "C" fn notify_height_mm_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
453            this: *mut ffi::GdkMonitor,
454            _param_spec: glib::ffi::gpointer,
455            f: glib::ffi::gpointer,
456        ) {
457            unsafe {
458                let f: &F = &*(f as *const F);
459                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
460            }
461        }
462        unsafe {
463            let f: Box_<F> = Box_::new(f);
464            connect_raw(
465                self.as_ptr() as *mut _,
466                c"notify::height-mm".as_ptr() as *const _,
467                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
468                    notify_height_mm_trampoline::<Self, F> as *const (),
469                )),
470                Box_::into_raw(f),
471            )
472        }
473    }
474
475    #[doc(alias = "manufacturer")]
476    fn connect_manufacturer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
477        unsafe extern "C" fn notify_manufacturer_trampoline<
478            P: IsA<Monitor>,
479            F: Fn(&P) + 'static,
480        >(
481            this: *mut ffi::GdkMonitor,
482            _param_spec: glib::ffi::gpointer,
483            f: glib::ffi::gpointer,
484        ) {
485            unsafe {
486                let f: &F = &*(f as *const F);
487                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
488            }
489        }
490        unsafe {
491            let f: Box_<F> = Box_::new(f);
492            connect_raw(
493                self.as_ptr() as *mut _,
494                c"notify::manufacturer".as_ptr() as *const _,
495                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
496                    notify_manufacturer_trampoline::<Self, F> as *const (),
497                )),
498                Box_::into_raw(f),
499            )
500        }
501    }
502
503    #[doc(alias = "model")]
504    fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
505        unsafe extern "C" fn notify_model_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
506            this: *mut ffi::GdkMonitor,
507            _param_spec: glib::ffi::gpointer,
508            f: glib::ffi::gpointer,
509        ) {
510            unsafe {
511                let f: &F = &*(f as *const F);
512                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
513            }
514        }
515        unsafe {
516            let f: Box_<F> = Box_::new(f);
517            connect_raw(
518                self.as_ptr() as *mut _,
519                c"notify::model".as_ptr() as *const _,
520                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
521                    notify_model_trampoline::<Self, F> as *const (),
522                )),
523                Box_::into_raw(f),
524            )
525        }
526    }
527
528    #[doc(alias = "refresh-rate")]
529    fn connect_refresh_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
530        unsafe extern "C" fn notify_refresh_rate_trampoline<
531            P: IsA<Monitor>,
532            F: Fn(&P) + 'static,
533        >(
534            this: *mut ffi::GdkMonitor,
535            _param_spec: glib::ffi::gpointer,
536            f: glib::ffi::gpointer,
537        ) {
538            unsafe {
539                let f: &F = &*(f as *const F);
540                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
541            }
542        }
543        unsafe {
544            let f: Box_<F> = Box_::new(f);
545            connect_raw(
546                self.as_ptr() as *mut _,
547                c"notify::refresh-rate".as_ptr() as *const _,
548                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
549                    notify_refresh_rate_trampoline::<Self, F> as *const (),
550                )),
551                Box_::into_raw(f),
552            )
553        }
554    }
555
556    #[cfg(feature = "v4_14")]
557    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
558    #[doc(alias = "scale")]
559    fn connect_scale_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
560        unsafe extern "C" fn notify_scale_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
561            this: *mut ffi::GdkMonitor,
562            _param_spec: glib::ffi::gpointer,
563            f: glib::ffi::gpointer,
564        ) {
565            unsafe {
566                let f: &F = &*(f as *const F);
567                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
568            }
569        }
570        unsafe {
571            let f: Box_<F> = Box_::new(f);
572            connect_raw(
573                self.as_ptr() as *mut _,
574                c"notify::scale".as_ptr() as *const _,
575                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
576                    notify_scale_trampoline::<Self, F> as *const (),
577                )),
578                Box_::into_raw(f),
579            )
580        }
581    }
582
583    #[doc(alias = "scale-factor")]
584    fn connect_scale_factor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
585        unsafe extern "C" fn notify_scale_factor_trampoline<
586            P: IsA<Monitor>,
587            F: Fn(&P) + 'static,
588        >(
589            this: *mut ffi::GdkMonitor,
590            _param_spec: glib::ffi::gpointer,
591            f: glib::ffi::gpointer,
592        ) {
593            unsafe {
594                let f: &F = &*(f as *const F);
595                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
596            }
597        }
598        unsafe {
599            let f: Box_<F> = Box_::new(f);
600            connect_raw(
601                self.as_ptr() as *mut _,
602                c"notify::scale-factor".as_ptr() as *const _,
603                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
604                    notify_scale_factor_trampoline::<Self, F> as *const (),
605                )),
606                Box_::into_raw(f),
607            )
608        }
609    }
610
611    #[doc(alias = "subpixel-layout")]
612    fn connect_subpixel_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
613        unsafe extern "C" fn notify_subpixel_layout_trampoline<
614            P: IsA<Monitor>,
615            F: Fn(&P) + 'static,
616        >(
617            this: *mut ffi::GdkMonitor,
618            _param_spec: glib::ffi::gpointer,
619            f: glib::ffi::gpointer,
620        ) {
621            unsafe {
622                let f: &F = &*(f as *const F);
623                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
624            }
625        }
626        unsafe {
627            let f: Box_<F> = Box_::new(f);
628            connect_raw(
629                self.as_ptr() as *mut _,
630                c"notify::subpixel-layout".as_ptr() as *const _,
631                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
632                    notify_subpixel_layout_trampoline::<Self, F> as *const (),
633                )),
634                Box_::into_raw(f),
635            )
636        }
637    }
638
639    #[doc(alias = "valid")]
640    fn connect_valid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
641        unsafe extern "C" fn notify_valid_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
642            this: *mut ffi::GdkMonitor,
643            _param_spec: glib::ffi::gpointer,
644            f: glib::ffi::gpointer,
645        ) {
646            unsafe {
647                let f: &F = &*(f as *const F);
648                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
649            }
650        }
651        unsafe {
652            let f: Box_<F> = Box_::new(f);
653            connect_raw(
654                self.as_ptr() as *mut _,
655                c"notify::valid".as_ptr() as *const _,
656                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
657                    notify_valid_trampoline::<Self, F> as *const (),
658                )),
659                Box_::into_raw(f),
660            )
661        }
662    }
663
664    #[doc(alias = "width-mm")]
665    fn connect_width_mm_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
666        unsafe extern "C" fn notify_width_mm_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
667            this: *mut ffi::GdkMonitor,
668            _param_spec: glib::ffi::gpointer,
669            f: glib::ffi::gpointer,
670        ) {
671            unsafe {
672                let f: &F = &*(f as *const F);
673                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
674            }
675        }
676        unsafe {
677            let f: Box_<F> = Box_::new(f);
678            connect_raw(
679                self.as_ptr() as *mut _,
680                c"notify::width-mm".as_ptr() as *const _,
681                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
682                    notify_width_mm_trampoline::<Self, F> as *const (),
683                )),
684                Box_::into_raw(f),
685            )
686        }
687    }
688}
689
690impl<O: IsA<Monitor>> MonitorExt for O {}