Remove unneeded field of DragSurface

This commit is contained in:
Ian Douglas Scott 2025-01-24 14:41:36 -08:00
parent 207e7b2ff3
commit 6838bd60be
3 changed files with 6 additions and 19 deletions

View file

@ -20,14 +20,8 @@ static TOPLEVEL_MIME: LazyLock<String> =
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum DragSurface { pub enum DragSurface {
#[allow(dead_code)] #[allow(dead_code)]
Workspace { Workspace(ZcosmicWorkspaceHandleV1),
handle: ZcosmicWorkspaceHandleV1, Toplevel(ZcosmicToplevelHandleV1),
output: wl_output::WlOutput,
},
Toplevel {
handle: ZcosmicToplevelHandleV1,
output: wl_output::WlOutput,
},
} }
// TODO store protocol object id? // TODO store protocol object id?

View file

@ -483,7 +483,7 @@ impl Application for App {
} }
} }
Msg::DndWorkspaceDrop(_toplevel) => { Msg::DndWorkspaceDrop(_toplevel) => {
if let Some((DragSurface::Toplevel { handle, .. }, _)) = &self.drag_surface { if let Some((DragSurface::Toplevel(handle), _)) = &self.drag_surface {
if let Some(DropTarget::WorkspaceSidebarEntry(workspace, output)) = if let Some(DropTarget::WorkspaceSidebarEntry(workspace, output)) =
self.drop_target.take() self.drop_target.take()
{ {

View file

@ -52,7 +52,7 @@ pub(crate) fn layer_surface<'a>(
} }
} }
let mut drag_toplevel = None; let mut drag_toplevel = None;
if let Some((DragSurface::Toplevel { handle, .. }, _)) = &app.drag_surface { if let Some((DragSurface::Toplevel(handle), _)) = &app.drag_surface {
drag_toplevel = Some(handle); drag_toplevel = Some(handle);
} }
let layout = app.conf.workspace_config.workspace_layout; let layout = app.conf.workspace_config.workspace_layout;
@ -75,7 +75,6 @@ pub(crate) fn layer_surface<'a>(
.map_or(false, |x| x.is_active) .map_or(false, |x| x.is_active)
}) })
}), }),
&surface.output,
layout, layout,
drag_toplevel, drag_toplevel,
); );
@ -306,7 +305,6 @@ fn toplevel_preview(toplevel: &Toplevel, is_being_dragged: bool) -> cosmic::Elem
fn toplevel_previews_entry<'a>( fn toplevel_previews_entry<'a>(
toplevel: &'a Toplevel, toplevel: &'a Toplevel,
output: &'a wl_output::WlOutput,
is_being_dragged: bool, is_being_dragged: bool,
) -> cosmic::Element<'a, Msg> { ) -> cosmic::Element<'a, Msg> {
// Dragged window still takes up space until moved, but isn't rendered while drag surface is // Dragged window still takes up space until moved, but isn't rendered while drag surface is
@ -329,11 +327,7 @@ fn toplevel_previews_entry<'a>(
}) })
.on_start(Some(Msg::StartDrag( .on_start(Some(Msg::StartDrag(
//size, //size,
//offset, DragSurface::Toplevel(toplevel.handle.clone()),
DragSurface::Toplevel {
handle: toplevel.handle.clone(),
output: output.clone(),
},
))) )))
.on_finish(Some(Msg::SourceFinished)) .on_finish(Some(Msg::SourceFinished))
.on_cancel(Some(Msg::SourceFinished)) .on_cancel(Some(Msg::SourceFinished))
@ -342,7 +336,6 @@ fn toplevel_previews_entry<'a>(
fn toplevel_previews<'a>( fn toplevel_previews<'a>(
toplevels: impl Iterator<Item = &'a Toplevel>, toplevels: impl Iterator<Item = &'a Toplevel>,
output: &'a wl_output::WlOutput,
layout: WorkspaceLayout, layout: WorkspaceLayout,
drag_toplevel: Option<&'a backend::ZcosmicToplevelHandleV1>, drag_toplevel: Option<&'a backend::ZcosmicToplevelHandleV1>,
) -> cosmic::Element<'a, Msg> { ) -> cosmic::Element<'a, Msg> {
@ -351,7 +344,7 @@ fn toplevel_previews<'a>(
WorkspaceLayout::Horizontal => (iced::Length::Fill, iced::Length::FillPortion(4)), WorkspaceLayout::Horizontal => (iced::Length::Fill, iced::Length::FillPortion(4)),
}; };
let entries = toplevels let entries = toplevels
.map(|t| toplevel_previews_entry(t, output, drag_toplevel == Some(&t.handle))) .map(|t| toplevel_previews_entry(t, drag_toplevel == Some(&t.handle)))
.collect(); .collect();
//row(entries) //row(entries)
widget::mouse_area( widget::mouse_area(