From d10dae464ef9309a92eb9b49323fe1db93c3fc9f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 8 Oct 2012 01:22:30 +0200 Subject: Raise NEWT MouseButton Maximum from 6 -> 16 (API Change) - Button 9 has been reported to be sent by Olamedia - Rearrange the input bit mask in InputEvent (API Change) - Raise the max. button number to 16 --- .../classes/com/jogamp/newt/event/InputEvent.java | 28 +++++++++++++--------- .../classes/com/jogamp/newt/event/MouseEvent.java | 11 +++++++-- .../jogamp/newt/driver/x11/WindowDriver.java | 4 ++-- 3 files changed, 28 insertions(+), 15 deletions(-) (limited to 'src/newt/classes') diff --git a/src/newt/classes/com/jogamp/newt/event/InputEvent.java b/src/newt/classes/com/jogamp/newt/event/InputEvent.java index 148ac5962..0122bda9a 100644 --- a/src/newt/classes/com/jogamp/newt/event/InputEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/InputEvent.java @@ -43,22 +43,28 @@ public abstract class InputEvent extends NEWTEvent public static final int CTRL_MASK = 1 << 1; public static final int META_MASK = 1 << 2; public static final int ALT_MASK = 1 << 3; - public static final int ALT_GRAPH_MASK = 1 << 5; - public static final int BUTTON1_MASK = 1 << 6; - public static final int BUTTON2_MASK = 1 << 7; - public static final int BUTTON3_MASK = 1 << 8; - public static final int BUTTON4_MASK = 1 << 9; - public static final int BUTTON5_MASK = 1 << 10; - public static final int BUTTON6_MASK = 1 << 11; + public static final int ALT_GRAPH_MASK = 1 << 4; + + public static final int BUTTON1_MASK = 1 << 5; + public static final int BUTTON2_MASK = 1 << 6; + public static final int BUTTON3_MASK = 1 << 7; + public static final int BUTTON4_MASK = 1 << 8; + public static final int BUTTON5_MASK = 1 << 9; + public static final int BUTTON6_MASK = 1 << 10; + public static final int BUTTON7_MASK = 1 << 11; + public static final int BUTTON8_MASK = 1 << 12; + public static final int BUTTON9_MASK = 1 << 13; + + public static final int BUTTONLAST_MASK = 1 << 20; // 16 /** Event is caused by auto-repeat. */ - public static final int AUTOREPEAT_MASK = 1 << 15; + public static final int AUTOREPEAT_MASK = 1 << 29; /** Pointer is confined, see {@link Window#confinePointer(boolean)}. */ - public static final int CONFINED_MASK = 1 << 16; + public static final int CONFINED_MASK = 1 << 30; /** Pointer is invisible, see {@link Window#setPointerVisible(boolean)}. */ - public static final int INVISIBLE_MASK = 1 << 17; + public static final int INVISIBLE_MASK = 1 << 31; /** * Returns the corresponding button mask for the given button. @@ -70,7 +76,7 @@ public abstract class InputEvent extends NEWTEvent */ public static final int getButtonMask(int button) { if( 0 < button && button <= MouseEvent.BUTTON_NUMBER ) { - return 1 << ( 5 + button ) ; + return 1 << ( 4 + button ) ; } return 0; } diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java index d293d2db7..914aaa647 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java @@ -49,8 +49,15 @@ public class MouseEvent extends InputEvent public static final int BUTTON5 = 5; /** ID for button 6, value 6 */ public static final int BUTTON6 = 6; - /** Number of buttons, value 6 */ - public static final int BUTTON_NUMBER = 6; + /** ID for button 6, value 7 */ + public static final int BUTTON7 = 7; + /** ID for button 6, value 8 */ + public static final int BUTTON8 = 8; + /** ID for button 6, value 9 */ + public static final int BUTTON9 = 9; + + /** Maximum number of buttons, value 16 */ + public static final int BUTTON_NUMBER = 16; public static final int getClickTimeout() { return 300; diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java index 92f174e39..c21cb4b40 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java @@ -51,9 +51,9 @@ import com.jogamp.newt.event.MouseEvent; public class WindowDriver extends WindowImpl { private static final String WINDOW_CLASS_NAME = "NewtWindow"; - private static final int X11_WHEEL_ONE_UP_BUTTON = 4; + private static final int X11_WHEEL_ONE_UP_BUTTON = 4; private static final int X11_WHEEL_ONE_DOWN_BUTTON = 5; - private static final int X11_WHEEL_TWO_UP_BUTTON = 6; + private static final int X11_WHEEL_TWO_UP_BUTTON = 6; private static final int X11_WHEEL_TWO_DOWN_BUTTON = 7; static { -- cgit v1.2.3