diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/inputwidget.c | 4 | ||||
-rw-r--r-- | src/ui/util.c | 25 |
2 files changed, 24 insertions, 5 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index 66419a16..fe897ed4 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -2121,6 +2121,10 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) { | |||
2121 | updateAfterVisualOffsetChange_InputWidget_(d, w->root); | 2121 | updateAfterVisualOffsetChange_InputWidget_(d, w->root); |
2122 | } | 2122 | } |
2123 | } | 2123 | } |
2124 | else if (d->sysCtrl && isCommand_UserEvent(ev, "menu.opened")) { | ||
2125 | setFocus_Widget(NULL); | ||
2126 | return iFalse; | ||
2127 | } | ||
2124 | #endif | 2128 | #endif |
2125 | if (isCommand_Widget(w, ev, "focus.gained")) { | 2129 | if (isCommand_Widget(w, ev, "focus.gained")) { |
2126 | begin_InputWidget(d); | 2130 | begin_InputWidget(d); |
diff --git a/src/ui/util.c b/src/ui/util.c index 8446416d..cc11db57 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -651,7 +651,7 @@ static iBool isCommandIgnoredByMenus_(const char *cmd) { | |||
651 | if (equal_Command(cmd, "window.focus.lost") || | 651 | if (equal_Command(cmd, "window.focus.lost") || |
652 | equal_Command(cmd, "window.focus.gained")) return iTrue; | 652 | equal_Command(cmd, "window.focus.gained")) return iTrue; |
653 | /* TODO: Perhaps a common way of indicating which commands are notifications and should not | 653 | /* TODO: Perhaps a common way of indicating which commands are notifications and should not |
654 | be reacted to by menus? */ | 654 | be reacted to by menus?! */ |
655 | return equal_Command(cmd, "media.updated") || | 655 | return equal_Command(cmd, "media.updated") || |
656 | equal_Command(cmd, "media.player.update") || | 656 | equal_Command(cmd, "media.player.update") || |
657 | startsWith_CStr(cmd, "feeds.update.") || | 657 | startsWith_CStr(cmd, "feeds.update.") || |
@@ -672,6 +672,8 @@ static iBool isCommandIgnoredByMenus_(const char *cmd) { | |||
672 | equal_Command(cmd, "window.mouse.exited") || | 672 | equal_Command(cmd, "window.mouse.exited") || |
673 | equal_Command(cmd, "window.mouse.entered") || | 673 | equal_Command(cmd, "window.mouse.entered") || |
674 | equal_Command(cmd, "input.backup") || | 674 | equal_Command(cmd, "input.backup") || |
675 | equal_Command(cmd, "input.ended") || | ||
676 | equal_Command(cmd, "focus.lost") || | ||
675 | (equal_Command(cmd, "mouse.clicked") && !arg_Command(cmd)); /* button released */ | 677 | (equal_Command(cmd, "mouse.clicked") && !arg_Command(cmd)); /* button released */ |
676 | } | 678 | } |
677 | 679 | ||
@@ -703,6 +705,13 @@ static iBool menuHandler_(iWidget *menu, const char *cmd) { | |||
703 | closeMenu_Widget(menu); | 705 | closeMenu_Widget(menu); |
704 | return iTrue; | 706 | return iTrue; |
705 | } | 707 | } |
708 | if (deviceType_App() == phone_AppDeviceType && equal_Command(cmd, "keyboard.changed") && | ||
709 | arg_Command(cmd) == 0) { | ||
710 | /* May need to reposition the menu. */ | ||
711 | menu->rect.pos = windowToLocal_Widget(menu, init_I2(left_Rect(bounds_Widget(menu)), | ||
712 | bottom_Rect(safeRect_Root(menu->root)) - menu->rect.size.y)); | ||
713 | return iFalse; | ||
714 | } | ||
706 | if (!isCommandIgnoredByMenus_(cmd)) { | 715 | if (!isCommandIgnoredByMenus_(cmd)) { |
707 | closeMenu_Widget(menu); | 716 | closeMenu_Widget(menu); |
708 | } | 717 | } |
@@ -2894,7 +2903,7 @@ static iBool isBookmarkFolder_(void *context, const iBookmark *bm) { | |||
2894 | return isFolder_Bookmark(bm); | 2903 | return isFolder_Bookmark(bm); |
2895 | } | 2904 | } |
2896 | 2905 | ||
2897 | static const iArray *makeBookmarkFolderItems_(void) { | 2906 | static const iArray *makeBookmarkFolderItems_(iBool withNullTerminator) { |
2898 | iArray *folders = new_Array(sizeof(iMenuItem)); | 2907 | iArray *folders = new_Array(sizeof(iMenuItem)); |
2899 | pushBack_Array(folders, &(iMenuItem){ "\u2014", 0, 0, "dlg.bookmark.setfolder arg:0" }); | 2908 | pushBack_Array(folders, &(iMenuItem){ "\u2014", 0, 0, "dlg.bookmark.setfolder arg:0" }); |
2900 | iConstForEach( | 2909 | iConstForEach( |
@@ -2915,6 +2924,9 @@ static const iArray *makeBookmarkFolderItems_(void) { | |||
2915 | 0, | 2924 | 0, |
2916 | format_CStr("dlg.bookmark.setfolder arg:%u", id_Bookmark(bm)) }); | 2925 | format_CStr("dlg.bookmark.setfolder arg:%u", id_Bookmark(bm)) }); |
2917 | } | 2926 | } |
2927 | if (withNullTerminator) { | ||
2928 | pushBack_Array(folders, &(iMenuItem){ NULL }); | ||
2929 | } | ||
2918 | return collect_Array(folders); | 2930 | return collect_Array(folders); |
2919 | } | 2931 | } |
2920 | 2932 | ||
@@ -2924,6 +2936,7 @@ iWidget *makeBookmarkEditor_Widget(void) { | |||
2924 | { uiTextCaution_ColorEscape "${dlg.bookmark.save}", SDLK_RETURN, KMOD_PRIMARY, "bmed.accept" } | 2936 | { uiTextCaution_ColorEscape "${dlg.bookmark.save}", SDLK_RETURN, KMOD_PRIMARY, "bmed.accept" } |
2925 | }; | 2937 | }; |
2926 | if (isUsingPanelLayout_Mobile()) { | 2938 | if (isUsingPanelLayout_Mobile()) { |
2939 | const iArray *folderItems = makeBookmarkFolderItems_(iTrue); | ||
2927 | const iMenuItem items[] = { | 2940 | const iMenuItem items[] = { |
2928 | { "title id:bmed.heading text:${heading.bookmark.edit}" }, | 2941 | { "title id:bmed.heading text:${heading.bookmark.edit}" }, |
2929 | { "heading id:dlg.bookmark.url" }, | 2942 | { "heading id:dlg.bookmark.url" }, |
@@ -2932,6 +2945,8 @@ iWidget *makeBookmarkEditor_Widget(void) { | |||
2932 | { "input id:bmed.title text:${dlg.bookmark.title}" }, | 2945 | { "input id:bmed.title text:${dlg.bookmark.title}" }, |
2933 | { "input id:bmed.tags text:${dlg.bookmark.tags}" }, | 2946 | { "input id:bmed.tags text:${dlg.bookmark.tags}" }, |
2934 | { "input id:bmed.icon maxlen:1 text:${dlg.bookmark.icon}" }, | 2947 | { "input id:bmed.icon maxlen:1 text:${dlg.bookmark.icon}" }, |
2948 | { "padding" }, | ||
2949 | { "dropdown id:bmed.folder text:${dlg.bookmark.folder}", 0, 0, (const void *) constData_Array(folderItems) }, | ||
2935 | { "heading text:${heading.bookmark.tags}" }, | 2950 | { "heading text:${heading.bookmark.tags}" }, |
2936 | { "toggle id:bmed.tag.home text:${bookmark.tag.home}" }, | 2951 | { "toggle id:bmed.tag.home text:${bookmark.tag.home}" }, |
2937 | { "toggle id:bmed.tag.remote text:${bookmark.tag.remote}" }, | 2952 | { "toggle id:bmed.tag.remote text:${bookmark.tag.remote}" }, |
@@ -2956,7 +2971,7 @@ iWidget *makeBookmarkEditor_Widget(void) { | |||
2956 | setUrlContent_InputWidget(inputs[1], iTrue); | 2971 | setUrlContent_InputWidget(inputs[1], iTrue); |
2957 | /* Folder to add to. */ { | 2972 | /* Folder to add to. */ { |
2958 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.bookmark.folder}"))); | 2973 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.bookmark.folder}"))); |
2959 | const iArray *folderItems = makeBookmarkFolderItems_(); | 2974 | const iArray *folderItems = makeBookmarkFolderItems_(iFalse); |
2960 | iLabelWidget *folderButton; | 2975 | iLabelWidget *folderButton; |
2961 | setId_Widget(addChildFlags_Widget(values, | 2976 | setId_Widget(addChildFlags_Widget(values, |
2962 | iClob(folderButton = makeMenuButton_LabelWidget( | 2977 | iClob(folderButton = makeMenuButton_LabelWidget( |
@@ -3153,13 +3168,13 @@ iWidget *makeFeedSettings_Widget(uint32_t bookmarkId) { | |||
3153 | setText_InputWidget(findChild_Widget(dlg, "feedcfg.title"), | 3168 | setText_InputWidget(findChild_Widget(dlg, "feedcfg.title"), |
3154 | bm ? &bm->title : feedTitle_DocumentWidget(document_App())); | 3169 | bm ? &bm->title : feedTitle_DocumentWidget(document_App())); |
3155 | setFlags_Widget(findChild_Widget(dlg, | 3170 | setFlags_Widget(findChild_Widget(dlg, |
3156 | bm->flags & headings_BookmarkFlag | 3171 | bm && bm->flags & headings_BookmarkFlag |
3157 | ? "feedcfg.type.headings" | 3172 | ? "feedcfg.type.headings" |
3158 | : "feedcfg.type.gemini"), | 3173 | : "feedcfg.type.gemini"), |
3159 | selected_WidgetFlag, | 3174 | selected_WidgetFlag, |
3160 | iTrue); | 3175 | iTrue); |
3161 | setToggle_Widget(findChild_Widget(dlg, "feedcfg.ignoreweb"), | 3176 | setToggle_Widget(findChild_Widget(dlg, "feedcfg.ignoreweb"), |
3162 | bm->flags & ignoreWeb_BookmarkFlag); | 3177 | bm && bm->flags & ignoreWeb_BookmarkFlag); |
3163 | setCommandHandler_Widget(dlg, handleFeedSettingCommands_); | 3178 | setCommandHandler_Widget(dlg, handleFeedSettingCommands_); |
3164 | } | 3179 | } |
3165 | setupSheetTransition_Mobile(dlg, incoming_TransitionFlag); | 3180 | setupSheetTransition_Mobile(dlg, incoming_TransitionFlag); |