Merge lp:~brandontschaefer/mir/mir-event-capnproto into lp:mir
- mir-event-capnproto
- Merge into development-branch
Status: | Superseded |
---|---|
Proposed branch: | lp:~brandontschaefer/mir/mir-event-capnproto |
Merge into: | lp:mir |
Prerequisite: | lp:~brandontschaefer/mir/deprecate-input-device-api |
Diff against target: |
4005 lines (+1089/-966) 58 files modified
CMakeLists.txt (+2/-1) debian/control (+2/-0) include/client/mir/events/event_builders.h (+1/-7) include/client/mir_toolkit/events/input_device_state_event.h (+12/-0) include/common/mir/events/input_device_state.h (+41/-0) src/CMakeLists.txt (+1/-0) src/capnproto/CMakeLists.txt (+29/-0) src/capnproto/mir_event.capnp (+237/-0) src/client/event.cpp (+187/-44) src/client/events/event_builders.cpp (+8/-33) src/client/input/input_event.cpp (+118/-30) src/client/mir_cookie.cpp (+10/-9) src/client/mir_cookie.h (+6/-4) src/client/mir_surface.cpp (+1/-1) src/client/symbols.map (+1/-0) src/common/CMakeLists.txt (+3/-1) src/common/events/CMakeLists.txt (+3/-0) src/common/events/close_surface_event.cpp (+4/-4) src/common/events/event.cpp (+63/-111) src/common/events/input_configuration_event.cpp (+8/-8) src/common/events/input_device_state_event.cpp (+30/-127) src/common/events/input_event.cpp (+0/-5) src/common/events/keyboard_event.cpp (+31/-26) src/common/events/keymap_event.cpp (+11/-113) src/common/events/motion_event.cpp (+93/-108) src/common/events/orientation_event.cpp (+6/-6) src/common/events/prompt_session_event.cpp (+4/-4) src/common/events/resize_event.cpp (+8/-8) src/common/events/surface_event.cpp (+8/-8) src/common/events/surface_output_event.cpp (+12/-12) src/common/events/surface_placement_event.cpp (+11/-6) src/common/symbols.map (+6/-4) src/include/common/mir/events/close_surface_event.h (+0/-3) src/include/common/mir/events/event.h (+8/-62) src/include/common/mir/events/input_configuration_event.h (+0/-6) src/include/common/mir/events/input_device_state_event.h (+3/-25) src/include/common/mir/events/input_event.h (+0/-1) src/include/common/mir/events/keyboard_event.h (+3/-15) src/include/common/mir/events/keymap_event.h (+0/-18) src/include/common/mir/events/motion_event.h (+4/-40) src/include/common/mir/events/orientation_event.h (+0/-4) src/include/common/mir/events/prompt_session_event.h (+0/-3) src/include/common/mir/events/resize_event.h (+0/-5) src/include/common/mir/events/surface_event.h (+0/-5) src/include/common/mir/events/surface_output_event.h (+0/-8) src/include/common/mir/events/surface_placement_event.h (+0/-4) src/server/graphics/nested/input_platform.cpp (+1/-1) src/server/input/android/input_sender.cpp (+24/-5) src/server/input/default_event_builder.cpp (+1/-3) src/server/input/key_repeat_dispatcher.cpp (+1/-3) src/server/input/validator.cpp (+3/-4) tests/acceptance-tests/test_client_input.cpp (+2/-1) tests/unit-tests/client/input/test_android_input_receiver.cpp (+1/-1) tests/unit-tests/input/test_surface_input_dispatcher.cpp (+1/-1) tests/unit-tests/input/test_validator.cpp (+34/-34) tests/unit-tests/scene/test_application_session.cpp (+39/-25) tests/unit-tests/scene/test_surface.cpp (+2/-2) tests/unit-tests/scene/test_surface_impl.cpp (+5/-7) |
To merge this branch: | bzr merge lp:~brandontschaefer/mir/mir-event-capnproto |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Daniel van Vugt | Pending | ||
Chris Halse Rogers | Pending | ||
Cemil Azizoglu | Pending | ||
Andreas Pokorny | Pending | ||
Alan Griffiths | Pending | ||
Review via email: mp+306535@code.launchpad.net |
This proposal supersedes a proposal from 2016-09-19.
This proposal has been superseded by a proposal from 2016-09-22.
Commit message
Switch to using capnproto for the MirEvents. Long term will be making a capnptoro input sender/recevier using the capnproto serialization.
Description of the change
Moves to support capnproto as how MirEvents are handled under the hood.
The main idea of capnproto is a union for a pool of memory. You can only ever deep copy the arena pool of memory. Otherwise you've to re-init and change the values.
The asReader() (ie. Reader) class is the ReadOnly class for the structure. Its the only way to get const functions. Otherwise they will be non-const functions.
ie.
event.asReader(
event.getXXX() == Returns modifiable structures
There is a current hack in place to keep a pointers lifetime for as long as the event. This should be removed once we can remove this from the public API: mir_input_
Anpok mentions its not actually used yet? It would just be an API break but if no one uses it *shouldnt* be an issue to remove but I have a workaround atm.
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3415
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Cemil Azizoglu (cemil-azizoglu) wrote : Posted in a previous version of this proposal | # |
Need to do more thorough review... For now :
s/MotionEventSe
279 + motionSet @1 :MotionEventSet;
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
+ BOOST_THROW_
The message won't be helpful - what was the "Unknown type"? And who is "major error"?
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
@Cemil
Yeah sounds better
@Alan
It was one of those errors... that shouldnt ever happen. I suppose it should just say Unknown event type, and thats about all
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
Also, please feel free to suggest any names anywhere. This would be a good time to change names of things!
I've changed:
MotionEvent --> MotionSetEvet
MotionPointer --> Motion
pointer_coord --> motions
pointer_count --> count
Soo any more are welcome!
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3416
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
I'm still looking at the same line of code!
+ BOOST_THROW_
Now this is in MirEvent::type() - and that is called from mir_event_
We all know that we must not propagate exceptions though C code.
So, something is wrong here. Actually, probably multiple things:
1. mir_event_
2. The error should be fatal, not reported by an exception
I've not checked the other exceptions, but suspect this isn't an isolated case.
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
It makes no sense to change the names of structures that mismatch our needs.
I mean Motion is abused for pointer and touch screen events.. So actually Motion is a bunch of TouchContacts with contact id, x, y, action, major minor orientation and pressure and a contact type (and as far as I can tell you wont need a size here .. ) . There should be no source id - just device id. The source id information is exposed via the input device api. Also you then need a Pointer event with x, y, dx, dy, hscroll_ticks and vscroll_ticks.. (and later double scroll values for better touchpad scrolling)
How hard would it be to fix the code generator of capnproto to accept and emit mir style code?
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
@Alan
Yeah I missed all those this branch... I had them for the last branch.
Ill print a message then abort there, vs throwing.
@Andreas
Sadly: https:/
I just couldnt think of a better name really :(. So you're proposing we split this *Motion* structure into two structures 1 for touch the other for pointer? Or just keep what we have now rename, and include only contact id, x, y, action, major, minor, orientation, pressure, contact type, dx, dy, hscroll/vscroll?
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
I assumed you intend to fix the MirEvent structures in a later mp - and this is just another one on one mapping MP of what we had, with no intention to consolidate it. So I expected another MP changing the types to match what we actually try to represent with the event API. To finally get rid of all the mapping code for input events.
But If this is meant to reflect the intended end state then this is a needs fixing..
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
This is indeed how i saw the end state of the event API mainly because its how its currently reflected.
If we want to change how it looks... then lets, Im just not 100% sure how your view of the end state is :).
Sooo we can try to do a hangout and talk about what is here vs what we should look like!
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
I think we do not need the InputConfigurat
Things I changed:
- dumped all pointer related elements from Contact
- moved Action into Contact (yay finally no more need to duplicate touch events)
- dumped size which is directly derived from major/minor
- added input event that holds the input event properties
- added a real pointer event with all the axis we expose and the ones we should be able expose soon..
If one cannot have regular properties and an unnamed union inside the same structure, one could use an intermediate structure inside InputEvent that then containd the union of input events.
+struct NanoSeconds
+{
+ count @0 :Int64;
+}
+
+struct InputDeviceId
+{
+ id @0 :UInt64;
+}
+
+struct KeyboardEvent
+{
+ action @0 :Action;
+ keyCode @1 :Int32;
+ scanCode @2 :Int32;
+
+ enum Action
+ {
+ up @0;
+ down @1;
+ repeat @2;
+ }
+}
+
+struct TouchEvent
+{
+ struct Contact
+ {
+ id @0 :Int32;
+ action @1: Action;
+ x @2 :Float32;
+ y @3 :Float32;
+ majorAxis @4 :Float32;
+ minorAxis @5 :Float32;
+ pressure @6 :Float32;
+ orientation @7 :Float32; // not yet exposed
+ toolType @8 :ToolType;
+
+ enum ToolType
+ {
+ unknown @0;
+ finger @1;
+ stylus @2;
+ }
+ enum Action
+ {
+ up @0;
+ down @1;
+ change @2;
+ }
+ }
+
+ deviceId @0 :InputDeviceId;
+ modifiers @1 :UInt32;
+ eventTime @2 :NanoSeconds;
+ cookie @3 :Data;
+
+ count @4 :UInt32;
+ contacts @5 :List(Contact);
+ const maxCount :UInt32 = 16; // do we need that?
+}
+
+struct PointerEvent
+{
+ action @0 :Action;
+ x @1 :Float32;
+ y @2 :Float32;
+ dx @3 :Float32;
+ dy @4 :Float32;
+ hscrollTicks @5 :Float32;
+ vscrollTicks @6 :Float32;
+ hscrollMotion @7 :Float32; // not yet exposed
+ vscrollMotion @8 :Float32; // not yet exposed
+ enum Action
+ {
+ up @0;
+ down @1;
+ enter @2;
+ leave @3;
+ motion @4;
+ };
+}
+
+struct InputEvent
+{
+ deviceId @0 :InputDeviceId;
+ modifiers @1 :UInt32;
+ eventTime @2 :NanoSeconds;
+ cookie @3 :Data;
+ union
+ {
+ keyboard @0 :KeyboardEvent;
+ touch @1 :TouchEvent;
+ pointer @2 :PointerEvent;
+ }
}
+
+ ... snip ...
+
+struct Event
+{
+ union
+ {
+ input @0 :InputEvent;
+ surface @1 :SurfaceEvent;
+ resize @2 :ResizeEvent;
.... snip ...
+ }
+}
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
@Andreas
I like those changes, and I can make a new branch after this one to add that in. Main reason not to in this branch, is i can see that adding +/- 1k lines.
Soo yes now this branch is not the final form :)
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3417
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3418
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
The numbers are erratic, but it looks like this new code is slower than Protobuf under stress. Is that expected?...
$ mirping -f
(this branch)
Round-trip time: 0.044031 milliseconds
Round-trip time: 0.044160 milliseconds
Round-trip time: 0.044155 milliseconds
Round-trip time: 0.044229 milliseconds
Round-trip time: 0.044130 milliseconds
Round-trip time: 0.044168 milliseconds
(lp:mir)
Round-trip time: 0.038198 milliseconds
Round-trip time: 0.038178 milliseconds
Round-trip time: 0.037950 milliseconds
Round-trip time: 0.038150 milliseconds
Round-trip time: 0.037935 milliseconds
Round-trip time: 0.038156 milliseconds
Round-trip time: 0.038351 milliseconds
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
+} catch (...)
+{
+ abort();
}
Is this the intended end state? It might assist users encountering this if we at least output the string from the exception before aborting.
Also, the figures Daniel provides are concerning. I thought one motivation for Capnproto was performance.
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
@Duflu
Hmm this ... doesnt replace any protobuf stuff? The only bits that touch protobuf are:
std::string MirEvent:
and
mir::EventUPtr MirEvent:
Which are only used for Surface events. Thats all we touch with protobuf, from there its just replacing android directly blitting over an FD (hard to be as fast as that). Though we copy them back into android events for now.
The solution for the serialize/
@Alan
Yeah i can print out the error message to the log!
The number one reason (as far as I know) for capnproto was to get a actual serialization into events to handle keymap/cookies better. Also its a first implementation, I could have caused some slow downs in those two functions. From my testing at lease we are faster with capnproto (when we replace the actual sender/receiver)
The other issue is we have to copy from capnproto --> android event --> fd (client) --> capnproto again. So yes, this is going to be slower on that front until we merge the sender/receiver code for capnproto. Which is done but needs to be tested a bit more. Mainly in the re-sampling areas.
You can test this branch out which has the capnproto input platform:
https:/
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
Also you'll notice that that branch will still be the same for RPC. The overall issue is having to use capnproto to produce *serialized* bytes to send of protobuf, when protobuf should really be handling that for us... So yes the side effect for right now is a slower RPC when it comes to surface events, but the reason capnproto is slower here is because we are slightly abusing it to get it to work
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
OK. It isn't really a blocking issue yet. Just keep 'mirping -f' in mind because in the long run if performance is still worse then we need to reassess this approach.
Even a few years ago it was apparent that the Mir protocol created a performance handicap compared to Wayland. So making it even slower again would be a red flag.
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
I'd be happier if we addressed two concerns before releasing this:
1. the performance issue
2. eating potentially useful error information
But I'm willing to let this land provided solutions to the above to follow shortly.
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
Opps forgot to push #2!
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3419
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3419
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3420
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3421
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Chris Halse Rogers (raof) wrote : Posted in a previous version of this proposal | # |
1384 + for (auto const& c : flat_event.
1385 + {
1386 + output += c;
1387 + }
Is it really necessary to do this a character at a time? You'll almost certainly be incurring a couple of unnecessary memory allocations here.
1415 + case mir::capnp:
1416 + return mir_event_
1417 + }
1418 +
1419 + mir::log_
1420 + abort();
Wouldn't the idiomatic thing here be to have a default: stanza in the switch()?
Otherwise, seems pretty sensible (modulo already requested follow-up work)
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
yeah those could be simple std::string(
I am looking forward to the upcoming MPs
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
Fixed.
I look forward to that branch as well :).
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3422
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3422
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
Yay cant reproduce that test issue ... seems to happen on xenial and vivid overlay....
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3423
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3423
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3427
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3429
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3430
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3431
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3431
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
Well same test failure, same issue not being able to reproduce ... yay again (ill dig into it some more i guess). Though im starting to wonder if the test it self needs a rework...
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
The issue is us taking about ~1ms per event longer then before. This is slightly expected until we move to our mir input sender/receiver vs androids.
As with this current branch we move everything to a capnproto memory pool. Then we copy back into the android layer to send across the input FD.
Once we move to a mir input sender/receiver we will serialize our with that memory pool vs having to copy into android. This will cut down an entire extra copy (i would bet ~1ms worth).
Not sure what the best way to go about that for this?
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
(1) Performance regression: mirping -f is still showing this is 20% slower than trunk under flooding, and regular mirping is 10% slower here. So that's a performance regression still. It doesn't sound like you're completely sure about the cause of the regression either. So needs fixing or information: Probably some real time profiling with Google Profiler to see where the new code is slowing down.
Should mirping even be affected by this branch? That's not even using events really, just normal IPC, which makes me think we might not even have a good performance measure for this work yet. Other than #2...
(2) Test failure: The test failure is logged as bug 1570698 already. Although that hasn't happened in the wild for 2.5 months now. It's definitely much worse in this branch, and the only theoretical reason I can find for the failure is if the event delivery is significantly slower(!) than before. This sounds counter-intuitive but getting too many resampled events simply means they are being generated so slow that they're not getting batched/resampled as they should.
I just figured out we're not synthesizing events with robust fake timestamps, which would help that test case a lot. It's presently using real time (and the wrong clock!) so I'll fix that separately and let's see if it helps you here. If it does then great! Otherwise more performance improvements are required in this branch.
In summary, Needs Information: We're not yet sure how to measure the event performance difference but it looks like a regression so far.
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
I doubt a copy of a mir event is 1ms .. 1ms is a lot larger than the time a mirserver needs to forward user input. I.e 0.4 to 0.6 ms is what I once measured on nexus4 : reading user input processing it in the server and dispatching to the session compositor or a simple client.
How do you test the difference?
I just tried mirping -f in a release build the turnaround time was about 0.011ms slower with the captn proto serialization on top of the existing code.. The regular turnaround time was at 0.042ms
I am considering rebasing my MirInputEvent cleanup branches ontop of this MP - to avoid the conflicts..
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
1)
The mirping, which you mentioned before is a surface event. Theres nothing we can do about that since we have to go through protobuf for that. There is going to be an extra copy. The mir ping is using the RPC for copying a *surface* event from server --> client. The issue is need to produce a flat array to then memcpy. Hence an extra copy, not really sure *why* we are memcpy'ing surface events to begin with when theres protobuf.
While I may be regressing in that, I think the solution is to just move surface events to actually use protobuf. Though in the long run once we replace protobuf with capnproto in the rpc layer there will be no increase.
2)
Yes there will be an extra copy in the server --> android layer since we have to go from a capnproto event memory pool to the android event. Using trunk mir to test number of input events received:
https:/
150 ^ (actually failed on trunk mir)
You can see how close this test is to failing on trunk mir. It even fails for one of the branch. I do know my branch will add an extra copy until we move to our own input sender/receiver.
When using my laptop to test this branch vs trunk. I get 96 for both. 0% different. So yes, CI does actually see the slow down but its still a small difference.
I also think the test is more or less testing the current setup, why does it have an nframes of error anyway? Shouldnt it always be 100 (based on the test name)? Then it comes down to timing... which is prone to error and fickle testing (imo).
So we can either, increase the nframes error number to 75 or wait for my second branch which will replace the android input sender/receiver (which again will have some issues that will need fixing with the interpolation/
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
I need to profile :) seems like we were already doing an extra copy into the android layer anyway
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
Well the extra conversion in the memcpy-able android events happens in both cases in a similar way. I was more concerned about the differences in make_event and accessing the different event properties.
So in a release build with -g and lttng function instrumentation (leaving out the generated code and code inside /usr/include) and testing with a single server and a single client, the runtime spent inside the accessors are within the margin of error identical. The make_event call for a pointer event is slightly slower 35 instead of 23 microseconds.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
No, please don't break the test or bother to propose further changes on top of this (it's too big to be a foundation right now).
I will look at implementing reliable fake timing for that test this week. You might have noticed bug 1570698 is in progress...
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:3432
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Obviously disabling tests that fail is not a solution:
3751 -TEST_F(
3752 +// Enable once lp:1570698 is fixed
3753 +TEST_F(
I will soon work to make that test a bit more sane which may or may not help you here. Either way, needs fixing to un-disable that important test.
Kevin DuBois (kdub) wrote : Posted in a previous version of this proposal | # |
Yeah, if an already broken test is aggravated by new code, seems the right way to go is to fix the test, then land the new code.
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
This test tests:
receives_
Right now this test adds 50 event +/- error margin because some computers are faster/slower. This code introduces slower event handling until we move the a capnproto input sender/receiver. Note that this slow down is small and only noticeable on CI.
https:/
This test fails on trunk mir:
https:/
150 ^ (actually failed on trunk mir)
So you dont want me increase the error margin to incorporate the slower event handling. (slower by a small amount). From here im blocked on waiting for your changes to *hopefully* fix this for me?
I can WIP this again from the same test, but im most likely not going to return to this branch after being blocked by this again
Kevin DuBois (kdub) wrote : Posted in a previous version of this proposal | # |
From chatting on irc, it seems that we're aware of a slowdown in copying events from capnproto (and there are future improvements that will eliminate the slowdown). So the real question with this test seems to be are we happy with the slowdown? If yes (and that seems to be the answer, given that we want capnproto events), then it seems better to increase the limit in the test a bit than disable it (and we can decrease it back down once we don't copy things to android events.
Brandon Schaefer (brandontschaefer) wrote : | # |
New parent to remove some extra stuff + pretty bad hack.
Looking at a new way to construct mir events (thanks to anpok) which has sped up the creation of events from 23 microseconds (trunk) vs 7.9 (his branch)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3433
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3435
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2016-09-08 16:52:49 +0000 |
3 | +++ CMakeLists.txt 2016-09-22 20:34:39 +0000 |
4 | @@ -196,6 +196,7 @@ |
5 | find_package(GLESv2 REQUIRED) |
6 | find_package(GLM REQUIRED) |
7 | find_package(Protobuf REQUIRED ) |
8 | +find_package(CapnProto REQUIRED) |
9 | find_package(GLog REQUIRED) |
10 | find_package(GFlags REQUIRED) |
11 | find_package(LTTngUST REQUIRED) |
12 | @@ -293,7 +294,7 @@ |
13 | |
14 | # There's no nice way to format this. Thanks CMake. |
15 | mir_add_test(NAME LGPL-required |
16 | - COMMAND /bin/sh -c "! grep -rl 'GNU General' ${PROJECT_SOURCE_DIR}/src/client ${PROJECT_SOURCE_DIR}/include/client ${PROJECT_SOURCE_DIR}/src/common ${PROJECT_SOURCE_DIR}/include/common ${PROJECT_SOURCE_DIR}/src/include/common ${PROJECT_SOURCE_DIR}/src/platform ${PROJECT_SOURCE_DIR}/include/platform ${PROJECT_SOURCE_DIR}/src/include/platform" |
17 | + COMMAND /bin/sh -c "! grep -rl 'GNU General' ${PROJECT_SOURCE_DIR}/src/client ${PROJECT_SOURCE_DIR}/include/client ${PROJECT_SOURCE_DIR}/src/common ${PROJECT_SOURCE_DIR}/include/common ${PROJECT_SOURCE_DIR}/src/include/common ${PROJECT_SOURCE_DIR}/src/platform ${PROJECT_SOURCE_DIR}/include/platform ${PROJECT_SOURCE_DIR}/src/include/platform ${PROJECT_SOURCE_DIR}/src/capnproto" |
18 | ) |
19 | mir_add_test(NAME GPL-required |
20 | COMMAND /bin/sh -c "! grep -rl 'GNU Lesser' ${PROJECT_SOURCE_DIR}/src/server ${PROJECT_SOURCE_DIR}/include/server ${PROJECT_SOURCE_DIR}/src/include/server ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/examples" |
21 | |
22 | === modified file 'debian/control' |
23 | --- debian/control 2016-09-12 11:49:12 +0000 |
24 | +++ debian/control 2016-09-22 20:34:39 +0000 |
25 | @@ -46,6 +46,8 @@ |
26 | python3:any, |
27 | dh-python, |
28 | nettle-dev, |
29 | + libcapnp-dev, |
30 | + capnproto, |
31 | libepoxy-dev, |
32 | Standards-Version: 3.9.4 |
33 | Homepage: https://launchpad.net/mir |
34 | |
35 | === modified file 'include/client/mir/events/event_builders.h' |
36 | --- include/client/mir/events/event_builders.h 2016-09-19 04:16:15 +0000 |
37 | +++ include/client/mir/events/event_builders.h 2016-09-22 20:34:39 +0000 |
38 | @@ -25,6 +25,7 @@ |
39 | #include "mir/geometry/point.h" |
40 | #include "mir/geometry/rectangle.h" |
41 | #include "mir/frontend/surface_id.h" |
42 | +#include "mir/events/input_device_state.h" |
43 | |
44 | #include <memory> |
45 | #include <functional> |
46 | @@ -138,13 +139,6 @@ |
47 | EventUPtr make_event(MirInputConfigurationAction action, |
48 | MirInputDeviceId id, std::chrono::nanoseconds time); |
49 | |
50 | -struct InputDeviceState |
51 | -{ |
52 | - MirInputDeviceId id; |
53 | - std::vector<uint32_t> pressed_keys; |
54 | - MirPointerButtons buttons; |
55 | -}; |
56 | - |
57 | EventUPtr make_event(std::chrono::nanoseconds timestamp, |
58 | MirPointerButtons pointer_buttons, |
59 | MirInputEventModifiers modifiers, |
60 | |
61 | === modified file 'include/client/mir_toolkit/events/input_device_state_event.h' |
62 | --- include/client/mir_toolkit/events/input_device_state_event.h 2016-09-22 20:34:38 +0000 |
63 | +++ include/client/mir_toolkit/events/input_device_state_event.h 2016-09-22 20:34:39 +0000 |
64 | @@ -122,6 +122,18 @@ |
65 | MirInputDeviceStateEvent const* ev, uint32_t index, uint32_t pressed_index); |
66 | |
67 | /** |
68 | + * Retrieve a pressed key on the device identified by the \a index. |
69 | + * The key is encoded as a scan code. |
70 | + * |
71 | + * \param[in] ev The input device state event |
72 | + * \param[in] index The index of the input device |
73 | + * \param[in] pressed_index The index of the pressed key |
74 | + * \return The pressed key at index pressed_index |
75 | + */ |
76 | +uint32_t mir_input_device_state_event_device_pressed_keys_for_index( |
77 | + MirInputDeviceStateEvent const* ev, uint32_t index, uint32_t pressed_index); |
78 | + |
79 | +/** |
80 | * Retrieve the size of scan code array of the device identified by the \a index. |
81 | * |
82 | * \param[in] ev The input device state event |
83 | |
84 | === added directory 'include/common/mir/events' |
85 | === added file 'include/common/mir/events/input_device_state.h' |
86 | --- include/common/mir/events/input_device_state.h 1970-01-01 00:00:00 +0000 |
87 | +++ include/common/mir/events/input_device_state.h 2016-09-22 20:34:39 +0000 |
88 | @@ -0,0 +1,41 @@ |
89 | +/* |
90 | + * Copyright © 2015 Canonical Ltd. |
91 | + * |
92 | + * This program is free software: you can redistribute it and/or modify it |
93 | + * under the terms of the GNU Lesser General Public License version 3, |
94 | + * as published by the Free Software Foundation. |
95 | + * |
96 | + * This program is distributed in the hope that it will be useful, |
97 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
98 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
99 | + * GNU Lesser General Public License for more details. |
100 | + * |
101 | + * You should have received a copy of the GNU Lesser General Public License |
102 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
103 | + * |
104 | + * Author: Brandon Schaefer <brandon.schaefer@canonical.com> |
105 | + */ |
106 | + |
107 | +#ifndef MIR_INPUT_DEVICE_STATE_H_ |
108 | +#define MIR_INPUT_DEVICE_STATE_H_ |
109 | + |
110 | +#include "mir_toolkit/event.h" |
111 | + |
112 | +#include <vector> |
113 | + |
114 | +namespace mir |
115 | +{ |
116 | +namespace events |
117 | +{ |
118 | + |
119 | +struct InputDeviceState |
120 | +{ |
121 | + MirInputDeviceId id; |
122 | + std::vector<uint32_t> pressed_keys; |
123 | + MirPointerButtons buttons; |
124 | +}; |
125 | + |
126 | +} |
127 | +} |
128 | + |
129 | +#endif // MIR_INPUT_DEVICE_STATE_H_ |
130 | |
131 | === modified file 'src/CMakeLists.txt' |
132 | --- src/CMakeLists.txt 2016-08-01 14:43:19 +0000 |
133 | +++ src/CMakeLists.txt 2016-09-22 20:34:39 +0000 |
134 | @@ -16,6 +16,7 @@ |
135 | # the src/include/... directories should be private to the implementation |
136 | include_directories(${PROJECT_SOURCE_DIR}/src/include/common) |
137 | set(MIR_GENERATED_INCLUDE_DIRECTORIES) |
138 | +add_subdirectory(capnproto/) |
139 | add_subdirectory(common/) |
140 | add_subdirectory(protobuf/) |
141 | include_directories(${MIR_GENERATED_INCLUDE_DIRECTORIES}) |
142 | |
143 | === added directory 'src/capnproto' |
144 | === added file 'src/capnproto/CMakeLists.txt' |
145 | --- src/capnproto/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
146 | +++ src/capnproto/CMakeLists.txt 2016-09-22 20:34:39 +0000 |
147 | @@ -0,0 +1,29 @@ |
148 | +# Copyright © 2016 Canonical Ltd. |
149 | +# |
150 | +# This program is free software: you can redistribute it and/or modify it |
151 | +# under the terms of the GNU Lesser General Public License version 3, |
152 | +# as published by the Free Software Foundation. |
153 | +# |
154 | +# This program is distributed in the hope that it will be useful, |
155 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
156 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
157 | +# GNU Lesser General Public License for more details. |
158 | +# |
159 | +# You should have received a copy of the GNU Lesser General Public License |
160 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
161 | +# |
162 | +# Author: Brandon Schaefer <brandon.schaefer@canonical.com> |
163 | + |
164 | +set(CAPNPC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) |
165 | + |
166 | +capnp_generate_cpp(CAPNPROTO_SRC CAPNPROTO_HDRS mir_event.capnp) |
167 | + |
168 | +add_library(mircapnproto STATIC ${CAPNPROTO_SRC}) |
169 | +target_link_libraries(mircapnproto ${CAPNP_LIBRARIES_LITE}) |
170 | + |
171 | +list(APPEND MIR_GENERATED_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}) |
172 | + |
173 | +set( |
174 | + MIR_GENERATED_INCLUDE_DIRECTORIES ${MIR_GENERATED_INCLUDE_DIRECTORIES} |
175 | + PARENT_SCOPE |
176 | +) |
177 | |
178 | === added file 'src/capnproto/mir_event.capnp' |
179 | --- src/capnproto/mir_event.capnp 1970-01-01 00:00:00 +0000 |
180 | +++ src/capnproto/mir_event.capnp 2016-09-22 20:34:39 +0000 |
181 | @@ -0,0 +1,237 @@ |
182 | +# Copyright © 2016 Canonical Ltd. |
183 | +# |
184 | +# This program is free software: you can redistribute it and/or modify it |
185 | +# under the terms of the GNU Lesser General Public License version 3, |
186 | +# as published by the Free Software Foundation. |
187 | +# |
188 | +# This program is distributed in the hope that it will be useful, |
189 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
190 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
191 | +# GNU Lesser General Public License for more details. |
192 | +# |
193 | +# You should have received a copy of the GNU Lesser General Public License |
194 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
195 | +# |
196 | +# Author: Brandon Schaefer <brandon.schaefer@canonical.com> |
197 | + |
198 | +@0x9ff9e89b8e11dc56; |
199 | + |
200 | +# Need to namespace the InputEvent/Event since the generated (Mir)Event has all its ctors deleted. |
201 | +# Which we need a C compliant struct to be generated. So namespace these, and wrap a |
202 | +# builder in a struct MirEvent {..}; |
203 | +using Cxx = import "/capnp/c++.capnp"; |
204 | +$Cxx.namespace("mir::capnp"); |
205 | + |
206 | +struct NanoSeconds |
207 | +{ |
208 | + count @0 :Int64; |
209 | +} |
210 | + |
211 | +struct InputDeviceId |
212 | +{ |
213 | + id @0 :UInt64; |
214 | +} |
215 | + |
216 | +struct Rectangle |
217 | +{ |
218 | + left @0 :Int32; |
219 | + top @1 :Int32; |
220 | + width @2 :UInt32; |
221 | + height @3 :UInt32; |
222 | +} |
223 | + |
224 | +struct KeyboardEvent |
225 | +{ |
226 | + id @0 :Int32; |
227 | + deviceId @1 :InputDeviceId; |
228 | + sourceId @2 :Int32; |
229 | + action @3 :Action; |
230 | + modifiers @4 :UInt32; |
231 | + keyCode @5 :Int32; |
232 | + scanCode @6 :Int32; |
233 | + eventTime @7 :NanoSeconds; |
234 | + cookie @8 :Data; |
235 | + |
236 | + enum Action |
237 | + { |
238 | + up @0; |
239 | + down @1; |
240 | + repeat @2; |
241 | + } |
242 | +} |
243 | + |
244 | +struct MotionSetEvent |
245 | +{ |
246 | + struct Motion |
247 | + { |
248 | + id @0 :Int32; |
249 | + x @1 :Float32; |
250 | + y @2 :Float32; |
251 | + dx @3 :Float32; |
252 | + dy @4 :Float32; |
253 | + touchMajor @5 :Float32; |
254 | + touchMinor @6 :Float32; |
255 | + size @7 :Float32; |
256 | + pressure @8 :Float32; |
257 | + orientation @9 :Float32; |
258 | + vscroll @10 :Float32; |
259 | + hscroll @11 :Float32; |
260 | + |
261 | + toolType @12 :ToolType; |
262 | + |
263 | + # TODO: We would like to store this as a TouchAction but we still encode pointer actions |
264 | + # here as well. |
265 | + action @13 :Int32; |
266 | + |
267 | + enum ToolType |
268 | + { |
269 | + unknown @0; |
270 | + finger @1; |
271 | + stylus @2; |
272 | + } |
273 | + } |
274 | + |
275 | + deviceId @0 :InputDeviceId; |
276 | + sourceId @1 :Int32; |
277 | + modifiers @2 :UInt32; |
278 | + buttons @3 :UInt32; |
279 | + eventTime @4 :NanoSeconds; |
280 | + cookie @5 :Data; |
281 | + |
282 | + count @6 :UInt32; |
283 | + motions @7 :List(Motion); |
284 | + const maxCount :UInt32 = 16; |
285 | +} |
286 | + |
287 | +struct InputConfigurationEvent |
288 | +{ |
289 | + action @0 :Action; |
290 | + when @1 :NanoSeconds; |
291 | + id @2 :InputDeviceId; |
292 | + |
293 | + enum Action |
294 | + { |
295 | + configurationChanged @0; |
296 | + deviceReset @1; |
297 | + } |
298 | +} |
299 | + |
300 | +struct SurfaceEvent |
301 | +{ |
302 | + id @0 :Int32; |
303 | + attrib @1 :Attrib; |
304 | + value @2 :Int32; |
305 | + |
306 | + enum Attrib |
307 | + { |
308 | + # Do not specify values...code relies on 0...N ordering. |
309 | + type @0; |
310 | + state @1; |
311 | + swapInterval @2; |
312 | + focus @3; |
313 | + dpi @4; |
314 | + visibility @5; |
315 | + preferredOrientation @6; |
316 | + # Must be last |
317 | + surfaceAttrib @7; |
318 | + } |
319 | +} |
320 | + |
321 | +struct ResizeEvent |
322 | +{ |
323 | + surfaceId @0 :Int32; |
324 | + width @1 :Int32; |
325 | + height @2 :Int32; |
326 | +} |
327 | + |
328 | +struct PromptSessionEvent |
329 | +{ |
330 | + newState @0 :State; |
331 | + |
332 | + enum State |
333 | + { |
334 | + stopped @0; |
335 | + started @1; |
336 | + suspended @2; |
337 | + } |
338 | +} |
339 | + |
340 | +struct OrientationEvent |
341 | +{ |
342 | + surfaceId @0 :Int32; |
343 | + direction @1 :Int32; |
344 | +} |
345 | + |
346 | +struct CloseSurfaceEvent |
347 | +{ |
348 | + surfaceId @0 :Int32; |
349 | +} |
350 | + |
351 | +struct KeymapEvent |
352 | +{ |
353 | + surfaceId @0 :Int32; |
354 | + |
355 | + deviceId @1 :InputDeviceId; |
356 | + buffer @2 :Text; |
357 | +} |
358 | + |
359 | +struct SurfaceOutputEvent |
360 | +{ |
361 | + surfaceId @0 :Int32; |
362 | + dpi @1 :Int32; |
363 | + scale @2 :Float32; |
364 | + formFactor @3 :FormFactor; |
365 | + outputId @4 :UInt32; |
366 | + |
367 | + enum FormFactor |
368 | + { |
369 | + unknown @0; |
370 | + phone @1; |
371 | + tablet @2; |
372 | + monitor @3; |
373 | + tv @4; |
374 | + projector @5; |
375 | + } |
376 | +} |
377 | + |
378 | +struct InputDeviceStateEvent |
379 | +{ |
380 | + when @0 :NanoSeconds; |
381 | + buttons @1 :UInt32; |
382 | + modifiers @2 :UInt32; |
383 | + pointerX @3 :Float32; |
384 | + pointerY @4 :Float32; |
385 | + devices @5 :List(DeviceState); |
386 | + |
387 | + struct DeviceState |
388 | + { |
389 | + deviceId @0 :InputDeviceId; |
390 | + pressedKeys @1 :List(UInt32); |
391 | + buttons @2 :UInt32; |
392 | + } |
393 | +} |
394 | + |
395 | +struct SurfacePlacementEvent |
396 | +{ |
397 | + id @0 :Int32; |
398 | + rectangle @1 :Rectangle; |
399 | +} |
400 | + |
401 | +struct Event |
402 | +{ |
403 | + union |
404 | + { |
405 | + key @0 :KeyboardEvent; |
406 | + motionSet @1 :MotionSetEvent; |
407 | + surface @2 :SurfaceEvent; |
408 | + resize @3 :ResizeEvent; |
409 | + promptSession @4 :PromptSessionEvent; |
410 | + orientation @5 :OrientationEvent; |
411 | + closeSurface @6 :CloseSurfaceEvent; |
412 | + keymap @7 :KeymapEvent; |
413 | + inputConfiguration @8 :InputConfigurationEvent; |
414 | + surfaceOutput @9 :SurfaceOutputEvent; |
415 | + inputDevice @10 :InputDeviceStateEvent; |
416 | + surfacePlacement @11 :SurfacePlacementEvent; |
417 | + } |
418 | +} |
419 | |
420 | === modified file 'src/client/event.cpp' |
421 | --- src/client/event.cpp 2016-09-22 20:34:38 +0000 |
422 | +++ src/client/event.cpp 2016-09-22 20:34:39 +0000 |
423 | @@ -40,7 +40,7 @@ |
424 | namespace |
425 | { |
426 | template <typename EventType> |
427 | -void expect_event_type(EventType const* ev, MirEventType t) |
428 | +void expect_event_type(EventType const* ev, MirEventType t) try |
429 | { |
430 | if (ev->type() != t) |
431 | { |
432 | @@ -48,6 +48,10 @@ |
433 | mir::event_type_to_string(ev->type())); |
434 | abort(); |
435 | } |
436 | +} catch (std::exception const& e) |
437 | +{ |
438 | + mir::log_critical(e.what()); |
439 | + abort(); |
440 | } |
441 | |
442 | void expect_index_in_range(size_t size, size_t index) |
443 | @@ -88,7 +92,7 @@ |
444 | } |
445 | |
446 | |
447 | -MirEventType mir_event_get_type(MirEvent const* ev) |
448 | +MirEventType mir_event_get_type(MirEvent const* ev) try |
449 | { |
450 | switch (ev->type()) |
451 | { |
452 | @@ -98,9 +102,13 @@ |
453 | default: |
454 | return ev->type(); |
455 | } |
456 | +} catch (std::exception const& e) |
457 | +{ |
458 | + mir::log_critical(e.what()); |
459 | + abort(); |
460 | } |
461 | |
462 | -MirInputEvent const* mir_event_get_input_event(MirEvent const* ev) |
463 | +MirInputEvent const* mir_event_get_input_event(MirEvent const* ev) try |
464 | { |
465 | if (ev->type() != mir_event_type_key && ev->type() != mir_event_type_motion) |
466 | { |
467 | @@ -110,215 +118,339 @@ |
468 | } |
469 | |
470 | return ev->to_input(); |
471 | +} catch (std::exception const& e) |
472 | +{ |
473 | + mir::log_critical(e.what()); |
474 | + abort(); |
475 | } |
476 | |
477 | -MirSurfaceEvent const* mir_event_get_surface_event(MirEvent const* ev) |
478 | +MirSurfaceEvent const* mir_event_get_surface_event(MirEvent const* ev) try |
479 | { |
480 | expect_event_type(ev, mir_event_type_surface); |
481 | |
482 | return ev->to_surface(); |
483 | +} catch (std::exception const& e) |
484 | +{ |
485 | + mir::log_critical(e.what()); |
486 | + abort(); |
487 | } |
488 | |
489 | -MirResizeEvent const* mir_event_get_resize_event(MirEvent const* ev) |
490 | +MirResizeEvent const* mir_event_get_resize_event(MirEvent const* ev) try |
491 | { |
492 | expect_event_type(ev, mir_event_type_resize); |
493 | |
494 | return ev->to_resize(); |
495 | +} catch (std::exception const& e) |
496 | +{ |
497 | + mir::log_critical(e.what()); |
498 | + abort(); |
499 | } |
500 | |
501 | -MirPromptSessionEvent const* mir_event_get_prompt_session_event(MirEvent const* ev) |
502 | +MirPromptSessionEvent const* mir_event_get_prompt_session_event(MirEvent const* ev) try |
503 | { |
504 | expect_event_type(ev, mir_event_type_prompt_session_state_change); |
505 | |
506 | return ev->to_prompt_session(); |
507 | +} catch (std::exception const& e) |
508 | +{ |
509 | + mir::log_critical(e.what()); |
510 | + abort(); |
511 | } |
512 | |
513 | -MirOrientationEvent const* mir_event_get_orientation_event(MirEvent const* ev) |
514 | +MirOrientationEvent const* mir_event_get_orientation_event(MirEvent const* ev) try |
515 | { |
516 | expect_event_type(ev, mir_event_type_orientation); |
517 | |
518 | return ev->to_orientation(); |
519 | +} catch (std::exception const& e) |
520 | +{ |
521 | + mir::log_critical(e.what()); |
522 | + abort(); |
523 | } |
524 | |
525 | -MirCloseSurfaceEvent const* mir_event_get_close_surface_event(MirEvent const* ev) |
526 | +MirCloseSurfaceEvent const* mir_event_get_close_surface_event(MirEvent const* ev) try |
527 | { |
528 | expect_event_type(ev, mir_event_type_close_surface); |
529 | |
530 | return ev->to_close_surface(); |
531 | +} catch (std::exception const& e) |
532 | +{ |
533 | + mir::log_critical(e.what()); |
534 | + abort(); |
535 | } |
536 | |
537 | -MirKeymapEvent const* mir_event_get_keymap_event(MirEvent const* ev) |
538 | +MirKeymapEvent const* mir_event_get_keymap_event(MirEvent const* ev) try |
539 | { |
540 | expect_event_type(ev, mir_event_type_keymap); |
541 | |
542 | return ev->to_keymap(); |
543 | +} catch (std::exception const& e) |
544 | +{ |
545 | + mir::log_critical(e.what()); |
546 | + abort(); |
547 | } |
548 | |
549 | -MirInputConfigurationEvent const* mir_event_get_input_configuration_event(MirEvent const* ev) |
550 | +MirInputConfigurationEvent const* mir_event_get_input_configuration_event(MirEvent const* ev) try |
551 | { |
552 | expect_event_type(ev, mir_event_type_input_configuration); |
553 | |
554 | return ev->to_input_configuration(); |
555 | +} catch (std::exception const& e) |
556 | +{ |
557 | + mir::log_critical(e.what()); |
558 | + abort(); |
559 | } |
560 | |
561 | -MirSurfaceOutputEvent const* mir_event_get_surface_output_event(MirEvent const* ev) |
562 | +MirSurfaceOutputEvent const* mir_event_get_surface_output_event(MirEvent const* ev) try |
563 | { |
564 | expect_event_type(ev, mir_event_type_surface_output); |
565 | |
566 | return ev->to_surface_output(); |
567 | +} catch (std::exception const& e) |
568 | +{ |
569 | + mir::log_critical(e.what()); |
570 | + abort(); |
571 | } |
572 | |
573 | -MirInputDeviceStateEvent const* mir_event_get_input_device_state_event(MirEvent const* ev) |
574 | +MirInputDeviceStateEvent const* mir_event_get_input_device_state_event(MirEvent const* ev) try |
575 | { |
576 | expect_event_type(ev, mir_event_type_input_device_state); |
577 | |
578 | return ev->to_input_device_state(); |
579 | +} catch (std::exception const& e) |
580 | +{ |
581 | + mir::log_critical(e.what()); |
582 | + abort(); |
583 | } |
584 | |
585 | /* Surface event accessors */ |
586 | |
587 | -MirSurfaceAttrib mir_surface_event_get_attribute(MirSurfaceEvent const* ev) |
588 | +MirSurfaceAttrib mir_surface_event_get_attribute(MirSurfaceEvent const* ev) try |
589 | { |
590 | expect_event_type(ev, mir_event_type_surface); |
591 | |
592 | return ev->attrib(); |
593 | +} catch (std::exception const& e) |
594 | +{ |
595 | + mir::log_critical(e.what()); |
596 | + abort(); |
597 | } |
598 | |
599 | -int mir_surface_event_get_attribute_value(MirSurfaceEvent const* ev) |
600 | +int mir_surface_event_get_attribute_value(MirSurfaceEvent const* ev) try |
601 | { |
602 | expect_event_type(ev, mir_event_type_surface); |
603 | |
604 | return ev->value(); |
605 | +} catch (std::exception const& e) |
606 | +{ |
607 | + mir::log_critical(e.what()); |
608 | + abort(); |
609 | } |
610 | |
611 | /* Resize event accessors */ |
612 | |
613 | -int mir_resize_event_get_width(MirResizeEvent const* ev) |
614 | +int mir_resize_event_get_width(MirResizeEvent const* ev) try |
615 | { |
616 | expect_event_type(ev, mir_event_type_resize); |
617 | return ev->width(); |
618 | +} catch (std::exception const& e) |
619 | +{ |
620 | + mir::log_critical(e.what()); |
621 | + abort(); |
622 | } |
623 | |
624 | -int mir_resize_event_get_height(MirResizeEvent const* ev) |
625 | +int mir_resize_event_get_height(MirResizeEvent const* ev) try |
626 | { |
627 | expect_event_type(ev, mir_event_type_resize); |
628 | return ev->height(); |
629 | +} catch (std::exception const& e) |
630 | +{ |
631 | + mir::log_critical(e.what()); |
632 | + abort(); |
633 | } |
634 | |
635 | /* Prompt session event accessors */ |
636 | |
637 | -MirPromptSessionState mir_prompt_session_event_get_state(MirPromptSessionEvent const* ev) |
638 | +MirPromptSessionState mir_prompt_session_event_get_state(MirPromptSessionEvent const* ev) try |
639 | { |
640 | expect_event_type(ev, mir_event_type_prompt_session_state_change); |
641 | return ev->new_state(); |
642 | +} catch (std::exception const& e) |
643 | +{ |
644 | + mir::log_critical(e.what()); |
645 | + abort(); |
646 | } |
647 | |
648 | /* Orientation event accessors */ |
649 | |
650 | -MirOrientation mir_orientation_event_get_direction(MirOrientationEvent const* ev) |
651 | +MirOrientation mir_orientation_event_get_direction(MirOrientationEvent const* ev) try |
652 | { |
653 | expect_event_type(ev, mir_event_type_orientation); |
654 | return ev->direction(); |
655 | +} catch (std::exception const& e) |
656 | +{ |
657 | + mir::log_critical(e.what()); |
658 | + abort(); |
659 | } |
660 | |
661 | /* Keymap event accessors */ |
662 | |
663 | -void mir_keymap_event_get_keymap_buffer(MirKeymapEvent const* ev, char const** buffer, size_t* length) |
664 | +void mir_keymap_event_get_keymap_buffer(MirKeymapEvent const* ev, char const** buffer, size_t* length) try |
665 | { |
666 | expect_event_type(ev, mir_event_type_keymap); |
667 | |
668 | *buffer = ev->buffer(); |
669 | *length = ev->size(); |
670 | +} catch (std::exception const& e) |
671 | +{ |
672 | + mir::log_critical(e.what()); |
673 | + abort(); |
674 | } |
675 | |
676 | -MirInputDeviceId mir_keymap_event_get_device_id(MirKeymapEvent const* ev) |
677 | +MirInputDeviceId mir_keymap_event_get_device_id(MirKeymapEvent const* ev) try |
678 | { |
679 | expect_event_type(ev, mir_event_type_keymap); |
680 | |
681 | return ev->device_id(); |
682 | +} catch (std::exception const& e) |
683 | +{ |
684 | + mir::log_critical(e.what()); |
685 | + abort(); |
686 | } |
687 | |
688 | /* Input configuration event accessors */ |
689 | |
690 | -MirInputConfigurationAction mir_input_configuration_event_get_action(MirInputConfigurationEvent const* ev) |
691 | +MirInputConfigurationAction mir_input_configuration_event_get_action(MirInputConfigurationEvent const* ev) try |
692 | { |
693 | expect_event_type(ev, mir_event_type_input_configuration); |
694 | return ev->action(); |
695 | +} catch (std::exception const& e) |
696 | +{ |
697 | + mir::log_critical(e.what()); |
698 | + abort(); |
699 | } |
700 | |
701 | -int64_t mir_input_configuration_event_get_time(MirInputConfigurationEvent const* ev) |
702 | +int64_t mir_input_configuration_event_get_time(MirInputConfigurationEvent const* ev) try |
703 | { |
704 | expect_event_type(ev, mir_event_type_input_configuration); |
705 | return ev->when().count(); |
706 | +} catch (std::exception const& e) |
707 | +{ |
708 | + mir::log_critical(e.what()); |
709 | + abort(); |
710 | } |
711 | |
712 | -MirInputDeviceId mir_input_configuration_event_get_device_id(MirInputConfigurationEvent const* ev) |
713 | +MirInputDeviceId mir_input_configuration_event_get_device_id(MirInputConfigurationEvent const* ev) try |
714 | { |
715 | expect_event_type(ev, mir_event_type_input_configuration); |
716 | return ev->id(); |
717 | +} catch (std::exception const& e) |
718 | +{ |
719 | + mir::log_critical(e.what()); |
720 | + abort(); |
721 | } |
722 | |
723 | /* Surface output event accessors */ |
724 | |
725 | -int mir_surface_output_event_get_dpi(MirSurfaceOutputEvent const* ev) |
726 | +int mir_surface_output_event_get_dpi(MirSurfaceOutputEvent const* ev) try |
727 | { |
728 | expect_event_type(ev, mir_event_type_surface_output); |
729 | return ev->dpi(); |
730 | +} catch (std::exception const& e) |
731 | +{ |
732 | + mir::log_critical(e.what()); |
733 | + abort(); |
734 | } |
735 | |
736 | -MirFormFactor mir_surface_output_event_get_form_factor(MirSurfaceOutputEvent const* ev) |
737 | +MirFormFactor mir_surface_output_event_get_form_factor(MirSurfaceOutputEvent const* ev) try |
738 | { |
739 | expect_event_type(ev, mir_event_type_surface_output); |
740 | return ev->form_factor(); |
741 | +} catch (std::exception const& e) |
742 | +{ |
743 | + mir::log_critical(e.what()); |
744 | + abort(); |
745 | } |
746 | |
747 | -float mir_surface_output_event_get_scale(MirSurfaceOutputEvent const* ev) |
748 | +float mir_surface_output_event_get_scale(MirSurfaceOutputEvent const* ev) try |
749 | { |
750 | expect_event_type(ev, mir_event_type_surface_output); |
751 | return ev->scale(); |
752 | +} catch (std::exception const& e) |
753 | +{ |
754 | + mir::log_critical(e.what()); |
755 | + abort(); |
756 | } |
757 | |
758 | -uint32_t mir_surface_output_event_get_output_id(MirSurfaceOutputEvent const *ev) |
759 | +uint32_t mir_surface_output_event_get_output_id(MirSurfaceOutputEvent const *ev) try |
760 | { |
761 | expect_event_type(ev, mir_event_type_surface_output); |
762 | return ev->output_id(); |
763 | +} catch (std::exception const& e) |
764 | +{ |
765 | + mir::log_critical(e.what()); |
766 | + abort(); |
767 | } |
768 | |
769 | -MirPointerButtons mir_input_device_state_event_pointer_buttons(MirInputDeviceStateEvent const* ev) |
770 | +MirPointerButtons mir_input_device_state_event_pointer_buttons(MirInputDeviceStateEvent const* ev) try |
771 | { |
772 | expect_event_type(ev, mir_event_type_input_device_state); |
773 | return ev->pointer_buttons(); |
774 | +} catch (std::exception const& e) |
775 | +{ |
776 | + mir::log_critical(e.what()); |
777 | + abort(); |
778 | } |
779 | |
780 | -float mir_input_device_state_event_pointer_axis(MirInputDeviceStateEvent const* ev, MirPointerAxis axis) |
781 | +float mir_input_device_state_event_pointer_axis(MirInputDeviceStateEvent const* ev, MirPointerAxis axis) try |
782 | { |
783 | expect_event_type(ev, mir_event_type_input_device_state); |
784 | return ev->pointer_axis(axis); |
785 | +} catch (std::exception const& e) |
786 | +{ |
787 | + mir::log_critical(e.what()); |
788 | + abort(); |
789 | } |
790 | |
791 | -int64_t mir_input_device_state_event_time(MirInputDeviceStateEvent const* ev) |
792 | +int64_t mir_input_device_state_event_time(MirInputDeviceStateEvent const* ev) try |
793 | { |
794 | expect_event_type(ev, mir_event_type_input_device_state); |
795 | return ev->when().count(); |
796 | +} catch (std::exception const& e) |
797 | +{ |
798 | + mir::log_critical(e.what()); |
799 | + abort(); |
800 | } |
801 | |
802 | -MirInputEventModifiers mir_input_device_state_event_modifiers(MirInputDeviceStateEvent const* ev) |
803 | +MirInputEventModifiers mir_input_device_state_event_modifiers(MirInputDeviceStateEvent const* ev) try |
804 | { |
805 | expect_event_type(ev, mir_event_type_input_device_state); |
806 | return ev->modifiers(); |
807 | +} catch (std::exception const& e) |
808 | +{ |
809 | + mir::log_critical(e.what()); |
810 | + abort(); |
811 | } |
812 | |
813 | -uint32_t mir_input_device_state_event_device_count(MirInputDeviceStateEvent const* ev) |
814 | +uint32_t mir_input_device_state_event_device_count(MirInputDeviceStateEvent const* ev) try |
815 | { |
816 | expect_event_type(ev, mir_event_type_input_device_state); |
817 | return ev->device_count(); |
818 | +} catch (std::exception const& e) |
819 | +{ |
820 | + mir::log_critical(e.what()); |
821 | + abort(); |
822 | } |
823 | |
824 | -MirInputDeviceId mir_input_device_state_event_device_id(MirInputDeviceStateEvent const* ev, uint32_t index) |
825 | +MirInputDeviceId mir_input_device_state_event_device_id(MirInputDeviceStateEvent const* ev, uint32_t index) try |
826 | { |
827 | expect_event_type(ev, mir_event_type_input_device_state); |
828 | expect_index_in_range(ev->device_count(), index); |
829 | return ev->device_id(index); |
830 | +} catch (std::exception const& e) |
831 | +{ |
832 | + mir::log_critical(e.what()); |
833 | + abort(); |
834 | } |
835 | |
836 | // Function is deprecated, and no one is currently using it. |
837 | @@ -329,25 +461,37 @@ |
838 | |
839 | uint32_t mir_input_device_state_event_device_pressed_keys_for_index(MirInputDeviceStateEvent const* ev, |
840 | uint32_t index, |
841 | - uint32_t pressed_index) |
842 | + uint32_t pressed_index) try |
843 | { |
844 | expect_event_type(ev, mir_event_type_input_device_state); |
845 | expect_index_in_range(ev->device_count(), index); |
846 | return ev->device_pressed_keys_for_index(index, pressed_index); |
847 | +} catch (std::exception const& e) |
848 | +{ |
849 | + mir::log_critical(e.what()); |
850 | + abort(); |
851 | } |
852 | |
853 | -uint32_t mir_input_device_state_event_device_pressed_keys_count(MirInputDeviceStateEvent const* ev, uint32_t index) |
854 | +uint32_t mir_input_device_state_event_device_pressed_keys_count(MirInputDeviceStateEvent const* ev, uint32_t index) try |
855 | { |
856 | expect_event_type(ev, mir_event_type_input_device_state); |
857 | expect_index_in_range(ev->device_count(), index); |
858 | return ev->device_pressed_keys_count(index); |
859 | +} catch (std::exception const& e) |
860 | +{ |
861 | + mir::log_critical(e.what()); |
862 | + abort(); |
863 | } |
864 | |
865 | -MirPointerButtons mir_input_device_state_event_device_pointer_buttons(MirInputDeviceStateEvent const* ev, uint32_t index) |
866 | +MirPointerButtons mir_input_device_state_event_device_pointer_buttons(MirInputDeviceStateEvent const* ev, uint32_t index) try |
867 | { |
868 | expect_event_type(ev, mir_event_type_input_device_state); |
869 | expect_index_in_range(ev->device_count(), index); |
870 | return ev->device_pointer_buttons(index); |
871 | +} catch (std::exception const& e) |
872 | +{ |
873 | + mir::log_critical(e.what()); |
874 | + abort(); |
875 | } |
876 | |
877 | MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event) |
878 | @@ -362,17 +506,16 @@ |
879 | |
880 | // TODO: Until we opaquify the MirEvent structure and add |
881 | // a ref count ref is implemented as copy. |
882 | -MirEvent const* mir_event_ref(MirEvent const* ev) |
883 | -{ |
884 | - return ev->clone(); |
885 | +MirEvent const* mir_event_ref(MirEvent const* ev) try |
886 | +{ |
887 | + return new MirEvent(*ev); |
888 | +} catch (std::exception const& e) |
889 | +{ |
890 | + mir::log_critical(e.what()); |
891 | + abort(); |
892 | } |
893 | |
894 | void mir_event_unref(MirEvent const* ev) |
895 | { |
896 | - if (mir_event_get_type(ev) == mir_event_type_keymap) |
897 | - { |
898 | - const_cast<MirEvent*>(ev)->to_keymap()->free_buffer(); |
899 | - } |
900 | - |
901 | delete const_cast<MirEvent*>(ev); |
902 | } |
903 | |
904 | === modified file 'src/client/events/event_builders.cpp' |
905 | --- src/client/events/event_builders.cpp 2016-09-19 04:16:15 +0000 |
906 | +++ src/client/events/event_builders.cpp 2016-09-22 20:34:39 +0000 |
907 | @@ -41,22 +41,6 @@ |
908 | |
909 | namespace |
910 | { |
911 | - mir::cookie::Blob vector_to_cookie_as_blob(std::vector<uint8_t> const& vector) |
912 | - { |
913 | - mir::cookie::Blob blob{{}}; |
914 | - |
915 | - if (vector.size() > blob.size()) |
916 | - { |
917 | - throw std::runtime_error("Vector size " + std::to_string(vector.size()) + |
918 | - " is larger then array size: " + |
919 | - std::to_string(blob.size())); |
920 | - } |
921 | - |
922 | - std::copy_n(vector.begin(), vector.size(), blob.begin()); |
923 | - |
924 | - return blob; |
925 | - } |
926 | - |
927 | template <class T> |
928 | T* new_event() |
929 | { |
930 | @@ -70,7 +54,6 @@ |
931 | { |
932 | return mir::EventUPtr(e, ([](MirEvent* e) { delete reinterpret_cast<T*>(e); })); |
933 | } |
934 | - |
935 | } |
936 | |
937 | mir::EventUPtr mev::make_event(mf::SurfaceId const& surface_id, MirOrientation orientation) |
938 | @@ -195,7 +178,7 @@ |
939 | e->set_device_id(device_id); |
940 | e->set_source_id(AINPUT_SOURCE_KEYBOARD); |
941 | e->set_event_time(timestamp); |
942 | - e->set_cookie(vector_to_cookie_as_blob(cookie)); |
943 | + e->set_cookie(cookie); |
944 | e->set_action(action); |
945 | e->set_key_code(key_code); |
946 | e->set_scan_code(scan_code); |
947 | @@ -269,7 +252,7 @@ |
948 | |
949 | e->set_device_id(device_id); |
950 | e->set_event_time(timestamp); |
951 | - e->set_cookie(vector_to_cookie_as_blob(cookie)); |
952 | + e->set_cookie(cookie); |
953 | e->set_modifiers(modifiers); |
954 | e->set_source_id(AINPUT_SOURCE_TOUCHSCREEN); |
955 | |
956 | @@ -321,7 +304,7 @@ |
957 | auto& mev = *e->to_input()->to_motion(); |
958 | mev.set_device_id(device_id); |
959 | mev.set_event_time(timestamp); |
960 | - mev.set_cookie(vector_to_cookie_as_blob(cookie)); |
961 | + mev.set_cookie(cookie); |
962 | mev.set_modifiers(modifiers); |
963 | mev.set_source_id(AINPUT_SOURCE_MOUSE); |
964 | mev.set_buttons(buttons_pressed); |
965 | @@ -390,15 +373,7 @@ |
966 | std::string const& layout, std::string const& variant, std::string const& options) |
967 | { |
968 | auto e = new_event<MirKeymapEvent>(); |
969 | - auto ep = mir::EventUPtr(e, [](MirEvent* e) { |
970 | - // xkbcommon creates the keymap through malloc |
971 | - if (e && e->type() == mir_event_type_keymap) |
972 | - { |
973 | - e->to_keymap()->free_buffer(); |
974 | - } |
975 | - |
976 | - delete e; |
977 | - }); |
978 | + auto ep = make_uptr_event(e); |
979 | |
980 | auto ctx = mi::make_unique_context(); |
981 | auto map = mi::make_unique_keymap(ctx.get(), mi::Keymap{model, layout, variant, options}); |
982 | @@ -409,8 +384,9 @@ |
983 | e->set_surface_id(surface_id.as_value()); |
984 | e->set_device_id(id); |
985 | // TODO consider caching compiled keymaps |
986 | - e->set_buffer(xkb_keymap_get_as_string(map.get(), XKB_KEYMAP_FORMAT_TEXT_V1)); |
987 | - e->set_size(strlen(e->to_keymap()->buffer())); |
988 | + auto buffer = xkb_keymap_get_as_string(map.get(), XKB_KEYMAP_FORMAT_TEXT_V1); |
989 | + e->set_buffer(buffer); |
990 | + std::free(buffer); |
991 | |
992 | return ep; |
993 | } |
994 | @@ -439,8 +415,7 @@ |
995 | e->set_pointer_buttons(pointer_buttons); |
996 | e->set_pointer_axis(mir_pointer_axis_x, x_axis_value); |
997 | e->set_pointer_axis(mir_pointer_axis_y, y_axis_value); |
998 | - for (auto& dev : device_states) |
999 | - e->add_device(dev.id, std::move(dev.pressed_keys), dev.buttons); |
1000 | + e->set_device_states(device_states); |
1001 | |
1002 | return make_uptr_event(e); |
1003 | } |
1004 | |
1005 | === modified file 'src/client/input/input_event.cpp' |
1006 | --- src/client/input/input_event.cpp 2016-08-01 07:44:10 +0000 |
1007 | +++ src/client/input/input_event.cpp 2016-09-22 20:34:39 +0000 |
1008 | @@ -18,6 +18,9 @@ |
1009 | |
1010 | #define MIR_LOG_COMPONENT "input-event-access" |
1011 | |
1012 | +// TODO Remove me once we use capnproto for input platform serialization |
1013 | +#include "mir/cookie/blob.h" |
1014 | + |
1015 | #include "mir/cookie/cookie.h" |
1016 | #include "mir/event_type_to_string.h" |
1017 | #include "mir/events/event_private.h" |
1018 | @@ -91,7 +94,7 @@ |
1019 | } |
1020 | } |
1021 | |
1022 | -MirInputEventType mir_input_event_get_type(MirInputEvent const* ev) |
1023 | +MirInputEventType mir_input_event_get_type(MirInputEvent const* ev) try |
1024 | { |
1025 | if (ev->type() != mir_event_type_key && ev->type() != mir_event_type_motion) |
1026 | { |
1027 | @@ -108,9 +111,13 @@ |
1028 | default: |
1029 | abort(); |
1030 | } |
1031 | +} catch (std::exception const& e) |
1032 | +{ |
1033 | + mir::log_critical(e.what()); |
1034 | + abort(); |
1035 | } |
1036 | |
1037 | -MirInputDeviceId mir_input_event_get_device_id(MirInputEvent const* ev) |
1038 | +MirInputDeviceId mir_input_event_get_device_id(MirInputEvent const* ev) try |
1039 | { |
1040 | if(mir_event_get_type(ev) != mir_event_type_input) |
1041 | { |
1042 | @@ -127,9 +134,13 @@ |
1043 | default: |
1044 | abort(); |
1045 | } |
1046 | +} catch (std::exception const& e) |
1047 | +{ |
1048 | + mir::log_critical(e.what()); |
1049 | + abort(); |
1050 | } |
1051 | |
1052 | -int64_t mir_input_event_get_event_time(MirInputEvent const* ev) |
1053 | +int64_t mir_input_event_get_event_time(MirInputEvent const* ev) try |
1054 | { |
1055 | if(mir_event_get_type(ev) != mir_event_type_input) |
1056 | { |
1057 | @@ -146,6 +157,10 @@ |
1058 | default: |
1059 | abort(); |
1060 | } |
1061 | +} catch (std::exception const& e) |
1062 | +{ |
1063 | + mir::log_critical(e.what()); |
1064 | + abort(); |
1065 | } |
1066 | |
1067 | MirInputEvent const* mir_pointer_event_input_event(MirPointerEvent const* event) |
1068 | @@ -177,33 +192,53 @@ |
1069 | return reinterpret_cast<MirKeyboardEvent const*>(ev); |
1070 | } |
1071 | |
1072 | -MirKeyboardAction mir_keyboard_event_action(MirKeyboardEvent const* kev) |
1073 | +MirKeyboardAction mir_keyboard_event_action(MirKeyboardEvent const* kev) try |
1074 | { |
1075 | return kev->action(); |
1076 | +} catch (std::exception const& e) |
1077 | +{ |
1078 | + mir::log_critical(e.what()); |
1079 | + abort(); |
1080 | } |
1081 | |
1082 | -xkb_keysym_t mir_keyboard_event_key_code(MirKeyboardEvent const* kev) |
1083 | +xkb_keysym_t mir_keyboard_event_key_code(MirKeyboardEvent const* kev) try |
1084 | { |
1085 | return kev->key_code(); |
1086 | +} catch (std::exception const& e) |
1087 | +{ |
1088 | + mir::log_critical(e.what()); |
1089 | + abort(); |
1090 | } |
1091 | |
1092 | -int mir_keyboard_event_scan_code(MirKeyboardEvent const* kev) |
1093 | +int mir_keyboard_event_scan_code(MirKeyboardEvent const* kev) try |
1094 | { |
1095 | return kev->scan_code(); |
1096 | +} catch (std::exception const& e) |
1097 | +{ |
1098 | + mir::log_critical(e.what()); |
1099 | + abort(); |
1100 | } |
1101 | |
1102 | -MirInputEventModifiers mir_keyboard_event_modifiers(MirKeyboardEvent const* kev) |
1103 | +MirInputEventModifiers mir_keyboard_event_modifiers(MirKeyboardEvent const* kev) try |
1104 | { |
1105 | return kev->modifiers(); |
1106 | +} catch (std::exception const& e) |
1107 | +{ |
1108 | + mir::log_critical(e.what()); |
1109 | + abort(); |
1110 | } |
1111 | /* Touch event accessors */ |
1112 | |
1113 | -MirInputEventModifiers mir_touch_event_modifiers(MirTouchEvent const* tev) |
1114 | +MirInputEventModifiers mir_touch_event_modifiers(MirTouchEvent const* tev) try |
1115 | { |
1116 | return tev->to_motion()->modifiers(); |
1117 | +} catch (std::exception const& e) |
1118 | +{ |
1119 | + mir::log_critical(e.what()); |
1120 | + abort(); |
1121 | } |
1122 | |
1123 | -MirTouchEvent const* mir_input_event_get_touch_event(MirInputEvent const* ev) |
1124 | +MirTouchEvent const* mir_input_event_get_touch_event(MirInputEvent const* ev) try |
1125 | { |
1126 | if(mir_input_event_get_type(ev) != mir_input_event_type_touch) |
1127 | { |
1128 | @@ -213,14 +248,22 @@ |
1129 | } |
1130 | |
1131 | return reinterpret_cast<MirTouchEvent const*>(ev); |
1132 | +} catch (std::exception const& e) |
1133 | +{ |
1134 | + mir::log_critical(e.what()); |
1135 | + abort(); |
1136 | } |
1137 | |
1138 | -unsigned int mir_touch_event_point_count(MirTouchEvent const* event) |
1139 | +unsigned int mir_touch_event_point_count(MirTouchEvent const* event) try |
1140 | { |
1141 | return event->to_motion()->pointer_count(); |
1142 | +} catch (std::exception const& e) |
1143 | +{ |
1144 | + mir::log_critical(e.what()); |
1145 | + abort(); |
1146 | } |
1147 | |
1148 | -MirTouchId mir_touch_event_id(MirTouchEvent const* event, size_t touch_index) |
1149 | +MirTouchId mir_touch_event_id(MirTouchEvent const* event, size_t touch_index) try |
1150 | { |
1151 | if (touch_index >= event->to_motion()->pointer_count()) |
1152 | { |
1153 | @@ -229,9 +272,13 @@ |
1154 | } |
1155 | |
1156 | return event->to_motion()->id(touch_index); |
1157 | +} catch (std::exception const& e) |
1158 | +{ |
1159 | + mir::log_critical(e.what()); |
1160 | + abort(); |
1161 | } |
1162 | |
1163 | -MirTouchAction mir_touch_event_action(MirTouchEvent const* event, size_t touch_index) |
1164 | +MirTouchAction mir_touch_event_action(MirTouchEvent const* event, size_t touch_index) try |
1165 | { |
1166 | if(touch_index > event->to_motion()->pointer_count()) |
1167 | { |
1168 | @@ -240,10 +287,14 @@ |
1169 | } |
1170 | |
1171 | return static_cast<MirTouchAction>(event->to_motion()->action(touch_index)); |
1172 | +} catch (std::exception const& e) |
1173 | +{ |
1174 | + mir::log_critical(e.what()); |
1175 | + abort(); |
1176 | } |
1177 | |
1178 | MirTouchTooltype mir_touch_event_tooltype(MirTouchEvent const* event, |
1179 | - size_t touch_index) |
1180 | + size_t touch_index) try |
1181 | { |
1182 | if(touch_index > event->to_motion()->pointer_count()) |
1183 | { |
1184 | @@ -252,10 +303,14 @@ |
1185 | } |
1186 | |
1187 | return event->to_motion()->tool_type(touch_index); |
1188 | +} catch (std::exception const& e) |
1189 | +{ |
1190 | + mir::log_critical(e.what()); |
1191 | + abort(); |
1192 | } |
1193 | |
1194 | float mir_touch_event_axis_value(MirTouchEvent const* event, |
1195 | - size_t touch_index, MirTouchAxis axis) |
1196 | + size_t touch_index, MirTouchAxis axis) try |
1197 | { |
1198 | if(touch_index > event->to_motion()->pointer_count()) |
1199 | { |
1200 | @@ -281,11 +336,15 @@ |
1201 | default: |
1202 | return -1; |
1203 | } |
1204 | -} |
1205 | +} catch (std::exception const& e) |
1206 | +{ |
1207 | + mir::log_critical(e.what()); |
1208 | + abort(); |
1209 | +} |
1210 | |
1211 | /* Pointer event accessors */ |
1212 | |
1213 | -MirPointerEvent const* mir_input_event_get_pointer_event(MirInputEvent const* ev) |
1214 | +MirPointerEvent const* mir_input_event_get_pointer_event(MirInputEvent const* ev) try |
1215 | { |
1216 | if(mir_input_event_get_type(ev) != mir_input_event_type_pointer) |
1217 | { |
1218 | @@ -295,30 +354,50 @@ |
1219 | } |
1220 | |
1221 | return reinterpret_cast<MirPointerEvent const*>(ev); |
1222 | +} catch (std::exception const& e) |
1223 | +{ |
1224 | + mir::log_critical(e.what()); |
1225 | + abort(); |
1226 | } |
1227 | |
1228 | -MirInputEventModifiers mir_pointer_event_modifiers(MirPointerEvent const* pev) |
1229 | +MirInputEventModifiers mir_pointer_event_modifiers(MirPointerEvent const* pev) try |
1230 | { |
1231 | return pev->to_motion()->modifiers(); |
1232 | +} catch (std::exception const& e) |
1233 | +{ |
1234 | + mir::log_critical(e.what()); |
1235 | + abort(); |
1236 | } |
1237 | |
1238 | -MirPointerAction mir_pointer_event_action(MirPointerEvent const* pev) |
1239 | +MirPointerAction mir_pointer_event_action(MirPointerEvent const* pev) try |
1240 | { |
1241 | return static_cast<MirPointerAction>(pev->to_motion()->action(0)); |
1242 | +} catch (std::exception const& e) |
1243 | +{ |
1244 | + mir::log_critical(e.what()); |
1245 | + abort(); |
1246 | } |
1247 | |
1248 | bool mir_pointer_event_button_state(MirPointerEvent const* pev, |
1249 | - MirPointerButton button) |
1250 | + MirPointerButton button) try |
1251 | { |
1252 | return pev->to_motion()->buttons() & button; |
1253 | +} catch (std::exception const& e) |
1254 | +{ |
1255 | + mir::log_critical(e.what()); |
1256 | + abort(); |
1257 | } |
1258 | |
1259 | -MirPointerButtons mir_pointer_event_buttons(MirPointerEvent const* pev) |
1260 | +MirPointerButtons mir_pointer_event_buttons(MirPointerEvent const* pev) try |
1261 | { |
1262 | return pev->to_motion()->buttons(); |
1263 | +} catch (std::exception const& e) |
1264 | +{ |
1265 | + mir::log_critical(e.what()); |
1266 | + abort(); |
1267 | } |
1268 | |
1269 | -float mir_pointer_event_axis_value(MirPointerEvent const* pev, MirPointerAxis axis) |
1270 | +float mir_pointer_event_axis_value(MirPointerEvent const* pev, MirPointerAxis axis) try |
1271 | { |
1272 | auto mev = pev->to_motion(); |
1273 | switch (axis) |
1274 | @@ -339,9 +418,13 @@ |
1275 | mir::log_critical("Invalid axis enumeration " + std::to_string(axis)); |
1276 | abort(); |
1277 | } |
1278 | +} catch (std::exception const& e) |
1279 | +{ |
1280 | + mir::log_critical(e.what()); |
1281 | + abort(); |
1282 | } |
1283 | |
1284 | -bool mir_input_event_has_cookie(MirInputEvent const* ev) |
1285 | +bool mir_input_event_has_cookie(MirInputEvent const* ev) try |
1286 | { |
1287 | switch (mir_input_event_get_type(ev)) |
1288 | { |
1289 | @@ -375,13 +458,18 @@ |
1290 | } |
1291 | |
1292 | return false; |
1293 | +} catch (std::exception const& e) |
1294 | +{ |
1295 | + mir::log_critical(e.what()); |
1296 | + abort(); |
1297 | } |
1298 | |
1299 | size_t mir_cookie_buffer_size(MirCookie const* cookie) try |
1300 | { |
1301 | return cookie->size(); |
1302 | -} catch (...) |
1303 | +} catch (std::exception const& e) |
1304 | { |
1305 | + mir::log_critical(e.what()); |
1306 | abort(); |
1307 | } |
1308 | |
1309 | @@ -399,16 +487,18 @@ |
1310 | abort(); |
1311 | } |
1312 | } |
1313 | -} catch (...) |
1314 | +} catch (std::exception const& e) |
1315 | { |
1316 | + mir::log_critical(e.what()); |
1317 | abort(); |
1318 | } |
1319 | |
1320 | void mir_cookie_to_buffer(MirCookie const* cookie, void* buffer, size_t size) try |
1321 | { |
1322 | return cookie->copy_to(buffer, size); |
1323 | -} catch (...) |
1324 | +} catch (std::exception const& e) |
1325 | { |
1326 | + mir::log_critical(e.what()); |
1327 | abort(); |
1328 | } |
1329 | |
1330 | @@ -418,15 +508,13 @@ |
1331 | return NULL; |
1332 | |
1333 | return new MirCookie(buffer, size); |
1334 | -} catch (...) |
1335 | +} catch (std::exception const& e) |
1336 | { |
1337 | + mir::log_critical(e.what()); |
1338 | abort(); |
1339 | } |
1340 | |
1341 | -void mir_cookie_release(MirCookie const* cookie) try |
1342 | +void mir_cookie_release(MirCookie const* cookie) |
1343 | { |
1344 | delete cookie; |
1345 | -} catch (...) |
1346 | -{ |
1347 | - abort(); |
1348 | } |
1349 | |
1350 | === modified file 'src/client/mir_cookie.cpp' |
1351 | --- src/client/mir_cookie.cpp 2016-01-22 20:16:50 +0000 |
1352 | +++ src/client/mir_cookie.cpp 2016-09-22 20:34:39 +0000 |
1353 | @@ -22,28 +22,29 @@ |
1354 | |
1355 | #include <string.h> |
1356 | |
1357 | -MirCookie::MirCookie(void const* buffer, size_t size) |
1358 | +MirCookie::MirCookie(void const* buffer, size_t size) : |
1359 | + cookie_(size) |
1360 | { |
1361 | - memcpy(blob_.data(), buffer, size); |
1362 | + memcpy(cookie_.data(), buffer, size); |
1363 | } |
1364 | |
1365 | -MirCookie::MirCookie(mir::cookie::Blob const& blob) : |
1366 | - blob_(blob) |
1367 | +MirCookie::MirCookie(std::vector<uint8_t> const& cookie) : |
1368 | + cookie_(cookie) |
1369 | { |
1370 | } |
1371 | |
1372 | void MirCookie::copy_to(void* buffer, size_t size) const |
1373 | { |
1374 | - mir::require(size == blob_.size()); |
1375 | - memcpy(buffer, blob_.data(), size); |
1376 | + mir::require(size == cookie_.size()); |
1377 | + memcpy(buffer, cookie_.data(), size); |
1378 | } |
1379 | |
1380 | size_t MirCookie::size() const |
1381 | { |
1382 | - return blob_.size(); |
1383 | + return cookie_.size(); |
1384 | } |
1385 | |
1386 | -mir::cookie::Blob MirCookie::blob() const |
1387 | +std::vector<uint8_t> MirCookie::cookie() const |
1388 | { |
1389 | - return blob_; |
1390 | + return cookie_; |
1391 | } |
1392 | |
1393 | === modified file 'src/client/mir_cookie.h' |
1394 | --- src/client/mir_cookie.h 2016-01-22 20:16:50 +0000 |
1395 | +++ src/client/mir_cookie.h 2016-09-22 20:34:39 +0000 |
1396 | @@ -20,21 +20,23 @@ |
1397 | #ifndef MIR_CLIENT_MIR_COOKIE_H_ |
1398 | #define MIR_CLIENT_MIR_COOKIE_H_ |
1399 | |
1400 | -#include "mir/cookie/blob.h" |
1401 | +#include <cstdint> |
1402 | +#include <cstdlib> |
1403 | +#include <vector> |
1404 | |
1405 | class MirCookie |
1406 | { |
1407 | public: |
1408 | explicit MirCookie(void const* buffer, size_t size); |
1409 | - explicit MirCookie(mir::cookie::Blob const& blob); |
1410 | + explicit MirCookie(std::vector<uint8_t> const& cookie); |
1411 | |
1412 | void copy_to(void* buffer, size_t size) const; |
1413 | size_t size() const; |
1414 | |
1415 | - mir::cookie::Blob blob() const; |
1416 | + std::vector<uint8_t> cookie() const; |
1417 | |
1418 | private: |
1419 | - mir::cookie::Blob blob_; |
1420 | + std::vector<uint8_t> cookie_; |
1421 | }; |
1422 | |
1423 | #endif // MIR_CLIENT_MIR_COOKIE_H_ |
1424 | |
1425 | === modified file 'src/client/mir_surface.cpp' |
1426 | --- src/client/mir_surface.cpp 2016-08-31 10:46:40 +0000 |
1427 | +++ src/client/mir_surface.cpp 2016-09-22 20:34:39 +0000 |
1428 | @@ -496,7 +496,7 @@ |
1429 | |
1430 | auto const event_cookie = raise_request.mutable_cookie(); |
1431 | |
1432 | - event_cookie->set_cookie(cookie->blob().data(), cookie->size()); |
1433 | + event_cookie->set_cookie(cookie->cookie().data(), cookie->size()); |
1434 | |
1435 | server->raise_surface( |
1436 | &raise_request, |
1437 | |
1438 | === modified file 'src/client/symbols.map' |
1439 | --- src/client/symbols.map 2016-09-22 20:34:38 +0000 |
1440 | +++ src/client/symbols.map 2016-09-22 20:34:39 +0000 |
1441 | @@ -429,6 +429,7 @@ |
1442 | mir_output_get_gamma; |
1443 | mir_output_set_gamma; |
1444 | mir_connection_cancel_base_display_configuration_preview; |
1445 | + mir_input_device_state_event_device_pressed_keys_for_index; |
1446 | mir_surface_placement_get_relative_position; |
1447 | mir_display_output_type_name; |
1448 | mir_output_type_name; |
1449 | |
1450 | === modified file 'src/common/CMakeLists.txt' |
1451 | --- src/common/CMakeLists.txt 2016-09-19 04:16:15 +0000 |
1452 | +++ src/common/CMakeLists.txt 2016-09-22 20:34:39 +0000 |
1453 | @@ -1,6 +1,5 @@ |
1454 | add_definitions(-DMIR_LOG_COMPONENT_FALLBACK="mircommon") |
1455 | |
1456 | -set(MIR_GENERATED_INCLUDE_DIRECTORIES) |
1457 | set(MIR_COMMON_SOURCES) |
1458 | set(MIR_COMMON_REFERENCES) |
1459 | |
1460 | @@ -45,9 +44,12 @@ |
1461 | ) |
1462 | |
1463 | target_link_libraries(mircommon |
1464 | + mircapnproto |
1465 | ${MIR_COMMON_REFERENCES} |
1466 | ) |
1467 | |
1468 | +add_dependencies(mircommon mircapnproto) |
1469 | + |
1470 | set_target_properties(mircommon |
1471 | |
1472 | PROPERTIES |
1473 | |
1474 | === modified file 'src/common/events/CMakeLists.txt' |
1475 | --- src/common/events/CMakeLists.txt 2016-09-19 04:16:15 +0000 |
1476 | +++ src/common/events/CMakeLists.txt 2016-09-22 20:34:39 +0000 |
1477 | @@ -36,7 +36,10 @@ |
1478 | ${EVENT_SOURCES} |
1479 | ) |
1480 | |
1481 | +add_dependencies(mirevents mircapnproto) |
1482 | + |
1483 | include_directories( |
1484 | ${PROJECT_SOURCE_DIR}/include/client |
1485 | ${PROJECT_SOURCE_DIR}/src/include/cookie |
1486 | + ${MIR_GENERATED_INCLUDE_DIRECTORIES} |
1487 | ) |
1488 | |
1489 | === modified file 'src/common/events/close_surface_event.cpp' |
1490 | --- src/common/events/close_surface_event.cpp 2016-03-29 03:41:45 +0000 |
1491 | +++ src/common/events/close_surface_event.cpp 2016-09-22 20:34:39 +0000 |
1492 | @@ -18,17 +18,17 @@ |
1493 | |
1494 | #include "mir/events/close_surface_event.h" |
1495 | |
1496 | -MirCloseSurfaceEvent::MirCloseSurfaceEvent() : |
1497 | - MirEvent(mir_event_type_close_surface) |
1498 | +MirCloseSurfaceEvent::MirCloseSurfaceEvent() |
1499 | { |
1500 | + event.initCloseSurface(); |
1501 | } |
1502 | |
1503 | int MirCloseSurfaceEvent::surface_id() const |
1504 | { |
1505 | - return surface_id_; |
1506 | + return event.asReader().getCloseSurface().getSurfaceId(); |
1507 | } |
1508 | |
1509 | void MirCloseSurfaceEvent::set_surface_id(int id) |
1510 | { |
1511 | - surface_id_ = id; |
1512 | + event.getCloseSurface().setSurfaceId(id); |
1513 | } |
1514 | |
1515 | === modified file 'src/common/events/event.cpp' |
1516 | --- src/common/events/event.cpp 2016-09-19 04:16:15 +0000 |
1517 | +++ src/common/events/event.cpp 2016-09-22 20:34:39 +0000 |
1518 | @@ -18,8 +18,8 @@ |
1519 | |
1520 | #include <boost/throw_exception.hpp> |
1521 | |
1522 | +#include "mir/log.h" |
1523 | #include "mir/events/event.h" |
1524 | - |
1525 | #include "mir/events/close_surface_event.h" |
1526 | #include "mir/events/input_configuration_event.h" |
1527 | #include "mir/events/input_event.h" |
1528 | @@ -34,127 +34,79 @@ |
1529 | #include "mir/events/input_device_state_event.h" |
1530 | #include "mir/events/surface_placement_event.h" |
1531 | |
1532 | -MirEvent::MirEvent(MirEventType type) : |
1533 | - type_(type) |
1534 | -{ |
1535 | -} |
1536 | - |
1537 | -MirEvent* MirEvent::clone() const |
1538 | -{ |
1539 | - switch (type_) |
1540 | - { |
1541 | - case mir_event_type_key: |
1542 | - return mir::event::deep_copy<MirKeyboardEvent>(this); |
1543 | - case mir_event_type_motion: |
1544 | - return mir::event::deep_copy<MirMotionEvent>(this); |
1545 | - case mir_event_type_surface: |
1546 | - return mir::event::deep_copy<MirSurfaceEvent>(this); |
1547 | - case mir_event_type_resize: |
1548 | - return mir::event::deep_copy<MirResizeEvent>(this); |
1549 | - case mir_event_type_prompt_session_state_change: |
1550 | - return mir::event::deep_copy<MirPromptSessionEvent>(this); |
1551 | - case mir_event_type_orientation: |
1552 | - return mir::event::deep_copy<MirOrientationEvent>(this); |
1553 | - case mir_event_type_close_surface: |
1554 | - return mir::event::deep_copy<MirCloseSurfaceEvent>(this); |
1555 | - case mir_event_type_input_configuration: |
1556 | - return mir::event::deep_copy<MirInputConfigurationEvent>(this); |
1557 | - case mir_event_type_surface_output: |
1558 | - return mir::event::deep_copy<MirSurfaceOutputEvent>(this); |
1559 | - case mir_event_type_keymap: |
1560 | - return to_keymap()->clone(); |
1561 | - case mir_event_type_input_device_state: |
1562 | - return to_input_device_state()->clone(); |
1563 | - case mir_event_type_surface_placement: |
1564 | - return mir::event::deep_copy<MirSurfacePlacementEvent>(this); |
1565 | - case mir_event_type_input: |
1566 | - break; |
1567 | - } |
1568 | - |
1569 | - BOOST_THROW_EXCEPTION(std::runtime_error("Failed to clone event")); |
1570 | -} |
1571 | - |
1572 | +#include <capnp/serialize.h> |
1573 | + |
1574 | + |
1575 | +namespace ml = mir::logging; |
1576 | + |
1577 | +MirEvent::MirEvent(MirEvent const& e) |
1578 | +{ |
1579 | + auto reader = e.event.asReader(); |
1580 | + message.setRoot(reader); |
1581 | + event = message.getRoot<mir::capnp::Event>(); |
1582 | +} |
1583 | + |
1584 | +MirEvent& MirEvent::operator=(MirEvent const& e) |
1585 | +{ |
1586 | + auto reader = e.event.asReader(); |
1587 | + message.setRoot(reader); |
1588 | + event = message.getRoot<mir::capnp::Event>(); |
1589 | + return *this; |
1590 | +} |
1591 | + |
1592 | +// TODO Look at replacing the surface event serializer with a capnproto layer |
1593 | mir::EventUPtr MirEvent::deserialize(std::string const& bytes) |
1594 | { |
1595 | - auto minimal_event_size = sizeof(MirEventType); |
1596 | - auto const stream_size = bytes.size(); |
1597 | - if (stream_size < minimal_event_size) |
1598 | - BOOST_THROW_EXCEPTION(std::runtime_error("Failed to deserialize event")); |
1599 | - |
1600 | - MirEventType type; |
1601 | - mir::event::consume(bytes.data(), type); |
1602 | - |
1603 | - switch (type) |
1604 | - { |
1605 | - case mir_event_type_key: |
1606 | - return mir::event::deserialize_from<MirKeyboardEvent>(bytes); |
1607 | - case mir_event_type_motion: |
1608 | - return mir::event::deserialize_from<MirMotionEvent>(bytes); |
1609 | - case mir_event_type_surface: |
1610 | - return mir::event::deserialize_from<MirSurfaceEvent>(bytes); |
1611 | - case mir_event_type_resize: |
1612 | - return mir::event::deserialize_from<MirResizeEvent>(bytes); |
1613 | - case mir_event_type_prompt_session_state_change: |
1614 | - return mir::event::deserialize_from<MirPromptSessionEvent>(bytes); |
1615 | - case mir_event_type_orientation: |
1616 | - return mir::event::deserialize_from<MirOrientationEvent>(bytes); |
1617 | - case mir_event_type_close_surface: |
1618 | - return mir::event::deserialize_from<MirCloseSurfaceEvent>(bytes); |
1619 | - case mir_event_type_input_configuration: |
1620 | - return mir::event::deserialize_from<MirInputConfigurationEvent>(bytes); |
1621 | - case mir_event_type_surface_output: |
1622 | - return mir::event::deserialize_from<MirSurfaceOutputEvent>(bytes); |
1623 | - case mir_event_type_keymap: |
1624 | - return MirKeymapEvent::deserialize(bytes); |
1625 | - case mir_event_type_input_device_state: |
1626 | - return MirInputDeviceStateEvent::deserialize(bytes); |
1627 | - case mir_event_type_surface_placement: |
1628 | - return mir::event::deserialize_from<MirSurfacePlacementEvent>(bytes); |
1629 | - case mir_event_type_input: |
1630 | - break; |
1631 | - } |
1632 | - |
1633 | - BOOST_THROW_EXCEPTION(std::runtime_error("Failed to deserialize event")); |
1634 | + auto e = mir::EventUPtr(new MirEvent, [](MirEvent* ev) { delete ev; }); |
1635 | + kj::ArrayPtr<::capnp::word const> words(reinterpret_cast<::capnp::word const*>( |
1636 | + bytes.data()), bytes.size() / sizeof(::capnp::word)); |
1637 | + |
1638 | + initMessageBuilderFromFlatArrayCopy(words, e->message); |
1639 | + e->event = e->message.getRoot<mir::capnp::Event>(); |
1640 | + |
1641 | + return e; |
1642 | } |
1643 | |
1644 | std::string MirEvent::serialize(MirEvent const* event) |
1645 | { |
1646 | - switch (event->type()) |
1647 | - { |
1648 | - case mir_event_type_key: |
1649 | - return mir::event::serialize_from<MirKeyboardEvent>(event); |
1650 | - case mir_event_type_motion: |
1651 | - return mir::event::serialize_from<MirMotionEvent>(event); |
1652 | - case mir_event_type_surface: |
1653 | - return mir::event::serialize_from<MirSurfaceEvent>(event); |
1654 | - case mir_event_type_resize: |
1655 | - return mir::event::serialize_from<MirResizeEvent>(event); |
1656 | - case mir_event_type_prompt_session_state_change: |
1657 | - return mir::event::serialize_from<MirPromptSessionEvent>(event); |
1658 | - case mir_event_type_orientation: |
1659 | - return mir::event::serialize_from<MirOrientationEvent>(event); |
1660 | - case mir_event_type_close_surface: |
1661 | - return mir::event::serialize_from<MirCloseSurfaceEvent>(event); |
1662 | - case mir_event_type_input_configuration: |
1663 | - return mir::event::serialize_from<MirInputConfigurationEvent>(event); |
1664 | - case mir_event_type_surface_output: |
1665 | - return mir::event::serialize_from<MirSurfaceOutputEvent>(event); |
1666 | - case mir_event_type_keymap: |
1667 | - return MirKeymapEvent::serialize(event); |
1668 | - case mir_event_type_input_device_state: |
1669 | - return MirInputDeviceStateEvent::serialize(event); |
1670 | - case mir_event_type_surface_placement: |
1671 | - return mir::event::serialize_from<MirSurfacePlacementEvent>(event); |
1672 | - case mir_event_type_input: |
1673 | - break; |
1674 | - } |
1675 | + std::string output; |
1676 | + auto flat_event = ::capnp::messageToFlatArray(const_cast<MirEvent*>(event)->message); |
1677 | |
1678 | - BOOST_THROW_EXCEPTION(std::runtime_error("Failed to serialize event")); |
1679 | + return {reinterpret_cast<char*>(flat_event.asBytes().begin()), flat_event.asBytes().size()}; |
1680 | } |
1681 | |
1682 | MirEventType MirEvent::type() const |
1683 | { |
1684 | - return type_; |
1685 | + switch (event.asReader().which()) |
1686 | + { |
1687 | + case mir::capnp::Event::Which::KEY: |
1688 | + return mir_event_type_key; |
1689 | + case mir::capnp::Event::Which::MOTION_SET: |
1690 | + return mir_event_type_motion; |
1691 | + case mir::capnp::Event::Which::SURFACE: |
1692 | + return mir_event_type_surface; |
1693 | + case mir::capnp::Event::Which::RESIZE: |
1694 | + return mir_event_type_resize; |
1695 | + case mir::capnp::Event::Which::PROMPT_SESSION: |
1696 | + return mir_event_type_prompt_session_state_change; |
1697 | + case mir::capnp::Event::Which::ORIENTATION: |
1698 | + return mir_event_type_orientation; |
1699 | + case mir::capnp::Event::Which::CLOSE_SURFACE: |
1700 | + return mir_event_type_close_surface; |
1701 | + case mir::capnp::Event::Which::KEYMAP: |
1702 | + return mir_event_type_keymap; |
1703 | + case mir::capnp::Event::Which::INPUT_CONFIGURATION: |
1704 | + return mir_event_type_input_configuration; |
1705 | + case mir::capnp::Event::Which::SURFACE_OUTPUT: |
1706 | + return mir_event_type_surface_output; |
1707 | + case mir::capnp::Event::Which::INPUT_DEVICE: |
1708 | + return mir_event_type_input_device_state; |
1709 | + case mir::capnp::Event::Which::SURFACE_PLACEMENT: |
1710 | + return mir_event_type_surface_placement; |
1711 | + default: |
1712 | + mir::log_critical("unknown event type."); |
1713 | + abort(); |
1714 | + } |
1715 | } |
1716 | |
1717 | MirInputEvent* MirEvent::to_input() |
1718 | |
1719 | === modified file 'src/common/events/input_configuration_event.cpp' |
1720 | --- src/common/events/input_configuration_event.cpp 2016-03-29 03:41:45 +0000 |
1721 | +++ src/common/events/input_configuration_event.cpp 2016-09-22 20:34:39 +0000 |
1722 | @@ -18,37 +18,37 @@ |
1723 | |
1724 | #include "mir/events/input_configuration_event.h" |
1725 | |
1726 | -MirInputConfigurationEvent::MirInputConfigurationEvent() : |
1727 | - MirEvent(mir_event_type_input_configuration) |
1728 | +MirInputConfigurationEvent::MirInputConfigurationEvent() |
1729 | { |
1730 | + event.initInputConfiguration(); |
1731 | } |
1732 | |
1733 | MirInputConfigurationAction MirInputConfigurationEvent::action() const |
1734 | { |
1735 | - return action_; |
1736 | + return static_cast<MirInputConfigurationAction>(event.asReader().getInputConfiguration().getAction()); |
1737 | } |
1738 | |
1739 | void MirInputConfigurationEvent::set_action(MirInputConfigurationAction action) |
1740 | { |
1741 | - action_ = action; |
1742 | + event.getInputConfiguration().setAction(static_cast<mir::capnp::InputConfigurationEvent::Action>(action)); |
1743 | } |
1744 | |
1745 | std::chrono::nanoseconds MirInputConfigurationEvent::when() const |
1746 | { |
1747 | - return when_; |
1748 | + return std::chrono::nanoseconds{event.asReader().getInputConfiguration().getWhen().getCount()}; |
1749 | } |
1750 | |
1751 | void MirInputConfigurationEvent::set_when(std::chrono::nanoseconds const& when) |
1752 | { |
1753 | - when_ = when; |
1754 | + event.getInputConfiguration().getWhen().setCount(when.count()); |
1755 | } |
1756 | |
1757 | MirInputDeviceId MirInputConfigurationEvent::id() const |
1758 | { |
1759 | - return id_; |
1760 | + return event.asReader().getInputConfiguration().getId().getId(); |
1761 | } |
1762 | |
1763 | void MirInputConfigurationEvent::set_id(MirInputDeviceId id) |
1764 | { |
1765 | - id_ = id; |
1766 | + event.getInputConfiguration().getId().setId(id); |
1767 | } |
1768 | |
1769 | === modified file 'src/common/events/input_device_state_event.cpp' |
1770 | --- src/common/events/input_device_state_event.cpp 2016-09-22 20:34:38 +0000 |
1771 | +++ src/common/events/input_device_state_event.cpp 2016-09-22 20:34:39 +0000 |
1772 | @@ -21,18 +21,18 @@ |
1773 | #include <boost/throw_exception.hpp> |
1774 | |
1775 | MirInputDeviceStateEvent::MirInputDeviceStateEvent() |
1776 | - : MirEvent(mir_event_type_input_device_state) |
1777 | { |
1778 | + event.initInputDevice(); |
1779 | } |
1780 | |
1781 | MirPointerButtons MirInputDeviceStateEvent::pointer_buttons() const |
1782 | { |
1783 | - return pointer_buttons_; |
1784 | + return static_cast<MirPointerButtons>(event.asReader().getInputDevice().getButtons()); |
1785 | } |
1786 | |
1787 | void MirInputDeviceStateEvent::set_pointer_buttons(MirPointerButtons new_pointer_buttons) |
1788 | { |
1789 | - pointer_buttons_ = new_pointer_buttons; |
1790 | + event.getInputDevice().setButtons(new_pointer_buttons); |
1791 | } |
1792 | |
1793 | float MirInputDeviceStateEvent::pointer_axis(MirPointerAxis axis) const |
1794 | @@ -40,9 +40,9 @@ |
1795 | switch(axis) |
1796 | { |
1797 | case mir_pointer_axis_x: |
1798 | - return pointer_x; |
1799 | + return event.asReader().getInputDevice().getPointerX(); |
1800 | case mir_pointer_axis_y: |
1801 | - return pointer_y; |
1802 | + return event.asReader().getInputDevice().getPointerY(); |
1803 | default: |
1804 | return 0.0f; |
1805 | } |
1806 | @@ -53,10 +53,10 @@ |
1807 | switch(axis) |
1808 | { |
1809 | case mir_pointer_axis_x: |
1810 | - pointer_x = value; |
1811 | + event.getInputDevice().setPointerX(value); |
1812 | break; |
1813 | case mir_pointer_axis_y: |
1814 | - pointer_y = value; |
1815 | + event.getInputDevice().setPointerY(value); |
1816 | break; |
1817 | default: |
1818 | break; |
1819 | @@ -65,159 +65,62 @@ |
1820 | |
1821 | std::chrono::nanoseconds MirInputDeviceStateEvent::when() const |
1822 | { |
1823 | - return when_; |
1824 | + return std::chrono::nanoseconds{event.asReader().getInputDevice().getWhen().getCount()}; |
1825 | } |
1826 | |
1827 | void MirInputDeviceStateEvent::set_when(std::chrono::nanoseconds const& when) |
1828 | { |
1829 | - when_ = when; |
1830 | + event.getInputDevice().getWhen().setCount(when.count()); |
1831 | } |
1832 | |
1833 | MirInputEventModifiers MirInputDeviceStateEvent::modifiers() const |
1834 | { |
1835 | - return modifiers_; |
1836 | + return static_cast<MirInputEventModifiers>(event.asReader().getInputDevice().getModifiers()); |
1837 | } |
1838 | |
1839 | void MirInputDeviceStateEvent::set_modifiers(MirInputEventModifiers modifiers) |
1840 | { |
1841 | - modifiers_ = modifiers; |
1842 | + event.getInputDevice().setModifiers(modifiers); |
1843 | } |
1844 | |
1845 | -void MirInputDeviceStateEvent::add_device(MirInputDeviceId id, std::vector<uint32_t> && pressed_keys, MirPointerButtons pointer_buttons) |
1846 | +void MirInputDeviceStateEvent::set_device_states(std::vector<mir::events::InputDeviceState> const& device_states) |
1847 | { |
1848 | - devices.emplace_back(id, std::move(pressed_keys), pointer_buttons); |
1849 | + event.getInputDevice().initDevices(device_states.size()); |
1850 | + |
1851 | + for (size_t i = 0; i < device_states.size(); i++) |
1852 | + { |
1853 | + auto const& state = device_states[i]; |
1854 | + event.getInputDevice().getDevices()[i].getDeviceId().setId(state.id); |
1855 | + event.getInputDevice().getDevices()[i].setButtons(state.buttons); |
1856 | + event.getInputDevice().getDevices()[i].initPressedKeys(state.pressed_keys.size()); |
1857 | + for (size_t j = 0; j < state.pressed_keys.size(); j++) |
1858 | + { |
1859 | + event.getInputDevice().getDevices()[i].getPressedKeys().set(j, state.pressed_keys[j]); |
1860 | + } |
1861 | + } |
1862 | } |
1863 | |
1864 | uint32_t MirInputDeviceStateEvent::device_count() const |
1865 | { |
1866 | - return devices.size(); |
1867 | + return event.asReader().getInputDevice().getDevices().size(); |
1868 | } |
1869 | |
1870 | MirInputDeviceId MirInputDeviceStateEvent::device_id(size_t index) const |
1871 | { |
1872 | - return devices[index].id; |
1873 | + return event.asReader().getInputDevice().getDevices()[index].getDeviceId().getId(); |
1874 | } |
1875 | |
1876 | uint32_t MirInputDeviceStateEvent::device_pressed_keys_for_index(size_t index, size_t pressed_index) const |
1877 | { |
1878 | - return devices[index].pressed_keys[pressed_index]; |
1879 | + return event.asReader().getInputDevice().getDevices()[index].getPressedKeys()[pressed_index]; |
1880 | } |
1881 | |
1882 | uint32_t MirInputDeviceStateEvent::device_pressed_keys_count(size_t index) const |
1883 | { |
1884 | - return devices[index].pressed_keys.size(); |
1885 | + return event.asReader().getInputDevice().getDevices()[index].getPressedKeys().size(); |
1886 | } |
1887 | |
1888 | MirPointerButtons MirInputDeviceStateEvent::device_pointer_buttons(size_t index) const |
1889 | { |
1890 | - return devices[index].pointer_buttons; |
1891 | -} |
1892 | - |
1893 | -namespace |
1894 | -{ |
1895 | -void delete_input_device_state_event(MirEvent* to) |
1896 | -{ |
1897 | - delete to->to_input_device_state(); |
1898 | -} |
1899 | -template<typename Data> |
1900 | -void encode(std::string& encoded, Data const& data) |
1901 | -{ |
1902 | - encoded.append(reinterpret_cast<char const*>(&data), sizeof data); |
1903 | -} |
1904 | -} |
1905 | - |
1906 | -mir::EventUPtr MirInputDeviceStateEvent::deserialize(std::string const& bytes) |
1907 | -{ |
1908 | - auto const stream_size = bytes.size(); |
1909 | - |
1910 | - MirEventType type; |
1911 | - std::chrono::nanoseconds when; |
1912 | - MirInputEventModifiers modifiers; |
1913 | - MirPointerButtons pointer_buttons; |
1914 | - float pointer_x; |
1915 | - float pointer_y; |
1916 | - uint32_t count; |
1917 | - |
1918 | - auto minimal_event_size = sizeof type + sizeof when + sizeof modifiers + sizeof pointer_buttons + sizeof pointer_x + |
1919 | - sizeof pointer_y + sizeof count; |
1920 | - |
1921 | - if (stream_size < minimal_event_size) |
1922 | - BOOST_THROW_EXCEPTION(std::runtime_error("Failed to deserialize event")); |
1923 | - |
1924 | - char const* pos = mir::event::consume(bytes.data(), type); |
1925 | - pos = mir::event::consume(pos, when); |
1926 | - pos = mir::event::consume(pos, modifiers); |
1927 | - pos = mir::event::consume(pos, pointer_buttons); |
1928 | - pos = mir::event::consume(pos, pointer_x); |
1929 | - pos = mir::event::consume(pos, pointer_y); |
1930 | - pos = mir::event::consume(pos, count); |
1931 | - |
1932 | - auto new_event = new MirInputDeviceStateEvent; |
1933 | - new_event->set_when(when); |
1934 | - new_event->set_modifiers(modifiers); |
1935 | - new_event->set_pointer_buttons(pointer_buttons); |
1936 | - new_event->set_pointer_axis(mir_pointer_axis_x, pointer_x); |
1937 | - new_event->set_pointer_axis(mir_pointer_axis_y, pointer_y); |
1938 | - |
1939 | - for (size_t i = 0; i != count; ++i) |
1940 | - { |
1941 | - uint32_t pressed_count = 0; |
1942 | - MirInputDeviceId id; |
1943 | - pos = mir::event::consume(pos, id); |
1944 | - pos = mir::event::consume(pos, pointer_buttons); |
1945 | - pos = mir::event::consume(pos, pressed_count); |
1946 | - |
1947 | - std::vector<uint32_t> pressed_keys(pressed_count); |
1948 | - |
1949 | - for (size_t j = 0;j != pressed_count; ++j) |
1950 | - pos = mir::event::consume(pos, pressed_keys[j]); |
1951 | - |
1952 | - new_event->add_device(id, std::move(pressed_keys), pointer_buttons); |
1953 | - } |
1954 | - |
1955 | - return mir::EventUPtr(new_event, delete_input_device_state_event); |
1956 | -} |
1957 | - |
1958 | -std::string MirInputDeviceStateEvent::serialize(MirEvent const* event) |
1959 | -{ |
1960 | - std::string encoded; |
1961 | - auto input_state = event->to_input_device_state(); |
1962 | - encoded.reserve(sizeof event->type() + |
1963 | - sizeof input_state->when() + |
1964 | - sizeof input_state->modifiers() + |
1965 | - sizeof input_state->pointer_buttons() + |
1966 | - sizeof input_state->pointer_axis(mir_pointer_axis_x) + |
1967 | - sizeof input_state->pointer_axis(mir_pointer_axis_y) + |
1968 | - sizeof input_state->device_count() + |
1969 | - input_state->device_count() * |
1970 | - ( |
1971 | - sizeof input_state->device_id(0) + |
1972 | - sizeof input_state->device_pointer_buttons(0) + |
1973 | - sizeof input_state->device_pressed_keys_count(0) |
1974 | - ) |
1975 | - ); |
1976 | - encode(encoded, event->type()); |
1977 | - encode(encoded, input_state->when()); |
1978 | - encode(encoded, input_state->modifiers()); |
1979 | - encode(encoded, input_state->pointer_buttons()); |
1980 | - encode(encoded, input_state->pointer_axis(mir_pointer_axis_x)); |
1981 | - encode(encoded, input_state->pointer_axis(mir_pointer_axis_y)); |
1982 | - encode(encoded, input_state->device_count()); |
1983 | - for (auto const& dev : input_state->devices) |
1984 | - { |
1985 | - encode(encoded, dev.id); |
1986 | - encode(encoded, dev.pointer_buttons); |
1987 | - encode(encoded, uint32_t(dev.pressed_keys.size())); |
1988 | - for (auto const& key : dev.pressed_keys) |
1989 | - encode(encoded, key); |
1990 | - } |
1991 | - |
1992 | - return encoded; |
1993 | - |
1994 | -} |
1995 | - |
1996 | -MirEvent* MirInputDeviceStateEvent::clone() const |
1997 | -{ |
1998 | - auto new_ev = new MirInputDeviceStateEvent(*this); |
1999 | - return new_ev; |
2000 | + return event.asReader().getInputDevice().getDevices()[index].getButtons(); |
2001 | } |
2002 | |
2003 | === modified file 'src/common/events/input_event.cpp' |
2004 | --- src/common/events/input_event.cpp 2016-03-29 03:41:45 +0000 |
2005 | +++ src/common/events/input_event.cpp 2016-09-22 20:34:39 +0000 |
2006 | @@ -21,11 +21,6 @@ |
2007 | #include "mir/events/keyboard_event.h" |
2008 | #include "mir/events/motion_event.h" |
2009 | |
2010 | -MirInputEvent::MirInputEvent(MirEventType type) : |
2011 | - MirEvent(type) |
2012 | -{ |
2013 | -} |
2014 | - |
2015 | MirKeyboardEvent* MirInputEvent::to_keyboard() |
2016 | { |
2017 | return static_cast<MirKeyboardEvent*>(this); |
2018 | |
2019 | === modified file 'src/common/events/keyboard_event.cpp' |
2020 | --- src/common/events/keyboard_event.cpp 2016-03-29 03:41:45 +0000 |
2021 | +++ src/common/events/keyboard_event.cpp 2016-09-22 20:34:39 +0000 |
2022 | @@ -19,87 +19,92 @@ |
2023 | #include "mir/events/input_event.h" |
2024 | #include "mir/events/keyboard_event.h" |
2025 | |
2026 | -MirKeyboardEvent::MirKeyboardEvent() : |
2027 | - MirInputEvent(mir_event_type_key) |
2028 | +MirKeyboardEvent::MirKeyboardEvent() |
2029 | { |
2030 | + event.initKey(); |
2031 | } |
2032 | |
2033 | int32_t MirKeyboardEvent::device_id() const |
2034 | { |
2035 | - return device_id_; |
2036 | + return event.asReader().getKey().getDeviceId().getId(); |
2037 | } |
2038 | |
2039 | void MirKeyboardEvent::set_device_id(int32_t id) |
2040 | { |
2041 | - device_id_ = id; |
2042 | + event.getKey().getDeviceId().setId(id); |
2043 | } |
2044 | |
2045 | int32_t MirKeyboardEvent::source_id() const |
2046 | { |
2047 | - return source_id_; |
2048 | + return event.asReader().getKey().getSourceId(); |
2049 | } |
2050 | |
2051 | void MirKeyboardEvent::set_source_id(int32_t id) |
2052 | { |
2053 | - source_id_ = id; |
2054 | + event.getKey().setSourceId(id); |
2055 | } |
2056 | |
2057 | MirKeyboardAction MirKeyboardEvent::action() const |
2058 | { |
2059 | - return action_; |
2060 | + return static_cast<MirKeyboardAction>(event.asReader().getKey().getAction()); |
2061 | } |
2062 | |
2063 | void MirKeyboardEvent::set_action(MirKeyboardAction action) |
2064 | { |
2065 | - action_ = action; |
2066 | + event.getKey().setAction(static_cast<mir::capnp::KeyboardEvent::Action>(action)); |
2067 | } |
2068 | |
2069 | MirInputEventModifiers MirKeyboardEvent::modifiers() const |
2070 | { |
2071 | - return modifiers_; |
2072 | + return event.asReader().getKey().getModifiers(); |
2073 | } |
2074 | |
2075 | void MirKeyboardEvent::set_modifiers(MirInputEventModifiers modifiers) |
2076 | { |
2077 | - modifiers_ = modifiers; |
2078 | + event.getKey().setModifiers(modifiers); |
2079 | } |
2080 | |
2081 | int32_t MirKeyboardEvent::key_code() const |
2082 | { |
2083 | - return key_code_; |
2084 | + return event.asReader().getKey().getKeyCode(); |
2085 | } |
2086 | |
2087 | void MirKeyboardEvent::set_key_code(int32_t key_code) |
2088 | { |
2089 | - key_code_ = key_code; |
2090 | + event.getKey().setKeyCode(key_code); |
2091 | } |
2092 | |
2093 | int32_t MirKeyboardEvent::scan_code() const |
2094 | { |
2095 | - return scan_code_; |
2096 | + return event.asReader().getKey().getScanCode(); |
2097 | } |
2098 | |
2099 | void MirKeyboardEvent::set_scan_code(int32_t scan_code) |
2100 | { |
2101 | - scan_code_ = scan_code; |
2102 | + event.getKey().setScanCode(scan_code); |
2103 | } |
2104 | |
2105 | std::chrono::nanoseconds MirKeyboardEvent::event_time() const |
2106 | { |
2107 | - return event_time_; |
2108 | + return std::chrono::nanoseconds{event.asReader().getKey().getEventTime().getCount()}; |
2109 | } |
2110 | |
2111 | void MirKeyboardEvent::set_event_time(std::chrono::nanoseconds const& event_time) |
2112 | { |
2113 | - event_time_ = event_time; |
2114 | -} |
2115 | - |
2116 | -mir::cookie::Blob MirKeyboardEvent::cookie() const |
2117 | -{ |
2118 | - return cookie_; |
2119 | -} |
2120 | - |
2121 | -void MirKeyboardEvent::set_cookie(mir::cookie::Blob const& cookie) |
2122 | -{ |
2123 | - cookie_ = cookie; |
2124 | + event.getKey().getEventTime().setCount(event_time.count()); |
2125 | +} |
2126 | + |
2127 | +std::vector<uint8_t> MirKeyboardEvent::cookie() const |
2128 | +{ |
2129 | + auto cookie = event.asReader().getKey().getCookie(); |
2130 | + std::vector<uint8_t> vec_cookie(cookie.size()); |
2131 | + std::copy(std::begin(cookie), std::end(cookie), std::begin(vec_cookie)); |
2132 | + |
2133 | + return vec_cookie; |
2134 | +} |
2135 | + |
2136 | +void MirKeyboardEvent::set_cookie(std::vector<uint8_t> const& cookie) |
2137 | +{ |
2138 | + ::capnp::Data::Reader cookie_data(cookie.data(), cookie.size()); |
2139 | + event.getKey().setCookie(cookie_data); |
2140 | } |
2141 | |
2142 | === modified file 'src/common/events/keymap_event.cpp' |
2143 | --- src/common/events/keymap_event.cpp 2016-03-29 03:41:45 +0000 |
2144 | +++ src/common/events/keymap_event.cpp 2016-09-22 20:34:39 +0000 |
2145 | @@ -20,145 +20,43 @@ |
2146 | |
2147 | #include "mir/events/keymap_event.h" |
2148 | |
2149 | -namespace |
2150 | -{ |
2151 | -void delete_keymap_event(MirEvent* e) |
2152 | -{ |
2153 | - if (e && e->to_keymap()->buffer()) |
2154 | - { |
2155 | - e->to_keymap()->free_buffer(); |
2156 | - } |
2157 | - |
2158 | - delete e; |
2159 | -} |
2160 | - |
2161 | -template<typename Data> |
2162 | -void encode(std::string& encoded, Data const& data) |
2163 | -{ |
2164 | - encoded.append(reinterpret_cast<char const*>(&data), sizeof data); |
2165 | -} |
2166 | -} |
2167 | - |
2168 | -MirKeymapEvent::MirKeymapEvent() : |
2169 | - MirEvent(mir_event_type_keymap) |
2170 | -{ |
2171 | -} |
2172 | - |
2173 | -MirEvent* MirKeymapEvent::clone() const |
2174 | -{ |
2175 | - auto new_ev = mir::event::deep_copy<MirKeymapEvent>(this); |
2176 | - auto keymap = new_ev->to_keymap(); |
2177 | - |
2178 | - // malloc to match xkbcommons allocation behavior |
2179 | - auto buffer = static_cast<char*>(malloc(keymap->size())); |
2180 | - std::memcpy(buffer, keymap->buffer(), keymap->size()); |
2181 | - keymap->set_buffer(buffer); |
2182 | - |
2183 | - return new_ev; |
2184 | -} |
2185 | - |
2186 | -// Edge case where we have handle the char* buffer manually! |
2187 | -mir::EventUPtr MirKeymapEvent::deserialize(std::string const& bytes) |
2188 | -{ |
2189 | - MirInputDeviceId device_id; |
2190 | - int surface_id; |
2191 | - size_t size; |
2192 | - |
2193 | - auto minimal_event_size = sizeof(MirEventType); |
2194 | - auto const stream_size = bytes.size(); |
2195 | - if (stream_size < minimal_event_size) |
2196 | - BOOST_THROW_EXCEPTION(std::runtime_error("Failed to deserialize event")); |
2197 | - |
2198 | - MirEventType type; |
2199 | - char const* pos = mir::event::consume(bytes.data(), type); |
2200 | - |
2201 | - minimal_event_size += sizeof(surface_id) + sizeof(device_id) + sizeof(size); |
2202 | - |
2203 | - if (stream_size < minimal_event_size) |
2204 | - BOOST_THROW_EXCEPTION(std::runtime_error("Failed to deserialize event")); |
2205 | - |
2206 | - pos = mir::event::consume(pos, surface_id); |
2207 | - pos = mir::event::consume(pos, device_id); |
2208 | - pos = mir::event::consume(pos, size); |
2209 | - |
2210 | - minimal_event_size += size; |
2211 | - |
2212 | - if (stream_size < minimal_event_size) |
2213 | - BOOST_THROW_EXCEPTION(std::runtime_error("Failed to deserialize event")); |
2214 | - |
2215 | - auto buffer = static_cast<char*>(std::malloc(size)); |
2216 | - std::memcpy(buffer, pos, size); |
2217 | - |
2218 | - auto new_event = new MirKeymapEvent; |
2219 | - new_event->set_surface_id(surface_id); |
2220 | - new_event->set_device_id(device_id); |
2221 | - new_event->set_size(size); |
2222 | - new_event->set_buffer(buffer); |
2223 | - |
2224 | - return mir::EventUPtr(new_event, delete_keymap_event); |
2225 | -} |
2226 | - |
2227 | - |
2228 | -// Edge case where we have handle the char* buffer manually! |
2229 | -std::string MirKeymapEvent::serialize(MirEvent const* event) |
2230 | -{ |
2231 | - std::string encoded; |
2232 | - auto keymap = event->to_keymap(); |
2233 | - encoded.reserve(sizeof event->type() + |
2234 | - sizeof keymap->surface_id() + |
2235 | - sizeof keymap->device_id() + |
2236 | - sizeof keymap->size() + |
2237 | - keymap->size()); |
2238 | - encode(encoded, event->type()); |
2239 | - encode(encoded, keymap->surface_id()); |
2240 | - encode(encoded, keymap->device_id()); |
2241 | - encode(encoded, keymap->size()); |
2242 | - encoded.append(keymap->buffer(), keymap->size()); |
2243 | - |
2244 | - return encoded; |
2245 | +MirKeymapEvent::MirKeymapEvent() |
2246 | +{ |
2247 | + event.initKeymap(); |
2248 | } |
2249 | |
2250 | int MirKeymapEvent::surface_id() const |
2251 | { |
2252 | - return surface_id_; |
2253 | + return event.asReader().getKeymap().getSurfaceId(); |
2254 | } |
2255 | |
2256 | void MirKeymapEvent::set_surface_id(int id) |
2257 | { |
2258 | - surface_id_ = id; |
2259 | + event.getKeymap().setSurfaceId(id); |
2260 | } |
2261 | |
2262 | MirInputDeviceId MirKeymapEvent::device_id() const |
2263 | { |
2264 | - return device_id_; |
2265 | + return event.asReader().getKeymap().getDeviceId().getId(); |
2266 | } |
2267 | |
2268 | void MirKeymapEvent::set_device_id(MirInputDeviceId id) |
2269 | { |
2270 | - device_id_ = id; |
2271 | + event.getKeymap().getDeviceId().setId(id); |
2272 | } |
2273 | |
2274 | char const* MirKeymapEvent::buffer() const |
2275 | { |
2276 | - return buffer_; |
2277 | + return event.asReader().getKeymap().getBuffer().cStr(); |
2278 | } |
2279 | |
2280 | void MirKeymapEvent::set_buffer(char const* buffer) |
2281 | { |
2282 | - buffer_ = buffer; |
2283 | -} |
2284 | - |
2285 | -void MirKeymapEvent::free_buffer() |
2286 | -{ |
2287 | - std::free(const_cast<char*>(buffer_)); |
2288 | + ::capnp::Text::Reader capnp_text(buffer, strlen(buffer)); |
2289 | + event.getKeymap().setBuffer(capnp_text); |
2290 | } |
2291 | |
2292 | size_t MirKeymapEvent::size() const |
2293 | { |
2294 | - return size_; |
2295 | -} |
2296 | - |
2297 | -void MirKeymapEvent::set_size(size_t size) |
2298 | -{ |
2299 | - size_ = size; |
2300 | + return event.asReader().getKeymap().getBuffer().size(); |
2301 | } |
2302 | |
2303 | === modified file 'src/common/events/motion_event.cpp' |
2304 | --- src/common/events/motion_event.cpp 2016-03-30 05:27:27 +0000 |
2305 | +++ src/common/events/motion_event.cpp 2016-09-22 20:34:39 +0000 |
2306 | @@ -20,303 +20,288 @@ |
2307 | |
2308 | #include "mir/events/motion_event.h" |
2309 | |
2310 | -MirMotionEvent::MirMotionEvent() : |
2311 | - MirInputEvent(mir_event_type_motion) |
2312 | +MirMotionEvent::MirMotionEvent() |
2313 | { |
2314 | + event.initMotionSet(); |
2315 | + event.getMotionSet().initMotions(mir::capnp::MotionSetEvent::MAX_COUNT); |
2316 | } |
2317 | |
2318 | int32_t MirMotionEvent::device_id() const |
2319 | { |
2320 | - return device_id_; |
2321 | + return event.asReader().getMotionSet().getDeviceId().getId(); |
2322 | } |
2323 | |
2324 | void MirMotionEvent::set_device_id(int32_t id) |
2325 | { |
2326 | - device_id_ = id; |
2327 | + event.getMotionSet().getDeviceId().setId(id); |
2328 | } |
2329 | |
2330 | int32_t MirMotionEvent::source_id() const |
2331 | { |
2332 | - return source_id_; |
2333 | + return event.asReader().getMotionSet().getSourceId(); |
2334 | } |
2335 | |
2336 | void MirMotionEvent::set_source_id(int32_t id) |
2337 | { |
2338 | - source_id_ = id; |
2339 | + event.getMotionSet().setSourceId(id); |
2340 | } |
2341 | |
2342 | MirInputEventModifiers MirMotionEvent::modifiers() const |
2343 | { |
2344 | - return modifiers_; |
2345 | + return event.asReader().getMotionSet().getModifiers(); |
2346 | } |
2347 | |
2348 | void MirMotionEvent::set_modifiers(MirInputEventModifiers modifiers) |
2349 | { |
2350 | - modifiers_ = modifiers; |
2351 | + event.getMotionSet().setModifiers(modifiers); |
2352 | } |
2353 | |
2354 | MirPointerButtons MirMotionEvent::buttons() const |
2355 | { |
2356 | - return buttons_; |
2357 | + return event.asReader().getMotionSet().getButtons(); |
2358 | } |
2359 | |
2360 | void MirMotionEvent::set_buttons(MirPointerButtons buttons) |
2361 | { |
2362 | - buttons_ = buttons; |
2363 | + event.getMotionSet().setButtons(buttons); |
2364 | } |
2365 | |
2366 | std::chrono::nanoseconds MirMotionEvent::event_time() const |
2367 | { |
2368 | - return event_time_; |
2369 | + return std::chrono::nanoseconds{event.asReader().getMotionSet().getEventTime().getCount()}; |
2370 | } |
2371 | |
2372 | void MirMotionEvent::set_event_time(std::chrono::nanoseconds const& event_time) |
2373 | { |
2374 | - event_time_ = event_time; |
2375 | -} |
2376 | - |
2377 | -mir::cookie::Blob MirMotionEvent::cookie() const |
2378 | -{ |
2379 | - return cookie_; |
2380 | -} |
2381 | - |
2382 | -void MirMotionEvent::set_cookie(mir::cookie::Blob const& blob) |
2383 | -{ |
2384 | - cookie_ = blob; |
2385 | + event.getMotionSet().getEventTime().setCount(event_time.count()); |
2386 | +} |
2387 | + |
2388 | +std::vector<uint8_t> MirMotionEvent::cookie() const |
2389 | +{ |
2390 | + auto cookie = event.asReader().getMotionSet().getCookie(); |
2391 | + std::vector<uint8_t> vec_cookie(cookie.size()); |
2392 | + std::copy(std::begin(cookie), std::end(cookie), std::begin(vec_cookie)); |
2393 | + |
2394 | + return vec_cookie; |
2395 | +} |
2396 | + |
2397 | +void MirMotionEvent::set_cookie(std::vector<uint8_t> const& cookie) |
2398 | +{ |
2399 | + ::capnp::Data::Reader cookie_data(cookie.data(), cookie.size()); |
2400 | + event.getMotionSet().setCookie(cookie_data); |
2401 | } |
2402 | |
2403 | size_t MirMotionEvent::pointer_count() const |
2404 | { |
2405 | - return pointer_count_; |
2406 | + return event.asReader().getMotionSet().getCount(); |
2407 | } |
2408 | |
2409 | void MirMotionEvent::set_pointer_count(size_t count) |
2410 | { |
2411 | - pointer_count_ = count; |
2412 | + return event.getMotionSet().setCount(count); |
2413 | +} |
2414 | + |
2415 | +void MirMotionEvent::throw_if_out_of_bounds(size_t index) const |
2416 | +{ |
2417 | + if (index > event.asReader().getMotionSet().getCount()) |
2418 | + BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2419 | } |
2420 | |
2421 | int MirMotionEvent::id(size_t index) const |
2422 | { |
2423 | - if (index > pointer_count_) |
2424 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2425 | + throw_if_out_of_bounds(index); |
2426 | |
2427 | - return pointer_coordinates_[index].id; |
2428 | + return event.asReader().getMotionSet().getMotions()[index].getId(); |
2429 | } |
2430 | |
2431 | void MirMotionEvent::set_id(size_t index, int id) |
2432 | { |
2433 | - if (index > pointer_count_) |
2434 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2435 | + throw_if_out_of_bounds(index); |
2436 | |
2437 | - pointer_coordinates_[index].id = id; |
2438 | + event.getMotionSet().getMotions()[index].setId(id); |
2439 | } |
2440 | |
2441 | float MirMotionEvent::x(size_t index) const |
2442 | { |
2443 | - if (index > pointer_count_) |
2444 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2445 | + throw_if_out_of_bounds(index); |
2446 | |
2447 | - return pointer_coordinates_[index].x; |
2448 | + return event.asReader().getMotionSet().getMotions()[index].getX(); |
2449 | } |
2450 | |
2451 | void MirMotionEvent::set_x(size_t index, float x) |
2452 | { |
2453 | - if (index > pointer_count_) |
2454 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2455 | + throw_if_out_of_bounds(index); |
2456 | |
2457 | - pointer_coordinates_[index].x = x; |
2458 | + event.getMotionSet().getMotions()[index].setX(x); |
2459 | } |
2460 | |
2461 | float MirMotionEvent::y(size_t index) const |
2462 | { |
2463 | - if (index > pointer_count_) |
2464 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2465 | + throw_if_out_of_bounds(index); |
2466 | |
2467 | - return pointer_coordinates_[index].y; |
2468 | + return event.asReader().getMotionSet().getMotions()[index].getY(); |
2469 | } |
2470 | |
2471 | void MirMotionEvent::set_y(size_t index, float y) |
2472 | { |
2473 | - if (index > pointer_count_) |
2474 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2475 | + throw_if_out_of_bounds(index); |
2476 | |
2477 | - pointer_coordinates_[index].y = y; |
2478 | + event.getMotionSet().getMotions()[index].setY(y); |
2479 | } |
2480 | |
2481 | float MirMotionEvent::dx(size_t index) const |
2482 | { |
2483 | - if (index > pointer_count_) |
2484 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2485 | + throw_if_out_of_bounds(index); |
2486 | |
2487 | - return pointer_coordinates_[index].dx; |
2488 | + return event.asReader().getMotionSet().getMotions()[index].getDx(); |
2489 | } |
2490 | |
2491 | void MirMotionEvent::set_dx(size_t index, float dx) |
2492 | { |
2493 | - if (index > pointer_count_) |
2494 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2495 | + throw_if_out_of_bounds(index); |
2496 | |
2497 | - pointer_coordinates_[index].dx = dx; |
2498 | + event.getMotionSet().getMotions()[index].setDx(dx); |
2499 | } |
2500 | |
2501 | float MirMotionEvent::dy(size_t index) const |
2502 | { |
2503 | - if (index > pointer_count_) |
2504 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2505 | + throw_if_out_of_bounds(index); |
2506 | |
2507 | - return pointer_coordinates_[index].dy; |
2508 | + return event.asReader().getMotionSet().getMotions()[index].getDy(); |
2509 | } |
2510 | |
2511 | void MirMotionEvent::set_dy(size_t index, float dy) |
2512 | { |
2513 | - if (index > pointer_count_) |
2514 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2515 | + throw_if_out_of_bounds(index); |
2516 | |
2517 | - pointer_coordinates_[index].dy = dy; |
2518 | + event.getMotionSet().getMotions()[index].setDy(dy); |
2519 | } |
2520 | |
2521 | float MirMotionEvent::touch_major(size_t index) const |
2522 | { |
2523 | - if (index > pointer_count_) |
2524 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2525 | + throw_if_out_of_bounds(index); |
2526 | |
2527 | - return pointer_coordinates_[index].touch_major; |
2528 | + return event.asReader().getMotionSet().getMotions()[index].getTouchMajor(); |
2529 | } |
2530 | |
2531 | void MirMotionEvent::set_touch_major(size_t index, float major) |
2532 | { |
2533 | - if (index > pointer_count_) |
2534 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2535 | + throw_if_out_of_bounds(index); |
2536 | |
2537 | - pointer_coordinates_[index].touch_major = major; |
2538 | + event.getMotionSet().getMotions()[index].setTouchMajor(major); |
2539 | } |
2540 | |
2541 | float MirMotionEvent::touch_minor(size_t index) const |
2542 | { |
2543 | - if (index > pointer_count_) |
2544 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2545 | + throw_if_out_of_bounds(index); |
2546 | |
2547 | - return pointer_coordinates_[index].touch_minor; |
2548 | + return event.asReader().getMotionSet().getMotions()[index].getTouchMinor(); |
2549 | } |
2550 | |
2551 | void MirMotionEvent::set_touch_minor(size_t index, float minor) |
2552 | { |
2553 | - if (index > pointer_count_) |
2554 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2555 | + throw_if_out_of_bounds(index); |
2556 | |
2557 | - pointer_coordinates_[index].touch_minor = minor; |
2558 | + event.getMotionSet().getMotions()[index].setTouchMinor(minor); |
2559 | } |
2560 | |
2561 | float MirMotionEvent::size(size_t index) const |
2562 | { |
2563 | - if (index > pointer_count_) |
2564 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2565 | + throw_if_out_of_bounds(index); |
2566 | |
2567 | - return pointer_coordinates_[index].size; |
2568 | + return event.asReader().getMotionSet().getMotions()[index].getSize(); |
2569 | } |
2570 | |
2571 | void MirMotionEvent::set_size(size_t index, float size) |
2572 | { |
2573 | - if (index > pointer_count_) |
2574 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2575 | + throw_if_out_of_bounds(index); |
2576 | |
2577 | - pointer_coordinates_[index].size = size; |
2578 | + event.getMotionSet().getMotions()[index].setSize(size); |
2579 | } |
2580 | |
2581 | float MirMotionEvent::pressure(size_t index) const |
2582 | { |
2583 | - if (index > pointer_count_) |
2584 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2585 | + throw_if_out_of_bounds(index); |
2586 | |
2587 | - return pointer_coordinates_[index].pressure; |
2588 | + return event.asReader().getMotionSet().getMotions()[index].getPressure(); |
2589 | } |
2590 | |
2591 | void MirMotionEvent::set_pressure(size_t index, float pressure) |
2592 | { |
2593 | - if (index > pointer_count_) |
2594 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2595 | + throw_if_out_of_bounds(index); |
2596 | |
2597 | - pointer_coordinates_[index].pressure = pressure; |
2598 | + event.getMotionSet().getMotions()[index].setPressure(pressure); |
2599 | } |
2600 | |
2601 | float MirMotionEvent::orientation(size_t index) const |
2602 | { |
2603 | - if (index > pointer_count_) |
2604 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2605 | + throw_if_out_of_bounds(index); |
2606 | |
2607 | - return pointer_coordinates_[index].orientation; |
2608 | + return event.asReader().getMotionSet().getMotions()[index].getOrientation(); |
2609 | } |
2610 | |
2611 | void MirMotionEvent::set_orientation(size_t index, float orientation) |
2612 | { |
2613 | - if (index > pointer_count_) |
2614 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2615 | + throw_if_out_of_bounds(index); |
2616 | |
2617 | - pointer_coordinates_[index].orientation = orientation; |
2618 | + event.getMotionSet().getMotions()[index].setOrientation(orientation); |
2619 | } |
2620 | |
2621 | float MirMotionEvent::vscroll(size_t index) const |
2622 | { |
2623 | - if (index > pointer_count_) |
2624 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2625 | + throw_if_out_of_bounds(index); |
2626 | |
2627 | - return pointer_coordinates_[index].vscroll; |
2628 | + return event.asReader().getMotionSet().getMotions()[index].getVscroll(); |
2629 | } |
2630 | |
2631 | void MirMotionEvent::set_vscroll(size_t index, float vscroll) |
2632 | { |
2633 | - if (index > pointer_count_) |
2634 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2635 | + throw_if_out_of_bounds(index); |
2636 | |
2637 | - pointer_coordinates_[index].vscroll = vscroll; |
2638 | + event.getMotionSet().getMotions()[index].setVscroll(vscroll); |
2639 | } |
2640 | |
2641 | float MirMotionEvent::hscroll(size_t index) const |
2642 | { |
2643 | - if (index > pointer_count_) |
2644 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2645 | + throw_if_out_of_bounds(index); |
2646 | |
2647 | - return pointer_coordinates_[index].hscroll; |
2648 | + return event.asReader().getMotionSet().getMotions()[index].getHscroll(); |
2649 | } |
2650 | |
2651 | void MirMotionEvent::set_hscroll(size_t index, float hscroll) |
2652 | { |
2653 | - if (index > pointer_count_) |
2654 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2655 | + throw_if_out_of_bounds(index); |
2656 | |
2657 | - pointer_coordinates_[index].hscroll = hscroll; |
2658 | + event.getMotionSet().getMotions()[index].setHscroll(hscroll); |
2659 | } |
2660 | |
2661 | MirTouchTooltype MirMotionEvent::tool_type(size_t index) const |
2662 | { |
2663 | - if (index > pointer_count_) |
2664 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2665 | + throw_if_out_of_bounds(index); |
2666 | |
2667 | - return pointer_coordinates_[index].tool_type; |
2668 | + return static_cast<MirTouchTooltype>(event.asReader().getMotionSet().getMotions()[index].getToolType()); |
2669 | } |
2670 | |
2671 | void MirMotionEvent::set_tool_type(size_t index, MirTouchTooltype tool_type) |
2672 | { |
2673 | - if (index > pointer_count_) |
2674 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2675 | + throw_if_out_of_bounds(index); |
2676 | |
2677 | - pointer_coordinates_[index].tool_type = tool_type; |
2678 | + auto capnp_tool_type = static_cast<mir::capnp::MotionSetEvent::Motion::ToolType>(tool_type); |
2679 | + event.getMotionSet().getMotions()[index].setToolType(capnp_tool_type); |
2680 | } |
2681 | |
2682 | int MirMotionEvent::action(size_t index) const |
2683 | { |
2684 | - if (index > pointer_count_) |
2685 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2686 | + throw_if_out_of_bounds(index); |
2687 | |
2688 | - return pointer_coordinates_[index].action; |
2689 | + return event.asReader().getMotionSet().getMotions()[index].getAction(); |
2690 | } |
2691 | |
2692 | void MirMotionEvent::set_action(size_t index, int action) |
2693 | { |
2694 | - if (index > pointer_count_) |
2695 | - BOOST_THROW_EXCEPTION(std::out_of_range("Out of bounds index in pointer coordinates")); |
2696 | + throw_if_out_of_bounds(index); |
2697 | |
2698 | - pointer_coordinates_[index].action = action; |
2699 | + event.getMotionSet().getMotions()[index].setAction(action); |
2700 | } |
2701 | |
2702 | MirTouchEvent* MirMotionEvent::to_touch() |
2703 | |
2704 | === modified file 'src/common/events/orientation_event.cpp' |
2705 | --- src/common/events/orientation_event.cpp 2016-03-29 03:41:45 +0000 |
2706 | +++ src/common/events/orientation_event.cpp 2016-09-22 20:34:39 +0000 |
2707 | @@ -18,27 +18,27 @@ |
2708 | |
2709 | #include "mir/events/orientation_event.h" |
2710 | |
2711 | -MirOrientationEvent::MirOrientationEvent() : |
2712 | - MirEvent(mir_event_type_orientation) |
2713 | +MirOrientationEvent::MirOrientationEvent() |
2714 | { |
2715 | + event.initOrientation(); |
2716 | } |
2717 | |
2718 | int MirOrientationEvent::surface_id() const |
2719 | { |
2720 | - return surface_id_; |
2721 | + return event.asReader().getOrientation().getSurfaceId(); |
2722 | } |
2723 | |
2724 | void MirOrientationEvent::set_surface_id(int id) |
2725 | { |
2726 | - surface_id_ = id; |
2727 | + event.getOrientation().setSurfaceId(id); |
2728 | } |
2729 | |
2730 | MirOrientation MirOrientationEvent::direction() const |
2731 | { |
2732 | - return direction_; |
2733 | + return static_cast<MirOrientation>(event.asReader().getOrientation().getDirection()); |
2734 | } |
2735 | |
2736 | void MirOrientationEvent::set_direction(MirOrientation orientation) |
2737 | { |
2738 | - direction_ = orientation; |
2739 | + event.getOrientation().setDirection(orientation); |
2740 | } |
2741 | |
2742 | === modified file 'src/common/events/prompt_session_event.cpp' |
2743 | --- src/common/events/prompt_session_event.cpp 2016-03-29 03:41:45 +0000 |
2744 | +++ src/common/events/prompt_session_event.cpp 2016-09-22 20:34:39 +0000 |
2745 | @@ -18,17 +18,17 @@ |
2746 | |
2747 | #include "mir/events/prompt_session_event.h" |
2748 | |
2749 | -MirPromptSessionEvent::MirPromptSessionEvent() : |
2750 | - MirEvent(mir_event_type_prompt_session_state_change) |
2751 | +MirPromptSessionEvent::MirPromptSessionEvent() |
2752 | { |
2753 | + event.initPromptSession(); |
2754 | } |
2755 | |
2756 | MirPromptSessionState MirPromptSessionEvent::new_state() const |
2757 | { |
2758 | - return new_state_; |
2759 | + return static_cast<MirPromptSessionState>(event.asReader().getPromptSession().getNewState()); |
2760 | } |
2761 | |
2762 | void MirPromptSessionEvent::set_new_state(MirPromptSessionState state) |
2763 | { |
2764 | - new_state_ = state; |
2765 | + event.getPromptSession().setNewState(static_cast<mir::capnp::PromptSessionEvent::State>(state)); |
2766 | } |
2767 | |
2768 | === modified file 'src/common/events/resize_event.cpp' |
2769 | --- src/common/events/resize_event.cpp 2016-03-29 03:41:45 +0000 |
2770 | +++ src/common/events/resize_event.cpp 2016-09-22 20:34:39 +0000 |
2771 | @@ -18,37 +18,37 @@ |
2772 | |
2773 | #include "mir/events/resize_event.h" |
2774 | |
2775 | -MirResizeEvent::MirResizeEvent() : |
2776 | - MirEvent(mir_event_type_resize) |
2777 | +MirResizeEvent::MirResizeEvent() |
2778 | { |
2779 | + event.initResize(); |
2780 | } |
2781 | |
2782 | int MirResizeEvent::surface_id() const |
2783 | { |
2784 | - return surface_id_; |
2785 | + return event.asReader().getResize().getSurfaceId(); |
2786 | } |
2787 | |
2788 | void MirResizeEvent::set_surface_id(int id) |
2789 | { |
2790 | - surface_id_ = id; |
2791 | + event.getResize().setSurfaceId(id); |
2792 | } |
2793 | |
2794 | int MirResizeEvent::width() const |
2795 | { |
2796 | - return width_; |
2797 | + return event.asReader().getResize().getWidth(); |
2798 | } |
2799 | |
2800 | void MirResizeEvent::set_width(int width) |
2801 | { |
2802 | - width_ = width; |
2803 | + event.getResize().setWidth(width); |
2804 | } |
2805 | |
2806 | int MirResizeEvent::height() const |
2807 | { |
2808 | - return height_; |
2809 | + return event.asReader().getResize().getHeight(); |
2810 | } |
2811 | |
2812 | void MirResizeEvent::set_height(int height) |
2813 | { |
2814 | - height_ = height; |
2815 | + event.getResize().setHeight(height); |
2816 | } |
2817 | |
2818 | === modified file 'src/common/events/surface_event.cpp' |
2819 | --- src/common/events/surface_event.cpp 2016-03-29 03:41:45 +0000 |
2820 | +++ src/common/events/surface_event.cpp 2016-09-22 20:34:39 +0000 |
2821 | @@ -18,37 +18,37 @@ |
2822 | |
2823 | #include "mir/events/surface_event.h" |
2824 | |
2825 | -MirSurfaceEvent::MirSurfaceEvent() : |
2826 | - MirEvent(mir_event_type_surface) |
2827 | +MirSurfaceEvent::MirSurfaceEvent() |
2828 | { |
2829 | + event.initSurface(); |
2830 | } |
2831 | |
2832 | int MirSurfaceEvent::id() const |
2833 | { |
2834 | - return id_; |
2835 | + return event.asReader().getSurface().getId(); |
2836 | } |
2837 | |
2838 | void MirSurfaceEvent::set_id(int id) |
2839 | { |
2840 | - id_ = id; |
2841 | + event.getSurface().setId(id); |
2842 | } |
2843 | |
2844 | MirSurfaceAttrib MirSurfaceEvent::attrib() const |
2845 | { |
2846 | - return attrib_; |
2847 | + return static_cast<MirSurfaceAttrib>(event.asReader().getSurface().getAttrib()); |
2848 | } |
2849 | |
2850 | void MirSurfaceEvent::set_attrib(MirSurfaceAttrib attrib) |
2851 | { |
2852 | - attrib_ = attrib; |
2853 | + event.getSurface().setAttrib(static_cast<mir::capnp::SurfaceEvent::Attrib>(attrib)); |
2854 | } |
2855 | |
2856 | int MirSurfaceEvent::value() const |
2857 | { |
2858 | - return value_; |
2859 | + return event.asReader().getSurface().getValue(); |
2860 | } |
2861 | |
2862 | void MirSurfaceEvent::set_value(int value) |
2863 | { |
2864 | - value_ = value; |
2865 | + event.getSurface().setValue(value); |
2866 | } |
2867 | |
2868 | === modified file 'src/common/events/surface_output_event.cpp' |
2869 | --- src/common/events/surface_output_event.cpp 2016-03-29 03:41:45 +0000 |
2870 | +++ src/common/events/surface_output_event.cpp 2016-09-22 20:34:39 +0000 |
2871 | @@ -18,57 +18,57 @@ |
2872 | |
2873 | #include "mir/events/surface_output_event.h" |
2874 | |
2875 | -MirSurfaceOutputEvent::MirSurfaceOutputEvent() : |
2876 | - MirEvent(mir_event_type_surface_output) |
2877 | +MirSurfaceOutputEvent::MirSurfaceOutputEvent() |
2878 | { |
2879 | + event.initSurfaceOutput(); |
2880 | } |
2881 | |
2882 | int MirSurfaceOutputEvent::surface_id() const |
2883 | { |
2884 | - return surface_id_; |
2885 | + return event.asReader().getSurfaceOutput().getSurfaceId(); |
2886 | } |
2887 | |
2888 | void MirSurfaceOutputEvent::set_surface_id(int id) |
2889 | { |
2890 | - surface_id_ = id; |
2891 | + event.getSurfaceOutput().setSurfaceId(id); |
2892 | } |
2893 | |
2894 | int MirSurfaceOutputEvent::dpi() const |
2895 | { |
2896 | - return dpi_; |
2897 | + return event.asReader().getSurfaceOutput().getDpi(); |
2898 | } |
2899 | |
2900 | void MirSurfaceOutputEvent::set_dpi(int dpi) |
2901 | { |
2902 | - dpi_ = dpi; |
2903 | + event.getSurfaceOutput().setDpi(dpi); |
2904 | } |
2905 | |
2906 | float MirSurfaceOutputEvent::scale() const |
2907 | { |
2908 | - return scale_; |
2909 | + return event.asReader().getSurfaceOutput().getScale(); |
2910 | } |
2911 | |
2912 | void MirSurfaceOutputEvent::set_scale(float scale) |
2913 | { |
2914 | - scale_ = scale; |
2915 | + event.getSurfaceOutput().setScale(scale); |
2916 | } |
2917 | |
2918 | MirFormFactor MirSurfaceOutputEvent::form_factor() const |
2919 | { |
2920 | - return form_factor_; |
2921 | + return static_cast<MirFormFactor>(event.asReader().getSurfaceOutput().getFormFactor()); |
2922 | } |
2923 | |
2924 | void MirSurfaceOutputEvent::set_form_factor(MirFormFactor factor) |
2925 | { |
2926 | - form_factor_ = factor; |
2927 | + event.getSurfaceOutput().setFormFactor(static_cast<mir::capnp::SurfaceOutputEvent::FormFactor>(factor)); |
2928 | } |
2929 | |
2930 | uint32_t MirSurfaceOutputEvent::output_id() const |
2931 | { |
2932 | - return output_id_; |
2933 | + return event.asReader().getSurfaceOutput().getOutputId(); |
2934 | } |
2935 | |
2936 | void MirSurfaceOutputEvent::set_output_id(uint32_t id) |
2937 | { |
2938 | - output_id_ = id; |
2939 | + event.getSurfaceOutput().setOutputId(id); |
2940 | } |
2941 | |
2942 | === modified file 'src/common/events/surface_placement_event.cpp' |
2943 | --- src/common/events/surface_placement_event.cpp 2016-09-12 14:18:39 +0000 |
2944 | +++ src/common/events/surface_placement_event.cpp 2016-09-22 20:34:39 +0000 |
2945 | @@ -18,29 +18,34 @@ |
2946 | |
2947 | #include "mir/events/surface_placement_event.h" |
2948 | |
2949 | -MirSurfacePlacementEvent::MirSurfacePlacementEvent() : |
2950 | - MirEvent(mir_event_type_surface_placement) |
2951 | +MirSurfacePlacementEvent::MirSurfacePlacementEvent() |
2952 | { |
2953 | + event.initSurfacePlacement(); |
2954 | } |
2955 | |
2956 | int MirSurfacePlacementEvent::id() const |
2957 | { |
2958 | - return id_; |
2959 | + return event.asReader().getSurfacePlacement().getId(); |
2960 | } |
2961 | |
2962 | void MirSurfacePlacementEvent::set_id(int const id) |
2963 | { |
2964 | - id_ = id; |
2965 | + event.getSurfacePlacement().setId(id); |
2966 | } |
2967 | |
2968 | MirRectangle MirSurfacePlacementEvent::placement() const |
2969 | { |
2970 | - return placement_; |
2971 | + auto rect = event.asReader().getSurfacePlacement().getRectangle(); |
2972 | + return {rect.getLeft(), rect.getTop(), rect.getWidth(), rect.getHeight()}; |
2973 | } |
2974 | |
2975 | void MirSurfacePlacementEvent::set_placement(MirRectangle const& placement) |
2976 | { |
2977 | - placement_ = placement; |
2978 | + auto rect = event.getSurfacePlacement().getRectangle(); |
2979 | + rect.setLeft(placement.left); |
2980 | + rect.setTop(placement.top); |
2981 | + rect.setWidth(placement.width); |
2982 | + rect.setHeight(placement.height); |
2983 | } |
2984 | |
2985 | MirSurfacePlacementEvent const* MirEvent::to_surface_placement() const |
2986 | |
2987 | === modified file 'src/common/symbols.map' |
2988 | --- src/common/symbols.map 2016-09-22 20:34:38 +0000 |
2989 | +++ src/common/symbols.map 2016-09-22 20:34:39 +0000 |
2990 | @@ -360,9 +360,6 @@ |
2991 | android::InputPublisher::publishEventBuffer*; |
2992 | MirEvent::to_input_device_state*; |
2993 | MirInputDeviceStateEvent::MirInputDeviceStateEvent*; |
2994 | - MirInputDeviceStateEvent::add_device*; |
2995 | - MirInputDeviceStateEvent::clone*; |
2996 | - MirInputDeviceStateEvent::deserialize*; |
2997 | MirInputDeviceStateEvent::device_count*; |
2998 | MirInputDeviceStateEvent::device_id*; |
2999 | MirInputDeviceStateEvent::device_pointer_buttons*; |
3000 | @@ -370,7 +367,6 @@ |
3001 | MirInputDeviceStateEvent::modifiers*; |
3002 | MirInputDeviceStateEvent::pointer_axis*; |
3003 | MirInputDeviceStateEvent::pointer_buttons*; |
3004 | - MirInputDeviceStateEvent::serialize*; |
3005 | MirInputDeviceStateEvent::set_modifiers*; |
3006 | MirInputDeviceStateEvent::set_pointer_axis*; |
3007 | MirInputDeviceStateEvent::set_pointer_buttons*; |
3008 | @@ -389,6 +385,12 @@ |
3009 | MIR_COMMON_0.25 { |
3010 | global: |
3011 | extern "C++" { |
3012 | + MirEvent::MirEvent*; |
3013 | + MirEvent::operator*; |
3014 | + MirInputEvent::operator*; |
3015 | + MirInputDeviceStateEvent::set_device_states*; |
3016 | + MirInputDeviceStateEvent::device_pressed_keys_for_index*; |
3017 | + mir::event::store_data_for_lifetime_of_event*; |
3018 | MirSurfacePlacementEvent::MirSurfacePlacementEvent*; |
3019 | MirSurfacePlacementEvent::id*; |
3020 | MirSurfacePlacementEvent::set_id*; |
3021 | |
3022 | === modified file 'src/include/common/mir/events/close_surface_event.h' |
3023 | --- src/include/common/mir/events/close_surface_event.h 2016-03-30 18:47:45 +0000 |
3024 | +++ src/include/common/mir/events/close_surface_event.h 2016-09-22 20:34:39 +0000 |
3025 | @@ -27,9 +27,6 @@ |
3026 | |
3027 | int surface_id() const; |
3028 | void set_surface_id(int id); |
3029 | - |
3030 | -private: |
3031 | - int surface_id_{-1}; |
3032 | }; |
3033 | |
3034 | #endif /* MIR_COMMON_CLOSE_SURFACE_EVENT_H_ */ |
3035 | |
3036 | === modified file 'src/include/common/mir/events/event.h' |
3037 | --- src/include/common/mir/events/event.h 2016-09-19 04:16:15 +0000 |
3038 | +++ src/include/common/mir/events/event.h 2016-09-22 20:34:39 +0000 |
3039 | @@ -21,6 +21,9 @@ |
3040 | |
3041 | #include "mir_toolkit/event.h" |
3042 | #include "mir/events/event_builders.h" |
3043 | +#include "mir_event.capnp.h" |
3044 | + |
3045 | +#include <capnp/message.h> |
3046 | |
3047 | #include <cstring> |
3048 | |
3049 | @@ -29,6 +32,9 @@ |
3050 | |
3051 | struct MirEvent |
3052 | { |
3053 | + MirEvent(MirEvent const& event); |
3054 | + MirEvent& operator=(MirEvent const& event); |
3055 | + |
3056 | MirEventType type() const; |
3057 | |
3058 | MirInputEvent* to_input(); |
3059 | @@ -70,69 +76,9 @@ |
3060 | |
3061 | protected: |
3062 | MirEvent() = default; |
3063 | - explicit MirEvent(MirEventType type); |
3064 | - MirEvent(MirEvent const& event) = default; |
3065 | - MirEvent& operator=(MirEvent const& event) = default; |
3066 | |
3067 | - MirEventType type_; |
3068 | + ::capnp::MallocMessageBuilder message; |
3069 | + mir::capnp::Event::Builder event{message.initRoot<mir::capnp::Event>()}; |
3070 | }; |
3071 | |
3072 | -namespace mir |
3073 | -{ |
3074 | -namespace event |
3075 | -{ |
3076 | -template<typename Data> |
3077 | -char const* consume(char const* pos, Data& data) |
3078 | -{ |
3079 | - std::memcpy(&data, pos, sizeof data); |
3080 | - return pos + sizeof data; |
3081 | -} |
3082 | - |
3083 | -template<typename T> |
3084 | -void assert_type_is_trivially_copyable() |
3085 | -{ |
3086 | -#if __GNUC__ >= 5 |
3087 | - static_assert(std::is_trivially_copyable<T>::value, ""); |
3088 | -#else |
3089 | - static_assert(__has_trivial_copy(T), ""); |
3090 | -#endif |
3091 | -} |
3092 | - |
3093 | -// T needs to be trivially copyable |
3094 | -// vivid wont allow a std::is_trivially_copyable |
3095 | -template<typename T> |
3096 | -mir::EventUPtr deserialize_from(std::string const& bytes) |
3097 | -{ |
3098 | - assert_type_is_trivially_copyable<T>(); |
3099 | - |
3100 | - T* t = new T; |
3101 | - memcpy(t, bytes.data(), bytes.size()); |
3102 | - |
3103 | - return mir::EventUPtr(t, [](MirEvent* e) { delete e; }); |
3104 | -} |
3105 | - |
3106 | -template<typename T> |
3107 | -std::string serialize_from(MirEvent const* ev) |
3108 | -{ |
3109 | - assert_type_is_trivially_copyable<T>(); |
3110 | - |
3111 | - std::string encoded_bytes; |
3112 | - encoded_bytes.append(reinterpret_cast<char const*>(ev), sizeof(T)); |
3113 | - |
3114 | - return encoded_bytes; |
3115 | -} |
3116 | - |
3117 | -template<typename T> |
3118 | -MirEvent* deep_copy(MirEvent const* ev) |
3119 | -{ |
3120 | - assert_type_is_trivially_copyable<T>(); |
3121 | - |
3122 | - T* t = new T; |
3123 | - memcpy(t, ev, sizeof(T)); |
3124 | - |
3125 | - return t; |
3126 | -} |
3127 | -} |
3128 | -} |
3129 | - |
3130 | #endif /* MIR_COMMON_EVENT_H_ */ |
3131 | |
3132 | === modified file 'src/include/common/mir/events/input_configuration_event.h' |
3133 | --- src/include/common/mir/events/input_configuration_event.h 2016-03-30 19:01:10 +0000 |
3134 | +++ src/include/common/mir/events/input_configuration_event.h 2016-09-22 20:34:39 +0000 |
3135 | @@ -20,7 +20,6 @@ |
3136 | #define MIR_COMMON_INPUT_CONFIGURATION_EVENT_H_ |
3137 | |
3138 | #include <chrono> |
3139 | -#include <limits> |
3140 | |
3141 | #include "mir/events/event.h" |
3142 | |
3143 | @@ -36,11 +35,6 @@ |
3144 | |
3145 | MirInputDeviceId id() const; |
3146 | void set_id(MirInputDeviceId id); |
3147 | - |
3148 | -private: |
3149 | - MirInputConfigurationAction action_; |
3150 | - std::chrono::nanoseconds when_{0}; |
3151 | - MirInputDeviceId id_{std::numeric_limits<MirInputDeviceId>::max()}; |
3152 | }; |
3153 | |
3154 | #endif /* MIR_COMMON_INPUT_CONFIGURATION_EVENT_H_ */ |
3155 | |
3156 | === modified file 'src/include/common/mir/events/input_device_state_event.h' |
3157 | --- src/include/common/mir/events/input_device_state_event.h 2016-09-22 20:34:38 +0000 |
3158 | +++ src/include/common/mir/events/input_device_state_event.h 2016-09-22 20:34:39 +0000 |
3159 | @@ -21,8 +21,9 @@ |
3160 | |
3161 | #include <chrono> |
3162 | #include <limits> |
3163 | - |
3164 | +#include <unordered_map> |
3165 | #include "mir/events/event.h" |
3166 | +#include "mir/events/input_device_state.h" |
3167 | |
3168 | struct MirInputDeviceStateEvent : MirEvent |
3169 | { |
3170 | @@ -46,30 +47,7 @@ |
3171 | uint32_t device_pressed_keys_for_index(size_t index, size_t pressed_index) const; |
3172 | uint32_t device_pressed_keys_count(size_t index) const; |
3173 | |
3174 | - static mir::EventUPtr deserialize(std::string const& bytes); |
3175 | - static std::string serialize(MirEvent const* event); |
3176 | - MirEvent* clone() const; |
3177 | - |
3178 | - void add_device(MirInputDeviceId id, std::vector<uint32_t> && pressed_keys, MirPointerButtons pointer_buttons); |
3179 | - |
3180 | -private: |
3181 | - std::chrono::nanoseconds when_{0}; |
3182 | - MirPointerButtons pointer_buttons_{0}; |
3183 | - MirInputEventModifiers modifiers_{0}; |
3184 | - |
3185 | - float pointer_x{0.0f}; |
3186 | - float pointer_y{0.0f}; |
3187 | - |
3188 | - struct DeviceState |
3189 | - { |
3190 | - DeviceState(MirInputDeviceId id, std::vector<uint32_t> && pressed_keys, MirPointerButtons buttons) |
3191 | - : id{id}, pressed_keys{std::move(pressed_keys)}, pointer_buttons{buttons} |
3192 | - {} |
3193 | - MirInputDeviceId id; |
3194 | - std::vector<uint32_t> pressed_keys; |
3195 | - MirPointerButtons pointer_buttons; |
3196 | - }; |
3197 | - std::vector<DeviceState> devices; |
3198 | + void set_device_states(std::vector<mir::events::InputDeviceState> const& device_states); |
3199 | }; |
3200 | |
3201 | #endif /* MIR_COMMON_INPUT_DEVICE_STATE_EVENT_H_*/ |
3202 | |
3203 | === modified file 'src/include/common/mir/events/input_event.h' |
3204 | --- src/include/common/mir/events/input_event.h 2016-03-29 03:41:45 +0000 |
3205 | +++ src/include/common/mir/events/input_event.h 2016-09-22 20:34:39 +0000 |
3206 | @@ -31,7 +31,6 @@ |
3207 | |
3208 | protected: |
3209 | MirInputEvent() = default; |
3210 | - explicit MirInputEvent(MirEventType type); |
3211 | MirInputEvent(MirInputEvent const& event) = default; |
3212 | MirInputEvent& operator=(MirInputEvent const& event) = default; |
3213 | }; |
3214 | |
3215 | === modified file 'src/include/common/mir/events/keyboard_event.h' |
3216 | --- src/include/common/mir/events/keyboard_event.h 2016-03-30 18:47:45 +0000 |
3217 | +++ src/include/common/mir/events/keyboard_event.h 2016-09-22 20:34:39 +0000 |
3218 | @@ -21,9 +21,9 @@ |
3219 | |
3220 | #include <chrono> |
3221 | #include <cstdint> |
3222 | +#include <vector> |
3223 | |
3224 | #include "mir/events/input_event.h" |
3225 | -#include "mir/cookie/blob.h" |
3226 | |
3227 | struct MirKeyboardEvent : MirInputEvent |
3228 | { |
3229 | @@ -50,20 +50,8 @@ |
3230 | std::chrono::nanoseconds event_time() const; |
3231 | void set_event_time(std::chrono::nanoseconds const& event_time); |
3232 | |
3233 | - mir::cookie::Blob cookie() const; |
3234 | - void set_cookie(mir::cookie::Blob const& cookie); |
3235 | - |
3236 | -private: |
3237 | - int32_t device_id_{-1}; |
3238 | - int32_t source_id_{-1}; |
3239 | - MirKeyboardAction action_; |
3240 | - MirInputEventModifiers modifiers_{0}; |
3241 | - |
3242 | - int32_t key_code_{0}; |
3243 | - int32_t scan_code_{0}; |
3244 | - |
3245 | - std::chrono::nanoseconds event_time_{0}; |
3246 | - mir::cookie::Blob cookie_; |
3247 | + std::vector<uint8_t> cookie() const; |
3248 | + void set_cookie(std::vector<uint8_t> const& cookie); |
3249 | }; |
3250 | |
3251 | #endif /* MIR_COMMON_KEYBOARD_EVENT_H_ */ |
3252 | |
3253 | === modified file 'src/include/common/mir/events/keymap_event.h' |
3254 | --- src/include/common/mir/events/keymap_event.h 2016-03-30 19:01:10 +0000 |
3255 | +++ src/include/common/mir/events/keymap_event.h 2016-09-22 20:34:39 +0000 |
3256 | @@ -20,7 +20,6 @@ |
3257 | #define MIR_COMMON_KEYMAP_EVENT_H_ |
3258 | |
3259 | #include <xkbcommon/xkbcommon.h> |
3260 | -#include <limits> |
3261 | |
3262 | #include "mir/events/event.h" |
3263 | |
3264 | @@ -35,26 +34,9 @@ |
3265 | void set_device_id(MirInputDeviceId id); |
3266 | |
3267 | char const* buffer() const; |
3268 | - /* FIXME We takes over ownership of the buffer pointer, but we should not be. |
3269 | - Either user a unique_ptr here later (when we dont depend on is_trivially_copyable) |
3270 | - or copy it into a vector or do a deep copy. |
3271 | - */ |
3272 | void set_buffer(char const* buffer); |
3273 | - void free_buffer(); |
3274 | |
3275 | size_t size() const; |
3276 | - void set_size(size_t size); |
3277 | - |
3278 | - /* FIXME Need to handle the special case of Keymap events due to char const* buffer */ |
3279 | - static mir::EventUPtr deserialize(std::string const& bytes); |
3280 | - static std::string serialize(MirEvent const* event); |
3281 | - MirEvent* clone() const; |
3282 | - |
3283 | -private: |
3284 | - int surface_id_{-1}; |
3285 | - MirInputDeviceId device_id_{std::numeric_limits<MirInputDeviceId>::max()}; |
3286 | - char const* buffer_{nullptr}; |
3287 | - size_t size_{0}; |
3288 | }; |
3289 | |
3290 | #endif /* MIR_COMMON_KEYMAP_EVENT_H_ */ |
3291 | |
3292 | === modified file 'src/include/common/mir/events/motion_event.h' |
3293 | --- src/include/common/mir/events/motion_event.h 2016-03-30 18:47:45 +0000 |
3294 | +++ src/include/common/mir/events/motion_event.h 2016-09-22 20:34:39 +0000 |
3295 | @@ -19,35 +19,10 @@ |
3296 | #ifndef MIR_COMMON_MOTION_EVENT_H_ |
3297 | #define MIR_COMMON_MOTION_EVENT_H_ |
3298 | |
3299 | -/* TODO: To the moon. */ |
3300 | -#define MIR_INPUT_EVENT_MAX_POINTER_COUNT 16 |
3301 | - |
3302 | #include <chrono> |
3303 | #include <cstdint> |
3304 | |
3305 | #include "mir/events/input_event.h" |
3306 | -#include "mir/cookie/blob.h" |
3307 | - |
3308 | -struct MirMotionPointer |
3309 | -{ |
3310 | - int id; |
3311 | - float x; |
3312 | - float y; |
3313 | - float dx; |
3314 | - float dy; |
3315 | - float touch_major; |
3316 | - float touch_minor; |
3317 | - float size; |
3318 | - float pressure; |
3319 | - float orientation; |
3320 | - float vscroll; |
3321 | - float hscroll; |
3322 | - MirTouchTooltype tool_type; |
3323 | - |
3324 | - // TODO: We would like to store this as a MirTouchAction but we still encode pointer actions |
3325 | - // here as well. |
3326 | - int action; |
3327 | -}; |
3328 | |
3329 | struct MirMotionEvent : MirInputEvent |
3330 | { |
3331 | @@ -68,8 +43,8 @@ |
3332 | std::chrono::nanoseconds event_time() const; |
3333 | void set_event_time(std::chrono::nanoseconds const& event_time); |
3334 | |
3335 | - mir::cookie::Blob cookie() const; |
3336 | - void set_cookie(mir::cookie::Blob const& blob); |
3337 | + std::vector<uint8_t> cookie() const; |
3338 | + void set_cookie(std::vector<uint8_t> const& cookie); |
3339 | |
3340 | size_t pointer_count() const; |
3341 | void set_pointer_count(size_t count); |
3342 | @@ -123,19 +98,8 @@ |
3343 | MirPointerEvent const* to_pointer() const; |
3344 | |
3345 | private: |
3346 | - int32_t device_id_{-1}; |
3347 | - int32_t source_id_{-1}; |
3348 | - |
3349 | - MirInputEventModifiers modifiers_{0}; |
3350 | - |
3351 | - MirPointerButtons buttons_{0}; |
3352 | - std::chrono::nanoseconds event_time_{0}; |
3353 | - mir::cookie::Blob cookie_; |
3354 | - |
3355 | - size_t pointer_count_{0}; |
3356 | - MirMotionPointer pointer_coordinates_[MIR_INPUT_EVENT_MAX_POINTER_COUNT]; |
3357 | - /* "_coordinates" is a misnomer here because there's plenty more info than |
3358 | - just coordinates, but renaming it accurately would be an API break */ |
3359 | + void throw_if_out_of_bounds(size_t index) const; |
3360 | + |
3361 | }; |
3362 | |
3363 | // These are left empty as they are just aliases for a MirMotionEvent, |
3364 | |
3365 | === modified file 'src/include/common/mir/events/orientation_event.h' |
3366 | --- src/include/common/mir/events/orientation_event.h 2016-03-30 18:47:45 +0000 |
3367 | +++ src/include/common/mir/events/orientation_event.h 2016-09-22 20:34:39 +0000 |
3368 | @@ -30,10 +30,6 @@ |
3369 | |
3370 | MirOrientation direction() const; |
3371 | void set_direction(MirOrientation orientation); |
3372 | - |
3373 | -private: |
3374 | - int surface_id_{-1}; |
3375 | - MirOrientation direction_; |
3376 | }; |
3377 | |
3378 | #endif /* MIR_COMMON_ORIENTATION_EVENT_H_ */ |
3379 | |
3380 | === modified file 'src/include/common/mir/events/prompt_session_event.h' |
3381 | --- src/include/common/mir/events/prompt_session_event.h 2016-03-29 03:41:45 +0000 |
3382 | +++ src/include/common/mir/events/prompt_session_event.h 2016-09-22 20:34:39 +0000 |
3383 | @@ -27,9 +27,6 @@ |
3384 | |
3385 | MirPromptSessionState new_state() const; |
3386 | void set_new_state(MirPromptSessionState state); |
3387 | - |
3388 | -private: |
3389 | - MirPromptSessionState new_state_; |
3390 | }; |
3391 | |
3392 | #endif /* MIR_COMMON_PROMPT_SESSION_EVENT_H_ */ |
3393 | |
3394 | === modified file 'src/include/common/mir/events/resize_event.h' |
3395 | --- src/include/common/mir/events/resize_event.h 2016-03-30 18:47:45 +0000 |
3396 | +++ src/include/common/mir/events/resize_event.h 2016-09-22 20:34:39 +0000 |
3397 | @@ -33,11 +33,6 @@ |
3398 | |
3399 | int height() const; |
3400 | void set_height(int height); |
3401 | - |
3402 | -private: |
3403 | - int surface_id_{-1}; |
3404 | - int width_{0}; |
3405 | - int height_{0}; |
3406 | }; |
3407 | |
3408 | #endif /* MIR_COMMON_RESIZE_EVENT_H_ */ |
3409 | |
3410 | === modified file 'src/include/common/mir/events/surface_event.h' |
3411 | --- src/include/common/mir/events/surface_event.h 2016-03-29 03:41:45 +0000 |
3412 | +++ src/include/common/mir/events/surface_event.h 2016-09-22 20:34:39 +0000 |
3413 | @@ -33,11 +33,6 @@ |
3414 | |
3415 | int value() const; |
3416 | void set_value(int value); |
3417 | - |
3418 | -private: |
3419 | - int id_{0}; |
3420 | - MirSurfaceAttrib attrib_; |
3421 | - int value_{0}; |
3422 | }; |
3423 | |
3424 | #endif /* MIR_COMMON_SURFACE_EVENT_H_ */ |
3425 | |
3426 | === modified file 'src/include/common/mir/events/surface_output_event.h' |
3427 | --- src/include/common/mir/events/surface_output_event.h 2016-03-30 19:01:10 +0000 |
3428 | +++ src/include/common/mir/events/surface_output_event.h 2016-09-22 20:34:39 +0000 |
3429 | @@ -20,7 +20,6 @@ |
3430 | #define MIR_COMMON_SURFACE_OUTPUT_EVENT_H_ |
3431 | |
3432 | #include <cstdint> |
3433 | -#include <limits> |
3434 | |
3435 | #include "mir/events/event.h" |
3436 | |
3437 | @@ -42,13 +41,6 @@ |
3438 | |
3439 | uint32_t output_id() const; |
3440 | void set_output_id(uint32_t id); |
3441 | - |
3442 | -private: |
3443 | - int surface_id_{-1}; |
3444 | - int dpi_{0}; |
3445 | - float scale_{0.0f}; |
3446 | - MirFormFactor form_factor_; |
3447 | - uint32_t output_id_{std::numeric_limits<uint32_t>::max()}; |
3448 | }; |
3449 | |
3450 | #endif /* MIR_COMMON_SURFACE_OUTPUT_EVENT_H_ */ |
3451 | |
3452 | === modified file 'src/include/common/mir/events/surface_placement_event.h' |
3453 | --- src/include/common/mir/events/surface_placement_event.h 2016-09-12 09:34:14 +0000 |
3454 | +++ src/include/common/mir/events/surface_placement_event.h 2016-09-22 20:34:39 +0000 |
3455 | @@ -31,10 +31,6 @@ |
3456 | |
3457 | MirRectangle placement() const; |
3458 | void set_placement(MirRectangle const& placement); |
3459 | - |
3460 | -private: |
3461 | - int id_{0}; |
3462 | - MirRectangle placement_; |
3463 | }; |
3464 | |
3465 | #endif //MIR_SURFACE_PLACEMENT_EVENT_H |
3466 | |
3467 | === modified file 'src/server/graphics/nested/input_platform.cpp' |
3468 | --- src/server/graphics/nested/input_platform.cpp 2016-09-22 20:34:38 +0000 |
3469 | +++ src/server/graphics/nested/input_platform.cpp 2016-09-22 20:34:39 +0000 |
3470 | @@ -229,7 +229,7 @@ |
3471 | { |
3472 | unknown_device_events[id].emplace_back( |
3473 | std::piecewise_construct, |
3474 | - std::forward_as_tuple(event.clone(), [](MirEvent* e){delete e;}), |
3475 | + std::forward_as_tuple(new MirEvent(event), [](MirEvent* e){delete e;}), |
3476 | std::forward_as_tuple(area)); |
3477 | } |
3478 | } |
3479 | |
3480 | === modified file 'src/server/input/android/input_sender.cpp' |
3481 | --- src/server/input/android/input_sender.cpp 2016-06-03 08:39:59 +0000 |
3482 | +++ src/server/input/android/input_sender.cpp 2016-09-22 20:34:39 +0000 |
3483 | @@ -38,6 +38,23 @@ |
3484 | |
3485 | namespace droidinput = android; |
3486 | |
3487 | +namespace |
3488 | +{ |
3489 | +// FIXME Temp, only needed to use the android input_sender/receiver |
3490 | +mir::cookie::Blob convert_cookie_to_blob(std::vector<uint8_t> const& cookie) |
3491 | +{ |
3492 | + if (cookie.size() > mir::cookie::default_blob_size) |
3493 | + { |
3494 | + BOOST_THROW_EXCEPTION(std::runtime_error("The cookie size must be less the mir::cookie::default_blob_size")); |
3495 | + } |
3496 | + |
3497 | + mir::cookie::Blob cookie_blob{{0}}; |
3498 | + std::copy(std::begin(cookie), std::end(cookie), std::begin(cookie_blob)); |
3499 | + |
3500 | + return cookie_blob; |
3501 | +} |
3502 | +} |
3503 | + |
3504 | mia::InputSender::InputSender(std::shared_ptr<mir::compositor::Scene> const& scene, |
3505 | std::shared_ptr<mir::MainLoop> const& main_loop, |
3506 | std::shared_ptr<InputReport> const& report) |
3507 | @@ -256,7 +273,7 @@ |
3508 | mir_keyboard_event_scan_code(key_event), |
3509 | mia::android_modifiers_from_mir(mir_keyboard_event_modifiers(key_event)), |
3510 | repeat_count, |
3511 | - event.to_input()->to_keyboard()->cookie(), |
3512 | + convert_cookie_to_blob(event.to_input()->to_keyboard()->cookie()), |
3513 | event_time, |
3514 | event_time); |
3515 | } |
3516 | @@ -264,8 +281,8 @@ |
3517 | droidinput::status_t mia::InputSender::ActiveTransfer::send_touch_event(uint32_t seq, MirEvent const& event) |
3518 | { |
3519 | droidinput::status_t ret = droidinput::OK; |
3520 | - droidinput::PointerCoords coords[MIR_INPUT_EVENT_MAX_POINTER_COUNT]; |
3521 | - droidinput::PointerProperties properties[MIR_INPUT_EVENT_MAX_POINTER_COUNT]; |
3522 | + droidinput::PointerCoords coords[mir::capnp::MotionSetEvent::MAX_COUNT]; |
3523 | + droidinput::PointerProperties properties[mir::capnp::MotionSetEvent::MAX_COUNT]; |
3524 | auto input_event = mir_event_get_input_event(&event); |
3525 | auto touch = mir_input_event_get_touch_event(input_event); |
3526 | std::chrono::nanoseconds const event_time{mir_input_event_get_event_time(input_event)}; |
3527 | @@ -333,7 +350,8 @@ |
3528 | ret = publisher.publishMotionEvent(seq, mir_input_event_get_device_id(input_event), AINPUT_SOURCE_TOUCHSCREEN, |
3529 | state_change.android_action, flags, edge_flags, |
3530 | mia::android_modifiers_from_mir(mir_touch_event_modifiers(touch)), |
3531 | - button_state, x_offset, y_offset, x_precision, y_precision, event.to_input()->to_motion()->cookie(), |
3532 | + button_state, x_offset, y_offset, x_precision, y_precision, |
3533 | + convert_cookie_to_blob(event.to_input()->to_motion()->cookie()), |
3534 | event_time, event_time, contacts_in_event, properties, coords); |
3535 | } |
3536 | |
3537 | @@ -370,7 +388,8 @@ |
3538 | mia::android_pointer_action_from_mir(mir_pointer_event_action(pointer), mir_pointer_event_buttons(pointer)), |
3539 | flags, edge_flags, mia::android_modifiers_from_mir(mir_pointer_event_modifiers(pointer)), |
3540 | mia::android_pointer_buttons_from_mir(mir_pointer_event_buttons(pointer)), x_offset, y_offset, x_precision, |
3541 | - y_precision, event.to_input()->to_motion()->cookie(), event_time, event_time, 1, &pointer_properties, &pointer_coord); |
3542 | + y_precision, convert_cookie_to_blob(event.to_input()->to_motion()->cookie()), |
3543 | + event_time, event_time, 1, &pointer_properties, &pointer_coord); |
3544 | } |
3545 | |
3546 | |
3547 | |
3548 | === modified file 'src/server/input/default_event_builder.cpp' |
3549 | --- src/server/input/default_event_builder.cpp 2016-06-03 08:39:59 +0000 |
3550 | +++ src/server/input/default_event_builder.cpp 2016-09-22 20:34:39 +0000 |
3551 | @@ -59,10 +59,8 @@ |
3552 | auto mev = event.to_input()->to_motion(); |
3553 | auto const cookie = cookie_authority->make_cookie(mev->event_time().count()); |
3554 | auto const serialized_cookie = cookie->serialize(); |
3555 | - mir::cookie::Blob event_cookie; |
3556 | - std::copy_n(std::begin(serialized_cookie), event_cookie.size(), std::begin(event_cookie)); |
3557 | |
3558 | - mev->set_cookie(event_cookie); |
3559 | + mev->set_cookie(serialized_cookie); |
3560 | } |
3561 | |
3562 | me::add_touch(event, touch_id, action, tooltype, x_axis_value, y_axis_value, pressure_value, touch_major_value, |
3563 | |
3564 | === modified file 'src/server/input/key_repeat_dispatcher.cpp' |
3565 | --- src/server/input/key_repeat_dispatcher.cpp 2016-05-03 06:55:25 +0000 |
3566 | +++ src/server/input/key_repeat_dispatcher.cpp 2016-09-22 20:34:39 +0000 |
3567 | @@ -173,9 +173,7 @@ |
3568 | new_kev.set_event_time(std::chrono::steady_clock::now().time_since_epoch()); |
3569 | auto const cookie = cookie_authority->make_cookie(new_kev.event_time().count()); |
3570 | auto const serialized_cookie = cookie->serialize(); |
3571 | - mir::cookie::Blob event_cookie; |
3572 | - std::copy_n(std::begin(serialized_cookie), event_cookie.size(), std::begin(event_cookie)); |
3573 | - new_kev.set_cookie(event_cookie); |
3574 | + new_kev.set_cookie(serialized_cookie); |
3575 | next_dispatcher->dispatch(new_kev); |
3576 | |
3577 | capture_alarm->reschedule_in(repeat_delay); |
3578 | |
3579 | === modified file 'src/server/input/validator.cpp' |
3580 | --- src/server/input/validator.cpp 2016-05-03 06:55:25 +0000 |
3581 | +++ src/server/input/validator.cpp 2016-09-22 20:34:39 +0000 |
3582 | @@ -56,7 +56,8 @@ |
3583 | |
3584 | namespace |
3585 | { |
3586 | -void delete_event(MirEvent *e) { mir_event_unref(e); } |
3587 | +void delete_event(MirEvent *e) { delete e; } |
3588 | + |
3589 | mir::EventUPtr make_event_uptr(MirEvent *e) |
3590 | { |
3591 | return mir::EventUPtr(e, delete_event); |
3592 | @@ -64,9 +65,7 @@ |
3593 | |
3594 | mir::EventUPtr copy_event(MirTouchEvent const* ev) |
3595 | { |
3596 | - MirTouchEvent* ret = new MirTouchEvent; |
3597 | - memcpy(ret, ev, sizeof(MirTouchEvent)); |
3598 | - return make_event_uptr(ret); |
3599 | + return make_event_uptr(new MirTouchEvent(*ev)); |
3600 | } |
3601 | |
3602 | // Return a copy of ev with existing touch actions converted to change. |
3603 | |
3604 | === modified file 'tests/acceptance-tests/test_client_input.cpp' |
3605 | --- tests/acceptance-tests/test_client_input.cpp 2016-06-02 08:20:22 +0000 |
3606 | +++ tests/acceptance-tests/test_client_input.cpp 2016-09-22 20:34:39 +0000 |
3607 | @@ -587,7 +587,8 @@ |
3608 | first_client.all_events_received.wait_for(2s); |
3609 | } |
3610 | |
3611 | -TEST_F(TestClientInput, receives_one_touch_event_per_frame) |
3612 | +// Enable once lp:1570698 is fixed |
3613 | +TEST_F(TestClientInput, DISABLED_receives_one_touch_event_per_frame) |
3614 | { |
3615 | positions[first] = screen_geometry; |
3616 | Client first_client(new_connection(), first); |
3617 | |
3618 | === modified file 'tests/unit-tests/client/input/test_android_input_receiver.cpp' |
3619 | --- tests/unit-tests/client/input/test_android_input_receiver.cpp 2016-05-03 06:55:25 +0000 |
3620 | +++ tests/unit-tests/client/input/test_android_input_receiver.cpp 2016-09-22 20:34:39 +0000 |
3621 | @@ -230,7 +230,7 @@ |
3622 | std::make_shared<mircv::XKBMapper>(), |
3623 | [&ev, &handler_called](MirEvent* event) |
3624 | { |
3625 | - ev.reset(event->clone()); |
3626 | + ev.reset(new MirEvent(*event)); |
3627 | handler_called = true; |
3628 | }, |
3629 | std::make_shared<mircv::NullInputReceiverReport>(), |
3630 | |
3631 | === modified file 'tests/unit-tests/input/test_surface_input_dispatcher.cpp' |
3632 | --- tests/unit-tests/input/test_surface_input_dispatcher.cpp 2016-06-10 12:55:53 +0000 |
3633 | +++ tests/unit-tests/input/test_surface_input_dispatcher.cpp 2016-09-22 20:34:39 +0000 |
3634 | @@ -264,7 +264,7 @@ |
3635 | FakeKeyboard keyboard; |
3636 | auto event = keyboard.press(); |
3637 | |
3638 | - EXPECT_CALL(*surface, consume(mt::MirKeyboardEventMatches(ByRef(*event)))).Times(1); |
3639 | + EXPECT_CALL(*surface, consume(mt::MirKeyboardEventMatches(event.get()))).Times(1); |
3640 | |
3641 | dispatcher.start(); |
3642 | |
3643 | |
3644 | === modified file 'tests/unit-tests/input/test_validator.cpp' |
3645 | --- tests/unit-tests/input/test_validator.cpp 2016-05-03 06:55:25 +0000 |
3646 | +++ tests/unit-tests/input/test_validator.cpp 2016-09-22 20:34:39 +0000 |
3647 | @@ -87,9 +87,9 @@ |
3648 | add_another_touch(inserted_down_id1, 1, mir_touch_action_down); |
3649 | |
3650 | InSequence seq; |
3651 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_down_id0)))); |
3652 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_down_id1)))); |
3653 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch)))); |
3654 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_down_id0.get()))); |
3655 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_down_id1.get()))); |
3656 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch.get()))); |
3657 | |
3658 | rewriter.validate_and_dispatch(*touch); |
3659 | } |
3660 | @@ -108,10 +108,10 @@ |
3661 | add_another_touch(inserted_release, 1, mir_touch_action_up); |
3662 | |
3663 | InSequence seq; |
3664 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_1)))); |
3665 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_2)))); |
3666 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_release)))); |
3667 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_3)))); |
3668 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_1.get()))); |
3669 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_2.get()))); |
3670 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_release.get()))); |
3671 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_3.get()))); |
3672 | |
3673 | rewriter.validate_and_dispatch(*touch_1); |
3674 | rewriter.validate_and_dispatch(*touch_2); |
3675 | @@ -138,12 +138,12 @@ |
3676 | add_another_touch(inserted_release_id0, 2, mir_touch_action_change); |
3677 | |
3678 | InSequence seq; |
3679 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_1)))); |
3680 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_2)))); |
3681 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_3)))); |
3682 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_release_id1)))); |
3683 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_release_id0)))); |
3684 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_4)))); |
3685 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_1.get()))); |
3686 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_2.get()))); |
3687 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_3.get()))); |
3688 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_release_id1.get()))); |
3689 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_release_id0.get()))); |
3690 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_4.get()))); |
3691 | |
3692 | rewriter.validate_and_dispatch(*touch_1); |
3693 | rewriter.validate_and_dispatch(*touch_2); |
3694 | @@ -169,12 +169,12 @@ |
3695 | auto inserted_down_id2 = make_touch(0, mir_touch_action_change); |
3696 | add_another_touch(inserted_down_id2, 2, mir_touch_action_down); |
3697 | |
3698 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_1)))); |
3699 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_2)))); |
3700 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_3)))); |
3701 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_release_id1)))); |
3702 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_down_id2)))); |
3703 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_4)))); |
3704 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_1.get()))); |
3705 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_2.get()))); |
3706 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_3.get()))); |
3707 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_release_id1.get()))); |
3708 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_down_id2.get()))); |
3709 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_4.get()))); |
3710 | |
3711 | rewriter.validate_and_dispatch(*touch_1); |
3712 | rewriter.validate_and_dispatch(*touch_2); |
3713 | @@ -196,11 +196,11 @@ |
3714 | auto inserted_down_id2 = make_touch(1, mir_touch_action_change); |
3715 | add_another_touch(inserted_down_id2, 2, mir_touch_action_down); |
3716 | |
3717 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_1)))); |
3718 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_2)))); |
3719 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_up_id0)))); |
3720 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_down_id2)))); |
3721 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_3)))); |
3722 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_1.get()))); |
3723 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_2.get()))); |
3724 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_up_id0.get()))); |
3725 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_down_id2.get()))); |
3726 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_3.get()))); |
3727 | |
3728 | rewriter.validate_and_dispatch(*touch_1); |
3729 | rewriter.validate_and_dispatch(*touch_2); |
3730 | @@ -226,12 +226,12 @@ |
3731 | add_another_touch(inserted_down_id1, 1, mir_touch_action_down); |
3732 | |
3733 | InSequence seq; |
3734 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_1)))); |
3735 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_2)))); |
3736 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_3)))); |
3737 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_4)))); |
3738 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_down_id1)))); |
3739 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_5)))); |
3740 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_1.get()))); |
3741 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_2.get()))); |
3742 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_3.get()))); |
3743 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_4.get()))); |
3744 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_down_id1.get()))); |
3745 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_5.get()))); |
3746 | |
3747 | rewriter.validate_and_dispatch(*touch_1); |
3748 | rewriter.validate_and_dispatch(*touch_2); |
3749 | @@ -252,10 +252,10 @@ |
3750 | auto inserted_up_id0 = make_touch(0, mir_touch_action_up); |
3751 | auto inserted_down_id1 = make_touch(1, mir_touch_action_down); |
3752 | |
3753 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_1)))); |
3754 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_up_id0)))); |
3755 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*inserted_down_id1)))); |
3756 | - EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(ByRef(*touch_2)))); |
3757 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_1.get()))); |
3758 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_up_id0.get()))); |
3759 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(inserted_down_id1.get()))); |
3760 | + EXPECT_CALL(input_sink, handle(mt::MirTouchEventMatches(touch_2.get()))); |
3761 | |
3762 | rewriter.validate_and_dispatch(*touch_1); |
3763 | rewriter.validate_and_dispatch(*touch_2); |
3764 | |
3765 | === modified file 'tests/unit-tests/scene/test_application_session.cpp' |
3766 | --- tests/unit-tests/scene/test_application_session.cpp 2016-08-10 10:43:39 +0000 |
3767 | +++ tests/unit-tests/scene/test_application_session.cpp 2016-09-22 20:34:39 +0000 |
3768 | @@ -897,14 +897,16 @@ |
3769 | { |
3770 | using namespace ::testing; |
3771 | |
3772 | - //MirEvent* event; |
3773 | - std::unique_ptr<MirEvent> event; |
3774 | + MirSurfaceOutputEvent event; |
3775 | bool event_received{false}; |
3776 | |
3777 | EXPECT_CALL(*sender, handle_event(IsSurfaceOutputEvent())) |
3778 | .WillOnce(Invoke([&event, &event_received](MirEvent const& ev) |
3779 | { |
3780 | - event.reset(ev.clone()); |
3781 | + if (event.type() == mir_event_type_surface_output) |
3782 | + { |
3783 | + event = *ev.to_surface_output(); |
3784 | + } |
3785 | event_received = true; |
3786 | })); |
3787 | |
3788 | @@ -922,7 +924,7 @@ |
3789 | auto surface = app_session.surface(surf_id); |
3790 | |
3791 | ASSERT_TRUE(event_received); |
3792 | - EXPECT_THAT(event.get(), SurfaceOutputEventFor(high_dpi)); |
3793 | + EXPECT_THAT(&event, SurfaceOutputEventFor(high_dpi)); |
3794 | } |
3795 | |
3796 | TEST_F(ApplicationSessionSurfaceOutput, sends_correct_surface_details_to_surface) |
3797 | @@ -931,13 +933,16 @@ |
3798 | |
3799 | std::array<TestOutput const*, 2> outputs{{ &high_dpi, &projector }}; |
3800 | |
3801 | - std::array<std::unique_ptr<MirEvent>, 2> event; |
3802 | + std::array<MirSurfaceOutputEvent, 2> event; |
3803 | int events_received{0}; |
3804 | |
3805 | ON_CALL(*sender, handle_event(IsSurfaceOutputEvent())) |
3806 | .WillByDefault(Invoke([&event, &events_received](MirEvent const& ev) |
3807 | { |
3808 | - event[events_received].reset(ev.clone()); |
3809 | + if (ev.type() == mir_event_type_surface_output) |
3810 | + { |
3811 | + event[events_received] = *ev.to_surface_output(); |
3812 | + } |
3813 | ++events_received; |
3814 | })); |
3815 | |
3816 | @@ -974,8 +979,8 @@ |
3817 | |
3818 | for (int i = 0; i < 2 ; ++i) |
3819 | { |
3820 | - EXPECT_THAT(event[i]->to_surface_output()->surface_id(), Eq(ids[i].as_value())); |
3821 | - EXPECT_THAT(event[i].get(), SurfaceOutputEventFor(*outputs[i])); |
3822 | + EXPECT_THAT(event[i].to_surface_output()->surface_id(), Eq(ids[i].as_value())); |
3823 | + EXPECT_THAT(&event[i], SurfaceOutputEventFor(*outputs[i])); |
3824 | } |
3825 | } |
3826 | |
3827 | @@ -985,13 +990,16 @@ |
3828 | |
3829 | std::array<TestOutput const*, 2> outputs{{ &projector, &high_dpi }}; |
3830 | |
3831 | - std::unique_ptr<MirEvent> event; |
3832 | + MirSurfaceOutputEvent event; |
3833 | bool event_received{false}; |
3834 | |
3835 | ON_CALL(*sender, handle_event(IsSurfaceOutputEvent())) |
3836 | .WillByDefault(Invoke([&event, &event_received](MirEvent const& ev) |
3837 | { |
3838 | - event.reset(ev.clone()); |
3839 | + if (ev.type() == mir_event_type_surface_output) |
3840 | + { |
3841 | + event = *ev.to_surface_output(); |
3842 | + } |
3843 | event_received = true; |
3844 | })); |
3845 | |
3846 | @@ -1020,8 +1028,8 @@ |
3847 | |
3848 | ASSERT_TRUE(event_received); |
3849 | |
3850 | - EXPECT_THAT(event->to_surface_output()->surface_id(), Eq(id.as_value())); |
3851 | - EXPECT_THAT(event.get(), SurfaceOutputEventFor(high_dpi)); |
3852 | + EXPECT_THAT(event.to_surface_output()->surface_id(), Eq(id.as_value())); |
3853 | + EXPECT_THAT(&event, SurfaceOutputEventFor(high_dpi)); |
3854 | } |
3855 | |
3856 | TEST_F(ApplicationSessionSurfaceOutput, surfaces_on_edges_get_correct_values) |
3857 | @@ -1030,13 +1038,16 @@ |
3858 | |
3859 | std::array<TestOutput const*, 2> outputs{{ &projector, &high_dpi }}; |
3860 | |
3861 | - std::unique_ptr<MirEvent> event; |
3862 | + MirSurfaceOutputEvent event; |
3863 | bool event_received{false}; |
3864 | |
3865 | ON_CALL(*sender, handle_event(IsSurfaceOutputEvent())) |
3866 | .WillByDefault(Invoke([&event, &event_received](MirEvent const& ev) |
3867 | { |
3868 | - event.reset(ev.clone()); |
3869 | + if (ev.type() == mir_event_type_surface_output) |
3870 | + { |
3871 | + event = *ev.to_surface_output(); |
3872 | + } |
3873 | event_received = true; |
3874 | })); |
3875 | |
3876 | @@ -1064,21 +1075,21 @@ |
3877 | surface->move_to({outputs[0]->width - ((surface->size().width.as_uint32_t()) / 2), 100}); |
3878 | |
3879 | ASSERT_TRUE(event_received); |
3880 | - EXPECT_THAT(event.get(), SurfaceOutputEventFor(high_dpi)); |
3881 | + EXPECT_THAT(&event, SurfaceOutputEventFor(high_dpi)); |
3882 | |
3883 | event_received = false; |
3884 | // This should be *just* entirely on the projector |
3885 | surface->move_to({outputs[0]->width - surface->size().width.as_uint32_t(), 100}); |
3886 | |
3887 | ASSERT_TRUE(event_received); |
3888 | - EXPECT_THAT(event.get(), SurfaceOutputEventFor(projector)); |
3889 | + EXPECT_THAT(&event, SurfaceOutputEventFor(projector)); |
3890 | |
3891 | event_received = false; |
3892 | // This should have a single pixel overlap on the high_dpi |
3893 | surface->move_to({outputs[0]->width - (surface->size().width.as_uint32_t() - 1), 100}); |
3894 | |
3895 | ASSERT_TRUE(event_received); |
3896 | - EXPECT_THAT(event.get(), SurfaceOutputEventFor(high_dpi)); |
3897 | + EXPECT_THAT(&event, SurfaceOutputEventFor(high_dpi)); |
3898 | } |
3899 | |
3900 | TEST_F(ApplicationSessionSurfaceOutput, sends_surface_output_event_on_move) |
3901 | @@ -1087,14 +1098,17 @@ |
3902 | |
3903 | std::array<TestOutput const*, 2> outputs {{ &projector, &high_dpi }}; |
3904 | |
3905 | - std::unique_ptr<MirEvent> event; |
3906 | + MirSurfaceOutputEvent event; |
3907 | int events_received{0}; |
3908 | |
3909 | |
3910 | ON_CALL(*sender, handle_event(IsSurfaceOutputEvent())) |
3911 | .WillByDefault(Invoke([&event, &events_received](MirEvent const& ev) |
3912 | { |
3913 | - event.reset(ev.clone()); |
3914 | + if (ev.type() == mir_event_type_surface_output) |
3915 | + { |
3916 | + event = *ev.to_surface_output(); |
3917 | + } |
3918 | events_received++; |
3919 | })); |
3920 | |
3921 | @@ -1125,8 +1139,8 @@ |
3922 | ASSERT_THAT(events_received, Ge(1)); |
3923 | auto events_expected = events_received + 1; |
3924 | |
3925 | - EXPECT_THAT(event->to_surface_output()->surface_id(), Eq(id.as_value())); |
3926 | - EXPECT_THAT(event.get(), SurfaceOutputEventFor(high_dpi)); |
3927 | + EXPECT_THAT(event.to_surface_output()->surface_id(), Eq(id.as_value())); |
3928 | + EXPECT_THAT(&event, SurfaceOutputEventFor(high_dpi)); |
3929 | |
3930 | // Now solely on the left output |
3931 | surface->move_to({0, 0}); |
3932 | @@ -1134,8 +1148,8 @@ |
3933 | ASSERT_THAT(events_received, Eq(events_expected)); |
3934 | events_expected++; |
3935 | |
3936 | - EXPECT_THAT(event->to_surface_output()->surface_id(), Eq(id.as_value())); |
3937 | - EXPECT_THAT(event.get(), SurfaceOutputEventFor(projector)); |
3938 | + EXPECT_THAT(event.to_surface_output()->surface_id(), Eq(id.as_value())); |
3939 | + EXPECT_THAT(&event, SurfaceOutputEventFor(projector)); |
3940 | |
3941 | // Now solely on the right output |
3942 | surface->move_to({outputs[0]->width + 100, 100}); |
3943 | @@ -1143,8 +1157,8 @@ |
3944 | ASSERT_THAT(events_received, Eq(events_expected)); |
3945 | events_expected++; |
3946 | |
3947 | - EXPECT_THAT(event->to_surface_output()->surface_id(), Eq(id.as_value())); |
3948 | - EXPECT_THAT(event.get(), SurfaceOutputEventFor(high_dpi)); |
3949 | + EXPECT_THAT(event.to_surface_output()->surface_id(), Eq(id.as_value())); |
3950 | + EXPECT_THAT(&event, SurfaceOutputEventFor(high_dpi)); |
3951 | } |
3952 | |
3953 | TEST_F(ApplicationSessionSurfaceOutput, sends_surface_output_event_on_move_only_if_changed) |
3954 | |
3955 | === modified file 'tests/unit-tests/scene/test_surface.cpp' |
3956 | --- tests/unit-tests/scene/test_surface.cpp 2016-08-24 02:09:08 +0000 |
3957 | +++ tests/unit-tests/scene/test_surface.cpp 2016-09-22 20:34:39 +0000 |
3958 | @@ -410,8 +410,8 @@ |
3959 | mev::add_touch(*touch_event, 0, mir_touch_action_down, mir_touch_tooltype_finger, 0, 0, |
3960 | 0, 0, 0, 0); |
3961 | |
3962 | - EXPECT_CALL(mock_sender, send_event(mt::MirKeyboardEventMatches(ByRef(*key_event)), _)).Times(1); |
3963 | - EXPECT_CALL(mock_sender, send_event(mt::MirTouchEventMatches(ByRef(*touch_event)), _)).Times(1); |
3964 | + EXPECT_CALL(mock_sender, send_event(mt::MirKeyboardEventMatches(key_event.get()), _)).Times(1); |
3965 | + EXPECT_CALL(mock_sender, send_event(mt::MirTouchEventMatches(touch_event.get()), _)).Times(1); |
3966 | |
3967 | surface.consume(key_event.get()); |
3968 | surface.consume(touch_event.get()); |
3969 | |
3970 | === modified file 'tests/unit-tests/scene/test_surface_impl.cpp' |
3971 | --- tests/unit-tests/scene/test_surface_impl.cpp 2016-08-24 02:09:08 +0000 |
3972 | +++ tests/unit-tests/scene/test_surface_impl.cpp 2016-09-22 20:34:39 +0000 |
3973 | @@ -166,12 +166,6 @@ |
3974 | EXPECT_EQ(mir_surface_state_fullscreen, surface->state()); |
3975 | } |
3976 | |
3977 | -bool operator==(MirEvent const& a, MirEvent const& b) |
3978 | -{ |
3979 | - // We will always fill unused bytes with zero, so memcmp is accurate... |
3980 | - return !memcmp(&a, &b, sizeof(MirEvent)); |
3981 | -} |
3982 | - |
3983 | TEST_F(Surface, clamps_undersized_resize) |
3984 | { |
3985 | using namespace testing; |
3986 | @@ -255,6 +249,10 @@ |
3987 | surface->configure(mir_surface_attrib_focus, mir_surface_focused); |
3988 | surface->configure(mir_surface_attrib_focus, mir_surface_unfocused); |
3989 | } |
3990 | +MATCHER_P(MirCloseSurfaceEventMatches, event, "") |
3991 | +{ |
3992 | + return arg.type() == event->type(); |
3993 | +} |
3994 | |
3995 | TEST_F(Surface, emits_client_close_events) |
3996 | { |
3997 | @@ -269,7 +267,7 @@ |
3998 | MirCloseSurfaceEvent e; |
3999 | e.to_close_surface()->set_surface_id(stub_id.as_value()); |
4000 | |
4001 | - EXPECT_CALL(*sink, handle_event(Eq(ByRef(e)))).Times(1); |
4002 | + EXPECT_CALL(*sink, handle_event(MirCloseSurfaceEventMatches(&e))).Times(1); |
4003 | |
4004 | surface->request_client_surface_close(); |
4005 | } |
FAILED: Continuous integration, rev:3414 /mir-jenkins. ubuntu. com/job/ mir-ci/ 736/ /mir-jenkins. ubuntu. com/job/ build-mir/ 705/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/742 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 733 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial/ 733 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 714/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial/ 714/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 714/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 714/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial/ 714/console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 736/rebuild
https:/