Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,12 @@ harness = false
[profile.release-with-debug]
inherits = "release"
debug = true

[patch.crates-io]
wayland-sys = { git = "https://github.com/smithay/wayland-rs", branch = "dispatch" }
wayland-egl = { git = "https://github.com/smithay/wayland-rs", branch = "dispatch" }
wayland-backend = { git = "https://github.com/smithay/wayland-rs", branch = "dispatch" }
wayland-server = { git = "https://github.com/smithay/wayland-rs", branch = "dispatch" }
# wayland-client = { git = "https://github.com/smithay/wayland-rs", branch = "dispatch" }
# wayland-protocols = { git = "https://github.com/smithay/wayland-rs", branch = "dispatch" }
# wayland-protocols-wlr = { git = "https://github.com/smithay/wayland-rs", branch = "dispatch" }
3 changes: 0 additions & 3 deletions anvil/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use smithay::{
RenderElementStates, default_primary_scanout_output_compare, utils::select_dmabuf_feedback,
},
},
delegate_dispatch2,
desktop::{
PopupKind, PopupManager, Space,
space::SpaceElement,
Expand Down Expand Up @@ -607,8 +606,6 @@ impl<BackendData: Backend> ImageCopyCaptureHandler for AnvilState<BackendData> {
}
}

delegate_dispatch2!(@<BackendData: Backend + 'static> AnvilState<BackendData>);

impl<BackendData: Backend + 'static> AnvilState<BackendData> {
pub fn init(
display: Display<AnvilState<BackendData>>,
Expand Down
14 changes: 7 additions & 7 deletions src/wayland/alpha_modifier/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ use wayland_protocols::wp::alpha_modifier::v1::server::{
wp_alpha_modifier_v1::{self, WpAlphaModifierV1},
};

use wayland_server::{Client, DataInit, Dispatch, DisplayHandle, New, Resource, backend::ClientId};
use wayland_server::{
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource, backend::ClientId,
};

use super::{AlphaModifierSurfaceCachedState, AlphaModifierSurfaceData, AlphaModifierSurfaceUserData};
use crate::wayland::{Dispatch2, GlobalData, GlobalDispatch2, compositor};
use crate::wayland::{GlobalData, compositor};

impl<D> GlobalDispatch2<WpAlphaModifierV1, D> for GlobalData
impl<D> GlobalDispatch<WpAlphaModifierV1, D> for GlobalData
where
D: Dispatch<WpAlphaModifierV1, GlobalData>,
D: 'static,
{
fn bind(
Expand All @@ -25,9 +26,8 @@ where
}
}

impl<D> Dispatch2<WpAlphaModifierV1, D> for GlobalData
impl<D> Dispatch<WpAlphaModifierV1, D> for GlobalData
where
D: Dispatch<WpAlphaModifierSurfaceV1, AlphaModifierSurfaceUserData>,
D: 'static,
{
fn request(
Expand Down Expand Up @@ -72,7 +72,7 @@ where
}
}

impl<D> Dispatch2<WpAlphaModifierSurfaceV1, D> for AlphaModifierSurfaceUserData {
impl<D> Dispatch<WpAlphaModifierSurfaceV1, D> for AlphaModifierSurfaceUserData {
fn request(
&self,
_state: &mut D,
Expand Down
5 changes: 1 addition & 4 deletions src/wayland/alpha_modifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ impl AlphaModifierState {
/// Regiseter new [WpAlphaModifierV1] global
pub fn new<D>(display: &DisplayHandle) -> AlphaModifierState
where
D: GlobalDispatch<WpAlphaModifierV1, GlobalData>
+ Dispatch<WpAlphaModifierV1, GlobalData>
+ Dispatch<WpAlphaModifierSurfaceV1, AlphaModifierSurfaceUserData>
+ 'static,
D: 'static,
{
let global = display.create_global::<D, WpAlphaModifierV1, _>(1, GlobalData);

Expand Down
16 changes: 5 additions & 11 deletions src/wayland/background_effect/dispatch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::wayland::background_effect::{BackgroundEffectSurfaceData, ExtBackgroundEffectHandler};
use crate::wayland::compositor;
use crate::wayland::{
Dispatch2, GlobalData, GlobalDispatch2,
GlobalData,
background_effect::{BackgroundEffectSurfaceCachedState, BackgroundEffectSurfaceUserData},
compositor::with_states,
};
Expand All @@ -13,12 +13,9 @@ use wayland_protocols::ext::background_effect::v1::server::{
Error as SurfaceError, ExtBackgroundEffectSurfaceV1, Request as SurfaceRequest,
},
};
use wayland_server::{Client, DataInit, Dispatch, DisplayHandle, New, Resource};
use wayland_server::{Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource};

impl<D: ExtBackgroundEffectHandler> GlobalDispatch2<ExtBackgroundEffectManagerV1, D> for GlobalData
where
D: Dispatch<ExtBackgroundEffectManagerV1, GlobalData>,
{
impl<D: ExtBackgroundEffectHandler> GlobalDispatch<ExtBackgroundEffectManagerV1, D> for GlobalData {
fn bind(
&self,
state: &mut D,
Expand All @@ -32,10 +29,7 @@ where
}
}

impl<D: ExtBackgroundEffectHandler> Dispatch2<ExtBackgroundEffectManagerV1, D> for GlobalData
where
D: Dispatch<ExtBackgroundEffectSurfaceV1, BackgroundEffectSurfaceUserData>,
{
impl<D: ExtBackgroundEffectHandler> Dispatch<ExtBackgroundEffectManagerV1, D> for GlobalData {
fn request(
&self,
_state: &mut D,
Expand Down Expand Up @@ -73,7 +67,7 @@ where
}
}

impl<D: ExtBackgroundEffectHandler> Dispatch2<ExtBackgroundEffectSurfaceV1, D>
impl<D: ExtBackgroundEffectHandler> Dispatch<ExtBackgroundEffectSurfaceV1, D>
for BackgroundEffectSurfaceUserData
{
fn request(
Expand Down
2 changes: 1 addition & 1 deletion src/wayland/background_effect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl BackgroundEffectState {
/// Regiseter new [ExtBackgroundEffectManagerV1] global
pub fn new<D>(display: &DisplayHandle) -> BackgroundEffectState
where
D: ExtBackgroundEffectHandler + GlobalDispatch<ExtBackgroundEffectManagerV1, GlobalData>,
D: ExtBackgroundEffectHandler,
{
let global = display.create_global::<D, ExtBackgroundEffectManagerV1, _>(1, GlobalData);
BackgroundEffectState { global }
Expand Down
16 changes: 4 additions & 12 deletions src/wayland/commit_timing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ use wayland_server::{

use crate::{
utils::Time,
wayland::{
Dispatch2, GlobalDispatch2,
compositor::{add_blocker, add_pre_commit_hook},
},
wayland::compositor::{add_blocker, add_pre_commit_hook},
};

use super::compositor::{Barrier, with_states};
Expand All @@ -114,7 +111,6 @@ impl CommitTimingManagerState {
/// remove or disable this global in the future.
pub fn new<D>(display: &DisplayHandle) -> Self
where
D: GlobalDispatch<WpCommitTimingManagerV1, CommitTimingManagerData>,
D: 'static,
{
Self::new_internal::<D>(display, true)
Expand All @@ -126,15 +122,13 @@ impl CommitTimingManagerState {
/// remove or disable this global in the future.
pub fn unmanaged<D>(display: &DisplayHandle) -> Self
where
D: GlobalDispatch<WpCommitTimingManagerV1, CommitTimingManagerData>,
D: 'static,
{
Self::new_internal::<D>(display, false)
}

fn new_internal<D>(display: &DisplayHandle, is_managed: bool) -> Self
where
D: GlobalDispatch<WpCommitTimingManagerV1, CommitTimingManagerData>,
D: 'static,
{
let global =
Expand All @@ -160,9 +154,8 @@ pub struct CommitTimingManagerData {
is_managed: bool,
}

impl<D> GlobalDispatch2<WpCommitTimingManagerV1, D> for CommitTimingManagerData
impl<D> GlobalDispatch<WpCommitTimingManagerV1, D> for CommitTimingManagerData
where
D: Dispatch<WpCommitTimingManagerV1, CommitTimingManagerData>,
D: 'static,
{
fn bind(
Expand All @@ -177,9 +170,8 @@ where
}
}

impl<D> Dispatch2<WpCommitTimingManagerV1, D> for CommitTimingManagerData
impl<D> Dispatch<WpCommitTimingManagerV1, D> for CommitTimingManagerData
where
D: Dispatch<WpCommitTimerV1, CommitTimerData>,
D: 'static,
{
fn request(
Expand Down Expand Up @@ -257,7 +249,7 @@ struct CommitTimerMarker(Option<WpCommitTimerV1>);
#[derive(Debug)]
pub struct CommitTimerData(Weak<WlSurface>);

impl<D> Dispatch2<WpCommitTimerV1, D> for CommitTimerData
impl<D> Dispatch<WpCommitTimerV1, D> for CommitTimerData
where
D: 'static,
{
Expand Down
29 changes: 10 additions & 19 deletions src/wayland/compositor/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::sync::{
};

use wayland_server::{
DataInit, Dispatch, DisplayHandle, New, Resource, WEnum,
DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource, WEnum,
protocol::{
wl_callback::{self, WlCallback},
wl_compositor::{self, WlCompositor},
Expand All @@ -20,7 +20,7 @@ use crate::utils::{
alive_tracker::{AliveTracker, IsAlive},
};

use crate::wayland::{Dispatch2, GlobalData, GlobalDispatch2};
use crate::wayland::GlobalData;

use super::{
AlreadyHasRole, BufferAssignment, CompositorHandler, Damage, Rectangle, RectangleKind, RegionAttributes,
Expand All @@ -35,11 +35,8 @@ use tracing::trace;
* wl_compositor
*/

impl<D> GlobalDispatch2<WlCompositor, D> for GlobalData
impl<D> GlobalDispatch<WlCompositor, D> for GlobalData
where
D: Dispatch<WlCompositor, GlobalData>,
D: Dispatch<WlSurface, SurfaceUserData>,
D: Dispatch<WlRegion, RegionUserData>,
D: CompositorHandler,
D: 'static,
{
Expand All @@ -55,10 +52,8 @@ where
}
}

impl<D> Dispatch2<WlCompositor, D> for GlobalData
impl<D> Dispatch<WlCompositor, D> for GlobalData
where
D: Dispatch<WlSurface, SurfaceUserData>,
D: Dispatch<WlRegion, RegionUserData>,
D: CompositorHandler,
D: 'static,
{
Expand Down Expand Up @@ -156,9 +151,8 @@ pub struct SurfaceUserData {
pub(super) user_state_type: (std::any::TypeId, &'static str),
}

impl<D> Dispatch2<WlSurface, D> for SurfaceUserData
impl<D> Dispatch<WlSurface, D> for SurfaceUserData
where
D: Dispatch<WlCallback, GlobalData>,
D: CompositorHandler,
D: 'static,
{
Expand Down Expand Up @@ -373,7 +367,7 @@ pub struct RegionUserData {
pub(crate) inner: Mutex<RegionAttributes>,
}

impl<D> Dispatch2<WlRegion, D> for RegionUserData
impl<D> Dispatch<WlRegion, D> for RegionUserData
where
D: CompositorHandler,
{
Expand Down Expand Up @@ -416,10 +410,8 @@ where
* wl_subcompositor
*/

impl<D> GlobalDispatch2<WlSubcompositor, D> for GlobalData
impl<D> GlobalDispatch<WlSubcompositor, D> for GlobalData
where
D: Dispatch<WlSubcompositor, GlobalData>,
D: Dispatch<WlSubsurface, SubsurfaceUserData>,
D: CompositorHandler,
D: 'static,
{
Expand All @@ -435,9 +427,8 @@ where
}
}

impl<D> Dispatch2<WlSubcompositor, D> for GlobalData
impl<D> Dispatch<WlSubcompositor, D> for GlobalData
where
D: Dispatch<WlSubsurface, SubsurfaceUserData>,
D: CompositorHandler,
D: 'static,
{
Expand Down Expand Up @@ -552,7 +543,7 @@ pub fn is_effectively_sync(surface: &wl_surface::WlSurface) -> bool {
}
}

impl<D> Dispatch2<WlSubsurface, D> for SubsurfaceUserData
impl<D> Dispatch<WlSubsurface, D> for SubsurfaceUserData
where
D: CompositorHandler,
D: 'static,
Expand Down Expand Up @@ -641,7 +632,7 @@ where
}
}

impl<D> Dispatch2<WlCallback, D> for GlobalData
impl<D> Dispatch<WlCallback, D> for GlobalData
where
D: CompositorHandler,
D: 'static,
Expand Down
6 changes: 3 additions & 3 deletions src/wayland/compositor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ impl CompositorState {
/// [`wl_subcompositor`]: wayland_server::protocol::wl_subcompositor
pub fn new<D>(display: &DisplayHandle) -> Self
where
D: GlobalDispatch<WlCompositor, GlobalData> + GlobalDispatch<WlSubcompositor, GlobalData> + 'static,
D: CompositorHandler + 'static,
{
Self::new_with_version::<D>(display, 5)
}
Expand All @@ -698,14 +698,14 @@ impl CompositorState {
/// [`wl_compositor`]: wayland_server::protocol::wl_compositor
pub fn new_v6<D>(display: &DisplayHandle) -> Self
where
D: GlobalDispatch<WlCompositor, GlobalData> + GlobalDispatch<WlSubcompositor, GlobalData> + 'static,
D: CompositorHandler + 'static,
{
Self::new_with_version::<D>(display, 6)
}

fn new_with_version<D>(display: &DisplayHandle, version: u32) -> Self
where
D: GlobalDispatch<WlCompositor, GlobalData> + GlobalDispatch<WlSubcompositor, GlobalData> + 'static,
D: CompositorHandler + 'static,
{
let compositor = display.create_global::<D, WlCompositor, _>(version, GlobalData);
let subcompositor = display.create_global::<D, WlSubcompositor, _>(1, GlobalData);
Expand Down
14 changes: 7 additions & 7 deletions src/wayland/content_type/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ use wayland_protocols::wp::content_type::v1::server::{
wp_content_type_manager_v1::{self, WpContentTypeManagerV1},
wp_content_type_v1::{self, WpContentTypeV1},
};
use wayland_server::{Client, DataInit, Dispatch, DisplayHandle, New, Resource, backend::ClientId};
use wayland_server::{
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource, backend::ClientId,
};

use super::{ContentTypeSurfaceCachedState, ContentTypeSurfaceData, ContentTypeUserData};
use crate::wayland::{Dispatch2, GlobalData, GlobalDispatch2, compositor};
use crate::wayland::{GlobalData, compositor};

impl<D> GlobalDispatch2<WpContentTypeManagerV1, D> for GlobalData
impl<D> GlobalDispatch<WpContentTypeManagerV1, D> for GlobalData
where
D: Dispatch<WpContentTypeManagerV1, GlobalData>,
D: 'static,
{
fn bind(
Expand All @@ -24,9 +25,8 @@ where
}
}

impl<D> Dispatch2<WpContentTypeManagerV1, D> for GlobalData
impl<D> Dispatch<WpContentTypeManagerV1, D> for GlobalData
where
D: Dispatch<WpContentTypeV1, ContentTypeUserData>,
D: 'static,
{
fn request(
Expand Down Expand Up @@ -71,7 +71,7 @@ where
}
}

impl<D> Dispatch2<WpContentTypeV1, D> for ContentTypeUserData {
impl<D> Dispatch<WpContentTypeV1, D> for ContentTypeUserData {
fn request(
&self,
_state: &mut D,
Expand Down
2 changes: 1 addition & 1 deletion src/wayland/content_type/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl ContentTypeState {
/// Regiseter new [WpContentTypeManagerV1] global
pub fn new<D>(display: &DisplayHandle) -> ContentTypeState
where
D: GlobalDispatch<WpContentTypeManagerV1, GlobalData> + 'static,
D: 'static,
{
let global = display.create_global::<D, WpContentTypeManagerV1, _>(1, GlobalData);

Expand Down
Loading
Loading