win32: activate application when inactive disabled form is clicked (windows does not send any other messages for such forms than WM_SETCURSOR) - fixes issue #0019069

git-svn-id: trunk@36182 -
This commit is contained in:
paul 2012-03-21 01:26:57 +00:00
parent a793b4fa1f
commit 0d66913910

View File

@ -706,9 +706,11 @@ var
lControl: TControl;
BoundsOffset: TRect;
ACursor: TCursor;
MouseMessage: Word;
begin
if (lWinControl <> nil) and not (csDesigning in lWinControl.ComponentState)
and (LOWORD(LParam) = HTCLIENT) then
if Assigned(lWinControl) then
begin
if not (csDesigning in lWinControl.ComponentState) and (LOWORD(LParam) = HTCLIENT) then
begin
ACursor := Screen.Cursor;
if ACursor = crDefault then
@ -733,6 +735,25 @@ var
Windows.SetCursor(Screen.Cursors[ACursor]);
LMessage.Result := 1;
end;
end
else
if (LOWORD(LParam) = Word(HTERROR)) then
begin
MouseMessage := HIWORD(LParam);
// a mouse click on a window
if ((MouseMessage = WM_LBUTTONDOWN) or
(MouseMessage = WM_RBUTTONDOWN) or
(MouseMessage = WM_XBUTTONDOWN)) and
Assigned(Screen) and Assigned(Screen.ActiveCustomForm) and
Screen.ActiveCustomForm.HandleAllocated and
(GetForegroundWindow <> Screen.ActiveCustomForm.Handle) then
begin
// A mouse click is happen on our application window which is not active
// we need to active it ourself. This is needed only when click is happen
// on disabled window (e.g. ShowModal is called and non modal window is clicked)
Win32WidgetSet.AppBringToFront;
end;
end;
end;
if LMessage.Result = 0 then
begin
@ -1005,7 +1026,6 @@ begin
WinProcess := True;
NotifyUserInput := False;
//WriteLn('Msg: ', WM_To_String(Msg), ' ', WndClassName(Window));
WindowInfo := GetWin32WindowInfo(Window);
if WindowInfo^.isChildEdit then
begin