summaryrefslogtreecommitdiff
path: root/src/ui/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/util.c')
-rw-r--r--src/ui/util.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index f1cab9ba..ff6f8822 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -243,6 +243,12 @@ iWidget *addAction_Widget(iWidget *parent, int key, int kmods, const char *comma
243 243
244/*-----------------------------------------------------------------------------------------------*/ 244/*-----------------------------------------------------------------------------------------------*/
245 245
246static iBool isCommandIgnoredByMenus_(const char *cmd) {
247 return equal_Command(cmd, "media.updated") || equal_Command(cmd, "document.request.updated") ||
248 equal_Command(cmd, "window.resized") ||
249 (equal_Command(cmd, "mouse.clicked") && !arg_Command(cmd)); /* button released */
250}
251
246static iBool menuHandler_(iWidget *menu, const char *cmd) { 252static iBool menuHandler_(iWidget *menu, const char *cmd) {
247 if (isVisible_Widget(menu)) { 253 if (isVisible_Widget(menu)) {
248 if (equalWidget_Command(cmd, menu, "menu.opened")) { 254 if (equalWidget_Command(cmd, menu, "menu.opened")) {
@@ -258,8 +264,7 @@ static iBool menuHandler_(iWidget *menu, const char *cmd) {
258 closeMenu_Widget(menu); 264 closeMenu_Widget(menu);
259 return iTrue; 265 return iTrue;
260 } 266 }
261 if (!equal_Command(cmd, "window.resized") && 267 if (!isCommandIgnoredByMenus_(cmd)) {
262 !(equal_Command(cmd, "mouse.clicked") && !arg_Command(cmd)) /* ignore button release */) {
263 closeMenu_Widget(menu); 268 closeMenu_Widget(menu);
264 } 269 }
265 } 270 }
@@ -734,10 +739,9 @@ void updateValueInput_Widget(iWidget *d, const char *title, const char *prompt)
734 739
735static iBool messageHandler_(iWidget *msg, const char *cmd) { 740static iBool messageHandler_(iWidget *msg, const char *cmd) {
736 /* Almost any command dismisses the sheet. */ 741 /* Almost any command dismisses the sheet. */
737// if (equal_Command(cmd, "menu.closed")) { 742 if (!(equal_Command(cmd, "media.updated") || equal_Command(cmd, "document.request.updated"))) {
738// return iFalse; 743 destroy_Widget(msg);
739// } 744 }
740 destroy_Widget(msg);
741 return iFalse; 745 return iFalse;
742} 746}
743 747
@@ -808,7 +812,7 @@ iWidget *makePreferences_Widget(void) {
808 addChild_Widget(dlg, iClob(page)); 812 addChild_Widget(dlg, iClob(page));
809 setFlags_Widget(page, arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag, iTrue); 813 setFlags_Widget(page, arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag, iTrue);
810 iWidget *headings = addChildFlags_Widget( 814 iWidget *headings = addChildFlags_Widget(
811 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); 815 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag);
812 iWidget *values = addChildFlags_Widget( 816 iWidget *values = addChildFlags_Widget(
813 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); 817 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag);
814 addChild_Widget(headings, iClob(makeHeading_Widget("Downloads folder:"))); 818 addChild_Widget(headings, iClob(makeHeading_Widget("Downloads folder:")));
@@ -817,7 +821,7 @@ iWidget *makePreferences_Widget(void) {
817 addChild_Widget(headings, iClob(makeHeading_Widget("Use system theme:"))); 821 addChild_Widget(headings, iClob(makeHeading_Widget("Use system theme:")));
818 addChild_Widget(values, iClob(makeToggle_Widget("prefs.ostheme"))); 822 addChild_Widget(values, iClob(makeToggle_Widget("prefs.ostheme")));
819#endif 823#endif
820 addChild_Widget(headings, iClob(makeHeading_Widget("Theme:"))); 824 addChild_Widget(headings, iClob(makeHeading_Widget("Theme:")));
821 iWidget *themes = new_Widget(); 825 iWidget *themes = new_Widget();
822 /* Themes. */ { 826 /* Themes. */ {
823 setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("Pure Black", 0, 0, "theme.set arg:0"))), "prefs.theme.0"); 827 setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("Pure Black", 0, 0, "theme.set arg:0"))), "prefs.theme.0");