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
1=== modified file 'playground/demo-shell/window_manager.cpp'
2--- playground/demo-shell/window_manager.cpp 2015-08-07 05:46:34 +0000
3+++ playground/demo-shell/window_manager.cpp 2015-12-07 08:43:59 +0000
4@@ -387,10 +387,11 @@
5
6 float new_zoom_mag = 0.0f; // zero means unchanged
7
8- if (modifiers & mir_input_event_modifier_meta &&
9- action == mir_pointer_action_motion)
10- {
11- zoom_exponent += vscroll;
12+ if (modifiers & mir_input_event_modifier_meta &&
13+ action == mir_pointer_action_motion &&
14+ vscroll != 0.0f)
15+ {
16+ zoom_exponent += vscroll > 0.0f ? 1.0f : -1.0f;
17
18 // Negative exponents do work too, but disable them until
19 // there's a clear edge to the desktop.
20@@ -449,7 +450,7 @@
21 vscroll)
22 {
23 float alpha = surf->alpha();
24- alpha += 0.1f * vscroll;
25+ alpha += vscroll > 0.0f ? 0.1f : -0.1f;
26 if (alpha < 0.0f)
27 alpha = 0.0f;
28 else if (alpha > 1.0f)

Subscribers

People subscribed via source and target branches