Some infomation about recent Qt5 mouse handling work.

classic Classic list List threaded Threaded
3 messages Options
csslayer csslayer
Reply | Threaded
Open this post in threaded view
|

Some infomation about recent Qt5 mouse handling work.

Hi,

I'm just coming from a phoronix post about qt5 work on libreoffice. I
noticed that
https://cgit.freedesktop.org/libreoffice/core/commit/?id=1426437be0530a8ba5749c7e76c5ce0e9053af2f 
mentioned that there're still some issues on touchpad, so I'd just like to
provides some info about qt5's wheel event since I had fixed a bunch of
similar issue in KDE some time ago.

This is because qt5  generates high resolution touchpad event.  The correct
implementation can be  done by either making use of pixelDelta to do high
resolution scroll, or using  angleDelta(or delta in qwidget) to trigger a
"tick" every 120 unit of angle delta. More information can be  found at
http://doc.qt.io/qt-5/qml-qtquick-wheelevent.html#angleDelta-prop (it's for
qml but the information about delta also applies to qwidget).

An example of "120 per tick" implementation in KDE code base can be found
at:
https://lxr.kde.org/source/frameworks/plasma-framework/src/scriptengines/qml/plasmoid/containmentinterface.cpp#1097

I guess for this  Qt5 work is still WIP probably doesn't worth a bug report,
so I'd just ping some one  here.

Regards,
Xuetian



--
Sent from: http://nabble.documentfoundation.org/Dev-f1639786.html
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Jan-Marek Glogowski Jan-Marek Glogowski
Reply | Threaded
Open this post in threaded view
|

Re: Some infomation about recent Qt5 mouse handling work.

Hi Xuetian,

> I'm just coming from a phoronix post about qt5 work on libreoffice. IOha

> noticed that
> https://cgit.freedesktop.org/libreoffice/core/commit/?id=1426437be0530a8ba5749c7e76c5ce0e9053af2f 
> mentioned that there're still some issues on touchpad, so I'd just like to
> provides some info about qt5's wheel event since I had fixed a bunch of
> similar issue in KDE some time ago.
>
> This is because qt5  generates high resolution touchpad event.  The correct
> implementation can be  done by either making use of pixelDelta to do high
> resolution scroll, or using  angleDelta(or delta in qwidget) to trigger a
> "tick" every 120 unit of angle delta. More information can be  found at
> http://doc.qt.io/qt-5/qml-qtquick-wheelevent.html#angleDelta-prop (it's for
> qml but the information about delta also applies to qwidget).
>
> An example of "120 per tick" implementation in KDE code base can be found
> at:
> https://lxr.kde.org/source/frameworks/plasma-framework/src/scriptengines/qml/plasmoid/containmentinterface.cpp#1097
>
> I guess for this  Qt5 work is still WIP probably doesn't worth a bug report,
> so I'd just ping some one  here.

Thanks for the info. It'll definitely be handy at some time.

I found https://doc.qt.io/qt-5/qwheelevent.html#angleDelta, which even
has a little example and which I kind of copied. The larger problem is
to understand, what the LO VCL event expects.

And you're right; since we still get the basic stuff running, it doesn't
make any sense to open bug reports. I hope something really usable will
be ready for 6.0. Still end of January 2018 seems a short ETA to finish
everything, not even considering any special KF5 handling.

> Regards,

Jan-Marek
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
csslayer csslayer
Reply | Threaded
Open this post in threaded view
|

Re: Some infomation about recent Qt5 mouse handling work.

On Tuesday, 7 November 2017 05:21:38 PST,Jan-Marek Glogowski wrote:
>
> Thanks for the info. It'll definitely be handy at some time.
>
> I found https://doc.qt.io/qt-5/qwheelevent.html#angleDelta, which even
> has a little example and which I kind of copied. The larger problem is
> to understand, what the LO VCL event expects.
>
Just to point out that the code snippet that you point to is not fully
correct, because angleDelta may return value less than 8. This is common on
modern touchpad when you move finger slowly, and that's the root clause why you
don't feel right when using touchpad.

One way to resolve this is to follow the text above the example:  
"cumulatively adding the delta" and trigger based on a certain value (not
necessary 120). Still, trigger threshold should be a factor of 120, because
low-precision mouse wheel will generate 120 per click.

Just take your implementation as an example, since you intent to scroll 3 line
per click, you may convert it to 40 unit per line so user can get more fine-
grained control if they're using touchpad or high-precision mouse. And keep
track of the remainder of delta and add it to the delta value for the next qt
wheel event.

Regards,
Xuetian

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice