Skip to content

Commit

Permalink
Fixed #709 - SWT key handling on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
eselmeister committed Aug 13, 2021
1 parent be4469a commit 2b34d9d
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2018 Lablicate GmbH.
* Copyright (c) 2017, 2021 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -26,7 +26,7 @@ public class CopyToClipboardEvent implements IKeyEventProcessor {
@Override
public void handleEvent(ExtendedTableViewer extendedTableViewer, KeyEvent e) {

if(e.stateMask == SWT.CTRL && e.keyCode == KEY_CODE_C) {
if(e.stateMask == SWT.MOD1 && e.keyCode == KEY_CODE_C) {
Clipboard clipboard = new Clipboard(Display.getDefault());
copyToClipboardProvider.copyToClipboard(clipboard, extendedTableViewer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private void calculateDimension(Event event) {

private boolean isControlKeyPressed(Event event) {

return (event.stateMask & SWT.CTRL) == SWT.CTRL;
return (event.stateMask & SWT.MOD1) == SWT.MOD1;
}

private void startBaselineSelection(int x, int y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private void calculateDimension(Event event) {

private boolean isControlKeyPressed(Event event) {

return (event.stateMask & SWT.CTRL) == SWT.CTRL;
return (event.stateMask & SWT.MOD1) == SWT.MOD1;
}

private void startBaselineSelection(int x, int y) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020 Lablicate GmbH.
* Copyright (c) 2020, 2021 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -129,7 +129,7 @@ private void init() {

private boolean isControlKeyPressed(Event event) {

return (event.stateMask & SWT.CTRL) == SWT.CTRL;
return (event.stateMask & SWT.MOD1) == SWT.MOD1;
}

private void startBaselineSelection(int x, int y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public int getButton() {
@Override
public int getStateMask() {

return SWT.ALT;
return SWT.MOD3;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private void adjustTimeRange(Event event) {

private boolean isControlKeyPressed(Event event) {

return (event.stateMask & SWT.CTRL) == SWT.CTRL;
return (event.stateMask & SWT.MOD1) == SWT.MOD1;
}

private void startBaselineSelection(int x, int y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public int getButton() {
@Override
public int getStateMask() {

return SWT.CTRL;
return SWT.MOD1;
}

@Override
Expand All @@ -225,7 +225,7 @@ public int getEvent() {
@Override
public int getStateMask() {

return SWT.CTRL;
return SWT.MOD1;
}

@Override
Expand Down Expand Up @@ -727,7 +727,7 @@ private void handleMouseUpEvent(Event event) {

private boolean isControlKeyPressed(Event event) {

return (event.stateMask & SWT.CTRL) == SWT.CTRL;
return (event.stateMask & SWT.MOD1) == SWT.MOD1;
}

private boolean isLeftMouseButtonPressed(Event event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ public void handleEvent(ExtendedTableViewer extendedTableViewer, KeyEvent e) {
* DEL
*/
deletePeaksOrIdentifications(display);
} else if(e.keyCode == IKeyboardSupport.KEY_CODE_LC_I && (e.stateMask & SWT.CTRL) == SWT.CTRL) {
if((e.stateMask & SWT.ALT) == SWT.ALT) {
} else if(e.keyCode == IKeyboardSupport.KEY_CODE_LC_I && (e.stateMask & SWT.MOD1) == SWT.MOD1) {
if((e.stateMask & SWT.MOD3) == SWT.MOD3) {
/*
* CTRL + ALT + i
*/
Expand All @@ -454,12 +454,12 @@ public void handleEvent(ExtendedTableViewer extendedTableViewer, KeyEvent e) {
*/
setPeaksActiveForAnalysis(true);
}
} else if(e.keyCode == IKeyboardSupport.KEY_CODE_LC_S && (e.stateMask & SWT.CTRL) == SWT.CTRL) {
} else if(e.keyCode == IKeyboardSupport.KEY_CODE_LC_S && (e.stateMask & SWT.MOD1) == SWT.MOD1) {
/*
* CTRL + s
*/
modifyInternalStandards(display);
} else if(e.keyCode == IKeyboardSupport.KEY_CODE_LC_D && (e.stateMask & SWT.CTRL) == SWT.CTRL) {
} else if(e.keyCode == IKeyboardSupport.KEY_CODE_LC_D && (e.stateMask & SWT.MOD1) == SWT.MOD1) {
/*
* CTRL + d
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,8 @@ public void handleEvent(ExtendedTableViewer extendedTableViewer, KeyEvent e) {
* DEL
*/
deleteTargets(display);
} else if(e.keyCode == IKeyboardSupport.KEY_CODE_LC_I && (e.stateMask & SWT.CTRL) == SWT.CTRL) {
if((e.stateMask & SWT.ALT) == SWT.ALT) {
} else if(e.keyCode == IKeyboardSupport.KEY_CODE_LC_I && (e.stateMask & SWT.MOD1) == SWT.MOD1) {
if((e.stateMask & SWT.MOD3) == SWT.MOD3) {
/*
* CTRL + ALT + I
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void doubleClick(DoubleClickEvent event) {
@Override
public void keyReleased(KeyEvent e) {

if(e.stateMask == SWT.CTRL && e.keyCode == 'c') {
if(e.stateMask == SWT.MOD1 && e.keyCode == 'c') {
toolbarButtons.get().copyToClipboard(e.display);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public int getButton() {
@Override
public int getStateMask() {

return SWT.ALT;
return SWT.MOD3;
}

@SuppressWarnings({"rawtypes", "unchecked"})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2020 Lablicate GmbH.
* Copyright (c) 2018, 2021 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -50,7 +50,7 @@ public int getButton() {
@Override
public int getStateMask() {

return SWT.CTRL;
return SWT.MOD1;
}

@Override
Expand Down

0 comments on commit 2b34d9d

Please sign in to comment.