Skip to content

Commit

Permalink
Update to wayland-rs git
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyMeilex committed Dec 26, 2024
1 parent 869ed11 commit 379091c
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 65 deletions.
12 changes: 11 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}
Expand All @@ -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"] }
Expand Down
42 changes: 0 additions & 42 deletions src/wayland/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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", []);
}
}
}
3 changes: 1 addition & 2 deletions src/wayland/selection/device.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
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;
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;
Expand Down
2 changes: 1 addition & 1 deletion src/wayland/selection/ext_data_control/device.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
26 changes: 12 additions & 14 deletions src/wayland/selection/ext_data_control/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
};
}
2 changes: 1 addition & 1 deletion src/wayland/selection/ext_data_control/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
6 changes: 3 additions & 3 deletions src/wayland/selection/offer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/wayland/selection/source.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 379091c

Please sign in to comment.