Skip to content

Commit 21b9e53

Browse files
committed
Rewrite delegate macro to make it more readable
1 parent 5cb7033 commit 21b9e53

File tree

1 file changed

+28
-22
lines changed
  • src/wayland/background_effect

1 file changed

+28
-22
lines changed

src/wayland/background_effect/mod.rs

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -158,26 +158,32 @@ impl BackgroundEffectState {
158158
#[macro_export]
159159
macro_rules! delegate_background_effect {
160160
($(@<$( $lt:tt $( : $clt:tt $(+ $dlt:tt )* )? ),+>)? $ty: ty) => {
161-
type __ExtBackgroundEffectManagerV1 =
162-
$crate::reexports::wayland_protocols::ext::background_effect::v1::server::ext_background_effect_manager_v1::ExtBackgroundEffectManagerV1;
163-
type __ExtBackgroundEffectSurfaceV1 =
164-
$crate::reexports::wayland_protocols::ext::background_effect::v1::server::ext_background_effect_surface_v1::ExtBackgroundEffectSurfaceV1;
165-
166-
$crate::reexports::wayland_server::delegate_global_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty:
167-
[
168-
__ExtBackgroundEffectManagerV1: ()
169-
] => $crate::wayland::background_effect::BackgroundEffectState
170-
);
171-
172-
$crate::reexports::wayland_server::delegate_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty:
173-
[
174-
__ExtBackgroundEffectManagerV1: ()
175-
] => $crate::wayland::background_effect::BackgroundEffectState
176-
);
177-
$crate::reexports::wayland_server::delegate_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty:
178-
[
179-
__ExtBackgroundEffectSurfaceV1: $crate::wayland::background_effect::BackgroundEffectSurfaceUserData
180-
] => $crate::wayland::background_effect::BackgroundEffectState
181-
);
182-
}
161+
const _: () = {
162+
use $crate::{
163+
reexports::{
164+
wayland_protocols::ext::background_effect::v1::server::{
165+
ext_background_effect_manager_v1::ExtBackgroundEffectManagerV1,
166+
ext_background_effect_surface_v1::ExtBackgroundEffectSurfaceV1,
167+
},
168+
wayland_server::{delegate_dispatch, delegate_global_dispatch},
169+
},
170+
wayland::background_effect::{BackgroundEffectState, BackgroundEffectSurfaceUserData},
171+
};
172+
173+
delegate_global_dispatch!(
174+
$(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)?
175+
$ty: [ExtBackgroundEffectManagerV1: ()] => BackgroundEffectState
176+
);
177+
178+
delegate_dispatch!(
179+
$(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)?
180+
$ty: [ExtBackgroundEffectManagerV1: ()] => BackgroundEffectState
181+
);
182+
183+
delegate_dispatch!(
184+
$(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)?
185+
$ty: [ExtBackgroundEffectSurfaceV1: BackgroundEffectSurfaceUserData] => BackgroundEffectState
186+
);
187+
};
188+
};
183189
}

0 commit comments

Comments
 (0)