Browse Source

* ptcpas update: support the F13..F35 function keys on platforms that recognize them

Nikolay Nikolov 3 years ago
parent
commit
5dcdfeb126

+ 6 - 0
packages/ptc/docs/CHANGES.txt

@@ -13,6 +13,12 @@
      resizable windowed output
      OpenGL support
      returning a mode list
+ - added support for the F13..F35 function keys (via the newly introduced
+   PTCKEY_F13..PTCKEY_F35 constants) on platforms that are capable of
+   recognizing them:
+     X11 supports F1..F35
+     Windows supports F1..F24
+     macOS supports F1..F19 (and some Apple keyboards have them)
 
 0.99.15
  - dead key support under Windows and X11 (via XIM)

+ 23 - 0
packages/ptc/examples/keyboard3.pp

@@ -113,6 +113,29 @@ begin
     PTCKEY_F10          : Result := 'PTCKEY_F10';
     PTCKEY_F11          : Result := 'PTCKEY_F11';
     PTCKEY_F12          : Result := 'PTCKEY_F12';
+    PTCKEY_F13          : Result := 'PTCKEY_F13';
+    PTCKEY_F14          : Result := 'PTCKEY_F14';
+    PTCKEY_F15          : Result := 'PTCKEY_F15';
+    PTCKEY_F16          : Result := 'PTCKEY_F16';
+    PTCKEY_F17          : Result := 'PTCKEY_F17';
+    PTCKEY_F18          : Result := 'PTCKEY_F18';
+    PTCKEY_F19          : Result := 'PTCKEY_F19';
+    PTCKEY_F20          : Result := 'PTCKEY_F20';
+    PTCKEY_F21          : Result := 'PTCKEY_F21';
+    PTCKEY_F22          : Result := 'PTCKEY_F22';
+    PTCKEY_F23          : Result := 'PTCKEY_F23';
+    PTCKEY_F24          : Result := 'PTCKEY_F24';
+    PTCKEY_F25          : Result := 'PTCKEY_F25';
+    PTCKEY_F26          : Result := 'PTCKEY_F26';
+    PTCKEY_F27          : Result := 'PTCKEY_F27';
+    PTCKEY_F28          : Result := 'PTCKEY_F28';
+    PTCKEY_F29          : Result := 'PTCKEY_F29';
+    PTCKEY_F30          : Result := 'PTCKEY_F30';
+    PTCKEY_F31          : Result := 'PTCKEY_F31';
+    PTCKEY_F32          : Result := 'PTCKEY_F32';
+    PTCKEY_F33          : Result := 'PTCKEY_F33';
+    PTCKEY_F34          : Result := 'PTCKEY_F34';
+    PTCKEY_F35          : Result := 'PTCKEY_F35';
     PTCKEY_DELETE       : Result := 'PTCKEY_DELETE';
     PTCKEY_NUMLOCK      : Result := 'PTCKEY_NUMLOCK';
     PTCKEY_SCROLLLOCK   : Result := 'PTCKEY_SCROLLLOCK';

+ 7 - 7
packages/ptc/src/cocoa/cocoaconsolei.inc

@@ -277,13 +277,13 @@ begin
     109: exit(PTCKEY_F10);
     103: exit(PTCKEY_F11);
     111: exit(PTCKEY_F12);
-    105: exit(0);  // F13
-    107: exit(0);  // F14
-    113: exit(0);  // F15
-    106: exit(0);  // F16
-    64:  exit(0);  // F17
-    79:  exit(0);  // F18
-    80:  exit(0);  // F19
+    105: exit(PTCKEY_F13);
+    107: exit(PTCKEY_F14);
+    113: exit(PTCKEY_F15);
+    106: exit(PTCKEY_F16);
+    64:  exit(PTCKEY_F17);
+    79:  exit(PTCKEY_F18);
+    80:  exit(PTCKEY_F19);
     115: exit(PTCKEY_HOME);
     119: exit(PTCKEY_END);
     116: exit(PTCKEY_PAGEUP);

+ 24 - 1
packages/ptc/src/core/keyeventd.inc

@@ -1,6 +1,6 @@
 {
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003, 2006, 2007, 2009-2011, 2015, 2017  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011, 2015, 2017, 2021  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
     This library is free software; you can redistribute it and/or
@@ -193,3 +193,26 @@ const
   PTCKEY_BACKQUOTE    = $C0;
   PTCKEY_QUOTE        = $DE;
   PTCKEY_COMMAND      = $100;
+  PTCKEY_F13          = $101;
+  PTCKEY_F14          = $102;
+  PTCKEY_F15          = $103;
+  PTCKEY_F16          = $104;
+  PTCKEY_F17          = $105;
+  PTCKEY_F18          = $106;
+  PTCKEY_F19          = $107;
+  PTCKEY_F20          = $108;
+  PTCKEY_F21          = $109;
+  PTCKEY_F22          = $10A;
+  PTCKEY_F23          = $10B;
+  PTCKEY_F24          = $10C;
+  PTCKEY_F25          = $10D;
+  PTCKEY_F26          = $10E;
+  PTCKEY_F27          = $10F;
+  PTCKEY_F28          = $110;
+  PTCKEY_F29          = $111;
+  PTCKEY_F30          = $112;
+  PTCKEY_F31          = $113;
+  PTCKEY_F32          = $114;
+  PTCKEY_F33          = $115;
+  PTCKEY_F34          = $116;
+  PTCKEY_F35          = $117;

+ 3 - 1
packages/ptc/src/win32/base/win32kbd.inc

@@ -1,6 +1,6 @@
 {
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003, 2006, 2007, 2009-2012, 2017  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2012, 2017, 2021  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
     This library is free software; you can redistribute it and/or
@@ -235,6 +235,8 @@ begin
       KeyCode := PTCKEY_SEMICOLON;
     if wParam = VK_OEM_2 then
       KeyCode := PTCKEY_SLASH;
+    if (wParam >= VK_F13) and (wParam <= VK_F24) then
+      KeyCode := wParam + (PTCKEY_F13 - VK_F13);
 
     { handle key repeat count }
     for i := 1 to lParam and $FFFF do

+ 24 - 1
packages/ptc/src/x11/x11displayi.inc

@@ -1,6 +1,6 @@
 {
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2013, 2015-2017 Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2013, 2015-2017, 2021 Nikolay Nikolov ([email protected])
     Original C++ version by Christian Nentwich ([email protected])
 
     This library is free software; you can redistribute it and/or
@@ -380,6 +380,29 @@ begin
   FFunctionKeys[$FF and XK_F10] := Integer(PTCKEY_F10);
   FFunctionKeys[$FF and XK_F11] := Integer(PTCKEY_F11);
   FFunctionKeys[$FF and XK_F12] := Integer(PTCKEY_F12);
+  FFunctionKeys[$FF and XK_F13] := Integer(PTCKEY_F13);
+  FFunctionKeys[$FF and XK_F14] := Integer(PTCKEY_F14);
+  FFunctionKeys[$FF and XK_F15] := Integer(PTCKEY_F15);
+  FFunctionKeys[$FF and XK_F16] := Integer(PTCKEY_F16);
+  FFunctionKeys[$FF and XK_F17] := Integer(PTCKEY_F17);
+  FFunctionKeys[$FF and XK_F18] := Integer(PTCKEY_F18);
+  FFunctionKeys[$FF and XK_F19] := Integer(PTCKEY_F19);
+  FFunctionKeys[$FF and XK_F20] := Integer(PTCKEY_F20);
+  FFunctionKeys[$FF and XK_F21] := Integer(PTCKEY_F21);
+  FFunctionKeys[$FF and XK_F22] := Integer(PTCKEY_F22);
+  FFunctionKeys[$FF and XK_F23] := Integer(PTCKEY_F23);
+  FFunctionKeys[$FF and XK_F24] := Integer(PTCKEY_F24);
+  FFunctionKeys[$FF and XK_F25] := Integer(PTCKEY_F25);
+  FFunctionKeys[$FF and XK_F26] := Integer(PTCKEY_F26);
+  FFunctionKeys[$FF and XK_F27] := Integer(PTCKEY_F27);
+  FFunctionKeys[$FF and XK_F28] := Integer(PTCKEY_F28);
+  FFunctionKeys[$FF and XK_F29] := Integer(PTCKEY_F29);
+  FFunctionKeys[$FF and XK_F30] := Integer(PTCKEY_F30);
+  FFunctionKeys[$FF and XK_F31] := Integer(PTCKEY_F31);
+  FFunctionKeys[$FF and XK_F32] := Integer(PTCKEY_F32);
+  FFunctionKeys[$FF and XK_F33] := Integer(PTCKEY_F33);
+  FFunctionKeys[$FF and XK_F34] := Integer(PTCKEY_F34);
+  FFunctionKeys[$FF and XK_F35] := Integer(PTCKEY_F35);
 
   FFunctionKeys[$FF and XK_Shift_L] := Integer(PTCKEY_SHIFT);
   FFunctionKeys[$FF and XK_Shift_R] := Integer(PTCKEY_SHIFT);