Mir

Merge lp:~raof/mir/wayland-touch-support into lp:mir

Proposed by Chris Halse Rogers
Status: Merged
Merged at revision: 4272
Proposed branch: lp:~raof/mir/wayland-touch-support
Merge into: lp:mir
Prerequisite: lp:~raof/mir/wayland-clients-close-their-sessions-on-quit
Diff against target: 106 lines (+78/-3)
1 file modified
src/server/frontend/wayland/wayland_connector.cpp (+78/-3)
To merge this branch: bzr merge lp:~raof/mir/wayland-touch-support
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Needs Fixing
Alan Griffiths Approve
Review via email: mp+331368@code.launchpad.net

Commit message

Wayland: Implement touch support.

This is mostly complete - it does not support touchpoint shape/size, but we only expose wl_seat v5 (as that's the version supported by Xenial's wayland) and the size/shape protocol was added in v6 anyway.

Fixes: https://bugs.launchpad.net/mir/+bug/1718732

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

$ bzr diff
=== modified file 'src/server/frontend/wayland/wayland_connector.cpp'
--- src/server/frontend/wayland/wayland_connector.cpp 2017-09-26 20:56:19 +0000
+++ src/server/frontend/wayland/wayland_connector.cpp 2017-09-26 21:24:57 +0000
@@ -1055,7 +1055,8 @@
         std::shared_ptr<mir::Executor> const& executor)
         : Touch(client, parent, id),
           executor{executor},
- on_destroy{on_destroy}
+ on_destroy{on_destroy},
+ destroyed{std::make_shared<bool>(false)}
     {
     }

review: Needs Fixing
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4280
https://mir-jenkins.ubuntu.com/job/mir-ci/3696/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5068/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5304
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5292
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5292
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5292
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5112
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5112/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5112/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5112
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5112/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5112/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5112
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5112/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5112
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5112/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/5112
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5112/artifact/output/*zip*/output.zip
    ABORTED: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5112/console

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

review: Needs Fixing (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-26 21:34:45 +0000
+++ src/server/frontend/wayland/wayland_connector.cpp 2017-09-26 21:34:45 +0000
@@ -1055,7 +1055,8 @@
1055 std::shared_ptr<mir::Executor> const& executor)1055 std::shared_ptr<mir::Executor> const& executor)
1056 : Touch(client, parent, id),1056 : Touch(client, parent, id),
1057 executor{executor},1057 executor{executor},
1058 on_destroy{on_destroy}1058 on_destroy{on_destroy},
1059 destroyed{std::make_shared<bool>(false)}
1059 {1060 {
1060 }1061 }
10611062
@@ -1065,8 +1066,81 @@
1065 *destroyed = true;1066 *destroyed = true;
1066 }1067 }
10671068
1068 void handle_event(MirInputEvent const* /*event*/, wl_resource* /*target*/)1069 void handle_event(MirInputEvent const* event, wl_resource* target)
1069 {1070 {
1071 executor->spawn(run_unless(
1072 destroyed,
1073 [ev = mcl::Event{mir_input_event_get_event(event)}, target = target, this]()
1074 {
1075 auto const input_ev = mir_event_get_input_event(ev);
1076 auto const touch_ev = mir_input_event_get_touch_event(input_ev);
1077
1078 for (auto i = 0u; i < mir_touch_event_point_count(touch_ev); ++i)
1079 {
1080 auto const touch_id = mir_touch_event_id(touch_ev, i);
1081 auto const action = mir_touch_event_action(touch_ev, i);
1082 auto const x = mir_touch_event_axis_value(
1083 touch_ev,
1084 i,
1085 mir_touch_axis_x);
1086 auto const y = mir_touch_event_axis_value(
1087 touch_ev,
1088 i,
1089 mir_touch_axis_y);
1090
1091 switch (action)
1092 {
1093 case mir_touch_action_down:
1094 wl_touch_send_down(
1095 resource,
1096 wl_display_get_serial(wl_client_get_display(client)),
1097 mir_input_event_get_event_time(input_ev) / 1000,
1098 target,
1099 touch_id,
1100 wl_fixed_from_double(x),
1101 wl_fixed_from_double(y));
1102 break;
1103 case mir_touch_action_up:
1104 wl_touch_send_up(
1105 resource,
1106 wl_display_get_serial(wl_client_get_display(client)),
1107 mir_input_event_get_event_time(input_ev) / 1000,
1108 touch_id);
1109 break;
1110 case mir_touch_action_change:
1111 wl_touch_send_motion(
1112 resource,
1113 mir_input_event_get_event_time(input_ev) / 1000,
1114 touch_id,
1115 wl_fixed_from_double(x),
1116 wl_fixed_from_double(y));
1117 break;
1118 case mir_touch_actions:
1119 /*
1120 * We should never receive an event with this action set;
1121 * the only way would be if a *new* action has been added
1122 * to the enum, and this hasn't been updated.
1123 *
1124 * There's nothing to do here, but don't use default: so
1125 * that the compiler will warn if a new enum value is added.
1126 */
1127 break;
1128 }
1129 }
1130
1131 if (mir_touch_event_point_count(touch_ev) > 0)
1132 {
1133 /*
1134 * This is mostly paranoia; I assume we won't actually be called
1135 * with an empty touch event.
1136 *
1137 * Regardless, the Wayland protocol requires that there be at least
1138 * one event sent before we send the ending frame, so make that explicit.
1139 */
1140 wl_touch_send_frame(resource);
1141 }
1142 }
1143 ));
1070 }1144 }
10711145
1072 // Touch interface1146 // Touch interface
@@ -1189,7 +1263,8 @@
1189 wl_seat_send_capabilities(1263 wl_seat_send_capabilities(
1190 resource,1264 resource,
1191 WL_SEAT_CAPABILITY_POINTER |1265 WL_SEAT_CAPABILITY_POINTER |
1192 WL_SEAT_CAPABILITY_KEYBOARD);1266 WL_SEAT_CAPABILITY_KEYBOARD |
1267 WL_SEAT_CAPABILITY_TOUCH);
1193 wl_seat_send_name(1268 wl_seat_send_name(
1194 resource,1269 resource,
1195 "seat0");1270 "seat0");

Subscribers

People subscribed via source and target branches