chore: Update smithay with Dispatch2

This commit is contained in:
Ian Douglas Scott 2026-04-28 16:58:33 -07:00 committed by Victoria Brekenfeld
parent b5186ef21a
commit 4106904a7e
46 changed files with 59 additions and 234 deletions

View file

@ -15,7 +15,7 @@ use smithay::{
reexports::wayland_server::{
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource,
},
wayland::image_capture_source::{ImageCaptureSource, ImageCaptureSourceData},
wayland::{image_capture_source::{ImageCaptureSource, ImageCaptureSourceData}, Dispatch2, GlobalDispatch2},
};
use wayland_backend::server::GlobalId;
@ -53,7 +53,7 @@ impl CosmicImageCaptureSourceState {
D: GlobalDispatch<
ZcosmicWorkspaceImageCaptureSourceManagerV1,
WorkspaceImageCaptureSourceManagerGlobalData,
> + Dispatch<ZcosmicWorkspaceImageCaptureSourceManagerV1, ()>
> + Dispatch<ZcosmicWorkspaceImageCaptureSourceManagerV1, CaptureSourceManagerData>
+ Dispatch<ExtImageCaptureSourceV1, ImageCaptureSourceData>
+ WorkspaceHandler
+ 'static,
@ -75,53 +75,41 @@ impl CosmicImageCaptureSourceState {
}
}
impl<D>
GlobalDispatch<
ZcosmicWorkspaceImageCaptureSourceManagerV1,
WorkspaceImageCaptureSourceManagerGlobalData,
D,
> for CosmicImageCaptureSourceState
pub struct CaptureSourceManagerData;
impl<D> GlobalDispatch2<ZcosmicWorkspaceImageCaptureSourceManagerV1, D>
for WorkspaceImageCaptureSourceManagerGlobalData
where
D: GlobalDispatch<
ZcosmicWorkspaceImageCaptureSourceManagerV1,
WorkspaceImageCaptureSourceManagerGlobalData,
> + Dispatch<ZcosmicWorkspaceImageCaptureSourceManagerV1, ()>
D: Dispatch<ZcosmicWorkspaceImageCaptureSourceManagerV1, CaptureSourceManagerData>
+ Dispatch<ExtImageCaptureSourceV1, ImageCaptureSourceData>
+ 'static,
{
fn bind(
&self,
_state: &mut D,
_handle: &DisplayHandle,
_client: &Client,
resource: New<ZcosmicWorkspaceImageCaptureSourceManagerV1>,
_global_data: &WorkspaceImageCaptureSourceManagerGlobalData,
data_init: &mut DataInit<'_, D>,
) {
data_init.init(resource, ());
data_init.init(resource, CaptureSourceManagerData);
}
fn can_view(
client: Client,
global_data: &WorkspaceImageCaptureSourceManagerGlobalData,
) -> bool {
(global_data.filter)(&client)
fn can_view(&self, client: &Client) -> bool {
(self.filter)(client)
}
}
impl<D> Dispatch<ZcosmicWorkspaceImageCaptureSourceManagerV1, (), D>
for CosmicImageCaptureSourceState
impl<D> Dispatch2<ZcosmicWorkspaceImageCaptureSourceManagerV1, D> for CaptureSourceManagerData
where
D: Dispatch<ZcosmicWorkspaceImageCaptureSourceManagerV1, ()>
+ Dispatch<ExtImageCaptureSourceV1, ImageCaptureSourceData>
+ WorkspaceHandler
+ 'static,
D: Dispatch<ExtImageCaptureSourceV1, ImageCaptureSourceData> + WorkspaceHandler + 'static,
{
fn request(
&self,
state: &mut D,
_client: &Client,
_resource: &ZcosmicWorkspaceImageCaptureSourceManagerV1,
request: <ZcosmicWorkspaceImageCaptureSourceManagerV1 as Resource>::Request,
_data: &(),
_dhandle: &DisplayHandle,
data_init: &mut DataInit<'_, D>,
) {
@ -146,15 +134,3 @@ where
}
}
}
macro_rules! delegate_cosmic_image_capture_source {
($(@<$( $lt:tt $( : $clt:tt $(+ $dlt:tt )* )? ),+>)? $ty: ty) => {
smithay::reexports::wayland_server::delegate_global_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [
cosmic_protocols::image_capture_source::v1::server::zcosmic_workspace_image_capture_source_manager_v1::ZcosmicWorkspaceImageCaptureSourceManagerV1: $crate::wayland::protocols::image_capture_source::WorkspaceImageCaptureSourceManagerGlobalData
] => $crate::wayland::protocols::image_capture_source::CosmicImageCaptureSourceState);
smithay::reexports::wayland_server::delegate_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [
cosmic_protocols::image_capture_source::v1::server::zcosmic_workspace_image_capture_source_manager_v1::ZcosmicWorkspaceImageCaptureSourceManagerV1: ()
] => $crate::wayland::protocols::image_capture_source::CosmicImageCaptureSourceState);
};
}
pub(crate) use delegate_cosmic_image_capture_source;

View file

@ -16,7 +16,10 @@ use smithay::{
desktop::{LayerSurface, layer_map_for_output},
output::Output,
reexports::{
wayland_protocols::ext::foreign_toplevel_list::v1::server::ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1,
wayland_protocols::ext::foreign_toplevel_list::v1::server::{
ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1,
ext_foreign_toplevel_list_v1::ExtForeignToplevelListV1,
},
wayland_protocols_wlr::layer_shell::v1::server::{
zwlr_layer_shell_v1::Layer as WlrLayer, zwlr_layer_surface_v1::ZwlrLayerSurfaceV1,
},
@ -24,7 +27,9 @@ use smithay::{
},
utils::{Logical, Rectangle},
wayland::{
foreign_toplevel_list::ForeignToplevelListHandler,
foreign_toplevel_list::{
ForeignToplevelHandle, ForeignToplevelListGlobalData, ForeignToplevelListHandler,
},
shell::wlr_layer::{ExclusiveZone, Layer},
},
};
@ -75,6 +80,8 @@ impl OverlapNotifyState {
pub fn refresh<D, W>(state: &mut D)
where
D: GlobalDispatch<ZcosmicOverlapNotifyV1, OverlapNotifyGlobalData>
+ GlobalDispatch<ExtForeignToplevelListV1, ForeignToplevelListGlobalData>
+ Dispatch<ExtForeignToplevelHandleV1, ForeignToplevelHandle>
+ Dispatch<ZcosmicOverlapNotifyV1, ()>
+ Dispatch<ZcosmicOverlapNotificationV1, ()>
+ OverlapNotifyHandler

View file

@ -5,7 +5,10 @@ use std::{collections::HashSet, sync::Mutex};
use smithay::{
output::Output,
reexports::{
wayland_protocols::ext::foreign_toplevel_list::v1::server::ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1,
wayland_protocols::ext::foreign_toplevel_list::v1::server::{
ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1,
ext_foreign_toplevel_list_v1::ExtForeignToplevelListV1,
},
wayland_server::{
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource, Weak,
backend::{ClientId, GlobalId},
@ -14,7 +17,8 @@ use smithay::{
},
utils::{IsAlive, Logical, Rectangle, user_data::UserDataMap},
wayland::foreign_toplevel_list::{
ForeignToplevelHandle, ForeignToplevelListHandler, ForeignToplevelListState,
ForeignToplevelHandle, ForeignToplevelListGlobalData, ForeignToplevelListHandler,
ForeignToplevelListState,
},
};
@ -300,6 +304,8 @@ pub fn toplevel_leave_workspace(toplevel: &impl Window, workspace: &WorkspaceHan
impl<D, W> ToplevelInfoState<D, W>
where
D: GlobalDispatch<ZcosmicToplevelInfoV1, ToplevelInfoGlobalData>
+ GlobalDispatch<ExtForeignToplevelListV1, ForeignToplevelListGlobalData>
+ Dispatch<ExtForeignToplevelHandleV1, ForeignToplevelHandle>
+ Dispatch<ZcosmicToplevelInfoV1, ()>
+ Dispatch<ZcosmicToplevelHandleV1, ToplevelHandleState<W>>
+ ForeignToplevelListHandler