1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{Display, Rectangle, SubpixelLayout};
use glib::{
    prelude::*,
    signal::{connect_raw, SignalHandlerId},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    /// [`Monitor`][crate::Monitor] objects represent the individual outputs that are
    /// associated with a [`Display`][crate::Display].
    ///
    /// [`Display`][crate::Display] keeps a `GListModel` to enumerate and monitor
    /// monitors with [`DisplayExt::monitors()`][crate::prelude::DisplayExt::monitors()]. You can use
    /// [`DisplayExt::monitor_at_surface()`][crate::prelude::DisplayExt::monitor_at_surface()] to find a particular
    /// monitor.
    ///
    /// ## Properties
    ///
    ///
    /// #### `connector`
    ///  The connector name.
    ///
    /// Readable
    ///
    ///
    /// #### `description`
    ///  A short description of the monitor, meant for display to the user.
    ///
    /// Readable
    ///
    ///
    /// #### `display`
    ///  The [`Display`][crate::Display] of the monitor.
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `geometry`
    ///  The geometry of the monitor.
    ///
    /// Readable
    ///
    ///
    /// #### `height-mm`
    ///  The height of the monitor, in millimeters.
    ///
    /// Readable
    ///
    ///
    /// #### `manufacturer`
    ///  The manufacturer name.
    ///
    /// Readable
    ///
    ///
    /// #### `model`
    ///  The model name.
    ///
    /// Readable
    ///
    ///
    /// #### `refresh-rate`
    ///  The refresh rate, in milli-Hertz.
    ///
    /// Readable
    ///
    ///
    /// #### `scale`
    ///  The scale of the monitor.
    ///
    /// Readable
    ///
    ///
    /// #### `scale-factor`
    ///  The scale factor.
    ///
    /// The scale factor is the next larger integer,
    /// compared to [`scale`][struct@crate::Surface#scale].
    ///
    /// Readable
    ///
    ///
    /// #### `subpixel-layout`
    ///  The subpixel layout.
    ///
    /// Readable
    ///
    ///
    /// #### `valid`
    ///  Whether the object is still valid.
    ///
    /// Readable
    ///
    ///
    /// #### `width-mm`
    ///  The width of the monitor, in millimeters.
    ///
    /// Readable
    ///
    /// ## Signals
    ///
    ///
    /// #### `invalidate`
    ///  Emitted when the output represented by @monitor gets disconnected.
    ///
    ///
    ///
    /// # Implements
    ///
    /// [`MonitorExt`][trait@crate::prelude::MonitorExt]
    #[doc(alias = "GdkMonitor")]
    pub struct Monitor(Object<ffi::GdkMonitor, ffi::GdkMonitorClass>);

    match fn {
        type_ => || ffi::gdk_monitor_get_type(),
    }
}

impl Monitor {
    pub const NONE: Option<&'static Monitor> = None;
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::Monitor>> Sealed for T {}
}

/// Trait containing all [`struct@Monitor`] methods.
///
/// # Implementors
///
/// [`Monitor`][struct@crate::Monitor]
pub trait MonitorExt: IsA<Monitor> + sealed::Sealed + 'static {
    /// Gets the name of the monitor's connector, if available.
    ///
    /// These are strings such as "eDP-1", or "HDMI-2". They depend
    /// on software and hardware configuration, and should not be
    /// relied on as stable identifiers of a specific monitor.
    ///
    /// # Returns
    ///
    /// the name of the connector
    #[doc(alias = "gdk_monitor_get_connector")]
    #[doc(alias = "get_connector")]
    fn connector(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::gdk_monitor_get_connector(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets a string describing the monitor, if available.
    ///
    /// This can be used to identify a monitor in the UI.
    ///
    /// # Returns
    ///
    /// the monitor description
    #[cfg(feature = "v4_10")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
    #[doc(alias = "gdk_monitor_get_description")]
    #[doc(alias = "get_description")]
    fn description(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::gdk_monitor_get_description(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets the display that this monitor belongs to.
    ///
    /// # Returns
    ///
    /// the display
    #[doc(alias = "gdk_monitor_get_display")]
    #[doc(alias = "get_display")]
    fn display(&self) -> Display {
        unsafe { from_glib_none(ffi::gdk_monitor_get_display(self.as_ref().to_glib_none().0)) }
    }

    /// Retrieves the size and position of the monitor within the
    /// display coordinate space.
    ///
    /// The returned geometry is in  ”application pixels”, not in
    /// ”device pixels” (see [`scale()`][Self::scale()]).
    ///
    /// # Returns
    ///
    ///
    /// ## `geometry`
    /// a [`Rectangle`][crate::Rectangle] to be filled with the monitor geometry
    #[doc(alias = "gdk_monitor_get_geometry")]
    #[doc(alias = "get_geometry")]
    fn geometry(&self) -> Rectangle {
        unsafe {
            let mut geometry = Rectangle::uninitialized();
            ffi::gdk_monitor_get_geometry(
                self.as_ref().to_glib_none().0,
                geometry.to_glib_none_mut().0,
            );
            geometry
        }
    }

    /// Gets the height in millimeters of the monitor.
    ///
    /// # Returns
    ///
    /// the physical height of the monitor
    #[doc(alias = "gdk_monitor_get_height_mm")]
    #[doc(alias = "get_height_mm")]
    fn height_mm(&self) -> i32 {
        unsafe { ffi::gdk_monitor_get_height_mm(self.as_ref().to_glib_none().0) }
    }

    /// Gets the name or PNP ID of the monitor's manufacturer.
    ///
    /// Note that this value might also vary depending on actual
    /// display backend.
    ///
    /// The PNP ID registry is located at
    /// [https://uefi.org/pnp_id_list](https://uefi.org/pnp_id_list).
    ///
    /// # Returns
    ///
    /// the name of the manufacturer
    #[doc(alias = "gdk_monitor_get_manufacturer")]
    #[doc(alias = "get_manufacturer")]
    fn manufacturer(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::gdk_monitor_get_manufacturer(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets the string identifying the monitor model, if available.
    ///
    /// # Returns
    ///
    /// the monitor model
    #[doc(alias = "gdk_monitor_get_model")]
    #[doc(alias = "get_model")]
    fn model(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::gdk_monitor_get_model(self.as_ref().to_glib_none().0)) }
    }

    /// Gets the refresh rate of the monitor, if available.
    ///
    /// The value is in milli-Hertz, so a refresh rate of 60Hz
    /// is returned as 60000.
    ///
    /// # Returns
    ///
    /// the refresh rate in milli-Hertz, or 0
    #[doc(alias = "gdk_monitor_get_refresh_rate")]
    #[doc(alias = "get_refresh_rate")]
    fn refresh_rate(&self) -> i32 {
        unsafe { ffi::gdk_monitor_get_refresh_rate(self.as_ref().to_glib_none().0) }
    }

    /// Gets the internal scale factor that maps from monitor coordinates
    /// to device pixels.
    ///
    /// This can be used if you want to create pixel based data for a
    /// particular monitor, but most of the time you’re drawing to a surface
    /// where it is better to use [`SurfaceExt::scale()`][crate::prelude::SurfaceExt::scale()] instead.
    ///
    /// # Returns
    ///
    /// the scale
    #[cfg(feature = "v4_14")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
    #[doc(alias = "gdk_monitor_get_scale")]
    #[doc(alias = "get_scale")]
    fn scale(&self) -> f64 {
        unsafe { ffi::gdk_monitor_get_scale(self.as_ref().to_glib_none().0) }
    }

    /// Gets the internal scale factor that maps from monitor coordinates
    /// to device pixels.
    ///
    /// On traditional systems this is 1, but on very high density outputs
    /// it can be a higher value (often 2).
    ///
    /// This can be used if you want to create pixel based data for a
    /// particular monitor, but most of the time you’re drawing to a surface
    /// where it is better to use [`SurfaceExt::scale_factor()`][crate::prelude::SurfaceExt::scale_factor()] instead.
    ///
    /// # Returns
    ///
    /// the scale factor
    #[doc(alias = "gdk_monitor_get_scale_factor")]
    #[doc(alias = "get_scale_factor")]
    fn scale_factor(&self) -> i32 {
        unsafe { ffi::gdk_monitor_get_scale_factor(self.as_ref().to_glib_none().0) }
    }

    /// Gets information about the layout of red, green and blue
    /// primaries for pixels.
    ///
    /// # Returns
    ///
    /// the subpixel layout
    #[doc(alias = "gdk_monitor_get_subpixel_layout")]
    #[doc(alias = "get_subpixel_layout")]
    fn subpixel_layout(&self) -> SubpixelLayout {
        unsafe {
            from_glib(ffi::gdk_monitor_get_subpixel_layout(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets the width in millimeters of the monitor.
    ///
    /// # Returns
    ///
    /// the physical width of the monitor
    #[doc(alias = "gdk_monitor_get_width_mm")]
    #[doc(alias = "get_width_mm")]
    fn width_mm(&self) -> i32 {
        unsafe { ffi::gdk_monitor_get_width_mm(self.as_ref().to_glib_none().0) }
    }

    /// Returns [`true`] if the @self object corresponds to a
    /// physical monitor.
    ///
    /// The @self becomes invalid when the physical monitor
    /// is unplugged or removed.
    ///
    /// # Returns
    ///
    /// [`true`] if the object corresponds to a physical monitor
    #[doc(alias = "gdk_monitor_is_valid")]
    fn is_valid(&self) -> bool {
        unsafe { from_glib(ffi::gdk_monitor_is_valid(self.as_ref().to_glib_none().0)) }
    }

    /// Emitted when the output represented by @monitor gets disconnected.
    #[doc(alias = "invalidate")]
    fn connect_invalidate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn invalidate_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
            this: *mut ffi::GdkMonitor,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"invalidate\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    invalidate_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "connector")]
    fn connect_connector_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_connector_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::connector\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_connector_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v4_10")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
    #[doc(alias = "description")]
    fn connect_description_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_description_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::description\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_description_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "geometry")]
    fn connect_geometry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_geometry_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::geometry\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_geometry_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "height-mm")]
    fn connect_height_mm_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_height_mm_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::height-mm\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_height_mm_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "manufacturer")]
    fn connect_manufacturer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_manufacturer_trampoline<
            P: IsA<Monitor>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::manufacturer\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_manufacturer_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "model")]
    fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_model_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::model\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_model_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "refresh-rate")]
    fn connect_refresh_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_refresh_rate_trampoline<
            P: IsA<Monitor>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::refresh-rate\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_refresh_rate_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v4_14")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
    #[doc(alias = "scale")]
    fn connect_scale_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_scale_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::scale\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_scale_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "scale-factor")]
    fn connect_scale_factor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_scale_factor_trampoline<
            P: IsA<Monitor>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::scale-factor\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_scale_factor_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "subpixel-layout")]
    fn connect_subpixel_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_subpixel_layout_trampoline<
            P: IsA<Monitor>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::subpixel-layout\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_subpixel_layout_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "valid")]
    fn connect_valid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_valid_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::valid\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_valid_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "width-mm")]
    fn connect_width_mm_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_width_mm_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
            this: *mut ffi::GdkMonitor,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::width-mm\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_width_mm_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl<O: IsA<Monitor>> MonitorExt for O {}