Mir

Merge lp:~vanvugt/mir/workaround-1522673 into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 3183
Proposed branch: lp:~vanvugt/mir/workaround-1522673
Merge into: lp:mir
Diff against target: 28 lines (+6/-5)
1 file modified
playground/demo-shell/window_manager.cpp (+6/-5)
To merge this branch: bzr merge lp:~vanvugt/mir/workaround-1522673
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+279731@code.launchpad.net

Commit message

Work around unpredictable scroll magnitude. (LP: #1522673)

Knowing that all desktop mice implement scroll wheel as discrete
button 4/5 events, a robust client should do this anyway. The existence
of a magnitude is an illusion introduced by libinput, so ignore it.

The direction is still backwards but we'll fix that in one of the
"fix" branches.

Description of the change

I still wonder why input APIs insist on creating this problem with
a scroll "axis". All wheel mice I've ever seen emitted discrete
button events. It would be clearer for everyone if we just kept the button
4/5 events. In Xmir I actually have to synthesise button 4/5 events from the vscroll information anyway.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

OK

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'playground/demo-shell/window_manager.cpp'
--- playground/demo-shell/window_manager.cpp 2015-08-07 05:46:34 +0000
+++ playground/demo-shell/window_manager.cpp 2015-12-07 08:43:59 +0000
@@ -387,10 +387,11 @@
387387
388 float new_zoom_mag = 0.0f; // zero means unchanged388 float new_zoom_mag = 0.0f; // zero means unchanged
389389
390 if (modifiers & mir_input_event_modifier_meta &&390 if (modifiers & mir_input_event_modifier_meta &&
391 action == mir_pointer_action_motion)391 action == mir_pointer_action_motion &&
392 {392 vscroll != 0.0f)
393 zoom_exponent += vscroll;393 {
394 zoom_exponent += vscroll > 0.0f ? 1.0f : -1.0f;
394395
395 // Negative exponents do work too, but disable them until396 // Negative exponents do work too, but disable them until
396 // there's a clear edge to the desktop.397 // there's a clear edge to the desktop.
@@ -449,7 +450,7 @@
449 vscroll)450 vscroll)
450 {451 {
451 float alpha = surf->alpha();452 float alpha = surf->alpha();
452 alpha += 0.1f * vscroll;453 alpha += vscroll > 0.0f ? 0.1f : -0.1f;
453 if (alpha < 0.0f)454 if (alpha < 0.0f)
454 alpha = 0.0f;455 alpha = 0.0f;
455 else if (alpha > 1.0f)456 else if (alpha > 1.0f)

Subscribers

People subscribed via source and target branches