[Development] mouse wheel zooming and inertial scrolling

René J. V. Bertin rjvbertin at gmail.com
Thu Sep 3 19:53:29 CEST 2015


Sorvig Morten wrote:

Hi,
> On the OS X side his is handled in the platform plugin: We read the key
> modifier state at the beginning of the scroll event sequence.
> 
> The code in question is in  - (void)scrollWheel:(NSEvent *)theEvent in
> qnsview.mm

Indeed, and it even has a nice comment that describes "my" issue perfectly:
  // Prevent keyboard modifier state from changing during scroll event streams.
  // A two-finger trackpad flick generates a stream of scroll events. We want
  // the keyboard modifier state to be the state at the beginning of the
  // flick in order to avoid changing the interpretation of the events
  // mid-stream. One example of this happening would be when pressing cmd
  // after scrolling in Qt Creator: not taking the phase into account causes
  // the end of the event stream to be interpreted as font size changes.

I've come up with the attached patch, which seems to have the intended effect.
Is there a reason to check and act on NSInputManager::wantsToHandleMouseEvents 
when QT_NO_WHEELEVENT is set? In other words, does the default scrollWheel 
method not do this already?

The question remains if it's possible to do something similar on X11/xcb ? 
Because the same issue occurs there too, and is actually worse because whatever 
simulates inertial scrolling there doesn't know when the view reached its top or 
bottom (so scroll events keep coming until the "inertia is coasted out").

R.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-avoid-unwanted-fontzooming.diff
Type: text/x-patch
Size: 3527 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150903/55aaaad2/attachment.bin>


More information about the Development mailing list