mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 15:49:27 +02:00
Cocoa: fix #40692, the bug of Modal Window
This commit is contained in:
parent
7157791611
commit
6f8a824944
@ -171,7 +171,6 @@ type
|
||||
procedure DoSetMainMenu(AMenu: NSMenu; ALCLMenu: TMenu);
|
||||
public
|
||||
// modal session
|
||||
CurModalForm: NSWindow;
|
||||
Modals : TList;
|
||||
ModalCounter: Integer; // the cheapest way to determine if modal window was called
|
||||
// used in mouse handling (in callbackobject)
|
||||
@ -218,6 +217,7 @@ type
|
||||
procedure SetMainMenu(const AMenu: HMENU; const ALCLMenu: TMenu);
|
||||
function StartModal(awin: NSWindow; hasMenu: Boolean): Boolean;
|
||||
procedure EndModal(awin: NSWindow);
|
||||
function CurModalForm: NSWindow;
|
||||
function isTopModalWin(awin: NSWindow): Boolean;
|
||||
function isModalSession: Boolean;
|
||||
|
||||
@ -946,13 +946,22 @@ begin
|
||||
wakeupEventLoop;
|
||||
end;
|
||||
|
||||
function TCocoaWidgetSet.CurModalForm: NSWindow;
|
||||
begin
|
||||
if isModalSession then begin
|
||||
Result := TModalSession(Modals[Modals.Count-1]).window;
|
||||
end else begin
|
||||
Result:= nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCocoaWidgetSet.isTopModalWin(awin: NSWindow): Boolean;
|
||||
begin
|
||||
if not isModalSession then begin
|
||||
Result := false;
|
||||
Exit;
|
||||
if Assigned(awin) then begin
|
||||
Result:= CurModalForm=awin;
|
||||
end else begin
|
||||
Result:= false;
|
||||
end;
|
||||
Result := TModalSession(Modals[Modals.Count-1]).window = awin;
|
||||
end;
|
||||
|
||||
function TCocoaWidgetSet.isModalSession: Boolean;
|
||||
|
@ -411,7 +411,6 @@ begin
|
||||
{$IFDEF COCOA_USE_NATIVE_MODAL}
|
||||
NSApp.stopModal();
|
||||
{$ENDIF}
|
||||
CocoaWidgetSet.CurModalForm := nil;
|
||||
{// Felipe: This code forces focusing another form, its a work around
|
||||
// for a gdb issue, gdb doesn't start the app properly
|
||||
//
|
||||
@ -936,7 +935,6 @@ begin
|
||||
if (not fullscreen) and (lWinContent.window.isKindOfClass(TCocoaWindow)) then
|
||||
fullscreen := TCocoaWindow(lWinContent.window).lclIsFullScreen;
|
||||
|
||||
CocoaWidgetSet.CurModalForm := lWinContent.lclOwnWindow;
|
||||
// LCL initialization code would cause the custom form to be disabled
|
||||
// (due to the fact, ShowModal() has not been called yet, and a previous form
|
||||
// might be disabled at the time.
|
||||
|
Loading…
Reference in New Issue
Block a user