_focus and logging
Some checks are pending
Build Android / Game (Android, Release ARM64) (push) Waiting to run
Build iOS / Game (iOS, Release ARM64) (push) Waiting to run
Build Linux / Editor (Linux, Development x64) (push) Waiting to run
Build Linux / Game (Linux, Release x64) (push) Waiting to run
Build macOS / Editor (Mac, Development ARM64) (push) Waiting to run
Build macOS / Game (Mac, Release ARM64) (push) Waiting to run
Build Windows / Editor (Windows, Development x64) (push) Waiting to run
Build Windows / Game (Windows, Release x64) (push) Waiting to run
Cooker / Cook (Mac) (push) Waiting to run
Tests / Tests (Linux) (push) Waiting to run
Tests / Tests (Windows) (push) Waiting to run
Some checks are pending
Build Android / Game (Android, Release ARM64) (push) Waiting to run
Build iOS / Game (iOS, Release ARM64) (push) Waiting to run
Build Linux / Editor (Linux, Development x64) (push) Waiting to run
Build Linux / Game (Linux, Release x64) (push) Waiting to run
Build macOS / Editor (Mac, Development ARM64) (push) Waiting to run
Build macOS / Game (Mac, Release ARM64) (push) Waiting to run
Build Windows / Editor (Windows, Development x64) (push) Waiting to run
Build Windows / Game (Windows, Release x64) (push) Waiting to run
Cooker / Cook (Mac) (push) Waiting to run
Tests / Tests (Linux) (push) Waiting to run
Tests / Tests (Windows) (push) Waiting to run
This commit is contained in:
@@ -570,10 +570,12 @@ void SDLWindow::HandleEvent(SDL_Event& event)
|
||||
// Check if window size has been changed
|
||||
if (width > 0 && height > 0 && (_swapChain == nullptr || width != _swapChain->GetWidth() || height != _swapChain->GetHeight()))
|
||||
OnResize(width, height);
|
||||
LOG(Info, "Resized {}x{}", width, height);
|
||||
return;
|
||||
}
|
||||
case SDL_EVENT_WINDOW_FOCUS_GAINED:
|
||||
{
|
||||
LOG(Info, "Focus gained {}", GetTitle());
|
||||
#if PLATFORM_LINUX
|
||||
_forcedFocus = false;
|
||||
#endif
|
||||
@@ -589,6 +591,7 @@ void SDLWindow::HandleEvent(SDL_Event& event)
|
||||
}
|
||||
case SDL_EVENT_WINDOW_FOCUS_LOST:
|
||||
{
|
||||
LOG(Info, "Focus lost {}", GetTitle());
|
||||
#if PLATFORM_LINUX
|
||||
_forcedFocus = false;
|
||||
#endif
|
||||
@@ -834,8 +837,8 @@ bool SDLWindow::IsClosed() const
|
||||
bool SDLWindow::IsForegroundWindow() const
|
||||
{
|
||||
#if PLATFORM_LINUX
|
||||
if (_forcedFocus)
|
||||
return true;
|
||||
//if (_forcedFocus)
|
||||
// return true;
|
||||
#endif
|
||||
SDL_WindowFlags flags = SDL_GetWindowFlags(_window);
|
||||
return (flags & SDL_WINDOW_INPUT_FOCUS) != 0;
|
||||
@@ -996,6 +999,7 @@ void SDLWindow::SetOpacity(const float opacity)
|
||||
|
||||
void SDLWindow::Focus()
|
||||
{
|
||||
#if PLATFORM_WINDOWS
|
||||
auto activateWhenRaised = SDL_GetHint(SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED);
|
||||
SDL_SetHint(SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED, "1");
|
||||
|
||||
@@ -1007,6 +1011,9 @@ void SDLWindow::Focus()
|
||||
|
||||
SDL_SetHint(SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED, activateWhenRaised);
|
||||
//SDL_SetHint(SDL_HINT_FORCE_RAISEWINDOW, forceRaiseWindow);
|
||||
#else
|
||||
SDL_RaiseWindow(_window);
|
||||
#endif
|
||||
}
|
||||
|
||||
String SDLWindow::GetTitle() const
|
||||
|
||||
Reference in New Issue
Block a user