Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/XIVLauncher.Core/Components/Common/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class Button : Component
public Vector4 TextColor { get; set; }

public event Action? Click;

public bool TakeKeyboardFocus { get; set; }

public int? Width { get; set; }

Expand All @@ -33,6 +35,9 @@ public override void Draw()
ImGui.PushStyleColor(ImGuiCol.Button, Color);
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, HoverColor);
ImGui.PushStyleColor(ImGuiCol.Text, TextColor);

if (TakeKeyboardFocus && ImGui.IsWindowAppearing())
ImGui.SetKeyboardFocusHere();

if (ImGui.Button(Label, new Vector2(Width ?? -1, 0)) || (ImGui.IsItemFocused() && ImGui.IsKeyPressed(ImGuiKey.Enter)))
{
Expand Down
5 changes: 4 additions & 1 deletion src/XIVLauncher.Core/Components/MainPage/LoginFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ void TriggerLogin()
this.freeTrialCheckbox = new Checkbox(Strings.FreeTrialAccountCheckbox);
this.autoLoginCheckbox = new Checkbox(Strings.LogInAutomaticCheckbox);

this.loginButton = new Button(Strings.LoginButton);
this.loginButton = new Button(Strings.LoginButton)
{
TakeKeyboardFocus = true
};
this.loginButton.Click += TriggerLogin;
}

Expand Down
Loading