mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 21:59:15 +02:00
cocoa: restoring the use of CocoaLoopOverride for a better control of the message loop. bug #36405
git-svn-id: trunk@62413 -
This commit is contained in:
parent
a896e7f941
commit
810d3c4e27
@ -20,7 +20,7 @@
|
||||
// the first request to process an event, and run LCL loop from there.
|
||||
// Such approach is some what an ugly solution, yet it's reliable, in a sense
|
||||
// that Cocoa performs ALL of this methods.
|
||||
{.$define COCOALOOPOVERRIDE}
|
||||
{$define COCOALOOPOVERRIDE}
|
||||
|
||||
// Not override "run" method. Catch any FPC exception
|
||||
// The biggest problem of the Native approach - LCL "runloop" method is not called
|
||||
|
@ -86,6 +86,7 @@ type
|
||||
modals : NSMutableDictionary;
|
||||
inputclient : TCocoaInputClient;
|
||||
inputctx : NSTextInputContext;
|
||||
isfinishLaunch: Boolean;
|
||||
|
||||
procedure dealloc; override;
|
||||
{$ifdef COCOALOOPOVERRIDE}
|
||||
@ -120,7 +121,7 @@ type
|
||||
TCocoaWidgetSet = class(TWidgetSet)
|
||||
private
|
||||
FTerminating: Boolean;
|
||||
FNSApp: NSApplication;
|
||||
FNSApp: TCocoaApplication;
|
||||
FNSApp_Delegate: TAppDelegate;
|
||||
FCurrentCursor: HCursor;
|
||||
FCaptureControl: HWND;
|
||||
@ -224,7 +225,7 @@ type
|
||||
function RawImage_DescriptionToBitmapType(ADesc: TRawImageDescription; out bmpType: TCocoaBitmapType): Boolean;
|
||||
function GetImagePixelData(AImage: CGImageRef; out bitmapByteCount: PtrUInt): Pointer;
|
||||
class function Create32BitAlphaBitmap(ABitmap, AMask: TCocoaBitmap): TCocoaBitmap;
|
||||
property NSApp: NSApplication read FNSApp;
|
||||
property NSApp: TCocoaApplication read FNSApp;
|
||||
property CurrentCursor: HCursor read FCurrentCursor write FCurrentCursor;
|
||||
property CaptureControl: HWND read FCaptureControl;
|
||||
// the winapi compatibility methods
|
||||
|
@ -38,7 +38,7 @@ begin
|
||||
ScreenInfo.PixelsPerInchY := CocoaBasePPI;
|
||||
|
||||
{ Creates the application NSApp object }
|
||||
FNSApp := TCocoaApplication.sharedApplication;
|
||||
FNSApp := TCocoaApplication(TCocoaApplication.sharedApplication);
|
||||
FNSApp_Delegate := TAppDelegate.alloc.init;
|
||||
FNSApp.setDelegate(FNSApp_Delegate);
|
||||
|
||||
@ -69,9 +69,6 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCocoaWidgetSet.AppRun(const ALoop: TApplicationMainLoop);
|
||||
begin
|
||||
{$ifdef COCOALOOPOVERRIDE}
|
||||
NSApp.finishLaunching;
|
||||
{$endif}
|
||||
if Assigned(ALoop) then
|
||||
begin
|
||||
TCocoaApplication(NSApp).aloop:=ALoop;
|
||||
@ -84,6 +81,14 @@ var
|
||||
event: NSEvent;
|
||||
pool:NSAutoReleasePool;
|
||||
begin
|
||||
{$ifdef COCOALOOPOVERRIDE}
|
||||
if not fNSApp.isfinishLaunch then
|
||||
begin
|
||||
FNSApp.finishLaunching;
|
||||
FNSApp.isfinishLaunch := true;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
repeat
|
||||
pool := NSAutoreleasePool.alloc.init;
|
||||
{$ifdef BOOLFIX}
|
||||
|
Loading…
Reference in New Issue
Block a user