mouse buttons - XButton1 and XButton2

Rick Stockton rickstockton at
Tue Feb 22 16:36:15 GMT 2011

On 01/-10/-28163 11:59 AM, todd rme  wrote:
> On Sun, Feb 20, 2011 at 4:57 PM, Rick Stockton 
> <rickstockton at 
> <mailto:rickstockton at>> wrote:
>     Within Qt, the Devs have recognized that Button8 and Button9 are
>     frequently implemented "backwards". Thus they assigned the more
>     cryptic names "XButton1" and "XButton2".
> Are you sure about this?  I thought xbutton1 and xbutton2 where the 
> "buttons" for the x-axis, that is the scroll wheel.  In other words, 
> xbutton1 is scroll up and xbutton 2 is scroll down (or vice versus).
Yes. Within 'qt/src/gui/kernel/qapplication_x11.cpp' , where X11 mouse 
events undergo translation (within QETWidget::translateMouseEvent(), 
which starts at-or-near line 4156 of the current GIT pull) you'll see 
Button4, Button5, Button6 and Button7 handled together as wheel events 
(with compression). The case statements for Button1 thru Button3 are 
above the wheel code, and the case statements for Button8 and Button9 
are below.

BTW, the switch statement is being done on an unsigned int 
(event->xbutton.button). Code for the higher-numbered buttons doesn't 
bother to create names like "Button3", the lines simply specify the uint 
values directly.
I've mis-stated this in the past. Thanks for the question, creating an 
opportunity for me to clarify and correct.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the kde-core-devel mailing list