[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
Nicolas Hake 2009-10-10 19:02:12 +02:00
parent b75e3090a4
commit a346811dff
3 changed files with 25 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
//----------------------------------------------------------------------------------------------------------------------------------
}