Ticket #22020: 22020.patch

File 22020.patch, 7.4 KB (added by taylor.smock, 2 years ago)

Add some new reserved shortcuts for Mac (w.r.t. for switching workspaces/applications) and remove extended keycodes for left/right/up/down arrows.

  • src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java

    diff --git a/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java b/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
    index 86159b9bb6..d2f279290a 100644
    a b public class PrefJPanel extends JPanel {  
    107107        KeyboardUtils.getExtendedKeyCodes(InputContext.getInstance().getLocale())
    108108                .forEach((key, value) -> list.put(key, value.toString()));
    109109        list.put(Integer.valueOf(-1), "");
     110
     111        // Remove "look-alike" values. See JOSM #22020 comment 2. These override the standard left/right/up/down keys.
     112        list.remove(KeyboardUtils.EXTENDED_KEYCODE_FLAG + 0x2190); // '←' (LEFTWARDS ARROW)
     113        list.remove(KeyboardUtils.EXTENDED_KEYCODE_FLAG + 0x2191); // '↑' (UPWARDS ARROW)
     114        list.remove(KeyboardUtils.EXTENDED_KEYCODE_FLAG + 0x2192); // '→' (RIGHTWARDS ARROW)
     115        list.remove(KeyboardUtils.EXTENDED_KEYCODE_FLAG + 0x2193); // '↓' (DOWNWARDS ARROW)
    110116        return list;
    111117    }
    112118
  • src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    diff --git a/src/org/openstreetmap/josm/tools/PlatformHookOsx.java b/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
    index 85bd01fe9e..684267b7c7 100644
    a b public class PlatformHookOsx implements PlatformHook, InvocationHandler {  
    328328        Shortcut.registerSystemShortcut("system:undo", tr("reserved"), KeyEvent.VK_Z, KeyEvent.META_DOWN_MASK); // Reverse the effect of the user's previous operation (equivalent to the Undo command). See "The Edit Menu."
    329329        Shortcut.registerSystemShortcut("system:redo", tr("reserved"), KeyEvent.VK_Z, KeyEvent.META_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK); // Reverse the effect of the last Undo command (equivalent to the Redo command). See "The Edit Menu."
    330330
    331         auto(Shortcut.registerSystemShortcut("apple-reserved-45", tr("reserved"), KeyEvent.VK_RIGHT, KeyEvent.META_DOWN_MASK)); // Change the keyboard layout to current layout of Roman script.
     331        //auto(Shortcut.registerSystemShortcut("apple-reserved-45", tr("reserved"), KeyEvent.VK_RIGHT, KeyEvent.META_DOWN_MASK)); // Change the keyboard layout to current layout of Roman script.
    332332        //auto(Shortcut.registerSystemCut("apple-reserved-46", tr("reserved"), KeyEvent.VK_RIGHT, KeyEvent.META_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK)); // Extend selection to the next semantic unit, typically the end of the current line.
    333333        //auto(Shortcut.registerSystemCut("apple-reserved-47", tr("reserved"), KeyEvent.VK_RIGHT, KeyEvent.SHIFT_DOWN_MASK)); // Extend selection one character to the right.
    334334        //auto(Shortcut.registerSystemCut("apple-reserved-48", tr("reserved"), KeyEvent.VK_RIGHT, KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK)); // Extend selection to the end of the current word, then to the end of the next word.
     335        // VK_RIGHT + KeyEvent.CTRL_DOWN_MASK is apple-reserved-59
    335336
    336         Shortcut.registerSystemShortcut("system:movefocusright", tr("reserved"), KeyEvent.VK_RIGHT, KeyEvent.CTRL_DOWN_MASK); // Move focus to another value or cell within a view, such as a table. See Accessibility Overview.
    337 
    338         auto(Shortcut.registerSystemShortcut("apple-reserved-49", tr("reserved"), KeyEvent.VK_LEFT, KeyEvent.META_DOWN_MASK)); // Change the keyboard layout to current layout of system script.
     337        //auto(Shortcut.registerSystemShortcut("apple-reserved-49", tr("reserved"), KeyEvent.VK_LEFT, KeyEvent.META_DOWN_MASK)); // Change the keyboard layout to current layout of system script.
    339338        //auto(Shortcut.registerSystemCut("apple-reserved-50", tr("reserved"), KeyEvent.VK_LEFT, KeyEvent.META_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK)); // Extend selection to the previous semantic unit, typically the beginning of the current line.
    340339        //auto(Shortcut.registerSystemCut("apple-reserved-51", tr("reserved"), KeyEvent.VK_LEFT, KeyEvent.SHIFT_DOWN_MASK)); // Extend selection one character to the left.
    341340        //auto(Shortcut.registerSystemCut("apple-reserved-52", tr("reserved"), KeyEvent.VK_LEFT, KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK)); // Extend selection to the beginning of the current word, then to the beginning of the previous word.
    342 
    343         Shortcut.registerSystemShortcut("system:movefocusleft", tr("reserved"), KeyEvent.VK_LEFT, KeyEvent.CTRL_DOWN_MASK); // Move focus to another value or cell within a view, such as a table. See Accessibility Overview.
     341        // VK_LEFT + KeyEvent.CTRL_DOWN_MASK is apple-reserved-60
    344342
    345343        //auto(Shortcut.registerSystemCut("apple-reserved-53", tr("reserved"), KeyEvent.VK_UP, KeyEvent.META_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK)); // Extend selection upward in the next semantic unit, typically the beginning of the document.
    346344        //auto(Shortcut.registerSystemCut("apple-reserved-54", tr("reserved"), KeyEvent.VK_UP, KeyEvent.SHIFT_DOWN_MASK)); // Extend selection to the line above, to the nearest character boundary at the same horizontal location.
    347345        //auto(Shortcut.registerSystemCut("apple-reserved-55", tr("reserved"), KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK)); // Extend selection to the beginning of the current paragraph, then to the beginning of the next paragraph.
    348 
    349         Shortcut.registerSystemShortcut("system:movefocusup", tr("reserved"), KeyEvent.VK_UP, KeyEvent.CTRL_DOWN_MASK); // Move focus to another value or cell within a view, such as a table. See Accessibility Overview.
     346        // VK_UP + KeyEvent.CTRL_DOWN_MASK is apple-reserved-61
    350347
    351348        //auto(Shortcut.registerSystemCut("apple-reserved-56", tr("reserved"), KeyEvent.VK_DOWN, KeyEvent.META_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK)); // Extend selection downward in the next semantic unit, typically the end of the document.
    352349        //auto(Shortcut.registerSystemCut("apple-reserved-57", tr("reserved"), KeyEvent.VK_DOWN, KeyEvent.SHIFT_DOWN_MASK)); // Extend selection to the line below, to the nearest character boundary at the same horizontal location.
    353350        //auto(Shortcut.registerSystemCut("apple-reserved-58", tr("reserved"), KeyEvent.VK_DOWN, KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK)); // Extend selection to the end of the current paragraph, then to the end of the next paragraph (include the blank line between paragraphs in cut, copy, and paste operations).
     351        // VK_DOWN + KeyEvent.CTRL_DOWN_MASK is apple-reserved-62
     352
     353        auto(Shortcut.registerSystemShortcut("apple-reserved-59", tr("reserved"), KeyEvent.VK_RIGHT, KeyEvent.CTRL_DOWN_MASK)); // Move right in the workspace list
     354        auto(Shortcut.registerSystemShortcut("apple-reserved-60", tr("reserved"), KeyEvent.VK_LEFT, KeyEvent.CTRL_DOWN_MASK)); // Move left in the workspace list
     355        auto(Shortcut.registerSystemShortcut("apple-reserved-61", tr("reserved"), KeyEvent.VK_UP, KeyEvent.CTRL_DOWN_MASK)); // Show overview of open windows
     356        auto(Shortcut.registerSystemShortcut("apple-reserved-62", tr("reserved"), KeyEvent.VK_DOWN, KeyEvent.CTRL_DOWN_MASK)); // Show available windows for the active application
    354357
    355         Shortcut.registerSystemShortcut("system:movefocusdown", tr("reserved"), KeyEvent.VK_DOWN, KeyEvent.CTRL_DOWN_MASK); // Move focus to another value or cell within a view, such as a table. See Accessibility Overview.
    356358
    357359        auto(Shortcut.registerSystemShortcut("system:about", tr("reserved"), 0, -1)); // About
    358360