1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
#![allow(deprecated)]

use crate::WaylandSurface;
use glib::translate::*;

glib::wrapper! {
    /// The Wayland implementation of [`gdk::Toplevel`][crate::gdk::Toplevel].
    ///
    /// Beyond the [`gdk::Toplevel`][crate::gdk::Toplevel] API, the Wayland implementation
    /// has API to set up cross-process parent-child relationships between
    /// surfaces with [`export_handle()`][Self::export_handle()] and
    /// [`set_transient_for_exported()`][Self::set_transient_for_exported()].
    ///
    /// # Implements
    ///
    /// [`WaylandSurfaceExt`][trait@crate::prelude::WaylandSurfaceExt], [`trait@gdk::prelude::SurfaceExt`], [`trait@gdk::prelude::ToplevelExt`], [`WaylandSurfaceExtManual`][trait@crate::prelude::WaylandSurfaceExtManual]
    #[doc(alias = "GdkWaylandToplevel")]
    pub struct WaylandToplevel(Object<ffi::GdkWaylandToplevel>) @extends WaylandSurface, gdk::Surface, @implements gdk::Toplevel;

    match fn {
        type_ => || ffi::gdk_wayland_toplevel_get_type(),
    }
}

impl WaylandToplevel {
    /// Destroy a handle that was obtained with gdk_wayland_toplevel_export_handle().
    ///
    /// Note that this API depends on an unstable Wayland protocol,
    /// and thus may require changes in the future.
    /// ## `handle`
    /// the handle to drop
    #[cfg(feature = "v4_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
    #[doc(alias = "gdk_wayland_toplevel_drop_exported_handle")]
    pub fn drop_exported_handle(&self, handle: &str) {
        unsafe {
            ffi::gdk_wayland_toplevel_drop_exported_handle(
                self.to_glib_none().0,
                handle.to_glib_none().0,
            );
        }
    }

    /// Sets the application id on a [`gdk::Toplevel`][crate::gdk::Toplevel].
    /// ## `application_id`
    /// the application id for the @self
    #[doc(alias = "gdk_wayland_toplevel_set_application_id")]
    pub fn set_application_id(&self, application_id: &str) {
        unsafe {
            ffi::gdk_wayland_toplevel_set_application_id(
                self.to_glib_none().0,
                application_id.to_glib_none().0,
            );
        }
    }

    /// Marks @self as transient for the surface to which the given
    /// @parent_handle_str refers.
    ///
    /// Typically, the handle will originate from a
    /// [`export_handle()`][Self::export_handle()] call in another process.
    ///
    /// Note that this API depends on an unstable Wayland protocol,
    /// and thus may require changes in the future.
    /// ## `parent_handle_str`
    /// an exported handle for a surface
    ///
    /// # Returns
    ///
    /// [`true`] if the surface has been marked as transient,
    ///   [`false`] if an error occurred.
    #[doc(alias = "gdk_wayland_toplevel_set_transient_for_exported")]
    pub fn set_transient_for_exported(&self, parent_handle_str: &str) -> bool {
        unsafe {
            from_glib(ffi::gdk_wayland_toplevel_set_transient_for_exported(
                self.to_glib_none().0,
                parent_handle_str.to_glib_none().0,
            ))
        }
    }

    /// Destroys the handle that was obtained with
    /// gdk_wayland_toplevel_export_handle().
    ///
    /// It is an error to call this function on a surface that
    /// does not have a handle.
    ///
    /// Since 4.12, this function does nothing. Use
    /// [`drop_exported_handle()`][Self::drop_exported_handle()] instead to drop a
    /// handle that was obtained with [`export_handle()`][Self::export_handle()].
    ///
    /// Note that this API depends on an unstable Wayland protocol,
    /// and thus may require changes in the future.
    ///
    /// # Deprecated since 4.12
    ///
    /// Use [`drop_exported_handle()`][Self::drop_exported_handle()]
    ///   instead, this function does nothing
    #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
    #[allow(deprecated)]
    #[doc(alias = "gdk_wayland_toplevel_unexport_handle")]
    pub fn unexport_handle(&self) {
        unsafe {
            ffi::gdk_wayland_toplevel_unexport_handle(self.to_glib_none().0);
        }
    }
}