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