diff options
author | Sven Gothel <[email protected]> | 2009-03-28 04:01:50 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-03-28 04:01:50 +0000 |
commit | 16767ef62eec3e843c80b7b546a0b38860190fb7 (patch) | |
tree | 5cc9b1b1b0aca4c36aaac0698f8376269b82f9a6 /src/newt/classes/com/sun | |
parent | c46f7bf8271c6e97d6889dca146a815818c6af6e (diff) |
Preserve mouse button number while dragging
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1899 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/newt/classes/com/sun')
-rwxr-xr-x | src/newt/classes/com/sun/javafx/newt/Window.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java index f323f824e..e47fa5361 100755 --- a/src/newt/classes/com/sun/javafx/newt/Window.java +++ b/src/newt/classes/com/sun/javafx/newt/Window.java @@ -422,10 +422,10 @@ public abstract class Window implements NativeWindow } private ArrayList mouseListeners = new ArrayList(); + private int lastMouseButton = 0; private long lastMousePressed = 0; private int lastMouseClickCount = 0; public static final int ClickTimeout = 300; - private boolean[] buttonStates = new boolean[MouseEvent.BUTTON_NUMBER]; protected void sendMouseEvent(int eventType, int modifiers, int x, int y, int button) { if(DEBUG_MOUSE_EVENT) { @@ -446,11 +446,10 @@ public abstract class Window implements NativeWindow lastMouseClickCount=1; } lastMousePressed=when; - buttonStates[button - 1] = true; + lastMouseButton=button; e = new MouseEvent(true, eventType, this, when, modifiers, x, y, lastMouseClickCount, button); } else if(MouseEvent.EVENT_MOUSE_RELEASED==eventType) { - buttonStates[button - 1] = false; e = new MouseEvent(true, eventType, this, when, modifiers, x, y, lastMouseClickCount, button); if(when-lastMousePressed<ClickTimeout) { @@ -459,11 +458,12 @@ public abstract class Window implements NativeWindow } else { lastMouseClickCount=0; lastMousePressed=0; + lastMouseButton=0; } } else if(MouseEvent.EVENT_MOUSE_MOVED==eventType) { - if (buttonStates[0] || buttonStates[1] || buttonStates[2]) { + if (lastMouseButton>0) { e = new MouseEvent(true, MouseEvent.EVENT_MOUSE_DRAGGED, this, when, - modifiers, x, y, 1, button); + modifiers, x, y, 1, lastMouseButton); } else { e = new MouseEvent(true, eventType, this, when, modifiers, x, y, 0, button); |