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 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
// 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::X11DeviceCore;
use crate::X11DeviceManagerCore;
use crate::X11Display;
use crate::X11Window;
use glib::object::IsA;
use glib::translate::*;
use x11::xlib;
/// Converts from a [`gdk::Atom`][crate::gdk::Atom] to the X atom for the default GDK display
/// with the same string value.
/// ## `atom`
/// A [`gdk::Atom`][crate::gdk::Atom]
///
/// # Returns
///
/// the X atom corresponding to `atom`.
#[doc(alias = "gdk_x11_atom_to_xatom")]
pub fn x11_atom_to_xatom(atom: &gdk::Atom) -> xlib::Atom {
assert_initialized_main_thread!();
unsafe { ffi::gdk_x11_atom_to_xatom(atom.to_glib_none().0) }
}
/// Converts from a [`gdk::Atom`][crate::gdk::Atom] to the X atom for a [`gdk::Display`][crate::gdk::Display]
/// with the same string value. The special value `GDK_NONE`
/// is converted to `None`.
/// ## `display`
/// A [`gdk::Display`][crate::gdk::Display]
/// ## `atom`
/// A [`gdk::Atom`][crate::gdk::Atom], or `GDK_NONE`
///
/// # Returns
///
/// the X atom corresponding to `atom`, or `None`
#[doc(alias = "gdk_x11_atom_to_xatom_for_display")]
pub fn x11_atom_to_xatom_for_display(display: &X11Display, atom: &gdk::Atom) -> xlib::Atom {
skip_assert_initialized!();
unsafe {
ffi::gdk_x11_atom_to_xatom_for_display(display.to_glib_none().0, atom.to_glib_none().0)
}
}
/// Returns the device ID as seen by XInput2.
///
/// > If `gdk_disable_multidevice()` has been called, this function
/// > will respectively return 2/3 for the core pointer and keyboard,
/// > (matching the IDs for the Virtual Core Pointer and Keyboard in
/// > XInput 2), but calling this function on any slave devices (i.e.
/// > those managed via XInput 1.x), will return 0.
/// ## `device`
/// a [`gdk::Device`][crate::gdk::Device]
///
/// # Returns
///
/// the XInput2 device ID.
#[doc(alias = "gdk_x11_device_get_id")]
pub fn x11_device_get_id(device: &X11DeviceCore) -> i32 {
skip_assert_initialized!();
unsafe { ffi::gdk_x11_device_get_id(device.to_glib_none().0) }
}
/// Returns the [`gdk::Device`][crate::gdk::Device] that wraps the given device ID.
/// ## `device_manager`
/// a [`gdk::DeviceManager`][crate::gdk::DeviceManager]
/// ## `device_id`
/// a device ID, as understood by the XInput2 protocol
///
/// # Returns
///
/// The [`gdk::Device`][crate::gdk::Device] wrapping the device ID,
/// or [`None`] if the given ID doesn’t currently represent a device.
#[doc(alias = "gdk_x11_device_manager_lookup")]
pub fn x11_device_manager_lookup(
device_manager: &impl IsA<X11DeviceManagerCore>,
device_id: i32,
) -> Option<X11DeviceCore> {
skip_assert_initialized!();
unsafe {
from_glib_none(ffi::gdk_x11_device_manager_lookup(
device_manager.as_ref().to_glib_none().0,
device_id,
))
}
}
/// Gets the root window of the default screen
/// (see [`x11_get_default_screen()`][crate::x11_get_default_screen()]).
///
/// # Returns
///
/// an Xlib Window.
#[doc(alias = "gdk_x11_get_default_root_xwindow")]
pub fn x11_get_default_root_xwindow() -> xlib::Window {
assert_initialized_main_thread!();
unsafe { ffi::gdk_x11_get_default_root_xwindow() }
}
/// Gets the default GTK+ screen number.
///
/// # Returns
///
/// returns the screen number specified by
/// the --display command line option or the DISPLAY environment
/// variable when `gdk_init()` calls XOpenDisplay().
#[doc(alias = "gdk_x11_get_default_screen")]
pub fn x11_get_default_screen() -> i32 {
assert_initialized_main_thread!();
unsafe { ffi::gdk_x11_get_default_screen() }
}
//#[cfg_attr(feature = "v3_24", deprecated = "Since 3.24")]
//#[cfg(any(feature = "v3_24_2", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24_2")))]
//#[doc(alias = "gdk_x11_get_parent_relative_pattern")]
//pub fn x11_get_parent_relative_pattern() -> /*Ignored*/Option<cairo::Pattern> {
// unsafe { TODO: call ffi:gdk_x11_get_parent_relative_pattern() }
//}
/// Routine to get the current X server time stamp.
/// ## `window`
/// a [`gdk::Window`][crate::gdk::Window], used for communication
/// with the server. The window must have
/// GDK_PROPERTY_CHANGE_MASK in its events mask or a hang will
/// result.
///
/// # Returns
///
/// the time stamp.
#[doc(alias = "gdk_x11_get_server_time")]
pub fn x11_get_server_time(window: &X11Window) -> u32 {
skip_assert_initialized!();
unsafe { ffi::gdk_x11_get_server_time(window.to_glib_none().0) }
}
/// Returns the X atom for GDK’s default display corresponding to `atom_name`.
/// This function caches the result, so if called repeatedly it is much
/// faster than XInternAtom(), which is a round trip to the server each time.
/// ## `atom_name`
/// a string
///
/// # Returns
///
/// a X atom for GDK’s default display.
#[doc(alias = "gdk_x11_get_xatom_by_name")]
pub fn x11_get_xatom_by_name(atom_name: &str) -> xlib::Atom {
assert_initialized_main_thread!();
unsafe { ffi::gdk_x11_get_xatom_by_name(atom_name.to_glib_none().0) }
}
/// Returns the X atom for a [`gdk::Display`][crate::gdk::Display] corresponding to `atom_name`.
/// This function caches the result, so if called repeatedly it is much
/// faster than XInternAtom(), which is a round trip to the server each time.
/// ## `display`
/// a [`gdk::Display`][crate::gdk::Display]
/// ## `atom_name`
/// a string
///
/// # Returns
///
/// a X atom for a [`gdk::Display`][crate::gdk::Display]
#[doc(alias = "gdk_x11_get_xatom_by_name_for_display")]
pub fn x11_get_xatom_by_name_for_display(display: &X11Display, atom_name: &str) -> xlib::Atom {
skip_assert_initialized!();
unsafe {
ffi::gdk_x11_get_xatom_by_name_for_display(
display.to_glib_none().0,
atom_name.to_glib_none().0,
)
}
}
/// Returns the name of an X atom for GDK’s default display. This
/// function is meant mainly for debugging, so for convenience, unlike
/// XAtomName() and [`gdk::Atom::name()`][crate::gdk::Atom::name()], the result
/// doesn’t need to be freed. Also, this function will never return [`None`],
/// even if `xatom` is invalid.
/// ## `xatom`
/// an X atom for GDK’s default display
///
/// # Returns
///
/// name of the X atom; this string is owned by GTK+,
/// so it shouldn’t be modifed or freed.
#[doc(alias = "gdk_x11_get_xatom_name")]
pub fn x11_get_xatom_name(xatom: xlib::Atom) -> Option<glib::GString> {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::gdk_x11_get_xatom_name(xatom)) }
}
/// Returns the name of an X atom for its display. This
/// function is meant mainly for debugging, so for convenience, unlike
/// XAtomName() and [`gdk::Atom::name()`][crate::gdk::Atom::name()], the result doesn’t need to
/// be freed.
/// ## `display`
/// the [`gdk::Display`][crate::gdk::Display] where `xatom` is defined
/// ## `xatom`
/// an X atom
///
/// # Returns
///
/// name of the X atom; this string is owned by GDK,
/// so it shouldn’t be modifed or freed.
#[doc(alias = "gdk_x11_get_xatom_name_for_display")]
pub fn x11_get_xatom_name_for_display(
display: &X11Display,
xatom: xlib::Atom,
) -> Option<glib::GString> {
skip_assert_initialized!();
unsafe {
from_glib_none(ffi::gdk_x11_get_xatom_name_for_display(
display.to_glib_none().0,
xatom,
))
}
}
/// Call [`X11Display::grab()`][crate::X11Display::grab()] on the default display.
/// To ungrab the server again, use [`x11_ungrab_server()`][crate::x11_ungrab_server()].
///
/// [`x11_grab_server()`][crate::x11_grab_server()]/[`x11_ungrab_server()`][crate::x11_ungrab_server()] calls can be nested.
#[doc(alias = "gdk_x11_grab_server")]
pub fn x11_grab_server() {
assert_initialized_main_thread!();
unsafe {
ffi::gdk_x11_grab_server();
}
}
/// Registers interest in receiving extension events with type codes
/// between `event_base` and `event_base + n_events - 1`.
/// The registered events must have the window field in the same place
/// as core X events (this is not the case for e.g. XKB extension events).
///
/// If an event type is registered, events of this type will go through
/// global and window-specific filters (see [`WindowExtManual::add_filter()`][crate::gdk::prelude::WindowExtManual::add_filter()]).
/// Unregistered events will only go through global filters.
/// GDK may register the events of some X extensions on its own.
///
/// This function should only be needed in unusual circumstances, e.g.
/// when filtering XInput extension events on the root window.
/// ## `display`
/// a [`gdk::Display`][crate::gdk::Display]
/// ## `event_base`
/// first event type code to register
/// ## `n_events`
/// number of event type codes to register
#[doc(alias = "gdk_x11_register_standard_event_type")]
pub fn x11_register_standard_event_type(display: &X11Display, event_base: i32, n_events: i32) {
skip_assert_initialized!();
unsafe {
ffi::gdk_x11_register_standard_event_type(display.to_glib_none().0, event_base, n_events);
}
}
/// Sets the `SM_CLIENT_ID` property on the application’s leader window so that
/// the window manager can save the application’s state using the X11R6 ICCCM
/// session management protocol.
///
/// See the X Session Management Library documentation for more information on
/// session management and the Inter-Client Communication Conventions Manual
/// ## `sm_client_id`
/// the client id assigned by the session manager
/// when the connection was opened, or [`None`] to remove the property.
#[doc(alias = "gdk_x11_set_sm_client_id")]
pub fn x11_set_sm_client_id(sm_client_id: Option<&str>) {
assert_initialized_main_thread!();
unsafe {
ffi::gdk_x11_set_sm_client_id(sm_client_id.to_glib_none().0);
}
}
/// Ungrab the default display after it has been grabbed with
/// [`x11_grab_server()`][crate::x11_grab_server()].
#[doc(alias = "gdk_x11_ungrab_server")]
pub fn x11_ungrab_server() {
assert_initialized_main_thread!();
unsafe {
ffi::gdk_x11_ungrab_server();
}
}
/// Convert from an X atom for the default display to the corresponding
/// [`gdk::Atom`][crate::gdk::Atom].
/// ## `xatom`
/// an X atom for the default GDK display
///
/// # Returns
///
/// the corresponding G`dkAtom`.
#[doc(alias = "gdk_x11_xatom_to_atom")]
pub fn x11_xatom_to_atom(xatom: xlib::Atom) -> Option<gdk::Atom> {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::gdk_x11_xatom_to_atom(xatom)) }
}
/// Convert from an X atom for a [`gdk::Display`][crate::gdk::Display] to the corresponding
/// [`gdk::Atom`][crate::gdk::Atom].
/// ## `display`
/// A [`gdk::Display`][crate::gdk::Display]
/// ## `xatom`
/// an X atom
///
/// # Returns
///
/// the corresponding [`gdk::Atom`][crate::gdk::Atom].
#[doc(alias = "gdk_x11_xatom_to_atom_for_display")]
pub fn x11_xatom_to_atom_for_display(display: &X11Display, xatom: xlib::Atom) -> Option<gdk::Atom> {
skip_assert_initialized!();
unsafe {
from_glib_none(ffi::gdk_x11_xatom_to_atom_for_display(
display.to_glib_none().0,
xatom,
))
}
}