mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 18:21: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.
|
||||
{.$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)}
|
||||
// the first call to nextEventMatchingMask_untilDate_inMode_dequeue would
|
||||
// cause an LCL event processing loop to be called.
|
||||
|
@ -483,6 +483,9 @@ var
|
||||
win : NSWindow;
|
||||
cbnew : ICommonCallback;
|
||||
begin
|
||||
{$ifdef COCOALOOPNATIVE}
|
||||
try
|
||||
{$endif}
|
||||
idx := CocoaWidgetSet.RetainToCollect;
|
||||
win := theEvent.window;
|
||||
if not Assigned(win) then win := self.keyWindow;
|
||||
@ -542,6 +545,14 @@ begin
|
||||
|
||||
CocoaWidgetSet.ReleaseToCollect(idx);
|
||||
end;
|
||||
{$ifdef COCOALOOPNATIVE}
|
||||
except
|
||||
if Assigned(Application) and Application.CaptureExceptions then
|
||||
Application.HandleException(Application)
|
||||
else
|
||||
raise;
|
||||
end;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
function isMouseMoveEvent(tp: NSEventType): Boolean; inline;
|
||||
|
Loading…
Reference in New Issue
Block a user