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
// 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 glib::translate::*;
use std::fmt;

glib::wrapper! {
    /// The Wayland implementation of [`gdk::Device`][crate::gdk::Device].
    ///
    /// Beyond the regular [`gdk::Device`][crate::gdk::Device] API, the Wayland implementation
    /// provides access to Wayland objects such as the `wl_seat` with
    /// [`wl_seat()`][Self::wl_seat()], the `wl_keyboard` with
    /// [`wl_keyboard()`][Self::wl_keyboard()] and the `wl_pointer` with
    /// [`wl_pointer()`][Self::wl_pointer()].
    ///
    /// # Implements
    ///
    /// [`trait@gdk::prelude::DeviceExt`]
    #[doc(alias = "GdkWaylandDevice")]
    pub struct WaylandDevice(Object<ffi::GdkWaylandDevice, ffi::GdkWaylandDeviceClass>) @extends gdk::Device;

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

impl WaylandDevice {
    /// Returns the `/dev/input/event*` path of this device.
    ///
    /// For [`gdk::Device`][crate::gdk::Device]s that possibly coalesce multiple hardware
    /// devices (eg. mouse, keyboard, touch,...), this function
    /// will return [`None`].
    ///
    /// This is most notably implemented for devices of type
    /// [`gdk::InputSource::Pen`][crate::gdk::InputSource::Pen], [`gdk::InputSource::TabletPad`][crate::gdk::InputSource::TabletPad].
    ///
    /// # Returns
    ///
    /// the `/dev/input/event*`
    ///   path of this device
    #[doc(alias = "gdk_wayland_device_get_node_path")]
    #[doc(alias = "get_node_path")]
    pub fn node_path(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::gdk_wayland_device_get_node_path(self.to_glib_none().0)) }
    }
}

impl fmt::Display for WaylandDevice {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("WaylandDevice")
    }
}