View Issue Details

IDProjectCategoryView StatusLast Update
0021748LazarusLCLpublic2017-04-10 11:18
ReporterDavid JenkinsAssigned ToJuha Manninen 
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Version0.9.30.5 (SVN)Product Build 
Target VersionFixed in Version 
Summary0021748: Extend Carbon keyboard shortcut handling for punctuation keys, etc
DescriptionExtend keyboard shortcut handling for punctuation keys, F13-F19, numpad keys, help, and clear. Numpad keys are mapped to standard keys. Change VK_ handling so higher-level functions see Mac specific keys (e.g. F14 instead of Print Screen, Help instead of Ins, Clear instead of NumLock).

Patches against rev 36681 are attached
TagsNo tags attached.
Fixed in Revisionr54598
LazTarget-
WidgetsetCarbon
Attached Files
  • carbonmenus.pp.patch (625 bytes)
    --- /Users/djenkins/laz-changes/14583/carbonmenus.pp	2012-04-11 11:29:16.000000000 
    +++ /Users/djenkins/laz-changes/14583/carbonmenus.pp.ss	2012-04-11 11:29:56.000000000 
    @@ -719,7 +719,7 @@
         // unset virtual key short cut
         OSError(ChangeMenuItemAttributes(FParentMenu.Menu, Index + 1, 0, kMenuItemAttrUseVirtualKey),
           Self, Sname, SChangeMenuItemAttrs);
    -    OSError(SetMenuItemCommandKey(FParentMenu.Menu, Index + 1, False, Key),
    +    OSError(SetMenuItemCommandKey(FParentMenu.Menu, Index + 1, False, VirtualKeyCodeToCharCode(Key)),
           Self, SName, SSetCmdKey);
       end
       else // use mac virtual key code
    
    carbonmenus.pp.patch (625 bytes)
  • carbonprivatewindow.inc.patch (1,650 bytes)
    --- /Users/djenkins/laz-changes/14583/carbonprivatewindow.inc	2012-04-11 11:30:33.000000000 
    +++ /Users/djenkins/laz-changes/14583/carbonprivatewindow.inc.ss	2012-04-11 11:31:55.000000000 
    @@ -514,12 +514,16 @@
           MK_F10      : VKKeyCode:=VK_F10;
           MK_F11      : VKKeyCode:=VK_F11;
           MK_F12      : VKKeyCode:=VK_F12;
    -      MK_F13      : VKKeyCode:=VK_SNAPSHOT;
    -      MK_F14      : VKKeyCode:=VK_SCROLL;
    -      MK_F15      : VKKeyCode:=VK_PAUSE;
    +      MK_F13      : VKKeyCode:=VK_F13;
    +      MK_F14      : VKKeyCode:=VK_F14;
    +      MK_F15      : VKKeyCode:=VK_F15;
    +      MK_F16      : VKKeyCode:=VK_F16;
    +      MK_F17      : VKKeyCode:=VK_F17;
    +      MK_F18      : VKKeyCode:=VK_F18;
    +      MK_F19      : VKKeyCode:=VK_F19;
           MK_POWER    : VKKeyCode:=VK_SLEEP; //?
           MK_TAB      : VKKeyCode:=VK_TAB; //strangely enough, tab is "non printable"
    -      MK_INS      : VKKeyCode:=VK_INSERT;
    +      MK_HELP     : VKKeyCode:=VK_HELP;
           MK_DEL      : VKKeyCode:=VK_DELETE;
           MK_HOME     : VKKeyCode:=VK_HOME;
           MK_END      : VKKeyCode:=VK_END;
    @@ -529,7 +533,7 @@
           MK_DOWN     : VKKeyCode:=VK_DOWN;
           MK_LEFT     : VKKeyCode:= VK_LEFT;
           MK_RIGHT    : VKKeyCode:= VK_RIGHT;
    -      MK_NUMLOCK  : VKKeyCode:= VK_NUMLOCK;
    +      MK_CLEAR    : VKKeyCode:= VK_CLEAR;
         end;
         
         if VKKeyCode<>VK_UNKNOWN then
    @@ -663,6 +667,7 @@
               MK_PADSUB  : VKKeyCode:=VK_SUBTRACT;
               MK_PADADD  : VKKeyCode:=VK_ADD;
               MK_PADDEC  : VKKeyCode:=VK_DECIMAL;
    +          MK_PADEQUALS: VKKeyCode:=VK_OEM_PLUS;
               MK_PADENTER:
                 begin
                   VKKeyCode:=VK_RETURN;
    
  • carbonproc.pp.patch (2,620 bytes)
    --- /Users/djenkins/laz-changes/14583/carbonproc.pp	2012-04-11 11:32:54.000000000 
    +++ /Users/djenkins/laz-changes/14583/carbonproc.pp.ss	2012-04-11 11:34:04.000000000 
    @@ -71,6 +71,7 @@
     {$I mackeycodes.inc}
     
     function VirtualKeyCodeToMac(AKey: Word): Word;
    +function VirtualKeyCodeToCharCode(AKey: Word): Word;
     
     function GetBorderWindowAttrs(const ABorderStyle: TFormBorderStyle;
       const ABorderIcons: TBorderIcons): WindowAttributes;
    @@ -301,8 +302,8 @@
       VK_NUMPAD7   : Result := MK_NUMPAD7;
       VK_NUMPAD8   : Result := MK_NUMPAD8;
       VK_NUMPAD9   : Result := MK_NUMPAD9;
    -  VK_MULTIPLY  : Result := MK_PADMULT;
    -  VK_ADD       : Result := MK_PADADD;
    +//VK_MULTIPLY  : Result := MK_PADMULT;
    +//VK_ADD       : Result := MK_PADADD;
       VK_SEPARATOR : Result := MK_PADDEC;
       VK_SUBTRACT  : Result := MK_PADSUB;
       VK_DECIMAL   : Result := MK_PADDEC;
    @@ -322,13 +323,18 @@
       VK_F13       : Result := MK_F13;
       VK_F14       : Result := MK_F14;
       VK_F15       : Result := MK_F15;
    +  VK_F16       : Result := MK_F16;
    +  VK_F17       : Result := MK_F17;
    +  VK_F18       : Result := MK_F18;
    +  VK_F19       : Result := MK_F19;
       VK_NUMLOCK   : Result := MK_NUMLOCK;
    +  VK_CLEAR     : Result := MK_CLEAR;
       VK_SCROLL    : Result := MK_SCRLOCK;
       VK_SHIFT     : Result := MK_SHIFTKEY;
       VK_CONTROL   : Result := MK_COMMAND;
       VK_MENU      : Result := MK_ALT;
       VK_OEM_3     : Result := MK_TILDE;
    -  VK_OEM_MINUS : Result := MK_MINUS;
    +//VK_OEM_MINUS : Result := MK_MINUS;
       VK_OEM_PLUS  : Result := MK_EQUAL;
       VK_OEM_5     : Result := MK_BACKSLASH;
       VK_OEM_4     : Result := MK_LEFTBRACKET;
    @@ -336,10 +342,29 @@
       VK_OEM_1     : Result := MK_SEMICOLON;
       VK_OEM_7     : Result := MK_QUOTE;
       VK_OEM_COMMA : Result := MK_COMMA;
    -  VK_OEM_PERIOD: Result := MK_PERIOD;
    -  VK_OEM_2     : Result := MK_SLASH;
    +//VK_OEM_PERIOD: Result := MK_PERIOD;
    +//VK_OEM_2     : Result := MK_SLASH;
       else
         Result := 0;
    +  end;
    +end;
    +
    +{------------------------------------------------------------------------------
    +  Name:    VirtualKeyCodeToCharCode
    +  Returns: The char code for the specified virtual key or the original
    +  virtual key.  Must be called after VirtualKeyCodeToMac since char codes
    +  overlap VK_ codes.
    + ------------------------------------------------------------------------------}
    +function VirtualKeyCodeToCharCode(AKey: Word): Word;
    +begin
    +  case AKey of
    +  VK_MULTIPLY  : Result := Ord('*');
    +  VK_ADD       : Result := Ord('+');
    +  VK_OEM_MINUS : Result := Ord('-');
    +  VK_OEM_PERIOD: Result := Ord('.');
    +  VK_OEM_2     : Result := Ord('/');
    +  else
    +    Result := AKey;
       end;
     end;
     
    
    carbonproc.pp.patch (2,620 bytes)
  • mackeycodes.inc.patch (826 bytes)
    --- /Users/djenkins/laz-changes/14583/mackeycodes.inc	2012-04-11 11:34:55.000000000 
    +++ /Users/djenkins/laz-changes/14583/mackeycodes.inc.ss	2012-04-11 11:35:46.000000000 
    @@ -38,6 +38,10 @@
       MK_F13       = $69; MK_PRNSCR  = MK_F13;  //Print screen = F13
       MK_F14       = $6B; MK_SCRLOCK = MK_F14;  //Scroll Lock = F14
       MK_F15       = $71; MK_PAUSE   = MK_F15;  //Pause = F15
    +  MK_F16       = $6A;
    +  MK_F17       = $40;
    +  MK_F18       = $4F;
    +  MK_F19       = $50;
       MK_POWER     = $7F7F;
       MK_TAB       = $30;
       MK_INS       = $72; MK_HELP    = MK_INS;  //old macs call this key "help"
    @@ -50,7 +54,7 @@
       MK_DOWN      = $7D;
       MK_LEFT      = $7B;
       MK_RIGHT     = $7C;
    -  MK_NUMLOCK   = $47;
    +  MK_NUMLOCK   = $47; MK_CLEAR   = MK_NUMLOCK;
       MK_NUMPAD0   = $52;
       MK_NUMPAD1   = $53;
       MK_NUMPAD2   = $54;
    
    mackeycodes.inc.patch (826 bytes)
  • svn_patch-21748 (6,227 bytes)
    Index: lcl/interfaces/carbon/carbonproc.pp
    ===================================================================
    --- lcl/interfaces/carbon/carbonproc.pp	(revision 36681)
    +++ lcl/interfaces/carbon/carbonproc.pp	(working copy)
    @@ -71,6 +71,7 @@
     {$I mackeycodes.inc}
     
     function VirtualKeyCodeToMac(AKey: Word): Word;
    +function VirtualKeyCodeToCharCode(AKey: Word): Word;
     
     function GetBorderWindowAttrs(const ABorderStyle: TFormBorderStyle;
       const ABorderIcons: TBorderIcons): WindowAttributes;
    @@ -301,8 +302,8 @@
       VK_NUMPAD7   : Result := MK_NUMPAD7;
       VK_NUMPAD8   : Result := MK_NUMPAD8;
       VK_NUMPAD9   : Result := MK_NUMPAD9;
    -  VK_MULTIPLY  : Result := MK_PADMULT;
    -  VK_ADD       : Result := MK_PADADD;
    +//VK_MULTIPLY  : Result := MK_PADMULT;
    +//VK_ADD       : Result := MK_PADADD;
       VK_SEPARATOR : Result := MK_PADDEC;
       VK_SUBTRACT  : Result := MK_PADSUB;
       VK_DECIMAL   : Result := MK_PADDEC;
    @@ -322,13 +323,18 @@
       VK_F13       : Result := MK_F13;
       VK_F14       : Result := MK_F14;
       VK_F15       : Result := MK_F15;
    +  VK_F16       : Result := MK_F16;
    +  VK_F17       : Result := MK_F17;
    +  VK_F18       : Result := MK_F18;
    +  VK_F19       : Result := MK_F19;
       VK_NUMLOCK   : Result := MK_NUMLOCK;
    +  VK_CLEAR     : Result := MK_CLEAR;
       VK_SCROLL    : Result := MK_SCRLOCK;
       VK_SHIFT     : Result := MK_SHIFTKEY;
       VK_CONTROL   : Result := MK_COMMAND;
       VK_MENU      : Result := MK_ALT;
       VK_OEM_3     : Result := MK_TILDE;
    -  VK_OEM_MINUS : Result := MK_MINUS;
    +//VK_OEM_MINUS : Result := MK_MINUS;
       VK_OEM_PLUS  : Result := MK_EQUAL;
       VK_OEM_5     : Result := MK_BACKSLASH;
       VK_OEM_4     : Result := MK_LEFTBRACKET;
    @@ -336,14 +342,33 @@
       VK_OEM_1     : Result := MK_SEMICOLON;
       VK_OEM_7     : Result := MK_QUOTE;
       VK_OEM_COMMA : Result := MK_COMMA;
    -  VK_OEM_PERIOD: Result := MK_PERIOD;
    -  VK_OEM_2     : Result := MK_SLASH;
    +//VK_OEM_PERIOD: Result := MK_PERIOD;
    +//VK_OEM_2     : Result := MK_SLASH;
       else
         Result := 0;
       end;
     end;
     
     {------------------------------------------------------------------------------
    +  Name:    VirtualKeyCodeToCharCode
    +  Returns: The char code for the specified virtual key or the original
    +  virtual key.  Must be called after VirtualKeyCodeToMac since char codes
    +  overlap VK_ codes.
    + ------------------------------------------------------------------------------}
    +function VirtualKeyCodeToCharCode(AKey: Word): Word;
    +begin
    +  case AKey of
    +  VK_MULTIPLY  : Result := Ord('*');
    +  VK_ADD       : Result := Ord('+');
    +  VK_OEM_MINUS : Result := Ord('-');
    +  VK_OEM_PERIOD: Result := Ord('.');
    +  VK_OEM_2     : Result := Ord('/');
    +  else
    +    Result := AKey;
    +  end;
    +end;
    +
    +{------------------------------------------------------------------------------
       Name:    GetBorderWindowAttrs
       Returns: Converts the form border style and icons to Carbon window attributes
      ------------------------------------------------------------------------------}
    Index: lcl/interfaces/carbon/carbonprivatewindow.inc
    ===================================================================
    --- lcl/interfaces/carbon/carbonprivatewindow.inc	(revision 36681)
    +++ lcl/interfaces/carbon/carbonprivatewindow.inc	(working copy)
    @@ -514,12 +514,16 @@
           MK_F10      : VKKeyCode:=VK_F10;
           MK_F11      : VKKeyCode:=VK_F11;
           MK_F12      : VKKeyCode:=VK_F12;
    -      MK_F13      : VKKeyCode:=VK_SNAPSHOT;
    -      MK_F14      : VKKeyCode:=VK_SCROLL;
    -      MK_F15      : VKKeyCode:=VK_PAUSE;
    +      MK_F13      : VKKeyCode:=VK_F13;
    +      MK_F14      : VKKeyCode:=VK_F14;
    +      MK_F15      : VKKeyCode:=VK_F15;
    +      MK_F16      : VKKeyCode:=VK_F16;
    +      MK_F17      : VKKeyCode:=VK_F17;
    +      MK_F18      : VKKeyCode:=VK_F18;
    +      MK_F19      : VKKeyCode:=VK_F19;
           MK_POWER    : VKKeyCode:=VK_SLEEP; //?
           MK_TAB      : VKKeyCode:=VK_TAB; //strangely enough, tab is "non printable"
    -      MK_INS      : VKKeyCode:=VK_INSERT;
    +      MK_HELP     : VKKeyCode:=VK_HELP;
           MK_DEL      : VKKeyCode:=VK_DELETE;
           MK_HOME     : VKKeyCode:=VK_HOME;
           MK_END      : VKKeyCode:=VK_END;
    @@ -529,7 +533,7 @@
           MK_DOWN     : VKKeyCode:=VK_DOWN;
           MK_LEFT     : VKKeyCode:= VK_LEFT;
           MK_RIGHT    : VKKeyCode:= VK_RIGHT;
    -      MK_NUMLOCK  : VKKeyCode:= VK_NUMLOCK;
    +      MK_CLEAR    : VKKeyCode:= VK_CLEAR;
         end;
         
         if VKKeyCode<>VK_UNKNOWN then
    @@ -663,6 +667,7 @@
               MK_PADSUB  : VKKeyCode:=VK_SUBTRACT;
               MK_PADADD  : VKKeyCode:=VK_ADD;
               MK_PADDEC  : VKKeyCode:=VK_DECIMAL;
    +          MK_PADEQUALS: VKKeyCode:=VK_OEM_PLUS;
               MK_PADENTER:
                 begin
                   VKKeyCode:=VK_RETURN;
    Index: lcl/interfaces/carbon/mackeycodes.inc
    ===================================================================
    --- lcl/interfaces/carbon/mackeycodes.inc	(revision 36681)
    +++ lcl/interfaces/carbon/mackeycodes.inc	(working copy)
    @@ -38,6 +38,10 @@
       MK_F13       = $69; MK_PRNSCR  = MK_F13;  //Print screen = F13
       MK_F14       = $6B; MK_SCRLOCK = MK_F14;  //Scroll Lock = F14
       MK_F15       = $71; MK_PAUSE   = MK_F15;  //Pause = F15
    +  MK_F16       = $6A;
    +  MK_F17       = $40;
    +  MK_F18       = $4F;
    +  MK_F19       = $50;
       MK_POWER     = $7F7F;
       MK_TAB       = $30;
       MK_INS       = $72; MK_HELP    = MK_INS;  //old macs call this key "help"
    @@ -50,7 +54,7 @@
       MK_DOWN      = $7D;
       MK_LEFT      = $7B;
       MK_RIGHT     = $7C;
    -  MK_NUMLOCK   = $47;
    +  MK_NUMLOCK   = $47; MK_CLEAR   = MK_NUMLOCK;
       MK_NUMPAD0   = $52;
       MK_NUMPAD1   = $53;
       MK_NUMPAD2   = $54;
    Index: lcl/interfaces/carbon/carbonmenus.pp
    ===================================================================
    --- lcl/interfaces/carbon/carbonmenus.pp	(revision 36681)
    +++ lcl/interfaces/carbon/carbonmenus.pp	(working copy)
    @@ -719,7 +719,7 @@
         // unset virtual key short cut
         OSError(ChangeMenuItemAttributes(FParentMenu.Menu, Index + 1, 0, kMenuItemAttrUseVirtualKey),
           Self, Sname, SChangeMenuItemAttrs);
    -    OSError(SetMenuItemCommandKey(FParentMenu.Menu, Index + 1, False, Key),
    +    OSError(SetMenuItemCommandKey(FParentMenu.Menu, Index + 1, False, VirtualKeyCodeToCharCode(Key)),
           Self, SName, SSetCmdKey);
       end
       else // use mac virtual key code
    
    svn_patch-21748 (6,227 bytes)

Activities

2012-04-13 21:11

 

carbonmenus.pp.patch (625 bytes)
--- /Users/djenkins/laz-changes/14583/carbonmenus.pp	2012-04-11 11:29:16.000000000 
+++ /Users/djenkins/laz-changes/14583/carbonmenus.pp.ss	2012-04-11 11:29:56.000000000 
@@ -719,7 +719,7 @@
     // unset virtual key short cut
     OSError(ChangeMenuItemAttributes(FParentMenu.Menu, Index + 1, 0, kMenuItemAttrUseVirtualKey),
       Self, Sname, SChangeMenuItemAttrs);
-    OSError(SetMenuItemCommandKey(FParentMenu.Menu, Index + 1, False, Key),
+    OSError(SetMenuItemCommandKey(FParentMenu.Menu, Index + 1, False, VirtualKeyCodeToCharCode(Key)),
       Self, SName, SSetCmdKey);
   end
   else // use mac virtual key code
carbonmenus.pp.patch (625 bytes)

2012-04-13 21:11

 

carbonprivatewindow.inc.patch (1,650 bytes)
--- /Users/djenkins/laz-changes/14583/carbonprivatewindow.inc	2012-04-11 11:30:33.000000000 
+++ /Users/djenkins/laz-changes/14583/carbonprivatewindow.inc.ss	2012-04-11 11:31:55.000000000 
@@ -514,12 +514,16 @@
       MK_F10      : VKKeyCode:=VK_F10;
       MK_F11      : VKKeyCode:=VK_F11;
       MK_F12      : VKKeyCode:=VK_F12;
-      MK_F13      : VKKeyCode:=VK_SNAPSHOT;
-      MK_F14      : VKKeyCode:=VK_SCROLL;
-      MK_F15      : VKKeyCode:=VK_PAUSE;
+      MK_F13      : VKKeyCode:=VK_F13;
+      MK_F14      : VKKeyCode:=VK_F14;
+      MK_F15      : VKKeyCode:=VK_F15;
+      MK_F16      : VKKeyCode:=VK_F16;
+      MK_F17      : VKKeyCode:=VK_F17;
+      MK_F18      : VKKeyCode:=VK_F18;
+      MK_F19      : VKKeyCode:=VK_F19;
       MK_POWER    : VKKeyCode:=VK_SLEEP; //?
       MK_TAB      : VKKeyCode:=VK_TAB; //strangely enough, tab is "non printable"
-      MK_INS      : VKKeyCode:=VK_INSERT;
+      MK_HELP     : VKKeyCode:=VK_HELP;
       MK_DEL      : VKKeyCode:=VK_DELETE;
       MK_HOME     : VKKeyCode:=VK_HOME;
       MK_END      : VKKeyCode:=VK_END;
@@ -529,7 +533,7 @@
       MK_DOWN     : VKKeyCode:=VK_DOWN;
       MK_LEFT     : VKKeyCode:= VK_LEFT;
       MK_RIGHT    : VKKeyCode:= VK_RIGHT;
-      MK_NUMLOCK  : VKKeyCode:= VK_NUMLOCK;
+      MK_CLEAR    : VKKeyCode:= VK_CLEAR;
     end;
     
     if VKKeyCode<>VK_UNKNOWN then
@@ -663,6 +667,7 @@
           MK_PADSUB  : VKKeyCode:=VK_SUBTRACT;
           MK_PADADD  : VKKeyCode:=VK_ADD;
           MK_PADDEC  : VKKeyCode:=VK_DECIMAL;
+          MK_PADEQUALS: VKKeyCode:=VK_OEM_PLUS;
           MK_PADENTER:
             begin
               VKKeyCode:=VK_RETURN;

2012-04-13 21:12

 

carbonproc.pp.patch (2,620 bytes)
--- /Users/djenkins/laz-changes/14583/carbonproc.pp	2012-04-11 11:32:54.000000000 
+++ /Users/djenkins/laz-changes/14583/carbonproc.pp.ss	2012-04-11 11:34:04.000000000 
@@ -71,6 +71,7 @@
 {$I mackeycodes.inc}
 
 function VirtualKeyCodeToMac(AKey: Word): Word;
+function VirtualKeyCodeToCharCode(AKey: Word): Word;
 
 function GetBorderWindowAttrs(const ABorderStyle: TFormBorderStyle;
   const ABorderIcons: TBorderIcons): WindowAttributes;
@@ -301,8 +302,8 @@
   VK_NUMPAD7   : Result := MK_NUMPAD7;
   VK_NUMPAD8   : Result := MK_NUMPAD8;
   VK_NUMPAD9   : Result := MK_NUMPAD9;
-  VK_MULTIPLY  : Result := MK_PADMULT;
-  VK_ADD       : Result := MK_PADADD;
+//VK_MULTIPLY  : Result := MK_PADMULT;
+//VK_ADD       : Result := MK_PADADD;
   VK_SEPARATOR : Result := MK_PADDEC;
   VK_SUBTRACT  : Result := MK_PADSUB;
   VK_DECIMAL   : Result := MK_PADDEC;
@@ -322,13 +323,18 @@
   VK_F13       : Result := MK_F13;
   VK_F14       : Result := MK_F14;
   VK_F15       : Result := MK_F15;
+  VK_F16       : Result := MK_F16;
+  VK_F17       : Result := MK_F17;
+  VK_F18       : Result := MK_F18;
+  VK_F19       : Result := MK_F19;
   VK_NUMLOCK   : Result := MK_NUMLOCK;
+  VK_CLEAR     : Result := MK_CLEAR;
   VK_SCROLL    : Result := MK_SCRLOCK;
   VK_SHIFT     : Result := MK_SHIFTKEY;
   VK_CONTROL   : Result := MK_COMMAND;
   VK_MENU      : Result := MK_ALT;
   VK_OEM_3     : Result := MK_TILDE;
-  VK_OEM_MINUS : Result := MK_MINUS;
+//VK_OEM_MINUS : Result := MK_MINUS;
   VK_OEM_PLUS  : Result := MK_EQUAL;
   VK_OEM_5     : Result := MK_BACKSLASH;
   VK_OEM_4     : Result := MK_LEFTBRACKET;
@@ -336,10 +342,29 @@
   VK_OEM_1     : Result := MK_SEMICOLON;
   VK_OEM_7     : Result := MK_QUOTE;
   VK_OEM_COMMA : Result := MK_COMMA;
-  VK_OEM_PERIOD: Result := MK_PERIOD;
-  VK_OEM_2     : Result := MK_SLASH;
+//VK_OEM_PERIOD: Result := MK_PERIOD;
+//VK_OEM_2     : Result := MK_SLASH;
   else
     Result := 0;
+  end;
+end;
+
+{------------------------------------------------------------------------------
+  Name:    VirtualKeyCodeToCharCode
+  Returns: The char code for the specified virtual key or the original
+  virtual key.  Must be called after VirtualKeyCodeToMac since char codes
+  overlap VK_ codes.
+ ------------------------------------------------------------------------------}
+function VirtualKeyCodeToCharCode(AKey: Word): Word;
+begin
+  case AKey of
+  VK_MULTIPLY  : Result := Ord('*');
+  VK_ADD       : Result := Ord('+');
+  VK_OEM_MINUS : Result := Ord('-');
+  VK_OEM_PERIOD: Result := Ord('.');
+  VK_OEM_2     : Result := Ord('/');
+  else
+    Result := AKey;
   end;
 end;
 
carbonproc.pp.patch (2,620 bytes)

2012-04-13 21:12

 

mackeycodes.inc.patch (826 bytes)
--- /Users/djenkins/laz-changes/14583/mackeycodes.inc	2012-04-11 11:34:55.000000000 
+++ /Users/djenkins/laz-changes/14583/mackeycodes.inc.ss	2012-04-11 11:35:46.000000000 
@@ -38,6 +38,10 @@
   MK_F13       = $69; MK_PRNSCR  = MK_F13;  //Print screen = F13
   MK_F14       = $6B; MK_SCRLOCK = MK_F14;  //Scroll Lock = F14
   MK_F15       = $71; MK_PAUSE   = MK_F15;  //Pause = F15
+  MK_F16       = $6A;
+  MK_F17       = $40;
+  MK_F18       = $4F;
+  MK_F19       = $50;
   MK_POWER     = $7F7F;
   MK_TAB       = $30;
   MK_INS       = $72; MK_HELP    = MK_INS;  //old macs call this key "help"
@@ -50,7 +54,7 @@
   MK_DOWN      = $7D;
   MK_LEFT      = $7B;
   MK_RIGHT     = $7C;
-  MK_NUMLOCK   = $47;
+  MK_NUMLOCK   = $47; MK_CLEAR   = MK_NUMLOCK;
   MK_NUMPAD0   = $52;
   MK_NUMPAD1   = $53;
   MK_NUMPAD2   = $54;
mackeycodes.inc.patch (826 bytes)

2012-04-19 23:00

 

svn_patch-21748 (6,227 bytes)
Index: lcl/interfaces/carbon/carbonproc.pp
===================================================================
--- lcl/interfaces/carbon/carbonproc.pp	(revision 36681)
+++ lcl/interfaces/carbon/carbonproc.pp	(working copy)
@@ -71,6 +71,7 @@
 {$I mackeycodes.inc}
 
 function VirtualKeyCodeToMac(AKey: Word): Word;
+function VirtualKeyCodeToCharCode(AKey: Word): Word;
 
 function GetBorderWindowAttrs(const ABorderStyle: TFormBorderStyle;
   const ABorderIcons: TBorderIcons): WindowAttributes;
@@ -301,8 +302,8 @@
   VK_NUMPAD7   : Result := MK_NUMPAD7;
   VK_NUMPAD8   : Result := MK_NUMPAD8;
   VK_NUMPAD9   : Result := MK_NUMPAD9;
-  VK_MULTIPLY  : Result := MK_PADMULT;
-  VK_ADD       : Result := MK_PADADD;
+//VK_MULTIPLY  : Result := MK_PADMULT;
+//VK_ADD       : Result := MK_PADADD;
   VK_SEPARATOR : Result := MK_PADDEC;
   VK_SUBTRACT  : Result := MK_PADSUB;
   VK_DECIMAL   : Result := MK_PADDEC;
@@ -322,13 +323,18 @@
   VK_F13       : Result := MK_F13;
   VK_F14       : Result := MK_F14;
   VK_F15       : Result := MK_F15;
+  VK_F16       : Result := MK_F16;
+  VK_F17       : Result := MK_F17;
+  VK_F18       : Result := MK_F18;
+  VK_F19       : Result := MK_F19;
   VK_NUMLOCK   : Result := MK_NUMLOCK;
+  VK_CLEAR     : Result := MK_CLEAR;
   VK_SCROLL    : Result := MK_SCRLOCK;
   VK_SHIFT     : Result := MK_SHIFTKEY;
   VK_CONTROL   : Result := MK_COMMAND;
   VK_MENU      : Result := MK_ALT;
   VK_OEM_3     : Result := MK_TILDE;
-  VK_OEM_MINUS : Result := MK_MINUS;
+//VK_OEM_MINUS : Result := MK_MINUS;
   VK_OEM_PLUS  : Result := MK_EQUAL;
   VK_OEM_5     : Result := MK_BACKSLASH;
   VK_OEM_4     : Result := MK_LEFTBRACKET;
@@ -336,14 +342,33 @@
   VK_OEM_1     : Result := MK_SEMICOLON;
   VK_OEM_7     : Result := MK_QUOTE;
   VK_OEM_COMMA : Result := MK_COMMA;
-  VK_OEM_PERIOD: Result := MK_PERIOD;
-  VK_OEM_2     : Result := MK_SLASH;
+//VK_OEM_PERIOD: Result := MK_PERIOD;
+//VK_OEM_2     : Result := MK_SLASH;
   else
     Result := 0;
   end;
 end;
 
 {------------------------------------------------------------------------------
+  Name:    VirtualKeyCodeToCharCode
+  Returns: The char code for the specified virtual key or the original
+  virtual key.  Must be called after VirtualKeyCodeToMac since char codes
+  overlap VK_ codes.
+ ------------------------------------------------------------------------------}
+function VirtualKeyCodeToCharCode(AKey: Word): Word;
+begin
+  case AKey of
+  VK_MULTIPLY  : Result := Ord('*');
+  VK_ADD       : Result := Ord('+');
+  VK_OEM_MINUS : Result := Ord('-');
+  VK_OEM_PERIOD: Result := Ord('.');
+  VK_OEM_2     : Result := Ord('/');
+  else
+    Result := AKey;
+  end;
+end;
+
+{------------------------------------------------------------------------------
   Name:    GetBorderWindowAttrs
   Returns: Converts the form border style and icons to Carbon window attributes
  ------------------------------------------------------------------------------}
Index: lcl/interfaces/carbon/carbonprivatewindow.inc
===================================================================
--- lcl/interfaces/carbon/carbonprivatewindow.inc	(revision 36681)
+++ lcl/interfaces/carbon/carbonprivatewindow.inc	(working copy)
@@ -514,12 +514,16 @@
       MK_F10      : VKKeyCode:=VK_F10;
       MK_F11      : VKKeyCode:=VK_F11;
       MK_F12      : VKKeyCode:=VK_F12;
-      MK_F13      : VKKeyCode:=VK_SNAPSHOT;
-      MK_F14      : VKKeyCode:=VK_SCROLL;
-      MK_F15      : VKKeyCode:=VK_PAUSE;
+      MK_F13      : VKKeyCode:=VK_F13;
+      MK_F14      : VKKeyCode:=VK_F14;
+      MK_F15      : VKKeyCode:=VK_F15;
+      MK_F16      : VKKeyCode:=VK_F16;
+      MK_F17      : VKKeyCode:=VK_F17;
+      MK_F18      : VKKeyCode:=VK_F18;
+      MK_F19      : VKKeyCode:=VK_F19;
       MK_POWER    : VKKeyCode:=VK_SLEEP; //?
       MK_TAB      : VKKeyCode:=VK_TAB; //strangely enough, tab is "non printable"
-      MK_INS      : VKKeyCode:=VK_INSERT;
+      MK_HELP     : VKKeyCode:=VK_HELP;
       MK_DEL      : VKKeyCode:=VK_DELETE;
       MK_HOME     : VKKeyCode:=VK_HOME;
       MK_END      : VKKeyCode:=VK_END;
@@ -529,7 +533,7 @@
       MK_DOWN     : VKKeyCode:=VK_DOWN;
       MK_LEFT     : VKKeyCode:= VK_LEFT;
       MK_RIGHT    : VKKeyCode:= VK_RIGHT;
-      MK_NUMLOCK  : VKKeyCode:= VK_NUMLOCK;
+      MK_CLEAR    : VKKeyCode:= VK_CLEAR;
     end;
     
     if VKKeyCode<>VK_UNKNOWN then
@@ -663,6 +667,7 @@
           MK_PADSUB  : VKKeyCode:=VK_SUBTRACT;
           MK_PADADD  : VKKeyCode:=VK_ADD;
           MK_PADDEC  : VKKeyCode:=VK_DECIMAL;
+          MK_PADEQUALS: VKKeyCode:=VK_OEM_PLUS;
           MK_PADENTER:
             begin
               VKKeyCode:=VK_RETURN;
Index: lcl/interfaces/carbon/mackeycodes.inc
===================================================================
--- lcl/interfaces/carbon/mackeycodes.inc	(revision 36681)
+++ lcl/interfaces/carbon/mackeycodes.inc	(working copy)
@@ -38,6 +38,10 @@
   MK_F13       = $69; MK_PRNSCR  = MK_F13;  //Print screen = F13
   MK_F14       = $6B; MK_SCRLOCK = MK_F14;  //Scroll Lock = F14
   MK_F15       = $71; MK_PAUSE   = MK_F15;  //Pause = F15
+  MK_F16       = $6A;
+  MK_F17       = $40;
+  MK_F18       = $4F;
+  MK_F19       = $50;
   MK_POWER     = $7F7F;
   MK_TAB       = $30;
   MK_INS       = $72; MK_HELP    = MK_INS;  //old macs call this key "help"
@@ -50,7 +54,7 @@
   MK_DOWN      = $7D;
   MK_LEFT      = $7B;
   MK_RIGHT     = $7C;
-  MK_NUMLOCK   = $47;
+  MK_NUMLOCK   = $47; MK_CLEAR   = MK_NUMLOCK;
   MK_NUMPAD0   = $52;
   MK_NUMPAD1   = $53;
   MK_NUMPAD2   = $54;
Index: lcl/interfaces/carbon/carbonmenus.pp
===================================================================
--- lcl/interfaces/carbon/carbonmenus.pp	(revision 36681)
+++ lcl/interfaces/carbon/carbonmenus.pp	(working copy)
@@ -719,7 +719,7 @@
     // unset virtual key short cut
     OSError(ChangeMenuItemAttributes(FParentMenu.Menu, Index + 1, 0, kMenuItemAttrUseVirtualKey),
       Self, Sname, SChangeMenuItemAttrs);
-    OSError(SetMenuItemCommandKey(FParentMenu.Menu, Index + 1, False, Key),
+    OSError(SetMenuItemCommandKey(FParentMenu.Menu, Index + 1, False, VirtualKeyCodeToCharCode(Key)),
       Self, SName, SSetCmdKey);
   end
   else // use mac virtual key code
svn_patch-21748 (6,227 bytes)

Alexey Tor.

2017-04-10 09:18

reporter   ~0099537

Last edited: 2017-04-10 09:19

View 2 revisions

Tested this pch.
w/o pch:
shortcuts for menu (Mainmenu): -+*/
if setted in OI were mapped to:
Num- Num+ Num* Num/
NumLock as shortcut mapped to unicode strange char. (dont work.)
(It is visible by glyphs in menu.)

with pch:
setting keys in OI makes them normal shortcuts: -+*/
also NumLock as shortcut, works now.

Please apply

Juha Manninen

2017-04-10 11:18

developer   ~0099539

Applied, thanks.

Issue History

Date Modified Username Field Change
2012-04-13 21:11 David Jenkins New Issue
2012-04-13 21:11 David Jenkins File Added: carbonmenus.pp.patch
2012-04-13 21:11 David Jenkins Widgetset => Carbon
2012-04-13 21:11 David Jenkins File Added: carbonprivatewindow.inc.patch
2012-04-13 21:12 David Jenkins File Added: carbonproc.pp.patch
2012-04-13 21:12 David Jenkins File Added: mackeycodes.inc.patch
2012-04-19 23:00 David Jenkins File Added: svn_patch-21748
2017-04-10 09:18 Alexey Tor. Note Added: 0099537
2017-04-10 09:19 Alexey Tor. Note Edited: 0099537 View Revisions
2017-04-10 10:43 Juha Manninen Assigned To => Juha Manninen
2017-04-10 10:43 Juha Manninen Status new => assigned
2017-04-10 11:18 Juha Manninen Fixed in Revision => r54598
2017-04-10 11:18 Juha Manninen LazTarget => -
2017-04-10 11:18 Juha Manninen Note Added: 0099539
2017-04-10 11:18 Juha Manninen Status assigned => resolved
2017-04-10 11:18 Juha Manninen Resolution open => fixed