mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 14:38:01 +02:00
Merge branch 'ExtendedKeyShortCuts' into 'main'
Cocoa: add callback for application specific Extended keys and non-US keyboards handling. See merge request freepascal.org/lazarus/lazarus!385
This commit is contained in:
commit
dc6183cb78
@ -39,6 +39,8 @@ var
|
||||
highestHandler: nil;
|
||||
// Event to call when there is no MainForm with MainForm.close
|
||||
onQuitApp: nil;
|
||||
// Platform key Event modification function
|
||||
keyEventToVK: nil;
|
||||
);
|
||||
);
|
||||
|
||||
|
@ -148,10 +148,13 @@ type
|
||||
TCocoaApplicationEventHandler = function( event: NSEvent ): Boolean of object;
|
||||
// Need to pass to QueueAsyncCall which takes TDataEvent
|
||||
TCocoaApplicationOnAppQuitEvent = TDataEvent;
|
||||
// Platform specific NSEvent key translation to VK Keycode function
|
||||
TCocoaApplicationEventToVK = function(AEvent: NSEvent): Word;
|
||||
|
||||
TCocoaConfigApplicationEvents = record
|
||||
highestHandler: TCocoaApplicationEventHandler;
|
||||
onQuitApp: TCocoaApplicationOnAppQuitEvent;
|
||||
keyEventToVK: TCocoaApplicationEventToVK;
|
||||
end;
|
||||
|
||||
TCocoaConfigApplication = record
|
||||
|
@ -595,6 +595,9 @@ begin
|
||||
else
|
||||
VKKeyCode := MacCodeToVK(KeyCode);
|
||||
|
||||
if Assigned(CocoaConfigApplication.events.keyEventToVK) then
|
||||
VKKeyCode := CocoaConfigApplication.events.keyEventToVK(Event);
|
||||
|
||||
case VKKeyCode of
|
||||
// for sure, these are "non-printable" keys (see http://wiki.lazarus.freepascal.org/LCL_Key_Handling)
|
||||
VK_F1..VK_F24, // Function keys (F1-F12)
|
||||
|
Loading…
Reference in New Issue
Block a user