Skip to content

Commit a966dd7

Browse files
committed
1 parent 45ca26c commit a966dd7

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Source/fmx/WrapFmxForms.pas

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,14 @@ EInvalidFormClass = class(Exception);
122122
implementation
123123

124124
uses
125-
System.Types, System.IOUtils, System.Rtti, System.Messaging;
125+
{$IFDEF OSX}
126+
Macapi.AppKit,
127+
FMX.Platform.Mac,
128+
{$ENDIF OSX}
129+
System.Types,
130+
System.IOUtils,
131+
System.Rtti,
132+
System.Messaging;
126133

127134
{$IFDEF OSX}
128135
var
@@ -225,10 +232,17 @@ procedure TPyDelphiApplication.SetDelphiObject(const Value: TApplication);
225232
end;
226233

227234
function TPyDelphiApplication.Initialize_Wrapper(AArgs: PPyObject): PPyObject;
235+
{$IFDEF OSX}
236+
var
237+
App: NSApplication;
238+
{$ENDIF OSX}
228239
begin
229240
Application.Initialize();
230241
{$IFDEF OSX}
231-
//The application initialization routine in macOS requires
242+
// #397
243+
App := TNSApplication.Wrap(TNSApplication.OCClass.sharedApplication);
244+
if App.ActivationPolicy > 0 then
245+
App.setActivationPolicy(0);
232246
//the main form standard creation way,
233247
//due to MainMenu creation and others.
234248
Application.CreateForm(TInternalMainForm, gDelphiMainForm);

0 commit comments

Comments
 (0)