gdk4_wayland/auto/
wayland_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#![allow(deprecated)]
5
6use crate::{ffi, WaylandSurface};
7use glib::translate::*;
8
9glib::wrapper! {
10    /// The Wayland implementation of [`gdk::Toplevel`][crate::gdk::Toplevel].
11    ///
12    /// Beyond the [`gdk::Toplevel`][crate::gdk::Toplevel] API, the Wayland implementation
13    /// has API to set up cross-process parent-child relationships between
14    /// surfaces with [`export_handle()`][Self::export_handle()] and
15    /// [`set_transient_for_exported()`][Self::set_transient_for_exported()].
16    ///
17    /// # Implements
18    ///
19    /// [`WaylandSurfaceExt`][trait@crate::prelude::WaylandSurfaceExt], [`trait@gdk::prelude::SurfaceExt`], [`trait@gdk::prelude::ToplevelExt`], [`WaylandSurfaceExtManual`][trait@crate::prelude::WaylandSurfaceExtManual]
20    #[doc(alias = "GdkWaylandToplevel")]
21    pub struct WaylandToplevel(Object<ffi::GdkWaylandToplevel>) @extends WaylandSurface, gdk::Surface, @implements gdk::Toplevel;
22
23    match fn {
24        type_ => || ffi::gdk_wayland_toplevel_get_type(),
25    }
26}
27
28impl WaylandToplevel {
29    /// Destroy a handle that was obtained with gdk_wayland_toplevel_export_handle().
30    ///
31    /// Note that this API depends on an unstable Wayland protocol,
32    /// and thus may require changes in the future.
33    /// ## `handle`
34    /// the handle to drop
35    #[cfg(feature = "v4_12")]
36    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
37    #[doc(alias = "gdk_wayland_toplevel_drop_exported_handle")]
38    pub fn drop_exported_handle(&self, handle: &str) {
39        unsafe {
40            ffi::gdk_wayland_toplevel_drop_exported_handle(
41                self.to_glib_none().0,
42                handle.to_glib_none().0,
43            );
44        }
45    }
46
47    /// Sets the application id on a [`gdk::Toplevel`][crate::gdk::Toplevel].
48    /// ## `application_id`
49    /// the application id for the @self
50    #[doc(alias = "gdk_wayland_toplevel_set_application_id")]
51    pub fn set_application_id(&self, application_id: &str) {
52        unsafe {
53            ffi::gdk_wayland_toplevel_set_application_id(
54                self.to_glib_none().0,
55                application_id.to_glib_none().0,
56            );
57        }
58    }
59
60    /// Marks @self as transient for the surface to which the given
61    /// @parent_handle_str refers.
62    ///
63    /// Typically, the handle will originate from a
64    /// [`export_handle()`][Self::export_handle()] call in another process.
65    ///
66    /// Note that this API depends on an unstable Wayland protocol,
67    /// and thus may require changes in the future.
68    /// ## `parent_handle_str`
69    /// an exported handle for a surface
70    ///
71    /// # Returns
72    ///
73    /// [`true`] if the surface has been marked as transient,
74    ///   [`false`] if an error occurred.
75    #[doc(alias = "gdk_wayland_toplevel_set_transient_for_exported")]
76    pub fn set_transient_for_exported(&self, parent_handle_str: &str) -> bool {
77        unsafe {
78            from_glib(ffi::gdk_wayland_toplevel_set_transient_for_exported(
79                self.to_glib_none().0,
80                parent_handle_str.to_glib_none().0,
81            ))
82        }
83    }
84
85    /// Destroys the handle that was obtained with
86    /// gdk_wayland_toplevel_export_handle().
87    ///
88    /// It is an error to call this function on a surface that
89    /// does not have a handle.
90    ///
91    /// Since 4.12, this function does nothing. Use
92    /// [`drop_exported_handle()`][Self::drop_exported_handle()] instead to drop a
93    /// handle that was obtained with [`export_handle()`][Self::export_handle()].
94    ///
95    /// Note that this API depends on an unstable Wayland protocol,
96    /// and thus may require changes in the future.
97    ///
98    /// # Deprecated since 4.12
99    ///
100    /// Use [`drop_exported_handle()`][Self::drop_exported_handle()]
101    ///   instead, this function does nothing
102    #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
103    #[allow(deprecated)]
104    #[doc(alias = "gdk_wayland_toplevel_unexport_handle")]
105    pub fn unexport_handle(&self) {
106        unsafe {
107            ffi::gdk_wayland_toplevel_unexport_handle(self.to_glib_none().0);
108        }
109    }
110}