gdk4-wayland-0.8.1/.cargo_vcs_info.json0000644000000001520000000000100133260ustar { "git": { "sha1": "05d26f6a97a0ccf856b565b4fd796cdf57059084" }, "path_in_vcs": "gdk4-wayland" }gdk4-wayland-0.8.1/COPYRIGHT000064400000000000000000000012131046102023000134100ustar 00000000000000The gtk-rs Project is licensed under the MIT license, see the LICENSE file or . Copyrights in the gtk-rs Project project are retained by their contributors. No copyright assignment is required to contribute to the gtk-rs Project project. For full authorship information, see the version control history. This project provides interoperability with various GNOME libraries but doesn't distribute any parts of them. Distributing compiled libraries and executables that link to those libraries may be subject to terms of the GNU LGPL or other licenses. For more information check the license of each GNOME library. gdk4-wayland-0.8.1/Cargo.toml0000644000000036710000000000100113350ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" rust-version = "1.70" name = "gdk4-wayland" version = "0.8.1" authors = ["The gtk-rs Project Developers"] description = "Rust bindings of the GDK 4 Wayland library" homepage = "https://gtk-rs.org/gtk4-rs" documentation = "https://gtk-rs.org/gtk4-rs/stable/latest/docs/gdk4_wayland/" readme = "README.md" keywords = [ "gdk4", "gdk4-wayland", "gtk-rs", "gnome", "GUI", ] categories = [ "api-bindings", "gui", ] license = "MIT" repository = "https://github.com/gtk-rs/gtk4-rs" [package.metadata.docs.rs] all-features = true rustc-args = [ "--cfg", "docsrs", ] rustdoc-args = [ "--cfg", "docsrs", "--generate-link-to-definition", ] [dependencies.ffi] version = "0.8" package = "gdk4-wayland-sys" [dependencies.gdk] version = "0.8" package = "gdk4" [dependencies.gio] version = "0.19" features = ["v2_66"] [dependencies.glib] version = "0.19" features = ["v2_66"] [dependencies.khronos-egl] version = "6.0" optional = true [dependencies.libc] version = "0.2" [dependencies.wayland-backend] version = "0.3.0" features = ["client_system"] optional = true [dependencies.wayland-client] version = "0.31.0" optional = true [dev-dependencies.gir-format-check] version = "^0.1" [features] egl = ["khronos-egl"] v4_10 = [ "ffi/v4_10", "v4_4", "gdk/v4_10", ] v4_12 = [ "ffi/v4_12", "v4_10", "gdk/v4_12", ] v4_4 = [ "ffi/v4_4", "gdk/v4_4", ] wayland_crate = [ "wayland-client", "wayland-backend", ] gdk4-wayland-0.8.1/Cargo.toml.orig000064400000000000000000000023231046102023000150070ustar 00000000000000[package] name = "gdk4-wayland" description = "Rust bindings of the GDK 4 Wayland library" documentation = "https://gtk-rs.org/gtk4-rs/stable/latest/docs/gdk4_wayland/" keywords = ["gdk4", "gdk4-wayland", "gtk-rs", "gnome", "GUI"] readme = "README.md" authors.workspace = true categories.workspace = true edition.workspace = true homepage.workspace = true license.workspace = true repository.workspace = true rust-version.workspace = true version.workspace = true [features] v4_4 = ["ffi/v4_4", "gdk/v4_4"] v4_10 = ["ffi/v4_10", "v4_4", "gdk/v4_10"] v4_12 = ["ffi/v4_12", "v4_10", "gdk/v4_12"] wayland_crate = ["wayland-client", "wayland-backend"] egl = ["khronos-egl"] [dependencies] ffi = {path = "./sys", package = "gdk4-wayland-sys", version = "0.8"} gdk.workspace= true gio.workspace = true glib.workspace = true libc.workspace = true wayland-client = {version = "0.31.0", optional = true} wayland-backend = {version = "0.3.0", optional = true, features = ["client_system"]} khronos-egl = {version = "6.0", optional = true} [dev-dependencies] gir-format-check.workspace = true [package.metadata.docs.rs] all-features = true rustc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] gdk4-wayland-0.8.1/Gir.toml000064400000000000000000000043411046102023000135400ustar 00000000000000[options] girs_directories = ["../gir-files"] library = "GdkWayland" version = "4.0" min_cfg_version = "4.0.0" target_path = "." work_mode = "normal" use_gi_docgen = true single_version_file = true generate_safety_asserts = true deprecate_by_min_version = true trust_return_value_nullability = true generate = [ "GdkWayland.WaylandGLContext", "GdkWayland.WaylandPopup", ] manual = [ "Gdk.DrawContext", "Gdk.InputSource", # docs only "Gdk.Popup", "Gdk.Toplevel", ] [[object]] name = "Gdk.Device" status = "manual" final_type = false [[object]] name = "Gdk.Display" status = "manual" final_type = false [[object.function]] name = "notify_startup_complete" ignore = true # docs only, otherwise it gets picked as ExtManual [[object]] name = "Gdk.GLContext" status = "manual" final_type = false [[object]] name = "Gdk.Monitor" status = "manual" final_type = false [[object]] name = "Gdk.Seat" status = "manual" final_type = false [[object]] name = "Gdk.Surface" status = "manual" final_type = false [[object]] name = "GdkWayland.WaylandDevice" status = "generate" [[object.function]] name = "get_wl_keyboard" manual = true [[object.function]] name = "get_wl_pointer" manual = true [[object.function]] name = "get_wl_seat" manual = true [[object.function]] name = "get_xkb_keymap" ignore = true [[object]] name = "GdkWayland.WaylandDisplay" status = "generate" [[object.function]] name = "get_egl_display" manual = true [[object.function]] name = "get_wl_compositor" manual = true [[object.function]] name = "get_wl_display" manual = true [[object]] name = "GdkWayland.WaylandMonitor" status = "generate" [[object.function]] name = "get_wl_output" manual = true [[object]] name = "GdkWayland.WaylandSeat" status = "generate" [[object.function]] name = "get_wl_seat" manual = true [[object]] name = "GdkWayland.WaylandSurface" status = "generate" manual_traits = ["WaylandSurfaceExtManual"] [[object.function]] name = "get_wl_surface" rename = "wl_surface" manual = true [[object]] name = "GdkWayland.WaylandToplevel" status = "generate" [[object.function]] name = "export_handle" manual = truegdk4-wayland-0.8.1/LICENSE000064400000000000000000000020001046102023000131150ustar 00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. gdk4-wayland-0.8.1/README.md000064400000000000000000000041141046102023000133770ustar 00000000000000# Rust GDK 4 Wayland bindings The project website is [here](https://gtk-rs.org/). Rust bindings of [GDK 4's Wayland backend](https://docs.gtk.org/gdk4-wayland/), part of [gtk4-rs](https://github.com/gtk-rs/gtk4-rs/). GDK is an intermediate layer that isolates GTK from the details of the windowing system. GDK Wayland contains functions specific to the Wayland backend. ## Minimum supported Rust version Currently, the minimum supported Rust version is `1.70`. ## Documentation - The Rust API [Stable](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gdk4_wayland/)/[Development](https://gtk-rs.org/gtk4-rs/git/docs/gdk4_wayland/) - [The C API](https://docs.gtk.org/gdk4-wayland/) - [GTK Installation instructions](https://www.gtk.org/docs/installations/) ## Using We recommend using [crates from crates.io](https://crates.io/keywords/gtk-rs), as [demonstrated here](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/index.html#library-versions). If you want to track the bleeding edge, use the git dependency instead: ```toml [dependencies] gdk-wayland = { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gdk4-wayland" } ``` Avoid mixing versioned and git crates like this: ```toml # This will not compile [dependencies] gdk-x11 = {version = "0.1", package = "gdk4-x11"} gdk-wayland = { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gdk4-wayland" } ``` ### Features | Feature | Description | | --- | ----------- | | `v4_12` | Enable the new APIs part of GTK 4.12 | | `v4_10` | Enable the new APIs part of GTK 4.10 | | `v4_4` | Enable the new APIs part of GTK 4.4 | | `wayland_crate` | Integration with the [wayland-client](https://crates.io/crates/wayland-client) crate | | `egl` | Integration with the [khronos-egl](https://crates.io/crates/khronos-egl) crate | ### See Also - [glib](https://crates.io/crates/glib) - [gio](https://crates.io/crates/gio) - [gsk4](https://crates.io/crates/gsk4) - [gdk4](https://crates.io/crates/gdk4) - [gtk4](https://crates.io/crates/gtk4) ## License The Rust bindings of __gdk4-wayland__ are available under the MIT License, please refer to it. gdk4-wayland-0.8.1/src/auto/mod.rs000064400000000000000000000012521046102023000150040ustar 00000000000000// 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 mod wayland_device; pub use self::wayland_device::WaylandDevice; mod wayland_display; pub use self::wayland_display::WaylandDisplay; mod wayland_gl_context; pub use self::wayland_gl_context::WaylandGLContext; mod wayland_monitor; pub use self::wayland_monitor::WaylandMonitor; mod wayland_popup; pub use self::wayland_popup::WaylandPopup; mod wayland_seat; pub use self::wayland_seat::WaylandSeat; mod wayland_surface; pub use self::wayland_surface::WaylandSurface; mod wayland_toplevel; pub use self::wayland_toplevel::WaylandToplevel; gdk4-wayland-0.8.1/src/auto/versions.txt000064400000000000000000000002041046102023000162640ustar 00000000000000Generated by gir (https://github.com/gtk-rs/gir @ c537d4a59043) from gir-files (https://github.com/gtk-rs/gir-files @ 2437ecd9a33d) gdk4-wayland-0.8.1/src/auto/wayland_device.rs000064400000000000000000000012511046102023000172020ustar 00000000000000// 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::*; glib::wrapper! { #[doc(alias = "GdkWaylandDevice")] pub struct WaylandDevice(Object) @extends gdk::Device; match fn { type_ => || ffi::gdk_wayland_device_get_type(), } } impl WaylandDevice { #[doc(alias = "gdk_wayland_device_get_node_path")] #[doc(alias = "get_node_path")] pub fn node_path(&self) -> Option { unsafe { from_glib_none(ffi::gdk_wayland_device_get_node_path(self.to_glib_none().0)) } } } gdk4-wayland-0.8.1/src/auto/wayland_display.rs000064400000000000000000000036451046102023000174210ustar 00000000000000// 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 #![allow(deprecated)] use glib::translate::*; glib::wrapper! { #[doc(alias = "GdkWaylandDisplay")] pub struct WaylandDisplay(Object) @extends gdk::Display; match fn { type_ => || ffi::gdk_wayland_display_get_type(), } } impl WaylandDisplay { #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] #[doc(alias = "gdk_wayland_display_get_startup_notification_id")] #[doc(alias = "get_startup_notification_id")] pub fn startup_notification_id(&self) -> Option { unsafe { from_glib_none(ffi::gdk_wayland_display_get_startup_notification_id( self.to_glib_none().0, )) } } #[doc(alias = "gdk_wayland_display_query_registry")] pub fn query_registry(&self, global: &str) -> bool { unsafe { from_glib(ffi::gdk_wayland_display_query_registry( self.to_glib_none().0, global.to_glib_none().0, )) } } #[doc(alias = "gdk_wayland_display_set_cursor_theme")] pub fn set_cursor_theme(&self, name: &str, size: i32) { unsafe { ffi::gdk_wayland_display_set_cursor_theme( self.to_glib_none().0, name.to_glib_none().0, size, ); } } #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] #[doc(alias = "gdk_wayland_display_set_startup_notification_id")] pub fn set_startup_notification_id(&self, startup_id: &str) { unsafe { ffi::gdk_wayland_display_set_startup_notification_id( self.to_glib_none().0, startup_id.to_glib_none().0, ); } } } gdk4-wayland-0.8.1/src/auto/wayland_gl_context.rs000064400000000000000000000006771046102023000201240ustar 00000000000000// 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 glib::wrapper! { #[doc(alias = "GdkWaylandGLContext")] pub struct WaylandGLContext(Object) @extends gdk::GLContext, gdk::DrawContext; match fn { type_ => || ffi::gdk_wayland_gl_context_get_type(), } } impl WaylandGLContext {} gdk4-wayland-0.8.1/src/auto/wayland_monitor.rs000064400000000000000000000006361046102023000174400ustar 00000000000000// 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 glib::wrapper! { #[doc(alias = "GdkWaylandMonitor")] pub struct WaylandMonitor(Object) @extends gdk::Monitor; match fn { type_ => || ffi::gdk_wayland_monitor_get_type(), } } impl WaylandMonitor {} gdk4-wayland-0.8.1/src/auto/wayland_popup.rs000064400000000000000000000006731046102023000171150ustar 00000000000000// 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::WaylandSurface; glib::wrapper! { #[doc(alias = "GdkWaylandPopup")] pub struct WaylandPopup(Object) @extends WaylandSurface, gdk::Surface, @implements gdk::Popup; match fn { type_ => || ffi::gdk_wayland_popup_get_type(), } } impl WaylandPopup {} gdk4-wayland-0.8.1/src/auto/wayland_seat.rs000064400000000000000000000006111046102023000166760ustar 00000000000000// 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 glib::wrapper! { #[doc(alias = "GdkWaylandSeat")] pub struct WaylandSeat(Object) @extends gdk::Seat; match fn { type_ => || ffi::gdk_wayland_seat_get_type(), } } impl WaylandSeat {} gdk4-wayland-0.8.1/src/auto/wayland_surface.rs000064400000000000000000000006761046102023000174050ustar 00000000000000// 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 glib::wrapper! { #[doc(alias = "GdkWaylandSurface")] pub struct WaylandSurface(Object) @extends gdk::Surface; match fn { type_ => || ffi::gdk_wayland_surface_get_type(), } } impl WaylandSurface { pub const NONE: Option<&'static WaylandSurface> = None; } gdk4-wayland-0.8.1/src/auto/wayland_toplevel.rs000064400000000000000000000035241046102023000176020ustar 00000000000000// 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 #![allow(deprecated)] use crate::WaylandSurface; use glib::translate::*; glib::wrapper! { #[doc(alias = "GdkWaylandToplevel")] pub struct WaylandToplevel(Object) @extends WaylandSurface, gdk::Surface, @implements gdk::Toplevel; match fn { type_ => || ffi::gdk_wayland_toplevel_get_type(), } } impl WaylandToplevel { #[cfg(feature = "v4_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))] #[doc(alias = "gdk_wayland_toplevel_drop_exported_handle")] pub fn drop_exported_handle(&self, handle: &str) { unsafe { ffi::gdk_wayland_toplevel_drop_exported_handle( self.to_glib_none().0, handle.to_glib_none().0, ); } } #[doc(alias = "gdk_wayland_toplevel_set_application_id")] pub fn set_application_id(&self, application_id: &str) { unsafe { ffi::gdk_wayland_toplevel_set_application_id( self.to_glib_none().0, application_id.to_glib_none().0, ); } } #[doc(alias = "gdk_wayland_toplevel_set_transient_for_exported")] pub fn set_transient_for_exported(&self, parent_handle_str: &str) -> bool { unsafe { from_glib(ffi::gdk_wayland_toplevel_set_transient_for_exported( self.to_glib_none().0, parent_handle_str.to_glib_none().0, )) } } #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")] #[allow(deprecated)] #[doc(alias = "gdk_wayland_toplevel_unexport_handle")] pub fn unexport_handle(&self) { unsafe { ffi::gdk_wayland_toplevel_unexport_handle(self.to_glib_none().0); } } } gdk4-wayland-0.8.1/src/lib.rs000064400000000000000000000011741046102023000140260ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #![doc = include_str!("../README.md")] #![cfg_attr(docsrs, feature(doc_cfg))] pub use ffi; pub use gdk; pub use gio; pub use glib; #[cfg(all(feature = "v4_4", feature = "egl"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))] pub use khronos_egl; #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub use wayland_client; mod auto; pub mod prelude; pub use auto::*; mod wayland_device; mod wayland_display; mod wayland_monitor; mod wayland_seat; mod wayland_surface; mod wayland_toplevel; gdk4-wayland-0.8.1/src/prelude.rs000064400000000000000000000003751046102023000147220ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. // rustdoc-stripper-ignore-next //! Traits intended for blanket imports. #[doc(hidden)] pub use gdk::prelude::*; pub use crate::wayland_surface::WaylandSurfaceExtManual; gdk4-wayland-0.8.1/src/wayland_device.rs000064400000000000000000000054261046102023000162420ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use glib::translate::*; #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use wayland_client::{ backend::ObjectId, protocol::{wl_keyboard::WlKeyboard, wl_pointer::WlPointer, wl_seat::WlSeat}, Proxy, }; #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use crate::prelude::*; use crate::WaylandDevice; impl WaylandDevice { #[doc(alias = "gdk_wayland_device_get_wl_keyboard")] #[doc(alias = "get_wl_keyboard")] #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_keyboard(&self) -> Option { let display = self.display().downcast::().unwrap(); unsafe { let keyboard_ptr = ffi::gdk_wayland_device_get_wl_keyboard(self.to_glib_none().0); if keyboard_ptr.is_null() { None } else { let cnx = display.connection(); let id = ObjectId::from_ptr(WlKeyboard::interface(), keyboard_ptr as *mut _).unwrap(); WlKeyboard::from_id(&cnx, id).ok() } } } #[doc(alias = "gdk_wayland_device_get_wl_pointer")] #[doc(alias = "get_wl_pointer")] #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_pointer(&self) -> Option { let display = self.display().downcast::().unwrap(); unsafe { let pointer_ptr = ffi::gdk_wayland_device_get_wl_pointer(self.to_glib_none().0); if pointer_ptr.is_null() { None } else { let cnx = display.connection(); let id = ObjectId::from_ptr(WlPointer::interface(), pointer_ptr as *mut _).unwrap(); WlPointer::from_id(&cnx, id).ok() } } } #[doc(alias = "gdk_wayland_device_get_wl_seat")] #[doc(alias = "get_wl_seat")] #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_seat(&self) -> Option { let display = self.display().downcast::().unwrap(); unsafe { let seat_ptr = ffi::gdk_wayland_device_get_wl_seat(self.to_glib_none().0); if seat_ptr.is_null() { None } else { let cnx = display.connection(); let id = ObjectId::from_ptr(WlSeat::interface(), seat_ptr as *mut _).unwrap(); WlSeat::from_id(&cnx, id).ok() } } } } gdk4-wayland-0.8.1/src/wayland_display.rs000064400000000000000000000067261046102023000164540ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use glib::{prelude::*, translate::*, Quark}; #[cfg(all(feature = "v4_4", feature = "egl"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))] use khronos_egl as egl; #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use wayland_client::{ backend::ObjectId, protocol::{wl_compositor::WlCompositor, wl_display::WlDisplay}, Proxy, }; use crate::WaylandDisplay; impl WaylandDisplay { #[cfg(all(feature = "v4_4", feature = "egl"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))] #[doc(alias = "gdk_wayland_display_get_egl_display")] #[doc(alias = "get_egl_display")] pub fn egl_display(&self) -> Option { unsafe { let ptr = ffi::gdk_wayland_display_get_egl_display(self.to_glib_none().0); if ptr.is_null() { None } else { Some(egl::Display::from_ptr(ptr)) } } } #[doc(alias = "gdk_wayland_display_get_wl_compositor")] #[doc(alias = "get_wl_compositor")] #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_compositor(&self) -> Option { unsafe { let compositor_ptr = ffi::gdk_wayland_display_get_wl_compositor(self.to_glib_none().0); if compositor_ptr.is_null() { None } else { let cnx = self.connection(); let id = ObjectId::from_ptr(WlCompositor::interface(), compositor_ptr as *mut _) .unwrap(); WlCompositor::from_id(&cnx, id).ok() } } } #[doc(alias = "gdk_wayland_display_get_wl_display")] #[doc(alias = "get_wl_display")] #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_display(&self) -> Option { unsafe { let display_ptr = ffi::gdk_wayland_display_get_wl_display(self.to_glib_none().0); if display_ptr.is_null() { None } else { let cnx = self.connection(); let id = ObjectId::from_ptr(WlDisplay::interface(), display_ptr as *mut _).unwrap(); WlDisplay::from_id(&cnx, id).ok() } } } #[cfg(feature = "wayland_crate")] pub(crate) fn connection(&self) -> wayland_client::Connection { use std::sync::OnceLock; static QUARK: OnceLock = OnceLock::new(); let quark = *QUARK.get_or_init(|| Quark::from_str("gtk-rs-wayland-display-connection-quark")); unsafe { match self.qdata::>(quark) { Some(conn) => conn.as_ref().clone().unwrap(), None => { let display_ptr = ffi::gdk_wayland_display_get_wl_display(self.to_glib_none().0); let backend = wayland_backend::sys::client::Backend::from_foreign_display( display_ptr as *mut _, ); let conn = wayland_client::Connection::from_backend(backend); self.set_qdata(quark, conn.clone()); conn } } } } } gdk4-wayland-0.8.1/src/wayland_monitor.rs000064400000000000000000000022341046102023000164640ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use wayland_client::{backend::ObjectId, protocol::wl_output::WlOutput, Proxy}; #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use {crate::prelude::*, glib::translate::*}; use crate::WaylandMonitor; impl WaylandMonitor { #[doc(alias = "gdk_wayland_monitor_get_wl_output")] #[doc(alias = "get_wl_output")] #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_output(&self) -> Option { let display = self.display().downcast::().unwrap(); unsafe { let output_ptr = ffi::gdk_wayland_monitor_get_wl_output(self.to_glib_none().0); if output_ptr.is_null() { None } else { let cnx = display.connection(); let id = ObjectId::from_ptr(WlOutput::interface(), output_ptr as *mut _).unwrap(); WlOutput::from_id(&cnx, id).ok() } } } } gdk4-wayland-0.8.1/src/wayland_seat.rs000064400000000000000000000021701046102023000157300ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use wayland_client::{backend::ObjectId, protocol::wl_seat::WlSeat, Proxy}; #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use {crate::prelude::*, glib::translate::*}; use crate::WaylandSeat; impl WaylandSeat { #[doc(alias = "gdk_wayland_seat_get_wl_seat")] #[doc(alias = "get_wl_seat")] #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_seat(&self) -> Option { let display = self.display().downcast::().unwrap(); unsafe { let seat_ptr = ffi::gdk_wayland_seat_get_wl_seat(self.to_glib_none().0); if seat_ptr.is_null() { None } else { let cnx = display.connection(); let id = ObjectId::from_ptr(WlSeat::interface(), seat_ptr as *mut _).unwrap(); WlSeat::from_id(&cnx, id).ok() } } } } gdk4-wayland-0.8.1/src/wayland_surface.rs000064400000000000000000000031331046102023000164240ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use glib::translate::*; #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use wayland_client::{backend::ObjectId, protocol::wl_surface::WlSurface, Proxy}; use crate::{prelude::*, WaylandSurface}; mod sealed { pub trait Sealed {} impl> Sealed for T {} } // rustdoc-stripper-ignore-next /// Trait containing manually implemented methods of /// [`WaylandSurface`](crate::WaylandSurface). pub trait WaylandSurfaceExtManual: sealed::Sealed + IsA + 'static { #[doc(alias = "gdk_wayland_surface_get_wl_surface")] #[doc(alias = "get_wl_surface")] #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] fn wl_surface(&self) -> Option { let display = self .as_ref() .display() .downcast::() .unwrap(); unsafe { let surface_ptr = ffi::gdk_wayland_surface_get_wl_surface(self.as_ref().to_glib_none().0); if surface_ptr.is_null() { None } else { let cnx = display.connection(); let id = ObjectId::from_ptr(WlSurface::interface(), surface_ptr as *mut _).unwrap(); WlSurface::from_id(&cnx, id).ok() } } } } impl> WaylandSurfaceExtManual for O {} gdk4-wayland-0.8.1/src/wayland_toplevel.rs000064400000000000000000000036141046102023000166320ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::WaylandToplevel; use glib::translate::*; use std::boxed::Box as Box_; impl WaylandToplevel { #[doc(alias = "gdk_wayland_toplevel_export_handle")] pub fn export_handle) + 'static>( &self, callback: P, ) -> bool { let callback_data: Box_

= Box_::new(callback); unsafe extern "C" fn callback_func< P: Fn(&WaylandToplevel, Result<&str, glib::BoolError>) + 'static, >( toplevel: *mut ffi::GdkWaylandToplevel, handle: *const libc::c_char, user_data: glib::ffi::gpointer, ) { let toplevel = from_glib_borrow(toplevel); let handle: Borrowed> = from_glib_borrow(handle); let callback = &*(user_data as *mut P); if let Some(handle) = handle.as_ref() { (*callback)(&toplevel, Ok(handle.as_str())) } else { (*callback)(&toplevel, Err(glib::bool_error!("Failed to export a handle. The compositor probably doesn't implement the xdg-foreign protocol"))) } } let callback = Some(callback_func::

as _); unsafe extern "C" fn destroy_func_func< P: Fn(&WaylandToplevel, Result<&str, glib::BoolError>) + 'static, >( data: glib::ffi::gpointer, ) { let _callback = Box_::from_raw(data as *mut P); } let destroy_call3 = Some(destroy_func_func::

as _); let super_callback0: Box_

= callback_data; unsafe { from_glib(ffi::gdk_wayland_toplevel_export_handle( self.to_glib_none().0, callback, Box_::into_raw(super_callback0) as *mut _, destroy_call3, )) } } } gdk4-wayland-0.8.1/tests/check_gir.rs000064400000000000000000000003461046102023000155510ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); println!("{res}"); assert_eq!(res.nb_errors, 0); }