Skip to content

Commit a699201

Browse files
committed
Fix ResetIme not starting text input with properties
1 parent 4760939 commit a699201

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

osu.Framework/Platform/SDL3/SDL3Window_Input.cs

+10-3
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,15 @@ private void pollMouse()
187187
}
188188
}
189189

190+
private SDL_PropertiesID? currentTextInputProperties;
191+
190192
public virtual void StartTextInput(TextInputProperties properties) => ScheduleCommand(() =>
191193
{
192-
var props = SDL_CreateProperties();
194+
currentTextInputProperties ??= SDL_CreateProperties();
195+
196+
var props = currentTextInputProperties.Value;
193197
SDL_SetNumberProperty(props, SDL_PROP_TEXTINPUT_TYPE_NUMBER, (long)properties.Type.ToSDLTextInputType());
194198
SDL_StartTextInputWithProperties(SDLWindowHandle, props);
195-
SDL_DestroyProperties(props);
196199
});
197200

198201
public void StopTextInput() => ScheduleCommand(() => SDL_StopTextInput(SDLWindowHandle));
@@ -204,7 +207,11 @@ public virtual void StartTextInput(TextInputProperties properties) => ScheduleCo
204207
public virtual void ResetIme() => ScheduleCommand(() =>
205208
{
206209
SDL_StopTextInput(SDLWindowHandle);
207-
SDL_StartTextInput(SDLWindowHandle);
210+
211+
if (currentTextInputProperties is SDL_PropertiesID props)
212+
SDL_StartTextInputWithProperties(SDLWindowHandle, props);
213+
else
214+
SDL_StartTextInput(SDLWindowHandle);
208215
});
209216

210217
public void SetTextInputRect(RectangleF rect) => ScheduleCommand(() =>

0 commit comments

Comments
 (0)