D5037: KTextEditor: prevent accidental zooming

René J.V. Bertin noreply at phabricator.kde.org
Tue Mar 14 20:47:07 UTC 2017


rjvbb added a comment.


  In https://phabricator.kde.org/D5037#95031, @anthonyfieroni wrote:
  
  > Ok, note this situation, hold modifier before first ever wheel event => you call m_lastWheelEvent.elapsed on unstarted timer
  
  
  This is true, and things can indeed be improved a bit there.
  
  > and function returns true (m_accidentalModifier == false, m_lastWheelEventUnmodified == false)
  
  Am I missing something? For me that is exactly what the function should return, and the internal state is correct too. This works because the initial values for the 2 boolean state variables are set appropriately. In this case `deltaT` may be assigned a random value (because ElapsedSince::elapsed() is undefined) but that value won't be used.
  
  I can rewrite the code slightly so that the timer isn't used when not started but it won't make a difference for the end result, it will just add a few lines and an additional runtime check. Will do that ASAP.
  
  I'd say try the patch and see if you can break its (now of after I upload the rewritten version). I just tried generating wheel events with the control modifier set from event 1. I even "primed" the text zoom via the keyboard shortcuts to prevent initial zooming hickups. I don't notice anything weird: the zoom works just as you'd expect.
  
  Let me repeat if this wasn't clear: the purpose of this patch is only to prevent accidental zooming because you push the Control key while a scroll is still in progress. There's no way we can decide if a Control press is accidental when nothing else is going on.
  
  In fact, we don't even know if what I now call an accidental Control press is really accidental. It's a reasonable assumption (I think) and it's still easy enough to trigger wheel-zooming with this protection in place. But it is possible that in a certain number of cases that we now treat as regular scroll events the user actually wanted zooming, not scrolling. I just have to hope that it is easier for those users to adapt to the behaviour with protection than it is for users like me to adapt to not having it :)

REVISION DETAIL
  https://phabricator.kde.org/D5037

To: rjvbb, #ktexteditor
Cc: luebking, anthonyfieroni, dhaumann, kwrite-devel, #ktexteditor, #frameworks, head7, cullmann, kfunk, sars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170314/15484214/attachment.html>


More information about the Kde-frameworks-devel mailing list