mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 18:20:30 +02:00
Cocoa: fix #40581, TWinControl.Focused() when Killing Focus Control on macOS
This commit is contained in:
parent
d5967d39d5
commit
5f743c0387
@ -171,6 +171,8 @@ type
|
||||
procedure DoSetMainMenu(AMenu: NSMenu; ALCLMenu: TMenu);
|
||||
public
|
||||
KeyWindow: NSWindow;
|
||||
KillingFocus: Boolean;
|
||||
|
||||
// modal session
|
||||
Modals : TList;
|
||||
ModalCounter: Integer; // the cheapest way to determine if modal window was called
|
||||
|
@ -2148,6 +2148,8 @@ var
|
||||
lclobj : TObject;
|
||||
begin
|
||||
Result := 0;
|
||||
if KillingFocus then
|
||||
Exit;
|
||||
|
||||
win := NSApp.keyWindow;
|
||||
if not Assigned(win) then
|
||||
|
@ -1376,7 +1376,12 @@ end;
|
||||
procedure TLCLCommonCallback.ResignFirstResponder;
|
||||
begin
|
||||
if not Assigned(Target) then Exit;
|
||||
LCLSendKillFocusMsg(Target);
|
||||
CocoaWidgetSet.KillingFocus:= true;
|
||||
try
|
||||
LCLSendKillFocusMsg(Target);
|
||||
finally
|
||||
CocoaWidgetSet.KillingFocus:= false;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLCLCommonCallback.DidBecomeKeyNotification;
|
||||
|
Loading…
Reference in New Issue
Block a user