gdk4_x11/auto/
x11_surface.rs

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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
// 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

use crate::ffi;
use glib::{prelude::*, translate::*};

glib::wrapper! {
    ///
    ///
    /// # Implements
    ///
    /// [`trait@gdk::prelude::SurfaceExt`]
    #[doc(alias = "GdkX11Surface")]
    pub struct X11Surface(Object<ffi::GdkX11Surface, ffi::GdkX11SurfaceClass>) @extends gdk::Surface;

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

impl X11Surface {
    /// Gets the number of the workspace @self is on.
    ///
    /// # Returns
    ///
    /// the current workspace of @self
    #[doc(alias = "gdk_x11_surface_get_desktop")]
    #[doc(alias = "get_desktop")]
    pub fn desktop(&self) -> u32 {
        unsafe { ffi::gdk_x11_surface_get_desktop(self.to_glib_none().0) }
    }

    /// Returns the group this surface belongs to.
    ///
    /// # Returns
    ///
    /// The group of this surface;
    #[doc(alias = "gdk_x11_surface_get_group")]
    #[doc(alias = "get_group")]
    pub fn group(&self) -> Option<gdk::Surface> {
        unsafe { from_glib_none(ffi::gdk_x11_surface_get_group(self.to_glib_none().0)) }
    }

    /// Moves the surface to the correct workspace when running under a
    /// window manager that supports multiple workspaces, as described
    /// in the [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec) specification.
    /// Will not do anything if the surface is already on all workspaces.
    #[doc(alias = "gdk_x11_surface_move_to_current_desktop")]
    pub fn move_to_current_desktop(&self) {
        unsafe {
            ffi::gdk_x11_surface_move_to_current_desktop(self.to_glib_none().0);
        }
    }

    /// Moves the surface to the given workspace when running unde a
    /// window manager that supports multiple workspaces, as described
    /// in the [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec) specification.
    /// ## `desktop`
    /// the number of the workspace to move the surface to
    #[doc(alias = "gdk_x11_surface_move_to_desktop")]
    pub fn move_to_desktop(&self, desktop: u32) {
        unsafe {
            ffi::gdk_x11_surface_move_to_desktop(self.to_glib_none().0, desktop);
        }
    }

    /// This function can be used to disable frame synchronization for a surface.
    /// Normally frame synchronziation will be enabled or disabled based on whether
    /// the system has a compositor that supports frame synchronization, but if
    /// the surface is not directly managed by the window manager, then frame
    /// synchronziation may need to be disabled. This is the case for a surface
    /// embedded via the XEMBED protocol.
    /// ## `frame_sync_enabled`
    /// whether frame-synchronization should be enabled
    #[doc(alias = "gdk_x11_surface_set_frame_sync_enabled")]
    pub fn set_frame_sync_enabled(&self, frame_sync_enabled: bool) {
        unsafe {
            ffi::gdk_x11_surface_set_frame_sync_enabled(
                self.to_glib_none().0,
                frame_sync_enabled.into_glib(),
            );
        }
    }

    /// Sets the group leader of @self to be @leader.
    /// See the ICCCM for details.
    /// ## `leader`
    /// a [`gdk::Surface`][crate::gdk::Surface]
    #[doc(alias = "gdk_x11_surface_set_group")]
    pub fn set_group(&self, leader: &impl IsA<gdk::Surface>) {
        unsafe {
            ffi::gdk_x11_surface_set_group(self.to_glib_none().0, leader.as_ref().to_glib_none().0);
        }
    }

    /// Sets a hint on @self that pagers should not
    /// display it. See the EWMH for details.
    /// ## `skips_pager`
    /// [`true`] to skip pagers
    #[doc(alias = "gdk_x11_surface_set_skip_pager_hint")]
    pub fn set_skip_pager_hint(&self, skips_pager: bool) {
        unsafe {
            ffi::gdk_x11_surface_set_skip_pager_hint(
                self.to_glib_none().0,
                skips_pager.into_glib(),
            );
        }
    }

    /// Sets a hint on @self that taskbars should not
    /// display it. See the EWMH for details.
    /// ## `skips_taskbar`
    /// [`true`] to skip taskbars
    #[doc(alias = "gdk_x11_surface_set_skip_taskbar_hint")]
    pub fn set_skip_taskbar_hint(&self, skips_taskbar: bool) {
        unsafe {
            ffi::gdk_x11_surface_set_skip_taskbar_hint(
                self.to_glib_none().0,
                skips_taskbar.into_glib(),
            );
        }
    }

    /// GTK applications can request a dark theme variant. In order to
    /// make other applications - namely window managers using GTK for
    /// themeing - aware of this choice, GTK uses this function to
    /// export the requested theme variant as _GTK_THEME_VARIANT property
    /// on toplevel surfaces.
    ///
    /// Note that this property is automatically updated by GTK, so this
    /// function should only be used by applications which do not use GTK
    /// to create toplevel surfaces.
    /// ## `variant`
    /// the theme variant to export
    #[doc(alias = "gdk_x11_surface_set_theme_variant")]
    pub fn set_theme_variant(&self, variant: &str) {
        unsafe {
            ffi::gdk_x11_surface_set_theme_variant(self.to_glib_none().0, variant.to_glib_none().0);
        }
    }

    /// Sets a hint on @self that it needs user attention.
    /// See the ICCCM for details.
    /// ## `urgent`
    /// [`true`] to indicate urgenct attention needed
    #[doc(alias = "gdk_x11_surface_set_urgency_hint")]
    pub fn set_urgency_hint(&self, urgent: bool) {
        unsafe {
            ffi::gdk_x11_surface_set_urgency_hint(self.to_glib_none().0, urgent.into_glib());
        }
    }

    /// The application can use this call to update the _NET_WM_USER_TIME
    /// property on a toplevel surface.  This property stores an Xserver
    /// time which represents the time of the last user input event
    /// received for this surface.  This property may be used by the window
    /// manager to alter the focus, stacking, and/or placement behavior of
    /// surfaces when they are mapped depending on whether the new surface
    /// was created by a user action or is a "pop-up" surface activated by a
    /// timer or some other event.
    ///
    /// Note that this property is automatically updated by GDK, so this
    /// function should only be used by applications which handle input
    /// events bypassing GDK.
    /// ## `timestamp`
    /// An XServer timestamp to which the property should be set
    #[doc(alias = "gdk_x11_surface_set_user_time")]
    pub fn set_user_time(&self, timestamp: u32) {
        unsafe {
            ffi::gdk_x11_surface_set_user_time(self.to_glib_none().0, timestamp);
        }
    }

    /// This function modifies or removes an arbitrary X11 window
    /// property of type UTF8_STRING.  If the given @self is
    /// not a toplevel surface, it is ignored.
    /// ## `name`
    /// Property name, will be interned as an X atom
    /// ## `value`
    /// Property value, or [`None`] to delete
    #[doc(alias = "gdk_x11_surface_set_utf8_property")]
    pub fn set_utf8_property(&self, name: &str, value: Option<&str>) {
        unsafe {
            ffi::gdk_x11_surface_set_utf8_property(
                self.to_glib_none().0,
                name.to_glib_none().0,
                value.to_glib_none().0,
            );
        }
    }
}