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