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 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
// 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::X11Display; use glib::object::Cast; use glib::translate::*; use std::fmt; use x11::xlib; glib::wrapper! { /// /// /// # Implements /// /// [`trait@gdk::prelude::WindowExt`] #[doc(alias = "GdkX11Window")] pub struct X11Window(Object<ffi::GdkX11Window, ffi::GdkX11WindowClass>) @extends gdk::Window; match fn { type_ => || ffi::gdk_x11_window_get_type(), } } impl X11Window { /// Wraps a native window in a [`gdk::Window`][crate::gdk::Window]. The function will try to /// look up the window using [`lookup_for_display()`][Self::lookup_for_display()] first. /// If it does not find it there, it will create a new window. /// /// This may fail if the window has been destroyed. If the window /// was already known to GDK, a new reference to the existing /// [`gdk::Window`][crate::gdk::Window] is returned. /// ## `display` /// the [`gdk::Display`][crate::gdk::Display] where the window handle comes from. /// ## `window` /// an Xlib Window /// /// # Returns /// /// a [`gdk::Window`][crate::gdk::Window] wrapper for the native /// window, or [`None`] if the window has been destroyed. The wrapper /// will be newly created, if one doesn’t exist already. #[doc(alias = "gdk_x11_window_foreign_new_for_display")] pub fn foreign_new_for_display(display: &X11Display, window: xlib::Window) -> X11Window { skip_assert_initialized!(); unsafe { gdk::Window::from_glib_full(ffi::gdk_x11_window_foreign_new_for_display( display.to_glib_none().0, window, )) .unsafe_cast() } } /// Gets the number of the workspace `self` is on. /// /// # Returns /// /// the current workspace of `self` #[doc(alias = "gdk_x11_window_get_desktop")] #[doc(alias = "get_desktop")] pub fn desktop(&self) -> u32 { unsafe { ffi::gdk_x11_window_get_desktop(self.to_glib_none().0) } } /// Returns the X resource (window) belonging to a [`gdk::Window`][crate::gdk::Window]. /// /// # Returns /// /// the ID of `drawable`’s X resource. #[doc(alias = "gdk_x11_window_get_xid")] #[doc(alias = "get_xid")] pub fn xid(&self) -> xlib::Window { unsafe { ffi::gdk_x11_window_get_xid(self.to_glib_none().0) } } /// Moves the window 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 window is already on all workspaces. #[doc(alias = "gdk_x11_window_move_to_current_desktop")] pub fn move_to_current_desktop(&self) { unsafe { ffi::gdk_x11_window_move_to_current_desktop(self.to_glib_none().0); } } /// Moves the window 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 window to #[doc(alias = "gdk_x11_window_move_to_desktop")] pub fn move_to_desktop(&self, desktop: u32) { unsafe { ffi::gdk_x11_window_move_to_desktop(self.to_glib_none().0, desktop); } } /// This function can be used to disable frame synchronization for a window. /// Normally frame synchronziation will be enabled or disabled based on whether /// the system has a compositor that supports frame synchronization, but if /// the window is not directly managed by the window manager, then frame /// synchronziation may need to be disabled. This is the case for a window /// embedded via the XEMBED protocol. /// ## `frame_sync_enabled` /// whether frame-synchronization should be enabled #[doc(alias = "gdk_x11_window_set_frame_sync_enabled")] pub fn set_frame_sync_enabled(&self, frame_sync_enabled: bool) { unsafe { ffi::gdk_x11_window_set_frame_sync_enabled( self.to_glib_none().0, frame_sync_enabled.into_glib(), ); } } /// Set a hint for the window manager, requesting that the titlebar /// should be hidden when the window is maximized. /// /// 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 windows. /// ## `hide_titlebar_when_maximized` /// whether to hide the titlebar when /// maximized #[doc(alias = "gdk_x11_window_set_hide_titlebar_when_maximized")] pub fn set_hide_titlebar_when_maximized(&self, hide_titlebar_when_maximized: bool) { unsafe { ffi::gdk_x11_window_set_hide_titlebar_when_maximized( self.to_glib_none().0, hide_titlebar_when_maximized.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 windows. /// /// 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 windows. /// ## `variant` /// the theme variant to export #[doc(alias = "gdk_x11_window_set_theme_variant")] pub fn set_theme_variant(&self, variant: &str) { unsafe { ffi::gdk_x11_window_set_theme_variant(self.to_glib_none().0, variant.to_glib_none().0); } } /// The application can use this call to update the _NET_WM_USER_TIME /// property on a toplevel window. This property stores an Xserver /// time which represents the time of the last user input event /// received for this window. This property may be used by the window /// manager to alter the focus, stacking, and/or placement behavior of /// windows when they are mapped depending on whether the new window /// was created by a user action or is a "pop-up" window 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_window_set_user_time")] pub fn set_user_time(&self, timestamp: u32) { unsafe { ffi::gdk_x11_window_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 window, it is ignored. /// ## `name` /// Property name, will be interned as an X atom /// ## `value` /// Property value, or [`None`] to delete #[doc(alias = "gdk_x11_window_set_utf8_property")] pub fn set_utf8_property(&self, name: &str, value: Option<&str>) { unsafe { ffi::gdk_x11_window_set_utf8_property( self.to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0, ); } } /// Looks up the [`gdk::Window`][crate::gdk::Window] that wraps the given native window handle. /// ## `display` /// the [`gdk::Display`][crate::gdk::Display] corresponding to the /// window handle /// ## `window` /// an Xlib Window /// /// # Returns /// /// the [`gdk::Window`][crate::gdk::Window] wrapper for the native /// window, or [`None`] if there is none. #[doc(alias = "gdk_x11_window_lookup_for_display")] pub fn lookup_for_display(display: &X11Display, window: xlib::Window) -> Option<X11Window> { skip_assert_initialized!(); unsafe { from_glib_none(ffi::gdk_x11_window_lookup_for_display( display.to_glib_none().0, window, )) } } } impl fmt::Display for X11Window { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("X11Window") } }