Drag toplevel to workspace; recognize what toplevel was dragged
This commit is contained in:
parent
e5aca0a6b5
commit
f2c77d035c
2 changed files with 55 additions and 74 deletions
|
|
@ -85,12 +85,13 @@ fn workspace_sidebar_entry<'a>(
|
|||
workspace: &'a Workspace,
|
||||
output: &'a wl_output::WlOutput,
|
||||
) -> cosmic::Element<'a, Msg> {
|
||||
/* TODO allow moving workspaces (needs compositor support)
|
||||
iced::widget::dnd_source(workspace_item(workspace, output))
|
||||
.on_drag(|size| {
|
||||
Msg::StartDrag(
|
||||
size,
|
||||
DragSurface::Workspace {
|
||||
name: workspace.name.to_string(),
|
||||
handle: workspace.handle.clone(),
|
||||
output: output.clone(),
|
||||
},
|
||||
)
|
||||
|
|
@ -98,6 +99,13 @@ fn workspace_sidebar_entry<'a>(
|
|||
.on_finished(Msg::SourceFinished)
|
||||
.on_cancelled(Msg::SourceFinished)
|
||||
.into()
|
||||
*/
|
||||
iced::widget::dnd_listener(workspace_item(workspace, output))
|
||||
.on_enter(Msg::DndWorkspaceEnter)
|
||||
.on_exit(Msg::DndWorkspaceLeave)
|
||||
.on_drop(Msg::DndWorkspaceDrop)
|
||||
.on_data(Msg::DndWorkspaceData)
|
||||
.into()
|
||||
}
|
||||
|
||||
fn workspaces_sidebar<'a>(
|
||||
|
|
@ -117,16 +125,10 @@ fn workspaces_sidebar<'a>(
|
|||
WorkspaceLayout::Vertical => column(sidebar_entries).into(),
|
||||
WorkspaceLayout::Horizontal => row(sidebar_entries).into(),
|
||||
};
|
||||
widget::container(
|
||||
iced::widget::dnd_listener(sidebar_entries_container)
|
||||
.on_enter(Msg::DndWorkspaceEnter)
|
||||
.on_exit(Msg::DndWorkspaceLeave)
|
||||
.on_drop(Msg::DndWorkspaceDrop)
|
||||
.on_data(Msg::DndWorkspaceData),
|
||||
)
|
||||
.width(iced::Length::Fill)
|
||||
.height(iced::Length::Fill)
|
||||
.into()
|
||||
widget::container(sidebar_entries_container)
|
||||
.width(iced::Length::Fill)
|
||||
.height(iced::Length::Fill)
|
||||
.into()
|
||||
}
|
||||
|
||||
pub(crate) fn toplevel_preview(toplevel: &Toplevel) -> cosmic::Element<Msg> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue