summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-08-28 08:53:24 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-08-28 08:53:24 +0300
commitabe38195588660abc717f13454d8dd28e425fd9e (patch)
tree589533269218aa58f99c1841f351521359a5cb0a /src
parent39cd19ffe677bf7d89681932d42469f54d70d86a (diff)
InputWidget: Tell SDL where text input is happening
Diffstat (limited to 'src')
-rw-r--r--src/ui/inputwidget.c7
1 files changed, 7 insertions, 0 deletions
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) {
541 return size_Range(&d->visWrapLines) * lineHeight_Text(d->font); 541 return size_Range(&d->visWrapLines) * lineHeight_Text(d->font);
542} 542}
543 543
544static void updateTextInputRect_InputWidget_(const iInputWidget *d) {
545 const iRect bounds = bounds_Widget(constAs_Widget(d));
546 SDL_SetTextInputRect(&(SDL_Rect){ bounds.pos.x, bounds.pos.y, bounds.size.x, bounds.size.y });
547}
548
544static void updateMetrics_InputWidget_(iInputWidget *d) { 549static void updateMetrics_InputWidget_(iInputWidget *d) {
545 iWidget *w = as_Widget(d); 550 iWidget *w = as_Widget(d);
546 updateSizeForFixedLength_InputWidget_(d); 551 updateSizeForFixedLength_InputWidget_(d);
@@ -553,6 +558,7 @@ static void updateMetrics_InputWidget_(iInputWidget *d) {
553 invalidateBuffered_InputWidget_(d); 558 invalidateBuffered_InputWidget_(d);
554 if (height_Rect(w->rect) != oldHeight) { 559 if (height_Rect(w->rect) != oldHeight) {
555 postCommand_Widget(d, "input.resized"); 560 postCommand_Widget(d, "input.resized");
561 updateTextInputRect_InputWidget_(d);
556 } 562 }
557} 563}
558 564
@@ -988,6 +994,7 @@ void begin_InputWidget(iInputWidget *d) {
988 iZap(d->mark); 994 iZap(d->mark);
989 } 995 }
990 enableEditorKeysInMenus_(iFalse); 996 enableEditorKeysInMenus_(iFalse);
997 updateTextInputRect_InputWidget_(d);
991 updateVisible_InputWidget_(d); 998 updateVisible_InputWidget_(d);
992} 999}
993 1000