Mir

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

Proposed by Alan Griffiths
Status: Merged
Approved by: Gerry Boland
Approved revision: no longer in the source branch.
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
Gerry Boland (community) Approve
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.
Revision history for this message
Gerry Boland (gerboland) wrote :

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

review: Approve
Revision history for this message
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)
Revision history for this message
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
=== modified file 'src/server/frontend/wayland/wayland_connector.cpp'
--- src/server/frontend/wayland/wayland_connector.cpp 2017-09-15 16:34:13 +0000
+++ src/server/frontend/wayland/wayland_connector.cpp 2017-09-21 11:34:58 +0000
@@ -795,28 +795,6 @@
795{795{
796}796}
797797
798namespace
799{
800uint32_t calc_button_difference(MirPointerButtons old, MirPointerButtons updated)
801{
802 switch (old ^ updated)
803 {
804 case mir_pointer_button_primary:
805 return 272; // No, I have *no* idea why GTK expects 271 to be the primary button.
806 case mir_pointer_button_secondary:
807 return 274;
808 case mir_pointer_button_tertiary:
809 return 273;
810 case mir_pointer_button_back:
811 return 275; // I dunno. It's a number, I guess.
812 case mir_pointer_button_forward:
813 return 276; // I dunno. It's a number, I guess.
814 default:
815 throw std::logic_error("Whoops, I misunderstand how Mir pointer events work");
816 }
817}
818}
819
820class WlPointer : public wayland::Pointer798class WlPointer : public wayland::Pointer
821{799{
822public:800public:
@@ -844,27 +822,33 @@
844 switch(mir_pointer_event_action(pointer_event))822 switch(mir_pointer_event_action(pointer_event))
845 {823 {
846 case mir_pointer_action_button_down:824 case mir_pointer_action_button_down:
847 {
848 auto button = calc_button_difference(last_set, mir_pointer_event_buttons(pointer_event));
849 wl_pointer_send_button(
850 resource,
851 serial,
852 mir_input_event_get_event_time(event) / 1000,
853 button,
854 WL_POINTER_BUTTON_STATE_PRESSED);
855 last_set = mir_pointer_event_buttons(pointer_event);
856 break;
857 }
858 case mir_pointer_action_button_up:825 case mir_pointer_action_button_up:
859 {826 {
860 auto button = calc_button_difference(last_set, mir_pointer_event_buttons(pointer_event));827 auto const current_set = mir_pointer_event_buttons(pointer_event);
861 wl_pointer_send_button(828 auto const current_time = mir_input_event_get_event_time(event) / 1000;
862 resource,829
863 serial,830 auto button = 272; // No, I have *no* idea why GTK expects 272 to be the primary button.
864 mir_input_event_get_event_time(event) / 1000,831 // NB button is incremented in the loop and the order mir_pointer_button_XXX matters
865 button,832 for (auto mir_button :
866 WL_POINTER_BUTTON_STATE_RELEASED);833 {mir_pointer_button_primary, // 272
867 last_set = mir_pointer_event_buttons(pointer_event);834 mir_pointer_button_tertiary, // 273
835 mir_pointer_button_secondary, // 274
836 mir_pointer_button_back, // 275
837 mir_pointer_button_forward}) // 276
838 {
839 if (mir_button & (current_set ^ last_set))
840 {
841 auto const action = (mir_button & current_set) ?
842 WL_POINTER_BUTTON_STATE_PRESSED :
843 WL_POINTER_BUTTON_STATE_RELEASED;
844
845 wl_pointer_send_button(resource, serial, current_time, button, action);
846 }
847
848 ++button;
849 }
850
851 last_set = current_set;
868 break;852 break;
869 }853 }
870 case mir_pointer_action_enter:854 case mir_pointer_action_enter:

Subscribers

People subscribed via source and target branches