gdk_wayland_sys/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg))]
2
3use gdk::{GdkAtom, GdkDevicePadFeature};
4use glib::{gpointer, GType};
5use libc::{c_char, c_int, c_uint};
6
7macro_rules! opaque {
8    ($(#[$attr:meta])*
9     $name:ident) => {
10        // https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
11        $(#[$attr])*
12        #[repr(C)]
13        pub struct $name {
14            _data: [u8; 0],
15            _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
16        }
17        $(#[$attr])*
18        impl ::std::fmt::Debug for $name {
19            fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
20                write!(f, "{} @ {:?}", stringify!($name), self as *const _)
21            }
22        }
23    };
24}
25
26opaque!(GdkWaylandDevice);
27opaque!(GdkWaylandDisplay);
28opaque!(GdkWaylandGLContext);
29opaque!(GdkWaylandMonitor);
30opaque!(GdkWaylandWindow);
31opaque!(GdkWaylandSeat);
32
33extern "C" {
34    //=========================================================================
35    // GdkWaylandWindow
36    //=========================================================================
37    pub fn gdk_wayland_window_get_type() -> GType;
38
39    pub fn gdk_wayland_window_get_wl_surface(window: *mut GdkWaylandWindow) -> gpointer;
40
41    pub fn gdk_wayland_window_set_use_custom_surface(window: *mut GdkWaylandWindow);
42
43    pub fn gdk_wayland_window_set_dbus_properties_libgtk_only(
44        window: *mut GdkWaylandWindow,
45        application_id: *const c_char,
46        app_menu_path: *const c_char,
47        menubar_path: *const c_char,
48        window_object_path: *const c_char,
49        application_object_path: *const c_char,
50        unique_bus_name: *const c_char,
51    );
52
53    pub fn gdk_wayland_selection_add_targets(
54        window: *mut GdkWaylandWindow,
55        selection: GdkAtom,
56        ntargets: c_uint,
57        targets: *mut GdkAtom,
58    );
59
60    pub fn gdk_wayland_window_unexport_handle(window: *mut GdkWaylandWindow);
61
62    pub fn gdk_wayland_window_export_handle(
63        window: *mut GdkWaylandWindow,
64        cb: Option<unsafe extern "C" fn(*mut GdkWaylandWindow, *const c_char, *mut libc::c_void)>,
65        user_data: *mut libc::c_void,
66        destroy_notify: Option<unsafe extern "C" fn(*mut libc::c_void)>,
67    ) -> glib::gboolean;
68
69    pub fn gdk_wayland_window_set_transient_for_exported(
70        window: *mut GdkWaylandWindow,
71        parent_handle: *const c_char,
72    ) -> glib::gboolean;
73
74    #[cfg(feature = "v3_24_22")]
75    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24_22")))]
76    pub fn gdk_wayland_window_set_application_id(
77        window: *mut GdkWaylandWindow,
78        application_id: *const c_char,
79    ) -> glib::gboolean;
80
81    pub fn gdk_wayland_window_announce_csd(window: *mut GdkWaylandWindow);
82
83    #[cfg(feature = "v3_24")]
84    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
85    pub fn gdk_wayland_window_announce_ssd(window: *mut GdkWaylandWindow);
86
87    #[cfg(feature = "v3_24")]
88    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
89    pub fn gdk_wayland_window_add_frame_callback_surface(
90        window: *mut GdkWaylandWindow,
91        surface: glib::gconstpointer,
92    );
93
94    #[cfg(feature = "v3_24")]
95    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
96    pub fn gdk_wayland_window_remove_frame_callback_surface(
97        window: *mut GdkWaylandWindow,
98        surface: glib::gconstpointer,
99    );
100
101    //=========================================================================
102    // GdkWaylandDevice
103    //=========================================================================
104    pub fn gdk_wayland_device_get_type() -> GType;
105
106    pub fn gdk_wayland_device_get_wl_seat(device: *mut GdkWaylandDevice) -> gpointer;
107
108    pub fn gdk_wayland_device_get_wl_pointer(device: *mut GdkWaylandDevice) -> gpointer;
109
110    pub fn gdk_wayland_device_get_wl_keyboard(device: *mut GdkWaylandDevice) -> gpointer;
111
112    pub fn gdk_wayland_device_get_node_path(device: *mut GdkWaylandDevice) -> *const c_char;
113
114    pub fn gdk_wayland_device_pad_set_feedback(
115        device: *mut GdkWaylandDevice,
116        element: GdkDevicePadFeature,
117        idx: c_uint,
118        label: *const c_char,
119    );
120
121    //=========================================================================
122    // GdkWaylandDisplay
123    //=========================================================================
124    pub fn gdk_wayland_display_get_type() -> GType;
125
126    pub fn gdk_wayland_display_set_cursor_theme(
127        display: *mut GdkWaylandDisplay,
128        theme: *const c_char,
129        size: c_int,
130    );
131
132    pub fn gdk_wayland_display_get_wl_display(display: *mut GdkWaylandDisplay) -> gpointer;
133
134    pub fn gdk_wayland_display_get_wl_compositor(display: *mut GdkWaylandDisplay) -> gpointer;
135
136    pub fn gdk_wayland_display_set_startup_notification_id(
137        display: *mut GdkWaylandDisplay,
138        startup_id: *const c_char,
139    );
140
141    pub fn gdk_wayland_display_prefers_ssd(display: *mut GdkWaylandDisplay) -> glib::gboolean;
142
143    pub fn gdk_wayland_display_query_registry(
144        display: *mut GdkWaylandDisplay,
145        global: *const c_char,
146    ) -> glib::gboolean;
147
148    //=========================================================================
149    // GdkWaylandGLContext
150    //=========================================================================
151    pub fn gdk_wayland_gl_context_get_type() -> GType;
152
153    //=========================================================================
154    // GdkWaylandSeat
155    //=========================================================================
156    pub fn gdk_wayland_seat_get_type() -> GType;
157
158    pub fn gdk_wayland_seat_get_wl_seat(seat: *mut GdkWaylandSeat) -> gpointer;
159
160    //=========================================================================
161    // GdkWaylandMonitor
162    //=========================================================================
163    pub fn gdk_wayland_monitor_get_type() -> GType;
164
165    pub fn gdk_wayland_monitor_get_wl_output(monitor: *mut GdkWaylandMonitor) -> gpointer;
166}