diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-14 15:09:54 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-14 15:09:54 +0300 |
commit | 21b16be87fec3ec163fb52b94619ba5f3b5df6d2 (patch) | |
tree | 73df8c1469f9d7f4186b40ea7b8d34c5b6dfd7bf /src/ui/inputwidget.c | |
parent | 7f737f1b88448a8a2ccca716a09e3b37fb0c08f9 (diff) |
Mobile and iOS: Various fixes and cleanup
Several regressions occurred when the split view mode was implemented.
Diffstat (limited to 'src/ui/inputwidget.c')
-rw-r--r-- | src/ui/inputwidget.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index d9985a8b..59bb8331 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -156,6 +156,9 @@ static iRect contentBounds_InputWidget_(const iInputWidget *d) { | |||
156 | neg_I2(addX_I2(padding_(), d->rightPadding))); | 156 | neg_I2(addX_I2(padding_(), d->rightPadding))); |
157 | shrink_Rect(&bounds, init_I2(gap_UI * (flags_Widget(w) & tight_WidgetFlag ? 1 : 2), 0)); | 157 | shrink_Rect(&bounds, init_I2(gap_UI * (flags_Widget(w) & tight_WidgetFlag ? 1 : 2), 0)); |
158 | bounds.pos.y += padding_().y / 2; | 158 | bounds.pos.y += padding_().y / 2; |
159 | if (flags_Widget(w) & extraPadding_WidgetFlag) { | ||
160 | bounds.pos.y += gap_UI; | ||
161 | } | ||
159 | return bounds; | 162 | return bounds; |
160 | } | 163 | } |
161 | 164 | ||
@@ -955,6 +958,9 @@ static iRect bounds_InputWidget_(const iInputWidget *d) { | |||
955 | return bounds; | 958 | return bounds; |
956 | } | 959 | } |
957 | bounds.size.y = contentHeight_InputWidget_(d, iFalse) + 3 * padding_().y; | 960 | bounds.size.y = contentHeight_InputWidget_(d, iFalse) + 3 * padding_().y; |
961 | if (w->flags & extraPadding_WidgetFlag) { | ||
962 | bounds.size.y += 2 * gap_UI; | ||
963 | } | ||
958 | return bounds; | 964 | return bounds; |
959 | } | 965 | } |
960 | 966 | ||
@@ -1006,6 +1012,13 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) { | |||
1006 | } | 1012 | } |
1007 | return iFalse; | 1013 | return iFalse; |
1008 | } | 1014 | } |
1015 | else if (isCommand_UserEvent(ev, "text.insert")) { | ||
1016 | pushUndo_InputWidget_(d); | ||
1017 | deleteMarked_InputWidget_(d); | ||
1018 | insertChar_InputWidget_(d, arg_Command(command_UserEvent(ev))); | ||
1019 | contentsWereChanged_InputWidget_(d); | ||
1020 | return iTrue; | ||
1021 | } | ||
1009 | else if (isMetricsChange_UserEvent(ev)) { | 1022 | else if (isMetricsChange_UserEvent(ev)) { |
1010 | updateMetrics_InputWidget_(d); | 1023 | updateMetrics_InputWidget_(d); |
1011 | updateLinesAndResize_InputWidget_(d); | 1024 | updateLinesAndResize_InputWidget_(d); |
@@ -1351,7 +1364,8 @@ static void draw_InputWidget_(const iInputWidget *d) { | |||
1351 | isFocused ? gap_UI / 4 : 1, | 1364 | isFocused ? gap_UI / 4 : 1, |
1352 | isFocused ? uiInputFrameFocused_ColorId | 1365 | isFocused ? uiInputFrameFocused_ColorId |
1353 | : isHover ? uiInputFrameHover_ColorId : uiInputFrame_ColorId); | 1366 | : isHover ? uiInputFrameHover_ColorId : uiInputFrame_ColorId); |
1354 | setClip_Paint(&p, adjusted_Rect(bounds, init_I2(d->leftPadding, 0), init_I2(-d->rightPadding, 0))); | 1367 | setClip_Paint(&p, adjusted_Rect(bounds, init_I2(d->leftPadding, 0), |
1368 | init_I2(-d->rightPadding, w->flags & extraPadding_WidgetFlag ? -gap_UI / 2 : 0))); | ||
1355 | const iRect contentBounds = contentBounds_InputWidget_(d); | 1369 | const iRect contentBounds = contentBounds_InputWidget_(d); |
1356 | // const iInt2 textOrigin = textOrigin_InputWidget_(d); //, cstr_String(text)); | 1370 | // const iInt2 textOrigin = textOrigin_InputWidget_(d); //, cstr_String(text)); |
1357 | iInt2 drawPos = topLeft_Rect(contentBounds); | 1371 | iInt2 drawPos = topLeft_Rect(contentBounds); |