Merge lp:~alan-griffiths/mir/drag-and-drop-II into lp:mir
- drag-and-drop-II
- Merge into development-branch
Status: | Merged |
---|---|
Merged at revision: | 4100 |
Proposed branch: | lp:~alan-griffiths/mir/drag-and-drop-II |
Merge into: | lp:mir |
Diff against target: |
2548 lines (+1425/-27) 75 files modified
examples/server_example_basic_window_manager.cpp (+8/-0) examples/server_example_basic_window_manager.h (+5/-0) include/client/mir/events/event_builders.h (+2/-0) include/client/mir_toolkit/extensions/drag_and_drop.h (+81/-0) include/server/mir/scene/null_surface_observer.h (+1/-0) include/server/mir/scene/surface.h (+1/-0) include/server/mir/scene/surface_observer.h (+2/-0) include/server/mir/shell/abstract_shell.h (+8/-0) include/server/mir/shell/focus_controller.h (+5/-0) include/server/mir/shell/input_targeter.h (+5/-0) include/server/mir/shell/shell.h (+4/-0) include/server/mir/shell/shell_wrapper.h (+8/-0) include/server/mir/shell/system_compositor_window_manager.h (+5/-0) include/server/mir/shell/window_manager.h (+5/-0) include/test/mir/test/doubles/mock_window_manager.h (+1/-0) include/test/mir/test/doubles/stub_surface.h (+1/-0) include/test/mir_test_framework/observant_shell.h (+8/-0) src/capnproto/mir_event.capnp (+5/-1) src/client/CMakeLists.txt (+2/-0) src/client/drag_and_drop.cpp (+85/-0) src/client/drag_and_drop.h (+32/-0) src/client/events/event_builders.cpp (+25/-0) src/client/mir_blob.cpp (+1/-8) src/client/mir_connection.cpp (+4/-0) src/client/mir_surface.cpp (+32/-0) src/client/mir_surface.h (+4/-0) src/client/rpc/mir_display_server.cpp (+9/-0) src/client/rpc/mir_display_server.h (+4/-0) src/client/symbols.map (+2/-0) src/common/events/pointer_event.cpp (+41/-3) src/common/events/surface_event.cpp (+39/-1) src/common/symbols.map (+4/-0) src/include/common/mir/events/pointer_event.h (+6/-1) src/include/common/mir/events/surface_event.h (+6/-1) src/include/common/mir/protobuf/display_server.h (+4/-0) src/include/common/mir_blob.h (+32/-0) src/include/server/mir/frontend/shell.h (+5/-0) src/include/server/mir/scene/surface_event_source.h (+1/-0) src/include/server/mir/scene/surface_observers.h (+1/-0) src/include/server/mir/shell/basic_window_manager.h (+15/-0) src/include/server/mir/shell/canonical_window_manager.h (+4/-0) src/protobuf/mir_protobuf.proto (+5/-0) src/protobuf/symbols.map (+26/-0) src/server/frontend/protobuf_message_processor.cpp (+4/-0) src/server/frontend/session_mediator.cpp (+20/-1) src/server/frontend/session_mediator.h (+4/-0) src/server/frontend/shell_wrapper.cpp (+8/-0) src/server/frontend/shell_wrapper.h (+5/-0) src/server/input/null_input_targeter.h (+3/-0) src/server/input/surface_input_dispatcher.cpp (+42/-8) src/server/input/surface_input_dispatcher.h (+5/-1) src/server/scene/basic_surface.cpp (+11/-0) src/server/scene/basic_surface.h (+1/-0) src/server/scene/legacy_surface_change_notification.cpp (+4/-0) src/server/scene/legacy_surface_change_notification.h (+1/-0) src/server/scene/null_surface_observer.cpp (+1/-0) src/server/scene/surface_event_source.cpp (+5/-0) src/server/shell/abstract_shell.cpp (+17/-0) src/server/shell/basic_window_manager.cpp (+21/-0) src/server/shell/canonical_window_manager.cpp (+13/-0) src/server/shell/frontend_shell.cpp (+10/-0) src/server/shell/frontend_shell.h (+5/-0) src/server/shell/shell_wrapper.cpp (+18/-0) src/server/shell/system_compositor_window_manager.cpp (+7/-0) src/server/symbols.map (+10/-0) tests/acceptance-tests/CMakeLists.txt (+2/-0) tests/acceptance-tests/drag_and_drop.cpp (+624/-0) tests/acceptance-tests/test_client_cursor_api.cpp (+1/-0) tests/include/mir/test/doubles/mock_input_targeter.h (+3/-0) tests/include/mir/test/doubles/mock_shell.h (+3/-0) tests/include/mir/test/doubles/stub_display_server.h (+4/-0) tests/include/mir/test/doubles/stub_input_targeter.h (+3/-0) tests/include/mir/test/doubles/stub_scene_surface.h (+1/-0) tests/mir_test_framework/observant_shell.cpp (+21/-2) tests/mir_test_framework/stub_surface.cpp (+4/-0) |
To merge this branch: | bzr merge lp:~alan-griffiths/mir/drag-and-drop-II |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brandon Schaefer (community) | Approve | ||
Kevin DuBois (community) | Approve | ||
Andreas Pokorny (community) | Approve | ||
Mir CI Bot | continuous-integration | Approve | |
Chris Halse Rogers | Pending | ||
Alan Griffiths | Pending | ||
Cemil Azizoglu | Pending | ||
Review via email: mp+320215@code.launchpad.net |
This proposal supersedes a proposal from 2017-03-14.
Commit message
Support for Drag and Drop
Description of the change
Support for Drag and Drop
This completes the Mir role in https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
18:39:25 [ RUN ] DragAndDrop.
...
18:39:25 /<<BUILDDIR>
18:39:25 Value of: have_cookie.
18:39:25 Expected: is equal to true
18:39:25 Actual: false (of type bool)
18:39:25 ==11713== Invalid read of size 8
The memory errors and FD leaks that follow result from following the resulting nullptr.
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
> 18:39:25 [ RUN ]
> DragAndDrop.
> ...
> 18:39:25 /<<BUILDDIR>
> tests/drag_
> 18:39:25 Value of: have_cookie.
> 18:39:25 Expected: is equal to true
> 18:39:25 Actual: false (of type bool)
> 18:39:25 ==11713== Invalid read of size 8
>
> The memory errors and FD leaks that follow result from following the resulting
> nullptr.
Hmm wrong paste buffer, but still I don't see how this can happen:
18:35:34 11: [ RUN ] DragAndDrop.
...
18:37:06 11: /<<BUILDDIR>
18:37:06 11: Value of: have_cookie.
18:37:06 11: Expected: is equal to true
18:37:06 11: Actual: false (of type bool)
18:37:06 11: ==11713== Invalid read of size 8
Basically, the click isn't seen by the window. And on this branch the window has definitely received {mir_window_
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:4088
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: 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 | # |
PASSED: Continuous integration, rev:4089
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:/
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 | # |
PASSED: Continuous integration, rev:4090
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:/
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:4091
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: 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 | # |
Failure is unrelated (lp:1660889)
So that's 3 CI runs with the new tests passing. (And soak testing them locally.)
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:4092
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:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : Posted in a previous version of this proposal | # |
l773 could use comment here as well (like the other comment noting how CapPnP has problems)
+ //std::
+// We miss the "mouseover" occasionally (with valgrind and heavy stress about 1/20).
1995 +// But it isn't essential for the test and we've probably waited long enough
1996 +// for the mouse-down needed by the test to reach the window.
1997 +// EXPECT_
does that need a bug?
both those minor, lgtm overall
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
> l773 could use comment here as well (like the other comment noting how CapPnP
> has problems)
> + //std::
> back_inserter(
Fixed.
> +// We miss the "mouseover" occasionally (with valgrind and heavy stress about
> 1/20).
> 1995 +// But it isn't essential for the test and we've probably waited long
> enough
> 1996 +// for the mouse-down needed by the test to reach the window.
> 1997 +// EXPECT_
> Eq(true));
> does that need a bug?
Possibly. It would appear there is a lack of consistency between the window management "model" that says the surface is ready and has focus (hence the mir_window_
I doubt we'll see an issue in "real life".
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:4094
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:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Cemil Azizoglu (cemil-azizoglu) wrote : Posted in a previous version of this proposal | # |
Why is this an extension? Because it requires an outside entity like a content hub?
-------
Is this needed?
130 + mir_surface_
-------
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
> Why is this an extension? Because it requires an outside entity like a content
> hub?
So that we can evolve the API without breaking ABI
> Is this needed?
>
> 130 + mir_surface_
> -------
It doesn't have to be done this way, but the mir_surface_attribs and mir_window_attribs enum members have to be kept in step somehow. This seemed the clearest approach.
Kevin DuBois (kdub) wrote : Posted in a previous version of this proposal | # |
> > Why is this an extension? Because it requires an outside entity like a
> content
> > hub?
>
> So that we can evolve the API without breaking ABI
+1 to evolving client api this way, keeps 1.0 stable, and can be incorporated to main api once the work is done and there are no more warts.
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
lgtm
Chris Halse Rogers (raof) wrote : Posted in a previous version of this proposal | # |
Needs info:
I'm not sure that overriding the events is appropriate - as I understand it, this will result in Mir sending pointer_
It looks like this will cause clients to behave incorrectly unless their event handler checks each pointer event for a drag handle, and treats pointer events with drag handles as not pointer events?
For example: given a client B that doesn't check pointer events for drag handles, if you initiate a drag and then move the pointer over B's window, this will act like you're just moving the pointer normally over B's window, and B will highlight buttons, perform on-hover actions, and so on? And then if you release the drag over a button in B's window, B will respond as if you mouse-button-
Nit: The locking in
+void MirSurface:
appears unnecessary? All of the things it accesses are stack variables (cookie) or written-
Is the locking for the appeasement of ThreadSanitizer?
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
> Needs info:
> I'm not sure that overriding the events is appropriate - as I understand it,
> this will result in Mir sending pointer_
> events in cases where we currently don't?
Yes leaving the boundaries of a window even when buttons are pressed will cause the source window to receive a pointer leave and potentially crossed windows to receive pointer_enter and motion events even though pointer buttons are still pressed.
>
> It looks like this will cause clients to behave incorrectly unless their event
> handler checks each pointer event for a drag handle, and treats pointer events
> with drag handles as not pointer events?
I doubt ui toolkits unaware of the drag handle will treat it as a click sequence, so there is wrong behavior but not really severe.
We cannot safely expand enums with extensions - so we either expand the MirPointerAction enum in an unsafe and problematic way (i.e. we have values like mir_pointer_
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
Now looking again - why do we need a surface attribute for drag and drop?
Are downstreams using values like: mir_window_attribs?
I think we should remove those.
Besides the enum changes and window attribute - lgtm
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
> > Needs info:
> > I'm not sure that overriding the events is appropriate - as I understand it,
> > this will result in Mir sending pointer_
> > events in cases where we currently don't?
>
> Yes leaving the boundaries of a window even when buttons are pressed will
> cause the source window to receive a pointer leave and potentially crossed
> windows to receive pointer_enter and motion events even though pointer buttons
> are still pressed.
>
> >
> > It looks like this will cause clients to behave incorrectly unless their
> event
> > handler checks each pointer event for a drag handle, and treats pointer
> events
> > with drag handles as not pointer events?
>
> I doubt ui toolkits unaware of the drag handle will treat it as a click
> sequence, so there is wrong behavior but not really severe.
The Nuremberg defence: https:/
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
> Now looking again - why do we need a surface attribute for drag and drop?
>
> Are downstreams using values like: mir_window_attribs?
>
> I think we should remove those.
>
> Besides the enum changes and window attribute - lgtm
We needed some event to carry the drag handle. Extending the window event seemed the path of least resistance. But we've hard-coded the existence of an attribute value pair into the API.
I can think of two alternatives:
/1/ Use window events as the transport, but filter out those with a D&D handle (and pass the handle to an entirely separate callback registered through the extension API).
/2/ Introduce a new drag-and-drop event to the transport.
If we were to introduce a new drag-and-drop event to carry the initial handle then we could also use it for leave/enter/
OTOH /1/ seems simpler.
*Seeking guidance* on /1/ or /2/
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
Which route will allow us to easily expand drag and drop to touch guestures?
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
> Which route will allow us to easily expand drag and drop to touch guestures?
I imagine the client-side processing needs to be different (i.e. different visual effects) so it might be easier to "piggy back" on the existing input events. But without a design for D&D touch I can't be sure.
/me wonders if Unity7 has prior art.
Chris Halse Rogers (raof) wrote : Posted in a previous version of this proposal | # |
I'd be reasonably happy with (1).
If people don't like throwing in an ad-hoc callback for each extension, an alternative would be to assign event types *in* the extension, like so:
struct DnDv1
{
int (*dnd_event_
MirDndEvent const* (*dnd_event_
MirBlob* (*dnd_event_
MirDndAction (*dnd_event_
}
…
DnDv1* dnd = mir_drag_
…
<in event handler>
if (mir_event_
{
MirDndEvent const* dnd_event = dnd->dnd_
if (dnd->dnd_
{
…
}
}
I prefer this to one-callback-
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
> I'd be reasonably happy with (1).
>
> If people don't like throwing in an ad-hoc callback for each extension, an
> alternative would be to assign event types *in* the extension, like so:
...
> if (mir_event_
Perhaps:
- if (mir_event_
+ if (dnd && dnd->is_
Chris Halse Rogers (raof) wrote : Posted in a previous version of this proposal | # |
Also happy with that :)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4097
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:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Andreas Pokorny (andreas-pokorny) wrote : | # |
looks good
Brandon Schaefer (brandontschaefer) wrote : | # |
+ drag_and_drop.cpp drag_and_drop.h
Header added here, which is added below this as well
Brandon Schaefer (brandontschaefer) wrote : | # |
Well those are both different headers, nm!
Brandon Schaefer (brandontschaefer) wrote : | # |
Some small nits, otherwise looks good
Alan Griffiths (alan-griffiths) wrote : | # |
On 20/03/17 18:52, Brandon Schaefer wrote:
> + const_cast<
> Why const cast this?
Because mir_input_
const* which makes the set_dnd_handle() call illegal.
> You can do auto input_event = event.to_input(); Or if it defaults to const, MirInputEvent* input_event = event.to_input()
Eh?
--
Alan Griffiths +44 (0)798 9938 758
Octopull Ltd http://
Brandon Schaefer (brandontschaefer) wrote : | # |
O yeah ... was thinking about the *.to_input() call not the client API call. Opps.
Alan Griffiths (alan-griffiths) wrote : | # |
On 20/03/17 18:52, Brandon Schaefer wrote:
>> + // Can't use std::copy() as the CapnP iterators don't provide an iterator category
>> + for (auto p = dnd_handle.begin(); p != dnd_handle.end(); ++p)
>> + blob->data_
> You should be able to do:
> std::copy(
Well, I can't.
> Able to do this with the cookie, which seems to work
>
Maybe there's something else needed too: the return type of
getDndHandle() is ::capnp::List< ::uint8_t>::Reader whereas getCookie()
returns ::capnp:
--
Alan Griffiths +44 (0)798 9938 758
Octopull Ltd http://
Alan Griffiths (alan-griffiths) wrote : | # |
On 20/03/17 18:52, Brandon Schaefer wrote:
>> +void MirPointerEvent
>> +{
>> + event.getInput(
>> + event.getInput(
> This could be done a bit different, though up to you:
> ::capnp:
> event.getInput(
>
Tried this: The tests hang (didn't investigate further).
--
Alan Griffiths +44 (0)798 9938 758
Octopull Ltd http://
Brandon Schaefer (brandontschaefer) wrote : | # |
lgtm (forgot to approve)
Preview Diff
1 | === modified file 'examples/server_example_basic_window_manager.cpp' | |||
2 | --- examples/server_example_basic_window_manager.cpp 2017-01-18 02:29:37 +0000 | |||
3 | +++ examples/server_example_basic_window_manager.cpp 2017-03-17 15:52:51 +0000 | |||
4 | @@ -136,6 +136,14 @@ | |||
5 | 136 | policy->handle_raise_surface(session, surface); | 136 | policy->handle_raise_surface(session, surface); |
6 | 137 | } | 137 | } |
7 | 138 | 138 | ||
8 | 139 | void me::BasicWindowManager::handle_request_drag_and_drop( | ||
9 | 140 | std::shared_ptr<scene::Session> const& /*session*/, | ||
10 | 141 | std::shared_ptr<scene::Surface> const& /*surface*/, | ||
11 | 142 | uint64_t /*timestamp*/) | ||
12 | 143 | { | ||
13 | 144 | // Not supported in example servers | ||
14 | 145 | } | ||
15 | 146 | |||
16 | 139 | int me::BasicWindowManager::set_surface_attribute( | 147 | int me::BasicWindowManager::set_surface_attribute( |
17 | 140 | std::shared_ptr<scene::Session> const& /*session*/, | 148 | std::shared_ptr<scene::Session> const& /*session*/, |
18 | 141 | std::shared_ptr<scene::Surface> const& surface, | 149 | std::shared_ptr<scene::Surface> const& surface, |
19 | 142 | 150 | ||
20 | === modified file 'examples/server_example_basic_window_manager.h' | |||
21 | --- examples/server_example_basic_window_manager.h 2017-01-18 02:29:37 +0000 | |||
22 | +++ examples/server_example_basic_window_manager.h 2017-03-17 15:52:51 +0000 | |||
23 | @@ -174,6 +174,11 @@ | |||
24 | 174 | std::shared_ptr<scene::Surface> const& surface, | 174 | std::shared_ptr<scene::Surface> const& surface, |
25 | 175 | uint64_t timestamp) override; | 175 | uint64_t timestamp) override; |
26 | 176 | 176 | ||
27 | 177 | void handle_request_drag_and_drop( | ||
28 | 178 | std::shared_ptr<scene::Session> const& session, | ||
29 | 179 | std::shared_ptr<scene::Surface> const& surface, | ||
30 | 180 | uint64_t timestamp) override; | ||
31 | 181 | |||
32 | 177 | int set_surface_attribute( | 182 | int set_surface_attribute( |
33 | 178 | std::shared_ptr<scene::Session> const& /*session*/, | 183 | std::shared_ptr<scene::Session> const& /*session*/, |
34 | 179 | std::shared_ptr<scene::Surface> const& surface, | 184 | std::shared_ptr<scene::Surface> const& surface, |
35 | 180 | 185 | ||
36 | === modified file 'include/client/mir/events/event_builders.h' | |||
37 | --- include/client/mir/events/event_builders.h 2017-02-15 13:36:35 +0000 | |||
38 | +++ include/client/mir/events/event_builders.h 2017-03-17 15:52:51 +0000 | |||
39 | @@ -161,6 +161,8 @@ | |||
40 | 161 | void transform_positions(MirEvent& event, mir::geometry::Displacement const& movement); | 161 | void transform_positions(MirEvent& event, mir::geometry::Displacement const& movement); |
41 | 162 | void set_window_id(MirEvent& event, int window_id); | 162 | void set_window_id(MirEvent& event, int window_id); |
42 | 163 | 163 | ||
43 | 164 | EventUPtr make_start_drag_and_drop_event(frontend::SurfaceId const& surface_id, std::vector<uint8_t> const& handle); | ||
44 | 165 | void set_drag_and_drop_handle(MirEvent& event, std::vector<uint8_t> const& handle); | ||
45 | 164 | } | 166 | } |
46 | 165 | } | 167 | } |
47 | 166 | 168 | ||
48 | 167 | 169 | ||
49 | === added file 'include/client/mir_toolkit/extensions/drag_and_drop.h' | |||
50 | --- include/client/mir_toolkit/extensions/drag_and_drop.h 1970-01-01 00:00:00 +0000 | |||
51 | +++ include/client/mir_toolkit/extensions/drag_and_drop.h 2017-03-17 15:52:51 +0000 | |||
52 | @@ -0,0 +1,81 @@ | |||
53 | 1 | /* | ||
54 | 2 | * Copyright © 2017 Canonical Ltd. | ||
55 | 3 | * | ||
56 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
57 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
58 | 6 | * as published by the Free Software Foundation. | ||
59 | 7 | * | ||
60 | 8 | * This program is distributed in the hope that it will be useful, | ||
61 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
62 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
63 | 11 | * GNU Lesser General Public License for more details. | ||
64 | 12 | * | ||
65 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
66 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
67 | 15 | * | ||
68 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
69 | 17 | */ | ||
70 | 18 | |||
71 | 19 | #ifndef MIR_DRAG_AND_DROP_H | ||
72 | 20 | #define MIR_DRAG_AND_DROP_H | ||
73 | 21 | |||
74 | 22 | #include "mir_toolkit/mir_extension_core.h" | ||
75 | 23 | #include "mir_toolkit/client_types.h" | ||
76 | 24 | |||
77 | 25 | #ifdef __cplusplus | ||
78 | 26 | extern "C" { | ||
79 | 27 | #endif | ||
80 | 28 | |||
81 | 29 | typedef struct MirDragAndDropEvent MirDragAndDropEvent; | ||
82 | 30 | |||
83 | 31 | typedef struct MirDragAndDropV1 | ||
84 | 32 | { | ||
85 | 33 | /** | ||
86 | 34 | * Request drag and drop. If the request succeeds a window event with a | ||
87 | 35 | * "start drag" handle will be received. | ||
88 | 36 | * | ||
89 | 37 | * \warning An invalid cookie will terminate the client connection. | ||
90 | 38 | * | ||
91 | 39 | * \param [in] window The source window | ||
92 | 40 | * \param [in] cookie A cookie instance obtained from an input event. | ||
93 | 41 | */ | ||
94 | 42 | void (*request_drag_and_drop)(MirWindow* window, MirCookie const* cookie); | ||
95 | 43 | |||
96 | 44 | /** | ||
97 | 45 | * Set the drag and drop callback. This receives | ||
98 | 46 | * | ||
99 | 47 | * \param [in] window The window | ||
100 | 48 | * \param [in] callback The callback function. | ||
101 | 49 | * \param [in] context To be passed to callback | ||
102 | 50 | */ | ||
103 | 51 | void (*set_start_drag_and_drop_callback)(MirWindow* window, | ||
104 | 52 | void (*callback)(MirWindow* window, MirDragAndDropEvent const* event, void* context), | ||
105 | 53 | void* context); | ||
106 | 54 | |||
107 | 55 | /** | ||
108 | 56 | * Retrieve any "drag & drop" handle associated with the event. | ||
109 | 57 | * | ||
110 | 58 | * \param [in] event The event | ||
111 | 59 | * \return The associated drag handle or NULL | ||
112 | 60 | */ | ||
113 | 61 | MirBlob* (*start_drag_and_drop)(MirDragAndDropEvent const* event); | ||
114 | 62 | |||
115 | 63 | /** | ||
116 | 64 | * Retrieve any "drag & drop" handle associated with the event. | ||
117 | 65 | * | ||
118 | 66 | * \param [in] event The event | ||
119 | 67 | * \return The associated drag handle or NULL | ||
120 | 68 | */ | ||
121 | 69 | MirBlob* (*pointer_drag_and_drop)(MirPointerEvent const* event); | ||
122 | 70 | |||
123 | 71 | } MirDragAndDropV1; | ||
124 | 72 | |||
125 | 73 | static inline MirDragAndDropV1 const* mir_drag_and_drop_v1(MirConnection* connection) | ||
126 | 74 | { | ||
127 | 75 | return (MirDragAndDropV1 const*) mir_connection_request_extension(connection, "mir_drag_and_drop", 1); | ||
128 | 76 | } | ||
129 | 77 | |||
130 | 78 | #ifdef __cplusplus | ||
131 | 79 | } | ||
132 | 80 | #endif | ||
133 | 81 | #endif //MIR_DRAG_AND_DROP_H | ||
134 | 0 | \ No newline at end of file | 82 | \ No newline at end of file |
135 | 1 | 83 | ||
136 | === modified file 'include/server/mir/scene/null_surface_observer.h' | |||
137 | --- include/server/mir/scene/null_surface_observer.h 2017-02-15 13:36:35 +0000 | |||
138 | +++ include/server/mir/scene/null_surface_observer.h 2017-03-17 15:52:51 +0000 | |||
139 | @@ -47,6 +47,7 @@ | |||
140 | 47 | void cursor_image_removed() override; | 47 | void cursor_image_removed() override; |
141 | 48 | void placed_relative(geometry::Rectangle const& placement) override; | 48 | void placed_relative(geometry::Rectangle const& placement) override; |
142 | 49 | void input_consumed(MirEvent const* event) override; | 49 | void input_consumed(MirEvent const* event) override; |
143 | 50 | void start_drag_and_drop(std::vector<uint8_t> const& handle) override; | ||
144 | 50 | 51 | ||
145 | 51 | protected: | 52 | protected: |
146 | 52 | NullSurfaceObserver(NullSurfaceObserver const&) = delete; | 53 | NullSurfaceObserver(NullSurfaceObserver const&) = delete; |
147 | 53 | 54 | ||
148 | === modified file 'include/server/mir/scene/surface.h' | |||
149 | --- include/server/mir/scene/surface.h 2017-02-15 14:45:41 +0000 | |||
150 | +++ include/server/mir/scene/surface.h 2017-03-17 15:52:51 +0000 | |||
151 | @@ -116,6 +116,7 @@ | |||
152 | 116 | virtual MirPointerConfinementState confine_pointer_state() const = 0; | 116 | virtual MirPointerConfinementState confine_pointer_state() const = 0; |
153 | 117 | 117 | ||
154 | 118 | virtual void placed_relative(geometry::Rectangle const& placement) = 0; | 118 | virtual void placed_relative(geometry::Rectangle const& placement) = 0; |
155 | 119 | virtual void start_drag_and_drop(std::vector<uint8_t> const& handle) = 0; | ||
156 | 119 | }; | 120 | }; |
157 | 120 | } | 121 | } |
158 | 121 | } | 122 | } |
159 | 122 | 123 | ||
160 | === modified file 'include/server/mir/scene/surface_observer.h' | |||
161 | --- include/server/mir/scene/surface_observer.h 2017-02-15 13:36:35 +0000 | |||
162 | +++ include/server/mir/scene/surface_observer.h 2017-03-17 15:52:51 +0000 | |||
163 | @@ -27,6 +27,7 @@ | |||
164 | 27 | 27 | ||
165 | 28 | #include <glm/glm.hpp> | 28 | #include <glm/glm.hpp> |
166 | 29 | #include <string> | 29 | #include <string> |
167 | 30 | #include <vector> | ||
168 | 30 | 31 | ||
169 | 31 | namespace mir | 32 | namespace mir |
170 | 32 | { | 33 | { |
171 | @@ -62,6 +63,7 @@ | |||
172 | 62 | virtual void cursor_image_removed() = 0; | 63 | virtual void cursor_image_removed() = 0; |
173 | 63 | virtual void placed_relative(geometry::Rectangle const& placement) = 0; | 64 | virtual void placed_relative(geometry::Rectangle const& placement) = 0; |
174 | 64 | virtual void input_consumed(MirEvent const* event) = 0; | 65 | virtual void input_consumed(MirEvent const* event) = 0; |
175 | 66 | virtual void start_drag_and_drop(std::vector<uint8_t> const& handle) = 0; | ||
176 | 65 | 67 | ||
177 | 66 | protected: | 68 | protected: |
178 | 67 | SurfaceObserver() = default; | 69 | SurfaceObserver() = default; |
179 | 68 | 70 | ||
180 | === modified file 'include/server/mir/shell/abstract_shell.h' | |||
181 | --- include/server/mir/shell/abstract_shell.h 2017-01-18 02:29:37 +0000 | |||
182 | +++ include/server/mir/shell/abstract_shell.h 2017-03-17 15:52:51 +0000 | |||
183 | @@ -82,6 +82,11 @@ | |||
184 | 82 | std::shared_ptr<scene::Surface> const& surface, | 82 | std::shared_ptr<scene::Surface> const& surface, |
185 | 83 | uint64_t timestamp) override; | 83 | uint64_t timestamp) override; |
186 | 84 | 84 | ||
187 | 85 | void request_drag_and_drop( | ||
188 | 86 | std::shared_ptr<scene::Session> const& session, | ||
189 | 87 | std::shared_ptr<scene::Surface> const& surface, | ||
190 | 88 | uint64_t timestamp) override; | ||
191 | 89 | |||
192 | 85 | std::shared_ptr<scene::PromptSession> start_prompt_session_for( | 90 | std::shared_ptr<scene::PromptSession> start_prompt_session_for( |
193 | 86 | std::shared_ptr<scene::Session> const& session, | 91 | std::shared_ptr<scene::Session> const& session, |
194 | 87 | scene::PromptSessionCreationParameters const& params) override; | 92 | scene::PromptSessionCreationParameters const& params) override; |
195 | @@ -124,6 +129,9 @@ | |||
196 | 124 | 129 | ||
197 | 125 | void update_focused_surface_confined_region(); | 130 | void update_focused_surface_confined_region(); |
198 | 126 | 131 | ||
199 | 132 | void set_drag_and_drop_handle(std::vector<uint8_t> const& handle) override; | ||
200 | 133 | void clear_drag_and_drop_handle() override; | ||
201 | 134 | |||
202 | 127 | protected: | 135 | protected: |
203 | 128 | std::shared_ptr<InputTargeter> const input_targeter; | 136 | std::shared_ptr<InputTargeter> const input_targeter; |
204 | 129 | std::shared_ptr<SurfaceStack> const surface_stack; | 137 | std::shared_ptr<SurfaceStack> const surface_stack; |
205 | 130 | 138 | ||
206 | === modified file 'include/server/mir/shell/focus_controller.h' | |||
207 | --- include/server/mir/shell/focus_controller.h 2016-01-29 08:18:22 +0000 | |||
208 | +++ include/server/mir/shell/focus_controller.h 2017-03-17 15:52:51 +0000 | |||
209 | @@ -19,8 +19,10 @@ | |||
210 | 19 | #ifndef MIR_SHELL_FOCUS_CONTROLLER_H_ | 19 | #ifndef MIR_SHELL_FOCUS_CONTROLLER_H_ |
211 | 20 | #define MIR_SHELL_FOCUS_CONTROLLER_H_ | 20 | #define MIR_SHELL_FOCUS_CONTROLLER_H_ |
212 | 21 | 21 | ||
213 | 22 | #include <stddef.h> | ||
214 | 22 | #include <memory> | 23 | #include <memory> |
215 | 23 | #include <set> | 24 | #include <set> |
216 | 25 | #include <vector> | ||
217 | 24 | 26 | ||
218 | 25 | namespace mir | 27 | namespace mir |
219 | 26 | { | 28 | { |
220 | @@ -54,6 +56,9 @@ | |||
221 | 54 | 56 | ||
222 | 55 | virtual void raise(SurfaceSet const& surfaces) = 0; | 57 | virtual void raise(SurfaceSet const& surfaces) = 0; |
223 | 56 | 58 | ||
224 | 59 | virtual void set_drag_and_drop_handle(std::vector<uint8_t> const& handle) = 0; | ||
225 | 60 | virtual void clear_drag_and_drop_handle() = 0; | ||
226 | 61 | |||
227 | 57 | protected: | 62 | protected: |
228 | 58 | FocusController() = default; | 63 | FocusController() = default; |
229 | 59 | FocusController(FocusController const&) = delete; | 64 | FocusController(FocusController const&) = delete; |
230 | 60 | 65 | ||
231 | === modified file 'include/server/mir/shell/input_targeter.h' | |||
232 | --- include/server/mir/shell/input_targeter.h 2015-06-18 02:46:16 +0000 | |||
233 | +++ include/server/mir/shell/input_targeter.h 2017-03-17 15:52:51 +0000 | |||
234 | @@ -19,7 +19,9 @@ | |||
235 | 19 | #ifndef MIR_SHELL_INPUT_TARGETER_H_ | 19 | #ifndef MIR_SHELL_INPUT_TARGETER_H_ |
236 | 20 | #define MIR_SHELL_INPUT_TARGETER_H_ | 20 | #define MIR_SHELL_INPUT_TARGETER_H_ |
237 | 21 | 21 | ||
238 | 22 | #include <stddef.h> | ||
239 | 22 | #include <memory> | 23 | #include <memory> |
240 | 24 | #include <vector> | ||
241 | 23 | 25 | ||
242 | 24 | namespace mir | 26 | namespace mir |
243 | 25 | { | 27 | { |
244 | @@ -40,6 +42,9 @@ | |||
245 | 40 | virtual void set_focus(std::shared_ptr<input::Surface> const& focus_surface) = 0; | 42 | virtual void set_focus(std::shared_ptr<input::Surface> const& focus_surface) = 0; |
246 | 41 | virtual void clear_focus() = 0; | 43 | virtual void clear_focus() = 0; |
247 | 42 | 44 | ||
248 | 45 | virtual void set_drag_and_drop_handle(std::vector<uint8_t> const& handle) = 0; | ||
249 | 46 | virtual void clear_drag_and_drop_handle() = 0; | ||
250 | 47 | |||
251 | 43 | protected: | 48 | protected: |
252 | 44 | InputTargeter() = default; | 49 | InputTargeter() = default; |
253 | 45 | InputTargeter(InputTargeter const&) = delete; | 50 | InputTargeter(InputTargeter const&) = delete; |
254 | 46 | 51 | ||
255 | === modified file 'include/server/mir/shell/shell.h' | |||
256 | --- include/server/mir/shell/shell.h 2017-01-19 00:27:55 +0000 | |||
257 | +++ include/server/mir/shell/shell.h 2017-03-17 15:52:51 +0000 | |||
258 | @@ -100,6 +100,10 @@ | |||
259 | 100 | std::shared_ptr<scene::Surface> const& surface, | 100 | std::shared_ptr<scene::Surface> const& surface, |
260 | 101 | uint64_t timestamp) = 0; | 101 | uint64_t timestamp) = 0; |
261 | 102 | 102 | ||
262 | 103 | virtual void request_drag_and_drop( | ||
263 | 104 | std::shared_ptr<scene::Session> const& session, | ||
264 | 105 | std::shared_ptr<scene::Surface> const& surface, | ||
265 | 106 | uint64_t timestamp) = 0; | ||
266 | 103 | /** @} */ | 107 | /** @} */ |
267 | 104 | }; | 108 | }; |
268 | 105 | } | 109 | } |
269 | 106 | 110 | ||
270 | === modified file 'include/server/mir/shell/shell_wrapper.h' | |||
271 | --- include/server/mir/shell/shell_wrapper.h 2017-01-18 02:29:37 +0000 | |||
272 | +++ include/server/mir/shell/shell_wrapper.h 2017-03-17 15:52:51 +0000 | |||
273 | @@ -85,11 +85,19 @@ | |||
274 | 85 | std::shared_ptr<scene::Surface> const& surface, | 85 | std::shared_ptr<scene::Surface> const& surface, |
275 | 86 | uint64_t timestamp) override; | 86 | uint64_t timestamp) override; |
276 | 87 | 87 | ||
277 | 88 | void request_drag_and_drop( | ||
278 | 89 | std::shared_ptr<scene::Session> const& session, | ||
279 | 90 | std::shared_ptr<scene::Surface> const& surface, | ||
280 | 91 | uint64_t timestamp) override; | ||
281 | 92 | |||
282 | 88 | void add_display(geometry::Rectangle const& area) override; | 93 | void add_display(geometry::Rectangle const& area) override; |
283 | 89 | void remove_display(geometry::Rectangle const& area) override; | 94 | void remove_display(geometry::Rectangle const& area) override; |
284 | 90 | 95 | ||
285 | 91 | bool handle(MirEvent const& event) override; | 96 | bool handle(MirEvent const& event) override; |
286 | 92 | 97 | ||
287 | 98 | void set_drag_and_drop_handle(std::vector<uint8_t> const& handle) override; | ||
288 | 99 | void clear_drag_and_drop_handle() override; | ||
289 | 100 | |||
290 | 93 | protected: | 101 | protected: |
291 | 94 | std::shared_ptr<Shell> const wrapped; | 102 | std::shared_ptr<Shell> const wrapped; |
292 | 95 | }; | 103 | }; |
293 | 96 | 104 | ||
294 | === modified file 'include/server/mir/shell/system_compositor_window_manager.h' | |||
295 | --- include/server/mir/shell/system_compositor_window_manager.h 2017-01-18 02:29:37 +0000 | |||
296 | +++ include/server/mir/shell/system_compositor_window_manager.h 2017-03-17 15:52:51 +0000 | |||
297 | @@ -95,6 +95,11 @@ | |||
298 | 95 | std::shared_ptr<scene::Surface> const& surface, | 95 | std::shared_ptr<scene::Surface> const& surface, |
299 | 96 | uint64_t timestamp) override; | 96 | uint64_t timestamp) override; |
300 | 97 | 97 | ||
301 | 98 | void handle_request_drag_and_drop( | ||
302 | 99 | std::shared_ptr<scene::Session> const& session, | ||
303 | 100 | std::shared_ptr<scene::Surface> const& surface, | ||
304 | 101 | uint64_t timestamp) override; | ||
305 | 102 | |||
306 | 98 | int set_surface_attribute( | 103 | int set_surface_attribute( |
307 | 99 | std::shared_ptr<scene::Session> const& session, | 104 | std::shared_ptr<scene::Session> const& session, |
308 | 100 | std::shared_ptr<scene::Surface> const& surface, | 105 | std::shared_ptr<scene::Surface> const& surface, |
309 | 101 | 106 | ||
310 | === modified file 'include/server/mir/shell/window_manager.h' | |||
311 | --- include/server/mir/shell/window_manager.h 2017-01-18 02:29:37 +0000 | |||
312 | +++ include/server/mir/shell/window_manager.h 2017-03-17 15:52:51 +0000 | |||
313 | @@ -76,6 +76,11 @@ | |||
314 | 76 | std::shared_ptr<scene::Surface> const& surface, | 76 | std::shared_ptr<scene::Surface> const& surface, |
315 | 77 | uint64_t timestamp) = 0; | 77 | uint64_t timestamp) = 0; |
316 | 78 | 78 | ||
317 | 79 | virtual void handle_request_drag_and_drop( | ||
318 | 80 | std::shared_ptr<scene::Session> const& session, | ||
319 | 81 | std::shared_ptr<scene::Surface> const& surface, | ||
320 | 82 | uint64_t timestamp) = 0; | ||
321 | 83 | |||
322 | 79 | virtual ~WindowManager() = default; | 84 | virtual ~WindowManager() = default; |
323 | 80 | WindowManager() = default; | 85 | WindowManager() = default; |
324 | 81 | WindowManager(WindowManager const&) = delete; | 86 | WindowManager(WindowManager const&) = delete; |
325 | 82 | 87 | ||
326 | === modified file 'include/test/mir/test/doubles/mock_window_manager.h' | |||
327 | --- include/test/mir/test/doubles/mock_window_manager.h 2017-01-18 02:29:37 +0000 | |||
328 | +++ include/test/mir/test/doubles/mock_window_manager.h 2017-03-17 15:52:51 +0000 | |||
329 | @@ -58,6 +58,7 @@ | |||
330 | 58 | MOCK_METHOD1(handle_pointer_event, bool(MirPointerEvent const*)); | 58 | MOCK_METHOD1(handle_pointer_event, bool(MirPointerEvent const*)); |
331 | 59 | 59 | ||
332 | 60 | MOCK_METHOD3(handle_raise_surface, void(std::shared_ptr<scene::Session> const&, std::shared_ptr<scene::Surface> const&, uint64_t)); | 60 | MOCK_METHOD3(handle_raise_surface, void(std::shared_ptr<scene::Session> const&, std::shared_ptr<scene::Surface> const&, uint64_t)); |
333 | 61 | MOCK_METHOD3(handle_request_drag_and_drop, void(std::shared_ptr<scene::Session> const&, std::shared_ptr<scene::Surface> const&, uint64_t)); | ||
334 | 61 | 62 | ||
335 | 62 | MOCK_METHOD4(set_surface_attribute, | 63 | MOCK_METHOD4(set_surface_attribute, |
336 | 63 | int(std::shared_ptr<scene::Session> const& session, | 64 | int(std::shared_ptr<scene::Session> const& session, |
337 | 64 | 65 | ||
338 | === modified file 'include/test/mir/test/doubles/stub_surface.h' | |||
339 | --- include/test/mir/test/doubles/stub_surface.h 2017-02-15 14:45:41 +0000 | |||
340 | +++ include/test/mir/test/doubles/stub_surface.h 2017-03-17 15:52:51 +0000 | |||
341 | @@ -70,6 +70,7 @@ | |||
342 | 70 | void set_confine_pointer_state(MirPointerConfinementState state) override; | 70 | void set_confine_pointer_state(MirPointerConfinementState state) override; |
343 | 71 | MirPointerConfinementState confine_pointer_state() const override; | 71 | MirPointerConfinementState confine_pointer_state() const override; |
344 | 72 | void placed_relative(geometry::Rectangle const& placement) override; | 72 | void placed_relative(geometry::Rectangle const& placement) override; |
345 | 73 | void start_drag_and_drop(std::vector<uint8_t> const& handle) override; | ||
346 | 73 | }; | 74 | }; |
347 | 74 | } | 75 | } |
348 | 75 | } | 76 | } |
349 | 76 | 77 | ||
350 | === modified file 'include/test/mir_test_framework/observant_shell.h' | |||
351 | --- include/test/mir_test_framework/observant_shell.h 2017-01-20 00:01:50 +0000 | |||
352 | +++ include/test/mir_test_framework/observant_shell.h 2017-03-17 15:52:51 +0000 | |||
353 | @@ -96,6 +96,14 @@ | |||
354 | 96 | std::shared_ptr<mir::scene::Surface> const& window, | 96 | std::shared_ptr<mir::scene::Surface> const& window, |
355 | 97 | uint64_t timestamp) override; | 97 | uint64_t timestamp) override; |
356 | 98 | 98 | ||
357 | 99 | void request_drag_and_drop( | ||
358 | 100 | std::shared_ptr<mir::scene::Session> const& session, | ||
359 | 101 | std::shared_ptr<mir::scene::Surface> const& window, | ||
360 | 102 | uint64_t timestamp) override; | ||
361 | 103 | |||
362 | 104 | void set_drag_and_drop_handle(std::vector<uint8_t> const& handle) override; | ||
363 | 105 | void clear_drag_and_drop_handle() override; | ||
364 | 106 | |||
365 | 99 | private: | 107 | private: |
366 | 100 | std::shared_ptr<mir::shell::Shell> const wrapped; | 108 | std::shared_ptr<mir::shell::Shell> const wrapped; |
367 | 101 | std::shared_ptr<mir::scene::SurfaceObserver> const surface_observer; | 109 | std::shared_ptr<mir::scene::SurfaceObserver> const surface_observer; |
368 | 102 | 110 | ||
369 | === modified file 'src/capnproto/mir_event.capnp' | |||
370 | --- src/capnproto/mir_event.capnp 2017-02-17 08:46:05 +0000 | |||
371 | +++ src/capnproto/mir_event.capnp 2017-03-17 15:52:51 +0000 | |||
372 | @@ -104,6 +104,8 @@ | |||
373 | 104 | 104 | ||
374 | 105 | buttons @7 :UInt32; | 105 | buttons @7 :UInt32; |
375 | 106 | 106 | ||
376 | 107 | dndHandle @8 :List(UInt8); | ||
377 | 108 | |||
378 | 107 | enum PointerAction | 109 | enum PointerAction |
379 | 108 | { | 110 | { |
380 | 109 | up @0; | 111 | up @0; |
381 | @@ -149,6 +151,7 @@ | |||
382 | 149 | id @0 :Int32; | 151 | id @0 :Int32; |
383 | 150 | attrib @1 :Attrib; | 152 | attrib @1 :Attrib; |
384 | 151 | value @2 :Int32; | 153 | value @2 :Int32; |
385 | 154 | dndHandle @3 :List(UInt8); | ||
386 | 152 | 155 | ||
387 | 153 | enum Attrib | 156 | enum Attrib |
388 | 154 | { | 157 | { |
389 | @@ -160,8 +163,9 @@ | |||
390 | 160 | dpi @4; | 163 | dpi @4; |
391 | 161 | visibility @5; | 164 | visibility @5; |
392 | 162 | preferredOrientation @6; | 165 | preferredOrientation @6; |
393 | 166 | startDragAndDrop @7; | ||
394 | 163 | # Must be last | 167 | # Must be last |
396 | 164 | surfaceAttrib @7; | 168 | surfaceAttrib @8; |
397 | 165 | } | 169 | } |
398 | 166 | } | 170 | } |
399 | 167 | 171 | ||
400 | 168 | 172 | ||
401 | === modified file 'src/client/CMakeLists.txt' | |||
402 | --- src/client/CMakeLists.txt 2017-01-24 13:43:12 +0000 | |||
403 | +++ src/client/CMakeLists.txt 2017-03-17 15:52:51 +0000 | |||
404 | @@ -49,6 +49,7 @@ | |||
405 | 49 | add_library(mirclientobjects OBJECT | 49 | add_library(mirclientobjects OBJECT |
406 | 50 | 50 | ||
407 | 51 | display_configuration.cpp | 51 | display_configuration.cpp |
408 | 52 | drag_and_drop.cpp drag_and_drop.h | ||
409 | 52 | error_connections.cpp | 53 | error_connections.cpp |
410 | 53 | event.cpp | 54 | event.cpp |
411 | 54 | event_printer.cpp | 55 | event_printer.cpp |
412 | @@ -105,6 +106,7 @@ | |||
413 | 105 | ${CMAKE_SOURCE_DIR}/include/client/mir_toolkit/mir_error.h | 106 | ${CMAKE_SOURCE_DIR}/include/client/mir_toolkit/mir_error.h |
414 | 106 | mir_extension_core.cpp | 107 | mir_extension_core.cpp |
415 | 107 | ${CMAKE_SOURCE_DIR}/include/client/mir_toolkit/mir_extension_core.h | 108 | ${CMAKE_SOURCE_DIR}/include/client/mir_toolkit/mir_extension_core.h |
416 | 109 | ${CMAKE_SOURCE_DIR}/include/client/mir_toolkit/extensions/drag_and_drop.h | ||
417 | 108 | ) | 110 | ) |
418 | 109 | 111 | ||
419 | 110 | # Ensure protobuf C++ headers have been produced before | 112 | # Ensure protobuf C++ headers have been produced before |
420 | 111 | 113 | ||
421 | === added file 'src/client/drag_and_drop.cpp' | |||
422 | --- src/client/drag_and_drop.cpp 1970-01-01 00:00:00 +0000 | |||
423 | +++ src/client/drag_and_drop.cpp 2017-03-17 15:52:51 +0000 | |||
424 | @@ -0,0 +1,85 @@ | |||
425 | 1 | /* | ||
426 | 2 | * Copyright © 2017 Canonical Ltd. | ||
427 | 3 | * | ||
428 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
429 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
430 | 6 | * as published by the Free Software Foundation. | ||
431 | 7 | * | ||
432 | 8 | * This program is distributed in the hope that it will be useful, | ||
433 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
434 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
435 | 11 | * GNU Lesser General Public License for more details. | ||
436 | 12 | * | ||
437 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
438 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
439 | 15 | * | ||
440 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
441 | 17 | */ | ||
442 | 18 | |||
443 | 19 | #include "drag_and_drop.h" | ||
444 | 20 | #include "mir_toolkit/extensions/drag_and_drop.h" | ||
445 | 21 | |||
446 | 22 | #include "mir/uncaught.h" | ||
447 | 23 | #include "mir/events/surface_event.h" | ||
448 | 24 | #include "mir/events/pointer_event.h" | ||
449 | 25 | |||
450 | 26 | #include "mir_surface.h" | ||
451 | 27 | |||
452 | 28 | namespace | ||
453 | 29 | { | ||
454 | 30 | |||
455 | 31 | void request_drag_and_drop(MirWindow* window, MirCookie const* cookie) | ||
456 | 32 | try | ||
457 | 33 | { | ||
458 | 34 | window->request_drag_and_drop(cookie); | ||
459 | 35 | } | ||
460 | 36 | catch (std::exception const& e) | ||
461 | 37 | { | ||
462 | 38 | MIR_LOG_UNCAUGHT_EXCEPTION(e); | ||
463 | 39 | abort(); | ||
464 | 40 | } | ||
465 | 41 | |||
466 | 42 | void set_start_drag_and_drop_callback(MirWindow* window, | ||
467 | 43 | void (*callback)(MirWindow* window, MirDragAndDropEvent const* event, void* context), | ||
468 | 44 | void* context) | ||
469 | 45 | try | ||
470 | 46 | { | ||
471 | 47 | window->set_drag_and_drop_start_handler([callback,window,context](MirWindowEvent const* event) | ||
472 | 48 | { callback(window, reinterpret_cast<MirDragAndDropEvent const*>(event), context); }); | ||
473 | 49 | } | ||
474 | 50 | catch (std::exception const& e) | ||
475 | 51 | { | ||
476 | 52 | MIR_LOG_UNCAUGHT_EXCEPTION(e); | ||
477 | 53 | abort(); | ||
478 | 54 | } | ||
479 | 55 | |||
480 | 56 | MirBlob* start_drag_and_drop(MirDragAndDropEvent const* event) | ||
481 | 57 | try | ||
482 | 58 | { | ||
483 | 59 | return reinterpret_cast<MirWindowEvent const*>(event)->dnd_handle(); | ||
484 | 60 | } | ||
485 | 61 | catch (std::exception const& e) | ||
486 | 62 | { | ||
487 | 63 | MIR_LOG_UNCAUGHT_EXCEPTION(e); | ||
488 | 64 | abort(); | ||
489 | 65 | } | ||
490 | 66 | |||
491 | 67 | MirBlob* pointer_drag_and_drop(MirPointerEvent const* event) | ||
492 | 68 | try | ||
493 | 69 | { | ||
494 | 70 | return event->dnd_handle(); | ||
495 | 71 | } | ||
496 | 72 | catch (std::exception const& e) | ||
497 | 73 | { | ||
498 | 74 | MIR_LOG_UNCAUGHT_EXCEPTION(e); | ||
499 | 75 | abort(); | ||
500 | 76 | } | ||
501 | 77 | |||
502 | 78 | MirDragAndDropV1 const impl{ | ||
503 | 79 | &request_drag_and_drop, | ||
504 | 80 | &set_start_drag_and_drop_callback, | ||
505 | 81 | &start_drag_and_drop, | ||
506 | 82 | &pointer_drag_and_drop}; | ||
507 | 83 | } | ||
508 | 84 | |||
509 | 85 | MirDragAndDropV1 const* const mir::drag_and_drop::v1 = &impl; | ||
510 | 0 | 86 | ||
511 | === added file 'src/client/drag_and_drop.h' | |||
512 | --- src/client/drag_and_drop.h 1970-01-01 00:00:00 +0000 | |||
513 | +++ src/client/drag_and_drop.h 2017-03-17 15:52:51 +0000 | |||
514 | @@ -0,0 +1,32 @@ | |||
515 | 1 | /* | ||
516 | 2 | * Copyright © 2017 Canonical Ltd. | ||
517 | 3 | * | ||
518 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
519 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
520 | 6 | * as published by the Free Software Foundation. | ||
521 | 7 | * | ||
522 | 8 | * This program is distributed in the hope that it will be useful, | ||
523 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
524 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
525 | 11 | * GNU Lesser General Public License for more details. | ||
526 | 12 | * | ||
527 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
528 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
529 | 15 | * | ||
530 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
531 | 17 | */ | ||
532 | 18 | |||
533 | 19 | #ifndef MIR_DRAG_AND_DROP_V1_H | ||
534 | 20 | #define MIR_DRAG_AND_DROP_V1_H | ||
535 | 21 | |||
536 | 22 | typedef struct MirDragAndDropV1 MirDragAndDropV1; | ||
537 | 23 | |||
538 | 24 | namespace mir | ||
539 | 25 | { | ||
540 | 26 | namespace drag_and_drop | ||
541 | 27 | { | ||
542 | 28 | extern MirDragAndDropV1 const* const v1; | ||
543 | 29 | } | ||
544 | 30 | } | ||
545 | 31 | |||
546 | 32 | #endif //MIR_DRAG_AND_DROP_V1_H | ||
547 | 0 | 33 | ||
548 | === modified file 'src/client/events/event_builders.cpp' | |||
549 | --- src/client/events/event_builders.cpp 2017-02-15 13:36:35 +0000 | |||
550 | +++ src/client/events/event_builders.cpp 2017-03-17 15:52:51 +0000 | |||
551 | @@ -110,6 +110,20 @@ | |||
552 | 110 | return make_uptr_event(e); | 110 | return make_uptr_event(e); |
553 | 111 | } | 111 | } |
554 | 112 | 112 | ||
555 | 113 | auto mev::make_start_drag_and_drop_event(frontend::SurfaceId const& surface_id, std::vector<uint8_t> const& handle) | ||
556 | 114 | -> EventUPtr | ||
557 | 115 | { | ||
558 | 116 | auto e = new_event<MirWindowEvent>(); | ||
559 | 117 | |||
560 | 118 | e->set_id(surface_id.as_value()); | ||
561 | 119 | e->set_attrib(mir_window_attribs); | ||
562 | 120 | e->set_value(0); | ||
563 | 121 | e->set_dnd_handle(handle); | ||
564 | 122 | |||
565 | 123 | return make_uptr_event(e); | ||
566 | 124 | |||
567 | 125 | } | ||
568 | 126 | |||
569 | 113 | mir::EventUPtr mev::make_event(mf::SurfaceId const& surface_id) | 127 | mir::EventUPtr mev::make_event(mf::SurfaceId const& surface_id) |
570 | 114 | { | 128 | { |
571 | 115 | auto e = new_event<MirCloseWindowEvent>(); | 129 | auto e = new_event<MirCloseWindowEvent>(); |
572 | @@ -450,3 +464,14 @@ | |||
573 | 450 | BOOST_THROW_EXCEPTION(std::invalid_argument("Event has no window id.")); | 464 | BOOST_THROW_EXCEPTION(std::invalid_argument("Event has no window id.")); |
574 | 451 | } | 465 | } |
575 | 452 | } | 466 | } |
576 | 467 | |||
577 | 468 | void mev::set_drag_and_drop_handle(MirEvent& event, std::vector<uint8_t> const& handle) | ||
578 | 469 | { | ||
579 | 470 | if (event.type() == mir_event_type_input) | ||
580 | 471 | { | ||
581 | 472 | auto const input_event = event.to_input(); | ||
582 | 473 | if (mir_input_event_get_type(input_event) == mir_input_event_type_pointer) | ||
583 | 474 | const_cast<MirPointerEvent*>(mir_input_event_get_pointer_event(input_event))->set_dnd_handle(handle); | ||
584 | 475 | } | ||
585 | 476 | } | ||
586 | 477 | |||
587 | 453 | 478 | ||
588 | === modified file 'src/client/mir_blob.cpp' | |||
589 | --- src/client/mir_blob.cpp 2017-01-18 02:29:37 +0000 | |||
590 | +++ src/client/mir_blob.cpp 2017-03-17 15:52:51 +0000 | |||
591 | @@ -16,6 +16,7 @@ | |||
592 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
593 | 17 | */ | 17 | */ |
594 | 18 | 18 | ||
595 | 19 | #include "mir_blob.h" | ||
596 | 19 | #include "display_configuration.h" | 20 | #include "display_configuration.h" |
597 | 20 | 21 | ||
598 | 21 | #include "mir_toolkit/mir_blob.h" | 22 | #include "mir_toolkit/mir_blob.h" |
599 | @@ -25,14 +26,6 @@ | |||
600 | 25 | 26 | ||
601 | 26 | namespace mp = mir::protobuf; | 27 | namespace mp = mir::protobuf; |
602 | 27 | 28 | ||
603 | 28 | struct MirBlob | ||
604 | 29 | { | ||
605 | 30 | virtual size_t size() const = 0; | ||
606 | 31 | virtual void const* data() const = 0; | ||
607 | 32 | |||
608 | 33 | virtual ~MirBlob() = default; | ||
609 | 34 | }; | ||
610 | 35 | |||
611 | 36 | namespace | 29 | namespace |
612 | 37 | { | 30 | { |
613 | 38 | struct MirManagedBlob : MirBlob | 31 | struct MirManagedBlob : MirBlob |
614 | 39 | 32 | ||
615 | === modified file 'src/client/mir_connection.cpp' | |||
616 | --- src/client/mir_connection.cpp 2017-03-14 04:41:33 +0000 | |||
617 | +++ src/client/mir_connection.cpp 2017-03-17 15:52:51 +0000 | |||
618 | @@ -17,6 +17,7 @@ | |||
619 | 17 | */ | 17 | */ |
620 | 18 | 18 | ||
621 | 19 | #include "mir_connection.h" | 19 | #include "mir_connection.h" |
622 | 20 | #include "drag_and_drop.h" | ||
623 | 20 | #include "mir_surface.h" | 21 | #include "mir_surface.h" |
624 | 21 | #include "mir_prompt_session.h" | 22 | #include "mir_prompt_session.h" |
625 | 22 | #include "mir_toolkit/extensions/graphics_module.h" | 23 | #include "mir_toolkit/extensions/graphics_module.h" |
626 | @@ -1451,6 +1452,9 @@ | |||
627 | 1451 | if (!strcmp(name, "mir_extension_graphics_module") && (version == 1) && graphics_module_extension.is_set()) | 1452 | if (!strcmp(name, "mir_extension_graphics_module") && (version == 1) && graphics_module_extension.is_set()) |
628 | 1452 | return &graphics_module_extension.value(); | 1453 | return &graphics_module_extension.value(); |
629 | 1453 | 1454 | ||
630 | 1455 | if (!strcmp(name, "mir_drag_and_drop") && (version == 1)) | ||
631 | 1456 | return const_cast<MirDragAndDropV1*>(mir::drag_and_drop::v1); | ||
632 | 1457 | |||
633 | 1454 | return platform->request_interface(name, version); | 1458 | return platform->request_interface(name, version); |
634 | 1455 | } | 1459 | } |
635 | 1456 | 1460 | ||
636 | 1457 | 1461 | ||
637 | === modified file 'src/client/mir_surface.cpp' | |||
638 | --- src/client/mir_surface.cpp 2017-03-14 04:41:33 +0000 | |||
639 | +++ src/client/mir_surface.cpp 2017-03-17 15:52:51 +0000 | |||
640 | @@ -24,6 +24,7 @@ | |||
641 | 24 | #include "connection_surface_map.h" | 24 | #include "connection_surface_map.h" |
642 | 25 | 25 | ||
643 | 26 | #include "mir_toolkit/mir_client_library.h" | 26 | #include "mir_toolkit/mir_client_library.h" |
644 | 27 | #include "mir_toolkit/mir_blob.h" | ||
645 | 27 | #include "mir/frontend/client_constants.h" | 28 | #include "mir/frontend/client_constants.h" |
646 | 28 | #include "mir/client_buffer.h" | 29 | #include "mir/client_buffer.h" |
647 | 29 | #include "mir/mir_buffer_stream.h" | 30 | #include "mir/mir_buffer_stream.h" |
648 | @@ -32,6 +33,7 @@ | |||
649 | 32 | #include "mir/cookie/cookie.h" | 33 | #include "mir/cookie/cookie.h" |
650 | 33 | #include "mir_cookie.h" | 34 | #include "mir_cookie.h" |
651 | 34 | #include "mir/time/posix_timestamp.h" | 35 | #include "mir/time/posix_timestamp.h" |
652 | 36 | #include "mir/events/surface_event.h" | ||
653 | 35 | 37 | ||
654 | 36 | #include <cassert> | 38 | #include <cassert> |
655 | 37 | #include <unistd.h> | 39 | #include <unistd.h> |
656 | @@ -493,7 +495,14 @@ | |||
657 | 493 | auto sev = mir_event_get_window_event(&e); | 495 | auto sev = mir_event_get_window_event(&e); |
658 | 494 | auto a = mir_window_event_get_attribute(sev); | 496 | auto a = mir_window_event_get_attribute(sev); |
659 | 495 | if (a < mir_window_attribs) | 497 | if (a < mir_window_attribs) |
660 | 498 | { | ||
661 | 496 | attrib_cache[a] = mir_window_event_get_attribute_value(sev); | 499 | attrib_cache[a] = mir_window_event_get_attribute_value(sev); |
662 | 500 | } | ||
663 | 501 | else | ||
664 | 502 | { | ||
665 | 503 | handle_drag_and_drop_start_callback(sev); | ||
666 | 504 | return; | ||
667 | 505 | } | ||
668 | 497 | break; | 506 | break; |
669 | 498 | } | 507 | } |
670 | 499 | case mir_event_type_input: | 508 | case mir_event_type_input: |
671 | @@ -598,6 +607,29 @@ | |||
672 | 598 | google::protobuf::NewCallback(google::protobuf::DoNothing)); | 607 | google::protobuf::NewCallback(google::protobuf::DoNothing)); |
673 | 599 | } | 608 | } |
674 | 600 | 609 | ||
675 | 610 | void MirSurface::request_drag_and_drop(MirCookie const* cookie) | ||
676 | 611 | { | ||
677 | 612 | mp::RequestAuthority authority; | ||
678 | 613 | |||
679 | 614 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
680 | 615 | authority.mutable_surface_id()->set_value(surface->id().value()); | ||
681 | 616 | |||
682 | 617 | auto const event_cookie = authority.mutable_cookie(); | ||
683 | 618 | |||
684 | 619 | event_cookie->set_cookie(cookie->cookie().data(), cookie->size()); | ||
685 | 620 | |||
686 | 621 | server->request_drag_and_drop( | ||
687 | 622 | &authority, | ||
688 | 623 | void_response.get(), | ||
689 | 624 | google::protobuf::NewCallback(google::protobuf::DoNothing)); | ||
690 | 625 | } | ||
691 | 626 | |||
692 | 627 | void MirSurface::set_drag_and_drop_start_handler(std::function<void(MirWindowEvent const*)> const& callback) | ||
693 | 628 | { | ||
694 | 629 | std::lock_guard<decltype(mutex)> lock(mutex); | ||
695 | 630 | handle_drag_and_drop_start_callback = callback; | ||
696 | 631 | } | ||
697 | 632 | |||
698 | 601 | MirBufferStream* MirSurface::get_buffer_stream() | 633 | MirBufferStream* MirSurface::get_buffer_stream() |
699 | 602 | { | 634 | { |
700 | 603 | std::lock_guard<decltype(mutex)> lock(mutex); | 635 | std::lock_guard<decltype(mutex)> lock(mutex); |
701 | 604 | 636 | ||
702 | === modified file 'src/client/mir_surface.h' | |||
703 | --- src/client/mir_surface.h 2017-02-15 14:45:41 +0000 | |||
704 | +++ src/client/mir_surface.h 2017-03-17 15:52:51 +0000 | |||
705 | @@ -200,6 +200,8 @@ | |||
706 | 200 | MirWaitHandle* set_preferred_orientation(MirOrientationMode mode); | 200 | MirWaitHandle* set_preferred_orientation(MirOrientationMode mode); |
707 | 201 | 201 | ||
708 | 202 | void raise_surface(MirCookie const* cookie); | 202 | void raise_surface(MirCookie const* cookie); |
709 | 203 | void request_drag_and_drop(MirCookie const* cookie); | ||
710 | 204 | void set_drag_and_drop_start_handler(std::function<void(MirWindowEvent const*)> const& callback); | ||
711 | 203 | 205 | ||
712 | 204 | MirWaitHandle* configure_cursor(MirCursorConfiguration const* cursor); | 206 | MirWaitHandle* configure_cursor(MirCursorConfiguration const* cursor); |
713 | 205 | 207 | ||
714 | @@ -262,6 +264,8 @@ | |||
715 | 262 | std::shared_ptr<mir::client::FrameClock> const frame_clock; | 264 | std::shared_ptr<mir::client::FrameClock> const frame_clock; |
716 | 263 | 265 | ||
717 | 264 | std::function<void(MirEvent const*)> handle_event_callback; | 266 | std::function<void(MirEvent const*)> handle_event_callback; |
718 | 267 | std::function<void(MirWindowEvent const*)> handle_drag_and_drop_start_callback = [](auto){}; | ||
719 | 268 | |||
720 | 265 | std::shared_ptr<mir::dispatch::ThreadedDispatcher> input_thread; | 269 | std::shared_ptr<mir::dispatch::ThreadedDispatcher> input_thread; |
721 | 266 | 270 | ||
722 | 267 | //a bit batty, but the creation handle has to exist for as long as the MirSurface does, | 271 | //a bit batty, but the creation handle has to exist for as long as the MirSurface does, |
723 | 268 | 272 | ||
724 | === modified file 'src/client/rpc/mir_display_server.cpp' | |||
725 | --- src/client/rpc/mir_display_server.cpp 2017-02-15 07:38:33 +0000 | |||
726 | +++ src/client/rpc/mir_display_server.cpp 2017-03-17 15:52:51 +0000 | |||
727 | @@ -238,6 +238,15 @@ | |||
728 | 238 | { | 238 | { |
729 | 239 | channel->call_method(std::string(__func__), request, response, done); | 239 | channel->call_method(std::string(__func__), request, response, done); |
730 | 240 | } | 240 | } |
731 | 241 | |||
732 | 242 | void mclr::DisplayServer::request_drag_and_drop( | ||
733 | 243 | mir::protobuf::RequestAuthority const* request, | ||
734 | 244 | mir::protobuf::Void* response, | ||
735 | 245 | google::protobuf::Closure* done) | ||
736 | 246 | { | ||
737 | 247 | channel->call_method(std::string(__func__), request, response, done); | ||
738 | 248 | } | ||
739 | 249 | |||
740 | 241 | void mclr::DisplayServer::apply_input_configuration( | 250 | void mclr::DisplayServer::apply_input_configuration( |
741 | 242 | mir::protobuf::InputConfigurationRequest const* request, | 251 | mir::protobuf::InputConfigurationRequest const* request, |
742 | 243 | mir::protobuf::Void* response, | 252 | mir::protobuf::Void* response, |
743 | 244 | 253 | ||
744 | === modified file 'src/client/rpc/mir_display_server.h' | |||
745 | --- src/client/rpc/mir_display_server.h 2017-02-15 07:38:33 +0000 | |||
746 | +++ src/client/rpc/mir_display_server.h 2017-03-17 15:52:51 +0000 | |||
747 | @@ -155,6 +155,10 @@ | |||
748 | 155 | mir::protobuf::RaiseRequest const* request, | 155 | mir::protobuf::RaiseRequest const* request, |
749 | 156 | mir::protobuf::Void* response, | 156 | mir::protobuf::Void* response, |
750 | 157 | google::protobuf::Closure* done) override; | 157 | google::protobuf::Closure* done) override; |
751 | 158 | void request_drag_and_drop( | ||
752 | 159 | mir::protobuf::RequestAuthority const* request, | ||
753 | 160 | mir::protobuf::Void* response, | ||
754 | 161 | google::protobuf::Closure* done) override; | ||
755 | 158 | void apply_input_configuration( | 162 | void apply_input_configuration( |
756 | 159 | mir::protobuf::InputConfigurationRequest const* request, | 163 | mir::protobuf::InputConfigurationRequest const* request, |
757 | 160 | mir::protobuf::Void* response, | 164 | mir::protobuf::Void* response, |
758 | 161 | 165 | ||
759 | === modified file 'src/client/symbols.map' | |||
760 | --- src/client/symbols.map 2017-03-14 04:41:33 +0000 | |||
761 | +++ src/client/symbols.map 2017-03-17 15:52:51 +0000 | |||
762 | @@ -604,6 +604,8 @@ | |||
763 | 604 | global: | 604 | global: |
764 | 605 | extern "C++" { | 605 | extern "C++" { |
765 | 606 | mir::events::set_window_id*; | 606 | mir::events::set_window_id*; |
766 | 607 | mir::events::make_start_drag_and_drop_event*; | ||
767 | 608 | mir::events::set_drag_and_drop_handle*; | ||
768 | 607 | }; | 609 | }; |
769 | 608 | } MIR_CLIENT_DETAIL_0.26.1; | 610 | } MIR_CLIENT_DETAIL_0.26.1; |
770 | 609 | 611 | ||
771 | 610 | 612 | ||
772 | === modified file 'src/common/events/pointer_event.cpp' | |||
773 | --- src/common/events/pointer_event.cpp 2016-11-07 23:02:26 +0000 | |||
774 | +++ src/common/events/pointer_event.cpp 2017-03-17 15:52:51 +0000 | |||
775 | @@ -1,5 +1,5 @@ | |||
776 | 1 | /* | 1 | /* |
778 | 2 | * Copyright © 2016 Canonical Ltd. | 2 | * Copyright © 2016-2017 Canonical Ltd. |
779 | 3 | * | 3 | * |
780 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
781 | 5 | * under the terms of the GNU Lesser General Public License version 3, | 5 | * under the terms of the GNU Lesser General Public License version 3, |
782 | @@ -16,10 +16,11 @@ | |||
783 | 16 | * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> | 16 | * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> |
784 | 17 | */ | 17 | */ |
785 | 18 | 18 | ||
786 | 19 | #include "mir/events/pointer_event.h" | ||
787 | 20 | #include "mir_blob.h" | ||
788 | 21 | |||
789 | 19 | #include <boost/throw_exception.hpp> | 22 | #include <boost/throw_exception.hpp> |
790 | 20 | 23 | ||
791 | 21 | #include "mir/events/pointer_event.h" | ||
792 | 22 | |||
793 | 23 | MirPointerEvent::MirPointerEvent() | 24 | MirPointerEvent::MirPointerEvent() |
794 | 24 | { | 25 | { |
795 | 25 | event.initInput(); | 26 | event.initInput(); |
796 | @@ -132,3 +133,40 @@ | |||
797 | 132 | { | 133 | { |
798 | 133 | event.getInput().getPointer().setAction(static_cast<mir::capnp::PointerEvent::PointerAction>(action)); | 134 | event.getInput().getPointer().setAction(static_cast<mir::capnp::PointerEvent::PointerAction>(action)); |
799 | 134 | } | 135 | } |
800 | 136 | |||
801 | 137 | void MirPointerEvent::set_dnd_handle(std::vector<uint8_t> const& handle) | ||
802 | 138 | { | ||
803 | 139 | event.getInput().getPointer().initDndHandle(handle.size()); | ||
804 | 140 | event.getInput().getPointer().setDndHandle(::kj::ArrayPtr<uint8_t const>{&*begin(handle), &*end(handle)}); | ||
805 | 141 | } | ||
806 | 142 | |||
807 | 143 | namespace | ||
808 | 144 | { | ||
809 | 145 | struct MyMirBlob : MirBlob | ||
810 | 146 | { | ||
811 | 147 | |||
812 | 148 | size_t size() const override { return data_.size(); } | ||
813 | 149 | virtual void const* data() const override { return data_.data(); } | ||
814 | 150 | |||
815 | 151 | std::vector<uint8_t> data_; | ||
816 | 152 | }; | ||
817 | 153 | } | ||
818 | 154 | |||
819 | 155 | MirBlob* MirPointerEvent::dnd_handle() const | ||
820 | 156 | { | ||
821 | 157 | auto const reader = event.asReader().getInput().getPointer(); | ||
822 | 158 | |||
823 | 159 | if (!reader.hasDndHandle()) | ||
824 | 160 | return nullptr; | ||
825 | 161 | |||
826 | 162 | auto const dnd_handle = reader.getDndHandle(); | ||
827 | 163 | |||
828 | 164 | auto blob = std::make_unique<MyMirBlob>(); | ||
829 | 165 | blob->data_.reserve(dnd_handle.size()); | ||
830 | 166 | |||
831 | 167 | // Can't use std::copy() as the CapnP iterators don't provide an iterator category | ||
832 | 168 | for (auto p = dnd_handle.begin(); p != dnd_handle.end(); ++p) | ||
833 | 169 | blob->data_.push_back(*p); | ||
834 | 170 | |||
835 | 171 | return blob.release(); | ||
836 | 172 | } | ||
837 | 135 | 173 | ||
838 | === modified file 'src/common/events/surface_event.cpp' | |||
839 | --- src/common/events/surface_event.cpp 2017-01-23 03:38:33 +0000 | |||
840 | +++ src/common/events/surface_event.cpp 2017-03-17 15:52:51 +0000 | |||
841 | @@ -1,5 +1,5 @@ | |||
842 | 1 | /* | 1 | /* |
844 | 2 | * Copyright © 2016 Canonical Ltd. | 2 | * Copyright © 2016-2017 Canonical Ltd. |
845 | 3 | * | 3 | * |
846 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
847 | 5 | * under the terms of the GNU Lesser General Public License version 3, | 5 | * under the terms of the GNU Lesser General Public License version 3, |
848 | @@ -17,6 +17,7 @@ | |||
849 | 17 | */ | 17 | */ |
850 | 18 | 18 | ||
851 | 19 | #include "mir/events/surface_event.h" | 19 | #include "mir/events/surface_event.h" |
852 | 20 | #include "mir_blob.h" | ||
853 | 20 | 21 | ||
854 | 21 | // MirSurfaceEvent is a deprecated type, but we need to implement it | 22 | // MirSurfaceEvent is a deprecated type, but we need to implement it |
855 | 22 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | 23 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
856 | @@ -55,3 +56,40 @@ | |||
857 | 55 | { | 56 | { |
858 | 56 | event.getSurface().setValue(value); | 57 | event.getSurface().setValue(value); |
859 | 57 | } | 58 | } |
860 | 59 | |||
861 | 60 | void MirSurfaceEvent::set_dnd_handle(std::vector<uint8_t> const& handle) | ||
862 | 61 | { | ||
863 | 62 | event.getSurface().initDndHandle(handle.size()); | ||
864 | 63 | event.getSurface().setDndHandle(::kj::ArrayPtr<uint8_t const>{&*begin(handle), &*end(handle)}); | ||
865 | 64 | } | ||
866 | 65 | |||
867 | 66 | namespace | ||
868 | 67 | { | ||
869 | 68 | struct MyMirBlob : MirBlob | ||
870 | 69 | { | ||
871 | 70 | |||
872 | 71 | size_t size() const override { return data_.size(); } | ||
873 | 72 | virtual void const* data() const override { return data_.data(); } | ||
874 | 73 | |||
875 | 74 | std::vector<uint8_t> data_; | ||
876 | 75 | }; | ||
877 | 76 | } | ||
878 | 77 | |||
879 | 78 | MirBlob* MirSurfaceEvent::dnd_handle() const | ||
880 | 79 | { | ||
881 | 80 | if (!event.asReader().getSurface().hasDndHandle()) | ||
882 | 81 | return nullptr; | ||
883 | 82 | |||
884 | 83 | auto blob = std::make_unique<MyMirBlob>(); | ||
885 | 84 | |||
886 | 85 | auto reader = event.asReader().getSurface().getDndHandle(); | ||
887 | 86 | |||
888 | 87 | blob->data_.reserve(reader.size()); | ||
889 | 88 | |||
890 | 89 | // Can't use std::copy() as the CapnP iterators don't provide an iterator category | ||
891 | 90 | for (auto p = reader.begin(); p != reader.end(); ++p) | ||
892 | 91 | blob->data_.push_back(*p); | ||
893 | 92 | |||
894 | 93 | return blob.release(); | ||
895 | 94 | } | ||
896 | 95 | |||
897 | 58 | 96 | ||
898 | === modified file 'src/common/symbols.map' | |||
899 | --- src/common/symbols.map 2017-02-28 08:53:57 +0000 | |||
900 | +++ src/common/symbols.map 2017-03-17 15:52:51 +0000 | |||
901 | @@ -432,5 +432,9 @@ | |||
902 | 432 | MirInputEvent::window_id*; | 432 | MirInputEvent::window_id*; |
903 | 433 | MirKeyboardEvent::set_text*; | 433 | MirKeyboardEvent::set_text*; |
904 | 434 | MirKeyboardEvent::text*; | 434 | MirKeyboardEvent::text*; |
905 | 435 | MirPointerEvent::dnd_handle*; | ||
906 | 436 | MirPointerEvent::set_dnd_handle*; | ||
907 | 437 | MirSurfaceEvent::dnd_handle*; | ||
908 | 438 | MirSurfaceEvent::set_dnd_handle*; | ||
909 | 435 | }; | 439 | }; |
910 | 436 | } MIR_COMMON_0.26; | 440 | } MIR_COMMON_0.26; |
911 | 437 | 441 | ||
912 | === modified file 'src/include/common/mir/events/pointer_event.h' | |||
913 | --- src/include/common/mir/events/pointer_event.h 2016-09-22 19:21:34 +0000 | |||
914 | +++ src/include/common/mir/events/pointer_event.h 2017-03-17 15:52:51 +0000 | |||
915 | @@ -1,5 +1,5 @@ | |||
916 | 1 | /* | 1 | /* |
918 | 2 | * Copyright © 2016 Canonical Ltd. | 2 | * Copyright © 2016-2017 Canonical Ltd. |
919 | 3 | * | 3 | * |
920 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
921 | 5 | * under the terms of the GNU Lesser General Public License version 3, | 5 | * under the terms of the GNU Lesser General Public License version 3, |
922 | @@ -21,6 +21,8 @@ | |||
923 | 21 | 21 | ||
924 | 22 | #include "mir/events/input_event.h" | 22 | #include "mir/events/input_event.h" |
925 | 23 | 23 | ||
926 | 24 | typedef struct MirBlob MirBlob; | ||
927 | 25 | |||
928 | 24 | struct MirPointerEvent : MirInputEvent | 26 | struct MirPointerEvent : MirInputEvent |
929 | 25 | { | 27 | { |
930 | 26 | MirPointerEvent(); | 28 | MirPointerEvent(); |
931 | @@ -60,6 +62,9 @@ | |||
932 | 60 | 62 | ||
933 | 61 | MirPointerButtons buttons() const; | 63 | MirPointerButtons buttons() const; |
934 | 62 | void set_buttons(MirPointerButtons buttons); | 64 | void set_buttons(MirPointerButtons buttons); |
935 | 65 | |||
936 | 66 | void set_dnd_handle(std::vector<uint8_t> const& handle); | ||
937 | 67 | MirBlob* dnd_handle() const; | ||
938 | 63 | private: | 68 | private: |
939 | 64 | }; | 69 | }; |
940 | 65 | 70 | ||
941 | 66 | 71 | ||
942 | === modified file 'src/include/common/mir/events/surface_event.h' | |||
943 | --- src/include/common/mir/events/surface_event.h 2017-01-18 02:29:37 +0000 | |||
944 | +++ src/include/common/mir/events/surface_event.h 2017-03-17 15:52:51 +0000 | |||
945 | @@ -1,5 +1,5 @@ | |||
946 | 1 | /* | 1 | /* |
948 | 2 | * Copyright © 2016 Canonical Ltd. | 2 | * Copyright © 2016-2017 Canonical Ltd. |
949 | 3 | * | 3 | * |
950 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
951 | 5 | * under the terms of the GNU Lesser General Public License version 3, | 5 | * under the terms of the GNU Lesser General Public License version 3, |
952 | @@ -21,6 +21,8 @@ | |||
953 | 21 | 21 | ||
954 | 22 | #include "mir/events/event.h" | 22 | #include "mir/events/event.h" |
955 | 23 | 23 | ||
956 | 24 | typedef struct MirBlob MirBlob; | ||
957 | 25 | |||
958 | 24 | struct MirSurfaceEvent : MirEvent | 26 | struct MirSurfaceEvent : MirEvent |
959 | 25 | { | 27 | { |
960 | 26 | MirSurfaceEvent(); | 28 | MirSurfaceEvent(); |
961 | @@ -33,6 +35,9 @@ | |||
962 | 33 | 35 | ||
963 | 34 | int value() const; | 36 | int value() const; |
964 | 35 | void set_value(int value); | 37 | void set_value(int value); |
965 | 38 | |||
966 | 39 | void set_dnd_handle(std::vector<uint8_t> const& handle); | ||
967 | 40 | MirBlob* dnd_handle() const; | ||
968 | 36 | }; | 41 | }; |
969 | 37 | 42 | ||
970 | 38 | #endif /* MIR_COMMON_SURFACE_EVENT_H_ */ | 43 | #endif /* MIR_COMMON_SURFACE_EVENT_H_ */ |
971 | 39 | 44 | ||
972 | === modified file 'src/include/common/mir/protobuf/display_server.h' | |||
973 | --- src/include/common/mir/protobuf/display_server.h 2017-02-15 07:38:33 +0000 | |||
974 | +++ src/include/common/mir/protobuf/display_server.h 2017-03-17 15:52:51 +0000 | |||
975 | @@ -151,6 +151,10 @@ | |||
976 | 151 | mir::protobuf::RaiseRequest const* request, | 151 | mir::protobuf::RaiseRequest const* request, |
977 | 152 | mir::protobuf::Void* response, | 152 | mir::protobuf::Void* response, |
978 | 153 | google::protobuf::Closure* done) = 0; | 153 | google::protobuf::Closure* done) = 0; |
979 | 154 | virtual void request_drag_and_drop( | ||
980 | 155 | mir::protobuf::RequestAuthority const* request, | ||
981 | 156 | mir::protobuf::Void* response, | ||
982 | 157 | google::protobuf::Closure* done) = 0; | ||
983 | 154 | virtual void apply_input_configuration( | 158 | virtual void apply_input_configuration( |
984 | 155 | mir::protobuf::InputConfigurationRequest const* request, | 159 | mir::protobuf::InputConfigurationRequest const* request, |
985 | 156 | mir::protobuf::Void* response, | 160 | mir::protobuf::Void* response, |
986 | 157 | 161 | ||
987 | === added file 'src/include/common/mir_blob.h' | |||
988 | --- src/include/common/mir_blob.h 1970-01-01 00:00:00 +0000 | |||
989 | +++ src/include/common/mir_blob.h 2017-03-17 15:52:51 +0000 | |||
990 | @@ -0,0 +1,32 @@ | |||
991 | 1 | /* | ||
992 | 2 | * Copyright © 2017 Canonical Ltd. | ||
993 | 3 | * | ||
994 | 4 | * This program is free software: you can redistribute it and/or modify | ||
995 | 5 | * it under the terms of the GNU Lesser General Public License version 3 as | ||
996 | 6 | * published by the Free Software Foundation. | ||
997 | 7 | * | ||
998 | 8 | * This program is distributed in the hope that it will be useful, | ||
999 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1000 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1001 | 11 | * GNU Lesser General Public License for more details. | ||
1002 | 12 | * | ||
1003 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1004 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1005 | 15 | * | ||
1006 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
1007 | 17 | */ | ||
1008 | 18 | |||
1009 | 19 | #ifndef MIR_MIR_BLOB_H_H | ||
1010 | 20 | #define MIR_MIR_BLOB_H_H | ||
1011 | 21 | |||
1012 | 22 | #include <stddef.h> | ||
1013 | 23 | |||
1014 | 24 | struct MirBlob | ||
1015 | 25 | { | ||
1016 | 26 | virtual size_t size() const = 0; | ||
1017 | 27 | virtual void const* data() const = 0; | ||
1018 | 28 | |||
1019 | 29 | virtual ~MirBlob() = default; | ||
1020 | 30 | }; | ||
1021 | 31 | |||
1022 | 32 | #endif //MIR_MIR_BLOB_H_H | ||
1023 | 0 | 33 | ||
1024 | === modified file 'src/include/server/mir/frontend/shell.h' | |||
1025 | --- src/include/server/mir/frontend/shell.h 2017-01-18 02:29:37 +0000 | |||
1026 | +++ src/include/server/mir/frontend/shell.h 2017-03-17 15:52:51 +0000 | |||
1027 | @@ -87,6 +87,11 @@ | |||
1028 | 87 | SurfaceId surface_id, | 87 | SurfaceId surface_id, |
1029 | 88 | uint64_t timestamp) = 0; | 88 | uint64_t timestamp) = 0; |
1030 | 89 | 89 | ||
1031 | 90 | virtual void request_drag_and_drop( | ||
1032 | 91 | std::shared_ptr<Session> const& session, | ||
1033 | 92 | SurfaceId surface_id, | ||
1034 | 93 | uint64_t timestamp) = 0; | ||
1035 | 94 | |||
1036 | 90 | protected: | 95 | protected: |
1037 | 91 | Shell() = default; | 96 | Shell() = default; |
1038 | 92 | Shell(const Shell&) = delete; | 97 | Shell(const Shell&) = delete; |
1039 | 93 | 98 | ||
1040 | === modified file 'src/include/server/mir/scene/surface_event_source.h' | |||
1041 | --- src/include/server/mir/scene/surface_event_source.h 2017-02-15 13:36:35 +0000 | |||
1042 | +++ src/include/server/mir/scene/surface_event_source.h 2017-03-17 15:52:51 +0000 | |||
1043 | @@ -51,6 +51,7 @@ | |||
1044 | 51 | std::string const& variant, std::string const& options) override; | 51 | std::string const& variant, std::string const& options) override; |
1045 | 52 | void placed_relative(geometry::Rectangle const& placement) override; | 52 | void placed_relative(geometry::Rectangle const& placement) override; |
1046 | 53 | void input_consumed(MirEvent const* event) override; | 53 | void input_consumed(MirEvent const* event) override; |
1047 | 54 | void start_drag_and_drop(std::vector<uint8_t> const& handle) override; | ||
1048 | 54 | 55 | ||
1049 | 55 | private: | 56 | private: |
1050 | 56 | frontend::SurfaceId const id; | 57 | frontend::SurfaceId const id; |
1051 | 57 | 58 | ||
1052 | === modified file 'src/include/server/mir/scene/surface_observers.h' | |||
1053 | --- src/include/server/mir/scene/surface_observers.h 2017-02-15 13:36:35 +0000 | |||
1054 | +++ src/include/server/mir/scene/surface_observers.h 2017-03-17 15:52:51 +0000 | |||
1055 | @@ -51,6 +51,7 @@ | |||
1056 | 51 | void cursor_image_removed() override; | 51 | void cursor_image_removed() override; |
1057 | 52 | void placed_relative(geometry::Rectangle const& placement) override; | 52 | void placed_relative(geometry::Rectangle const& placement) override; |
1058 | 53 | void input_consumed(MirEvent const* event) override; | 53 | void input_consumed(MirEvent const* event) override; |
1059 | 54 | void start_drag_and_drop(std::vector<uint8_t> const& handle) override; | ||
1060 | 54 | }; | 55 | }; |
1061 | 55 | 56 | ||
1062 | 56 | } | 57 | } |
1063 | 57 | 58 | ||
1064 | === modified file 'src/include/server/mir/shell/basic_window_manager.h' | |||
1065 | --- src/include/server/mir/shell/basic_window_manager.h 2017-01-18 02:29:37 +0000 | |||
1066 | +++ src/include/server/mir/shell/basic_window_manager.h 2017-03-17 15:52:51 +0000 | |||
1067 | @@ -65,6 +65,9 @@ | |||
1068 | 65 | 65 | ||
1069 | 66 | virtual void raise_tree(std::shared_ptr<scene::Surface> const& root) = 0; | 66 | virtual void raise_tree(std::shared_ptr<scene::Surface> const& root) = 0; |
1070 | 67 | 67 | ||
1071 | 68 | virtual void set_drag_and_drop_handle(std::vector<uint8_t> const& handle) = 0; | ||
1072 | 69 | virtual void clear_drag_and_drop_handle() = 0; | ||
1073 | 70 | |||
1074 | 68 | virtual ~WindowManagerTools() = default; | 71 | virtual ~WindowManagerTools() = default; |
1075 | 69 | WindowManagerTools() = default; | 72 | WindowManagerTools() = default; |
1076 | 70 | WindowManagerTools(WindowManagerTools const&) = delete; | 73 | WindowManagerTools(WindowManagerTools const&) = delete; |
1077 | @@ -107,6 +110,10 @@ | |||
1078 | 107 | std::shared_ptr<scene::Session> const& session, | 110 | std::shared_ptr<scene::Session> const& session, |
1079 | 108 | std::shared_ptr<scene::Surface> const& surface) = 0; | 111 | std::shared_ptr<scene::Surface> const& surface) = 0; |
1080 | 109 | 112 | ||
1081 | 113 | virtual void handle_request_drag_and_drop( | ||
1082 | 114 | std::shared_ptr<scene::Session> const& session, | ||
1083 | 115 | std::shared_ptr<scene::Surface> const& surface) = 0; | ||
1084 | 116 | |||
1085 | 110 | virtual ~WindowManagementPolicy() = default; | 117 | virtual ~WindowManagementPolicy() = default; |
1086 | 111 | WindowManagementPolicy() = default; | 118 | WindowManagementPolicy() = default; |
1087 | 112 | WindowManagementPolicy(WindowManagementPolicy const&) = delete; | 119 | WindowManagementPolicy(WindowManagementPolicy const&) = delete; |
1088 | @@ -163,6 +170,11 @@ | |||
1089 | 163 | std::shared_ptr<scene::Surface> const& surface, | 170 | std::shared_ptr<scene::Surface> const& surface, |
1090 | 164 | uint64_t timestamp) override; | 171 | uint64_t timestamp) override; |
1091 | 165 | 172 | ||
1092 | 173 | void handle_request_drag_and_drop( | ||
1093 | 174 | std::shared_ptr<scene::Session> const& session, | ||
1094 | 175 | std::shared_ptr<scene::Surface> const& surface, | ||
1095 | 176 | uint64_t timestamp) override; | ||
1096 | 177 | |||
1097 | 166 | int set_surface_attribute( | 178 | int set_surface_attribute( |
1098 | 167 | std::shared_ptr<scene::Session> const& /*session*/, | 179 | std::shared_ptr<scene::Session> const& /*session*/, |
1099 | 168 | std::shared_ptr<scene::Surface> const& surface, | 180 | std::shared_ptr<scene::Surface> const& surface, |
1100 | @@ -192,6 +204,9 @@ | |||
1101 | 192 | 204 | ||
1102 | 193 | void raise_tree(std::shared_ptr<scene::Surface> const& root) override; | 205 | void raise_tree(std::shared_ptr<scene::Surface> const& root) override; |
1103 | 194 | 206 | ||
1104 | 207 | void set_drag_and_drop_handle(std::vector<uint8_t> const& handle) override; | ||
1105 | 208 | void clear_drag_and_drop_handle() override; | ||
1106 | 209 | |||
1107 | 195 | private: | 210 | private: |
1108 | 196 | shell::FocusController* const focus_controller; | 211 | shell::FocusController* const focus_controller; |
1109 | 197 | std::unique_ptr<WindowManagementPolicy> const policy; | 212 | std::unique_ptr<WindowManagementPolicy> const policy; |
1110 | 198 | 213 | ||
1111 | === modified file 'src/include/server/mir/shell/canonical_window_manager.h' | |||
1112 | --- src/include/server/mir/shell/canonical_window_manager.h 2017-01-18 02:29:37 +0000 | |||
1113 | +++ src/include/server/mir/shell/canonical_window_manager.h 2017-03-17 15:52:51 +0000 | |||
1114 | @@ -75,6 +75,10 @@ | |||
1115 | 75 | std::shared_ptr<scene::Session> const& session, | 75 | std::shared_ptr<scene::Session> const& session, |
1116 | 76 | std::shared_ptr<scene::Surface> const& surface) override; | 76 | std::shared_ptr<scene::Surface> const& surface) override; |
1117 | 77 | 77 | ||
1118 | 78 | void handle_request_drag_and_drop( | ||
1119 | 79 | std::shared_ptr<scene::Session> const& session, | ||
1120 | 80 | std::shared_ptr<scene::Surface> const& surface) override; | ||
1121 | 81 | |||
1122 | 78 | private: | 82 | private: |
1123 | 79 | static const int modifier_mask = | 83 | static const int modifier_mask = |
1124 | 80 | mir_input_event_modifier_alt | | 84 | mir_input_event_modifier_alt | |
1125 | 81 | 85 | ||
1126 | === modified file 'src/protobuf/mir_protobuf.proto' | |||
1127 | --- src/protobuf/mir_protobuf.proto 2017-03-14 04:41:33 +0000 | |||
1128 | +++ src/protobuf/mir_protobuf.proto 2017-03-17 15:52:51 +0000 | |||
1129 | @@ -444,6 +444,11 @@ | |||
1130 | 444 | required SurfaceId surface_id = 2; | 444 | required SurfaceId surface_id = 2; |
1131 | 445 | } | 445 | } |
1132 | 446 | 446 | ||
1133 | 447 | message RequestAuthority { | ||
1134 | 448 | required Cookie cookie = 1; | ||
1135 | 449 | required SurfaceId surface_id = 2; | ||
1136 | 450 | } | ||
1137 | 451 | |||
1138 | 447 | message InputDevices { | 452 | message InputDevices { |
1139 | 448 | repeated InputDeviceInfo device_info = 1; | 453 | repeated InputDeviceInfo device_info = 1; |
1140 | 449 | } | 454 | } |
1141 | 450 | 455 | ||
1142 | === modified file 'src/protobuf/symbols.map' | |||
1143 | --- src/protobuf/symbols.map 2017-02-15 07:38:33 +0000 | |||
1144 | +++ src/protobuf/symbols.map 2017-03-17 15:52:51 +0000 | |||
1145 | @@ -1112,3 +1112,29 @@ | |||
1146 | 1112 | vtable?for?mir::protobuf::PromptSession; | 1112 | vtable?for?mir::protobuf::PromptSession; |
1147 | 1113 | }; | 1113 | }; |
1148 | 1114 | } MIR_PROTOBUF_0.22; | 1114 | } MIR_PROTOBUF_0.22; |
1149 | 1115 | |||
1150 | 1116 | MIR_PROTOBUF_0.27 { | ||
1151 | 1117 | global: | ||
1152 | 1118 | extern "C++" { | ||
1153 | 1119 | mir::protobuf::RequestAuthority::ByteSize*; | ||
1154 | 1120 | mir::protobuf::RequestAuthority::CheckTypeAndMergeFrom*; | ||
1155 | 1121 | mir::protobuf::RequestAuthority::Clear*; | ||
1156 | 1122 | mir::protobuf::RequestAuthority::CopyFrom*; | ||
1157 | 1123 | mir::protobuf::RequestAuthority::default_instance*; | ||
1158 | 1124 | mir::protobuf::RequestAuthority::DiscardUnknownFields*; | ||
1159 | 1125 | mir::protobuf::RequestAuthority::GetTypeName*; | ||
1160 | 1126 | mir::protobuf::RequestAuthority::IsInitialized*; | ||
1161 | 1127 | mir::protobuf::RequestAuthority::kCookieFieldNumber*; | ||
1162 | 1128 | mir::protobuf::RequestAuthority::kSurfaceIdFieldNumber*; | ||
1163 | 1129 | mir::protobuf::RequestAuthority::MergeFrom*; | ||
1164 | 1130 | mir::protobuf::RequestAuthority::MergePartialFromCodedStream*; | ||
1165 | 1131 | mir::protobuf::RequestAuthority::New*; | ||
1166 | 1132 | mir::protobuf::RequestAuthority::?RequestAuthority*; | ||
1167 | 1133 | mir::protobuf::RequestAuthority::RequestAuthority*; | ||
1168 | 1134 | mir::protobuf::RequestAuthority::SerializeWithCachedSizes*; | ||
1169 | 1135 | mir::protobuf::RequestAuthority::Swap*; | ||
1170 | 1136 | non-virtual?thunk?to?mir::protobuf::RequestAuthority::?RequestAuthority*; | ||
1171 | 1137 | typeinfo?for?mir::protobuf::RequestAuthority; | ||
1172 | 1138 | vtable?for?mir::protobuf::RequestAuthority; | ||
1173 | 1139 | }; | ||
1174 | 1140 | } MIR_PROTOBUF_0.26; | ||
1175 | 1115 | 1141 | ||
1176 | === modified file 'src/server/frontend/protobuf_message_processor.cpp' | |||
1177 | --- src/server/frontend/protobuf_message_processor.cpp 2017-02-15 07:38:33 +0000 | |||
1178 | +++ src/server/frontend/protobuf_message_processor.cpp 2017-03-17 15:52:51 +0000 | |||
1179 | @@ -305,6 +305,10 @@ | |||
1180 | 305 | { | 305 | { |
1181 | 306 | invoke(this, display_server.get(), &protobuf::DisplayServer::stop_prompt_session, invocation); | 306 | invoke(this, display_server.get(), &protobuf::DisplayServer::stop_prompt_session, invocation); |
1182 | 307 | } | 307 | } |
1183 | 308 | else if ("request_drag_and_drop" == invocation.method_name()) | ||
1184 | 309 | { | ||
1185 | 310 | invoke(this, display_server.get(), &protobuf::DisplayServer::request_drag_and_drop, invocation); | ||
1186 | 311 | } | ||
1187 | 308 | else if ("disconnect" == invocation.method_name()) | 312 | else if ("disconnect" == invocation.method_name()) |
1188 | 309 | { | 313 | { |
1189 | 310 | invoke(this, display_server.get(), &DisplayServer::disconnect, invocation); | 314 | invoke(this, display_server.get(), &DisplayServer::disconnect, invocation); |
1190 | 311 | 315 | ||
1191 | === modified file 'src/server/frontend/session_mediator.cpp' | |||
1192 | --- src/server/frontend/session_mediator.cpp 2017-03-14 04:41:33 +0000 | |||
1193 | +++ src/server/frontend/session_mediator.cpp 2017-03-17 15:52:51 +0000 | |||
1194 | @@ -1175,6 +1175,26 @@ | |||
1195 | 1175 | done->Run(); | 1175 | done->Run(); |
1196 | 1176 | } | 1176 | } |
1197 | 1177 | 1177 | ||
1198 | 1178 | void mir::frontend::SessionMediator::request_drag_and_drop(mir::protobuf::RequestAuthority const* request, | ||
1199 | 1179 | mir::protobuf::Void*, google::protobuf::Closure* done) | ||
1200 | 1180 | { | ||
1201 | 1181 | auto const session = weak_session.lock(); | ||
1202 | 1182 | if (!session) | ||
1203 | 1183 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session")); | ||
1204 | 1184 | |||
1205 | 1185 | auto const cookie = request->cookie(); | ||
1206 | 1186 | auto const surface_id = request->surface_id(); | ||
1207 | 1187 | |||
1208 | 1188 | auto cookie_string = cookie.cookie(); | ||
1209 | 1189 | |||
1210 | 1190 | std::vector<uint8_t> cookie_bytes(cookie_string.begin(), cookie_string.end()); | ||
1211 | 1191 | auto const cookie_ptr = cookie_authority->make_cookie(cookie_bytes); | ||
1212 | 1192 | |||
1213 | 1193 | shell->request_drag_and_drop(session, mf::SurfaceId{surface_id.value()}, cookie_ptr->timestamp()); | ||
1214 | 1194 | |||
1215 | 1195 | done->Run(); | ||
1216 | 1196 | } | ||
1217 | 1197 | |||
1218 | 1178 | void mf::SessionMediator::apply_input_configuration( | 1198 | void mf::SessionMediator::apply_input_configuration( |
1219 | 1179 | mir::protobuf::InputConfigurationRequest const* request, | 1199 | mir::protobuf::InputConfigurationRequest const* request, |
1220 | 1180 | mir::protobuf::Void*, | 1200 | mir::protobuf::Void*, |
1221 | @@ -1254,7 +1274,6 @@ | |||
1222 | 1254 | screencast_buffer_tracker.remove_session(id); | 1274 | screencast_buffer_tracker.remove_session(id); |
1223 | 1255 | } | 1275 | } |
1224 | 1256 | 1276 | ||
1225 | 1257 | |||
1226 | 1258 | auto mf::detail::PromptSessionStore::insert(std::shared_ptr<PromptSession> const& session) -> PromptSessionId | 1277 | auto mf::detail::PromptSessionStore::insert(std::shared_ptr<PromptSession> const& session) -> PromptSessionId |
1227 | 1259 | { | 1278 | { |
1228 | 1260 | std::lock_guard<decltype(mutex)> lock{mutex}; | 1279 | std::lock_guard<decltype(mutex)> lock{mutex}; |
1229 | 1261 | 1280 | ||
1230 | === modified file 'src/server/frontend/session_mediator.h' | |||
1231 | --- src/server/frontend/session_mediator.h 2017-03-14 02:26:28 +0000 | |||
1232 | +++ src/server/frontend/session_mediator.h 2017-03-17 15:52:51 +0000 | |||
1233 | @@ -249,6 +249,10 @@ | |||
1234 | 249 | mir::protobuf::RaiseRequest const* request, | 249 | mir::protobuf::RaiseRequest const* request, |
1235 | 250 | mir::protobuf::Void*, | 250 | mir::protobuf::Void*, |
1236 | 251 | google::protobuf::Closure* done) override; | 251 | google::protobuf::Closure* done) override; |
1237 | 252 | void request_drag_and_drop( | ||
1238 | 253 | mir::protobuf::RequestAuthority const* request, | ||
1239 | 254 | mir::protobuf::Void*, | ||
1240 | 255 | google::protobuf::Closure* done) override; | ||
1241 | 252 | void apply_input_configuration( | 256 | void apply_input_configuration( |
1242 | 253 | mir::protobuf::InputConfigurationRequest const* request, | 257 | mir::protobuf::InputConfigurationRequest const* request, |
1243 | 254 | mir::protobuf::Void* response, | 258 | mir::protobuf::Void* response, |
1244 | 255 | 259 | ||
1245 | === modified file 'src/server/frontend/shell_wrapper.cpp' | |||
1246 | --- src/server/frontend/shell_wrapper.cpp 2017-01-18 02:29:37 +0000 | |||
1247 | +++ src/server/frontend/shell_wrapper.cpp 2017-03-17 15:52:51 +0000 | |||
1248 | @@ -106,3 +106,11 @@ | |||
1249 | 106 | { | 106 | { |
1250 | 107 | wrapped->raise_surface(session, surface_id, timestamp); | 107 | wrapped->raise_surface(session, surface_id, timestamp); |
1251 | 108 | } | 108 | } |
1252 | 109 | |||
1253 | 110 | void mf::ShellWrapper::request_drag_and_drop( | ||
1254 | 111 | std::shared_ptr<Session> const& session, | ||
1255 | 112 | SurfaceId surface_id, | ||
1256 | 113 | uint64_t timestamp) | ||
1257 | 114 | { | ||
1258 | 115 | wrapped->request_drag_and_drop(session, surface_id, timestamp); | ||
1259 | 116 | } | ||
1260 | 109 | 117 | ||
1261 | === modified file 'src/server/frontend/shell_wrapper.h' | |||
1262 | --- src/server/frontend/shell_wrapper.h 2017-01-18 02:29:37 +0000 | |||
1263 | +++ src/server/frontend/shell_wrapper.h 2017-03-17 15:52:51 +0000 | |||
1264 | @@ -80,6 +80,11 @@ | |||
1265 | 80 | SurfaceId surface_id, | 80 | SurfaceId surface_id, |
1266 | 81 | uint64_t timestamp) override; | 81 | uint64_t timestamp) override; |
1267 | 82 | 82 | ||
1268 | 83 | void request_drag_and_drop( | ||
1269 | 84 | std::shared_ptr<Session> const& session, | ||
1270 | 85 | SurfaceId surface_id, | ||
1271 | 86 | uint64_t timestamp) override; | ||
1272 | 87 | |||
1273 | 83 | protected: | 88 | protected: |
1274 | 84 | std::shared_ptr<Shell> const wrapped; | 89 | std::shared_ptr<Shell> const wrapped; |
1275 | 85 | }; | 90 | }; |
1276 | 86 | 91 | ||
1277 | === modified file 'src/server/input/null_input_targeter.h' | |||
1278 | --- src/server/input/null_input_targeter.h 2017-02-15 14:45:41 +0000 | |||
1279 | +++ src/server/input/null_input_targeter.h 2017-03-17 15:52:51 +0000 | |||
1280 | @@ -38,6 +38,9 @@ | |||
1281 | 38 | void clear_focus() override | 38 | void clear_focus() override |
1282 | 39 | { | 39 | { |
1283 | 40 | } | 40 | } |
1284 | 41 | |||
1285 | 42 | void set_drag_and_drop_handle(std::vector<uint8_t> const&) override {} | ||
1286 | 43 | void clear_drag_and_drop_handle() override {} | ||
1287 | 41 | }; | 44 | }; |
1288 | 42 | 45 | ||
1289 | 43 | } | 46 | } |
1290 | 44 | 47 | ||
1291 | === modified file 'src/server/input/surface_input_dispatcher.cpp' | |||
1292 | --- src/server/input/surface_input_dispatcher.cpp 2017-01-18 02:29:37 +0000 | |||
1293 | +++ src/server/input/surface_input_dispatcher.cpp 2017-03-17 15:52:51 +0000 | |||
1294 | @@ -70,7 +70,10 @@ | |||
1295 | 70 | std::function<void(ms::Surface*)> const on_removed; | 70 | std::function<void(ms::Surface*)> const on_removed; |
1296 | 71 | }; | 71 | }; |
1297 | 72 | 72 | ||
1299 | 73 | void deliver_without_relative_motion(std::shared_ptr<mi::Surface> const& surface, MirEvent const* ev) | 73 | void deliver_without_relative_motion( |
1300 | 74 | std::shared_ptr<mi::Surface> const& surface, | ||
1301 | 75 | MirEvent const* ev, | ||
1302 | 76 | std::vector<uint8_t> const& drag_and_drop_handle) | ||
1303 | 74 | { | 77 | { |
1304 | 75 | auto const* input_ev = mir_event_get_input_event(ev); | 78 | auto const* input_ev = mir_event_get_input_event(ev); |
1305 | 76 | auto const* pev = mir_input_event_get_pointer_event(input_ev); | 79 | auto const* pev = mir_input_event_get_pointer_event(input_ev); |
1306 | @@ -98,12 +101,21 @@ | |||
1307 | 98 | 0.0f); | 101 | 0.0f); |
1308 | 99 | 102 | ||
1309 | 100 | mev::transform_positions(*to_deliver, geom::Displacement{bounds.top_left.x.as_int(), bounds.top_left.y.as_int()}); | 103 | mev::transform_positions(*to_deliver, geom::Displacement{bounds.top_left.x.as_int(), bounds.top_left.y.as_int()}); |
1310 | 104 | if (!drag_and_drop_handle.empty()) | ||
1311 | 105 | mev::set_drag_and_drop_handle(*to_deliver, drag_and_drop_handle); | ||
1312 | 101 | surface->consume(to_deliver.get()); | 106 | surface->consume(to_deliver.get()); |
1313 | 102 | } | 107 | } |
1314 | 103 | 108 | ||
1316 | 104 | void deliver(std::shared_ptr<mi::Surface> const& surface, MirEvent const* ev) | 109 | void deliver( |
1317 | 110 | std::shared_ptr<mi::Surface> const& surface, | ||
1318 | 111 | MirEvent const* ev, | ||
1319 | 112 | std::vector<uint8_t> const& drag_and_drop_handle) | ||
1320 | 105 | { | 113 | { |
1321 | 106 | auto to_deliver = mev::clone_event(*ev); | 114 | auto to_deliver = mev::clone_event(*ev); |
1322 | 115 | |||
1323 | 116 | if (!drag_and_drop_handle.empty()) | ||
1324 | 117 | mev::set_drag_and_drop_handle(*to_deliver, drag_and_drop_handle); | ||
1325 | 118 | |||
1326 | 107 | auto const& bounds = surface->input_bounds(); | 119 | auto const& bounds = surface->input_bounds(); |
1327 | 108 | mev::transform_positions(*to_deliver, geom::Displacement{bounds.top_left.x.as_int(), bounds.top_left.y.as_int()}); | 120 | mev::transform_positions(*to_deliver, geom::Displacement{bounds.top_left.x.as_int(), bounds.top_left.y.as_int()}); |
1328 | 109 | surface->consume(to_deliver.get()); | 121 | surface->consume(to_deliver.get()); |
1329 | @@ -243,6 +255,8 @@ | |||
1330 | 243 | mir_pointer_event_axis_value(pev, mir_pointer_axis_relative_x), | 255 | mir_pointer_event_axis_value(pev, mir_pointer_axis_relative_x), |
1331 | 244 | mir_pointer_event_axis_value(pev, mir_pointer_axis_relative_y)); | 256 | mir_pointer_event_axis_value(pev, mir_pointer_axis_relative_y)); |
1332 | 245 | 257 | ||
1333 | 258 | if (!drag_and_drop_handle.empty()) | ||
1334 | 259 | mev::set_drag_and_drop_handle(*event, drag_and_drop_handle); | ||
1335 | 246 | surface->consume(event.get()); | 260 | surface->consume(event.get()); |
1336 | 247 | } | 261 | } |
1337 | 248 | 262 | ||
1338 | @@ -270,12 +284,17 @@ | |||
1339 | 270 | 284 | ||
1340 | 271 | if (pointer_state.gesture_owner) | 285 | if (pointer_state.gesture_owner) |
1341 | 272 | { | 286 | { |
1345 | 273 | deliver(pointer_state.gesture_owner, ev); | 287 | deliver(pointer_state.gesture_owner, ev, drag_and_drop_handle); |
1346 | 274 | 288 | ||
1347 | 275 | if (is_gesture_terminator(pev)) | 289 | auto const gesture_terminated = is_gesture_terminator(pev); |
1348 | 290 | |||
1349 | 291 | if (gesture_terminated) | ||
1350 | 276 | { | 292 | { |
1351 | 277 | pointer_state.gesture_owner.reset(); | 293 | pointer_state.gesture_owner.reset(); |
1352 | 294 | } | ||
1353 | 278 | 295 | ||
1354 | 296 | if (gesture_terminated || !drag_and_drop_handle.empty()) | ||
1355 | 297 | { | ||
1356 | 279 | auto target = find_target_surface(event_x_y); | 298 | auto target = find_target_surface(event_x_y); |
1357 | 280 | 299 | ||
1358 | 281 | if (pointer_state.current_target != target) | 300 | if (pointer_state.current_target != target) |
1359 | @@ -286,6 +305,9 @@ | |||
1360 | 286 | pointer_state.current_target = target; | 305 | pointer_state.current_target = target; |
1361 | 287 | if (target) | 306 | if (target) |
1362 | 288 | send_enter_exit_event(target, pev, mir_pointer_action_enter); | 307 | send_enter_exit_event(target, pev, mir_pointer_action_enter); |
1363 | 308 | |||
1364 | 309 | if (!gesture_terminated) | ||
1365 | 310 | pointer_state.gesture_owner = target; | ||
1366 | 289 | } | 311 | } |
1367 | 290 | } | 312 | } |
1368 | 291 | 313 | ||
1369 | @@ -323,11 +345,11 @@ | |||
1370 | 323 | if (sent_ev) | 345 | if (sent_ev) |
1371 | 324 | { | 346 | { |
1372 | 325 | if (action != mir_pointer_action_motion) | 347 | if (action != mir_pointer_action_motion) |
1374 | 326 | deliver_without_relative_motion(target, ev); | 348 | deliver_without_relative_motion(target, ev, drag_and_drop_handle); |
1375 | 327 | } | 349 | } |
1376 | 328 | else | 350 | else |
1377 | 329 | { | 351 | { |
1379 | 330 | deliver(target, ev); | 352 | deliver(target, ev, drag_and_drop_handle); |
1380 | 331 | } | 353 | } |
1381 | 332 | return true; | 354 | return true; |
1382 | 333 | } | 355 | } |
1383 | @@ -383,7 +405,7 @@ | |||
1384 | 383 | 405 | ||
1385 | 384 | if (gesture_owner) | 406 | if (gesture_owner) |
1386 | 385 | { | 407 | { |
1388 | 386 | deliver(gesture_owner, ev); | 408 | deliver(gesture_owner, ev, drag_and_drop_handle); |
1389 | 387 | 409 | ||
1390 | 388 | if (is_gesture_end(tev)) | 410 | if (is_gesture_end(tev)) |
1391 | 389 | gesture_owner.reset(); | 411 | gesture_owner.reset(); |
1392 | @@ -450,3 +472,15 @@ | |||
1393 | 450 | set_focus_locked(lg, nullptr); | 472 | set_focus_locked(lg, nullptr); |
1394 | 451 | } | 473 | } |
1395 | 452 | 474 | ||
1396 | 475 | void mir::input::SurfaceInputDispatcher::set_drag_and_drop_handle(std::vector<uint8_t> const& handle) | ||
1397 | 476 | { | ||
1398 | 477 | std::lock_guard<std::mutex> lg(dispatcher_mutex); | ||
1399 | 478 | drag_and_drop_handle = handle; | ||
1400 | 479 | } | ||
1401 | 480 | |||
1402 | 481 | void mir::input::SurfaceInputDispatcher::clear_drag_and_drop_handle() | ||
1403 | 482 | { | ||
1404 | 483 | std::lock_guard<std::mutex> lg(dispatcher_mutex); | ||
1405 | 484 | drag_and_drop_handle.clear(); | ||
1406 | 485 | } | ||
1407 | 486 | |||
1408 | 453 | 487 | ||
1409 | === modified file 'src/server/input/surface_input_dispatcher.h' | |||
1410 | --- src/server/input/surface_input_dispatcher.h 2016-10-05 13:18:38 +0000 | |||
1411 | +++ src/server/input/surface_input_dispatcher.h 2017-03-17 15:52:51 +0000 | |||
1412 | @@ -54,7 +54,10 @@ | |||
1413 | 54 | // InputTargeter | 54 | // InputTargeter |
1414 | 55 | void set_focus(std::shared_ptr<input::Surface> const& target) override; | 55 | void set_focus(std::shared_ptr<input::Surface> const& target) override; |
1415 | 56 | void clear_focus() override; | 56 | void clear_focus() override; |
1417 | 57 | 57 | ||
1418 | 58 | void set_drag_and_drop_handle(std::vector<uint8_t> const& handle) override; | ||
1419 | 59 | void clear_drag_and_drop_handle() override; | ||
1420 | 60 | |||
1421 | 58 | private: | 61 | private: |
1422 | 59 | void device_reset(MirInputDeviceId reset_device_id, std::chrono::nanoseconds when); | 62 | void device_reset(MirInputDeviceId reset_device_id, std::chrono::nanoseconds when); |
1423 | 60 | bool dispatch_key(MirEvent const* kev); | 63 | bool dispatch_key(MirEvent const* kev); |
1424 | @@ -92,6 +95,7 @@ | |||
1425 | 92 | 95 | ||
1426 | 93 | std::mutex dispatcher_mutex; | 96 | std::mutex dispatcher_mutex; |
1427 | 94 | std::weak_ptr<input::Surface> focus_surface; | 97 | std::weak_ptr<input::Surface> focus_surface; |
1428 | 98 | std::vector<uint8_t> drag_and_drop_handle; | ||
1429 | 95 | bool started; | 99 | bool started; |
1430 | 96 | }; | 100 | }; |
1431 | 97 | 101 | ||
1432 | 98 | 102 | ||
1433 | === modified file 'src/server/scene/basic_surface.cpp' | |||
1434 | --- src/server/scene/basic_surface.cpp 2017-02-15 14:45:41 +0000 | |||
1435 | +++ src/server/scene/basic_surface.cpp 2017-03-17 15:52:51 +0000 | |||
1436 | @@ -144,6 +144,12 @@ | |||
1437 | 144 | { observer->input_consumed(event); }); | 144 | { observer->input_consumed(event); }); |
1438 | 145 | } | 145 | } |
1439 | 146 | 146 | ||
1440 | 147 | void ms::SurfaceObservers::start_drag_and_drop(std::vector<uint8_t> const& handle) | ||
1441 | 148 | { | ||
1442 | 149 | for_each([&](std::shared_ptr<SurfaceObserver> const& observer) | ||
1443 | 150 | { observer->start_drag_and_drop(handle); }); | ||
1444 | 151 | } | ||
1445 | 152 | |||
1446 | 147 | 153 | ||
1447 | 148 | struct ms::CursorStreamImageAdapter | 154 | struct ms::CursorStreamImageAdapter |
1448 | 149 | { | 155 | { |
1449 | @@ -923,3 +929,8 @@ | |||
1450 | 923 | { | 929 | { |
1451 | 924 | observers.placed_relative(placement); | 930 | observers.placed_relative(placement); |
1452 | 925 | } | 931 | } |
1453 | 932 | |||
1454 | 933 | void mir::scene::BasicSurface::start_drag_and_drop(std::vector<uint8_t> const& handle) | ||
1455 | 934 | { | ||
1456 | 935 | observers.start_drag_and_drop(handle); | ||
1457 | 936 | } | ||
1458 | 926 | 937 | ||
1459 | === modified file 'src/server/scene/basic_surface.h' | |||
1460 | --- src/server/scene/basic_surface.h 2017-02-15 14:45:41 +0000 | |||
1461 | +++ src/server/scene/basic_surface.h 2017-03-17 15:52:51 +0000 | |||
1462 | @@ -139,6 +139,7 @@ | |||
1463 | 139 | void set_confine_pointer_state(MirPointerConfinementState state) override; | 139 | void set_confine_pointer_state(MirPointerConfinementState state) override; |
1464 | 140 | MirPointerConfinementState confine_pointer_state() const override; | 140 | MirPointerConfinementState confine_pointer_state() const override; |
1465 | 141 | void placed_relative(geometry::Rectangle const& placement) override; | 141 | void placed_relative(geometry::Rectangle const& placement) override; |
1466 | 142 | void start_drag_and_drop(std::vector<uint8_t> const& handle) override; | ||
1467 | 142 | 143 | ||
1468 | 143 | private: | 144 | private: |
1469 | 144 | bool visible(std::unique_lock<std::mutex>&) const; | 145 | bool visible(std::unique_lock<std::mutex>&) const; |
1470 | 145 | 146 | ||
1471 | === modified file 'src/server/scene/legacy_surface_change_notification.cpp' | |||
1472 | --- src/server/scene/legacy_surface_change_notification.cpp 2017-02-15 13:36:35 +0000 | |||
1473 | +++ src/server/scene/legacy_surface_change_notification.cpp 2017-03-17 15:52:51 +0000 | |||
1474 | @@ -108,3 +108,7 @@ | |||
1475 | 108 | void ms::LegacySurfaceChangeNotification::input_consumed(MirEvent const*) | 108 | void ms::LegacySurfaceChangeNotification::input_consumed(MirEvent const*) |
1476 | 109 | { | 109 | { |
1477 | 110 | } | 110 | } |
1478 | 111 | |||
1479 | 112 | void ms::LegacySurfaceChangeNotification::start_drag_and_drop(std::vector<uint8_t> const& /*handle*/) | ||
1480 | 113 | { | ||
1481 | 114 | } | ||
1482 | 111 | \ No newline at end of file | 115 | \ No newline at end of file |
1483 | 112 | 116 | ||
1484 | === modified file 'src/server/scene/legacy_surface_change_notification.h' | |||
1485 | --- src/server/scene/legacy_surface_change_notification.h 2017-02-15 13:36:35 +0000 | |||
1486 | +++ src/server/scene/legacy_surface_change_notification.h 2017-03-17 15:52:51 +0000 | |||
1487 | @@ -51,6 +51,7 @@ | |||
1488 | 51 | void cursor_image_removed() override; | 51 | void cursor_image_removed() override; |
1489 | 52 | void placed_relative(geometry::Rectangle const& placement) override; | 52 | void placed_relative(geometry::Rectangle const& placement) override; |
1490 | 53 | void input_consumed(MirEvent const* event) override; | 53 | void input_consumed(MirEvent const* event) override; |
1491 | 54 | void start_drag_and_drop(std::vector<uint8_t> const& handle) override; | ||
1492 | 54 | 55 | ||
1493 | 55 | private: | 56 | private: |
1494 | 56 | std::function<void()> const notify_scene_change; | 57 | std::function<void()> const notify_scene_change; |
1495 | 57 | 58 | ||
1496 | === modified file 'src/server/scene/null_surface_observer.cpp' | |||
1497 | --- src/server/scene/null_surface_observer.cpp 2017-02-15 13:36:35 +0000 | |||
1498 | +++ src/server/scene/null_surface_observer.cpp 2017-03-17 15:52:51 +0000 | |||
1499 | @@ -41,3 +41,4 @@ | |||
1500 | 41 | void ms::NullSurfaceObserver::cursor_image_removed() {} | 41 | void ms::NullSurfaceObserver::cursor_image_removed() {} |
1501 | 42 | void ms::NullSurfaceObserver::placed_relative(geometry::Rectangle const& /*placement*/) {} | 42 | void ms::NullSurfaceObserver::placed_relative(geometry::Rectangle const& /*placement*/) {} |
1502 | 43 | void ms::NullSurfaceObserver::input_consumed(MirEvent const* /*event*/) {} | 43 | void ms::NullSurfaceObserver::input_consumed(MirEvent const* /*event*/) {} |
1503 | 44 | void ms::NullSurfaceObserver::start_drag_and_drop(std::vector<uint8_t> const& /*handle*/) {} | ||
1504 | 44 | 45 | ||
1505 | === modified file 'src/server/scene/surface_event_source.cpp' | |||
1506 | --- src/server/scene/surface_event_source.cpp 2017-02-15 13:36:35 +0000 | |||
1507 | +++ src/server/scene/surface_event_source.cpp 2017-03-17 15:52:51 +0000 | |||
1508 | @@ -101,3 +101,8 @@ | |||
1509 | 101 | mev::set_window_id(*ev, id.as_value()); | 101 | mev::set_window_id(*ev, id.as_value()); |
1510 | 102 | event_sink->handle_event(*ev); | 102 | event_sink->handle_event(*ev); |
1511 | 103 | } | 103 | } |
1512 | 104 | |||
1513 | 105 | void ms::SurfaceEventSource::start_drag_and_drop(std::vector<uint8_t> const& handle) | ||
1514 | 106 | { | ||
1515 | 107 | event_sink->handle_event(*mev::make_start_drag_and_drop_event(id, handle)); | ||
1516 | 108 | } | ||
1517 | 104 | 109 | ||
1518 | === modified file 'src/server/shell/abstract_shell.cpp' | |||
1519 | --- src/server/shell/abstract_shell.cpp 2017-03-10 19:47:57 +0000 | |||
1520 | +++ src/server/shell/abstract_shell.cpp 2017-03-17 15:52:51 +0000 | |||
1521 | @@ -251,6 +251,14 @@ | |||
1522 | 251 | window_manager->handle_raise_surface(session, surface, timestamp); | 251 | window_manager->handle_raise_surface(session, surface, timestamp); |
1523 | 252 | } | 252 | } |
1524 | 253 | 253 | ||
1525 | 254 | void msh::AbstractShell::request_drag_and_drop( | ||
1526 | 255 | std::shared_ptr<scene::Session> const& session, | ||
1527 | 256 | std::shared_ptr<scene::Surface> const& surface, | ||
1528 | 257 | uint64_t timestamp) | ||
1529 | 258 | { | ||
1530 | 259 | window_manager->handle_request_drag_and_drop(session, surface, timestamp); | ||
1531 | 260 | } | ||
1532 | 261 | |||
1533 | 254 | void msh::AbstractShell::focus_next_session() | 262 | void msh::AbstractShell::focus_next_session() |
1534 | 255 | { | 263 | { |
1535 | 256 | std::unique_lock<std::mutex> lock(focus_mutex); | 264 | std::unique_lock<std::mutex> lock(focus_mutex); |
1536 | @@ -401,3 +409,12 @@ | |||
1537 | 401 | report->surfaces_raised(surfaces); | 409 | report->surfaces_raised(surfaces); |
1538 | 402 | } | 410 | } |
1539 | 403 | 411 | ||
1540 | 412 | void msh::AbstractShell::set_drag_and_drop_handle(std::vector<uint8_t> const& handle) | ||
1541 | 413 | { | ||
1542 | 414 | input_targeter->set_drag_and_drop_handle(handle); | ||
1543 | 415 | } | ||
1544 | 416 | |||
1545 | 417 | void msh::AbstractShell::clear_drag_and_drop_handle() | ||
1546 | 418 | { | ||
1547 | 419 | input_targeter->clear_drag_and_drop_handle(); | ||
1548 | 420 | } | ||
1549 | 404 | 421 | ||
1550 | === modified file 'src/server/shell/basic_window_manager.cpp' | |||
1551 | --- src/server/shell/basic_window_manager.cpp 2017-01-18 02:29:37 +0000 | |||
1552 | +++ src/server/shell/basic_window_manager.cpp 2017-03-17 15:52:51 +0000 | |||
1553 | @@ -135,6 +135,16 @@ | |||
1554 | 135 | policy->handle_raise_surface(session, surface); | 135 | policy->handle_raise_surface(session, surface); |
1555 | 136 | } | 136 | } |
1556 | 137 | 137 | ||
1557 | 138 | void msh::BasicWindowManager::handle_request_drag_and_drop( | ||
1558 | 139 | std::shared_ptr<scene::Session> const& session, | ||
1559 | 140 | std::shared_ptr<scene::Surface> const& surface, | ||
1560 | 141 | uint64_t timestamp) | ||
1561 | 142 | { | ||
1562 | 143 | std::lock_guard<decltype(mutex)> lock(mutex); | ||
1563 | 144 | if (timestamp >= last_input_event_timestamp) | ||
1564 | 145 | policy->handle_request_drag_and_drop(session, surface); | ||
1565 | 146 | } | ||
1566 | 147 | |||
1567 | 138 | int msh::BasicWindowManager::set_surface_attribute( | 148 | int msh::BasicWindowManager::set_surface_attribute( |
1568 | 139 | std::shared_ptr<scene::Session> const& /*session*/, | 149 | std::shared_ptr<scene::Session> const& /*session*/, |
1569 | 140 | std::shared_ptr<scene::Surface> const& surface, | 150 | std::shared_ptr<scene::Surface> const& surface, |
1570 | @@ -309,3 +319,14 @@ | |||
1571 | 309 | } | 319 | } |
1572 | 310 | } | 320 | } |
1573 | 311 | } | 321 | } |
1574 | 322 | |||
1575 | 323 | void mir::shell::BasicWindowManager::set_drag_and_drop_handle(std::vector<uint8_t> const& handle) | ||
1576 | 324 | { | ||
1577 | 325 | focus_controller->set_drag_and_drop_handle(handle); | ||
1578 | 326 | } | ||
1579 | 327 | |||
1580 | 328 | void mir::shell::BasicWindowManager::clear_drag_and_drop_handle() | ||
1581 | 329 | { | ||
1582 | 330 | focus_controller->clear_drag_and_drop_handle(); | ||
1583 | 331 | } | ||
1584 | 332 | |||
1585 | 312 | 333 | ||
1586 | === modified file 'src/server/shell/canonical_window_manager.cpp' | |||
1587 | --- src/server/shell/canonical_window_manager.cpp 2017-03-10 19:47:57 +0000 | |||
1588 | +++ src/server/shell/canonical_window_manager.cpp 2017-03-17 15:52:51 +0000 | |||
1589 | @@ -24,6 +24,7 @@ | |||
1590 | 24 | #include "mir/shell/surface_ready_observer.h" | 24 | #include "mir/shell/surface_ready_observer.h" |
1591 | 25 | #include "mir/shell/display_layout.h" | 25 | #include "mir/shell/display_layout.h" |
1592 | 26 | 26 | ||
1593 | 27 | #include <uuid/uuid.h> | ||
1594 | 27 | #include <linux/input.h> | 28 | #include <linux/input.h> |
1595 | 28 | #include <csignal> | 29 | #include <csignal> |
1596 | 29 | 30 | ||
1597 | @@ -583,6 +584,18 @@ | |||
1598 | 583 | select_active_surface(surface); | 584 | select_active_surface(surface); |
1599 | 584 | } | 585 | } |
1600 | 585 | 586 | ||
1601 | 587 | void msh::CanonicalWindowManagerPolicy::handle_request_drag_and_drop( | ||
1602 | 588 | std::shared_ptr<ms::Session> const& /*session*/, | ||
1603 | 589 | std::shared_ptr<ms::Surface> const& surface) | ||
1604 | 590 | { | ||
1605 | 591 | uuid_t uuid; | ||
1606 | 592 | uuid_generate(uuid); | ||
1607 | 593 | std::vector<uint8_t> const handle{std::begin(uuid), std::end(uuid)}; | ||
1608 | 594 | |||
1609 | 595 | surface->start_drag_and_drop(handle); | ||
1610 | 596 | tools->set_drag_and_drop_handle(handle); | ||
1611 | 597 | } | ||
1612 | 598 | |||
1613 | 586 | bool msh::CanonicalWindowManagerPolicy::handle_keyboard_event(MirKeyboardEvent const* event) | 599 | bool msh::CanonicalWindowManagerPolicy::handle_keyboard_event(MirKeyboardEvent const* event) |
1614 | 587 | { | 600 | { |
1615 | 588 | auto const action = mir_keyboard_event_action(event); | 601 | auto const action = mir_keyboard_event_action(event); |
1616 | 589 | 602 | ||
1617 | === modified file 'src/server/shell/frontend_shell.cpp' | |||
1618 | --- src/server/shell/frontend_shell.cpp 2017-01-18 02:29:37 +0000 | |||
1619 | +++ src/server/shell/frontend_shell.cpp 2017-03-17 15:52:51 +0000 | |||
1620 | @@ -157,3 +157,13 @@ | |||
1621 | 157 | auto const surface = scene_session->surface(surface_id); | 157 | auto const surface = scene_session->surface(surface_id); |
1622 | 158 | wrapped->raise_surface(scene_session, surface, timestamp); | 158 | wrapped->raise_surface(scene_session, surface, timestamp); |
1623 | 159 | } | 159 | } |
1624 | 160 | |||
1625 | 161 | void msh::FrontendShell::request_drag_and_drop( | ||
1626 | 162 | std::shared_ptr<mf::Session> const& session, | ||
1627 | 163 | mf::SurfaceId surface_id, | ||
1628 | 164 | uint64_t timestamp) | ||
1629 | 165 | { | ||
1630 | 166 | auto const scene_session = std::dynamic_pointer_cast<ms::Session>(session); | ||
1631 | 167 | auto const surface = scene_session->surface(surface_id); | ||
1632 | 168 | wrapped->request_drag_and_drop(scene_session, surface, timestamp); | ||
1633 | 169 | } | ||
1634 | 160 | 170 | ||
1635 | === modified file 'src/server/shell/frontend_shell.h' | |||
1636 | --- src/server/shell/frontend_shell.h 2017-01-18 02:29:37 +0000 | |||
1637 | +++ src/server/shell/frontend_shell.h 2017-03-17 15:52:51 +0000 | |||
1638 | @@ -91,6 +91,11 @@ | |||
1639 | 91 | std::shared_ptr<mf::Session> const& session, | 91 | std::shared_ptr<mf::Session> const& session, |
1640 | 92 | mf::SurfaceId surface_id, | 92 | mf::SurfaceId surface_id, |
1641 | 93 | uint64_t timestamp) override; | 93 | uint64_t timestamp) override; |
1642 | 94 | |||
1643 | 95 | void request_drag_and_drop( | ||
1644 | 96 | std::shared_ptr<mf::Session> const& session, | ||
1645 | 97 | mf::SurfaceId surface_id, | ||
1646 | 98 | uint64_t timestamp) override; | ||
1647 | 94 | }; | 99 | }; |
1648 | 95 | } | 100 | } |
1649 | 96 | } | 101 | } |
1650 | 97 | 102 | ||
1651 | === modified file 'src/server/shell/shell_wrapper.cpp' | |||
1652 | --- src/server/shell/shell_wrapper.cpp 2017-01-18 02:29:37 +0000 | |||
1653 | +++ src/server/shell/shell_wrapper.cpp 2017-03-17 15:52:51 +0000 | |||
1654 | @@ -120,6 +120,14 @@ | |||
1655 | 120 | wrapped->raise_surface(session, surface, timestamp); | 120 | wrapped->raise_surface(session, surface, timestamp); |
1656 | 121 | } | 121 | } |
1657 | 122 | 122 | ||
1658 | 123 | void msh::ShellWrapper::request_drag_and_drop( | ||
1659 | 124 | std::shared_ptr<ms::Session> const& session, | ||
1660 | 125 | std::shared_ptr<ms::Surface> const& surface, | ||
1661 | 126 | uint64_t timestamp) | ||
1662 | 127 | { | ||
1663 | 128 | wrapped->request_drag_and_drop(session, surface, timestamp); | ||
1664 | 129 | } | ||
1665 | 130 | |||
1666 | 123 | void msh::ShellWrapper::add_display(geometry::Rectangle const& area) | 131 | void msh::ShellWrapper::add_display(geometry::Rectangle const& area) |
1667 | 124 | { | 132 | { |
1668 | 125 | wrapped->add_display(area); | 133 | wrapped->add_display(area); |
1669 | @@ -149,3 +157,13 @@ | |||
1670 | 149 | { | 157 | { |
1671 | 150 | return wrapped->raise(surfaces); | 158 | return wrapped->raise(surfaces); |
1672 | 151 | } | 159 | } |
1673 | 160 | |||
1674 | 161 | void msh::ShellWrapper::set_drag_and_drop_handle(std::vector<uint8_t> const& handle) | ||
1675 | 162 | { | ||
1676 | 163 | wrapped->set_drag_and_drop_handle(handle); | ||
1677 | 164 | } | ||
1678 | 165 | |||
1679 | 166 | void msh::ShellWrapper::clear_drag_and_drop_handle() | ||
1680 | 167 | { | ||
1681 | 168 | wrapped->clear_drag_and_drop_handle(); | ||
1682 | 169 | } | ||
1683 | 152 | 170 | ||
1684 | === modified file 'src/server/shell/system_compositor_window_manager.cpp' | |||
1685 | --- src/server/shell/system_compositor_window_manager.cpp 2017-01-18 02:29:37 +0000 | |||
1686 | +++ src/server/shell/system_compositor_window_manager.cpp 2017-03-17 15:52:51 +0000 | |||
1687 | @@ -201,3 +201,10 @@ | |||
1688 | 201 | uint64_t /*timestamp*/) | 201 | uint64_t /*timestamp*/) |
1689 | 202 | { | 202 | { |
1690 | 203 | } | 203 | } |
1691 | 204 | |||
1692 | 205 | void msh::SystemCompositorWindowManager::handle_request_drag_and_drop( | ||
1693 | 206 | std::shared_ptr<ms::Session> const& /*session*/, | ||
1694 | 207 | std::shared_ptr<ms::Surface> const& /*surface*/, | ||
1695 | 208 | uint64_t /*timestamp*/) | ||
1696 | 209 | { | ||
1697 | 210 | } | ||
1698 | 204 | 211 | ||
1699 | === modified file 'src/server/symbols.map' | |||
1700 | --- src/server/symbols.map 2017-03-15 10:38:02 +0000 | |||
1701 | +++ src/server/symbols.map 2017-03-17 15:52:51 +0000 | |||
1702 | @@ -129,6 +129,7 @@ | |||
1703 | 129 | mir::scene::NullSurfaceObserver::reception_mode_set_to*; | 129 | mir::scene::NullSurfaceObserver::reception_mode_set_to*; |
1704 | 130 | mir::scene::NullSurfaceObserver::renamed*; | 130 | mir::scene::NullSurfaceObserver::renamed*; |
1705 | 131 | mir::scene::NullSurfaceObserver::resized_to*; | 131 | mir::scene::NullSurfaceObserver::resized_to*; |
1706 | 132 | mir::scene::NullSurfaceObserver::start_drag_and_drop*; | ||
1707 | 132 | mir::scene::NullSurfaceObserver::transformation_set_to*; | 133 | mir::scene::NullSurfaceObserver::transformation_set_to*; |
1708 | 133 | mir::scene::Observer::?Observer*; | 134 | mir::scene::Observer::?Observer*; |
1709 | 134 | mir::scene::Observer::Observer*; | 135 | mir::scene::Observer::Observer*; |
1710 | @@ -293,6 +294,7 @@ | |||
1711 | 293 | mir::shell::ShellReport::ShellReport*; | 294 | mir::shell::ShellReport::ShellReport*; |
1712 | 294 | mir::shell::ShellWrapper::add_display*; | 295 | mir::shell::ShellWrapper::add_display*; |
1713 | 295 | mir::shell::ShellWrapper::add_prompt_provider_for*; | 296 | mir::shell::ShellWrapper::add_prompt_provider_for*; |
1714 | 297 | mir::shell::ShellWrapper::clear_drag_and_drop_handle*; | ||
1715 | 296 | mir::shell::ShellWrapper::close_session*; | 298 | mir::shell::ShellWrapper::close_session*; |
1716 | 297 | mir::shell::ShellWrapper::create_surface*; | 299 | mir::shell::ShellWrapper::create_surface*; |
1717 | 298 | mir::shell::ShellWrapper::destroy_surface*; | 300 | mir::shell::ShellWrapper::destroy_surface*; |
1718 | @@ -306,9 +308,11 @@ | |||
1719 | 306 | mir::shell::ShellWrapper::raise*; | 308 | mir::shell::ShellWrapper::raise*; |
1720 | 307 | mir::shell::ShellWrapper::raise_surface*; | 309 | mir::shell::ShellWrapper::raise_surface*; |
1721 | 308 | mir::shell::ShellWrapper::remove_display*; | 310 | mir::shell::ShellWrapper::remove_display*; |
1722 | 311 | mir::shell::ShellWrapper::request_drag_and_drop*; | ||
1723 | 309 | mir::shell::ShellWrapper::set_focus_to*; | 312 | mir::shell::ShellWrapper::set_focus_to*; |
1724 | 310 | mir::shell::ShellWrapper::set_surface_attribute*; | 313 | mir::shell::ShellWrapper::set_surface_attribute*; |
1725 | 311 | mir::shell::ShellWrapper::ShellWrapper*; | 314 | mir::shell::ShellWrapper::ShellWrapper*; |
1726 | 315 | mir::shell::ShellWrapper::set_drag_and_drop_handle*; | ||
1727 | 312 | mir::shell::ShellWrapper::start_prompt_session_for*; | 316 | mir::shell::ShellWrapper::start_prompt_session_for*; |
1728 | 313 | mir::shell::ShellWrapper::stop_prompt_session*; | 317 | mir::shell::ShellWrapper::stop_prompt_session*; |
1729 | 314 | mir::shell::ShellWrapper::surface_at*; | 318 | mir::shell::ShellWrapper::surface_at*; |
1730 | @@ -338,6 +342,7 @@ | |||
1731 | 338 | mir::shell::SystemCompositorWindowManager::remove_display*; | 342 | mir::shell::SystemCompositorWindowManager::remove_display*; |
1732 | 339 | mir::shell::SystemCompositorWindowManager::remove_session*; | 343 | mir::shell::SystemCompositorWindowManager::remove_session*; |
1733 | 340 | mir::shell::SystemCompositorWindowManager::remove_surface*; | 344 | mir::shell::SystemCompositorWindowManager::remove_surface*; |
1734 | 345 | mir::shell::SystemCompositorWindowManager::handle_request_drag_and_drop*; | ||
1735 | 341 | mir::shell::SystemCompositorWindowManager::set_surface_attribute*; | 346 | mir::shell::SystemCompositorWindowManager::set_surface_attribute*; |
1736 | 342 | mir::shell::SystemCompositorWindowManager::SystemCompositorWindowManager*; | 347 | mir::shell::SystemCompositorWindowManager::SystemCompositorWindowManager*; |
1737 | 343 | mir::shell::WindowManager::operator*; | 348 | mir::shell::WindowManager::operator*; |
1738 | @@ -695,6 +700,7 @@ | |||
1739 | 695 | mir::shell::CanonicalWindowManagerPolicy::handle_touch_event*; | 700 | mir::shell::CanonicalWindowManagerPolicy::handle_touch_event*; |
1740 | 696 | mir::shell::CanonicalWindowManagerPolicy::handle_pointer_event*; | 701 | mir::shell::CanonicalWindowManagerPolicy::handle_pointer_event*; |
1741 | 697 | mir::shell::CanonicalWindowManagerPolicy::handle_raise_surface*; | 702 | mir::shell::CanonicalWindowManagerPolicy::handle_raise_surface*; |
1742 | 703 | mir::shell::CanonicalWindowManagerPolicy::handle_request_drag_and_drop*; | ||
1743 | 698 | typeinfo?for?mir::shell::CanonicalWindowManagerPolicy; | 704 | typeinfo?for?mir::shell::CanonicalWindowManagerPolicy; |
1744 | 699 | vtable?for?mir::shell::CanonicalWindowManagerPolicy; | 705 | vtable?for?mir::shell::CanonicalWindowManagerPolicy; |
1745 | 700 | VTT?for?mir::shell::CanonicalWindowManagerPolicy; | 706 | VTT?for?mir::shell::CanonicalWindowManagerPolicy; |
1746 | @@ -831,6 +837,7 @@ | |||
1747 | 831 | mir::shell::BasicWindowManager::add_session*; | 837 | mir::shell::BasicWindowManager::add_session*; |
1748 | 832 | mir::shell::BasicWindowManager::add_surface*; | 838 | mir::shell::BasicWindowManager::add_surface*; |
1749 | 833 | mir::shell::BasicWindowManager::BasicWindowManager*; | 839 | mir::shell::BasicWindowManager::BasicWindowManager*; |
1750 | 840 | mir::shell::BasicWindowManager::clear_drag_and_drop_handle*; | ||
1751 | 834 | mir::shell::BasicWindowManager::find_session*; | 841 | mir::shell::BasicWindowManager::find_session*; |
1752 | 835 | mir::shell::BasicWindowManager::focused_session*; | 842 | mir::shell::BasicWindowManager::focused_session*; |
1753 | 836 | mir::shell::BasicWindowManager::focused_surface*; | 843 | mir::shell::BasicWindowManager::focused_surface*; |
1754 | @@ -839,6 +846,7 @@ | |||
1755 | 839 | mir::shell::BasicWindowManager::handle_keyboard_event*; | 846 | mir::shell::BasicWindowManager::handle_keyboard_event*; |
1756 | 840 | mir::shell::BasicWindowManager::handle_pointer_event*; | 847 | mir::shell::BasicWindowManager::handle_pointer_event*; |
1757 | 841 | mir::shell::BasicWindowManager::handle_raise_surface*; | 848 | mir::shell::BasicWindowManager::handle_raise_surface*; |
1758 | 849 | mir::shell::BasicWindowManager::handle_request_drag_and_drop*; | ||
1759 | 842 | mir::shell::BasicWindowManager::handle_touch_event*; | 850 | mir::shell::BasicWindowManager::handle_touch_event*; |
1760 | 843 | mir::shell::BasicWindowManager::info_for*; | 851 | mir::shell::BasicWindowManager::info_for*; |
1761 | 844 | mir::shell::BasicWindowManager::modify_surface*; | 852 | mir::shell::BasicWindowManager::modify_surface*; |
1762 | @@ -846,6 +854,7 @@ | |||
1763 | 846 | mir::shell::BasicWindowManager::remove_display*; | 854 | mir::shell::BasicWindowManager::remove_display*; |
1764 | 847 | mir::shell::BasicWindowManager::remove_session*; | 855 | mir::shell::BasicWindowManager::remove_session*; |
1765 | 848 | mir::shell::BasicWindowManager::remove_surface*; | 856 | mir::shell::BasicWindowManager::remove_surface*; |
1766 | 857 | mir::shell::BasicWindowManager::set_drag_and_drop_handle*; | ||
1767 | 849 | mir::shell::BasicWindowManager::set_focus_to*; | 858 | mir::shell::BasicWindowManager::set_focus_to*; |
1768 | 850 | mir::shell::BasicWindowManager::set_surface_attribute*; | 859 | mir::shell::BasicWindowManager::set_surface_attribute*; |
1769 | 851 | mir::shell::BasicWindowManager::surface_at*; | 860 | mir::shell::BasicWindowManager::surface_at*; |
1770 | @@ -856,6 +865,7 @@ | |||
1771 | 856 | virtual?thunk?to?mir::shell::BasicWindowManager::handle_keyboard_event*; | 865 | virtual?thunk?to?mir::shell::BasicWindowManager::handle_keyboard_event*; |
1772 | 857 | virtual?thunk?to?mir::shell::BasicWindowManager::handle_pointer_event*; | 866 | virtual?thunk?to?mir::shell::BasicWindowManager::handle_pointer_event*; |
1773 | 858 | virtual?thunk?to?mir::shell::BasicWindowManager::handle_raise_surface*; | 867 | virtual?thunk?to?mir::shell::BasicWindowManager::handle_raise_surface*; |
1774 | 868 | virtual?thunk?to?mir::shell::BasicWindowManager::handle_request_drag_and_drop*; | ||
1775 | 859 | virtual?thunk?to?mir::shell::BasicWindowManager::handle_touch_event*; | 869 | virtual?thunk?to?mir::shell::BasicWindowManager::handle_touch_event*; |
1776 | 860 | virtual?thunk?to?mir::shell::BasicWindowManager::modify_surface*; | 870 | virtual?thunk?to?mir::shell::BasicWindowManager::modify_surface*; |
1777 | 861 | virtual?thunk?to?mir::shell::BasicWindowManager::remove_display*; | 871 | virtual?thunk?to?mir::shell::BasicWindowManager::remove_display*; |
1778 | 862 | 872 | ||
1779 | === modified file 'tests/acceptance-tests/CMakeLists.txt' | |||
1780 | --- tests/acceptance-tests/CMakeLists.txt 2017-03-10 19:47:57 +0000 | |||
1781 | +++ tests/acceptance-tests/CMakeLists.txt 2017-03-17 15:52:51 +0000 | |||
1782 | @@ -3,6 +3,8 @@ | |||
1783 | 3 | set( | 3 | set( |
1784 | 4 | SOURCES | 4 | SOURCES |
1785 | 5 | 5 | ||
1786 | 6 | drag_and_drop.cpp | ||
1787 | 7 | |||
1788 | 6 | # Catch double-free bugs by wrapping close() and abort()ing on EBADF | 8 | # Catch double-free bugs by wrapping close() and abort()ing on EBADF |
1789 | 7 | strict_close.cpp | 9 | strict_close.cpp |
1790 | 8 | 10 | ||
1791 | 9 | 11 | ||
1792 | === added file 'tests/acceptance-tests/drag_and_drop.cpp' | |||
1793 | --- tests/acceptance-tests/drag_and_drop.cpp 1970-01-01 00:00:00 +0000 | |||
1794 | +++ tests/acceptance-tests/drag_and_drop.cpp 2017-03-17 15:52:51 +0000 | |||
1795 | @@ -0,0 +1,624 @@ | |||
1796 | 1 | /* | ||
1797 | 2 | * Copyright © 2017 Canonical Ltd. | ||
1798 | 3 | * | ||
1799 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1800 | 5 | * under the terms of the GNU General Public License version 3, | ||
1801 | 6 | * as published by the Free Software Foundation. | ||
1802 | 7 | * | ||
1803 | 8 | * This program is distributed in the hope that it will be useful, | ||
1804 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1805 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1806 | 11 | * GNU General Public License for more details. | ||
1807 | 12 | * | ||
1808 | 13 | * You should have received a copy of the GNU General Public License | ||
1809 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1810 | 15 | * | ||
1811 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
1812 | 17 | */ | ||
1813 | 18 | |||
1814 | 19 | #include <mir_toolkit/extensions/drag_and_drop.h> | ||
1815 | 20 | #include <mir_toolkit/mir_blob.h> | ||
1816 | 21 | |||
1817 | 22 | #include <mir/geometry/displacement.h> | ||
1818 | 23 | #include <mir/input/input_device_info.h> | ||
1819 | 24 | #include <mir/input/device_capability.h> | ||
1820 | 25 | #include <mir/shell/shell.h> | ||
1821 | 26 | |||
1822 | 27 | #include <mir_test_framework/connected_client_with_a_window.h> | ||
1823 | 28 | #include <mir_test_framework/fake_input_device.h> | ||
1824 | 29 | #include <mir_test_framework/stub_server_platform_factory.h> | ||
1825 | 30 | #include <mir/test/event_factory.h> | ||
1826 | 31 | #include <mir/test/signal.h> | ||
1827 | 32 | |||
1828 | 33 | #include <gmock/gmock.h> | ||
1829 | 34 | #include <gtest/gtest.h> | ||
1830 | 35 | |||
1831 | 36 | #include <linux/input.h> | ||
1832 | 37 | |||
1833 | 38 | #include <boost/throw_exception.hpp> | ||
1834 | 39 | #include <atomic> | ||
1835 | 40 | |||
1836 | 41 | using namespace std::chrono_literals; | ||
1837 | 42 | using namespace mir::geometry; | ||
1838 | 43 | using namespace testing; | ||
1839 | 44 | using mir::test::Signal; | ||
1840 | 45 | |||
1841 | 46 | namespace | ||
1842 | 47 | { | ||
1843 | 48 | class Cookie | ||
1844 | 49 | { | ||
1845 | 50 | public: | ||
1846 | 51 | Cookie() = default; | ||
1847 | 52 | explicit Cookie(MirCookie const* cookie) : self{cookie, deleter} {} | ||
1848 | 53 | |||
1849 | 54 | operator MirCookie const*() const { return self.get(); } | ||
1850 | 55 | auto get() const -> MirCookie const* { return self.get(); } | ||
1851 | 56 | |||
1852 | 57 | void reset() { self.reset(); } | ||
1853 | 58 | void reset(MirCookie const* cookie) { self.reset(cookie, deleter); } | ||
1854 | 59 | |||
1855 | 60 | private: | ||
1856 | 61 | static void deleter(MirCookie const* cookie) { mir_cookie_release(cookie); } | ||
1857 | 62 | std::shared_ptr<MirCookie const> self; | ||
1858 | 63 | }; | ||
1859 | 64 | |||
1860 | 65 | void mir_cookie_release(Cookie const&) = delete; | ||
1861 | 66 | |||
1862 | 67 | class Blob | ||
1863 | 68 | { | ||
1864 | 69 | public: | ||
1865 | 70 | Blob() = default; | ||
1866 | 71 | explicit Blob(MirBlob* blob) : self{blob, deleter} {} | ||
1867 | 72 | |||
1868 | 73 | operator MirBlob*() const { return self.get(); } | ||
1869 | 74 | auto get() const -> MirBlob* { return self.get(); } | ||
1870 | 75 | |||
1871 | 76 | void reset() { self.reset(); } | ||
1872 | 77 | void reset(MirBlob* blob) { self.reset(blob, deleter); } | ||
1873 | 78 | |||
1874 | 79 | private: | ||
1875 | 80 | static void deleter(MirBlob* blob) { mir_blob_release(blob); } | ||
1876 | 81 | std::shared_ptr<MirBlob> self; | ||
1877 | 82 | }; | ||
1878 | 83 | |||
1879 | 84 | void mir_blob_release(Blob const&) = delete; | ||
1880 | 85 | |||
1881 | 86 | struct MouseMoverAndFaker | ||
1882 | 87 | { | ||
1883 | 88 | void start_dragging_mouse() | ||
1884 | 89 | { | ||
1885 | 90 | using namespace mir::input::synthesis; | ||
1886 | 91 | fake_mouse->emit_event(a_button_down_event().of_button(BTN_LEFT)); | ||
1887 | 92 | } | ||
1888 | 93 | |||
1889 | 94 | void move_mouse(Displacement const& displacement) | ||
1890 | 95 | { | ||
1891 | 96 | using mir::input::synthesis::a_pointer_event; | ||
1892 | 97 | fake_mouse->emit_event(a_pointer_event().with_movement(displacement.dx.as_int(), displacement.dy.as_int())); | ||
1893 | 98 | } | ||
1894 | 99 | |||
1895 | 100 | void release_mouse() | ||
1896 | 101 | { | ||
1897 | 102 | using namespace mir::input::synthesis; | ||
1898 | 103 | fake_mouse->emit_event(a_button_up_event().of_button(BTN_LEFT)); | ||
1899 | 104 | } | ||
1900 | 105 | |||
1901 | 106 | private: | ||
1902 | 107 | std::unique_ptr<mir_test_framework::FakeInputDevice> fake_mouse{ | ||
1903 | 108 | mir_test_framework::add_fake_input_device( | ||
1904 | 109 | mir::input::InputDeviceInfo{"mouse", "mouse-uid", mir::input::DeviceCapability::pointer})}; | ||
1905 | 110 | }; | ||
1906 | 111 | |||
1907 | 112 | Rectangle const screen_geometry{{0,0}, {800,600}}; | ||
1908 | 113 | auto const receive_event_timeout = 90s; | ||
1909 | 114 | |||
1910 | 115 | struct DragAndDrop : mir_test_framework::ConnectedClientWithAWindow, | ||
1911 | 116 | MouseMoverAndFaker | ||
1912 | 117 | { | ||
1913 | 118 | MirDragAndDropV1 const* dnd = nullptr; | ||
1914 | 119 | |||
1915 | 120 | void SetUp() override | ||
1916 | 121 | { | ||
1917 | 122 | initial_display_layout({screen_geometry}); | ||
1918 | 123 | mir_test_framework::ConnectedClientWithAWindow::SetUp(); | ||
1919 | 124 | dnd = mir_drag_and_drop_v1(connection); | ||
1920 | 125 | mir_window_set_event_handler(window, &window_event_handler, this); | ||
1921 | 126 | if (dnd) dnd->set_start_drag_and_drop_callback(window, &window_dnd_start_handler, this); | ||
1922 | 127 | |||
1923 | 128 | create_target_window(); | ||
1924 | 129 | |||
1925 | 130 | paint_window(window); | ||
1926 | 131 | |||
1927 | 132 | center_mouse(); | ||
1928 | 133 | } | ||
1929 | 134 | |||
1930 | 135 | void TearDown() override | ||
1931 | 136 | { | ||
1932 | 137 | reset_window_event_handler(target_window); | ||
1933 | 138 | reset_window_event_handler(window); | ||
1934 | 139 | mir_window_release_sync(target_window); | ||
1935 | 140 | mir_connection_release(another_connection); | ||
1936 | 141 | mir_test_framework::ConnectedClientWithAWindow::TearDown(); | ||
1937 | 142 | } | ||
1938 | 143 | |||
1939 | 144 | auto user_initiates_drag() -> Cookie; | ||
1940 | 145 | auto client_requests_drag(Cookie const& cookie) -> Blob; | ||
1941 | 146 | auto handle_from_mouse_move() -> Blob; | ||
1942 | 147 | auto handle_from_mouse_leave() -> Blob; | ||
1943 | 148 | auto handle_from_mouse_enter() -> Blob; | ||
1944 | 149 | auto handle_from_mouse_release() -> Blob; | ||
1945 | 150 | auto count_of_handles_when_moving_mouse() -> int; | ||
1946 | 151 | |||
1947 | 152 | private: | ||
1948 | 153 | void center_mouse(); | ||
1949 | 154 | void paint_window(MirWindow* w); | ||
1950 | 155 | void set_window_event_handler(MirWindow* window, std::function<void(MirEvent const* event)> const& handler); | ||
1951 | 156 | void set_window_dnd_start_handler(MirWindow* window, std::function<void(MirDragAndDropEvent const*)> const& handler); | ||
1952 | 157 | void reset_window_event_handler(MirWindow* window); | ||
1953 | 158 | |||
1954 | 159 | void create_target_window() | ||
1955 | 160 | { | ||
1956 | 161 | another_connection = mir_connect_sync(new_connection().c_str(), "another_connection"); | ||
1957 | 162 | auto const spec = mir_create_normal_window_spec( | ||
1958 | 163 | connection, screen_geometry.size.width.as_int(), screen_geometry.size.height.as_int()); | ||
1959 | 164 | mir_window_spec_set_pixel_format(spec, mir_pixel_format_abgr_8888); | ||
1960 | 165 | mir_window_spec_set_name(spec, "target_window"); | ||
1961 | 166 | mir_window_spec_set_buffer_usage(spec, mir_buffer_usage_hardware); | ||
1962 | 167 | mir_window_spec_set_event_handler(spec, &window_event_handler, this); | ||
1963 | 168 | |||
1964 | 169 | target_window = mir_create_window_sync(spec); | ||
1965 | 170 | mir_window_spec_release(spec); | ||
1966 | 171 | |||
1967 | 172 | paint_window(target_window); | ||
1968 | 173 | } | ||
1969 | 174 | |||
1970 | 175 | void invoke_window_event_handler(MirWindow* window, MirEvent const* event) | ||
1971 | 176 | { | ||
1972 | 177 | std::lock_guard<decltype(window_event_handler_mutex)> lock{window_event_handler_mutex}; | ||
1973 | 178 | if (window == this->window) window_event_handler_(event); | ||
1974 | 179 | if (window == target_window) target_window_event_handler_(event); | ||
1975 | 180 | } | ||
1976 | 181 | |||
1977 | 182 | void invoke_window_dnd_start_handler(MirWindow* window, MirDragAndDropEvent const* event) | ||
1978 | 183 | { | ||
1979 | 184 | std::lock_guard<decltype(window_event_handler_mutex)> lock{window_event_handler_mutex}; | ||
1980 | 185 | if (window == this->window) window_dnd_start_(event); | ||
1981 | 186 | } | ||
1982 | 187 | |||
1983 | 188 | std::mutex window_event_handler_mutex; | ||
1984 | 189 | std::function<void(MirDragAndDropEvent const* event)> window_dnd_start_ = [](MirDragAndDropEvent const*) {}; | ||
1985 | 190 | std::function<void(MirEvent const* event)> window_event_handler_ = [](MirEvent const*) {}; | ||
1986 | 191 | std::function<void(MirEvent const* event)> target_window_event_handler_ = [](MirEvent const*) {}; | ||
1987 | 192 | |||
1988 | 193 | static void window_event_handler(MirWindow* window, MirEvent const* event, void* context); | ||
1989 | 194 | static void window_dnd_start_handler(MirWindow* window, MirDragAndDropEvent const* event, void* context); | ||
1990 | 195 | |||
1991 | 196 | MirConnection* another_connection{nullptr}; | ||
1992 | 197 | MirWindow* target_window{nullptr}; | ||
1993 | 198 | }; | ||
1994 | 199 | |||
1995 | 200 | void DragAndDrop::set_window_event_handler(MirWindow* window, std::function<void(MirEvent const* event)> const& handler) | ||
1996 | 201 | { | ||
1997 | 202 | std::lock_guard<decltype(window_event_handler_mutex)> lock{window_event_handler_mutex}; | ||
1998 | 203 | if (window == this->window) window_event_handler_ = handler; | ||
1999 | 204 | if (window == target_window) target_window_event_handler_ = handler; | ||
2000 | 205 | } | ||
2001 | 206 | |||
2002 | 207 | void DragAndDrop::set_window_dnd_start_handler(MirWindow* window, std::function<void(MirDragAndDropEvent const*)> const& handler) | ||
2003 | 208 | { | ||
2004 | 209 | std::lock_guard<decltype(window_event_handler_mutex)> lock{window_event_handler_mutex}; | ||
2005 | 210 | if (window == this->window) window_dnd_start_ = handler; | ||
2006 | 211 | } | ||
2007 | 212 | |||
2008 | 213 | |||
2009 | 214 | void DragAndDrop::reset_window_event_handler(MirWindow* window) | ||
2010 | 215 | { | ||
2011 | 216 | if (window == this->window) window_event_handler_ = [](MirEvent const*) {}; | ||
2012 | 217 | if (window == target_window) target_window_event_handler_ = [](MirEvent const*) {}; | ||
2013 | 218 | } | ||
2014 | 219 | |||
2015 | 220 | void DragAndDrop::paint_window(MirWindow* w) | ||
2016 | 221 | { | ||
2017 | 222 | Signal have_focus; | ||
2018 | 223 | |||
2019 | 224 | set_window_event_handler(w, [&](MirEvent const* event) | ||
2020 | 225 | { | ||
2021 | 226 | if (mir_event_get_type(event) != mir_event_type_window) | ||
2022 | 227 | return; | ||
2023 | 228 | |||
2024 | 229 | auto const window_event = mir_event_get_window_event(event); | ||
2025 | 230 | if (mir_window_event_get_attribute(window_event) != mir_window_attrib_focus) | ||
2026 | 231 | return; | ||
2027 | 232 | |||
2028 | 233 | if (mir_window_event_get_attribute_value(window_event)) | ||
2029 | 234 | have_focus.raise(); | ||
2030 | 235 | }); | ||
2031 | 236 | |||
2032 | 237 | mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(w)); | ||
2033 | 238 | |||
2034 | 239 | EXPECT_THAT(have_focus.wait_for(receive_event_timeout), Eq(true)); | ||
2035 | 240 | |||
2036 | 241 | reset_window_event_handler(w); | ||
2037 | 242 | } | ||
2038 | 243 | |||
2039 | 244 | void DragAndDrop::center_mouse() | ||
2040 | 245 | { | ||
2041 | 246 | Signal have_mouseover; | ||
2042 | 247 | |||
2043 | 248 | set_window_event_handler(window, [&](MirEvent const* event) | ||
2044 | 249 | { | ||
2045 | 250 | if (mir_event_get_type(event) != mir_event_type_input) | ||
2046 | 251 | return; | ||
2047 | 252 | |||
2048 | 253 | auto const input_event = mir_event_get_input_event(event); | ||
2049 | 254 | |||
2050 | 255 | if (mir_input_event_get_type(input_event) != mir_input_event_type_pointer) | ||
2051 | 256 | return; | ||
2052 | 257 | |||
2053 | 258 | auto const pointer_event = mir_input_event_get_pointer_event(input_event); | ||
2054 | 259 | |||
2055 | 260 | if (mir_pointer_event_action(pointer_event) != mir_pointer_action_enter) | ||
2056 | 261 | return; | ||
2057 | 262 | |||
2058 | 263 | have_mouseover.raise(); | ||
2059 | 264 | }); | ||
2060 | 265 | |||
2061 | 266 | move_mouse(0.5 * as_displacement(screen_geometry.size)); | ||
2062 | 267 | |||
2063 | 268 | // We miss the "mouseover" occasionally (with valgrind and heavy stress about 1/20). | ||
2064 | 269 | // But it isn't essential for the test and we've probably waited long enough | ||
2065 | 270 | // for the mouse-down needed by the test to reach the window. | ||
2066 | 271 | // EXPECT_THAT(have_mouseover.wait_for(receive_event_timeout), Eq(true)); | ||
2067 | 272 | have_mouseover.wait_for(receive_event_timeout); | ||
2068 | 273 | |||
2069 | 274 | reset_window_event_handler(window); | ||
2070 | 275 | } | ||
2071 | 276 | |||
2072 | 277 | void DragAndDrop::window_event_handler(MirWindow* window, MirEvent const* event, void* context) | ||
2073 | 278 | { | ||
2074 | 279 | static_cast<DragAndDrop*>(context)->invoke_window_event_handler(window, event); | ||
2075 | 280 | } | ||
2076 | 281 | |||
2077 | 282 | void DragAndDrop::window_dnd_start_handler(MirWindow* window, MirDragAndDropEvent const* event, void* context) | ||
2078 | 283 | { | ||
2079 | 284 | static_cast<DragAndDrop*>(context)->invoke_window_dnd_start_handler(window, event); | ||
2080 | 285 | } | ||
2081 | 286 | |||
2082 | 287 | |||
2083 | 288 | auto DragAndDrop::user_initiates_drag() -> Cookie | ||
2084 | 289 | { | ||
2085 | 290 | Cookie cookie; | ||
2086 | 291 | Signal have_cookie; | ||
2087 | 292 | |||
2088 | 293 | set_window_event_handler(window, [&](MirEvent const* event) | ||
2089 | 294 | { | ||
2090 | 295 | if (mir_event_get_type(event) != mir_event_type_input) | ||
2091 | 296 | return; | ||
2092 | 297 | |||
2093 | 298 | auto const input_event = mir_event_get_input_event(event); | ||
2094 | 299 | |||
2095 | 300 | if (mir_input_event_get_type(input_event) != mir_input_event_type_pointer) | ||
2096 | 301 | return; | ||
2097 | 302 | |||
2098 | 303 | auto const pointer_event = mir_input_event_get_pointer_event(input_event); | ||
2099 | 304 | |||
2100 | 305 | if (mir_pointer_event_action(pointer_event) != mir_pointer_action_button_down) | ||
2101 | 306 | return; | ||
2102 | 307 | |||
2103 | 308 | cookie = Cookie{mir_input_event_get_cookie(input_event)}; | ||
2104 | 309 | have_cookie.raise(); | ||
2105 | 310 | }); | ||
2106 | 311 | |||
2107 | 312 | start_dragging_mouse(); | ||
2108 | 313 | |||
2109 | 314 | EXPECT_THAT(have_cookie.wait_for(receive_event_timeout), Eq(true)); | ||
2110 | 315 | |||
2111 | 316 | reset_window_event_handler(window); | ||
2112 | 317 | return cookie; | ||
2113 | 318 | } | ||
2114 | 319 | |||
2115 | 320 | auto DragAndDrop::client_requests_drag(Cookie const& cookie) -> Blob | ||
2116 | 321 | { | ||
2117 | 322 | Blob blob; | ||
2118 | 323 | Signal initiated; | ||
2119 | 324 | |||
2120 | 325 | set_window_dnd_start_handler(window, [&](MirDragAndDropEvent const* event) | ||
2121 | 326 | { | ||
2122 | 327 | if (dnd) | ||
2123 | 328 | blob.reset(dnd->start_drag_and_drop(event)); | ||
2124 | 329 | |||
2125 | 330 | if (blob) | ||
2126 | 331 | initiated.raise(); | ||
2127 | 332 | }); | ||
2128 | 333 | |||
2129 | 334 | EXPECT_THAT(dnd, Ne(nullptr)) << "No Drag and Drop extension"; | ||
2130 | 335 | |||
2131 | 336 | if (dnd) | ||
2132 | 337 | dnd->request_drag_and_drop(window, cookie); | ||
2133 | 338 | |||
2134 | 339 | EXPECT_TRUE(initiated.wait_for(receive_event_timeout)); | ||
2135 | 340 | |||
2136 | 341 | reset_window_event_handler(window); | ||
2137 | 342 | return blob; | ||
2138 | 343 | } | ||
2139 | 344 | |||
2140 | 345 | auto DragAndDrop::handle_from_mouse_move() -> Blob | ||
2141 | 346 | { | ||
2142 | 347 | Blob blob; | ||
2143 | 348 | Signal have_blob; | ||
2144 | 349 | |||
2145 | 350 | set_window_event_handler(window, [&](MirEvent const* event) | ||
2146 | 351 | { | ||
2147 | 352 | if (mir_event_get_type(event) != mir_event_type_input) | ||
2148 | 353 | return; | ||
2149 | 354 | |||
2150 | 355 | auto const input_event = mir_event_get_input_event(event); | ||
2151 | 356 | |||
2152 | 357 | if (mir_input_event_get_type(input_event) != mir_input_event_type_pointer) | ||
2153 | 358 | return; | ||
2154 | 359 | |||
2155 | 360 | auto const pointer_event = mir_input_event_get_pointer_event(input_event); | ||
2156 | 361 | |||
2157 | 362 | EXPECT_THAT(dnd, Ne(nullptr)) << "No Drag and Drop extension"; | ||
2158 | 363 | |||
2159 | 364 | if (dnd) | ||
2160 | 365 | blob.reset(dnd->pointer_drag_and_drop(pointer_event)); | ||
2161 | 366 | |||
2162 | 367 | if (blob) | ||
2163 | 368 | have_blob.raise(); | ||
2164 | 369 | }); | ||
2165 | 370 | |||
2166 | 371 | move_mouse({1,1}); | ||
2167 | 372 | |||
2168 | 373 | EXPECT_TRUE(have_blob.wait_for(receive_event_timeout)); | ||
2169 | 374 | |||
2170 | 375 | reset_window_event_handler(window); | ||
2171 | 376 | return blob; | ||
2172 | 377 | } | ||
2173 | 378 | |||
2174 | 379 | auto DragAndDrop::handle_from_mouse_leave() -> Blob | ||
2175 | 380 | { | ||
2176 | 381 | Blob blob; | ||
2177 | 382 | Signal have_blob; | ||
2178 | 383 | |||
2179 | 384 | set_window_event_handler(window, [&](MirEvent const* event) | ||
2180 | 385 | { | ||
2181 | 386 | if (mir_event_get_type(event) != mir_event_type_input) | ||
2182 | 387 | return; | ||
2183 | 388 | |||
2184 | 389 | auto const input_event = mir_event_get_input_event(event); | ||
2185 | 390 | |||
2186 | 391 | if (mir_input_event_get_type(input_event) != mir_input_event_type_pointer) | ||
2187 | 392 | return; | ||
2188 | 393 | |||
2189 | 394 | auto const pointer_event = mir_input_event_get_pointer_event(input_event); | ||
2190 | 395 | |||
2191 | 396 | if (mir_pointer_event_action(pointer_event) != mir_pointer_action_leave) | ||
2192 | 397 | return; | ||
2193 | 398 | |||
2194 | 399 | EXPECT_THAT(dnd, Ne(nullptr)) << "No Drag and Drop extension"; | ||
2195 | 400 | |||
2196 | 401 | if (dnd) | ||
2197 | 402 | blob.reset(dnd->pointer_drag_and_drop(pointer_event)); | ||
2198 | 403 | |||
2199 | 404 | if (blob) | ||
2200 | 405 | have_blob.raise(); | ||
2201 | 406 | }); | ||
2202 | 407 | |||
2203 | 408 | move_mouse({1,1}); | ||
2204 | 409 | move_mouse(0.5 * as_displacement(surface_size)); | ||
2205 | 410 | |||
2206 | 411 | EXPECT_TRUE(have_blob.wait_for(receive_event_timeout)); | ||
2207 | 412 | |||
2208 | 413 | reset_window_event_handler(window); | ||
2209 | 414 | return blob; | ||
2210 | 415 | } | ||
2211 | 416 | |||
2212 | 417 | auto DragAndDrop::handle_from_mouse_enter() -> Blob | ||
2213 | 418 | { | ||
2214 | 419 | Blob blob; | ||
2215 | 420 | Signal have_blob; | ||
2216 | 421 | |||
2217 | 422 | set_window_event_handler(target_window, [&](MirEvent const* event) | ||
2218 | 423 | { | ||
2219 | 424 | if (mir_event_get_type(event) != mir_event_type_input) | ||
2220 | 425 | return; | ||
2221 | 426 | |||
2222 | 427 | auto const input_event = mir_event_get_input_event(event); | ||
2223 | 428 | |||
2224 | 429 | if (mir_input_event_get_type(input_event) != mir_input_event_type_pointer) | ||
2225 | 430 | return; | ||
2226 | 431 | |||
2227 | 432 | auto const pointer_event = mir_input_event_get_pointer_event(input_event); | ||
2228 | 433 | |||
2229 | 434 | if (mir_pointer_event_action(pointer_event) != mir_pointer_action_enter) | ||
2230 | 435 | return; | ||
2231 | 436 | |||
2232 | 437 | EXPECT_THAT(dnd, Ne(nullptr)) << "No Drag and Drop extension"; | ||
2233 | 438 | |||
2234 | 439 | if (dnd) | ||
2235 | 440 | blob.reset(dnd->pointer_drag_and_drop(pointer_event)); | ||
2236 | 441 | |||
2237 | 442 | if (blob) | ||
2238 | 443 | have_blob.raise(); | ||
2239 | 444 | }); | ||
2240 | 445 | |||
2241 | 446 | move_mouse({1,1}); | ||
2242 | 447 | move_mouse(0.5 * as_displacement(surface_size)); | ||
2243 | 448 | |||
2244 | 449 | EXPECT_TRUE(have_blob.wait_for(receive_event_timeout)); | ||
2245 | 450 | |||
2246 | 451 | reset_window_event_handler(target_window); | ||
2247 | 452 | return blob; | ||
2248 | 453 | } | ||
2249 | 454 | |||
2250 | 455 | auto DragAndDrop::handle_from_mouse_release() -> Blob | ||
2251 | 456 | { | ||
2252 | 457 | Blob blob; | ||
2253 | 458 | Signal have_blob; | ||
2254 | 459 | |||
2255 | 460 | set_window_event_handler(target_window, [&](MirEvent const* event) | ||
2256 | 461 | { | ||
2257 | 462 | if (mir_event_get_type(event) != mir_event_type_input) | ||
2258 | 463 | return; | ||
2259 | 464 | |||
2260 | 465 | auto const input_event = mir_event_get_input_event(event); | ||
2261 | 466 | |||
2262 | 467 | if (mir_input_event_get_type(input_event) != mir_input_event_type_pointer) | ||
2263 | 468 | return; | ||
2264 | 469 | |||
2265 | 470 | auto const pointer_event = mir_input_event_get_pointer_event(input_event); | ||
2266 | 471 | |||
2267 | 472 | if (mir_pointer_event_action(pointer_event) != mir_pointer_action_button_up) | ||
2268 | 473 | return; | ||
2269 | 474 | |||
2270 | 475 | EXPECT_THAT(dnd, Ne(nullptr)) << "No Drag and Drop extension"; | ||
2271 | 476 | |||
2272 | 477 | if (dnd) | ||
2273 | 478 | blob.reset(dnd->pointer_drag_and_drop(pointer_event)); | ||
2274 | 479 | |||
2275 | 480 | if (blob) | ||
2276 | 481 | have_blob.raise(); | ||
2277 | 482 | }); | ||
2278 | 483 | |||
2279 | 484 | move_mouse({1,1}); | ||
2280 | 485 | move_mouse(0.5 * as_displacement(surface_size)); | ||
2281 | 486 | release_mouse(); | ||
2282 | 487 | |||
2283 | 488 | EXPECT_TRUE(have_blob.wait_for(receive_event_timeout)); | ||
2284 | 489 | |||
2285 | 490 | reset_window_event_handler(target_window); | ||
2286 | 491 | return blob; | ||
2287 | 492 | } | ||
2288 | 493 | |||
2289 | 494 | auto DragAndDrop::count_of_handles_when_moving_mouse() -> int | ||
2290 | 495 | { | ||
2291 | 496 | Signal have_3_events; | ||
2292 | 497 | std::atomic<int> events{0}; | ||
2293 | 498 | std::atomic<int> handles{0}; | ||
2294 | 499 | |||
2295 | 500 | auto counter = [&](MirEvent const* event) | ||
2296 | 501 | { | ||
2297 | 502 | if (mir_event_get_type(event) != mir_event_type_input) | ||
2298 | 503 | return; | ||
2299 | 504 | |||
2300 | 505 | auto const input_event = mir_event_get_input_event(event); | ||
2301 | 506 | |||
2302 | 507 | if (mir_input_event_get_type(input_event) != mir_input_event_type_pointer) | ||
2303 | 508 | return; | ||
2304 | 509 | |||
2305 | 510 | auto const pointer_event = mir_input_event_get_pointer_event(input_event); | ||
2306 | 511 | |||
2307 | 512 | EXPECT_THAT(dnd, Ne(nullptr)) << "No Drag and Drop extension"; | ||
2308 | 513 | |||
2309 | 514 | Blob blob; | ||
2310 | 515 | if (dnd) | ||
2311 | 516 | blob.reset(dnd->pointer_drag_and_drop(pointer_event)); | ||
2312 | 517 | |||
2313 | 518 | if (blob) | ||
2314 | 519 | handles.fetch_add(1); | ||
2315 | 520 | |||
2316 | 521 | if (events.fetch_add(1) == 2) | ||
2317 | 522 | have_3_events.raise(); | ||
2318 | 523 | }; | ||
2319 | 524 | |||
2320 | 525 | set_window_event_handler(window, counter); | ||
2321 | 526 | set_window_event_handler(target_window, counter); | ||
2322 | 527 | |||
2323 | 528 | start_dragging_mouse(); | ||
2324 | 529 | move_mouse({1,1}); | ||
2325 | 530 | release_mouse(); | ||
2326 | 531 | |||
2327 | 532 | EXPECT_TRUE(have_3_events.wait_for(receive_event_timeout)); | ||
2328 | 533 | |||
2329 | 534 | reset_window_event_handler(window); | ||
2330 | 535 | reset_window_event_handler(target_window); | ||
2331 | 536 | return handles; | ||
2332 | 537 | } | ||
2333 | 538 | |||
2334 | 539 | MATCHER_P(BlobContentEq, p, "") | ||
2335 | 540 | { | ||
2336 | 541 | if (!arg || !p) | ||
2337 | 542 | return false; | ||
2338 | 543 | if (mir_blob_size(arg) != mir_blob_size(p)) | ||
2339 | 544 | return false; | ||
2340 | 545 | return !memcmp(mir_blob_data(arg), mir_blob_data(p), mir_blob_size(p)); | ||
2341 | 546 | } | ||
2342 | 547 | } | ||
2343 | 548 | |||
2344 | 549 | TEST_F(DragAndDrop, when_user_initiates_drag_client_receives_cookie) | ||
2345 | 550 | { | ||
2346 | 551 | auto const cookie = user_initiates_drag(); | ||
2347 | 552 | |||
2348 | 553 | EXPECT_THAT(cookie.get(), NotNull()); | ||
2349 | 554 | } | ||
2350 | 555 | |||
2351 | 556 | TEST_F(DragAndDrop, when_client_requests_drags_it_receives_handle) | ||
2352 | 557 | { | ||
2353 | 558 | auto const cookie = user_initiates_drag(); | ||
2354 | 559 | ASSERT_THAT(cookie.get(), NotNull()); | ||
2355 | 560 | |||
2356 | 561 | auto const handle = client_requests_drag(cookie); | ||
2357 | 562 | |||
2358 | 563 | EXPECT_THAT(handle.get(), NotNull()); | ||
2359 | 564 | } | ||
2360 | 565 | |||
2361 | 566 | TEST_F(DragAndDrop, during_drag_when_user_moves_mouse_client_receives_handle) | ||
2362 | 567 | { | ||
2363 | 568 | auto const cookie = user_initiates_drag(); | ||
2364 | 569 | ASSERT_THAT(cookie.get(), NotNull()); | ||
2365 | 570 | auto const handle_from_request = client_requests_drag(cookie); | ||
2366 | 571 | |||
2367 | 572 | auto const handle = handle_from_mouse_move(); | ||
2368 | 573 | |||
2369 | 574 | EXPECT_THAT(handle.get(), NotNull()); | ||
2370 | 575 | EXPECT_THAT(handle.get(), BlobContentEq(handle_from_request.get())); | ||
2371 | 576 | } | ||
2372 | 577 | |||
2373 | 578 | TEST_F(DragAndDrop, when_drag_moves_from_window_leave_event_contains_handle) | ||
2374 | 579 | { | ||
2375 | 580 | auto const cookie = user_initiates_drag(); | ||
2376 | 581 | ASSERT_THAT(cookie.get(), NotNull()); | ||
2377 | 582 | auto const handle_from_request = client_requests_drag(cookie); | ||
2378 | 583 | |||
2379 | 584 | auto const handle = handle_from_mouse_leave(); | ||
2380 | 585 | |||
2381 | 586 | EXPECT_THAT(handle.get(), NotNull()); | ||
2382 | 587 | EXPECT_THAT(handle.get(), BlobContentEq(handle_from_request.get())); | ||
2383 | 588 | } | ||
2384 | 589 | |||
2385 | 590 | TEST_F(DragAndDrop, when_drag_enters_target_window_enter_event_contains_handle) | ||
2386 | 591 | { | ||
2387 | 592 | auto const cookie = user_initiates_drag(); | ||
2388 | 593 | ASSERT_THAT(cookie.get(), NotNull()); | ||
2389 | 594 | auto const handle_from_request = client_requests_drag(cookie); | ||
2390 | 595 | |||
2391 | 596 | auto const handle = handle_from_mouse_enter(); | ||
2392 | 597 | |||
2393 | 598 | EXPECT_THAT(handle.get(), NotNull()); | ||
2394 | 599 | EXPECT_THAT(handle.get(), BlobContentEq(handle_from_request.get())); | ||
2395 | 600 | } | ||
2396 | 601 | |||
2397 | 602 | TEST_F(DragAndDrop, when_drag_releases_target_window_release_event_contains_handle) | ||
2398 | 603 | { | ||
2399 | 604 | auto const cookie = user_initiates_drag(); | ||
2400 | 605 | ASSERT_THAT(cookie.get(), NotNull()); | ||
2401 | 606 | auto const handle_from_request = client_requests_drag(cookie); | ||
2402 | 607 | |||
2403 | 608 | auto const handle = handle_from_mouse_release(); | ||
2404 | 609 | |||
2405 | 610 | EXPECT_THAT(handle.get(), NotNull()); | ||
2406 | 611 | EXPECT_THAT(handle.get(), BlobContentEq(handle_from_request.get())); | ||
2407 | 612 | } | ||
2408 | 613 | |||
2409 | 614 | TEST_F(DragAndDrop, after_drag_finishes_pointer_events_no_longer_contain_handle) | ||
2410 | 615 | { | ||
2411 | 616 | auto const cookie = user_initiates_drag(); | ||
2412 | 617 | ASSERT_THAT(cookie.get(), NotNull()); | ||
2413 | 618 | client_requests_drag(cookie); | ||
2414 | 619 | handle_from_mouse_release(); | ||
2415 | 620 | |||
2416 | 621 | server.the_shell()->clear_drag_and_drop_handle(); | ||
2417 | 622 | |||
2418 | 623 | EXPECT_THAT(count_of_handles_when_moving_mouse(), Eq(0)); | ||
2419 | 624 | } | ||
2420 | 0 | 625 | ||
2421 | === modified file 'tests/acceptance-tests/test_client_cursor_api.cpp' | |||
2422 | --- tests/acceptance-tests/test_client_cursor_api.cpp 2017-02-28 08:53:57 +0000 | |||
2423 | +++ tests/acceptance-tests/test_client_cursor_api.cpp 2017-03-17 15:52:51 +0000 | |||
2424 | @@ -82,6 +82,7 @@ | |||
2425 | 82 | MOCK_METHOD0(cursor_image_removed, void()); | 82 | MOCK_METHOD0(cursor_image_removed, void()); |
2426 | 83 | MOCK_METHOD1(placed_relative, void(geom::Rectangle const& placement)); | 83 | MOCK_METHOD1(placed_relative, void(geom::Rectangle const& placement)); |
2427 | 84 | MOCK_METHOD1(input_consumed, void(MirEvent const*)); | 84 | MOCK_METHOD1(input_consumed, void(MirEvent const*)); |
2428 | 85 | MOCK_METHOD1(start_drag_and_drop, void(std::vector<uint8_t> const& handle)); | ||
2429 | 85 | }; | 86 | }; |
2430 | 86 | 87 | ||
2431 | 87 | 88 | ||
2432 | 88 | 89 | ||
2433 | === modified file 'tests/include/mir/test/doubles/mock_input_targeter.h' | |||
2434 | --- tests/include/mir/test/doubles/mock_input_targeter.h 2015-06-18 02:46:16 +0000 | |||
2435 | +++ tests/include/mir/test/doubles/mock_input_targeter.h 2017-03-17 15:52:51 +0000 | |||
2436 | @@ -35,6 +35,9 @@ | |||
2437 | 35 | virtual ~MockInputTargeter() noexcept(true) {} | 35 | virtual ~MockInputTargeter() noexcept(true) {} |
2438 | 36 | MOCK_METHOD1(set_focus, void(std::shared_ptr<input::Surface> const&)); | 36 | MOCK_METHOD1(set_focus, void(std::shared_ptr<input::Surface> const&)); |
2439 | 37 | MOCK_METHOD0(clear_focus, void()); | 37 | MOCK_METHOD0(clear_focus, void()); |
2440 | 38 | |||
2441 | 39 | void set_drag_and_drop_handle(std::vector<uint8_t> const&) override {} | ||
2442 | 40 | void clear_drag_and_drop_handle() override {} | ||
2443 | 38 | }; | 41 | }; |
2444 | 39 | 42 | ||
2445 | 40 | } | 43 | } |
2446 | 41 | 44 | ||
2447 | === modified file 'tests/include/mir/test/doubles/mock_shell.h' | |||
2448 | --- tests/include/mir/test/doubles/mock_shell.h 2017-01-18 02:29:37 +0000 | |||
2449 | +++ tests/include/mir/test/doubles/mock_shell.h 2017-03-17 15:52:51 +0000 | |||
2450 | @@ -72,6 +72,9 @@ | |||
2451 | 72 | 72 | ||
2452 | 73 | MOCK_METHOD3(raise_surface, void(std::shared_ptr<frontend::Session> const& session, | 73 | MOCK_METHOD3(raise_surface, void(std::shared_ptr<frontend::Session> const& session, |
2453 | 74 | frontend::SurfaceId surface_id, uint64_t timestamp)); | 74 | frontend::SurfaceId surface_id, uint64_t timestamp)); |
2454 | 75 | |||
2455 | 76 | MOCK_METHOD3(request_drag_and_drop, void(std::shared_ptr<frontend::Session> const& session, | ||
2456 | 77 | frontend::SurfaceId surface_id, uint64_t timestamp)); | ||
2457 | 75 | }; | 78 | }; |
2458 | 76 | 79 | ||
2459 | 77 | } | 80 | } |
2460 | 78 | 81 | ||
2461 | === modified file 'tests/include/mir/test/doubles/stub_display_server.h' | |||
2462 | --- tests/include/mir/test/doubles/stub_display_server.h 2017-02-15 07:38:33 +0000 | |||
2463 | +++ tests/include/mir/test/doubles/stub_display_server.h 2017-03-17 15:52:51 +0000 | |||
2464 | @@ -158,6 +158,10 @@ | |||
2465 | 158 | mir::protobuf::RaiseRequest const* /*request*/, | 158 | mir::protobuf::RaiseRequest const* /*request*/, |
2466 | 159 | mir::protobuf::Void* /*response*/, | 159 | mir::protobuf::Void* /*response*/, |
2467 | 160 | google::protobuf::Closure* /*done*/) {} | 160 | google::protobuf::Closure* /*done*/) {} |
2468 | 161 | void request_drag_and_drop( | ||
2469 | 162 | mir::protobuf::RequestAuthority const* /*request*/, | ||
2470 | 163 | mir::protobuf::Void* /*response*/, | ||
2471 | 164 | google::protobuf::Closure* /*done*/) {} | ||
2472 | 161 | void apply_input_configuration( | 165 | void apply_input_configuration( |
2473 | 162 | mir::protobuf::InputConfigurationRequest const* /*request*/, | 166 | mir::protobuf::InputConfigurationRequest const* /*request*/, |
2474 | 163 | mir::protobuf::Void* /*response*/, | 167 | mir::protobuf::Void* /*response*/, |
2475 | 164 | 168 | ||
2476 | === modified file 'tests/include/mir/test/doubles/stub_input_targeter.h' | |||
2477 | --- tests/include/mir/test/doubles/stub_input_targeter.h 2015-06-18 02:46:16 +0000 | |||
2478 | +++ tests/include/mir/test/doubles/stub_input_targeter.h 2017-03-17 15:52:51 +0000 | |||
2479 | @@ -36,6 +36,9 @@ | |||
2480 | 36 | void clear_focus() | 36 | void clear_focus() |
2481 | 37 | { | 37 | { |
2482 | 38 | } | 38 | } |
2483 | 39 | |||
2484 | 40 | void set_drag_and_drop_handle(std::vector<uint8_t> const&) override {} | ||
2485 | 41 | void clear_drag_and_drop_handle() override {} | ||
2486 | 39 | }; | 42 | }; |
2487 | 40 | 43 | ||
2488 | 41 | } | 44 | } |
2489 | 42 | 45 | ||
2490 | === modified file 'tests/include/mir/test/doubles/stub_scene_surface.h' | |||
2491 | --- tests/include/mir/test/doubles/stub_scene_surface.h 2017-02-15 14:45:41 +0000 | |||
2492 | +++ tests/include/mir/test/doubles/stub_scene_surface.h 2017-03-17 15:52:51 +0000 | |||
2493 | @@ -94,6 +94,7 @@ | |||
2494 | 94 | void set_confine_pointer_state(MirPointerConfinementState /*state*/) override {} | 94 | void set_confine_pointer_state(MirPointerConfinementState /*state*/) override {} |
2495 | 95 | MirPointerConfinementState confine_pointer_state() const override { return {}; } | 95 | MirPointerConfinementState confine_pointer_state() const override { return {}; } |
2496 | 96 | void placed_relative(geometry::Rectangle const& /*placement*/) override {} | 96 | void placed_relative(geometry::Rectangle const& /*placement*/) override {} |
2497 | 97 | void start_drag_and_drop(std::vector<uint8_t> const& /*handle*/) override {} | ||
2498 | 97 | }; | 98 | }; |
2499 | 98 | 99 | ||
2500 | 99 | } | 100 | } |
2501 | 100 | 101 | ||
2502 | === modified file 'tests/mir_test_framework/observant_shell.cpp' | |||
2503 | --- tests/mir_test_framework/observant_shell.cpp 2017-01-20 00:01:50 +0000 | |||
2504 | +++ tests/mir_test_framework/observant_shell.cpp 2017-03-17 15:52:51 +0000 | |||
2505 | @@ -155,7 +155,26 @@ | |||
2506 | 155 | void mtf::ObservantShell::raise_surface( | 155 | void mtf::ObservantShell::raise_surface( |
2507 | 156 | std::shared_ptr<msc::Session> const& session, | 156 | std::shared_ptr<msc::Session> const& session, |
2508 | 157 | std::shared_ptr<msc::Surface> const& window, | 157 | std::shared_ptr<msc::Surface> const& window, |
2509 | 158 | uint64_t timestamp) | ||
2510 | 159 | { | ||
2511 | 160 | return wrapped->raise_surface(session, window, timestamp); | ||
2512 | 161 | } | ||
2513 | 162 | |||
2514 | 163 | void mtf::ObservantShell::request_drag_and_drop( | ||
2515 | 164 | std::shared_ptr<msc::Session> const& session, | ||
2516 | 165 | std::shared_ptr<msc::Surface> const& window, | ||
2517 | 158 | uint64_t timestamp) | 166 | uint64_t timestamp) |
2518 | 159 | { | 167 | { |
2521 | 160 | return wrapped->raise_surface(session, window, timestamp); | 168 | return wrapped->request_drag_and_drop(session, window, timestamp); |
2522 | 161 | } | 169 | } |
2523 | 170 | |||
2524 | 171 | void mtf::ObservantShell::set_drag_and_drop_handle(std::vector<uint8_t> const& handle) | ||
2525 | 172 | { | ||
2526 | 173 | wrapped->set_drag_and_drop_handle(handle); | ||
2527 | 174 | } | ||
2528 | 175 | |||
2529 | 176 | void mtf::ObservantShell::clear_drag_and_drop_handle() | ||
2530 | 177 | { | ||
2531 | 178 | wrapped->clear_drag_and_drop_handle(); | ||
2532 | 179 | } | ||
2533 | 180 | |||
2534 | 162 | 181 | ||
2535 | === modified file 'tests/mir_test_framework/stub_surface.cpp' | |||
2536 | --- tests/mir_test_framework/stub_surface.cpp 2017-02-15 14:45:41 +0000 | |||
2537 | +++ tests/mir_test_framework/stub_surface.cpp 2017-03-17 15:52:51 +0000 | |||
2538 | @@ -198,6 +198,10 @@ | |||
2539 | 198 | { | 198 | { |
2540 | 199 | } | 199 | } |
2541 | 200 | 200 | ||
2542 | 201 | void mtd::StubSurface::start_drag_and_drop(std::vector<uint8_t> const& /*handle*/) | ||
2543 | 202 | { | ||
2544 | 203 | } | ||
2545 | 204 | |||
2546 | 201 | namespace | 205 | namespace |
2547 | 202 | { | 206 | { |
2548 | 203 | // Ensure we don't accidentally have an abstract class | 207 | // Ensure we don't accidentally have an abstract class |
FAILED: Continuous integration, rev:4086 /mir-jenkins. ubuntu. com/job/ mir-ci/ 3142/ /mir-jenkins. ubuntu. com/job/ build-mir/ 4216/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/4303 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 4293 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 4293 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= zesty/4293 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/4243 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/4243/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4243 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4243/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/4243/ console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4243 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4243/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4243 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4243/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4243 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4243/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 3142/rebuild
https:/