mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 18:00:26 +02:00
cocoa: adding cocoaloopnative approach - use Cocoa natively and catch FPC exceptions within cocoa-ws
git-svn-id: trunk@61406 -
This commit is contained in:
parent
55c5fcfd47
commit
3cba1d3b82
@ -22,6 +22,11 @@
|
|||||||
// that Cocoa performs ALL of this methods.
|
// 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
|
||||||
|
// at all. Thus if LCL implementation is changed, CocoaWS needs to be updated
|
||||||
|
{.$define COCOALOOPNATIVE}
|
||||||
|
|
||||||
{$if not defined(COCOALOOPOVERRIDE) and not defined(COCOALOOPNATIVE)}
|
{$if not defined(COCOALOOPOVERRIDE) and not defined(COCOALOOPNATIVE)}
|
||||||
// the first call to nextEventMatchingMask_untilDate_inMode_dequeue would
|
// the first call to nextEventMatchingMask_untilDate_inMode_dequeue would
|
||||||
// cause an LCL event processing loop to be called.
|
// cause an LCL event processing loop to be called.
|
||||||
|
@ -483,6 +483,9 @@ var
|
|||||||
win : NSWindow;
|
win : NSWindow;
|
||||||
cbnew : ICommonCallback;
|
cbnew : ICommonCallback;
|
||||||
begin
|
begin
|
||||||
|
{$ifdef COCOALOOPNATIVE}
|
||||||
|
try
|
||||||
|
{$endif}
|
||||||
idx := CocoaWidgetSet.RetainToCollect;
|
idx := CocoaWidgetSet.RetainToCollect;
|
||||||
win := theEvent.window;
|
win := theEvent.window;
|
||||||
if not Assigned(win) then win := self.keyWindow;
|
if not Assigned(win) then win := self.keyWindow;
|
||||||
@ -542,6 +545,14 @@ begin
|
|||||||
|
|
||||||
CocoaWidgetSet.ReleaseToCollect(idx);
|
CocoaWidgetSet.ReleaseToCollect(idx);
|
||||||
end;
|
end;
|
||||||
|
{$ifdef COCOALOOPNATIVE}
|
||||||
|
except
|
||||||
|
if Assigned(Application) and Application.CaptureExceptions then
|
||||||
|
Application.HandleException(Application)
|
||||||
|
else
|
||||||
|
raise;
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function isMouseMoveEvent(tp: NSEventType): Boolean; inline;
|
function isMouseMoveEvent(tp: NSEventType): Boolean; inline;
|
||||||
|
Loading…
Reference in New Issue
Block a user