mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-22 10:39:23 +02:00
win32: apply Dmitry patch with modifications for fixing application focus - move focus to last focused window on getting focus event (issue #0015494)
git-svn-id: trunk@23911 -
This commit is contained in:
parent
c45eae6352
commit
a77478ebb9
@ -2028,11 +2028,27 @@ begin
|
||||
begin
|
||||
HandleSetCursor;
|
||||
end;
|
||||
CM_ACTIVATE:
|
||||
begin
|
||||
if (Window = Win32WidgetSet.AppHandle) then
|
||||
begin
|
||||
if not IsIconic(Window) and IsWindow(WindowLastFocused) then
|
||||
SetFocus(WindowLastFocused);
|
||||
Result := 0;
|
||||
Exit;
|
||||
end;
|
||||
WinProcess := False;
|
||||
end;
|
||||
WM_SETFOCUS:
|
||||
begin
|
||||
{$ifdef DEBUG_CARET}
|
||||
DebugLn('WM_SETFOCUS received for window ', IntToHex(Window, 8));
|
||||
{$endif}
|
||||
// move focus to another application window but process event first
|
||||
if (Window = Win32WidgetSet.AppHandle) then
|
||||
PostMessage(Window, CM_ACTIVATE, 0, 0)
|
||||
else
|
||||
WindowLastFocused := Window;
|
||||
// handle feature mouse-click, setfocus, mouse-click -> double-click
|
||||
if (Window <> MouseDownWindow) and (MouseDownFocusStatus <> mfNone) then
|
||||
begin
|
||||
|
@ -269,6 +269,7 @@ var
|
||||
MouseDownWindow: HWND = 0;
|
||||
MouseDownFocusWindow: HWND;
|
||||
MouseDownFocusStatus: TMouseDownFocusStatus = mfNone;
|
||||
WindowLastFocused: HWND = 0;
|
||||
ComboBoxHandleSizeWindow: HWND = 0;
|
||||
IgnoreNextCharWindow: HWND = 0; // ignore next WM_(SYS)CHAR message
|
||||
// set to true, if we are redirecting a WM_MOUSEWHEEL message, to prevent recursion
|
||||
|
Loading…
Reference in New Issue
Block a user