Skip to content

Commit c5b358d

Browse files
committed
Add preference to disable ctrl/cmd+mouse1 combo
1 parent 46f68f7 commit c5b358d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

java/src/processing/mode/java/JavaMode.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ void initLogger() {
316316
static public volatile boolean defaultAutoSaveEnabled = true;
317317
static public volatile boolean ccTriggerEnabled = false;
318318
static public volatile boolean importSuggestEnabled = true;
319+
static public volatile boolean inspectModeHotkeyEnabled = true;
319320
static public int autoSaveInterval = 3; //in minutes
320321

321322

@@ -337,6 +338,7 @@ void initLogger() {
337338
static public final String COMPLETION_PREF = "pdex.completion";
338339
static public final String COMPLETION_TRIGGER_PREF = "pdex.completion.trigger";
339340
static public final String SUGGEST_IMPORTS_PREF = "pdex.suggest.imports";
341+
static public final String INSPECT_MODE_HOTKEY_PREF = "pdex.inspectMode.hotkey";
340342

341343
// static volatile public boolean enableTweak = false;
342344

@@ -361,6 +363,7 @@ public void loadPreferences() {
361363
defaultAutoSaveEnabled = Preferences.getBoolean(prefDefaultAutoSave);
362364
ccTriggerEnabled = Preferences.getBoolean(COMPLETION_TRIGGER_PREF);
363365
importSuggestEnabled = Preferences.getBoolean(SUGGEST_IMPORTS_PREF);
366+
inspectModeHotkeyEnabled = Preferences.getBoolean(INSPECT_MODE_HOTKEY_PREF);
364367
loadSuggestionsMap();
365368
}
366369

@@ -379,6 +382,7 @@ public void savePreferences() {
379382
Preferences.setBoolean(prefDefaultAutoSave, defaultAutoSaveEnabled);
380383
Preferences.setBoolean(COMPLETION_TRIGGER_PREF, ccTriggerEnabled);
381384
Preferences.setBoolean(SUGGEST_IMPORTS_PREF, importSuggestEnabled);
385+
Preferences.setBoolean(INSPECT_MODE_HOTKEY_PREF, inspectModeHotkeyEnabled);
382386
}
383387

384388
public void loadSuggestionsMap() {
@@ -449,6 +453,8 @@ public void ensurePrefsExist() {
449453
Preferences.setBoolean(COMPLETION_TRIGGER_PREF, ccTriggerEnabled);
450454
if (Preferences.get(SUGGEST_IMPORTS_PREF) == null)
451455
Preferences.setBoolean(SUGGEST_IMPORTS_PREF, importSuggestEnabled);
456+
if (Preferences.get(INSPECT_MODE_HOTKEY_PREF) == null)
457+
Preferences.setBoolean(INSPECT_MODE_HOTKEY_PREF, inspectModeHotkeyEnabled);
452458
}
453459

454460

java/src/processing/mode/java/pdex/PDEX.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ public void mousePressed(MouseEvent e) {
214214
public void mouseReleased(MouseEvent e) {
215215
boolean releasingMouse1 = e.getButton() == MouseEvent.BUTTON1;
216216
boolean releasingMouse2 = e.getButton() == MouseEvent.BUTTON2;
217-
if (inspectModeEnabled && isMouse1Down && releasingMouse1) {
217+
if (JavaMode.inspectModeHotkeyEnabled && inspectModeEnabled &&
218+
isMouse1Down && releasingMouse1) {
218219
handleInspect(e);
219220
} else if (!inspectModeEnabled && isMouse2Down && releasingMouse2) {
220221
handleInspect(e);

0 commit comments

Comments
 (0)