Skip to content

Commit

Permalink
Fix TextInput.OnInput not firing on Wayland
Browse files Browse the repository at this point in the history
Platforms like Wayland require calling TextInputEXT.StartTextInput()
before any events are fired. With the addition, input on the debug
console and CelestNet chat will work under Wayland, whereas before both
accepted no input after being opened.
  • Loading branch information
GaimeWolves committed Mar 14, 2023
1 parent 620b7d2 commit 25ac1d9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Celeste.Mod.mm/Mod/Everest/TextInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ internal static void Initialize(Game game) {
// public static event Action<char> TextInput;
e_TextInput.AddEventHandler(null, new Action<char>(ReceiveTextInput).CastDelegate(e_TextInput.EventHandlerType));

// Some platforms like Linux/Wayland may require calling TextInputEXT.StartTextInput to receive events for TextInputEXT.TextInput
MethodInfo e_StartTextInput = t_TextInputExt?.GetMethod("StartTextInput", new Type[] { } );
e_StartTextInput?.Invoke(t_TextInputExt, null);

// SDL2 offers SDL_GetClipboardText and SDL_SetClipboardText
Type t_SDL2 = typeof(Keyboard).Assembly.GetType("SDL2.SDL");
_GetClipboardText = t_SDL2.GetMethod("SDL_GetClipboardText").CreateDelegate(typeof(Func<string>)) as Func<string>;
Expand Down

0 comments on commit 25ac1d9

Please sign in to comment.