Mir

Merge lp:~brandontschaefer/mir/set-device-states-vs-add into lp:mir

Proposed by Brandon Schaefer
Status: Merged
Approved by: Cemil Azizoglu
Approved revision: no longer in the source branch.
Merged at revision: 3764
Proposed branch: lp:~brandontschaefer/mir/set-device-states-vs-add
Merge into: lp:mir
Diff against target: 197 lines (+54/-26)
6 files modified
include/client/mir/events/event_builders.h (+1/-7)
include/common/mir/events/input_device_state.h (+41/-0)
src/client/events/event_builders.cpp (+1/-2)
src/common/events/input_device_state_event.cpp (+7/-5)
src/common/symbols.map (+1/-1)
src/include/common/mir/events/input_device_state_event.h (+3/-11)
To merge this branch: bzr merge lp:~brandontschaefer/mir/set-device-states-vs-add
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Cemil Azizoglu (community) Approve
Alan Griffiths Approve
Andreas Pokorny Pending
Kevin DuBois Pending
Review via email: mp+308206@code.launchpad.net

This proposal supersedes a proposal from 2016-09-22.

Commit message

Move the InputDeviceState into a shared region we can then use for both event_builder and the class InputDevice.

This is needed for capnproto changes due to capnproto needing to know the full size of the number of InputDeviceStates so adding one at a time doesnt work.

Description of the change

Move the InputDeviceState into a shared region we can then use for both event_builder and the class InputDevice.

This is needed for capnproto changes due to capnproto needing to know the full size of the number of InputDeviceStates so adding one at a time doesnt work.

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:3716
https://mir-jenkins.ubuntu.com/job/mir-ci/1793/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2243
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2306
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2297
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2297
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2297
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2271
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2271/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2271
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2271/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2271
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2271/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2271
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2271/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2271
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2271/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

this needs the mircommon7 MP as prereq..

other than that - I am ok with the change

review: Needs Resubmitting
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

ok

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:3717
https://mir-jenkins.ubuntu.com/job/mir-ci/1805/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/2255/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2318
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2309
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2309
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2309
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2283
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2283/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2283
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2283/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2283
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2283/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2283
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2283/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2283/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote : Posted in a previous version of this proposal

lgtm

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

The prerequisite chain is potentially contentious still.

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

PASSED: Continuous integration, rev:3717
https://mir-jenkins.ubuntu.com/job/mir-ci/1945/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2478
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2541
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2533
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2533
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2533
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2507
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2507/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2507
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2507/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2507
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2507/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/2507
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/2507/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2507
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2507/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2507
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2507/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

OK

review: Approve
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

LGTM

review: Approve
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
1=== modified file 'include/client/mir/events/event_builders.h'
2--- include/client/mir/events/event_builders.h 2016-10-11 12:04:23 +0000
3+++ include/client/mir/events/event_builders.h 2016-10-12 00:32:11 +0000
4@@ -26,6 +26,7 @@
5 #include "mir/geometry/rectangle.h"
6 #include "mir/geometry/displacement.h"
7 #include "mir/frontend/surface_id.h"
8+#include "mir/events/input_device_state.h"
9 #include "mir/events/contact_state.h"
10
11 #include <memory>
12@@ -142,13 +143,6 @@
13 EventUPtr make_event(MirInputConfigurationAction action,
14 MirInputDeviceId id, std::chrono::nanoseconds time);
15
16-struct InputDeviceState
17-{
18- MirInputDeviceId id;
19- std::vector<uint32_t> pressed_keys;
20- MirPointerButtons buttons;
21-};
22-
23 EventUPtr make_event(std::chrono::nanoseconds timestamp,
24 MirPointerButtons pointer_buttons,
25 MirInputEventModifiers modifiers,
26
27=== added file 'include/common/mir/events/input_device_state.h'
28--- include/common/mir/events/input_device_state.h 1970-01-01 00:00:00 +0000
29+++ include/common/mir/events/input_device_state.h 2016-10-12 00:32:11 +0000
30@@ -0,0 +1,41 @@
31+/*
32+ * Copyright © 2016 Canonical Ltd.
33+ *
34+ * This program is free software: you can redistribute it and/or modify it
35+ * under the terms of the GNU Lesser General Public License version 3,
36+ * as published by the Free Software Foundation.
37+ *
38+ * This program is distributed in the hope that it will be useful,
39+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
40+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41+ * GNU Lesser General Public License for more details.
42+ *
43+ * You should have received a copy of the GNU Lesser General Public License
44+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
45+ *
46+ * Author: Andreas Pokorny <andreas.pokorny@canonical.com>
47+ */
48+
49+#ifndef MIR_INPUT_DEVICE_STATE_H_
50+#define MIR_INPUT_DEVICE_STATE_H_
51+
52+#include "mir_toolkit/event.h"
53+
54+#include <vector>
55+
56+namespace mir
57+{
58+namespace events
59+{
60+
61+struct InputDeviceState
62+{
63+ MirInputDeviceId id;
64+ std::vector<uint32_t> pressed_keys;
65+ MirPointerButtons buttons;
66+};
67+
68+}
69+}
70+
71+#endif // MIR_INPUT_DEVICE_STATE_H_
72
73=== modified file 'src/client/events/event_builders.cpp'
74--- src/client/events/event_builders.cpp 2016-10-11 12:04:23 +0000
75+++ src/client/events/event_builders.cpp 2016-10-12 00:32:11 +0000
76@@ -453,8 +453,7 @@
77 e->set_pointer_buttons(pointer_buttons);
78 e->set_pointer_axis(mir_pointer_axis_x, x_axis_value);
79 e->set_pointer_axis(mir_pointer_axis_y, y_axis_value);
80- for (auto& dev : device_states)
81- e->add_device(dev.id, std::move(dev.pressed_keys), dev.buttons);
82+ e->set_device_states(device_states);
83
84 return make_uptr_event(e);
85 }
86
87=== modified file 'src/common/events/input_device_state_event.cpp'
88--- src/common/events/input_device_state_event.cpp 2016-10-07 21:05:19 +0000
89+++ src/common/events/input_device_state_event.cpp 2016-10-12 00:32:11 +0000
90@@ -83,9 +83,9 @@
91 modifiers_ = modifiers;
92 }
93
94-void MirInputDeviceStateEvent::add_device(MirInputDeviceId id, std::vector<uint32_t> && pressed_keys, MirPointerButtons pointer_buttons)
95+void MirInputDeviceStateEvent::set_device_states(std::vector<mir::events::InputDeviceState> const& device_states)
96 {
97- devices.emplace_back(id, std::move(pressed_keys), pointer_buttons);
98+ devices = device_states;
99 }
100
101 uint32_t MirInputDeviceStateEvent::device_count() const
102@@ -110,7 +110,7 @@
103
104 MirPointerButtons MirInputDeviceStateEvent::device_pointer_buttons(size_t index) const
105 {
106- return devices[index].pointer_buttons;
107+ return devices[index].buttons;
108 }
109
110 namespace
111@@ -159,6 +159,7 @@
112 new_event->set_pointer_axis(mir_pointer_axis_x, pointer_x);
113 new_event->set_pointer_axis(mir_pointer_axis_y, pointer_y);
114
115+ std::vector<mir::events::InputDeviceState> states;
116 for (size_t i = 0; i != count; ++i)
117 {
118 uint32_t pressed_count = 0;
119@@ -172,8 +173,9 @@
120 for (size_t j = 0;j != pressed_count; ++j)
121 pos = mir::event::consume(pos, pressed_keys[j]);
122
123- new_event->add_device(id, std::move(pressed_keys), pointer_buttons);
124+ states.push_back({id, std::move(pressed_keys), pointer_buttons});
125 }
126+ new_event->set_device_states(states);
127
128 return mir::EventUPtr(new_event, delete_input_device_state_event);
129 }
130@@ -206,7 +208,7 @@
131 for (auto const& dev : input_state->devices)
132 {
133 encode(encoded, dev.id);
134- encode(encoded, dev.pointer_buttons);
135+ encode(encoded, dev.buttons);
136 encode(encoded, uint32_t(dev.pressed_keys.size()));
137 for (auto const& key : dev.pressed_keys)
138 encode(encoded, key);
139
140=== modified file 'src/common/symbols.map'
141--- src/common/symbols.map 2016-10-11 18:10:32 +0000
142+++ src/common/symbols.map 2016-10-12 00:32:11 +0000
143@@ -357,7 +357,6 @@
144 android::InputPublisher::publishEventBuffer*;
145 MirEvent::to_input_device_state*;
146 MirInputDeviceStateEvent::MirInputDeviceStateEvent*;
147- MirInputDeviceStateEvent::add_device*;
148 MirInputDeviceStateEvent::clone*;
149 MirInputDeviceStateEvent::deserialize*;
150 MirInputDeviceStateEvent::device_count*;
151@@ -402,6 +401,7 @@
152 MirSurfacePlacementEvent::placement*;
153 MirSurfacePlacementEvent::set_placement*;
154 MirInputDeviceStateEvent::device_pressed_keys_for_index*;
155+ MirInputDeviceStateEvent::set_device_states*;
156 mir::output_type_name*;
157 MirSurfaceOutputEvent::refresh_rate*;
158 MirSurfaceOutputEvent::set_refresh_rate*;
159
160=== modified file 'src/include/common/mir/events/input_device_state_event.h'
161--- src/include/common/mir/events/input_device_state_event.h 2016-10-07 21:05:19 +0000
162+++ src/include/common/mir/events/input_device_state_event.h 2016-10-12 00:32:11 +0000
163@@ -23,6 +23,7 @@
164 #include <limits>
165
166 #include "mir/events/event.h"
167+#include "mir/events/input_device_state_event.h"
168
169 struct MirInputDeviceStateEvent : MirEvent
170 {
171@@ -51,7 +52,7 @@
172 static std::string serialize(MirEvent const* event);
173 MirEvent* clone() const;
174
175- void add_device(MirInputDeviceId id, std::vector<uint32_t> && pressed_keys, MirPointerButtons pointer_buttons);
176+ void set_device_states(std::vector<mir::events::InputDeviceState> const& device_states);
177
178 private:
179 std::chrono::nanoseconds when_{0};
180@@ -61,16 +62,7 @@
181 float pointer_x{0.0f};
182 float pointer_y{0.0f};
183
184- struct DeviceState
185- {
186- DeviceState(MirInputDeviceId id, std::vector<uint32_t> && pressed_keys, MirPointerButtons buttons)
187- : id{id}, pressed_keys{std::move(pressed_keys)}, pointer_buttons{buttons}
188- {}
189- MirInputDeviceId id;
190- std::vector<uint32_t> pressed_keys;
191- MirPointerButtons pointer_buttons;
192- };
193- std::vector<DeviceState> devices;
194+ std::vector<mir::events::InputDeviceState> devices;
195 };
196
197 #endif /* MIR_COMMON_INPUT_DEVICE_STATE_EVENT_H_*/

Subscribers

People subscribed via source and target branches