User hover style for drop target

This commit is contained in:
Ian Douglas Scott 2024-05-01 12:14:46 -07:00
parent b635c10837
commit 6cca5476ab
2 changed files with 5 additions and 4 deletions

View file

@ -669,7 +669,7 @@ impl Application for App {
if let Some(workspace) = if let Some(workspace) =
self.workspaces.iter().find(|x| &x.handle == handle) self.workspaces.iter().find(|x| &x.handle == handle)
{ {
let item = view::workspace_item(workspace, output); let item = view::workspace_item(workspace, output, false);
return widget::container(item) return widget::container(item)
.height(iced::Length::Fixed(size.height)) .height(iced::Length::Fixed(size.height))
.width(iced::Length::Fixed(size.width)) .width(iced::Length::Fixed(size.width))

View file

@ -115,6 +115,7 @@ fn workspace_item_appearance(
pub(crate) fn workspace_item<'a>( pub(crate) fn workspace_item<'a>(
workspace: &'a Workspace, workspace: &'a Workspace,
output: &wl_output::WlOutput, output: &wl_output::WlOutput,
is_drop_target: bool,
) -> cosmic::Element<'a, Msg> { ) -> cosmic::Element<'a, Msg> {
let image = capture_image(workspace.img_for_output.get(output)); let image = capture_image(workspace.img_for_output.get(output));
let is_active = workspace.is_active; let is_active = workspace.is_active;
@ -124,7 +125,7 @@ pub(crate) fn workspace_item<'a>(
.selected(workspace.is_active) .selected(workspace.is_active)
.style(cosmic::theme::Button::Custom { .style(cosmic::theme::Button::Custom {
active: Box::new(move |_focused, theme| workspace_item_appearance( active: Box::new(move |_focused, theme| workspace_item_appearance(
theme, is_active, false theme, is_active, is_drop_target
)), )),
disabled: Box::new(|_theme| { unreachable!() }), disabled: Box::new(|_theme| { unreachable!() }),
hovered: Box::new(move |_focused, theme| workspace_item_appearance( hovered: Box::new(move |_focused, theme| workspace_item_appearance(
@ -144,7 +145,7 @@ pub(crate) fn workspace_item<'a>(
fn workspace_sidebar_entry<'a>( fn workspace_sidebar_entry<'a>(
workspace: &'a Workspace, workspace: &'a Workspace,
output: &'a wl_output::WlOutput, output: &'a wl_output::WlOutput,
_is_drop_target: bool, is_drop_target: bool,
) -> cosmic::Element<'a, Msg> { ) -> cosmic::Element<'a, Msg> {
/* XXX /* XXX
let mouse_interaction = if is_drop_target { let mouse_interaction = if is_drop_target {
@ -170,7 +171,7 @@ fn workspace_sidebar_entry<'a>(
*/ */
//crate::widgets::mouse_interaction_wrapper( //crate::widgets::mouse_interaction_wrapper(
// mouse_interaction, // mouse_interaction,
iced::widget::dnd_listener(workspace_item(workspace, output)) iced::widget::dnd_listener(workspace_item(workspace, output, is_drop_target))
.on_enter(|actions, mime, pos| { .on_enter(|actions, mime, pos| {
Msg::DndWorkspaceEnter(workspace.handle.clone(), output.clone(), actions, mime, pos) Msg::DndWorkspaceEnter(workspace.handle.clone(), output.clone(), actions, mime, pos)
}) })