Bug 571 - Wrong Newt MouseEvent behavior on X11
Summary: Wrong Newt MouseEvent behavior on X11
Status: RESOLVED FIXED
Alias: None
Product: Newt
Classification: JogAmp
Component: x11 (show other bugs)
Version: 1
Hardware: pc_x86_64 linux
: --- normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2012-03-30 10:39 CEST by Sebastien Schneider
Modified: 2012-04-27 10:28 CEST (History)
2 users (show)

See Also:
Type: ---
SCM Refs:
4efc9344af1c4aa7d00c7b40e5caf063efdf6080
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastien Schneider 2012-03-30 10:39:27 CEST
Hi,
It looks like there is a bug in the modifiers attribute value of the NEWT InputEvent when this one is a MouseEvent and only on X11. The problem is reproducible with a pure NEWT GLWindow or also with a NewtCanvasAWT and can be highlighted by using a TraceMouseAdapter to display the modifiers value.

Actually, on a given event it seems that the modifiers is set to the value of the previous event. Over there  the modifiers value in a MouseEvent on X11 is never set to a combination of button pressed.

Typical use case is: I press button 1, then button 2 and then button 3 without releasing anything and the trace log on X11 (Ubuntu 11.10 64bit) from TraceMouseAdapter is:

MouseEvent[EVENT_MOUSE_PRESSED, [I@4911b910/[I@2a8ceeea, button 1, count 1, wheel rotation 0, pointer<1>[-1: 181 / 145 0.0p], InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1333096374870 d 0ms]]]
MouseEvent[EVENT_MOUSE_PRESSED, [I@5a02c35e/[I@6b687e7c, button 2, count 1, wheel rotation 0, pointer<1>[-1: 181 / 145 0.0p], InputEvent[modifiers: 0x40, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1333096376803 d 0ms]]]
MouseEvent[EVENT_MOUSE_PRESSED, [I@194835fb/[I@53cffeb4, button 3, count 1, wheel rotation 0, pointer<1>[-1: 181 / 145 0.0p], InputEvent[modifiers: 0xc0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1333096378004 d 1ms]]]

And the same NEWT code on Windows7 64bits with the same use case, the trace log is:

MouseEvent[EVENT_MOUSE_PRESSED, [I@1723ade0/[I@276c58fe, button 1, count 1, wheel rotation 0, pointer<1>[-1: 193 / 231 0.0p], InputEvent[modifiers:64, NEWTEvent[sys:false, source:jogamp.newt.driver.windows.WindowsWindow, when:1333096612564 d 0ms]]]
MouseEvent[EVENT_MOUSE_PRESSED, [I@3a469fea/[I@72acd989, button 2, count 2, wheel rotation 0, pointer<1>[-1: 193 / 231 0.0p], InputEvent[modifiers:192, NEWTEvent[sys:false, source:jogamp.newt.driver.windows.WindowsWindow, when:1333096612795 d 0ms]]]
MouseEvent[EVENT_MOUSE_PRESSED, [I@e41a242/[I@7703a25d, button 3, count 3, wheel rotation 0, pointer<1>[-1: 193 / 231 0.0p], InputEvent[modifiers:448, NEWTEvent[sys:false, source:jogamp.newt.driver.windows.WindowsWindow, when:1333096612976 d 0ms]]]
Comment 1 Sebastien Schneider 2012-03-30 11:19:03 CEST
Sorry I was wrong by saying that "Over there  the modifiers value in a MouseEvent on X11 is never set to a combination of button pressed.": 0x40+0x80=0xc0. So the button press combination is ok but still shifted one event back.
Comment 2 Sven Gothel 2012-04-27 01:22:41 CEST
Fixed w/ JOGL commit 4efc9344af1c4aa7d00c7b40e5caf063efdf6080

Remark: The behavior described _is_ the original X11 behavior.
However, to align the platform behavior, we now set the button mask of a named button
if the native mouse event.
Comment 3 Julien Gouesse 2012-04-27 10:28:22 CEST
I'll give it a try very soon. Thank you.