summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-29 08:26:37 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-29 08:27:57 +0300
commit55e23dd24bf29c8aa6c257f74bac9b0b10c7e391 (patch)
treea04ec57123c0c8f5485062bc0d285f9de7ca3efd
parentf90104259c4929c86c1af630c4eff62580c3028b (diff)
Context menu behavior improvements
-rw-r--r--src/ui/util.c8
-rw-r--r--src/ui/window.c4
2 files changed, 9 insertions, 3 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index 770071a6..a24b3199 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -181,7 +181,13 @@ static iBool menuHandler_(iWidget *menu, const char *cmd) {
181 /* Don't reopen self; instead, root will close the menu. */ 181 /* Don't reopen self; instead, root will close the menu. */
182 return iFalse; 182 return iFalse;
183 } 183 }
184 if (!equal_Command(cmd, "window.resized")) { 184 if (equal_Command(cmd, "mouse.clicked") && arg_Command(cmd)) {
185 /* Dismiss open menus when clicking outside them. */
186 closeMenu_Widget(menu);
187 return iTrue;
188 }
189 if (!equal_Command(cmd, "window.resized") &&
190 !(equal_Command(cmd, "mouse.clicked") && !arg_Command(cmd)) /* ignore button release */) {
185 closeMenu_Widget(menu); 191 closeMenu_Widget(menu);
186 } 192 }
187 } 193 }
diff --git a/src/ui/window.c b/src/ui/window.c
index a8c86e56..bdf80e52 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -229,10 +229,10 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) {
229 isRequestOngoing_DocumentWidget(doc) ? stopCStr_ : reloadCStr_); 229 isRequestOngoing_DocumentWidget(doc) ? stopCStr_ : reloadCStr_);
230 } 230 }
231 } 231 }
232 else if (equal_Command(cmd, "mouse.clicked")) { 232 else if (equal_Command(cmd, "mouse.clicked") && arg_Command(cmd)) {
233 iWidget *widget = pointer_Command(cmd); 233 iWidget *widget = pointer_Command(cmd);
234 iWidget *menu = findWidget_App("doctabs.menu"); 234 iWidget *menu = findWidget_App("doctabs.menu");
235 if (isTabButton_Widget(widget)) { 235 if (isTabButton_Widget(widget) && !isVisible_Widget(menu)) {
236 iWidget *tabs = findWidget_App("doctabs"); 236 iWidget *tabs = findWidget_App("doctabs");
237 showTabPage_Widget(tabs, 237 showTabPage_Widget(tabs,
238 tabPage_Widget(tabs, childIndex_Widget(widget->parent, widget))); 238 tabPage_Widget(tabs, childIndex_Widget(widget->parent, widget)));