From 379091c9b3230f0e9878c2be95c63cf9d443fe27 Mon Sep 17 00:00:00 2001 From: PolyMeilex Date: Thu, 26 Dec 2024 00:47:51 +0100 Subject: [PATCH] Update to wayland-rs git --- Cargo.toml | 12 +++++- src/wayland/mod.rs | 42 ------------------- src/wayland/selection/device.rs | 3 +- .../selection/ext_data_control/device.rs | 2 +- src/wayland/selection/ext_data_control/mod.rs | 26 ++++++------ .../selection/ext_data_control/source.rs | 2 +- src/wayland/selection/offer.rs | 6 +-- src/wayland/selection/source.rs | 2 +- 8 files changed, 30 insertions(+), 65 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4d47576f2351..2f059471109a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,6 @@ wayland-protocols-misc = { version = "0.3.1", features = ["server"], optional = wayland-server = { version = "0.31.0", optional = true } wayland-sys = { version = "0.31", optional = true } wayland-backend = { version = "0.3.5", optional = true } -wayland-scanner = { version = "0.31.5" } winit = { version = "0.30.0", default-features = false, features = ["wayland", "wayland-dlopen", "x11", "rwh_06"], optional = true } x11rb = { version = "0.13.0", optional = true } xkbcommon = { version = "0.8.0", features = ["wayland"]} @@ -72,6 +71,17 @@ profiling = "1.0.13" smallvec = "1.11" pixman = { version = "0.2.0", features = ["drm-fourcc", "sync"], optional = true } +[patch.crates-io] +wayland-egl = { git = "https://github.com/Smithay/wayland-rs.git" } +wayland-protocols = { git = "https://github.com/Smithay/wayland-rs.git" } +wayland-protocols-wlr = { git = "https://github.com/Smithay/wayland-rs.git" } +wayland-protocols-misc = { git = "https://github.com/Smithay/wayland-rs.git" } +wayland-server = { git = "https://github.com/Smithay/wayland-rs.git" } +wayland-cursor = { git = "https://github.com/Smithay/wayland-rs.git" } +wayland-client = { git = "https://github.com/Smithay/wayland-rs.git" } +wayland-sys = { git = "https://github.com/Smithay/wayland-rs.git" } +wayland-backend = { git = "https://github.com/Smithay/wayland-rs.git" } +wayland-scanner = { git = "https://github.com/Smithay/wayland-rs.git" } [dev-dependencies] clap = { version = "4", features = ["derive"] } diff --git a/src/wayland/mod.rs b/src/wayland/mod.rs index 1ea5b480bba8..44c51d663402 100644 --- a/src/wayland/mod.rs +++ b/src/wayland/mod.rs @@ -88,45 +88,3 @@ pub mod xdg_toplevel_icon; pub mod xwayland_keyboard_grab; #[cfg(feature = "xwayland")] pub mod xwayland_shell; - -mod gen { - macro_rules! wayland_protocol( - ($path:expr, [$($imports:path),*]) => { - pub use self::generated::server; - - mod generated { - #![allow(dead_code,non_camel_case_types,unused_unsafe,unused_variables)] - #![allow(non_upper_case_globals,non_snake_case,unused_imports)] - #![allow(missing_docs, clippy::all)] - - pub mod server { - //! Server-side API of this protocol - use wayland_server; - use wayland_server::protocol::*; - $(use $imports::{server::*};)* - - pub mod __interfaces { - use wayland_server::protocol::__interfaces::*; - $(use $imports::{server::__interfaces::*};)* - wayland_scanner::generate_interfaces!($path); - } - use self::__interfaces::*; - - wayland_scanner::generate_server_code!($path); - } - } - } - ); - - pub mod ext_data_control { - //! Control data devices, particularly the clipboard. - //! - //! An interface to control data devices, particularly to manage the current selection and - //! take the role of a clipboard manager. - - #[allow(missing_docs)] - pub mod v1 { - wayland_protocol!("./ext_data_control.xml", []); - } - } -} diff --git a/src/wayland/selection/device.rs b/src/wayland/selection/device.rs index c41db061b5a2..c52e1aea08e9 100644 --- a/src/wayland/selection/device.rs +++ b/src/wayland/selection/device.rs @@ -1,3 +1,4 @@ +use wayland_protocols::ext::data_control::v1::server::ext_data_control_device_v1::ExtDataControlDeviceV1; use wayland_protocols::wp::primary_selection::zv1::server::zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1 as PrimaryDevice; use wayland_protocols_wlr::data_control::v1::server::zwlr_data_control_device_v1::ZwlrDataControlDeviceV1; use wayland_server::backend::ObjectId; @@ -5,8 +6,6 @@ use wayland_server::protocol::wl_data_device::WlDataDevice; use wayland_server::protocol::wl_seat::WlSeat; use wayland_server::Resource; -use crate::wayland::gen::ext_data_control::v1::server::ext_data_control_device_v1::ExtDataControlDeviceV1; - use super::data_device::DataDeviceUserData; use super::ext_data_control::ExtDataControlDeviceUserData; use super::offer::DataControlOffer; diff --git a/src/wayland/selection/ext_data_control/device.rs b/src/wayland/selection/ext_data_control/device.rs index baebd2920a8e..68616bf714d2 100644 --- a/src/wayland/selection/ext_data_control/device.rs +++ b/src/wayland/selection/ext_data_control/device.rs @@ -1,6 +1,6 @@ use std::cell::RefCell; -use crate::wayland::gen::ext_data_control::v1::server::ext_data_control_device_v1::{ +use wayland_protocols::ext::data_control::v1::server::ext_data_control_device_v1::{ self, ExtDataControlDeviceV1, }; use wayland_server::protocol::wl_seat::WlSeat; diff --git a/src/wayland/selection/ext_data_control/mod.rs b/src/wayland/selection/ext_data_control/mod.rs index 5c20edd40218..c510d0a575b2 100644 --- a/src/wayland/selection/ext_data_control/mod.rs +++ b/src/wayland/selection/ext_data_control/mod.rs @@ -47,7 +47,7 @@ //! Be aware that data control clients rely on other selection providers to be implemneted, like //! wl_data_device or zwp_primary_selection. -use crate::wayland::gen::ext_data_control::v1::server::ext_data_control_manager_v1::ExtDataControlManagerV1; +use wayland_protocols::ext::data_control::v1::server::ext_data_control_manager_v1::ExtDataControlManagerV1; use wayland_server::backend::GlobalId; use wayland_server::{Client, DisplayHandle, GlobalDispatch}; @@ -119,15 +119,13 @@ pub struct DataControlManagerUserData { mod handlers { use std::cell::RefCell; - use crate::wayland::{ - gen::ext_data_control::v1::server::{ - ext_data_control_device_v1::ExtDataControlDeviceV1, - ext_data_control_manager_v1::{self, ExtDataControlManagerV1}, - ext_data_control_source_v1::ExtDataControlSourceV1, - }, - selection::device::DataControlDevice, - }; + use crate::wayland::selection::device::DataControlDevice; use tracing::error; + use wayland_protocols::ext::data_control::v1::server::{ + ext_data_control_device_v1::ExtDataControlDeviceV1, + ext_data_control_manager_v1::{self, ExtDataControlManagerV1}, + ext_data_control_source_v1::ExtDataControlSourceV1, + }; use wayland_server::{Client, Dispatch, DisplayHandle, GlobalDispatch}; use crate::input::Seat; @@ -239,21 +237,21 @@ mod handlers { } } -#[allow(missing_docs)] // TODO +/// Macro to delegate implementation of the ext_data_control protocol #[macro_export] macro_rules! delegate_ext_data_control { ($(@<$( $lt:tt $( : $clt:tt $(+ $dlt:tt )* )? ),+>)? $ty: ty) => { $crate::reexports::wayland_server::delegate_global_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [ - $crate::reexports::wayland_protocols::ext_data_control::v1::server::ext_data_control_manager_v1::ExtDataControlManagerV1: $crate::wayland::selection::ext_data_control::DataControlManagerGlobalData + $crate::reexports::wayland_protocols::ext::data_control::v1::server::ext_data_control_manager_v1::ExtDataControlManagerV1: $crate::wayland::selection::ext_data_control::DataControlManagerGlobalData ] => $crate::wayland::selection::ext_data_control::DataControlState); $crate::reexports::wayland_server::delegate_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [ - $crate::reexports::wayland_protocols::ext_data_control::v1::server::ext_data_control_manager_v1::ExtDataControlManagerV1: $crate::wayland::selection::ext_data_control::DataControlManagerUserData + $crate::reexports::wayland_protocols::ext::data_control::v1::server::ext_data_control_manager_v1::ExtDataControlManagerV1: $crate::wayland::selection::ext_data_control::DataControlManagerUserData ] => $crate::wayland::selection::ext_data_control::DataControlState); $crate::reexports::wayland_server::delegate_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [ - $crate::reexports::wayland_protocols::ext_data_control::v1::server::ext_data_control_device_v1::ExtDataControlDeviceV1: $crate::wayland::selection::ext_data_control::DataControlDeviceUserData + $crate::reexports::wayland_protocols::ext::data_control::v1::server::ext_data_control_device_v1::ExtDataControlDeviceV1: $crate::wayland::selection::ext_data_control::DataControlDeviceUserData ] => $crate::wayland::selection::ext_data_control::DataControlState); $crate::reexports::wayland_server::delegate_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [ - $crate::reexports::wayland_protocols::ext_data_control::v1::server::ext_data_control_source_v1::ExtDataControlSourceV1: $crate::wayland::selection::ext_data_control::DataControlSourceUserData + $crate::reexports::wayland_protocols::ext::data_control::v1::server::ext_data_control_source_v1::ExtDataControlSourceV1: $crate::wayland::selection::ext_data_control::DataControlSourceUserData ] => $crate::wayland::selection::ext_data_control::DataControlState); }; } diff --git a/src/wayland/selection/ext_data_control/source.rs b/src/wayland/selection/ext_data_control/source.rs index 6c8f51552028..e254d99cc61a 100644 --- a/src/wayland/selection/ext_data_control/source.rs +++ b/src/wayland/selection/ext_data_control/source.rs @@ -6,7 +6,7 @@ use wayland_server::{Dispatch, DisplayHandle, Resource}; use crate::utils::alive_tracker::AliveTracker; use crate::utils::IsAlive; -use crate::wayland::gen::ext_data_control::v1::server::ext_data_control_source_v1::{ +use wayland_protocols::ext::data_control::v1::server::ext_data_control_source_v1::{ self, ExtDataControlSourceV1, }; diff --git a/src/wayland/selection/offer.rs b/src/wayland/selection/offer.rs index 882262c7af70..39287f4fe99e 100644 --- a/src/wayland/selection/offer.rs +++ b/src/wayland/selection/offer.rs @@ -2,6 +2,9 @@ use std::os::unix::io::OwnedFd; use std::sync::Arc; use tracing::debug; +use wayland_protocols::ext::data_control::v1::server::ext_data_control_offer_v1::{ + self, ExtDataControlOfferV1, +}; use wayland_protocols::wp::primary_selection::zv1::server::zwp_primary_selection_offer_v1::{ self, ZwpPrimarySelectionOfferV1 as PrimaryOffer, }; @@ -20,9 +23,6 @@ use zwlr_data_control_offer_v1::Request as DataControlRequest; use zwp_primary_selection_offer_v1::Request as PrimaryRequest; use crate::input::Seat; -use crate::wayland::gen::ext_data_control::v1::server::ext_data_control_offer_v1::{ - self, ExtDataControlOfferV1, -}; use super::device::{DataDeviceKind, SelectionDevice}; use super::private::selection_dispatch; diff --git a/src/wayland/selection/source.rs b/src/wayland/selection/source.rs index c85de8c27450..45ce5216815d 100644 --- a/src/wayland/selection/source.rs +++ b/src/wayland/selection/source.rs @@ -1,12 +1,12 @@ use std::os::fd::BorrowedFd; use std::os::unix::io::{AsFd, OwnedFd}; +use wayland_protocols::ext::data_control::v1::server::ext_data_control_source_v1::ExtDataControlSourceV1; use wayland_protocols::wp::primary_selection::zv1::server::zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1 as PrimarySource; use wayland_protocols_wlr::data_control::v1::server::zwlr_data_control_source_v1::ZwlrDataControlSourceV1; use wayland_server::{protocol::wl_data_source::WlDataSource, Resource}; use crate::utils::IsAlive; -use crate::wayland::gen::ext_data_control::v1::server::ext_data_control_source_v1::ExtDataControlSourceV1; use crate::wayland::selection::primary_selection::PrimarySourceUserData; use super::data_device::DataSourceUserData;