gdk4_x11/auto/
functions.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
// 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, X11DeviceManagerXI2, X11DeviceXI2, X11Surface};
use glib::translate::*;

/// Returns the device ID as seen by XInput2.
/// ## `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: &X11DeviceXI2) -> 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 `GdkDeviceManager`
/// ## `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: &X11DeviceManagerXI2,
    device_id: i32,
) -> Option<X11DeviceXI2> {
    skip_assert_initialized!();
    unsafe {
        from_glib_none(ffi::gdk_x11_device_manager_lookup(
            device_manager.to_glib_none().0,
            device_id,
        ))
    }
}

/// Routine to get the current X server time stamp.
/// ## `surface`
/// a [`gdk::Surface`][crate::gdk::Surface], used for communication
///   with the server. The surface 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(surface: &X11Surface) -> u32 {
    skip_assert_initialized!();
    unsafe { ffi::gdk_x11_get_server_time(surface.to_glib_none().0) }
}

/// 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);
    }
}