From 6c70a51d280647154bc39fb79b18005a07b3e2b4 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 25 Oct 2018 11:37:43 +0200 Subject: [PATCH] sculpt_manager: improved popup toggling In a corner case, the toggling of the popup menu entered a state where the menu could not be opened anymore by the user. Specifically the following input sequence triggered this problem. 1. The user opens the menu 2. The user clicks on the menu and holds the button 3. While holding the button, the user moves the pointer to the outside of the popup (e.g., to the '+' button) 4. The user releases the button. In this situation, the popup is closed but the hover information for the popup contains still the original clicked-on item. Hence, all subsequent clicks on the '+' appear as both a click on the '+' (opening the popup) and a click on the "hovered" popup entry (closing the popup). The patch explicitely clears the popup's hover information when closing the popup. --- repos/gems/src/app/sculpt_manager/main.cc | 2 ++ .../src/app/sculpt_manager/view/popup_dialog.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/repos/gems/src/app/sculpt_manager/main.cc b/repos/gems/src/app/sculpt_manager/main.cc index cad4f757e5..cfe0a8261d 100644 --- a/repos/gems/src/app/sculpt_manager/main.cc +++ b/repos/gems/src/app/sculpt_manager/main.cc @@ -347,6 +347,7 @@ struct Sculpt::Main : Input_event_handler, && !_graph.add_button_hovered()) { _popup.state = Popup::OFF; + _popup_dialog.reset_hover(); /* de-select '+' button */ _graph._gen_graph_dialog(); @@ -406,6 +407,7 @@ struct Sculpt::Main : Input_event_handler, /* close popup menu */ _popup.state = Popup::OFF; + _popup_dialog.reset_hover(); _handle_window_layout(); /* reset state of the '+' button */ diff --git a/repos/gems/src/app/sculpt_manager/view/popup_dialog.h b/repos/gems/src/app/sculpt_manager/view/popup_dialog.h index 57cd48c3c5..69268fbda4 100644 --- a/repos/gems/src/app/sculpt_manager/view/popup_dialog.h +++ b/repos/gems/src/app/sculpt_manager/view/popup_dialog.h @@ -102,6 +102,23 @@ struct Sculpt::Popup_dialog action.launch_global(_item._hovered); } + /* + * XXX + * + * This method should not be needed. However, in some situations, + * the popup menu_view does not receive a leave event when the popup + * is closed, to the effect of maintaining stale hover information + * instead of generating an empty hover report. So from the sculpt- + * manager's point of view, the popup is still hovered even if it is + * actually closed. The 'reset_hover' shortcuts the regular hover + * update in this situation. + */ + void reset_hover() + { + _item._hovered = Hoverable_item::Id(); + _hovered = false; + } + Popup_dialog(Env &env, Launchers const &launchers, Runtime_info const &runtime_info) :