summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-12-15 13:41:02 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-12-15 13:41:02 +0200
commitf8dac44a38ee4dc6472f5d01f66ca9cd7ac1adec (patch)
treedb2aad2f79670d3e56cb43b36e539daff1f88c9a /src
parentc8fcbe53279d9537895e17e15047b0142d24e4a1 (diff)
Workaround for layout issue in value input dialogs
Diffstat (limited to 'src')
-rw-r--r--src/ui/util.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index cc11db57..db24b6fc 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1699,6 +1699,12 @@ iBool valueInputHandler_(iWidget *dlg, const char *cmd) {
1699 } 1699 }
1700 return iFalse; 1700 return iFalse;
1701 } 1701 }
1702 if (equal_Command(cmd, "input.resized")) {
1703 /* BUG: A single arrange here is not sufficient, leaving a big gap between prompt and input. Why? */
1704 arrange_Widget(dlg);
1705 arrange_Widget(dlg);
1706 return iTrue;
1707 }
1702 if (equal_Command(cmd, "input.ended")) { 1708 if (equal_Command(cmd, "input.ended")) {
1703 if (argLabel_Command(cmd, "enter") && hasParent_Widget(ptr, dlg)) { 1709 if (argLabel_Command(cmd, "enter") && hasParent_Widget(ptr, dlg)) {
1704 if (arg_Command(cmd)) { 1710 if (arg_Command(cmd)) {
@@ -1861,8 +1867,9 @@ iWidget *makeValueInput_Widget(iWidget *parent, const iString *initialValue, con
1861 if (parent) { 1867 if (parent) {
1862 setFocus_Widget(as_Widget(input)); 1868 setFocus_Widget(as_Widget(input));
1863 } 1869 }
1864 /* Check that the top is in the safe area. */ { 1870 /* Check that the top is in the safe area. */
1865 int top = top_Rect(bounds_Widget(dlg)); 1871 if (deviceType_App() != desktop_AppDeviceType) {
1872 int top = top_Rect(boundsWithoutVisualOffset_Widget(dlg));
1866 int delta = top - top_Rect(safeRect_Root(dlg->root)); 1873 int delta = top - top_Rect(safeRect_Root(dlg->root));
1867 if (delta < 0) { 1874 if (delta < 0) {
1868 dlg->rect.pos.y -= delta; 1875 dlg->rect.pos.y -= delta;
@@ -2943,10 +2950,10 @@ iWidget *makeBookmarkEditor_Widget(void) {
2943 { "input id:bmed.url url:1 noheading:1" }, 2950 { "input id:bmed.url url:1 noheading:1" },
2944 { "padding" }, 2951 { "padding" },
2945 { "input id:bmed.title text:${dlg.bookmark.title}" }, 2952 { "input id:bmed.title text:${dlg.bookmark.title}" },
2946 { "input id:bmed.tags text:${dlg.bookmark.tags}" },
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) }, 2953 { "dropdown id:bmed.folder text:${dlg.bookmark.folder}", 0, 0, (const void *) constData_Array(folderItems) },
2954 { "padding" },
2955 { "input id:bmed.icon maxlen:1 text:${dlg.bookmark.icon}" },
2956 { "input id:bmed.tags text:${dlg.bookmark.tags}" },
2950 { "heading text:${heading.bookmark.tags}" }, 2957 { "heading text:${heading.bookmark.tags}" },
2951 { "toggle id:bmed.tag.home text:${bookmark.tag.home}" }, 2958 { "toggle id:bmed.tag.home text:${bookmark.tag.home}" },
2952 { "toggle id:bmed.tag.remote text:${bookmark.tag.remote}" }, 2959 { "toggle id:bmed.tag.remote text:${bookmark.tag.remote}" },
@@ -2966,24 +2973,24 @@ iWidget *makeBookmarkEditor_Widget(void) {
2966 iWidget *headings, *values; 2973 iWidget *headings, *values;
2967 addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values))); 2974 addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values)));
2968 iInputWidget *inputs[4]; 2975 iInputWidget *inputs[4];
2969 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.title}", "bmed.title", iClob(inputs[0] = new_InputWidget(0)));
2970 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.url}", "bmed.url", iClob(inputs[1] = new_InputWidget(0)));
2971 setUrlContent_InputWidget(inputs[1], iTrue);
2972 /* Folder to add to. */ { 2976 /* Folder to add to. */ {
2973 addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.bookmark.folder}"))); 2977 addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.bookmark.folder}")));
2974 const iArray *folderItems = makeBookmarkFolderItems_(iFalse); 2978 const iArray *folderItems = makeBookmarkFolderItems_(iFalse);
2975 iLabelWidget *folderButton; 2979 iLabelWidget *folderButton;
2976 setId_Widget(addChildFlags_Widget(values, 2980 setId_Widget(addChildFlags_Widget(values,
2977 iClob(folderButton = makeMenuButton_LabelWidget( 2981 iClob(folderButton = makeMenuButton_LabelWidget(
2978 widestLabel_MenuItemArray(folderItems), 2982 widestLabel_MenuItemArray(folderItems),
2979 constData_Array(folderItems), 2983 constData_Array(folderItems),
2980 size_Array(folderItems))), alignLeft_WidgetFlag), 2984 size_Array(folderItems))), alignLeft_WidgetFlag),
2981 "bmed.folder"); 2985 "bmed.folder");
2982 const uint32_t recentFolderId = recentFolder_Bookmarks(bookmarks_App()); 2986 const uint32_t recentFolderId = recentFolder_Bookmarks(bookmarks_App());
2983 updateDropdownSelection_LabelWidget( 2987 updateDropdownSelection_LabelWidget(
2984 folderButton, format_CStr(" arg:%u", recentFolderId)); 2988 folderButton, format_CStr(" arg:%u", recentFolderId));
2985 setUserData_Object(folderButton, get_Bookmarks(bookmarks_App(), recentFolderId)); 2989 setUserData_Object(folderButton, get_Bookmarks(bookmarks_App(), recentFolderId));
2986 } 2990 }
2991 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.title}", "bmed.title", iClob(inputs[0] = new_InputWidget(0)));
2992 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.url}", "bmed.url", iClob(inputs[1] = new_InputWidget(0)));
2993 setUrlContent_InputWidget(inputs[1], iTrue);
2987 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.tags}", "bmed.tags", iClob(inputs[2] = new_InputWidget(0))); 2994 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.tags}", "bmed.tags", iClob(inputs[2] = new_InputWidget(0)));
2988 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.icon}", "bmed.icon", iClob(inputs[3] = new_InputWidget(1))); 2995 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.icon}", "bmed.icon", iClob(inputs[3] = new_InputWidget(1)));
2989 /* Buttons for special tags. */ 2996 /* Buttons for special tags. */