[Development] I have ALL MOUSE BUTTONS WORKING for xcb and xlib :)) on qt5

Samuel Rødal samuel.rodal at nokia.com
Thu Nov 10 09:23:23 CET 2011


On 11/10/2011 12:41 AM, ext Rick Stockton wrote:
> My thanks to you, MGrasslin, Aaron, Todd rme, and Thiago for coaching me
> towards this achievement. The new code is small, and VERY simple. We
> have no API changes (at least, not yet--- we should implement a mouse
> button mask "getter" as a new feature, but that's for later in the 5.x
> series. It won't have any BC issues.) I will need to write doco of the
> new Qt::MouseButton values, and others will need to translate that material.
>
> My "qt5_MouseButtonTester" is a QTextEdit window, with Mouse events
> (Click/Release/DoubleClick) extended to show some qDebug() on the parent
> console. Basically, it's an "xev" program for Mouse Buttons in Qt. This
> tester, on Qt::MouseButton events, translates the button value back into
> the raw X11 number. I verified the button locations on my mouse to be
> correct, using xev itself.
>
> My mouse has "only" 14 buttons, plus the tilt wheel, for a total of 18.
> I know that the Razr 'Naga' has even more, but it's too small for my
> hand. (And the one I've got cost me enough money, already.) The logic
> works for up to 31 "button numbers", with 4-7 taken for the four
> possible directions of wheel motion. Just for fun, here's my output from
> clicking the buttons in order. I did perform a few DoubleClick events
> during the test:
>
>     rick at x2:~/qt_projects/qt5_MouseButtonTester> qt5_MouseButtonTester
>
>     No platform plugin argument was specified, defaulting to "xcb".
>     Successfully connected to display :0
>
>     Information of screen 346:
>     width.........: 1920
>     height........: 1200
>     depth.........: 24
>     white pixel...: ffffff
>     black pixel...: 0
>
>     Running window manager: KWin
>     MousePress: button 1
>     MouseRelease:
>     MousePress: button 2
>     MouseRelease:
>     MousePress: button 3
>     Mouse Wheel Event: UP
>     Mouse Wheel Event: DOWN
>     Mouse Wheel Event: LEFT
>     Mouse Wheel Event: RIGHT
>     MousePress: button 8
>     MouseRelease:
>     MousePress: button 9
>     MouseRelease:
>     Mouse DoubleClick:
>     MousePress: button 10
>     MouseRelease:
>     MousePress: button 11
>     MouseRelease:
>     Mouse DoubleClick:
>     MousePress: button 12
>     MouseRelease:
>     MousePress: button 13
>     MouseRelease:
>     Mouse DoubleClick:
>     MousePress: button 14
>     MouseRelease:
>     rick at x2:~/qt_projects/qt5_MouseButtonTester>
>
> xlib runs the same, as far as my mouse buttons are concerned. But the
> App Window fails to repaint when I move it, or when I resize it. I'll
> SWAG that we've got an issue there, not the fault of kwin 4.6.5. (I can
> try running it from another User in which my desktop is fresh kwin
> 4.8-pre from GIT, if you think that the WM should be getting the blame
> for this behavior. Let me know on that, thanks.
> - - - - -
>
> FILES CHANGED:
>
> qnamespace.h:
> (The expanded enum/flags is prerequisite for all other code changes).
> DOCO IS NEEDED, I can write it in En-US.
>
> qguiapplication.cpp:
> (This contains a redundant check on button numbers being passed up from
> plugins. I made a one-line change, upping the high-limit to be
> 'Qt::Button31'.)
>
> qxlibwindow.cpp, qxcbwindow:
> (I added cases to the ev->button 'switch' block, for all of the new
> buttons. In this file, and qxcbwindow.cpp, I also eliminated an
> unnecessary multiply in the calculation of 'delta' -- simply setting
> values 120 : -120 as the hard-coded results of the "?" operator (rather
> than multiplying 120 * .... ? 1: -1).
>
> Should we do them all as one update, or do xlib first -- and add the
> more widely used xcb as a separate update, after the first one is found
> NOT to cause regression test failures over the next weekend? (BTW, I
> don't know how to do the Git Clone and Request procedure, and I'm a slow
> learner-- it would REALLY be better if I simply emailed these files to
> you.) Changes are public domain, of course - I think that I've already
> certified acceptance of the Qt license exceptions for my Contributions.

On linux tests are run with xcb, so xlib won't cause any regressions. 
Potential regressions will be caught by the CI system when using Gerrit. 
I don't mind submitting the xcb and xlib changes as one.

> Now, for Wayland:
> I can create alternate UserIDs on my PC, of course. But the plugin fails
> to compile, issuing the following message:
>
>     ..... -o qwaylandinputdevice.o qwaylandinputdevice.cpp
>     qwaylandinputdevice.cpp:527:1: error: too many initializers for
>     ‘const wl_input_device_listener’
>     make: *** [qwaylandinputdevice.o] Error 1
>
> Not a missing library or header, my hand-edit of the Makefile was
> correct. I suspect that this results from my use of a fresh 'Pull' of
> Wayland, per the README instructions. I don't have time for this one
> (and I'm a slow learner), can you or another 'Grandmaster' take care of it?

In qtwayland there's a wayland_sha1.txt, we haven't upgraded to the 
latest wayland API changes in a while. We're in the process of doing so 
thoug.

--
Samuel




More information about the Development mailing list