[Qt5-feedback] X11 mouse buttons in qt4, qt5, and KDE: please, PLEASE review this design.

Samuel Rødal samuel.rodal at nokia.com
Thu Jul 28 10:25:17 CEST 2011


On 07/28/2011 10:16 AM, ext Samuel Rødal wrote:
> On 07/27/2011 10:16 PM, ext Rick Stockton wrote:
>> We have 3 bits available for enumeration of additional buttons without
>> breaking compatibility. I think that the key to getting all 31 possible
>> X11 buttons into qt is this: Use only two of them, for the buttons sent
>> up from X11 as "Button10" and Button11". (Those are the raw numbers from
>> X11, in which the four wheel-scroll "buttons" DID appear as button
>> numbers.) Then, instead of using the last bit (x80) to define
>> "Button12", give it a name (e.g., Qt::HigherButton) which indicates that
>> the Button number (from X11, or another platform interface with good
>> button support) is GREATER than the one that which I've tentatively
>> enumerating as "Button11". BTW, here's the entire enum which I propose
>> to use:
>>
>> enum MouseButton {
>> NoButton = 0x00000000,
>> LeftButton = 0x00000001,
>> RightButton = 0x00000002,
>> MidButton = 0x00000004, // ### Qt 5: remove me
>> MiddleButton = MidButton,
>> XButton1 = 0x00000008,
>> BackButton = XButton1,
>> XButton2 = 0x00000010,
>> ForwardButton = XButton2,
>> Button10 = 0x00000020,
>> Button11 = 0x00000040,
>> HigherButton = 0x00000080,
>> MouseButtonMask = 0x000000ff
>> };
>> Q_DECLARE_FLAGS(MouseButtons, MouseButton)

Oh, another thought, can't we just extend the MouseButtonMask to include 
more bits in Qt 5? Would 32 buttons be sufficient for any reasonable use?

--
Samuel


More information about the Qt5-feedback mailing list