Add love.window.focus (resolves #1911).

Calling the function brings the window into the foreground and makes it the focused window for keyboard input.
This commit is contained in:
Sasha Szpakowski
2023-04-01 18:02:16 -03:00
parent 0b48dacb4e
commit 2c3ea60c79
4 changed files with 18 additions and 0 deletions
+9
View File
@@ -1182,6 +1182,15 @@ void Window::restore()
}
}
void Window::focus()
{
if (window != nullptr)
{
SDL_RaiseWindow(window);
updateSettings(settings, true);
}
}
bool Window::isMaximized() const
{
return window != nullptr && (SDL_GetWindowFlags(window) & SDL_WINDOW_MAXIMIZED);
+1
View File
@@ -87,6 +87,7 @@ public:
void minimize() override;
void maximize() override;
void restore() override;
void focus() override;
bool isMaximized() const override;
bool isMinimized() const override;