Skip to main content

gdk4/auto/
toplevel.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
5#[cfg(feature = "v4_4")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
7use crate::TitlebarGesture;
8use crate::{
9    Device, Event, FullscreenMode, Surface, SurfaceEdge, Texture, ToplevelLayout, ToplevelState,
10    ffi,
11};
12#[cfg(feature = "v4_20")]
13#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
14use crate::{Gravity, ToplevelCapabilities};
15use glib::{
16    prelude::*,
17    signal::{SignalHandlerId, connect_raw},
18    translate::*,
19};
20use std::boxed::Box as Box_;
21
22glib::wrapper! {
23    /// A freestanding toplevel surface.
24    ///
25    /// The [`Toplevel`][crate::Toplevel] interface provides useful APIs for interacting with
26    /// the windowing system, such as controlling maximization and size of the
27    /// surface, setting icons and transient parents for dialogs.
28    ///
29    /// ## Properties
30    ///
31    ///
32    /// #### `capabilities`
33    ///  The capabilities that are available for this toplevel.
34    ///
35    /// Readable
36    ///
37    ///
38    /// #### `decorated`
39    ///  Whether the window manager should add decorations.
40    ///
41    /// Readable | Writable
42    ///
43    ///
44    /// #### `deletable`
45    ///  Whether the window manager should allow to close the surface.
46    ///
47    /// Readable | Writable
48    ///
49    ///
50    /// #### `fullscreen-mode`
51    ///  The fullscreen mode of the surface.
52    ///
53    /// Readable | Writable
54    ///
55    ///
56    /// #### `gravity`
57    ///  The gravity to use when resizing a surface programmatically.
58    ///
59    /// Gravity describes which point of the surface we want to keep
60    /// fixed (meaning that the surface will grow in the opposite direction).
61    /// For example, a gravity of `GDK_GRAVITY_NORTH_EAST` means that we
62    /// want to fix top right corner of the surface.
63    ///
64    /// This property is just a hint that may affect the result when negotiating
65    /// toplevel sizes with the windowing system. It does not affect interactive
66    /// resizes started with [`ToplevelExt::begin_resize()`][crate::prelude::ToplevelExt::begin_resize()].
67    ///
68    /// Readable | Writable
69    ///
70    ///
71    /// #### `icon-list`
72    ///  A list of textures to use as icon.
73    ///
74    /// Readable | Writable
75    ///
76    ///
77    /// #### `modal`
78    ///  Whether the surface is modal.
79    ///
80    /// Readable | Writable
81    ///
82    ///
83    /// #### `shortcuts-inhibited`
84    ///  Whether the surface should inhibit keyboard shortcuts.
85    ///
86    /// Readable
87    ///
88    ///
89    /// #### `startup-id`
90    ///  The startup ID of the surface.
91    ///
92    /// See [`AppLaunchContext`][crate::AppLaunchContext] for more information about
93    /// startup feedback.
94    ///
95    /// Readable | Writable
96    ///
97    ///
98    /// #### `state`
99    ///  The state of the toplevel.
100    ///
101    /// Readable
102    ///
103    ///
104    /// #### `title`
105    ///  The title of the surface.
106    ///
107    /// Readable | Writable
108    ///
109    ///
110    /// #### `transient-for`
111    ///  The transient parent of the surface.
112    ///
113    /// Readable | Writable
114    /// <details><summary><h4>Surface</h4></summary>
115    ///
116    ///
117    /// #### `cursor`
118    ///  The mouse pointer for the [`Surface`][crate::Surface].
119    ///
120    /// Readable | Writable
121    ///
122    ///
123    /// #### `display`
124    ///  The [`Display`][crate::Display] connection of the surface.
125    ///
126    /// Readable | Writable | Construct Only
127    ///
128    ///
129    /// #### `frame-clock`
130    ///  The [`FrameClock`][crate::FrameClock] of the surface.
131    ///
132    /// Readable | Writable | Construct Only
133    ///
134    ///
135    /// #### `height`
136    ///  The height of the surface, in pixels.
137    ///
138    /// Readable
139    ///
140    ///
141    /// #### `mapped`
142    ///  Whether the surface is mapped.
143    ///
144    /// Readable
145    ///
146    ///
147    /// #### `scale`
148    ///  The scale of the surface.
149    ///
150    /// Readable
151    ///
152    ///
153    /// #### `scale-factor`
154    ///  The scale factor of the surface.
155    ///
156    /// The scale factor is the next larger integer,
157    /// compared to [`scale`][struct@crate::Surface#scale].
158    ///
159    /// Readable
160    ///
161    ///
162    /// #### `width`
163    ///  The width of the surface in pixels.
164    ///
165    /// Readable
166    /// </details>
167    ///
168    /// ## Signals
169    ///
170    ///
171    /// #### `compute-size`
172    ///  Emitted when the size for the surface needs to be computed, when
173    /// it is present.
174    ///
175    /// This signal will normally be emitted during or after a call to
176    /// [`ToplevelExt::present()`][crate::prelude::ToplevelExt::present()], depending on the configuration
177    /// received by the windowing system. It may also be emitted at any
178    /// other point in time, in response to the windowing system
179    /// spontaneously changing the configuration of the toplevel surface.
180    ///
181    /// It is the responsibility of the toplevel user to handle this signal
182    /// and compute the desired size of the toplevel, given the information
183    /// passed via the [`ToplevelSize`][crate::ToplevelSize] object. Failing to do so
184    /// will result in an arbitrary size being used as a result.
185    ///
186    ///
187    /// <details><summary><h4>Surface</h4></summary>
188    ///
189    ///
190    /// #### `enter-monitor`
191    ///  Emitted when @surface starts being present on the monitor.
192    ///
193    ///
194    ///
195    ///
196    /// #### `event`
197    ///  Emitted when GDK receives an input event for @surface.
198    ///
199    ///
200    ///
201    ///
202    /// #### `layout`
203    ///   (see gdk_surface_get_scale_factor()).
204    ///
205    ///
206    ///
207    ///
208    /// #### `leave-monitor`
209    ///  Emitted when @surface stops being present on the monitor.
210    ///
211    ///
212    ///
213    ///
214    /// #### `render`
215    ///  Emitted when part of the surface needs to be redrawn.
216    ///
217    ///
218    /// </details>
219    ///
220    /// # Implements
221    ///
222    /// [`ToplevelExt`][trait@crate::prelude::ToplevelExt], [`SurfaceExt`][trait@crate::prelude::SurfaceExt], [`ToplevelExtManual`][trait@crate::prelude::ToplevelExtManual], [`SurfaceExtManual`][trait@crate::prelude::SurfaceExtManual]
223    #[doc(alias = "GdkToplevel")]
224    pub struct Toplevel(Interface<ffi::GdkToplevel, ffi::GdkToplevelInterface>) @requires Surface;
225
226    match fn {
227        type_ => || ffi::gdk_toplevel_get_type(),
228    }
229}
230
231impl Toplevel {
232    pub const NONE: Option<&'static Toplevel> = None;
233}
234
235/// Trait containing all [`struct@Toplevel`] methods.
236///
237/// # Implementors
238///
239/// [`Toplevel`][struct@crate::Toplevel]
240pub trait ToplevelExt: IsA<Toplevel> + 'static {
241    /// Begins an interactive move operation.
242    ///
243    /// You might use this function to implement draggable titlebars.
244    /// ## `device`
245    /// the device used for the operation
246    /// ## `button`
247    /// the button being used to drag, or 0 for a keyboard-initiated drag
248    /// ## `x`
249    /// surface X coordinate of mouse click that began the drag
250    /// ## `y`
251    /// surface Y coordinate of mouse click that began the drag
252    /// ## `timestamp`
253    /// timestamp of mouse click that began the drag (use
254    ///   [`Event::time()`][crate::Event::time()])
255    #[doc(alias = "gdk_toplevel_begin_move")]
256    fn begin_move(&self, device: &impl IsA<Device>, button: i32, x: f64, y: f64, timestamp: u32) {
257        unsafe {
258            ffi::gdk_toplevel_begin_move(
259                self.as_ref().to_glib_none().0,
260                device.as_ref().to_glib_none().0,
261                button,
262                x,
263                y,
264                timestamp,
265            );
266        }
267    }
268
269    /// window resize grip.
270    /// ## `edge`
271    /// the edge or corner from which the drag is started
272    /// ## `device`
273    /// the device used for the operation
274    /// ## `button`
275    /// the button being used to drag, or 0 for a keyboard-initiated drag
276    /// ## `x`
277    /// surface X coordinate of mouse click that began the drag
278    /// ## `y`
279    /// surface Y coordinate of mouse click that began the drag
280    /// ## `timestamp`
281    /// timestamp of mouse click that began the drag (use
282    ///   [`Event::time()`][crate::Event::time()])
283    #[doc(alias = "gdk_toplevel_begin_resize")]
284    fn begin_resize(
285        &self,
286        edge: SurfaceEdge,
287        device: Option<&impl IsA<Device>>,
288        button: i32,
289        x: f64,
290        y: f64,
291        timestamp: u32,
292    ) {
293        unsafe {
294            ffi::gdk_toplevel_begin_resize(
295                self.as_ref().to_glib_none().0,
296                edge.into_glib(),
297                device.map(|p| p.as_ref()).to_glib_none().0,
298                button,
299                x,
300                y,
301                timestamp,
302            );
303        }
304    }
305
306    /// Sets keyboard focus to @surface.
307    ///
308    /// In most cases, [gtk_window_present_with_time()](../gtk4/method.Window.present_with_time.html)
309    /// should be used on a [GtkWindow](../gtk4/class.Window.html), rather than
310    /// calling this function.
311    /// ## `timestamp`
312    /// timestamp of the event triggering the surface focus
313    #[doc(alias = "gdk_toplevel_focus")]
314    fn focus(&self, timestamp: u32) {
315        unsafe {
316            ffi::gdk_toplevel_focus(self.as_ref().to_glib_none().0, timestamp);
317        }
318    }
319
320    /// The capabilities that are available for this toplevel.
321    ///
322    /// # Returns
323    ///
324    /// the capabilities of the [`Toplevel`][crate::Toplevel].
325    #[cfg(feature = "v4_20")]
326    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
327    #[doc(alias = "gdk_toplevel_get_capabilities")]
328    #[doc(alias = "get_capabilities")]
329    fn capabilities(&self) -> ToplevelCapabilities {
330        unsafe {
331            from_glib(ffi::gdk_toplevel_get_capabilities(
332                self.as_ref().to_glib_none().0,
333            ))
334        }
335    }
336
337    /// Returns the gravity that is used when changing the toplevel
338    /// size programmatically.
339    ///
340    /// # Returns
341    ///
342    /// the gravity
343    #[cfg(feature = "v4_20")]
344    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
345    #[doc(alias = "gdk_toplevel_get_gravity")]
346    #[doc(alias = "get_gravity")]
347    fn gravity(&self) -> Gravity {
348        unsafe {
349            from_glib(ffi::gdk_toplevel_get_gravity(
350                self.as_ref().to_glib_none().0,
351            ))
352        }
353    }
354
355    /// Gets the bitwise or of the currently active surface state flags,
356    /// from the [`ToplevelState`][crate::ToplevelState] enumeration.
357    ///
358    /// # Returns
359    ///
360    /// surface state bitfield
361    #[doc(alias = "gdk_toplevel_get_state")]
362    #[doc(alias = "get_state")]
363    fn state(&self) -> ToplevelState {
364        unsafe { from_glib(ffi::gdk_toplevel_get_state(self.as_ref().to_glib_none().0)) }
365    }
366
367    /// Requests that the @self inhibit the system shortcuts.
368    ///
369    /// This is asking the desktop environment/windowing system to let all
370    /// keyboard events reach the surface, as long as it is focused, instead
371    /// of triggering system actions.
372    ///
373    /// If granted, the rerouting remains active until the default shortcuts
374    /// processing is restored with [`restore_system_shortcuts()`][Self::restore_system_shortcuts()],
375    /// or the request is revoked by the desktop environment, windowing system
376    /// or the user.
377    ///
378    /// A typical use case for this API is remote desktop or virtual machine
379    /// viewers which need to inhibit the default system keyboard shortcuts
380    /// so that the remote session or virtual host gets those instead of the
381    /// local environment.
382    ///
383    /// The windowing system or desktop environment may ask the user to grant
384    /// or deny the request or even choose to ignore the request entirely.
385    ///
386    /// The caller can be notified whenever the request is granted or revoked
387    /// by listening to the [`shortcuts-inhibited`][struct@crate::Toplevel#shortcuts-inhibited] property.
388    /// ## `event`
389    /// the [`Event`][crate::Event] that is triggering the inhibit
390    ///   request, or [`None`] if none is available
391    #[doc(alias = "gdk_toplevel_inhibit_system_shortcuts")]
392    fn inhibit_system_shortcuts(&self, event: Option<impl AsRef<Event>>) {
393        unsafe {
394            ffi::gdk_toplevel_inhibit_system_shortcuts(
395                self.as_ref().to_glib_none().0,
396                event.as_ref().map(|p| p.as_ref()).to_glib_none().0,
397            );
398        }
399    }
400
401    /// Asks to lower the @self below other windows.
402    ///
403    /// The windowing system may choose to ignore the request.
404    ///
405    /// # Returns
406    ///
407    /// [`true`] if the surface was lowered
408    #[doc(alias = "gdk_toplevel_lower")]
409    fn lower(&self) -> bool {
410        unsafe { from_glib(ffi::gdk_toplevel_lower(self.as_ref().to_glib_none().0)) }
411    }
412
413    /// Asks to minimize the @self.
414    ///
415    /// The windowing system may choose to ignore the request.
416    ///
417    /// # Returns
418    ///
419    /// [`true`] if the surface was minimized
420    #[doc(alias = "gdk_toplevel_minimize")]
421    fn minimize(&self) -> bool {
422        unsafe { from_glib(ffi::gdk_toplevel_minimize(self.as_ref().to_glib_none().0)) }
423    }
424
425    /// Present @self after having processed the [`ToplevelLayout`][crate::ToplevelLayout] rules.
426    ///
427    /// If the toplevel was previously not showing, it will be showed,
428    /// otherwise it will change layout according to @layout.
429    ///
430    /// GDK may emit the [`compute-size`][struct@crate::Toplevel#compute-size] signal to let
431    /// the user of this toplevel compute the preferred size of the toplevel
432    /// surface.
433    ///
434    /// Presenting is asynchronous and the specified layout parameters are not
435    /// guaranteed to be respected.
436    /// ## `layout`
437    /// the [`ToplevelLayout`][crate::ToplevelLayout] object used to layout
438    #[doc(alias = "gdk_toplevel_present")]
439    fn present(&self, layout: &ToplevelLayout) {
440        unsafe {
441            ffi::gdk_toplevel_present(self.as_ref().to_glib_none().0, layout.to_glib_none().0);
442        }
443    }
444
445    /// Restore default system keyboard shortcuts which were previously
446    /// inhibited.
447    ///
448    /// This undoes the effect of [`inhibit_system_shortcuts()`][Self::inhibit_system_shortcuts()].
449    #[doc(alias = "gdk_toplevel_restore_system_shortcuts")]
450    fn restore_system_shortcuts(&self) {
451        unsafe {
452            ffi::gdk_toplevel_restore_system_shortcuts(self.as_ref().to_glib_none().0);
453        }
454    }
455
456    /// Sets the toplevel to be decorated.
457    ///
458    /// Setting @decorated to [`false`] hints the desktop environment
459    /// that the surface has its own, client-side decorations and
460    /// does not need to have window decorations added.
461    /// ## `decorated`
462    /// [`true`] to request decorations
463    #[doc(alias = "gdk_toplevel_set_decorated")]
464    #[doc(alias = "decorated")]
465    fn set_decorated(&self, decorated: bool) {
466        unsafe {
467            ffi::gdk_toplevel_set_decorated(self.as_ref().to_glib_none().0, decorated.into_glib());
468        }
469    }
470
471    /// Sets the toplevel to be deletable.
472    ///
473    /// Setting @deletable to [`true`] hints the desktop environment
474    /// that it should offer the user a way to close the surface.
475    /// ## `deletable`
476    /// [`true`] to request a delete button
477    #[doc(alias = "gdk_toplevel_set_deletable")]
478    #[doc(alias = "deletable")]
479    fn set_deletable(&self, deletable: bool) {
480        unsafe {
481            ffi::gdk_toplevel_set_deletable(self.as_ref().to_glib_none().0, deletable.into_glib());
482        }
483    }
484
485    /// Sets the gravity that is used when changing the toplevel
486    /// size programmatically.
487    /// ## `gravity`
488    /// the new gravity
489    #[cfg(feature = "v4_20")]
490    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
491    #[doc(alias = "gdk_toplevel_set_gravity")]
492    #[doc(alias = "gravity")]
493    fn set_gravity(&self, gravity: Gravity) {
494        unsafe {
495            ffi::gdk_toplevel_set_gravity(self.as_ref().to_glib_none().0, gravity.into_glib());
496        }
497    }
498
499    /// Sets a list of icons for the surface.
500    ///
501    /// One of these will be used to represent the surface in iconic form.
502    /// The icon may be shown in window lists or task bars. Which icon
503    /// size is shown depends on the window manager. The window manager
504    /// can scale the icon but setting several size icons can give better
505    /// image quality.
506    ///
507    /// Note that some platforms don't support surface icons.
508    /// ## `surfaces`
509    ///
510    ///   A list of textures to use as icon, of different sizes
511    #[doc(alias = "gdk_toplevel_set_icon_list")]
512    #[doc(alias = "icon-list")]
513    fn set_icon_list(&self, surfaces: &[Texture]) {
514        unsafe {
515            ffi::gdk_toplevel_set_icon_list(
516                self.as_ref().to_glib_none().0,
517                surfaces.to_glib_none().0,
518            );
519        }
520    }
521
522    /// Sets the toplevel to be modal.
523    ///
524    /// The application can use this hint to tell the
525    /// window manager that a certain surface has modal
526    /// behaviour. The window manager can use this information
527    /// to handle modal surfaces in a special way.
528    ///
529    /// You should only use this on surfaces for which you have
530    /// previously called [`set_transient_for()`][Self::set_transient_for()].
531    /// ## `modal`
532    /// [`true`] if the surface is modal, [`false`] otherwise.
533    #[doc(alias = "gdk_toplevel_set_modal")]
534    #[doc(alias = "modal")]
535    fn set_modal(&self, modal: bool) {
536        unsafe {
537            ffi::gdk_toplevel_set_modal(self.as_ref().to_glib_none().0, modal.into_glib());
538        }
539    }
540
541    /// Sets the startup notification ID.
542    ///
543    /// When using GTK, typically you should use
544    /// [gtk_window_set_startup_id()](../gtk4/method.Window.set_startup_id.html)
545    /// instead of this low-level function.
546    /// ## `startup_id`
547    /// a string with startup-notification identifier
548    #[doc(alias = "gdk_toplevel_set_startup_id")]
549    #[doc(alias = "startup-id")]
550    fn set_startup_id(&self, startup_id: &str) {
551        unsafe {
552            ffi::gdk_toplevel_set_startup_id(
553                self.as_ref().to_glib_none().0,
554                startup_id.to_glib_none().0,
555            );
556        }
557    }
558
559    /// Sets the title of a toplevel surface.
560    ///
561    /// The title maybe be displayed in the titlebar,
562    /// in lists of windows, etc.
563    /// ## `title`
564    /// title of @surface
565    #[doc(alias = "gdk_toplevel_set_title")]
566    #[doc(alias = "title")]
567    fn set_title(&self, title: &str) {
568        unsafe {
569            ffi::gdk_toplevel_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
570        }
571    }
572
573    /// re using [GtkWindow](../gtk4/class.Window.html).
574    /// ## `parent`
575    /// another toplevel [`Surface`][crate::Surface]
576    #[doc(alias = "gdk_toplevel_set_transient_for")]
577    #[doc(alias = "transient-for")]
578    fn set_transient_for(&self, parent: &impl IsA<Surface>) {
579        unsafe {
580            ffi::gdk_toplevel_set_transient_for(
581                self.as_ref().to_glib_none().0,
582                parent.as_ref().to_glib_none().0,
583            );
584        }
585    }
586
587    /// Asks the windowing system to show the window menu.
588    ///
589    /// The window menu is the menu shown when right-clicking the titlebar
590    /// on traditional windows managed by the window manager. This is useful
591    /// for windows using client-side decorations, activating it with a
592    /// right-click on the window decorations.
593    /// ## `event`
594    /// a [`Event`][crate::Event] to show the menu for
595    ///
596    /// # Returns
597    ///
598    /// [`true`] if the window menu was shown and [`false`] otherwise.
599    #[doc(alias = "gdk_toplevel_show_window_menu")]
600    fn show_window_menu(&self, event: impl AsRef<Event>) -> bool {
601        unsafe {
602            from_glib(ffi::gdk_toplevel_show_window_menu(
603                self.as_ref().to_glib_none().0,
604                event.as_ref().to_glib_none().0,
605            ))
606        }
607    }
608
609    /// Returns whether the desktop environment supports
610    /// tiled window states.
611    ///
612    /// # Returns
613    ///
614    /// [`true`] if the desktop environment supports tiled window states
615    #[doc(alias = "gdk_toplevel_supports_edge_constraints")]
616    fn supports_edge_constraints(&self) -> bool {
617        unsafe {
618            from_glib(ffi::gdk_toplevel_supports_edge_constraints(
619                self.as_ref().to_glib_none().0,
620            ))
621        }
622    }
623
624    /// Performs a title bar gesture.
625    /// ## `gesture`
626    /// a [`TitlebarGesture`][crate::TitlebarGesture]
627    ///
628    /// # Returns
629    ///
630    /// whether the gesture was performed
631    #[cfg(feature = "v4_4")]
632    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
633    #[doc(alias = "gdk_toplevel_titlebar_gesture")]
634    fn titlebar_gesture(&self, gesture: TitlebarGesture) -> bool {
635        unsafe {
636            from_glib(ffi::gdk_toplevel_titlebar_gesture(
637                self.as_ref().to_glib_none().0,
638                gesture.into_glib(),
639            ))
640        }
641    }
642
643    /// Whether the window manager should add decorations.
644    fn is_decorated(&self) -> bool {
645        ObjectExt::property(self.as_ref(), "decorated")
646    }
647
648    /// Whether the window manager should allow to close the surface.
649    fn is_deletable(&self) -> bool {
650        ObjectExt::property(self.as_ref(), "deletable")
651    }
652
653    /// The fullscreen mode of the surface.
654    #[doc(alias = "fullscreen-mode")]
655    fn fullscreen_mode(&self) -> FullscreenMode {
656        ObjectExt::property(self.as_ref(), "fullscreen-mode")
657    }
658
659    /// The fullscreen mode of the surface.
660    #[doc(alias = "fullscreen-mode")]
661    fn set_fullscreen_mode(&self, fullscreen_mode: FullscreenMode) {
662        ObjectExt::set_property(self.as_ref(), "fullscreen-mode", fullscreen_mode)
663    }
664
665    //#[doc(alias = "icon-list")]
666    //fn icon_list(&self) -> /*Unimplemented*/Basic: Pointer {
667    //    ObjectExt::property(self.as_ref(), "icon-list")
668    //}
669
670    /// Whether the surface is modal.
671    fn is_modal(&self) -> bool {
672        ObjectExt::property(self.as_ref(), "modal")
673    }
674
675    /// Whether the surface should inhibit keyboard shortcuts.
676    #[doc(alias = "shortcuts-inhibited")]
677    fn is_shortcuts_inhibited(&self) -> bool {
678        ObjectExt::property(self.as_ref(), "shortcuts-inhibited")
679    }
680
681    /// The startup ID of the surface.
682    ///
683    /// See [`AppLaunchContext`][crate::AppLaunchContext] for more information about
684    /// startup feedback.
685    #[doc(alias = "startup-id")]
686    fn startup_id(&self) -> Option<glib::GString> {
687        ObjectExt::property(self.as_ref(), "startup-id")
688    }
689
690    /// The title of the surface.
691    fn title(&self) -> Option<glib::GString> {
692        ObjectExt::property(self.as_ref(), "title")
693    }
694
695    /// The transient parent of the surface.
696    #[doc(alias = "transient-for")]
697    fn transient_for(&self) -> Option<Surface> {
698        ObjectExt::property(self.as_ref(), "transient-for")
699    }
700
701    #[cfg(feature = "v4_20")]
702    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
703    #[doc(alias = "capabilities")]
704    fn connect_capabilities_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
705        unsafe extern "C" fn notify_capabilities_trampoline<
706            P: IsA<Toplevel>,
707            F: Fn(&P) + 'static,
708        >(
709            this: *mut ffi::GdkToplevel,
710            _param_spec: glib::ffi::gpointer,
711            f: glib::ffi::gpointer,
712        ) {
713            unsafe {
714                let f: &F = &*(f as *const F);
715                f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
716            }
717        }
718        unsafe {
719            let f: Box_<F> = Box_::new(f);
720            connect_raw(
721                self.as_ptr() as *mut _,
722                c"notify::capabilities".as_ptr(),
723                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
724                    notify_capabilities_trampoline::<Self, F> as *const (),
725                )),
726                Box_::into_raw(f),
727            )
728        }
729    }
730
731    #[doc(alias = "decorated")]
732    fn connect_decorated_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
733        unsafe extern "C" fn notify_decorated_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
734            this: *mut ffi::GdkToplevel,
735            _param_spec: glib::ffi::gpointer,
736            f: glib::ffi::gpointer,
737        ) {
738            unsafe {
739                let f: &F = &*(f as *const F);
740                f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
741            }
742        }
743        unsafe {
744            let f: Box_<F> = Box_::new(f);
745            connect_raw(
746                self.as_ptr() as *mut _,
747                c"notify::decorated".as_ptr(),
748                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
749                    notify_decorated_trampoline::<Self, F> as *const (),
750                )),
751                Box_::into_raw(f),
752            )
753        }
754    }
755
756    #[doc(alias = "deletable")]
757    fn connect_deletable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
758        unsafe extern "C" fn notify_deletable_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
759            this: *mut ffi::GdkToplevel,
760            _param_spec: glib::ffi::gpointer,
761            f: glib::ffi::gpointer,
762        ) {
763            unsafe {
764                let f: &F = &*(f as *const F);
765                f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
766            }
767        }
768        unsafe {
769            let f: Box_<F> = Box_::new(f);
770            connect_raw(
771                self.as_ptr() as *mut _,
772                c"notify::deletable".as_ptr(),
773                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
774                    notify_deletable_trampoline::<Self, F> as *const (),
775                )),
776                Box_::into_raw(f),
777            )
778        }
779    }
780
781    #[doc(alias = "fullscreen-mode")]
782    fn connect_fullscreen_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
783        unsafe extern "C" fn notify_fullscreen_mode_trampoline<
784            P: IsA<Toplevel>,
785            F: Fn(&P) + 'static,
786        >(
787            this: *mut ffi::GdkToplevel,
788            _param_spec: glib::ffi::gpointer,
789            f: glib::ffi::gpointer,
790        ) {
791            unsafe {
792                let f: &F = &*(f as *const F);
793                f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
794            }
795        }
796        unsafe {
797            let f: Box_<F> = Box_::new(f);
798            connect_raw(
799                self.as_ptr() as *mut _,
800                c"notify::fullscreen-mode".as_ptr(),
801                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
802                    notify_fullscreen_mode_trampoline::<Self, F> as *const (),
803                )),
804                Box_::into_raw(f),
805            )
806        }
807    }
808
809    #[cfg(feature = "v4_20")]
810    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
811    #[doc(alias = "gravity")]
812    fn connect_gravity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
813        unsafe extern "C" fn notify_gravity_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
814            this: *mut ffi::GdkToplevel,
815            _param_spec: glib::ffi::gpointer,
816            f: glib::ffi::gpointer,
817        ) {
818            unsafe {
819                let f: &F = &*(f as *const F);
820                f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
821            }
822        }
823        unsafe {
824            let f: Box_<F> = Box_::new(f);
825            connect_raw(
826                self.as_ptr() as *mut _,
827                c"notify::gravity".as_ptr(),
828                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
829                    notify_gravity_trampoline::<Self, F> as *const (),
830                )),
831                Box_::into_raw(f),
832            )
833        }
834    }
835
836    #[doc(alias = "icon-list")]
837    fn connect_icon_list_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
838        unsafe extern "C" fn notify_icon_list_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
839            this: *mut ffi::GdkToplevel,
840            _param_spec: glib::ffi::gpointer,
841            f: glib::ffi::gpointer,
842        ) {
843            unsafe {
844                let f: &F = &*(f as *const F);
845                f(Toplevel::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::icon-list".as_ptr(),
853                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
854                    notify_icon_list_trampoline::<Self, F> as *const (),
855                )),
856                Box_::into_raw(f),
857            )
858        }
859    }
860
861    #[doc(alias = "modal")]
862    fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
863        unsafe extern "C" fn notify_modal_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
864            this: *mut ffi::GdkToplevel,
865            _param_spec: glib::ffi::gpointer,
866            f: glib::ffi::gpointer,
867        ) {
868            unsafe {
869                let f: &F = &*(f as *const F);
870                f(Toplevel::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::modal".as_ptr(),
878                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
879                    notify_modal_trampoline::<Self, F> as *const (),
880                )),
881                Box_::into_raw(f),
882            )
883        }
884    }
885
886    #[doc(alias = "shortcuts-inhibited")]
887    fn connect_shortcuts_inhibited_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
888        unsafe extern "C" fn notify_shortcuts_inhibited_trampoline<
889            P: IsA<Toplevel>,
890            F: Fn(&P) + 'static,
891        >(
892            this: *mut ffi::GdkToplevel,
893            _param_spec: glib::ffi::gpointer,
894            f: glib::ffi::gpointer,
895        ) {
896            unsafe {
897                let f: &F = &*(f as *const F);
898                f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
899            }
900        }
901        unsafe {
902            let f: Box_<F> = Box_::new(f);
903            connect_raw(
904                self.as_ptr() as *mut _,
905                c"notify::shortcuts-inhibited".as_ptr(),
906                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
907                    notify_shortcuts_inhibited_trampoline::<Self, F> as *const (),
908                )),
909                Box_::into_raw(f),
910            )
911        }
912    }
913
914    #[doc(alias = "startup-id")]
915    fn connect_startup_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
916        unsafe extern "C" fn notify_startup_id_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
917            this: *mut ffi::GdkToplevel,
918            _param_spec: glib::ffi::gpointer,
919            f: glib::ffi::gpointer,
920        ) {
921            unsafe {
922                let f: &F = &*(f as *const F);
923                f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
924            }
925        }
926        unsafe {
927            let f: Box_<F> = Box_::new(f);
928            connect_raw(
929                self.as_ptr() as *mut _,
930                c"notify::startup-id".as_ptr(),
931                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
932                    notify_startup_id_trampoline::<Self, F> as *const (),
933                )),
934                Box_::into_raw(f),
935            )
936        }
937    }
938
939    #[doc(alias = "state")]
940    fn connect_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
941        unsafe extern "C" fn notify_state_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
942            this: *mut ffi::GdkToplevel,
943            _param_spec: glib::ffi::gpointer,
944            f: glib::ffi::gpointer,
945        ) {
946            unsafe {
947                let f: &F = &*(f as *const F);
948                f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
949            }
950        }
951        unsafe {
952            let f: Box_<F> = Box_::new(f);
953            connect_raw(
954                self.as_ptr() as *mut _,
955                c"notify::state".as_ptr(),
956                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
957                    notify_state_trampoline::<Self, F> as *const (),
958                )),
959                Box_::into_raw(f),
960            )
961        }
962    }
963
964    #[doc(alias = "title")]
965    fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
966        unsafe extern "C" fn notify_title_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
967            this: *mut ffi::GdkToplevel,
968            _param_spec: glib::ffi::gpointer,
969            f: glib::ffi::gpointer,
970        ) {
971            unsafe {
972                let f: &F = &*(f as *const F);
973                f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
974            }
975        }
976        unsafe {
977            let f: Box_<F> = Box_::new(f);
978            connect_raw(
979                self.as_ptr() as *mut _,
980                c"notify::title".as_ptr(),
981                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
982                    notify_title_trampoline::<Self, F> as *const (),
983                )),
984                Box_::into_raw(f),
985            )
986        }
987    }
988
989    #[doc(alias = "transient-for")]
990    fn connect_transient_for_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
991        unsafe extern "C" fn notify_transient_for_trampoline<
992            P: IsA<Toplevel>,
993            F: Fn(&P) + 'static,
994        >(
995            this: *mut ffi::GdkToplevel,
996            _param_spec: glib::ffi::gpointer,
997            f: glib::ffi::gpointer,
998        ) {
999            unsafe {
1000                let f: &F = &*(f as *const F);
1001                f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
1002            }
1003        }
1004        unsafe {
1005            let f: Box_<F> = Box_::new(f);
1006            connect_raw(
1007                self.as_ptr() as *mut _,
1008                c"notify::transient-for".as_ptr(),
1009                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1010                    notify_transient_for_trampoline::<Self, F> as *const (),
1011                )),
1012                Box_::into_raw(f),
1013            )
1014        }
1015    }
1016}
1017
1018impl<O: IsA<Toplevel>> ToplevelExt for O {}