Mir

Merge lp:~alan-griffiths/mir/fix-1718624 into lp:mir

Proposed by Alan Griffiths on 2017-09-21
Status: Merged
Approved by: Gerry Boland on 2017-09-21
Approved revision: 4258
Merged at revision: 4262
Proposed branch: lp:~alan-griffiths/mir/fix-1718624
Merge into: lp:mir
Diff against target: 85 lines (+25/-41)
1 file modified
src/server/frontend/wayland/wayland_connector.cpp (+25/-41)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-1718624
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve on 2017-09-22
Gerry Boland 2017-09-21 Approve on 2017-09-21
Review via email: mp+331139@code.launchpad.net

Commit message

Improve handling of pointer button actions for Wayland clients

To post a comment you must log in.
Gerry Boland (gerboland) wrote :

Seems to work, I can't get the failure any more

review: Approve
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4258
https://mir-jenkins.ubuntu.com/job/mir-ci/3675/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5034/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5270
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5258
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5258
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5258
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5077/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5077
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5077/artifact/output/*zip*/output.zip
    ABORTED: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5077/console
    ABORTED: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5077/console
    ABORTED: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5077/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5077
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5077/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5077
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5077/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5077
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5077/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3675/rebuild

review: Needs Fixing (continuous-integration)
Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/frontend/wayland/wayland_connector.cpp'
2--- src/server/frontend/wayland/wayland_connector.cpp 2017-09-15 16:34:13 +0000
3+++ src/server/frontend/wayland/wayland_connector.cpp 2017-09-21 11:34:58 +0000
4@@ -795,28 +795,6 @@
5 {
6 }
7
8-namespace
9-{
10-uint32_t calc_button_difference(MirPointerButtons old, MirPointerButtons updated)
11-{
12- switch (old ^ updated)
13- {
14- case mir_pointer_button_primary:
15- return 272; // No, I have *no* idea why GTK expects 271 to be the primary button.
16- case mir_pointer_button_secondary:
17- return 274;
18- case mir_pointer_button_tertiary:
19- return 273;
20- case mir_pointer_button_back:
21- return 275; // I dunno. It's a number, I guess.
22- case mir_pointer_button_forward:
23- return 276; // I dunno. It's a number, I guess.
24- default:
25- throw std::logic_error("Whoops, I misunderstand how Mir pointer events work");
26- }
27-}
28-}
29-
30 class WlPointer : public wayland::Pointer
31 {
32 public:
33@@ -844,27 +822,33 @@
34 switch(mir_pointer_event_action(pointer_event))
35 {
36 case mir_pointer_action_button_down:
37- {
38- auto button = calc_button_difference(last_set, mir_pointer_event_buttons(pointer_event));
39- wl_pointer_send_button(
40- resource,
41- serial,
42- mir_input_event_get_event_time(event) / 1000,
43- button,
44- WL_POINTER_BUTTON_STATE_PRESSED);
45- last_set = mir_pointer_event_buttons(pointer_event);
46- break;
47- }
48 case mir_pointer_action_button_up:
49 {
50- auto button = calc_button_difference(last_set, mir_pointer_event_buttons(pointer_event));
51- wl_pointer_send_button(
52- resource,
53- serial,
54- mir_input_event_get_event_time(event) / 1000,
55- button,
56- WL_POINTER_BUTTON_STATE_RELEASED);
57- last_set = mir_pointer_event_buttons(pointer_event);
58+ auto const current_set = mir_pointer_event_buttons(pointer_event);
59+ auto const current_time = mir_input_event_get_event_time(event) / 1000;
60+
61+ auto button = 272; // No, I have *no* idea why GTK expects 272 to be the primary button.
62+ // NB button is incremented in the loop and the order mir_pointer_button_XXX matters
63+ for (auto mir_button :
64+ {mir_pointer_button_primary, // 272
65+ mir_pointer_button_tertiary, // 273
66+ mir_pointer_button_secondary, // 274
67+ mir_pointer_button_back, // 275
68+ mir_pointer_button_forward}) // 276
69+ {
70+ if (mir_button & (current_set ^ last_set))
71+ {
72+ auto const action = (mir_button & current_set) ?
73+ WL_POINTER_BUTTON_STATE_PRESSED :
74+ WL_POINTER_BUTTON_STATE_RELEASED;
75+
76+ wl_pointer_send_button(resource, serial, current_time, button, action);
77+ }
78+
79+ ++button;
80+ }
81+
82+ last_set = current_set;
83 break;
84 }
85 case mir_pointer_action_enter:

Subscribers

People subscribed via source and target branches