Repository: lapce/lapce (language: rust)

Issue:
Not Working On Linux Mint!
## Lapce Version

0.3.1

## System information

Linux Mint 21.1 Cinnamon

## Describe the bug
I cloned the lapce repo as mentioned in the docs and compiled it.
But when I run the lapce binary:
    - Only terminal works
    - settings button not working
    - menu not working
    - connect to SSH not working
It is just a ui window opened having no functionality! 


Discussion / hints:
Same problem on the latest commit.
Looks like [this PR](https://github.com/lapce/floem/pull/379) changed something causing the popout_menu to not work.
Can you suggest how to go back to a working version before that PR.
You can temporarily downgrade floem by reverting commit https://github.com/lapce/lapce/commit/987bfb8b28a632df2536a1fe82a83f2cdd232a0c.

Fix patch:
diff --git a/lapce-app/src/app.rs b/lapce-app/src/app.rs
index 71d2ca7fa2..cec55df10f 100644
--- a/lapce-app/src/app.rs
+++ b/lapce-app/src/app.rs
@@ -678,6 +678,7 @@ fn editor_tab_header(
                 || false,
                 || "Close",
                 config,
+                true,
             )
             .on_event_stop(EventListener::PointerDown, |_| {})
             .on_event_stop(EventListener::PointerEnter, move |_| {
@@ -899,6 +900,7 @@ fn editor_tab_header(
                         || false,
                         || "Previous Tab",
                         config,
+                        true,
                     )
                     .style(|s| s.margin_horiz(6.0).margin_vert(7.0)),
                     clickable_icon(
@@ -911,6 +913,7 @@ fn editor_tab_header(
                         || false,
                         || "Next Tab",
                         config,
+                        true,
                     )
                     .style(|s| s.margin_right(6.0)),
                 ))
@@ -992,6 +995,7 @@ fn editor_tab_header(
                         || false,
                         || "Split Horizontally",
                         config,
+                        true,
                     )
                     .style(|s| s.margin_left(6.0)),
                     clickable_icon(
@@ -1007,6 +1011,7 @@ fn editor_tab_header(
                         || false,
                         || "Close All",
                         config,
+                        true,
                     )
                     .style(|s| s.margin_horiz(6.0)),
                 ))
@@ -1839,10 +1844,18 @@ pub fn clickable_icon<S: std::fmt::Display + 'static>(
     disabled_fn: impl Fn() -> bool + 'static + Copy,
     tooltip_: impl Fn() -> S + 'static + Clone,
     config: ReadSignal<Arc<LapceConfig>>,
+    event_propagation: bool,
 ) -> impl View {
     tooltip_label(
         config,
-        clickable_icon_base(icon, on_click, active_fn, disabled_fn, config),
+        clickable_icon_base(
+            icon,
+            on_click,
+            active_fn,
+            disabled_fn,
+            config,
+            event_propagation,
+        ),
         tooltip_,
     )
 }
@@ -1853,7 +1866,9 @@ pub fn clickable_icon_base(
     active_fn: impl Fn() -> bool + 'static,
     disabled_fn: impl Fn() -> bool + 'static + Copy,
     config: ReadSignal<Arc<LapceConfig>>,
+    event_propagation: bool,
 ) -> impl View {
+    let pointer_down = create_rw_signal(false);
     container(
         container(
             svg(move || config.get().ui_svg(icon()))
@@ -1869,8 +1884,20 @@ pub fn clickable_icon_base(
                 })
                 .disabled(disabled_fn),
         )
-        .on_click_stop(move |_| {
-            on_click();
+        .on_event(EventListener::PointerDown, move |_| {
+            pointer_down.set(true);
+            EventPropagation::Continue
+        })
+        .on_event(EventListener::PointerUp, move |_| {
+            if pointer_down.get() {
+                on_click();
+            }
+            pointer_down.set(false);
+            if event_propagation {
+                EventPropagation::Continue
+            } else {
+                EventPropagation::Stop
+            }
         })
         .disabled(disabled_fn)
         .style(move |s| {
@@ -2628,6 +2655,7 @@ fn window_message_view(
                     || false,
                     || "Close",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_left(6.0)),
             ))
@@ -3118,6 +3146,7 @@ fn workspace_tab_header(window_data: WindowData) -> impl View {
                                 || false,
                                 || "Close",
                                 config.read_only(),
+                                true,
                             )
                             .style(|s| s.margin_horiz(6.0))
                         },
@@ -3275,6 +3304,7 @@ fn workspace_tab_header(window_data: WindowData) -> impl View {
             || false,
             || "New Workspace Tab",
             config.read_only(),
+            true,
         ))
         .on_resize(move |rect| {
             let current = add_icon_width.get_untracked();
diff --git a/lapce-app/src/editor/view.rs b/lapce-app/src/editor/view.rs
index 39866bc2d0..85aca6f0e0 100644
--- a/lapce-app/src/editor/view.rs
+++ b/lapce-app/src/editor/view.rs
@@ -1796,6 +1796,7 @@ fn search_editor_view(
             || false,
             || "Case Sensitive",
             config,
+            true,
         )
         .style(|s| s.padding_vert(4.0)),
         clickable_icon(
@@ -1809,6 +1810,7 @@ fn search_editor_view(
             || false,
             || "Whole Word",
             config,
+            true,
         )
         .style(|s| s.padding_left(6.0)),
         clickable_icon(
@@ -1822,6 +1824,7 @@ fn search_editor_view(
             || false,
             || "Use Regex",
             config,
+            true,
         )
         .style(|s| s.padding_horiz(6.0)),
     ))
@@ -1928,6 +1931,7 @@ fn find_view(
                     || false,
                     || "Toggle Replace",
                     config,
+                    true,
                 )
                 .style(|s| s.padding_horiz(6.0)),
                 search_editor_view(
@@ -1956,6 +1960,7 @@ fn find_view(
                     || false,
                     || "Previous Match",
                     config,
+                    true,
                 )
                 .style(|s| s.padding_left(6.0)),
                 clickable_icon(
@@ -1969,6 +1974,7 @@ fn find_view(
                     || false,
                     || "Next Match",
                     config,
+                    true,
                 )
                 .style(|s| s.padding_left(6.0)),
                 clickable_icon(
@@ -1980,6 +1986,7 @@ fn find_view(
                     || false,
                     || "Close",
                     config,
+                    true,
                 )
                 .style(|s| s.padding_horiz(6.0)),
             ))
@@ -2010,6 +2017,7 @@ fn find_view(
                     || false,
                     || "Replace Next",
                     config,
+                    true,
                 )
                 .style(|s| s.padding_left(6.0)),
                 clickable_icon(
@@ -2025,6 +2033,7 @@ fn find_view(
                     || false,
                     || "Replace All",
                     config,
+                    true,
                 )
                 .style(|s| s.padding_left(6.0)),
             ))
diff --git a/lapce-app/src/file_explorer/view.rs b/lapce-app/src/file_explorer/view.rs
index c31cfbe9b6..541075fcb9 100644
--- a/lapce-app/src/file_explorer/view.rs
+++ b/lapce-app/src/file_explorer/view.rs
@@ -463,6 +463,7 @@ fn open_editors_view(window_tab_data: Rc<WindowTabData>) -> impl View {
                 || false,
                 || "Close",
                 config,
+                true,
             )
             .on_event_stop(EventListener::PointerEnter, move |_| {
                 hovered.set(true);
diff --git a/lapce-app/src/panel/debug_view.rs b/lapce-app/src/panel/debug_view.rs
index 24417ab490..ce204c4cfc 100644
--- a/lapce-app/src/panel/debug_view.rs
+++ b/lapce-app/src/panel/debug_view.rs
@@ -85,6 +85,7 @@ fn debug_process_icons(
                     || false,
                     || "Restart",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_horiz(4.0))
             },
@@ -99,6 +100,7 @@ fn debug_process_icons(
                     move || stopped,
                     || "Stop",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_right(4.0))
             },
@@ -113,6 +115,7 @@ fn debug_process_icons(
                     || false,
                     || "Close",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_right(4.0))
             },
@@ -129,6 +132,7 @@ fn debug_process_icons(
                     move || !paused() || stopped,
                     || "Continue",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_horiz(6.0))
             },
@@ -143,6 +147,7 @@ fn debug_process_icons(
                     move || paused() || stopped,
                     || "Pause",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_right(4.0))
             },
@@ -157,6 +162,7 @@ fn debug_process_icons(
                     move || !paused() || stopped,
                     || "Step Over",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_right(4.0))
             },
@@ -171,6 +177,7 @@ fn debug_process_icons(
                     move || !paused() || stopped,
                     || "Step Into",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_right(4.0))
             },
@@ -185,6 +192,7 @@ fn debug_process_icons(
                     move || !paused() || stopped,
                     || "Step Out",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_right(4.0))
             },
@@ -199,6 +207,7 @@ fn debug_process_icons(
                     || false,
                     || "Restart",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_right(4.0))
             },
@@ -213,6 +222,7 @@ fn debug_process_icons(
                     move || stopped,
                     || "Stop",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_right(4.0))
             },
@@ -227,6 +237,7 @@ fn debug_process_icons(
                     || false,
                     || "Close",
                     config,
+                    true,
                 )
                 .style(|s| s.margin_right(4.0))
             },
@@ -669,6 +680,7 @@ fn breakpoints_view(window_tab_data: Rc<WindowTabData>) -> impl View {
                             || false,
                             || "Remove",
                             config,
+                            true,
                         )
                         .on_event_stop(EventListener::PointerDown, |_| {}),
                         checkbox(move || breakpoint.active, config)
diff --git a/lapce-app/src/panel/global_search_view.rs b/lapce-app/src/panel/global_search_view.rs
index e16ebdd190..1ecae5ccc0 100644
--- a/lapce-app/src/panel/global_search_view.rs
+++ b/lapce-app/src/panel/global_search_view.rs
@@ -59,6 +59,7 @@ pub fn global_search_panel(
                     || false,
                     || "Case Sensitive",
                     config,
+                    true,
                 )
                 .style(|s| s.padding_vert(4.0)),
                 clickable_icon(
@@ -72,6 +73,7 @@ pub fn global_search_panel(
                     || false,
                     || "Whole Word",
                     config,
+                    true,
                 )
                 .style(|s| s.padding_left(6.0)),
                 clickable_icon(
@@ -85,6 +87,7 @@ pub fn global_search_panel(
                     || false,
                     || "Use Regex",
                     config,
+                    true,
                 )
                 .style(|s| s.padding_left(6.0)),
             ))
diff --git a/lapce-app/src/panel/plugin_view.rs b/lapce-app/src/panel/plugin_view.rs
index 3b6df200d6..895c649fc7 100644
--- a/lapce-app/src/panel/plugin_view.rs
+++ b/lapce-app/src/panel/plugin_view.rs
@@ -143,6 +143,7 @@ fn installed_view(plugin: PluginData) -> impl View {
                         || false,
                         || "Options",
                         config,
+                        true,
                     )
                     .style(|s| s.padding_left(6.0))
                     .popout_menu(move || {
diff --git a/lapce-app/src/panel/terminal_view.rs b/lapce-app/src/panel/terminal_view.rs
index 018e74b796..62d5f3a132 100644
--- a/lapce-app/src/panel/terminal_view.rs
+++ b/lapce-app/src/panel/terminal_view.rs
@@ -138,6 +138,7 @@ fn terminal_tab_header(window_tab_data: Rc<WindowTabData>) -> impl View {
                                 || false,
                                 || "Close",
                                 config,
+                                true,
                             )
                             .style(|s| s.margin_horiz(6.0)),
                             empty().style(move |s| {
@@ -221,6 +222,7 @@ fn terminal_tab_header(window_tab_data: Rc<WindowTabData>) -> impl View {
             || false,
             || "New Terminal",
             config,
+            true,
         ))
         .on_resize(move |rect| {
             let width = rect.size().width;
diff --git a/lapce-app/src/panel/view.rs b/lapce-app/src/panel/view.rs
index 4f99d81f18..79ee01a4fe 100644
--- a/lapce-app/src/panel/view.rs
+++ b/lapce-app/src/panel/view.rs
@@ -63,6 +63,7 @@ fn foldable_panel_section_s(
                 || false,
                 || false,
                 config,
+                false,
             ),
             header.style(|s| s.align_items(AlignItems::Center).padding_left(3.0)),
         ))
@@ -548,6 +549,7 @@ fn panel_picker(
                     || false,
                     move || tooltip,
                     config,
+                    false,
                 )
                 .draggable()
                 .on_event_stop(EventListener::DragStart, move |_| {
diff --git a/lapce-app/src/status.rs b/lapce-app/src/status.rs
index 7758959c1f..c6890c8d78 100644
--- a/lapce-app/src/status.rs
+++ b/lapce-app/src/status.rs
@@ -69,6 +69,7 @@ pub fn status(
 
     let progresses = window_tab_data.progresses;
     let mode = create_memo(move |_| window_tab_data.mode());
+    let pointer_down = floem::reactive::create_rw_signal(false);
 
     stack((
         stack((
@@ -146,9 +147,20 @@ pub fn status(
                     )
                 })
             })
-            .on_click_stop(move |_| {
-                workbench_command.send(LapceWorkbenchCommand::PaletteSCMReferences);
-            }),
+            .on_event_cont(floem::event::EventListener::PointerDown, move |_| {
+                pointer_down.set(true);
+            })
+            .on_event(
+                floem::event::EventListener::PointerUp,
+                move |_| {
+                    if pointer_down.get() {
+                        workbench_command
+                            .send(LapceWorkbenchCommand::PaletteSCMReferences);
+                    }
+                    pointer_down.set(false);
+                    floem::EventPropagation::Continue
+                },
+            ),
             {
                 let panel = panel.clone();
                 stack((
@@ -232,6 +244,7 @@ pub fn status(
                     || false,
                     || "Toggle Left Panel",
                     config,
+                    false,
                 )
             },
             {
@@ -259,6 +272,7 @@ pub fn status(
                     || false,
                     || "Toggle Bottom Panel",
                     config,
+                    false,
                 )
             },
             {
@@ -284,6 +298,7 @@ pub fn status(
                     || false,
                     || "Toggle Right Panel",
                     config,
+                    false,
                 )
             },
         ))
diff --git a/lapce-app/src/title.rs b/lapce-app/src/title.rs
index d4957e6c1f..b2e682c790 100644
--- a/lapce-app/src/title.rs
+++ b/lapce-app/src/title.rs
@@ -57,6 +57,7 @@ fn left(
             || false,
             || "Menu",
             config,
+            false,
         )
         .popout_menu(move || window_menu(lapce_command, workbench_command))
         .style(move |s| {
@@ -164,6 +165,7 @@ fn middle(
             move || !can_jump_backward.get(),
             || "Jump Backward",
             config,
+            true,
         )
         .style(move |s| s.margin_horiz(6.0))
     };
@@ -177,6 +179,7 @@ fn middle(
             move || !can_jump_forward.get(),
             || "Jump Forward",
             config,
+            true,
         )
         .style(move |s| s.margin_right(6.0))
     };
@@ -189,6 +192,7 @@ fn middle(
             || false,
             || "Open Folder / Recent Workspace",
             config,
+            true,
         )
         .popout_menu(move || {
             Menu::new("")
@@ -267,6 +271,7 @@ fn middle(
                 || false,
                 || "Run and Debug",
                 config,
+                true,
             )
             .style(move |s| s.margin_horiz(6.0)),
             drag_window_area(empty())
@@ -321,6 +326,7 @@ fn right(
                 || false,
                 || "Settings",
                 config,
+                true,
             )
             .popout_menu(move || {
                 Menu::new("")
@@ -469,6 +475,7 @@ pub fn window_controls_view(
             || false,
             || "Minimize",
             config,
+            true,
         )
         .style(|s| s.margin_right(16.0).margin_left(10.0)),
         clickable_icon(
@@ -488,6 +495,7 @@ pub fn window_controls_view(
             || false,
             || "Maximize",
             config,
+            true,
         )
         .style(|s| s.margin_right(16.0)),
         clickable_icon(
@@ -499,6 +507,7 @@ pub fn window_controls_view(
             || false,
             || "Close Window",
             config,
+            true,
         )
         .style(|s| s.margin_right(6.0)),
     ))


Test patch: