Mir

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

Proposed by Brandon Schaefer
Status: Superseded
Proposed branch: lp:~brandontschaefer/mir/set-device-states-vs-add
Merge into: lp:mir
Prerequisite: lp:~brandontschaefer/mir/deprecate-input-device-api
Diff against target: 198 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
Kevin DuBois (community) Approve
Mir CI Bot continuous-integration Needs Fixing
Andreas Pokorny (community) Approve
Review via email: mp+306548@code.launchpad.net

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

This proposal has been superseded by a proposal from 2016-10-12.

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 :

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 :

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 :

ok

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

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 :

lgtm

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

The prerequisite chain is potentially contentious still.

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

Subscribers

People subscribed via source and target branches