diff options
author | Kenneth Russel <[email protected]> | 2008-06-02 00:09:57 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-06-02 00:09:57 +0000 |
commit | 9583bd12ed22ece50ff6d1f40fc5a31ce1f96e6d (patch) | |
tree | 660044ef49307e28e12dd37f76a37a91a2040e9b /src/classes | |
parent | c15e1883d7f4f9aa426e63dd4aaf85194aa60300 (diff) |
Bug fixes to mouse dragging logic
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1660 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes')
-rwxr-xr-x | src/classes/com/sun/javafx/newt/Window.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/classes/com/sun/javafx/newt/Window.java b/src/classes/com/sun/javafx/newt/Window.java index 6bb617687..b5a0db6bb 100755 --- a/src/classes/com/sun/javafx/newt/Window.java +++ b/src/classes/com/sun/javafx/newt/Window.java @@ -174,6 +174,7 @@ public abstract class Window implements NativeWindow private long lastMousePressed = 0; private int lastMouseClickCount = 0; public static final int ClickTimeout = 200; + private boolean[] buttonStates = new boolean[3]; protected void sendMouseEvent(int eventType, int modifiers, int x, int y, int button) { if(DEBUG_MOUSE_EVENT) { @@ -191,9 +192,11 @@ public abstract class Window implements NativeWindow lastMouseClickCount=1; } lastMousePressed=when; + buttonStates[button - 1] = true; 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) { @@ -203,13 +206,14 @@ public abstract class Window implements NativeWindow lastMouseClickCount=0; lastMousePressed=0; } - } else if(MouseEvent.EVENT_MOUSE_MOVED==eventType && - 1==lastMouseClickCount) { - e = new MouseEvent(true, MouseEvent.EVENT_MOUSE_DRAGGED, this, when, - modifiers, x, y, 1, button); - } else { - e = new MouseEvent(true, eventType, this, when, - modifiers, x, y, 0, button); + } else if(MouseEvent.EVENT_MOUSE_MOVED==eventType) { + if (buttonStates[0] || buttonStates[1] || buttonStates[2]) { + e = new MouseEvent(true, MouseEvent.EVENT_MOUSE_DRAGGED, this, when, + modifiers, x, y, 1, button); + } else { + e = new MouseEvent(true, eventType, this, when, + modifiers, x, y, 0, button); + } } if(DEBUG_MOUSE_EVENT) { @@ -220,7 +224,7 @@ public abstract class Window implements NativeWindow } for(Iterator i = mouseListener.iterator(); i.hasNext(); ) { - switch(eventType) { + switch(e.getEventType()) { case MouseEvent.EVENT_MOUSE_ENTERED: ((MouseListener)i.next()).mouseEntered(e); break; |