mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 18:37:58 +02:00
Cocoa: fix the issue that Modal Form may disappear when switching back from other apps
the issue fixed: 1. run your app, open Modal Form 2. switch to other apps 3. in the dock, right click your app ico and select "Show All Window", and select a window 4. the Modal Form is disappear (actually ordered behind the selected Form)
This commit is contained in:
parent
27f6e20118
commit
b184a37dbe
@ -122,6 +122,8 @@ type
|
||||
private
|
||||
// for the reentrancy of makeFirstResponder()
|
||||
makeFirstResponderCount: Integer;
|
||||
private
|
||||
procedure DoWindowDidBecomeKey(); message 'DoWindowDidBecomeKey';
|
||||
protected
|
||||
fieldEditor: TCocoaFieldEditor;
|
||||
firedMouseEvent: Boolean;
|
||||
@ -235,6 +237,9 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
CocoaInt;
|
||||
|
||||
{ TCocoaDesignOverlay }
|
||||
|
||||
procedure TCocoaDesignOverlay.drawRect(r: NSRect);
|
||||
@ -756,6 +761,13 @@ begin
|
||||
callback.Close;
|
||||
end;
|
||||
|
||||
procedure TCocoaWindow.DoWindowDidBecomeKey();
|
||||
begin
|
||||
if Assigned(CocoaWidgetSet.CurModalForm) then
|
||||
CocoaWidgetSet.CurModalForm.orderFront(nil);
|
||||
CursorHelper.SetCursorOnActive();
|
||||
end;
|
||||
|
||||
procedure TCocoaWindow.windowDidBecomeKey(notification: NSNotification);
|
||||
begin
|
||||
// forcing to keep the level as all other LCL windows
|
||||
@ -780,7 +792,7 @@ begin
|
||||
and (contentView.isKindOfClass(TCocoaWindowContent)) then
|
||||
self.makeFirstResponder( TCocoaWindowContent(contentView).documentView );
|
||||
|
||||
CursorHelper.SetCursorOnActive;
|
||||
performSelector_withObject_afterDelay( ObjCSelector('DoWindowDidBecomeKey'), nil, 0.1 );
|
||||
end;
|
||||
|
||||
procedure TCocoaWindow.windowDidResignKey(notification: NSNotification);
|
||||
|
Loading…
Reference in New Issue
Block a user