Closed mro closed 9 years ago
Interesting!
What hardware are you using specifically? Do AWT and Swing apps have the correct behaviour,
or is this just a limitation of the Swing --> Piccolo2D mouse event conversion process?
Reported by heuermh
on 2011-02-07 17:07:39
Good point, actually horizontal scrolling does not work with AWT and Swing apps, but
it does work in Eclipse. However, other applications do not throw an exception. Horizontal
scrolling results in a MouseEvent with getButton() returning MouseEvent.NOBUTTON causing
the Piccolo2D conversion process to throw the exception. Maybe this is a Java Swing
issue...
Reported by nlskrg
on 2011-02-07 18:24:45
I would assert Piccolo2D shouldn't throw an exception if getButton() returns MouseEvent.NOBUTTON
then. There may be some confusion between MouseEvent.MOUSE_DRAGGED and MouseEvent.MOUSE_MOVED
though, see e.g. PCanvas.java, lines 729-734 and 744-749.
Reported by heuermh
on 2011-11-01 19:34:36
Accepted
Line 761 creates the button value based on the raw event's getModifiers() (see call
to copyButtonsFromModifiers).
For the device you are talking about, does event.getModifiers() or event.getModifiersEx()
give any indication of a special button press? Maybe there is a natural translation
from that to some state we can track...
Reported by atdixon
on 2011-11-02 01:39:47
Unfortunately, the event does store much information in this case since horizontal scroll
wheel support seems not to be implemented in AWT/Swing. I have found this related feature
request:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6440198
Currently on my system two events are generated with the following properties:
java.awt.event.MouseEvent[MOUSE_PRESSED,(320,295),absolute(425,421),button=0,clickCount=1]
java.awt.event.MouseEvent[MOUSE_RELEASED,(320,295),absolute(425,421),button=0,clickCount=1]
The methods getModifiers() and getModifiersEx() return 0 for these events. Both events
cause an exception, I have only reported the fist one above.
Reported by nlskrg
on 2011-11-02 20:40:29
Actually it is not even possible to distinguish right from left scrolling with the events
fired by Sun Java 6. I have also tested this with OpenJDK Java 6/7 with the following
results for right tilt followed by left tilt:
Sun Java 6:
java.awt.event.MouseEvent[MOUSE_PRESSED,(385,400),absolute(549,601),button=0,clickCount=1]
java.awt.event.MouseEvent[MOUSE_RELEASED,(385,400),absolute(549,601),button=0,clickCount=1]
java.awt.event.MouseEvent[MOUSE_PRESSED,(387,400),absolute(551,601),button=0,clickCount=1]
java.awt.event.MouseEvent[MOUSE_RELEASED,(387,400),absolute(551,601),button=0,clickCount=1]
OpenJDK Java 6:
java.awt.event.MouseEvent[MOUSE_PRESSED,(245,274),absolute(350,400),button=0,clickCount=1]
java.awt.event.MouseEvent[MOUSE_RELEASED,(245,274),absolute(350,400),button=0,clickCount=1]
java.awt.event.MouseEvent[MOUSE_PRESSED,(311,274),absolute(416,400),button=0,clickCount=1]
java.awt.event.MouseEvent[MOUSE_RELEASED,(311,274),absolute(416,400),button=0,clickCount=1]
OpenJDK Java 7:
java.awt.event.MouseEvent[MOUSE_PRESSED,(261,202),absolute(366,328),button=5,extModifiers=Button5,clickCount=1]
java.awt.event.MouseEvent[MOUSE_RELEASED,(261,202),absolute(366,328),button=5,clickCount=1]
java.awt.event.MouseEvent[MOUSE_PRESSED,(261,202),absolute(366,328),button=4,extModifiers=Button4,clickCount=1]
java.awt.event.MouseEvent[MOUSE_RELEASED,(261,202),absolute(366,328),button=4,clickCount=1]
With Java 7 it might be possible to implement a workaround since button 4 and 5 are
used to indicate left and right scrolling, but this might be system dependent.
I would suggest just to ignore these events for now instead of throwing an exception
until Java officially supports horizontal scrolling.
Reported by nlskrg
on 2011-11-03 21:26:16
+1 to ignoring these events for now instead of throwing an exception for the release-1.3
branch.
A comment in the Sun bug above describes a workaround for OSX
"Apple have added a workaround for this in Radar #4631846 - horizontal scrolling creates
a MouseWheelEvent with the "Shift" modifier set. This is a much lower impact method
than that specified above and works quite well. Any chance it could be extended across
platform?"
For svn trunk I think Piccolo2D should forward on events to the best of its ability,
and add support to e.g. PInputEvent for these platform-specific workarounds, in case
clients wish to implement horizontal scrolling on their own.
Reported by heuermh
on 2011-11-03 21:48:06
I ran into this unexpectedly on linux with a mouse that had buttons 4-5 mismapped as
6-7 when testing issue 236.
I also wanted to forward this note I received from an AWT engineer:
"[H]orizontal scrolling is indeed a problem in AWT/Swing. We don't have public API
for that (but we do for vertical/wheel events). It can be introduced in JDK8, but given
the current status of AWT and Swing, I don't think it makes much sense.
However, some of the Swing controls (e.g. JScrollPane) support horizontal scrolling
emulation. When mouse wheel is rotated with Shift being pressed, horizontal scrolling
takes place. In Mac OS X Port, we translated native horizontal events (e.g. from MacBook/Pro
touchpad) into Shift+MouseWheel, so it should also work."
Reported by heuermh
on 2012-02-23 22:11:15
Fixed on branches/release-1.3.1
$ svn commit -m "Issue 207 ; ignore mouse pressed and released events with button MouseEvent.NOBUTTON
instead of throwing an exception" .
Committed revision 1174.
and svn trunk
$ svn commit -m "Issue 207 ; ignore mouse pressed and released events with button MouseEvent.NOBUTTON
instead of throwing an exception" .
Committed revision 1175.
Will create a new issue for button 4/5 support + horizontal scrolling emulation.
Reported by heuermh
on 2012-08-31 20:12:18
Fixed
See related issue 241
Reported by heuermh
on 2012-08-31 20:16:08
Reported by heuermh
on 2013-11-26 17:42:20
Verified
Originally reported on Google Code with ID 207
Reported by
nlskrg
on 2011-02-07 15:42:07