From 32916adb820e2e8c4b11917d7635c84138770484 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 27 May 2022 02:23:54 +0100 Subject: [PATCH] Add handy mouse button enum Signed-off-by: falkTX --- dgl/Base.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dgl/Base.hpp b/dgl/Base.hpp index bb0538c9..c49740ad 100644 --- a/dgl/Base.hpp +++ b/dgl/Base.hpp @@ -130,6 +130,29 @@ enum CrossingMode { kCrossingUngrab ///< Crossing due to a grab release }; +/** + A mouse button. + + Mouse button numbers start from 1, and are ordered: primary, secondary, middle. + So, on a typical right-handed mouse, the button numbers are: + + Left: 1 + Right: 2 + Middle (often a wheel): 3 + + Higher button numbers are reported in the same order they are represented on the system. + There is no universal standard here, but buttons 4 and 5 are typically a pair of buttons or a rocker, + which are usually bound to "back" and "forward" operations. + + Note that these numbers may differ from those used on the underlying + platform, since they are manipulated to provide a consistent portable API. +*/ +enum MouseButton { + kMouseButtonLeft = 1, + kMouseButtonRight, + kMouseButtonMiddle, +}; + /** A mouse cursor type.