gdk4/auto/
display.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#![allow(deprecated)]
5
6#[cfg(target_os = "linux")]
7#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))]
8#[cfg(feature = "v4_14")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
10use crate::DmabufFormats;
11#[cfg(feature = "v4_6")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
13use crate::GLContext;
14use crate::{ffi, AppLaunchContext, Clipboard, Device, Event, Monitor, Seat, Surface};
15use glib::{
16    object::ObjectType as _,
17    prelude::*,
18    signal::{connect_raw, SignalHandlerId},
19    translate::*,
20};
21use std::boxed::Box as Box_;
22
23glib::wrapper! {
24    /// A representation of a workstation.
25    ///
26    /// Their purpose are two-fold:
27    ///
28    /// - To manage and provide information about input devices (pointers, keyboards, etc)
29    /// - To manage and provide information about output devices (monitors, projectors, etc)
30    ///
31    /// Most of the input device handling has been factored out into separate
32    /// [`Seat`][crate::Seat] objects. Every display has a one or more seats, which
33    /// can be accessed with [`DisplayExt::default_seat()`][crate::prelude::DisplayExt::default_seat()] and
34    /// [`DisplayExt::list_seats()`][crate::prelude::DisplayExt::list_seats()].
35    ///
36    /// Output devices are represented by [`Monitor`][crate::Monitor] objects, which can
37    /// be accessed with [`DisplayExt::monitor_at_surface()`][crate::prelude::DisplayExt::monitor_at_surface()] and similar APIs.
38    ///
39    /// ## Properties
40    ///
41    ///
42    /// #### `composited`
43    ///  [`true`] if the display properly composites the alpha channel.
44    ///
45    /// Readable
46    ///
47    ///
48    /// #### `dmabuf-formats`
49    ///  The dma-buf formats that are supported on this display
50    ///
51    /// Readable
52    ///
53    ///
54    /// #### `input-shapes`
55    ///  [`true`] if the display supports input shapes.
56    ///
57    /// Readable
58    ///
59    ///
60    /// #### `rgba`
61    ///  [`true`] if the display supports an alpha channel.
62    ///
63    /// Readable
64    ///
65    ///
66    /// #### `shadow-width`
67    ///  [`true`] if the display supports extensible frames.
68    ///
69    /// Readable
70    ///
71    /// ## Signals
72    ///
73    ///
74    /// #### `closed`
75    ///  Emitted when the connection to the windowing system for @display is closed.
76    ///
77    ///
78    ///
79    ///
80    /// #### `opened`
81    ///  Emitted when the connection to the windowing system for @display is opened.
82    ///
83    ///
84    ///
85    ///
86    /// #### `seat-added`
87    ///  Emitted whenever a new seat is made known to the windowing system.
88    ///
89    ///
90    ///
91    ///
92    /// #### `seat-removed`
93    ///  Emitted whenever a seat is removed by the windowing system.
94    ///
95    ///
96    ///
97    ///
98    /// #### `setting-changed`
99    ///  Emitted whenever a setting changes its value.
100    ///
101    ///
102    ///
103    /// # Implements
104    ///
105    /// [`DisplayExt`][trait@crate::prelude::DisplayExt], [`DisplayExtManual`][trait@crate::prelude::DisplayExtManual]
106    #[doc(alias = "GdkDisplay")]
107    pub struct Display(Object<ffi::GdkDisplay>);
108
109    match fn {
110        type_ => || ffi::gdk_display_get_type(),
111    }
112}
113
114impl Display {
115    pub const NONE: Option<&'static Display> = None;
116
117    /// Gets the default [`Display`][crate::Display].
118    ///
119    /// This is a convenience function for:
120    ///
121    ///     gdk_display_manager_get_default_display (gdk_display_manager_get ())
122    ///
123    /// # Returns
124    ///
125    /// a [`Display`][crate::Display], or [`None`] if
126    ///   there is no default display
127    #[doc(alias = "gdk_display_get_default")]
128    #[doc(alias = "get_default")]
129    #[allow(clippy::should_implement_trait)]
130    pub fn default() -> Option<Display> {
131        assert_initialized_main_thread!();
132        unsafe { from_glib_none(ffi::gdk_display_get_default()) }
133    }
134
135    /// Opens a display.
136    ///
137    /// If opening the display fails, `NULL` is returned.
138    /// ## `display_name`
139    /// the name of the display to open
140    ///
141    /// # Returns
142    ///
143    /// a [`Display`][crate::Display]
144    #[doc(alias = "gdk_display_open")]
145    pub fn open(display_name: Option<&str>) -> Option<Display> {
146        assert_initialized_main_thread!();
147        unsafe { from_glib_none(ffi::gdk_display_open(display_name.to_glib_none().0)) }
148    }
149}
150
151impl std::fmt::Display for Display {
152    #[inline]
153    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
154        f.write_str(&DisplayExt::name(self))
155    }
156}
157
158/// Trait containing all [`struct@Display`] methods.
159///
160/// # Implementors
161///
162/// [`Display`][struct@crate::Display]
163pub trait DisplayExt: IsA<Display> + 'static {
164    /// Emits a short beep on @self
165    #[doc(alias = "gdk_display_beep")]
166    fn beep(&self) {
167        unsafe {
168            ffi::gdk_display_beep(self.as_ref().to_glib_none().0);
169        }
170    }
171
172    /// Closes the connection to the windowing system for the given display.
173    ///
174    /// This cleans up associated resources.
175    #[doc(alias = "gdk_display_close")]
176    fn close(&self) {
177        unsafe {
178            ffi::gdk_display_close(self.as_ref().to_glib_none().0);
179        }
180    }
181
182    /// Creates a new [`GLContext`][crate::GLContext] for the [`Display`][crate::Display].
183    ///
184    /// The context is disconnected from any particular surface or surface
185    /// and cannot be used to draw to any surface. It can only be used to
186    /// draw to non-surface framebuffers like textures.
187    ///
188    /// If the creation of the [`GLContext`][crate::GLContext] failed, @error will be set.
189    /// Before using the returned [`GLContext`][crate::GLContext], you will need to
190    /// call [`GLContextExt::make_current()`][crate::prelude::GLContextExt::make_current()] or [`GLContextExt::realize()`][crate::prelude::GLContextExt::realize()].
191    ///
192    /// # Returns
193    ///
194    /// the newly created [`GLContext`][crate::GLContext]
195    #[cfg(feature = "v4_6")]
196    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
197    #[doc(alias = "gdk_display_create_gl_context")]
198    fn create_gl_context(&self) -> Result<GLContext, glib::Error> {
199        unsafe {
200            let mut error = std::ptr::null_mut();
201            let ret =
202                ffi::gdk_display_create_gl_context(self.as_ref().to_glib_none().0, &mut error);
203            if error.is_null() {
204                Ok(from_glib_full(ret))
205            } else {
206                Err(from_glib_full(error))
207            }
208        }
209    }
210
211    /// Returns [`true`] if there is an ongoing grab on @device for @self.
212    /// ## `device`
213    /// a [`Device`][crate::Device]
214    ///
215    /// # Returns
216    ///
217    /// [`true`] if there is a grab in effect for @device.
218    #[doc(alias = "gdk_display_device_is_grabbed")]
219    fn device_is_grabbed(&self, device: &impl IsA<Device>) -> bool {
220        unsafe {
221            from_glib(ffi::gdk_display_device_is_grabbed(
222                self.as_ref().to_glib_none().0,
223                device.as_ref().to_glib_none().0,
224            ))
225        }
226    }
227
228    /// Flushes any requests queued for the windowing system.
229    ///
230    /// This happens automatically when the main loop blocks waiting for new events,
231    /// but if your application is drawing without returning control to the main loop,
232    /// you may need to call this function explicitly. A common case where this function
233    /// needs to be called is when an application is executing drawing commands
234    /// from a thread other than the thread where the main loop is running.
235    ///
236    /// This is most useful for X11. On windowing systems where requests are
237    /// handled synchronously, this function will do nothing.
238    #[doc(alias = "gdk_display_flush")]
239    fn flush(&self) {
240        unsafe {
241            ffi::gdk_display_flush(self.as_ref().to_glib_none().0);
242        }
243    }
244
245    /// Returns a [`AppLaunchContext`][crate::AppLaunchContext] suitable for launching
246    /// applications on the given display.
247    ///
248    /// # Returns
249    ///
250    /// a new [`AppLaunchContext`][crate::AppLaunchContext] for @self
251    #[doc(alias = "gdk_display_get_app_launch_context")]
252    #[doc(alias = "get_app_launch_context")]
253    fn app_launch_context(&self) -> AppLaunchContext {
254        unsafe {
255            from_glib_full(ffi::gdk_display_get_app_launch_context(
256                self.as_ref().to_glib_none().0,
257            ))
258        }
259    }
260
261    /// Gets the clipboard used for copy/paste operations.
262    ///
263    /// # Returns
264    ///
265    /// the display's clipboard
266    #[doc(alias = "gdk_display_get_clipboard")]
267    #[doc(alias = "get_clipboard")]
268    fn clipboard(&self) -> Clipboard {
269        unsafe {
270            from_glib_none(ffi::gdk_display_get_clipboard(
271                self.as_ref().to_glib_none().0,
272            ))
273        }
274    }
275
276    /// Returns the default [`Seat`][crate::Seat] for this display.
277    ///
278    /// Note that a display may not have a seat. In this case,
279    /// this function will return [`None`].
280    ///
281    /// # Returns
282    ///
283    /// the default seat.
284    #[doc(alias = "gdk_display_get_default_seat")]
285    #[doc(alias = "get_default_seat")]
286    fn default_seat(&self) -> Option<Seat> {
287        unsafe {
288            from_glib_none(ffi::gdk_display_get_default_seat(
289                self.as_ref().to_glib_none().0,
290            ))
291        }
292    }
293
294    /// Returns the dma-buf formats that are supported on this display.
295    ///
296    /// GTK may use OpenGL or Vulkan to support some formats.
297    /// Calling this function will then initialize them if they aren't yet.
298    ///
299    /// The formats returned by this function can be used for negotiating
300    /// buffer formats with producers such as v4l, pipewire or GStreamer.
301    ///
302    /// To learn more about dma-bufs, see [`DmabufTextureBuilder`][crate::DmabufTextureBuilder].
303    ///
304    /// # Returns
305    ///
306    /// a [`DmabufFormats`][crate::DmabufFormats] object
307    #[cfg(target_os = "linux")]
308    #[cfg_attr(docsrs, doc(cfg(target_os = "linux")))]
309    #[cfg(feature = "v4_14")]
310    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
311    #[doc(alias = "gdk_display_get_dmabuf_formats")]
312    #[doc(alias = "get_dmabuf_formats")]
313    #[doc(alias = "dmabuf-formats")]
314    fn dmabuf_formats(&self) -> DmabufFormats {
315        unsafe {
316            from_glib_none(ffi::gdk_display_get_dmabuf_formats(
317                self.as_ref().to_glib_none().0,
318            ))
319        }
320    }
321
322    /// Gets the monitor in which the largest area of @surface
323    /// resides.
324    /// ## `surface`
325    /// a [`Surface`][crate::Surface]
326    ///
327    /// # Returns
328    ///
329    /// the monitor with the largest
330    ///   overlap with @surface
331    #[doc(alias = "gdk_display_get_monitor_at_surface")]
332    #[doc(alias = "get_monitor_at_surface")]
333    fn monitor_at_surface(&self, surface: &impl IsA<Surface>) -> Option<Monitor> {
334        unsafe {
335            from_glib_none(ffi::gdk_display_get_monitor_at_surface(
336                self.as_ref().to_glib_none().0,
337                surface.as_ref().to_glib_none().0,
338            ))
339        }
340    }
341
342    /// Gets the list of monitors associated with this display.
343    ///
344    /// Subsequent calls to this function will always return the
345    /// same list for the same display.
346    ///
347    /// You can listen to the GListModel::items-changed signal on
348    /// this list to monitor changes to the monitor of this display.
349    ///
350    /// # Returns
351    ///
352    /// a `GListModel` of [`Monitor`][crate::Monitor]
353    #[doc(alias = "gdk_display_get_monitors")]
354    #[doc(alias = "get_monitors")]
355    fn monitors(&self) -> gio::ListModel {
356        unsafe {
357            from_glib_none(ffi::gdk_display_get_monitors(
358                self.as_ref().to_glib_none().0,
359            ))
360        }
361    }
362
363    /// Gets the name of the display.
364    ///
365    /// # Returns
366    ///
367    /// a string representing the display name. This string is owned
368    ///   by GDK and should not be modified or freed.
369    #[doc(alias = "gdk_display_get_name")]
370    #[doc(alias = "get_name")]
371    fn name(&self) -> glib::GString {
372        unsafe { from_glib_none(ffi::gdk_display_get_name(self.as_ref().to_glib_none().0)) }
373    }
374
375    /// Gets the clipboard used for the primary selection.
376    ///
377    /// On backends where the primary clipboard is not supported natively,
378    /// GDK emulates this clipboard locally.
379    ///
380    /// # Returns
381    ///
382    /// the primary clipboard
383    #[doc(alias = "gdk_display_get_primary_clipboard")]
384    #[doc(alias = "get_primary_clipboard")]
385    fn primary_clipboard(&self) -> Clipboard {
386        unsafe {
387            from_glib_none(ffi::gdk_display_get_primary_clipboard(
388                self.as_ref().to_glib_none().0,
389            ))
390        }
391    }
392
393    /// Gets the startup notification ID for a Wayland display, or [`None`]
394    /// if no ID has been defined.
395    ///
396    /// # Deprecated since 4.10
397    ///
398    ///
399    /// # Returns
400    ///
401    /// the startup notification ID for @self
402    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
403    #[allow(deprecated)]
404    #[doc(alias = "gdk_display_get_startup_notification_id")]
405    #[doc(alias = "get_startup_notification_id")]
406    fn startup_notification_id(&self) -> Option<glib::GString> {
407        unsafe {
408            from_glib_none(ffi::gdk_display_get_startup_notification_id(
409                self.as_ref().to_glib_none().0,
410            ))
411        }
412    }
413
414    /// Finds out if the display has been closed.
415    ///
416    /// # Returns
417    ///
418    /// [`true`] if the display is closed.
419    #[doc(alias = "gdk_display_is_closed")]
420    fn is_closed(&self) -> bool {
421        unsafe { from_glib(ffi::gdk_display_is_closed(self.as_ref().to_glib_none().0)) }
422    }
423
424    /// Returns whether surfaces can reasonably be expected to have
425    /// their alpha channel drawn correctly on the screen.
426    ///
427    /// Check [`is_rgba()`][Self::is_rgba()] for whether the display
428    /// supports an alpha channel.
429    ///
430    /// On X11 this function returns whether a compositing manager is
431    /// compositing on @self.
432    ///
433    /// On modern displays, this value is always [`true`].
434    ///
435    /// # Returns
436    ///
437    /// Whether surfaces with RGBA visuals can reasonably
438    ///   be expected to have their alpha channels drawn correctly
439    ///   on the screen.
440    #[doc(alias = "gdk_display_is_composited")]
441    #[doc(alias = "composited")]
442    fn is_composited(&self) -> bool {
443        unsafe {
444            from_glib(ffi::gdk_display_is_composited(
445                self.as_ref().to_glib_none().0,
446            ))
447        }
448    }
449
450    /// Returns whether surfaces on this @self are created with an
451    /// alpha channel.
452    ///
453    /// Even if a [`true`] is returned, it is possible that the
454    /// surface’s alpha channel won’t be honored when displaying the
455    /// surface on the screen: in particular, for X an appropriate
456    /// windowing manager and compositing manager must be running to
457    /// provide appropriate display. Use [`is_composited()`][Self::is_composited()]
458    /// to check if that is the case.
459    ///
460    /// On modern displays, this value is always [`true`].
461    ///
462    /// # Returns
463    ///
464    /// [`true`] if surfaces are created with an alpha channel or
465    ///   [`false`] if the display does not support this functionality.
466    #[doc(alias = "gdk_display_is_rgba")]
467    #[doc(alias = "rgba")]
468    fn is_rgba(&self) -> bool {
469        unsafe { from_glib(ffi::gdk_display_is_rgba(self.as_ref().to_glib_none().0)) }
470    }
471
472    /// Returns the list of seats known to @self.
473    ///
474    /// # Returns
475    ///
476    /// the
477    ///   list of seats known to the [`Display`][crate::Display]
478    #[doc(alias = "gdk_display_list_seats")]
479    fn list_seats(&self) -> Vec<Seat> {
480        unsafe {
481            FromGlibPtrContainer::from_glib_container(ffi::gdk_display_list_seats(
482                self.as_ref().to_glib_none().0,
483            ))
484        }
485    }
486
487    /// Indicates to the GUI environment that the application has
488    /// finished loading, using a given identifier.
489    ///
490    /// GTK will call this function automatically for [GtkWindow](../gtk4/class.Window.html)
491    /// with custom startup-notification identifier unless
492    /// [gtk_window_set_auto_startup_notification()](../gtk4/method.Window.set_auto_startup_notification.html)
493    /// is called to disable that feature.
494    ///
495    /// # Deprecated since 4.10
496    ///
497    /// Using [`ToplevelExt::set_startup_id()`][crate::prelude::ToplevelExt::set_startup_id()] is sufficient
498    /// ## `startup_id`
499    /// a startup-notification identifier, for which
500    ///   notification process should be completed
501    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
502    #[allow(deprecated)]
503    #[doc(alias = "gdk_display_notify_startup_complete")]
504    fn notify_startup_complete(&self, startup_id: &str) {
505        unsafe {
506            ffi::gdk_display_notify_startup_complete(
507                self.as_ref().to_glib_none().0,
508                startup_id.to_glib_none().0,
509            );
510        }
511    }
512
513    /// Checks that OpenGL is available for @self and ensures that it is
514    /// properly initialized.
515    /// When this fails, an @error will be set describing the error and this
516    /// function returns [`false`].
517    ///
518    /// Note that even if this function succeeds, creating a [`GLContext`][crate::GLContext]
519    /// may still fail.
520    ///
521    /// This function is idempotent. Calling it multiple times will just
522    /// return the same value or error.
523    ///
524    /// You never need to call this function, GDK will call it automatically
525    /// as needed. But you can use it as a check when setting up code that
526    /// might make use of OpenGL.
527    ///
528    /// # Returns
529    ///
530    /// [`true`] if the display supports OpenGL
531    #[cfg(feature = "v4_4")]
532    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
533    #[doc(alias = "gdk_display_prepare_gl")]
534    fn prepare_gl(&self) -> Result<(), glib::Error> {
535        unsafe {
536            let mut error = std::ptr::null_mut();
537            let is_ok = ffi::gdk_display_prepare_gl(self.as_ref().to_glib_none().0, &mut error);
538            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
539            if error.is_null() {
540                Ok(())
541            } else {
542                Err(from_glib_full(error))
543            }
544        }
545    }
546
547    /// Adds the given event to the event queue for @self.
548    ///
549    /// # Deprecated since 4.10
550    ///
551    /// This function is only useful in very
552    /// special situations and should not be used by applications.
553    /// ## `event`
554    /// a [`Event`][crate::Event]
555    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
556    #[allow(deprecated)]
557    #[doc(alias = "gdk_display_put_event")]
558    fn put_event(&self, event: impl AsRef<Event>) {
559        unsafe {
560            ffi::gdk_display_put_event(
561                self.as_ref().to_glib_none().0,
562                event.as_ref().to_glib_none().0,
563            );
564        }
565    }
566
567    /// Returns [`true`] if the display supports input shapes.
568    ///
569    /// This means that [`SurfaceExt::set_input_region()`][crate::prelude::SurfaceExt::set_input_region()] can
570    /// be used to modify the input shape of surfaces on @self.
571    ///
572    /// On modern displays, this value is always [`true`].
573    ///
574    /// # Returns
575    ///
576    /// [`true`] if surfaces with modified input shape are supported
577    #[doc(alias = "gdk_display_supports_input_shapes")]
578    #[doc(alias = "input-shapes")]
579    fn supports_input_shapes(&self) -> bool {
580        unsafe {
581            from_glib(ffi::gdk_display_supports_input_shapes(
582                self.as_ref().to_glib_none().0,
583            ))
584        }
585    }
586
587    /// Returns whether it's possible for a surface to draw outside of the window area.
588    ///
589    /// If [`true`] is returned the application decides if it wants to draw shadows.
590    /// If [`false`] is returned, the compositor decides if it wants to draw shadows.
591    ///
592    /// # Returns
593    ///
594    /// [`true`] if surfaces can draw shadows or
595    ///   [`false`] if the display does not support this functionality.
596    #[cfg(feature = "v4_14")]
597    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
598    #[doc(alias = "gdk_display_supports_shadow_width")]
599    #[doc(alias = "shadow-width")]
600    fn supports_shadow_width(&self) -> bool {
601        unsafe {
602            from_glib(ffi::gdk_display_supports_shadow_width(
603                self.as_ref().to_glib_none().0,
604            ))
605        }
606    }
607
608    /// Flushes any requests queued for the windowing system and waits until all
609    /// requests have been handled.
610    ///
611    /// This is often used for making sure that the display is synchronized
612    /// with the current state of the program. Calling [`sync()`][Self::sync()]
613    /// before `GdkX11::Display::error_trap_pop()` makes sure that any errors
614    /// generated from earlier requests are handled before the error trap is removed.
615    ///
616    /// This is most useful for X11. On windowing systems where requests are
617    /// handled synchronously, this function will do nothing.
618    #[doc(alias = "gdk_display_sync")]
619    fn sync(&self) {
620        unsafe {
621            ffi::gdk_display_sync(self.as_ref().to_glib_none().0);
622        }
623    }
624
625    /// Emitted when the connection to the windowing system for @display is closed.
626    /// ## `is_error`
627    /// [`true`] if the display was closed due to an error
628    #[doc(alias = "closed")]
629    fn connect_closed<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId {
630        unsafe extern "C" fn closed_trampoline<P: IsA<Display>, F: Fn(&P, bool) + 'static>(
631            this: *mut ffi::GdkDisplay,
632            is_error: glib::ffi::gboolean,
633            f: glib::ffi::gpointer,
634        ) {
635            let f: &F = &*(f as *const F);
636            f(
637                Display::from_glib_borrow(this).unsafe_cast_ref(),
638                from_glib(is_error),
639            )
640        }
641        unsafe {
642            let f: Box_<F> = Box_::new(f);
643            connect_raw(
644                self.as_ptr() as *mut _,
645                c"closed".as_ptr() as *const _,
646                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
647                    closed_trampoline::<Self, F> as *const (),
648                )),
649                Box_::into_raw(f),
650            )
651        }
652    }
653
654    /// Emitted when the connection to the windowing system for @display is opened.
655    #[doc(alias = "opened")]
656    fn connect_opened<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
657        unsafe extern "C" fn opened_trampoline<P: IsA<Display>, F: Fn(&P) + 'static>(
658            this: *mut ffi::GdkDisplay,
659            f: glib::ffi::gpointer,
660        ) {
661            let f: &F = &*(f as *const F);
662            f(Display::from_glib_borrow(this).unsafe_cast_ref())
663        }
664        unsafe {
665            let f: Box_<F> = Box_::new(f);
666            connect_raw(
667                self.as_ptr() as *mut _,
668                c"opened".as_ptr() as *const _,
669                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
670                    opened_trampoline::<Self, F> as *const (),
671                )),
672                Box_::into_raw(f),
673            )
674        }
675    }
676
677    /// Emitted whenever a new seat is made known to the windowing system.
678    /// ## `seat`
679    /// the seat that was just added
680    #[doc(alias = "seat-added")]
681    fn connect_seat_added<F: Fn(&Self, &Seat) + 'static>(&self, f: F) -> SignalHandlerId {
682        unsafe extern "C" fn seat_added_trampoline<P: IsA<Display>, F: Fn(&P, &Seat) + 'static>(
683            this: *mut ffi::GdkDisplay,
684            seat: *mut ffi::GdkSeat,
685            f: glib::ffi::gpointer,
686        ) {
687            let f: &F = &*(f as *const F);
688            f(
689                Display::from_glib_borrow(this).unsafe_cast_ref(),
690                &from_glib_borrow(seat),
691            )
692        }
693        unsafe {
694            let f: Box_<F> = Box_::new(f);
695            connect_raw(
696                self.as_ptr() as *mut _,
697                c"seat-added".as_ptr() as *const _,
698                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
699                    seat_added_trampoline::<Self, F> as *const (),
700                )),
701                Box_::into_raw(f),
702            )
703        }
704    }
705
706    /// Emitted whenever a seat is removed by the windowing system.
707    /// ## `seat`
708    /// the seat that was just removed
709    #[doc(alias = "seat-removed")]
710    fn connect_seat_removed<F: Fn(&Self, &Seat) + 'static>(&self, f: F) -> SignalHandlerId {
711        unsafe extern "C" fn seat_removed_trampoline<
712            P: IsA<Display>,
713            F: Fn(&P, &Seat) + 'static,
714        >(
715            this: *mut ffi::GdkDisplay,
716            seat: *mut ffi::GdkSeat,
717            f: glib::ffi::gpointer,
718        ) {
719            let f: &F = &*(f as *const F);
720            f(
721                Display::from_glib_borrow(this).unsafe_cast_ref(),
722                &from_glib_borrow(seat),
723            )
724        }
725        unsafe {
726            let f: Box_<F> = Box_::new(f);
727            connect_raw(
728                self.as_ptr() as *mut _,
729                c"seat-removed".as_ptr() as *const _,
730                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
731                    seat_removed_trampoline::<Self, F> as *const (),
732                )),
733                Box_::into_raw(f),
734            )
735        }
736    }
737
738    /// Emitted whenever a setting changes its value.
739    /// ## `setting`
740    /// the name of the setting that changed
741    #[doc(alias = "setting-changed")]
742    fn connect_setting_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
743        unsafe extern "C" fn setting_changed_trampoline<
744            P: IsA<Display>,
745            F: Fn(&P, &str) + 'static,
746        >(
747            this: *mut ffi::GdkDisplay,
748            setting: *mut std::ffi::c_char,
749            f: glib::ffi::gpointer,
750        ) {
751            let f: &F = &*(f as *const F);
752            f(
753                Display::from_glib_borrow(this).unsafe_cast_ref(),
754                &glib::GString::from_glib_borrow(setting),
755            )
756        }
757        unsafe {
758            let f: Box_<F> = Box_::new(f);
759            connect_raw(
760                self.as_ptr() as *mut _,
761                c"setting-changed".as_ptr() as *const _,
762                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
763                    setting_changed_trampoline::<Self, F> as *const (),
764                )),
765                Box_::into_raw(f),
766            )
767        }
768    }
769
770    #[doc(alias = "composited")]
771    fn connect_composited_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
772        unsafe extern "C" fn notify_composited_trampoline<P: IsA<Display>, F: Fn(&P) + 'static>(
773            this: *mut ffi::GdkDisplay,
774            _param_spec: glib::ffi::gpointer,
775            f: glib::ffi::gpointer,
776        ) {
777            let f: &F = &*(f as *const F);
778            f(Display::from_glib_borrow(this).unsafe_cast_ref())
779        }
780        unsafe {
781            let f: Box_<F> = Box_::new(f);
782            connect_raw(
783                self.as_ptr() as *mut _,
784                c"notify::composited".as_ptr() as *const _,
785                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
786                    notify_composited_trampoline::<Self, F> as *const (),
787                )),
788                Box_::into_raw(f),
789            )
790        }
791    }
792
793    #[cfg(feature = "v4_14")]
794    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
795    #[doc(alias = "dmabuf-formats")]
796    fn connect_dmabuf_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
797        unsafe extern "C" fn notify_dmabuf_formats_trampoline<
798            P: IsA<Display>,
799            F: Fn(&P) + 'static,
800        >(
801            this: *mut ffi::GdkDisplay,
802            _param_spec: glib::ffi::gpointer,
803            f: glib::ffi::gpointer,
804        ) {
805            let f: &F = &*(f as *const F);
806            f(Display::from_glib_borrow(this).unsafe_cast_ref())
807        }
808        unsafe {
809            let f: Box_<F> = Box_::new(f);
810            connect_raw(
811                self.as_ptr() as *mut _,
812                c"notify::dmabuf-formats".as_ptr() as *const _,
813                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
814                    notify_dmabuf_formats_trampoline::<Self, F> as *const (),
815                )),
816                Box_::into_raw(f),
817            )
818        }
819    }
820
821    #[doc(alias = "input-shapes")]
822    fn connect_input_shapes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
823        unsafe extern "C" fn notify_input_shapes_trampoline<
824            P: IsA<Display>,
825            F: Fn(&P) + 'static,
826        >(
827            this: *mut ffi::GdkDisplay,
828            _param_spec: glib::ffi::gpointer,
829            f: glib::ffi::gpointer,
830        ) {
831            let f: &F = &*(f as *const F);
832            f(Display::from_glib_borrow(this).unsafe_cast_ref())
833        }
834        unsafe {
835            let f: Box_<F> = Box_::new(f);
836            connect_raw(
837                self.as_ptr() as *mut _,
838                c"notify::input-shapes".as_ptr() as *const _,
839                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
840                    notify_input_shapes_trampoline::<Self, F> as *const (),
841                )),
842                Box_::into_raw(f),
843            )
844        }
845    }
846
847    #[doc(alias = "rgba")]
848    fn connect_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
849        unsafe extern "C" fn notify_rgba_trampoline<P: IsA<Display>, F: Fn(&P) + 'static>(
850            this: *mut ffi::GdkDisplay,
851            _param_spec: glib::ffi::gpointer,
852            f: glib::ffi::gpointer,
853        ) {
854            let f: &F = &*(f as *const F);
855            f(Display::from_glib_borrow(this).unsafe_cast_ref())
856        }
857        unsafe {
858            let f: Box_<F> = Box_::new(f);
859            connect_raw(
860                self.as_ptr() as *mut _,
861                c"notify::rgba".as_ptr() as *const _,
862                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
863                    notify_rgba_trampoline::<Self, F> as *const (),
864                )),
865                Box_::into_raw(f),
866            )
867        }
868    }
869
870    #[cfg(feature = "v4_14")]
871    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
872    #[doc(alias = "shadow-width")]
873    fn connect_shadow_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
874        unsafe extern "C" fn notify_shadow_width_trampoline<
875            P: IsA<Display>,
876            F: Fn(&P) + 'static,
877        >(
878            this: *mut ffi::GdkDisplay,
879            _param_spec: glib::ffi::gpointer,
880            f: glib::ffi::gpointer,
881        ) {
882            let f: &F = &*(f as *const F);
883            f(Display::from_glib_borrow(this).unsafe_cast_ref())
884        }
885        unsafe {
886            let f: Box_<F> = Box_::new(f);
887            connect_raw(
888                self.as_ptr() as *mut _,
889                c"notify::shadow-width".as_ptr() as *const _,
890                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
891                    notify_shadow_width_trampoline::<Self, F> as *const (),
892                )),
893                Box_::into_raw(f),
894            )
895        }
896    }
897}
898
899impl<O: IsA<Display>> DisplayExt for O {}