Skip to content

Commit

Permalink
Fix ResetIme not starting text input with properties
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte committed Dec 23, 2024
1 parent 4760939 commit a699201
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions osu.Framework/Platform/SDL3/SDL3Window_Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,15 @@ private void pollMouse()
}
}

private SDL_PropertiesID? currentTextInputProperties;

public virtual void StartTextInput(TextInputProperties properties) => ScheduleCommand(() =>
{
var props = SDL_CreateProperties();
currentTextInputProperties ??= SDL_CreateProperties();

var props = currentTextInputProperties.Value;
SDL_SetNumberProperty(props, SDL_PROP_TEXTINPUT_TYPE_NUMBER, (long)properties.Type.ToSDLTextInputType());
SDL_StartTextInputWithProperties(SDLWindowHandle, props);
SDL_DestroyProperties(props);
});

public void StopTextInput() => ScheduleCommand(() => SDL_StopTextInput(SDLWindowHandle));
Expand All @@ -204,7 +207,11 @@ public virtual void StartTextInput(TextInputProperties properties) => ScheduleCo
public virtual void ResetIme() => ScheduleCommand(() =>
{
SDL_StopTextInput(SDLWindowHandle);
SDL_StartTextInput(SDLWindowHandle);

if (currentTextInputProperties is SDL_PropertiesID props)
SDL_StartTextInputWithProperties(SDLWindowHandle, props);
else
SDL_StartTextInput(SDLWindowHandle);
});

public void SetTextInputRect(RectangleF rect) => ScheduleCommand(() =>
Expand Down

0 comments on commit a699201

Please sign in to comment.