mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 00:38:10 +02:00
Cocoa: add event handler to TCocoaConfigApplication, see also !351
This commit is contained in:
parent
a1655315ce
commit
fa5e325c86
@ -32,6 +32,14 @@ var
|
||||
);
|
||||
);
|
||||
|
||||
var
|
||||
CocoaConfigApplication: TCocoaConfigApplication = (
|
||||
event: (
|
||||
// highest priority event handler
|
||||
highestHandler: nil;
|
||||
);
|
||||
);
|
||||
|
||||
var
|
||||
CocoaConfigGlobal: TCocoaConfigGlobal = (
|
||||
// for compatiblity with LCL 1.8 release. The macOS base is 72ppi
|
||||
|
@ -143,6 +143,18 @@ type
|
||||
dockMenu: TCocoaConfigDockMenu;
|
||||
end;
|
||||
|
||||
type
|
||||
// return True for event Handled, bypass post system processing
|
||||
TCocoaApplicationEventHandler = function( event: NSEvent ): Boolean of object;
|
||||
|
||||
TCocoaConfigApplicationEvent = record
|
||||
highestHandler: TCocoaApplicationEventHandler;
|
||||
end;
|
||||
|
||||
TCocoaConfigApplication = record
|
||||
event: TCocoaConfigApplicationEvent;
|
||||
end;
|
||||
|
||||
type
|
||||
TCocoaConfigGlobal = record
|
||||
basePPI: Integer;
|
||||
|
@ -666,6 +666,18 @@ begin
|
||||
expiration, mode, deqFlag);
|
||||
{$endif}
|
||||
|
||||
{
|
||||
Monitors from NSEvent.addLocalMonitorForEvents aren't called until
|
||||
NSApplication.sendEvent, so it's not early enough to capture the tracking
|
||||
run loop behavior below or to prevent key events going into KeyEvBefore, and
|
||||
Application.OnUserInput doesn't allow filtering messages.
|
||||
see also !351
|
||||
}
|
||||
if Assigned(Result) and Assigned(CocoaConfigApplication.event.highestHandler) then begin
|
||||
if CocoaConfigApplication.event.highestHandler(Result) then
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if (Result.type_=NSApplicationDefined) and (Result.subtype=LazarusApplicationDefinedSubtypeWakeup) then
|
||||
Result:= nil;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user