forked from Mirrors/openclonk
[win32][devmode] Keep dialogs on VPs without HWND_TOPMOST
It's very annoying to have developer mode dialogs on top of everything else. Keep them on top of the current viewport, but below other apps when OC isn't the foreground.stable-5.2
parent
b75e3090a4
commit
a346811dff
|
@ -127,7 +127,7 @@ bool C4PropertyDlg::Open()
|
|||
EnableWindow( GetDlgItem(hDialog,IDC_BUTTONRELOADDEF), Console.Editing );
|
||||
// Show window
|
||||
RestoreWindowPosition(hDialog, "Property", Config.GetSubkeyPath("Console"));
|
||||
SetWindowPos(hDialog,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
|
||||
SetWindowPos(hDialog,Console.hWindow,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
|
||||
ShowWindow(hDialog,SW_SHOWNOACTIVATE);
|
||||
#else // _WIN32
|
||||
#ifdef WITH_DEVELOPER_MODE
|
||||
|
|
|
@ -285,7 +285,7 @@ bool C4ToolsDlg::Open()
|
|||
#endif
|
||||
// Show window
|
||||
RestoreWindowPosition(hDialog, "Property", Config.GetSubkeyPath("Console"));
|
||||
SetWindowPos(hDialog,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
|
||||
SetWindowPos(hDialog,Console.hWindow,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
|
||||
ShowWindow(hDialog,SW_SHOWNOACTIVATE);
|
||||
#else
|
||||
#ifdef WITH_DEVELOPER_MODE
|
||||
|
|
|
@ -170,6 +170,29 @@ LRESULT APIENTRY ViewportWinProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
cvp->Execute();
|
||||
cvp->ScrollBarsByViewPosition();
|
||||
return 0;
|
||||
//----------------------------------------------------------------------------------------------------------------------------------
|
||||
case WM_ACTIVATE:
|
||||
// Keep editing dialogs on top of the current viewport, but don't make them
|
||||
// float on other windows (i.e., no HWND_TOPMOST).
|
||||
// Also, don't use SetParent, since that activates the window, which in turn
|
||||
// posts a new WM_ACTIVATE to us, and so on, ultimately leading to a hang.
|
||||
if (LOWORD(wParam) == WA_INACTIVE)
|
||||
{
|
||||
if (Console.PropertyDlg.hDialog)
|
||||
SetWindowLong(Console.PropertyDlg.hDialog, GWL_HWNDPARENT, reinterpret_cast<LONG>(Console.hWindow));
|
||||
if (Console.ToolsDlg.hDialog)
|
||||
SetWindowLong(Console.PropertyDlg.hDialog, GWL_HWNDPARENT, reinterpret_cast<LONG>(Console.hWindow));
|
||||
} else {
|
||||
// FALLTHROUGH
|
||||
case WM_MOUSEACTIVATE:
|
||||
// WM_MOUSEACTIVATE is emitted when the user hovers over a window and pushes a mouse button.
|
||||
// Setting the window owner here avoids z-order flickering.
|
||||
if (Console.PropertyDlg.hDialog)
|
||||
SetWindowLong(Console.PropertyDlg.hDialog, GWL_HWNDPARENT, reinterpret_cast<LONG>(hwnd));
|
||||
if (Console.ToolsDlg.hDialog)
|
||||
SetWindowLong(Console.ToolsDlg.hDialog, GWL_HWNDPARENT, reinterpret_cast<LONG>(hwnd));
|
||||
}
|
||||
break;
|
||||
//----------------------------------------------------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue