Fix floating window ordering and focus restoration
Keep minimizable macOS regular windows as independent top-level windows instead of Cocoa child windows while preserving their logical parent relationship.
This commit is contained in:
@@ -362,6 +362,13 @@ void WindowsWindow::BringToFront(bool force)
|
||||
{
|
||||
ASSERT(HasHWND());
|
||||
|
||||
HWND hWndInsertAfter = HWND_TOP;
|
||||
uint32 flags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER;
|
||||
if (_settings.IsTopmost)
|
||||
{
|
||||
hWndInsertAfter = HWND_TOPMOST;
|
||||
}
|
||||
|
||||
if (_settings.Type == WindowType::Regular)
|
||||
{
|
||||
if (IsIconic(_handle))
|
||||
@@ -372,22 +379,15 @@ void WindowsWindow::BringToFront(bool force)
|
||||
{
|
||||
SetActiveWindow(_handle);
|
||||
}
|
||||
SetWindowPos(_handle, hWndInsertAfter, 0, 0, 0, 0, flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWND hWndInsertAfter = HWND_TOP;
|
||||
uint32 flags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER;
|
||||
|
||||
if (!force)
|
||||
{
|
||||
flags |= SWP_NOACTIVATE;
|
||||
}
|
||||
|
||||
if (_settings.IsTopmost)
|
||||
{
|
||||
hWndInsertAfter = HWND_TOPMOST;
|
||||
}
|
||||
|
||||
SetWindowPos(_handle, hWndInsertAfter, 0, 0, 0, 0, flags);
|
||||
}
|
||||
}
|
||||
@@ -614,6 +614,7 @@ void WindowsWindow::SetOpacity(const float opacity)
|
||||
void WindowsWindow::Focus()
|
||||
{
|
||||
ASSERT(HasHWND());
|
||||
BringToFront();
|
||||
if (GetFocus() != _handle)
|
||||
{
|
||||
SetFocus(_handle);
|
||||
@@ -1130,6 +1131,10 @@ LRESULT WindowsWindow::WndProc(UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_MOUSEACTIVATE:
|
||||
if (_settings.Type == WindowType::Regular)
|
||||
BringToFront();
|
||||
break;
|
||||
case WM_CREATE:
|
||||
return 0;
|
||||
case WM_SIZE:
|
||||
|
||||
Reference in New Issue
Block a user