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
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
// 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 cairo;
use gdk_sys;
use glib::object::IsA;
use glib::object::ObjectType as ObjectType_;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::GString;
use glib_sys;
use std::boxed::Box as Box_;
use std::fmt;
use std::mem::transmute;
use Display;
use Rectangle;
use Visual;
use Window;

glib_wrapper! {
    /// `Screen` objects are the GDK representation of the screen on
    /// which windows can be displayed and on which the pointer moves.
    /// X originally identified screens with physical screens, but
    /// nowadays it is more common to have a single `Screen` which
    /// combines several physical monitors (see `Screen::get_n_monitors`).
    ///
    /// `Screen` is used throughout GDK and GTK+ to specify which screen
    /// the top level windows are to be displayed on. it is also used to
    /// query the screen specification and default settings such as
    /// the default visual (`Screen::get_system_visual`), the dimensions
    /// of the physical monitors (`Screen::get_monitor_geometry`), etc.
    pub struct Screen(Object<gdk_sys::GdkScreen, ScreenClass>);

    match fn {
        get_type => || gdk_sys::gdk_screen_get_type(),
    }
}

impl Screen {
    /// Returns the screen’s currently active window.
    ///
    /// On X11, this is done by inspecting the _NET_ACTIVE_WINDOW property
    /// on the root window, as described in the
    /// [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec).
    /// If there is no currently currently active
    /// window, or the window manager does not support the
    /// _NET_ACTIVE_WINDOW hint, this function returns `None`.
    ///
    /// On other platforms, this function may return `None`, depending on whether
    /// it is implementable on that platform.
    ///
    /// The returned window should be unrefed using `gobject::Object::unref` when
    /// no longer needed.
    ///
    /// # Deprecated since 3.22
    ///
    ///
    /// # Returns
    ///
    /// the currently active window,
    ///  or `None`.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_active_window(&self) -> Option<Window> {
        unsafe { from_glib_full(gdk_sys::gdk_screen_get_active_window(self.to_glib_none().0)) }
    }

    /// Gets the display to which the `self` belongs.
    ///
    /// # Returns
    ///
    /// the display to which `self` belongs
    pub fn get_display(&self) -> Display {
        unsafe { from_glib_none(gdk_sys::gdk_screen_get_display(self.to_glib_none().0)) }
    }

    /// Gets the height of `self` in pixels. The returned size is in
    /// ”application pixels”, not in ”device pixels” (see
    /// `Screen::get_monitor_scale_factor`).
    ///
    /// # Deprecated since 3.22
    ///
    /// Use per-monitor information instead
    ///
    /// # Returns
    ///
    /// the height of `self` in pixels.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_height(&self) -> i32 {
        unsafe { gdk_sys::gdk_screen_get_height(self.to_glib_none().0) }
    }

    /// Returns the height of `self` in millimeters.
    ///
    /// Note that this value is somewhat ill-defined when the screen
    /// has multiple monitors of different resolution. It is recommended
    /// to use the monitor dimensions instead.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use per-monitor information instead
    ///
    /// # Returns
    ///
    /// the heigth of `self` in millimeters.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_height_mm(&self) -> i32 {
        unsafe { gdk_sys::gdk_screen_get_height_mm(self.to_glib_none().0) }
    }

    /// Returns the monitor number in which the point (`x`,`y`) is located.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use `Display::get_monitor_at_point` instead
    /// ## `x`
    /// the x coordinate in the virtual screen.
    /// ## `y`
    /// the y coordinate in the virtual screen.
    ///
    /// # Returns
    ///
    /// the monitor number in which the point (`x`,`y`) lies, or
    ///  a monitor close to (`x`,`y`) if the point is not in any monitor.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_monitor_at_point(&self, x: i32, y: i32) -> i32 {
        unsafe { gdk_sys::gdk_screen_get_monitor_at_point(self.to_glib_none().0, x, y) }
    }

    /// Returns the number of the monitor in which the largest area of the
    /// bounding rectangle of `window` resides.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use `Display::get_monitor_at_window` instead
    /// ## `window`
    /// a `Window`
    ///
    /// # Returns
    ///
    /// the monitor number in which most of `window` is located,
    ///  or if `window` does not intersect any monitors, a monitor,
    ///  close to `window`.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_monitor_at_window<P: IsA<Window>>(&self, window: &P) -> i32 {
        unsafe {
            gdk_sys::gdk_screen_get_monitor_at_window(
                self.to_glib_none().0,
                window.as_ref().to_glib_none().0,
            )
        }
    }

    /// Retrieves the `Rectangle` representing the size and position of
    /// the individual monitor within the entire screen area. The returned
    /// geometry is in ”application pixels”, not in ”device pixels” (see
    /// `Screen::get_monitor_scale_factor`).
    ///
    /// Monitor numbers start at 0. To obtain the number of monitors of
    /// `self`, use `Screen::get_n_monitors`.
    ///
    /// Note that the size of the entire screen area can be retrieved via
    /// `Screen::get_width` and `Screen::get_height`.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use `Monitor::get_geometry` instead
    /// ## `monitor_num`
    /// the monitor number
    /// ## `dest`
    /// a `Rectangle` to be filled with
    ///  the monitor geometry
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_monitor_geometry(&self, monitor_num: i32) -> Rectangle {
        unsafe {
            let mut dest = Rectangle::uninitialized();
            gdk_sys::gdk_screen_get_monitor_geometry(
                self.to_glib_none().0,
                monitor_num,
                dest.to_glib_none_mut().0,
            );
            dest
        }
    }

    /// Gets the height in millimeters of the specified monitor.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use `Monitor::get_height_mm` instead
    /// ## `monitor_num`
    /// number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
    ///
    /// # Returns
    ///
    /// the height of the monitor, or -1 if not available
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_monitor_height_mm(&self, monitor_num: i32) -> i32 {
        unsafe { gdk_sys::gdk_screen_get_monitor_height_mm(self.to_glib_none().0, monitor_num) }
    }

    /// Returns the output name of the specified monitor.
    /// Usually something like VGA, DVI, or TV, not the actual
    /// product name of the display device.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use `Monitor::get_model` instead
    /// ## `monitor_num`
    /// number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
    ///
    /// # Returns
    ///
    /// a newly-allocated string containing the name
    ///  of the monitor, or `None` if the name cannot be determined
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_monitor_plug_name(&self, monitor_num: i32) -> Option<GString> {
        unsafe {
            from_glib_full(gdk_sys::gdk_screen_get_monitor_plug_name(
                self.to_glib_none().0,
                monitor_num,
            ))
        }
    }

    /// Returns the internal scale factor that maps from monitor coordinates
    /// to the actual device pixels. On traditional systems this is 1, but
    /// on very high density outputs this 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 window
    /// where it is better to use `WindowExt::get_scale_factor` instead.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use `Monitor::get_scale_factor` instead
    /// ## `monitor_num`
    /// number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
    ///
    /// # Returns
    ///
    /// the scale factor
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_monitor_scale_factor(&self, monitor_num: i32) -> i32 {
        unsafe { gdk_sys::gdk_screen_get_monitor_scale_factor(self.to_glib_none().0, monitor_num) }
    }

    /// Gets the width in millimeters of the specified monitor, if available.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use `Monitor::get_width_mm` instead
    /// ## `monitor_num`
    /// number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
    ///
    /// # Returns
    ///
    /// the width of the monitor, or -1 if not available
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_monitor_width_mm(&self, monitor_num: i32) -> i32 {
        unsafe { gdk_sys::gdk_screen_get_monitor_width_mm(self.to_glib_none().0, monitor_num) }
    }

    /// Retrieves the `Rectangle` representing the size and position of
    /// the “work area” on a monitor within the entire screen area. The returned
    /// geometry is in ”application pixels”, not in ”device pixels” (see
    /// `Screen::get_monitor_scale_factor`).
    ///
    /// The work area should be considered when positioning menus and
    /// similar popups, to avoid placing them below panels, docks or other
    /// desktop components.
    ///
    /// Note that not all backends may have a concept of workarea. This
    /// function will return the monitor geometry if a workarea is not
    /// available, or does not apply.
    ///
    /// Monitor numbers start at 0. To obtain the number of monitors of
    /// `self`, use `Screen::get_n_monitors`.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use `Monitor::get_workarea` instead
    /// ## `monitor_num`
    /// the monitor number
    /// ## `dest`
    /// a `Rectangle` to be filled with
    ///  the monitor workarea
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_monitor_workarea(&self, monitor_num: i32) -> Rectangle {
        unsafe {
            let mut dest = Rectangle::uninitialized();
            gdk_sys::gdk_screen_get_monitor_workarea(
                self.to_glib_none().0,
                monitor_num,
                dest.to_glib_none_mut().0,
            );
            dest
        }
    }

    /// Returns the number of monitors which `self` consists of.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use `Display::get_n_monitors` instead
    ///
    /// # Returns
    ///
    /// number of monitors which `self` consists of
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_n_monitors(&self) -> i32 {
        unsafe { gdk_sys::gdk_screen_get_n_monitors(self.to_glib_none().0) }
    }

    /// Gets the index of `self` among the screens in the display
    /// to which it belongs. (See `Screen::get_display`)
    ///
    /// # Deprecated since 3.22
    ///
    ///
    /// # Returns
    ///
    /// the index
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_number(&self) -> i32 {
        unsafe { gdk_sys::gdk_screen_get_number(self.to_glib_none().0) }
    }

    /// Gets the primary monitor for `self`. The primary monitor
    /// is considered the monitor where the “main desktop” lives.
    /// While normal application windows typically allow the window
    /// manager to place the windows, specialized desktop applications
    /// such as panels should place themselves on the primary monitor.
    ///
    /// If no primary monitor is configured by the user, the return value
    /// will be 0, defaulting to the first monitor.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use `Display::get_primary_monitor` instead
    ///
    /// # Returns
    ///
    /// An integer index for the primary monitor, or 0 if none is configured.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_primary_monitor(&self) -> i32 {
        unsafe { gdk_sys::gdk_screen_get_primary_monitor(self.to_glib_none().0) }
    }

    /// Gets the resolution for font handling on the screen; see
    /// `Screen::set_resolution` for full details.
    ///
    /// # Returns
    ///
    /// the current resolution, or -1 if no resolution
    /// has been set.
    pub fn get_resolution(&self) -> f64 {
        unsafe { gdk_sys::gdk_screen_get_resolution(self.to_glib_none().0) }
    }

    /// Gets a visual to use for creating windows with an alpha channel.
    /// The windowing system on which GTK+ is running
    /// may not support this capability, in which case `None` will
    /// be returned. Even if a non-`None` value is returned, its
    /// possible that the window’s alpha channel won’t be honored
    /// when displaying the window on the screen: in particular, for
    /// X an appropriate windowing manager and compositing manager
    /// must be running to provide appropriate display.
    ///
    /// This functionality is not implemented in the Windows backend.
    ///
    /// For setting an overall opacity for a top-level window, see
    /// `WindowExt::set_opacity`.
    ///
    /// # Returns
    ///
    /// a visual to use for windows
    ///  with an alpha channel or `None` if the capability is not
    ///  available.
    pub fn get_rgba_visual(&self) -> Option<Visual> {
        unsafe { from_glib_none(gdk_sys::gdk_screen_get_rgba_visual(self.to_glib_none().0)) }
    }

    /// Gets the root window of `self`.
    ///
    /// # Returns
    ///
    /// the root window
    pub fn get_root_window(&self) -> Option<Window> {
        unsafe { from_glib_none(gdk_sys::gdk_screen_get_root_window(self.to_glib_none().0)) }
    }

    /// Get the system’s default visual for `self`.
    /// This is the visual for the root window of the display.
    /// The return value should not be freed.
    ///
    /// # Returns
    ///
    /// the system visual
    pub fn get_system_visual(&self) -> Option<Visual> {
        unsafe { from_glib_none(gdk_sys::gdk_screen_get_system_visual(self.to_glib_none().0)) }
    }

    /// Obtains a list of all toplevel windows known to GDK on the screen `self`.
    /// A toplevel window is a child of the root window (see
    /// `gdk_get_default_root_window`).
    ///
    /// The returned list should be freed with `glib::List::free`, but
    /// its elements need not be freed.
    ///
    /// # Returns
    ///
    ///
    ///  list of toplevel windows, free with `glib::List::free`
    pub fn get_toplevel_windows(&self) -> Vec<Window> {
        unsafe {
            FromGlibPtrContainer::from_glib_container(gdk_sys::gdk_screen_get_toplevel_windows(
                self.to_glib_none().0,
            ))
        }
    }

    /// Gets the width of `self` in pixels. The returned size is in
    /// ”application pixels”, not in ”device pixels” (see
    /// `Screen::get_monitor_scale_factor`).
    ///
    /// # Deprecated since 3.22
    ///
    /// Use per-monitor information instead
    ///
    /// # Returns
    ///
    /// the width of `self` in pixels.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_width(&self) -> i32 {
        unsafe { gdk_sys::gdk_screen_get_width(self.to_glib_none().0) }
    }

    /// Gets the width of `self` in millimeters.
    ///
    /// Note that this value is somewhat ill-defined when the screen
    /// has multiple monitors of different resolution. It is recommended
    /// to use the monitor dimensions instead.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use per-monitor information instead
    ///
    /// # Returns
    ///
    /// the width of `self` in millimeters.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn get_width_mm(&self) -> i32 {
        unsafe { gdk_sys::gdk_screen_get_width_mm(self.to_glib_none().0) }
    }

    /// Returns a `glib::List` of ``GdkWindows`` representing the current
    /// window stack.
    ///
    /// On X11, this is done by inspecting the _NET_CLIENT_LIST_STACKING
    /// property on the root window, as described in the
    /// [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec).
    /// If the window manager does not support the
    /// _NET_CLIENT_LIST_STACKING hint, this function returns `None`.
    ///
    /// On other platforms, this function may return `None`, depending on whether
    /// it is implementable on that platform.
    ///
    /// The returned list is newly allocated and owns references to the
    /// windows it contains, so it should be freed using `glib::List::free` and
    /// its windows unrefed using `gobject::Object::unref` when no longer needed.
    ///
    /// # Returns
    ///
    /// a
    ///  list of ``GdkWindows`` for the current window stack, or `None`.
    pub fn get_window_stack(&self) -> Vec<Window> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(gdk_sys::gdk_screen_get_window_stack(
                self.to_glib_none().0,
            ))
        }
    }

    /// Returns whether windows with an RGBA visual can reasonably
    /// be expected to have their alpha channel drawn correctly on
    /// the screen.
    ///
    /// On X11 this function returns whether a compositing manager is
    /// compositing `self`.
    ///
    /// # Returns
    ///
    /// Whether windows with RGBA visuals can reasonably be
    /// expected to have their alpha channels drawn correctly on the screen.
    pub fn is_composited(&self) -> bool {
        unsafe { from_glib(gdk_sys::gdk_screen_is_composited(self.to_glib_none().0)) }
    }

    /// Lists the available visuals for the specified `self`.
    /// A visual describes a hardware image data format.
    /// For example, a visual might support 24-bit color, or 8-bit color,
    /// and might expect pixels to be in a certain format.
    ///
    /// Call `glib::List::free` on the return value when you’re finished with it.
    ///
    /// # Returns
    ///
    ///
    ///  a list of visuals; the list must be freed, but not its contents
    pub fn list_visuals(&self) -> Vec<Visual> {
        unsafe {
            FromGlibPtrContainer::from_glib_container(gdk_sys::gdk_screen_list_visuals(
                self.to_glib_none().0,
            ))
        }
    }

    /// Determines the name to pass to `Display::open` to get
    /// a `Display` with this screen as the default screen.
    ///
    /// # Deprecated since 3.22
    ///
    ///
    /// # Returns
    ///
    /// a newly allocated string, free with `g_free`
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn make_display_name(&self) -> GString {
        unsafe { from_glib_full(gdk_sys::gdk_screen_make_display_name(self.to_glib_none().0)) }
    }

    /// Sets the default font options for the screen. These
    /// options will be set on any `pango::Context`’s newly created
    /// with `gdk_pango_context_get_for_screen`. Changing the
    /// default set of font options does not affect contexts that
    /// have already been created.
    /// ## `options`
    /// a `cairo::FontOptions`, or `None` to unset any
    ///  previously set default font options.
    pub fn set_font_options(&self, options: Option<&cairo::FontOptions>) {
        unsafe {
            gdk_sys::gdk_screen_set_font_options(self.to_glib_none().0, options.to_glib_none().0);
        }
    }

    /// Sets the resolution for font handling on the screen. This is a
    /// scale factor between points specified in a `pango::FontDescription`
    /// and cairo units. The default value is 96, meaning that a 10 point
    /// font will be 13 units high. (10 * 96. / 72. = 13.3).
    /// ## `dpi`
    /// the resolution in “dots per inch”. (Physical inches aren’t actually
    ///  involved; the terminology is conventional.)
    pub fn set_resolution(&self, dpi: f64) {
        unsafe {
            gdk_sys::gdk_screen_set_resolution(self.to_glib_none().0, dpi);
        }
    }

    //pub fn get_property_font_options(&self) -> /*Unimplemented*/Fundamental: Pointer {
    //    unsafe {
    //        let mut value = Value::from_type(</*Unknown type*/ as StaticType>::static_type());
    //        gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"font-options\0".as_ptr() as *const _, value.to_glib_none_mut().0);
    //        value.get().expect("Return Value for property `font-options` getter").unwrap()
    //    }
    //}

    /// Gets the default screen for the default display. (See
    /// gdk_display_get_default ()).
    ///
    /// # Returns
    ///
    /// a `Screen`, or `None` if
    ///  there is no default display.
    pub fn get_default() -> Option<Screen> {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(gdk_sys::gdk_screen_get_default()) }
    }

    /// Gets the height of the default screen in pixels. The returned
    /// size is in ”application pixels”, not in ”device pixels” (see
    /// `Screen::get_monitor_scale_factor`).
    ///
    /// # Deprecated since 3.22
    ///
    /// Use per-monitor information
    ///
    /// # Returns
    ///
    /// the height of the default screen in pixels.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn height() -> i32 {
        assert_initialized_main_thread!();
        unsafe { gdk_sys::gdk_screen_height() }
    }

    /// Returns the height of the default screen in millimeters.
    /// Note that on many X servers this value will not be correct.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use per-monitor information
    ///
    /// # Returns
    ///
    /// the height of the default screen in millimeters,
    /// though it is not always correct.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn height_mm() -> i32 {
        assert_initialized_main_thread!();
        unsafe { gdk_sys::gdk_screen_height_mm() }
    }

    /// Gets the width of the default screen in pixels. The returned
    /// size is in ”application pixels”, not in ”device pixels” (see
    /// `Screen::get_monitor_scale_factor`).
    ///
    /// # Deprecated since 3.22
    ///
    /// Use per-monitor information
    ///
    /// # Returns
    ///
    /// the width of the default screen in pixels.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn width() -> i32 {
        assert_initialized_main_thread!();
        unsafe { gdk_sys::gdk_screen_width() }
    }

    /// Returns the width of the default screen in millimeters.
    /// Note that on many X servers this value will not be correct.
    ///
    /// # Deprecated since 3.22
    ///
    /// Use per-monitor information
    ///
    /// # Returns
    ///
    /// the width of the default screen in millimeters,
    /// though it is not always correct.
    #[cfg_attr(feature = "v3_22", deprecated)]
    pub fn width_mm() -> i32 {
        assert_initialized_main_thread!();
        unsafe { gdk_sys::gdk_screen_width_mm() }
    }

    /// The ::composited-changed signal is emitted when the composited
    /// status of the screen changes
    pub fn connect_composited_changed<F: Fn(&Screen) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn composited_changed_trampoline<F: Fn(&Screen) + 'static>(
            this: *mut gdk_sys::GdkScreen,
            f: glib_sys::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"composited-changed\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    composited_changed_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    /// The ::monitors-changed signal is emitted when the number, size
    /// or position of the monitors attached to the screen change.
    ///
    /// Only for X11 and OS X for now. A future implementation for Win32
    /// may be a possibility.
    pub fn connect_monitors_changed<F: Fn(&Screen) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn monitors_changed_trampoline<F: Fn(&Screen) + 'static>(
            this: *mut gdk_sys::GdkScreen,
            f: glib_sys::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"monitors-changed\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    monitors_changed_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    /// The ::size-changed signal is emitted when the pixel width or
    /// height of a screen changes.
    pub fn connect_size_changed<F: Fn(&Screen) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn size_changed_trampoline<F: Fn(&Screen) + 'static>(
            this: *mut gdk_sys::GdkScreen,
            f: glib_sys::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"size-changed\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    size_changed_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    pub fn connect_property_font_options_notify<F: Fn(&Screen) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_font_options_trampoline<F: Fn(&Screen) + 'static>(
            this: *mut gdk_sys::GdkScreen,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::font-options\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_font_options_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    pub fn connect_property_resolution_notify<F: Fn(&Screen) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_resolution_trampoline<F: Fn(&Screen) + 'static>(
            this: *mut gdk_sys::GdkScreen,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::resolution\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_resolution_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl fmt::Display for Screen {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "Screen")
    }
}