win32: fix bug with main window deactivation (caused by todays commit)

git-svn-id: trunk@12402 -
This commit is contained in:
paul 2007-10-10 09:26:31 +00:00
parent 7bb6447b50
commit 924b036e96
2 changed files with 8 additions and 2 deletions

View File

@ -1133,20 +1133,25 @@ begin
begin
if WParam <> 0 then // activated
begin
//WriteLn('Restore');
RestoreStayOnTopFlags(Window);
Windows.SetWindowPos(TWin32WidgetSet(WidgetSet).AppHandle, HWND_TOP,
0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
end
else
begin // deactivated
//WriteLn('Remove');
RemoveStayOnTopFlags(Window);
Windows.SetWindowPos(TWin32WidgetSet(WidgetSet).AppHandle, HWND_BOTTOM,
0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
end;
// activate/deactivate main window
if (Application <> nil) and (Application.MainForm <> nil) and
Application.MainForm.HandleAllocated then
begin
CallDefaultWindowProc(Application.MainForm.Handle, WM_NCACTIVATE, WParam, LParam);
//WriteLn('Activate/Deactivate main window');
CallDefaultWindowProc(Application.MainForm.Handle, WM_NCACTIVATE, WParam, 0);
end;
end;
end;

View File

@ -1156,7 +1156,8 @@ begin
if WindowInfo^.StayOnTopList <> nil then
begin
for I := 0 to WindowInfo^.StayOnTopList.Count - 1 do
SetWindowPos(HWND(WindowInfo^.StayOnTopList.Items[I]), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
SetWindowPos(HWND(WindowInfo^.StayOnTopList.Items[I]),
HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
FreeAndNil(WindowInfo^.StayOnTopList);
end;
end;