Skip to content

Commit

Permalink
fixup!
Browse files Browse the repository at this point in the history
  • Loading branch information
brcolow committed Dec 24, 2018
1 parent fd1f732 commit 315551a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,15 @@ char *StringForMsg(UINT msg) {
case WM_LBUTTONDOWN: return "WM_LBUTTONDOWN";
case WM_RBUTTONDOWN: return "WM_RBUTTONDOWN";
case WM_MBUTTONDOWN: return "WM_MBUTTONDOWN";
case WM_XBUTTONDOWN: return "WM_XBUTTONDOWN";
case WM_LBUTTONUP: return "WM_LBUTTONUP";
case WM_LBUTTONDBLCLK: return "WM_LBUTTONDBLCLK";
case WM_RBUTTONUP: return "WM_RBUTTONUP";
case WM_RBUTTONDBLCLK: return "WM_RBUTTONDBLCLK";
case WM_MBUTTONUP: return "WM_MBUTTONUP";
case WM_MBUTTONDBLCLK: return "WM_MBUTTONDBLCLK";
case WM_XBUTTONUP: return "WM_XBUTTONUP";
case WM_XBUTTONDBLCLK: return "WM_XBUTTONDBLCLK";
case WM_MOUSEWHEEL: return "WM_MOUSEWHEEL";
case WM_MOUSEHWHEEL: return "WM_MOUSEHWHEEL";
case WM_MOUSELEAVE: return "WM_MOUSELEAVE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ public static int mouseButtonToEmbedMouseButton(int button, int extModifiers) {
case MouseEvent.BUTTON3:
abstractButton = AbstractEvents.MOUSEEVENT_SECONDARY_BUTTON;
break;
case 4:
abstractButton = AbstractEvents.MOUSEEVENT_BACK_BUTTON;
break;
case 5:
abstractButton = AbstractEvents.MOUSEEVENT_FORWARD_BUTTON;
break;
default:
break;
}
Expand Down Expand Up @@ -201,6 +207,10 @@ public static int fxMouseButtonToMouseButton(javafx.scene.input.MouseEvent event
return MouseEvent.BUTTON3;
case MIDDLE:
return MouseEvent.BUTTON2;
case BACK:
return 4;
case FORWARD:
return 5;
}
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,12 @@ private void sendMouseEventToFX(MouseEvent e) {
return;
}

// FX only supports 3 buttons so don't send the event for other buttons
// FX only supports 5 buttons so don't send the event for other buttons
switch (e.getID()) {
case MouseEvent.MOUSE_DRAGGED:
case MouseEvent.MOUSE_PRESSED:
case MouseEvent.MOUSE_RELEASED:
if (e.getButton() > 3) return;
if (e.getButton() > 5) return;
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,22 +488,17 @@ public void mouseDoubleClick(MouseEvent me) {
}
@Override
public void mouseDown(MouseEvent me) {
// FX only supports 3 buttons so don't send the event for other buttons
if (me.button > 3) return;
FXCanvas.this.sendMouseEventToFX(me, AbstractEvents.MOUSEEVENT_PRESSED);
}
@Override
public void mouseUp(MouseEvent me) {
// FX only supports 3 buttons so don't send the event for other buttons
if (me.button > 3) return;
FXCanvas.this.sendMouseEventToFX(me, AbstractEvents.MOUSEEVENT_RELEASED);
}
});

addMouseMoveListener(me -> {
if ((me.stateMask & SWT.BUTTON_MASK) != 0) {
// FX only supports 3 buttons so don't send the event for other buttons
if ((me.stateMask & (SWT.BUTTON1 | SWT.BUTTON2 | SWT.BUTTON3)) != 0) {
if ((me.stateMask & (SWT.BUTTON1 | SWT.BUTTON2 | SWT.BUTTON3 | SWT.BUTTON4 | SWT.BUTTON5)) != 0) {
FXCanvas.this.sendMouseEventToFX(me, AbstractEvents.MOUSEEVENT_DRAGGED);
} else {
FXCanvas.this.sendMouseEventToFX(me, AbstractEvents.MOUSEEVENT_MOVED);
Expand Down

0 comments on commit 315551a

Please sign in to comment.