summaryrefslogtreecommitdiff
path: root/src/ui/util.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-09-15 14:07:33 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-09-15 14:07:33 +0300
commit0f0eef8c4228b06c5388aa4ca9e02ab8efee8273 (patch)
tree80643db8e0b71328c54277b9c5ccf172772a8f7a /src/ui/util.c
parent6580b4e2c396f2fdfb0fb017ec4249baa2fba5ff (diff)
Mobile: Minor improvements
Fixed issues: scrollbar goes under toolbar, value input dialog grows too tall, Undo/Select All in the clip menu.
Diffstat (limited to 'src/ui/util.c')
-rw-r--r--src/ui/util.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index cfa8152c..eb3d1cf2 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1218,11 +1218,23 @@ static void updateValueInputWidth_(iWidget *dlg) {
1218 dlg->rect.size.x = 1218 dlg->rect.size.x =
1219 iMin(rootSize.x, iMaxi(iMaxi(100 * gap_UI, title->rect.size.x), prompt->rect.size.x)); 1219 iMin(rootSize.x, iMaxi(iMaxi(100 * gap_UI, title->rect.size.x), prompt->rect.size.x));
1220 } 1220 }
1221 /* Adjust the maximum number of visible lines. */
1222 int footer = 6 * gap_UI + get_Window()->keyboardHeight;
1223 iWidget *buttons = findChild_Widget(dlg, "dialogbuttons");
1224 if (buttons) {
1225 footer += height_Widget(buttons);
1226 }
1227 iInputWidget *input = findChild_Widget(dlg, "input");
1228 setLineLimits_InputWidget(input,
1229 1,
1230 (bottom_Rect(safeRect_Root(dlg->root)) - footer -
1231 top_Rect(boundsWithoutVisualOffset_Widget(as_Widget(input)))) /
1232 lineHeight_Text(font_InputWidget(input)));
1221} 1233}
1222 1234
1223iBool valueInputHandler_(iWidget *dlg, const char *cmd) { 1235iBool valueInputHandler_(iWidget *dlg, const char *cmd) {
1224 iWidget *ptr = as_Widget(pointer_Command(cmd)); 1236 iWidget *ptr = as_Widget(pointer_Command(cmd));
1225 if (equal_Command(cmd, "window.resized")) { 1237 if (equal_Command(cmd, "window.resized") || equal_Command(cmd, "keyboard.changed")) {
1226 if (isVisible_Widget(dlg)) { 1238 if (isVisible_Widget(dlg)) {
1227 updateValueInputWidth_(dlg); 1239 updateValueInputWidth_(dlg);
1228 arrange_Widget(dlg); 1240 arrange_Widget(dlg);
@@ -1357,7 +1369,6 @@ iWidget *makeValueInput_Widget(iWidget *parent, const iString *initialValue, con
1357 setText_InputWidget(input, initialValue); 1369 setText_InputWidget(input, initialValue);
1358 } 1370 }
1359 setId_Widget(as_Widget(input), "input"); 1371 setId_Widget(as_Widget(input), "input");
1360 updateValueInputWidth_(dlg);
1361 addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); 1372 addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI)));
1362 addChild_Widget(dlg, 1373 addChild_Widget(dlg,
1363 iClob(makeDialogButtons_Widget( 1374 iClob(makeDialogButtons_Widget(
@@ -1379,6 +1390,7 @@ iWidget *makeValueInput_Widget(iWidget *parent, const iString *initialValue, con
1379 dlg->rect.pos.y -= delta; 1390 dlg->rect.pos.y -= delta;
1380 } 1391 }
1381 } 1392 }
1393 updateValueInputWidth_(dlg);
1382 setupSheetTransition_Mobile(dlg, incoming_TransitionFlag | top_TransitionDir); 1394 setupSheetTransition_Mobile(dlg, incoming_TransitionFlag | top_TransitionDir);
1383 return dlg; 1395 return dlg;
1384} 1396}