From c7117049478712de70ea4ea1982ae35db8e531a8 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 23 Sep 2024 16:05:43 -0600 Subject: [PATCH] Fix window drag and add double click to maximize in gallery view --- src/app.rs | 3 +++ src/dialog.rs | 3 +++ src/tab.rs | 9 ++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index 7576cd8..302f1f5 100644 --- a/src/app.rs +++ b/src/app.rs @@ -2403,6 +2403,9 @@ impl Application for App { tab::Command::WindowDrag => { commands.push(window::drag(self.main_window_id())); } + tab::Command::WindowToggleMaximize => { + commands.push(window::toggle_maximize(self.main_window_id())); + } } } return Command::batch(commands); diff --git a/src/dialog.rs b/src/dialog.rs index 85c800a..5a1c39b 100644 --- a/src/dialog.rs +++ b/src/dialog.rs @@ -1359,6 +1359,9 @@ impl Application for App { tab::Command::WindowDrag => { commands.push(window::drag(self.main_window_id())); } + tab::Command::WindowToggleMaximize => { + commands.push(window::toggle_maximize(self.main_window_id())); + } unsupported => { log::warn!("{unsupported:?} not supported in dialog mode"); } diff --git a/src/tab.rs b/src/tab.rs index 2c877c1..4204f8f 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -819,6 +819,7 @@ pub enum Command { Preview(PreviewKind, Duration), PreviewCancel, WindowDrag, + WindowToggleMaximize, } #[derive(Clone, Debug)] @@ -864,6 +865,7 @@ pub enum Message { DndEnter(Location), DndLeave(Location), WindowDrag, + WindowToggleMaximize, ZoomDefault, ZoomIn, ZoomOut, @@ -2279,6 +2281,9 @@ impl Tab { Message::WindowDrag => { commands.push(Command::WindowDrag); } + Message::WindowToggleMaximize => { + commands.push(Command::WindowToggleMaximize); + } Message::ZoomDefault => match self.config.view { View::List => self.config.icon_sizes.list = 100.try_into().unwrap(), View::Grid => self.config.icon_sizes.grid = 100.try_into().unwrap(), @@ -2556,7 +2561,9 @@ impl Tab { ); row = row.push(widget::horizontal_space(Length::Fixed(space_xxs.into()))); // This mouse area provides window drag while the header bar is hidden - let mouse_area = mouse_area::MouseArea::new(row).on_press(|_| Message::WindowDrag); + let mouse_area = mouse_area::MouseArea::new(row) + .on_drag(|_| Message::WindowDrag) + .on_double_click(|_| Message::WindowToggleMaximize); column = column.push(mouse_area); } {