From 4f4a9be15b0c52837dd4d4a04ff021cc3e5d691e Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Thu, 26 Sep 2024 17:59:52 +0200 Subject: Support mouse buttons 4 + 5 (aka "side buttons") (#1076, #1068) This work is based on PR 1068 (patch by @CendioHalim) and extended to store button status (4,5) in Fl::event_state() like it's done for other mouse buttons (1-3). Changes: - new symbol: FL_BUTTON4 = side button 1 = "back" - new symbol: FL_BUTTON5 = side button 2 = "forward" - modified : FL_BUTTONS now includes bits for two side buttons Note: the status of these new buttons is not maintained by X11, therefore we need to maintain them in internal variables for this platform. --- FL/Enumerations.H | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'FL/Enumerations.H') diff --git a/FL/Enumerations.H b/FL/Enumerations.H index 1beb450e5..97b4c7029 100644 --- a/FL/Enumerations.H +++ b/FL/Enumerations.H @@ -548,9 +548,11 @@ enum Fl_Callback_Reason { /**@{*/ -#define FL_LEFT_MOUSE 1 ///< The left mouse button -#define FL_MIDDLE_MOUSE 2 ///< The middle mouse button -#define FL_RIGHT_MOUSE 3 ///< The right mouse button +#define FL_LEFT_MOUSE 1 ///< The left mouse button +#define FL_MIDDLE_MOUSE 2 ///< The middle mouse button +#define FL_RIGHT_MOUSE 3 ///< The right mouse button +#define FL_BACK_MOUSE 4 ///< The back mouse button (side button 1) +#define FL_FORWARD_MOUSE 5 ///< The forward mouse button (side button 2) /**@}*/ // group: Mouse Buttons @@ -575,11 +577,17 @@ enum Fl_Callback_Reason { // correct for XFree86 #define FL_SCROLL_LOCK 0x00800000 ///< The scroll lock is on // correct for XFree86 -#define FL_BUTTON1 0x01000000 ///< Mouse button 1 is pushed (L) -#define FL_BUTTON2 0x02000000 ///< Mouse button 2 is pushed (M) -#define FL_BUTTON3 0x04000000 ///< Mouse button 3 is pushed (R) -#define FL_BUTTONS 0x07000000 ///< Any mouse button (1-3) is pushed -#define FL_BUTTON(n) (0x00800000<<(n)) ///< Mouse button n (n > 0) is pushed +// Mouse buttons + +#define FL_BUTTON1 0x01000000 ///< Mouse button 1 is pushed (L) +#define FL_BUTTON2 0x02000000 ///< Mouse button 2 is pushed (M) +#define FL_BUTTON3 0x04000000 ///< Mouse button 3 is pushed (R) +#define FL_BUTTON4 0x08000000 ///< Mouse button 4 is pushed (BACK) +#define FL_BUTTON5 0x10000000 ///< Mouse button 5 is pushed (FORWARD) +#define FL_BUTTONS 0x1f000000 ///< Bitmask: any mouse button (1-5) is pushed + +#define FL_BUTTON(n) (0x00800000<<(n)) ///< Mouse button n (n = 1..5) is pushed, + ///< *undefined* if n outside 1..5 #define FL_KEY_MASK 0x0000ffff ///< All keys are 16 bit for now // FIXME: Unicode needs 21 bits! -- cgit v1.2.3