Skip to main content

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::{AppLaunchContext, Clipboard, Device, Event, Monitor, Seat, Surface, ffi};
15use glib::{
16    object::ObjectType as _,
17    prelude::*,
18    signal::{SignalHandlerId, connect_raw},
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    /// This function is threadsafe. It can be called from any thread.
305    ///
306    /// # Returns
307    ///
308    /// a [`DmabufFormats`][crate::DmabufFormats] object
309    #[cfg(target_os = "linux")]
310    #[cfg_attr(docsrs, doc(cfg(target_os = "linux")))]
311    #[cfg(feature = "v4_14")]
312    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
313    #[doc(alias = "gdk_display_get_dmabuf_formats")]
314    #[doc(alias = "get_dmabuf_formats")]
315    #[doc(alias = "dmabuf-formats")]
316    fn dmabuf_formats(&self) -> DmabufFormats {
317        unsafe {
318            from_glib_none(ffi::gdk_display_get_dmabuf_formats(
319                self.as_ref().to_glib_none().0,
320            ))
321        }
322    }
323
324    /// Gets the monitor in which the largest area of @surface
325    /// resides.
326    /// ## `surface`
327    /// a [`Surface`][crate::Surface]
328    ///
329    /// # Returns
330    ///
331    /// the monitor with the largest
332    ///   overlap with @surface
333    #[doc(alias = "gdk_display_get_monitor_at_surface")]
334    #[doc(alias = "get_monitor_at_surface")]
335    fn monitor_at_surface(&self, surface: &impl IsA<Surface>) -> Option<Monitor> {
336        unsafe {
337            from_glib_none(ffi::gdk_display_get_monitor_at_surface(
338                self.as_ref().to_glib_none().0,
339                surface.as_ref().to_glib_none().0,
340            ))
341        }
342    }
343
344    /// Gets the list of monitors associated with this display.
345    ///
346    /// Subsequent calls to this function will always return the
347    /// same list for the same display.
348    ///
349    /// You can listen to the GListModel::items-changed signal on
350    /// this list to monitor changes to the monitor of this display.
351    ///
352    /// # Returns
353    ///
354    /// a `GListModel` of [`Monitor`][crate::Monitor]
355    #[doc(alias = "gdk_display_get_monitors")]
356    #[doc(alias = "get_monitors")]
357    fn monitors(&self) -> gio::ListModel {
358        unsafe {
359            from_glib_none(ffi::gdk_display_get_monitors(
360                self.as_ref().to_glib_none().0,
361            ))
362        }
363    }
364
365    /// Gets the name of the display.
366    ///
367    /// # Returns
368    ///
369    /// a string representing the display name. This string is owned
370    ///   by GDK and should not be modified or freed.
371    #[doc(alias = "gdk_display_get_name")]
372    #[doc(alias = "get_name")]
373    fn name(&self) -> glib::GString {
374        unsafe { from_glib_none(ffi::gdk_display_get_name(self.as_ref().to_glib_none().0)) }
375    }
376
377    /// Gets the clipboard used for the primary selection.
378    ///
379    /// On backends where the primary clipboard is not supported natively,
380    /// GDK emulates this clipboard locally.
381    ///
382    /// # Returns
383    ///
384    /// the primary clipboard
385    #[doc(alias = "gdk_display_get_primary_clipboard")]
386    #[doc(alias = "get_primary_clipboard")]
387    fn primary_clipboard(&self) -> Clipboard {
388        unsafe {
389            from_glib_none(ffi::gdk_display_get_primary_clipboard(
390                self.as_ref().to_glib_none().0,
391            ))
392        }
393    }
394
395    /// Gets the startup notification ID for a Wayland display, or [`None`]
396    /// if no ID has been defined.
397    ///
398    /// # Deprecated since 4.10
399    ///
400    ///
401    /// # Returns
402    ///
403    /// the startup notification ID for @self
404    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
405    #[allow(deprecated)]
406    #[doc(alias = "gdk_display_get_startup_notification_id")]
407    #[doc(alias = "get_startup_notification_id")]
408    fn startup_notification_id(&self) -> Option<glib::GString> {
409        unsafe {
410            from_glib_none(ffi::gdk_display_get_startup_notification_id(
411                self.as_ref().to_glib_none().0,
412            ))
413        }
414    }
415
416    /// Finds out if the display has been closed.
417    ///
418    /// # Returns
419    ///
420    /// [`true`] if the display is closed.
421    #[doc(alias = "gdk_display_is_closed")]
422    fn is_closed(&self) -> bool {
423        unsafe { from_glib(ffi::gdk_display_is_closed(self.as_ref().to_glib_none().0)) }
424    }
425
426    /// Returns whether surfaces can reasonably be expected to have
427    /// their alpha channel drawn correctly on the screen.
428    ///
429    /// Check [`is_rgba()`][Self::is_rgba()] for whether the display
430    /// supports an alpha channel.
431    ///
432    /// On X11 this function returns whether a compositing manager is
433    /// compositing on @self.
434    ///
435    /// On modern displays, this value is always [`true`].
436    ///
437    /// # Returns
438    ///
439    /// Whether surfaces with RGBA visuals can reasonably
440    ///   be expected to have their alpha channels drawn correctly
441    ///   on the screen.
442    #[doc(alias = "gdk_display_is_composited")]
443    #[doc(alias = "composited")]
444    fn is_composited(&self) -> bool {
445        unsafe {
446            from_glib(ffi::gdk_display_is_composited(
447                self.as_ref().to_glib_none().0,
448            ))
449        }
450    }
451
452    /// t be honored when displaying the
453    /// surface on the screen: in particular, for X an appropriate
454    /// windowing manager and compositing manager must be running to
455    /// provide appropriate display. Use [`is_composited()`][Self::is_composited()]
456    /// to check if that is the case.
457    ///
458    /// On modern displays, this value is always [`true`].
459    ///
460    /// # Returns
461    ///
462    /// [`true`] if surfaces are created with an alpha channel or
463    ///   [`false`] if the display does not support this functionality.
464    #[doc(alias = "gdk_display_is_rgba")]
465    #[doc(alias = "rgba")]
466    fn is_rgba(&self) -> bool {
467        unsafe { from_glib(ffi::gdk_display_is_rgba(self.as_ref().to_glib_none().0)) }
468    }
469
470    /// Returns the list of seats known to @self.
471    ///
472    /// # Returns
473    ///
474    /// the
475    ///   list of seats known to the [`Display`][crate::Display]
476    #[doc(alias = "gdk_display_list_seats")]
477    fn list_seats(&self) -> Vec<Seat> {
478        unsafe {
479            FromGlibPtrContainer::from_glib_container(ffi::gdk_display_list_seats(
480                self.as_ref().to_glib_none().0,
481            ))
482        }
483    }
484
485    /// Indicates to the GUI environment that the application has
486    /// finished loading, using a given identifier.
487    ///
488    /// GTK will call this function automatically for [GtkWindow](../gtk4/class.Window.html)
489    /// with custom startup-notification identifier unless
490    /// [gtk_window_set_auto_startup_notification()](../gtk4/method.Window.set_auto_startup_notification.html)
491    /// is called to disable that feature.
492    ///
493    /// # Deprecated since 4.10
494    ///
495    /// Using [`ToplevelExt::set_startup_id()`][crate::prelude::ToplevelExt::set_startup_id()] is sufficient
496    /// ## `startup_id`
497    /// a startup-notification identifier, for which
498    ///   notification process should be completed
499    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
500    #[allow(deprecated)]
501    #[doc(alias = "gdk_display_notify_startup_complete")]
502    fn notify_startup_complete(&self, startup_id: &str) {
503        unsafe {
504            ffi::gdk_display_notify_startup_complete(
505                self.as_ref().to_glib_none().0,
506                startup_id.to_glib_none().0,
507            );
508        }
509    }
510
511    /// Checks that OpenGL is available for @self and ensures that it is
512    /// properly initialized.
513    /// When this fails, an @error will be set describing the error and this
514    /// function returns [`false`].
515    ///
516    /// Note that even if this function succeeds, creating a [`GLContext`][crate::GLContext]
517    /// may still fail.
518    ///
519    /// This function is idempotent. Calling it multiple times will just
520    /// return the same value or error.
521    ///
522    /// You never need to call this function, GDK will call it automatically
523    /// as needed. But you can use it as a check when setting up code that
524    /// might make use of OpenGL.
525    ///
526    /// # Returns
527    ///
528    /// [`true`] if the display supports OpenGL
529    #[cfg(feature = "v4_4")]
530    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
531    #[doc(alias = "gdk_display_prepare_gl")]
532    fn prepare_gl(&self) -> Result<(), glib::Error> {
533        unsafe {
534            let mut error = std::ptr::null_mut();
535            let is_ok = ffi::gdk_display_prepare_gl(self.as_ref().to_glib_none().0, &mut error);
536            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
537            if error.is_null() {
538                Ok(())
539            } else {
540                Err(from_glib_full(error))
541            }
542        }
543    }
544
545    /// Adds the given event to the event queue for @self.
546    ///
547    /// # Deprecated since 4.10
548    ///
549    /// This function is only useful in very
550    /// special situations and should not be used by applications.
551    /// ## `event`
552    /// a [`Event`][crate::Event]
553    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
554    #[allow(deprecated)]
555    #[doc(alias = "gdk_display_put_event")]
556    fn put_event(&self, event: impl AsRef<Event>) {
557        unsafe {
558            ffi::gdk_display_put_event(
559                self.as_ref().to_glib_none().0,
560                event.as_ref().to_glib_none().0,
561            );
562        }
563    }
564
565    /// Returns [`true`] if the display supports input shapes.
566    ///
567    /// This means that [`SurfaceExt::set_input_region()`][crate::prelude::SurfaceExt::set_input_region()] can
568    /// be used to modify the input shape of surfaces on @self.
569    ///
570    /// On modern displays, this value is always [`true`].
571    ///
572    /// # Returns
573    ///
574    /// [`true`] if surfaces with modified input shape are supported
575    #[doc(alias = "gdk_display_supports_input_shapes")]
576    #[doc(alias = "input-shapes")]
577    fn supports_input_shapes(&self) -> bool {
578        unsafe {
579            from_glib(ffi::gdk_display_supports_input_shapes(
580                self.as_ref().to_glib_none().0,
581            ))
582        }
583    }
584
585    /// Returns whether it's possible for a surface to draw outside of the window area.
586    ///
587    /// If [`true`] is returned the application decides if it wants to draw shadows.
588    /// If [`false`] is returned, the compositor decides if it wants to draw shadows.
589    ///
590    /// # Returns
591    ///
592    /// [`true`] if surfaces can draw shadows or
593    ///   [`false`] if the display does not support this functionality.
594    #[cfg(feature = "v4_14")]
595    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
596    #[doc(alias = "gdk_display_supports_shadow_width")]
597    #[doc(alias = "shadow-width")]
598    fn supports_shadow_width(&self) -> bool {
599        unsafe {
600            from_glib(ffi::gdk_display_supports_shadow_width(
601                self.as_ref().to_glib_none().0,
602            ))
603        }
604    }
605
606    /// Flushes any requests queued for the windowing system and waits until all
607    /// requests have been handled.
608    ///
609    /// This is often used for making sure that the display is synchronized
610    /// with the current state of the program. Calling [`sync()`][Self::sync()]
611    /// before `GdkX11::Display::error_trap_pop()` makes sure that any errors
612    /// generated from earlier requests are handled before the error trap is removed.
613    ///
614    /// This is most useful for X11. On windowing systems where requests are
615    /// handled synchronously, this function will do nothing.
616    #[doc(alias = "gdk_display_sync")]
617    fn sync(&self) {
618        unsafe {
619            ffi::gdk_display_sync(self.as_ref().to_glib_none().0);
620        }
621    }
622
623    /// Emitted when the connection to the windowing system for @display is closed.
624    /// ## `is_error`
625    /// [`true`] if the display was closed due to an error
626    #[doc(alias = "closed")]
627    fn connect_closed<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId {
628        unsafe extern "C" fn closed_trampoline<P: IsA<Display>, F: Fn(&P, bool) + 'static>(
629            this: *mut ffi::GdkDisplay,
630            is_error: glib::ffi::gboolean,
631            f: glib::ffi::gpointer,
632        ) {
633            unsafe {
634                let f: &F = &*(f as *const F);
635                f(
636                    Display::from_glib_borrow(this).unsafe_cast_ref(),
637                    from_glib(is_error),
638                )
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(),
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            unsafe {
662                let f: &F = &*(f as *const F);
663                f(Display::from_glib_borrow(this).unsafe_cast_ref())
664            }
665        }
666        unsafe {
667            let f: Box_<F> = Box_::new(f);
668            connect_raw(
669                self.as_ptr() as *mut _,
670                c"opened".as_ptr(),
671                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
672                    opened_trampoline::<Self, F> as *const (),
673                )),
674                Box_::into_raw(f),
675            )
676        }
677    }
678
679    /// Emitted whenever a new seat is made known to the windowing system.
680    /// ## `seat`
681    /// the seat that was just added
682    #[doc(alias = "seat-added")]
683    fn connect_seat_added<F: Fn(&Self, &Seat) + 'static>(&self, f: F) -> SignalHandlerId {
684        unsafe extern "C" fn seat_added_trampoline<P: IsA<Display>, F: Fn(&P, &Seat) + 'static>(
685            this: *mut ffi::GdkDisplay,
686            seat: *mut ffi::GdkSeat,
687            f: glib::ffi::gpointer,
688        ) {
689            unsafe {
690                let f: &F = &*(f as *const F);
691                f(
692                    Display::from_glib_borrow(this).unsafe_cast_ref(),
693                    &from_glib_borrow(seat),
694                )
695            }
696        }
697        unsafe {
698            let f: Box_<F> = Box_::new(f);
699            connect_raw(
700                self.as_ptr() as *mut _,
701                c"seat-added".as_ptr(),
702                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
703                    seat_added_trampoline::<Self, F> as *const (),
704                )),
705                Box_::into_raw(f),
706            )
707        }
708    }
709
710    /// Emitted whenever a seat is removed by the windowing system.
711    /// ## `seat`
712    /// the seat that was just removed
713    #[doc(alias = "seat-removed")]
714    fn connect_seat_removed<F: Fn(&Self, &Seat) + 'static>(&self, f: F) -> SignalHandlerId {
715        unsafe extern "C" fn seat_removed_trampoline<
716            P: IsA<Display>,
717            F: Fn(&P, &Seat) + 'static,
718        >(
719            this: *mut ffi::GdkDisplay,
720            seat: *mut ffi::GdkSeat,
721            f: glib::ffi::gpointer,
722        ) {
723            unsafe {
724                let f: &F = &*(f as *const F);
725                f(
726                    Display::from_glib_borrow(this).unsafe_cast_ref(),
727                    &from_glib_borrow(seat),
728                )
729            }
730        }
731        unsafe {
732            let f: Box_<F> = Box_::new(f);
733            connect_raw(
734                self.as_ptr() as *mut _,
735                c"seat-removed".as_ptr(),
736                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
737                    seat_removed_trampoline::<Self, F> as *const (),
738                )),
739                Box_::into_raw(f),
740            )
741        }
742    }
743
744    /// Emitted whenever a setting changes its value.
745    /// ## `setting`
746    /// the name of the setting that changed
747    #[doc(alias = "setting-changed")]
748    fn connect_setting_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
749        unsafe extern "C" fn setting_changed_trampoline<
750            P: IsA<Display>,
751            F: Fn(&P, &str) + 'static,
752        >(
753            this: *mut ffi::GdkDisplay,
754            setting: *mut std::ffi::c_char,
755            f: glib::ffi::gpointer,
756        ) {
757            unsafe {
758                let f: &F = &*(f as *const F);
759                f(
760                    Display::from_glib_borrow(this).unsafe_cast_ref(),
761                    &glib::GString::from_glib_borrow(setting),
762                )
763            }
764        }
765        unsafe {
766            let f: Box_<F> = Box_::new(f);
767            connect_raw(
768                self.as_ptr() as *mut _,
769                c"setting-changed".as_ptr(),
770                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
771                    setting_changed_trampoline::<Self, F> as *const (),
772                )),
773                Box_::into_raw(f),
774            )
775        }
776    }
777
778    #[doc(alias = "composited")]
779    fn connect_composited_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
780        unsafe extern "C" fn notify_composited_trampoline<P: IsA<Display>, F: Fn(&P) + 'static>(
781            this: *mut ffi::GdkDisplay,
782            _param_spec: glib::ffi::gpointer,
783            f: glib::ffi::gpointer,
784        ) {
785            unsafe {
786                let f: &F = &*(f as *const F);
787                f(Display::from_glib_borrow(this).unsafe_cast_ref())
788            }
789        }
790        unsafe {
791            let f: Box_<F> = Box_::new(f);
792            connect_raw(
793                self.as_ptr() as *mut _,
794                c"notify::composited".as_ptr(),
795                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
796                    notify_composited_trampoline::<Self, F> as *const (),
797                )),
798                Box_::into_raw(f),
799            )
800        }
801    }
802
803    #[cfg(feature = "v4_14")]
804    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
805    #[doc(alias = "dmabuf-formats")]
806    fn connect_dmabuf_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
807        unsafe extern "C" fn notify_dmabuf_formats_trampoline<
808            P: IsA<Display>,
809            F: Fn(&P) + 'static,
810        >(
811            this: *mut ffi::GdkDisplay,
812            _param_spec: glib::ffi::gpointer,
813            f: glib::ffi::gpointer,
814        ) {
815            unsafe {
816                let f: &F = &*(f as *const F);
817                f(Display::from_glib_borrow(this).unsafe_cast_ref())
818            }
819        }
820        unsafe {
821            let f: Box_<F> = Box_::new(f);
822            connect_raw(
823                self.as_ptr() as *mut _,
824                c"notify::dmabuf-formats".as_ptr(),
825                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
826                    notify_dmabuf_formats_trampoline::<Self, F> as *const (),
827                )),
828                Box_::into_raw(f),
829            )
830        }
831    }
832
833    #[doc(alias = "input-shapes")]
834    fn connect_input_shapes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
835        unsafe extern "C" fn notify_input_shapes_trampoline<
836            P: IsA<Display>,
837            F: Fn(&P) + 'static,
838        >(
839            this: *mut ffi::GdkDisplay,
840            _param_spec: glib::ffi::gpointer,
841            f: glib::ffi::gpointer,
842        ) {
843            unsafe {
844                let f: &F = &*(f as *const F);
845                f(Display::from_glib_borrow(this).unsafe_cast_ref())
846            }
847        }
848        unsafe {
849            let f: Box_<F> = Box_::new(f);
850            connect_raw(
851                self.as_ptr() as *mut _,
852                c"notify::input-shapes".as_ptr(),
853                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
854                    notify_input_shapes_trampoline::<Self, F> as *const (),
855                )),
856                Box_::into_raw(f),
857            )
858        }
859    }
860
861    #[doc(alias = "rgba")]
862    fn connect_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
863        unsafe extern "C" fn notify_rgba_trampoline<P: IsA<Display>, F: Fn(&P) + 'static>(
864            this: *mut ffi::GdkDisplay,
865            _param_spec: glib::ffi::gpointer,
866            f: glib::ffi::gpointer,
867        ) {
868            unsafe {
869                let f: &F = &*(f as *const F);
870                f(Display::from_glib_borrow(this).unsafe_cast_ref())
871            }
872        }
873        unsafe {
874            let f: Box_<F> = Box_::new(f);
875            connect_raw(
876                self.as_ptr() as *mut _,
877                c"notify::rgba".as_ptr(),
878                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
879                    notify_rgba_trampoline::<Self, F> as *const (),
880                )),
881                Box_::into_raw(f),
882            )
883        }
884    }
885
886    #[cfg(feature = "v4_14")]
887    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
888    #[doc(alias = "shadow-width")]
889    fn connect_shadow_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
890        unsafe extern "C" fn notify_shadow_width_trampoline<
891            P: IsA<Display>,
892            F: Fn(&P) + 'static,
893        >(
894            this: *mut ffi::GdkDisplay,
895            _param_spec: glib::ffi::gpointer,
896            f: glib::ffi::gpointer,
897        ) {
898            unsafe {
899                let f: &F = &*(f as *const F);
900                f(Display::from_glib_borrow(this).unsafe_cast_ref())
901            }
902        }
903        unsafe {
904            let f: Box_<F> = Box_::new(f);
905            connect_raw(
906                self.as_ptr() as *mut _,
907                c"notify::shadow-width".as_ptr(),
908                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
909                    notify_shadow_width_trampoline::<Self, F> as *const (),
910                )),
911                Box_::into_raw(f),
912            )
913        }
914    }
915}
916
917impl<O: IsA<Display>> DisplayExt for O {}