Skip to content

Commit

Permalink
Add meta masks
Browse files Browse the repository at this point in the history
  • Loading branch information
SiboVG authored and weisJ committed Nov 14, 2023
1 parent 0622af3 commit 347182c
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,55 @@ public void run(final Theme currentTheme, final UIDefaults defaults) {

@SuppressWarnings({"HardCodedStringLiteral"})
private void initIdeaDefaults(final UIDefaults defaults) {
defaults.put("Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {"ctrl C", "copy", "meta C",
"copy", "ctrl V", "paste", "meta V", "paste", "ctrl X", "cut", "meta X", "cut", "COPY", "copy", "PASTE",
"paste", "CUT", "cut", "control INSERT", "copy", "shift INSERT", "paste", "shift DELETE", "cut",
"RIGHT", "selectNextColumn", "KP_RIGHT", "selectNextColumn", "LEFT", "selectPreviousColumn", "KP_LEFT",
"selectPreviousColumn", "DOWN", "selectNextRow", "KP_DOWN", "selectNextRow", "UP", "selectPreviousRow",
"KP_UP", "selectPreviousRow", "shift RIGHT", "selectNextColumnExtendSelection", "shift KP_RIGHT",
"selectNextColumnExtendSelection", "shift LEFT", "selectPreviousColumnExtendSelection", "shift KP_LEFT",
"selectPreviousColumnExtendSelection", "shift DOWN", "selectNextRowExtendSelection", "shift KP_DOWN",
"selectNextRowExtendSelection", "shift UP", "selectPreviousRowExtendSelection", "shift KP_UP",
"selectPreviousRowExtendSelection", "PAGE_UP", "scrollUpChangeSelection", "PAGE_DOWN",
"scrollDownChangeSelection", "HOME", "selectFirstColumn", "END", "selectLastColumn", "shift PAGE_UP",
"scrollUpExtendSelection", "shift PAGE_DOWN", "scrollDownExtendSelection", "shift HOME",
"selectFirstColumnExtendSelection", "shift END", "selectLastColumnExtendSelection", "ctrl PAGE_UP",
"scrollLeftChangeSelection", "ctrl PAGE_DOWN", "scrollRightChangeSelection", "ctrl HOME",
"selectFirstRow", "ctrl END", "selectLastRow", "ctrl shift PAGE_UP", "scrollRightExtendSelection",
"ctrl shift PAGE_DOWN", "scrollLeftExtendSelection", "ctrl shift HOME", "selectFirstRowExtendSelection",
"ctrl shift END", "selectLastRowExtendSelection", "TAB", "selectNextColumnCell", "shift TAB",
"selectPreviousColumnCell", "ENTER", "selectNextRowCell", "shift ENTER", "selectPreviousRowCell",
"ctrl A", "selectAll", "meta A", "selectAll", "ESCAPE", "cancel", "F2", "startEditing"}));
defaults.put("Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
"ctrl C", "copy", "meta C", "copy",
"ctrl V", "paste", "meta V", "paste",
"ctrl X", "cut", "meta X", "cut",
"COPY", "copy",
"PASTE", "paste",
"CUT", "cut",
"control INSERT", "copy",
"shift INSERT", "paste",
"shift DELETE", "cut",
"RIGHT", "selectNextColumn",
"KP_RIGHT", "selectNextColumn",
"LEFT", "selectPreviousColumn",
"KP_LEFT", "selectPreviousColumn",
"DOWN", "selectNextRow",
"KP_DOWN", "selectNextRow",
"UP", "selectPreviousRow",
"KP_UP", "selectPreviousRow",
"shift RIGHT", "selectNextColumnExtendSelection",
"shift KP_RIGHT", "selectNextColumnExtendSelection",
"shift LEFT", "selectPreviousColumnExtendSelection",
"shift KP_LEFT", "selectPreviousColumnExtendSelection",
"shift DOWN", "selectNextRowExtendSelection",
"shift KP_DOWN", "selectNextRowExtendSelection",
"shift UP", "selectPreviousRowExtendSelection",
"shift KP_UP", "selectPreviousRowExtendSelection",
"PAGE_UP", "scrollUpChangeSelection",
"PAGE_DOWN", "scrollDownChangeSelection",
"HOME", "selectFirstColumn",
"END", "selectLastColumn",
"shift PAGE_UP", "scrollUpExtendSelection",
"shift PAGE_DOWN", "scrollDownExtendSelection",
"shift HOME", "selectFirstColumnExtendSelection",
"shift END", "selectLastColumnExtendSelection",
"ctrl PAGE_UP", "scrollLeftChangeSelection", "meta PAGE_UP", "scrollLeftChangeSelection",
"ctrl PAGE_DOWN", "scrollRightChangeSelection", "meta PAGE_DOWN", "scrollRightChangeSelection",
"ctrl HOME", "selectFirstRow", "meta HOME", "selectFirstRow",
"ctrl END", "selectLastRow", "meta END", "selectLastRow",
"ctrl shift PAGE_UP", "scrollRightExtendSelection", "meta shift PAGE_UP", "scrollRightExtendSelection",
"ctrl shift PAGE_DOWN", "scrollLeftExtendSelection", "meta shift PAGE_DOWN", "scrollLeftExtendSelection",
"ctrl shift HOME", "selectFirstRowExtendSelection", "meta shift HOME", "selectFirstRowExtendSelection",
"ctrl shift END", "selectLastRowExtendSelection", "meta shift END", "selectLastRowExtendSelection",
"ctrl A", "selectAll", "meta A", "selectAll",
"TAB", "selectNextColumnCell",
"shift TAB", "selectPreviousColumnCell",
"ENTER", "selectNextRowCell",
"shift ENTER", "selectPreviousRowCell",
"ESCAPE", "cancel",
"F2", "startEditing"
}));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import javax.swing.tree.TreeCellEditor;
import javax.swing.tree.TreeCellRenderer;

import com.github.weisj.darklaf.platform.SystemInfo;
import org.jetbrains.annotations.NotNull;

import com.github.weisj.darklaf.focus.FocusParentHelper;
Expand Down Expand Up @@ -297,7 +298,11 @@ public static boolean isOverText(final MouseEvent e, final int row, final int co
}

public static boolean isMenuShortcutKeyDown(final InputEvent event) {
return (event.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0;
if (SystemInfo.isMac) {
return (event.getModifiersEx() & InputEvent.META_DOWN_MASK) != 0;
} else {
return (event.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0;
}
}

@SuppressWarnings("SuspiciousNameCombination")
Expand Down

0 comments on commit 347182c

Please sign in to comment.