gdk4_x11/auto/
functions.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
5use crate::{ffi, X11DeviceManagerXI2, X11DeviceXI2, X11Surface};
6use glib::translate::*;
7
8/// Returns the device ID as seen by XInput2.
9///
10/// # Deprecated since 4.18
11///
12/// ## `device`
13/// a [`gdk::Device`][crate::gdk::Device]
14///
15/// # Returns
16///
17/// the XInput2 device ID
18#[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
19#[allow(deprecated)]
20#[doc(alias = "gdk_x11_device_get_id")]
21pub fn x11_device_get_id(device: &X11DeviceXI2) -> i32 {
22    skip_assert_initialized!();
23    unsafe { ffi::gdk_x11_device_get_id(device.to_glib_none().0) }
24}
25
26/// Returns the [`gdk::Device`][crate::gdk::Device] that wraps the given device ID.
27///
28/// # Deprecated since 4.18
29///
30/// ## `device_manager`
31/// a `GdkDeviceManager`
32/// ## `device_id`
33/// a device ID, as understood by the XInput2 protocol
34///
35/// # Returns
36///
37/// The
38///   [`gdk::Device`][crate::gdk::Device] wrapping the device ID, or [`None`] if the given ID
39///   doesn’t currently represent a device.
40#[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
41#[allow(deprecated)]
42#[doc(alias = "gdk_x11_device_manager_lookup")]
43pub fn x11_device_manager_lookup(
44    device_manager: &X11DeviceManagerXI2,
45    device_id: i32,
46) -> Option<X11DeviceXI2> {
47    skip_assert_initialized!();
48    unsafe {
49        from_glib_none(ffi::gdk_x11_device_manager_lookup(
50            device_manager.to_glib_none().0,
51            device_id,
52        ))
53    }
54}
55
56/// Routine to get the current X server time stamp.
57///
58/// # Deprecated since 4.18
59///
60/// ## `surface`
61/// a [`gdk::Surface`][crate::gdk::Surface], used for communication
62///   with the server. The surface must have `GDK_PROPERTY_CHANGE_MASK` in
63///   its events mask or a hang will result.
64///
65/// # Returns
66///
67/// the time stamp
68#[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
69#[allow(deprecated)]
70#[doc(alias = "gdk_x11_get_server_time")]
71pub fn x11_get_server_time(surface: &X11Surface) -> u32 {
72    skip_assert_initialized!();
73    unsafe { ffi::gdk_x11_get_server_time(surface.to_glib_none().0) }
74}
75
76/// Sets the `SM_CLIENT_ID` property on the application’s leader window so that
77/// the window manager can save the application’s state using the X11R6 ICCCM
78/// session management protocol.
79///
80/// See the X Session Management Library documentation for more information on
81/// session management and the Inter-Client Communication Conventions Manual
82/// ## `sm_client_id`
83/// the client id assigned by the session manager
84///    when the connection was opened, or [`None`] to remove the property.
85#[doc(alias = "gdk_x11_set_sm_client_id")]
86pub fn x11_set_sm_client_id(sm_client_id: Option<&str>) {
87    assert_initialized_main_thread!();
88    unsafe {
89        ffi::gdk_x11_set_sm_client_id(sm_client_id.to_glib_none().0);
90    }
91}