From abe38195588660abc717f13454d8dd28e425fd9e Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 28 Aug 2021 08:53:24 +0300 Subject: InputWidget: Tell SDL where text input is happening --- src/ui/inputwidget.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/ui') diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index fa65cf3c..690107a2 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c @@ -541,6 +541,11 @@ static int contentHeight_InputWidget_(const iInputWidget *d) { return size_Range(&d->visWrapLines) * lineHeight_Text(d->font); } +static void updateTextInputRect_InputWidget_(const iInputWidget *d) { + const iRect bounds = bounds_Widget(constAs_Widget(d)); + SDL_SetTextInputRect(&(SDL_Rect){ bounds.pos.x, bounds.pos.y, bounds.size.x, bounds.size.y }); +} + static void updateMetrics_InputWidget_(iInputWidget *d) { iWidget *w = as_Widget(d); updateSizeForFixedLength_InputWidget_(d); @@ -553,6 +558,7 @@ static void updateMetrics_InputWidget_(iInputWidget *d) { invalidateBuffered_InputWidget_(d); if (height_Rect(w->rect) != oldHeight) { postCommand_Widget(d, "input.resized"); + updateTextInputRect_InputWidget_(d); } } @@ -988,6 +994,7 @@ void begin_InputWidget(iInputWidget *d) { iZap(d->mark); } enableEditorKeysInMenus_(iFalse); + updateTextInputRect_InputWidget_(d); updateVisible_InputWidget_(d); } -- cgit v1.2.3