gdk4_wayland/auto/wayland_display.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#![allow(deprecated)]
5
6use crate::ffi;
7use glib::translate::*;
8
9glib::wrapper! {
10 /// The Wayland implementation of [`gdk::Display`][crate::gdk::Display].
11 ///
12 /// Beyond the regular [`gdk::Display`][crate::gdk::Display] API, the Wayland implementation
13 /// provides access to Wayland objects such as the `wl_display` with
14 /// [`wl_display()`][Self::wl_display()], the `wl_compositor` with
15 /// [`wl_compositor()`][Self::wl_compositor()].
16 ///
17 /// You can find out what Wayland globals are supported by a display
18 /// with [`query_registry()`][Self::query_registry()].
19 ///
20 /// # Implements
21 ///
22 /// [`trait@gdk::prelude::DisplayExt`]
23 #[doc(alias = "GdkWaylandDisplay")]
24 pub struct WaylandDisplay(Object<ffi::GdkWaylandDisplay, ffi::GdkWaylandDisplayClass>) @extends gdk::Display;
25
26 match fn {
27 type_ => || ffi::gdk_wayland_display_get_type(),
28 }
29}
30
31impl WaylandDisplay {
32 /// Gets the startup notification ID for a Wayland display, or [`None`]
33 /// if no ID has been defined.
34 ///
35 /// # Deprecated since 4.10
36 ///
37 ///
38 /// # Returns
39 ///
40 /// the startup notification ID for @self
41 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
42 #[allow(deprecated)]
43 #[doc(alias = "gdk_wayland_display_get_startup_notification_id")]
44 #[doc(alias = "get_startup_notification_id")]
45 pub fn startup_notification_id(&self) -> Option<glib::GString> {
46 unsafe {
47 from_glib_none(ffi::gdk_wayland_display_get_startup_notification_id(
48 self.to_glib_none().0,
49 ))
50 }
51 }
52
53 /// Returns [`true`] if the interface was found in the display
54 /// `wl_registry.global` handler.
55 /// ## `global`
56 /// global interface to query in the registry
57 ///
58 /// # Returns
59 ///
60 /// [`true`] if the global is offered by the compositor
61 #[doc(alias = "gdk_wayland_display_query_registry")]
62 pub fn query_registry(&self, global: &str) -> bool {
63 unsafe {
64 from_glib(ffi::gdk_wayland_display_query_registry(
65 self.to_glib_none().0,
66 global.to_glib_none().0,
67 ))
68 }
69 }
70
71 /// Sets the cursor theme for the given @self.
72 ///
73 /// # Deprecated since 4.16
74 ///
75 /// Use the cursor-related properties of
76 /// [GtkSettings](../gtk4/class.Settings.html) to set the cursor theme
77 /// ## `name`
78 /// the new cursor theme
79 /// ## `size`
80 /// the size to use for cursors
81 #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")]
82 #[allow(deprecated)]
83 #[doc(alias = "gdk_wayland_display_set_cursor_theme")]
84 pub fn set_cursor_theme(&self, name: &str, size: i32) {
85 unsafe {
86 ffi::gdk_wayland_display_set_cursor_theme(
87 self.to_glib_none().0,
88 name.to_glib_none().0,
89 size,
90 );
91 }
92 }
93
94 /// Sets the startup notification ID for a display.
95 ///
96 /// This is usually taken from the value of the `DESKTOP_STARTUP_ID`
97 /// environment variable, but in some cases (such as the application not
98 /// being launched using exec()) it can come from other sources.
99 ///
100 /// The startup ID is also what is used to signal that the startup is
101 /// complete (for example, when opening a window or when calling
102 /// `Gdk::Display::notify_startup_complete()`).
103 ///
104 /// # Deprecated since 4.10
105 ///
106 /// Use [`ToplevelExtManual::set_startup_id()`][crate::gdk::prelude::ToplevelExtManual::set_startup_id()]
107 /// ## `startup_id`
108 /// the startup notification ID (must be valid utf8)
109 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
110 #[allow(deprecated)]
111 #[doc(alias = "gdk_wayland_display_set_startup_notification_id")]
112 pub fn set_startup_notification_id(&self, startup_id: &str) {
113 unsafe {
114 ffi::gdk_wayland_display_set_startup_notification_id(
115 self.to_glib_none().0,
116 startup_id.to_glib_none().0,
117 );
118 }
119 }
120}