mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 14:39:13 +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
|
var
|
||||||
CocoaConfigGlobal: TCocoaConfigGlobal = (
|
CocoaConfigGlobal: TCocoaConfigGlobal = (
|
||||||
// for compatiblity with LCL 1.8 release. The macOS base is 72ppi
|
// for compatiblity with LCL 1.8 release. The macOS base is 72ppi
|
||||||
|
@ -143,6 +143,18 @@ type
|
|||||||
dockMenu: TCocoaConfigDockMenu;
|
dockMenu: TCocoaConfigDockMenu;
|
||||||
end;
|
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
|
type
|
||||||
TCocoaConfigGlobal = record
|
TCocoaConfigGlobal = record
|
||||||
basePPI: Integer;
|
basePPI: Integer;
|
||||||
|
@ -666,6 +666,18 @@ begin
|
|||||||
expiration, mode, deqFlag);
|
expiration, mode, deqFlag);
|
||||||
{$endif}
|
{$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
|
if (Result.type_=NSApplicationDefined) and (Result.subtype=LazarusApplicationDefinedSubtypeWakeup) then
|
||||||
Result:= nil;
|
Result:= nil;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user