Mir

Merge lp:~raof/mir/the-least-dirty-thing into lp:mir

Proposed by Chris Halse Rogers on 2014-08-21
Status: Merged
Approved by: Alberto Aguirre on 2014-10-27
Approved revision: 1870
Merged at revision: 2005
Proposed branch: lp:~raof/mir/the-least-dirty-thing
Merge into: lp:mir
Diff against target: 1865 lines (+1026/-46)
53 files modified
client-ABI-sha1sums (+1/-1)
debian/control (+46/-0)
debian/libmirclient-debug-extension-dev.install (+3/-0)
debian/libmirclient-debug-extension1.install (+1/-0)
debian/libmirclient-dev.install (+1/-1)
include/client/mir_toolkit/debug/surface.h (+20/-0)
include/platform/mir/options/configuration.h (+1/-0)
include/server/mir/default_server_configuration.h (+3/-0)
include/server/mir/scene/coordinate_translator.h (+66/-0)
platform-ABI-sha1sums (+1/-1)
server-ABI-sha1sums (+3/-2)
src/client/CMakeLists.txt (+52/-2)
src/client/mir_connection.cpp (+3/-1)
src/client/mir_connection.h (+1/-0)
src/client/mir_debug_api.cpp (+39/-0)
src/client/mir_surface.cpp (+63/-0)
src/client/mir_surface.h (+16/-1)
src/client/mir_surface_api.cpp (+2/-3)
src/client/mirclient-debug-extension.pc.in (+11/-0)
src/client/mirclient.pc.in (+5/-3)
src/client/symbols-debug.map (+5/-0)
src/common/protobuf/mir_protobuf.proto (+17/-0)
src/common/symbols.map (+54/-0)
src/include/server/mir/frontend/unsupported_feature_exception.h (+41/-0)
src/platform/options/default_configuration.cpp (+4/-1)
src/platform/symbols.map (+1/-0)
src/server/frontend/CMakeLists.txt (+1/-0)
src/server/frontend/default_configuration.cpp (+21/-8)
src/server/frontend/default_ipc_factory.cpp (+6/-3)
src/server/frontend/default_ipc_factory.h (+8/-1)
src/server/frontend/protobuf_message_processor.cpp (+37/-0)
src/server/frontend/session_mediator.cpp (+30/-2)
src/server/frontend/session_mediator.h (+16/-2)
src/server/frontend/unsupported_coordinate_translator.cpp (+32/-0)
src/server/frontend/unsupported_coordinate_translator.h (+37/-0)
src/server/scene/CMakeLists.txt (+1/-0)
src/server/scene/default_configuration.cpp (+11/-0)
src/server/scene/default_coordinate_translator.cpp (+32/-0)
src/server/scene/default_coordinate_translator.h (+37/-0)
src/server/symbols.map (+6/-0)
tests/acceptance-tests/CMakeLists.txt (+2/-0)
tests/acceptance-tests/test_client_library.cpp (+0/-1)
tests/acceptance-tests/test_client_surface_events.cpp (+1/-1)
tests/acceptance-tests/test_client_surfaces.cpp (+1/-1)
tests/acceptance-tests/test_custom_input_dispatcher.cpp (+2/-2)
tests/acceptance-tests/test_debug_api.cpp (+231/-0)
tests/include/mir_test_doubles/mock_coordinate_translator.h (+42/-0)
tests/include/mir_test_doubles/mock_surface.h (+2/-1)
tests/integration-tests/CMakeLists.txt (+1/-0)
tests/integration-tests/test_stale_frames.cpp (+1/-1)
tests/unit-tests/frontend/test_session_mediator.cpp (+5/-5)
tests/unit-tests/frontend/test_session_mediator_android.cpp (+1/-1)
tests/unit-tests/frontend/test_session_mediator_mesa.cpp (+2/-1)
To merge this branch: bzr merge lp:~raof/mir/the-least-dirty-thing
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve on 2014-10-27
Alberto Aguirre (community) Approve on 2014-10-27
Alan Griffiths Approve on 2014-10-14
Daniel van Vugt 2014-08-21 Abstain on 2014-10-14
Andreas Pokorny (community) Approve on 2014-09-24
Alexandros Frantzis (community) Approve on 2014-09-19
Kevin DuBois (community) Abstain on 2014-09-08
Review via email: mp+231679@code.launchpad.net

Commit message

Add a debug interface to translate from surface to screen coordinates.

This is the Mir part of the infrastructure for Autopilot to determine the screen location of widgets, for full-stack testing.

This is hidden behind a --debug server option, to make it absolutely clear that applications cannot depend on this functionality outside of a constrained environment.

(See also https://lists.ubuntu.com/archives/mir-devel/2014-August/000848.html)

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

Description of the change

Add a translate_surface_to_screen debug interface, hidden behind running the server with --debug

This can be somewhat cleaned up when we've got real support for extensions, but should do for now.

To post a comment you must log in.
Daniel van Vugt (vanvugt) wrote :

Minor observations so far:

(1) 18 +Package: libmirclient-debug
is potentially confusing with the existing convention: packagename-dbg
so I think the dash needs removing. Something like "libmirclienttesting", since it's really not about "debugging" Mir at all.

(2) It seems we're going backwards in code bloat faster than I can keep up with fixing it. Can we avoid this part?
176 +
177 +# TODO: Extension apparatus so that mirclient-debug can be a MODULE and not
178 +# duplicate (almost) the entirity of mirclient
179 +add_library(
180 + mirclient-debug SHARED
181 +
182 + mir_debug_api.cpp
183 + $<TARGET_OBJECTS:mirclientobjects>
184 +)

(3) The amount of coupling we have is a bit excessive. Or is that an existing issue imposed by the existing class design?; "make_mediator()"

review: Needs Fixing
Kevin DuBois (kdub) wrote :

36 + Interfaces will come and go; end-user applications SHOULD NOT be linked
37 + against this library.

"interfaces come and go" is true of all the public interfaces... We should say something stronger like:
"Not all mir servers run with the capability to service this api; end-user applications SHOULD NOT depend on the functionality of this api."

review: Needs Fixing
Chris Halse Rogers (raof) wrote :

> Minor observations so far:
>
> (1) 18 +Package: libmirclient-debug
> is potentially confusing with the existing convention: packagename-dbg
> so I think the dash needs removing. Something like "libmirclienttesting",
> since it's really not about "debugging" Mir at all.

It actually is a bit about debugging Mir; at least, I've used the symbols in there to debug Mir and low-level client bits like XMir.

>
> (2) It seems we're going backwards in code bloat faster than I can keep up
> with fixing it. Can we avoid this part?

Not without either (a) exposing all the libmirclient internal symbols, or (b) adding in a real extension mechanism.

Since this library isn't expected to be installed on anything but development machines I wouldn't care if it was 100MB. I don't think we should spend any significant effort caring about its size.

We'll want an actual extension mechanism at some point in the future. At that point this can be switched to using that and libmirclient-debug-extension.so won't be almost exactly the same size as libmirclient.so

>
> (3) The amount of coupling we have is a bit excessive. Or is that an existing
> issue imposed by the existing class design?; "make_mediator()"

Yeah, that's the existing class design.

Alexandros Frantzis (afrantzis) wrote :

> "Not all mir servers run with the capability to service this api; end-user applications SHOULD NOT depend on the functionality of this api."

I agree with Kevin. I don't think it's worth having a different debugging version of the client library. Until we get an extension mechanism, I would prefer just exposing the debug APIs in our normal client library builds (like we have been doing up to now).

review: Needs Fixing
Chris Halse Rogers (raof) wrote :

From the client perspective it *is* an extension; libmirclient-debug-extension.so exposes only the three symbols we currently support; it's not a debugging version of the client library.

I can, of course, fold those symbols back into libmirclient. I think it's useful to have the non-core things split out a bit, though.

Daniel van Vugt (vanvugt) wrote :

OK, I still have the same concerns as mentioned above. But nothing strictly blocking. That's not to say this is a proper review.

review: Abstain
Chris Halse Rogers (raof) wrote :

So, I'm not sure what needs to be done here in order to make this acceptable.

Do I need to fold the three debugging APIs back into libmirclient rather than their own DSO? Do I need to reduce the on-disc size of libmirclient-debug-extension by introducing infrastructure for extension loading in libmirclient?

Alexandros Frantzis (afrantzis) wrote :

> Do I need to fold the three debugging APIs back into libmirclient rather than their own DSO?
> Do I need to reduce the on-disc size of libmirclient-debug-extension by introducing
> infrastructure for extension loading in libmirclient?

I am fine with folding the debugging APIs back into libmirclient until we get a proper extension mechanism.

Kevin DuBois (kdub) wrote :

So, the stronger wording seems better, so that 'needs fixing' is resolved. As for having two libraries vs the one, I'm on the fence, so I won't object. I somewhat like that there's less temptation to roll these functions into the public api.

As for the DebuggingSessionMediator, it seems to me that the SessionMediator should depend on (via a constructor parameter) some object that is capable of looking up the coordinates. A debug implementation of this object would lookup the coordinates, the normal implementation would throw when the lookup is attempted.
OTOH, SessionMediator already has a pretty bloated constructor... but I'd rather have one bloated constructor on SessionMediator than a bloated constructor on both SessionMediator and DebuggingSessionMediator.

review: Abstain
Chris Halse Rogers (raof) wrote :

Yeah, I could make an extra interface for SessionMediator to depend on. I'll ask the list first about the general “how many DSOs should this be” question and then see what that version of SessionMediator would look like.

A bit ugly, because we're adding even more special-purpose code to a general interface, but until it gains an extension mechanism... :)

Andreas Pokorny (andreas-pokorny) wrote :

In src/server/frontend/debugging_session_mediator.cpp
743 + response->set_x(request->x() + surface->top_left().x.as_int());
744 + response->set_y(request->y() + surface->top_left().y.as_int());

You have to transform x and y according to the surface orientation here (and in theory surface transformation but i doubt we want to be super correct - makes me wonder whether unity8 overrides that information stored at the surface? ). Furthermore in the nested case you have to forward that request to the system compositor.

So dl-load the debug extension in mirserver, and fail unlikely if not available.

Regarding the library vs internal topic. I prefer the separate library approach already implemented in this MP

review: Needs Fixing
kevin gunn (kgunn72) wrote :

As long as it's a dbug module that's not going to be part of a release image & you have to install when you want. Then I prefer the bloat-on-debug hit to keep it separated from regular ol' libmirclient.

however, is there a plan or mechanism to help resynch this with libmirclient where the code is duplicated ?
iirc, we're adding primarily for AP testing... so we'd want to keep the the functionality the same in the debug client, as to ensure the testing/config is valid and we trust the results.

Chris Halse Rogers (raof) wrote :

Clients wanting to use the debug extensions link against libmirclient as normal, and *also* libmirclient-debug-extension. There's no duplication of source code, just duplication of object code (as libmirclient-debug-extension needs access to the MirSurface implementation).

Andreas: Urgh, yeah, I guess so. I _think_ we have enough information in the nested case to do the translation without bouncing up to the host server, but it'll be safer to do so, yeah.

Kevin DuBois (kdub) wrote :

Its looking like we're coalescing around 2 DSO's then, everyone? (a second debug library is good by me)

Chris Halse Rogers (raof) wrote :

Andreas: Actually, I don't think we *do* need to forward to the system compositor - the nested compositor ensures it has a logical coordinate space that's identical to the system compositor's by means of the display configuration.

And we don't actually use the surface orientation anywhere, so I don't think we need to transform according to that either?

Andreas Pokorny (andreas-pokorny) wrote :

> Andreas: Actually, I don't think we *do* need to forward to the system
> compositor - the nested compositor ensures it has a logical coordinate space
> that's identical to the system compositor's by means of the display
> configuration.
>
> And we don't actually use the surface orientation anywhere, so I don't think
> we need to transform according to that either

I agree for a 'we' as in u-s-c + unity8 - since usc does not change the properties of unity8 surface. hmm.. it could still decide that unity8 and thus the client surface is not visible. But that is probably not a relevant result of the transformation? So I agree if you count demo shell out.

> And we don't actually use the surface orientation anywhere, so I don't think
> we need to transform according to that either

I thought for that calculation coordinates are given as client surface coordinates. Rotating the device turns a client surface of 400x900 pixels into a 900x400 grid. Whatever is now on 800x10, must be touched by the user at 390x800 or 10x100...

Alexandros Frantzis (afrantzis) wrote :

OK. Hopefully we will get a proper extension mechanism in the near/medium term.

509 +TEST_F(TestDebugAPI, ApiIsUnavaliableWhenServerNotStartedWithDebug)

"Unavailable"

> I thought for that calculation coordinates are given as client surface coordinates. Rotating the
> device turns a client surface of 400x900 pixels into a 900x400 grid. Whatever is now on 800x10,
> must be touched by the user at 390x800 or 10x100...

Not sure about this aspect of the code, so a weak approval for me pending further information on this.

review: Approve
Andreas Pokorny (andreas-pokorny) wrote :

As far as I can see qtmir/unity8 is not using mirs orientation values(, yet?). But it will need a way to influence the calculation instead.

Chris Halse Rogers (raof) wrote :

Yup. CoordinateTranslator is now available for overload by shells.

Andreas Pokorny (andreas-pokorny) wrote :

lgtm.

one little detail .. why int32_t in the protobuf messages/int in the client api - but unsigned in the CoordinateTranslator interface and the default implementation does .as_unit32_t(). Looking at the code I believe negative values here are properly transported and returned.. and also in the case where the surface position is promoted to an unsigned int (which could be potentially negative) in 1280, there is only an addition and the result is converted back to int. A bit dirty but it should still work.

(negative positions could be possible too, if decorations are in negative coordinate space of the surface)

review: Approve
Chris Halse Rogers (raof) wrote :

Probably best to use int32_t everywhere. Good catch.

Daniel van Vugt (vanvugt) wrote :

We do indeed have negative coordinates. So make sure your x's and y's are signed.

Although I recommend against int32_t for a few reasons. "int" is better because:
  * On any modern platform "int" is already >= 32 bits
  * On some 64-bit platforms "int" is 64-bit and it's more efficient to use that native word size than forcing 32-bits.
  * int32_t increases coupling to yet another header.

review: Needs Fixing
Alberto Aguirre (albaguirre) wrote :

> Although I recommend against int32_t for a few reasons. "int" is better
> because:
> * On any modern platform "int" is already >= 32 bits
> * On some 64-bit platforms "int" is 64-bit and it's more efficient to use
> that native word size than forcing 32-bits.
> * int32_t increases coupling to yet another header.

No since it involves protobuf (https://developers.google.com/protocol-buffers/docs/proto#scalar)
The type should match the type assigned in protobuf or in the very least specifically converted from int32_t to whatever internal type you use. The last thing we need is a subtle type conversion issue.

Daniel van Vugt (vanvugt) wrote :

Alright, still needs conversion to signed ints though. Like in:
232 + virtual geometry::Point surface_to_screen(std::shared_ptr<frontend::Surface> surface,
233 + uint32_t x, uint32_t y) = 0;

Even local coordinates can go negative -- Consider what happens when you drag something like a scroll bar or image. The scrolling keeps responding even when the pointer itself is out of the window (so could be in negative coordinates).

review: Needs Fixing
Daniel van Vugt (vanvugt) wrote :

Actually I still disagree with int32_t. If you make the decision to use that type just because Protobuf does, then you leak that information throughout your APIs in a very ugly way. "int" should be used instead, so that we at least hide the protocol implementation details from our client API design.

review: Needs Fixing
Chris Halse Rogers (raof) wrote :

Hah. I think we've found another area in which our stylistic preferences disagree :)

The way I see it, we currently hide the fact from our client API that Mir's coordinates system has exactly 32bits of significant data. “int” isn't hiding irrelevant implementation details, it's hiding a potentially relevant aspect of our API.

Indeed, I think we should be explicitly sizing *all* our types where they correspond to coordinates or other data types that are a part of our API that happen to be integral.

Daniel van Vugt (vanvugt) wrote :

Remember we only support client and server on the same host, and only plan on supporting that. As such the client and server can safely use the same type with an unspecified width, like "int".

Only if you're supporting a networked environment with heterogeneous word sizes is it necessary to specify the size. But we have no plans to ever make Mir a network protocol.

Chris Halse Rogers (raof) wrote :

I run armhf code on my amd64 machine all the time. Local machine only does *not* imply same-word-size, or even same-endianness.

Chris Halse Rogers (raof) wrote :

And, obviously, i386/amd64 is an even more common usecase.

Andreas Pokorny (andreas-pokorny) wrote :

> And, obviously, i386/amd64 is an even more common usecase.

hm maybe we could add something to the ci script that takes the x86 build and tries to run it with an amd64 server

Daniel van Vugt (vanvugt) wrote :

You have an armhf client/server talking to an amd64 server/client? That sounds interesting. QEMU?

Also interesting is the idea of mixing and matching amd64 and i386 on the same host. That does sound like a plausible albeit uncommon scenario.

Still, even if there are reasonable use cases for mixing and matching I think it's much cleaner design to choose the client API and then modify the protocol to fit rather than vice-versa.

review: Abstain
Chris Halse Rogers (raof) wrote :

On Tue, Oct 14, 2014 at 5:06 PM, Daniel van Vugt
<email address hidden> wrote:
> Review: Abstain
>
> You have an armhf client/server talking to an amd64 server/client?
> That sounds interesting. QEMU?

Indeed. With dpkg multiarch the only limitation on the architecture
combinations are the qemu system hosts.

>
> Also interesting is the idea of mixing and matching amd64 and i386 on
> the same host. That does sound like a plausible albeit uncommon
> scenario.

It's actually *super* common; does Steam ship an amd64 binary, for
example? The majority of games are still i386 binaries.

If Intel has its way we'll end up with lots of x32 binaries on amd64
systems as the norm :).

>
> Still, even if there are reasonable use cases for mixing and matching
> I think it's much cleaner design to choose the client API and then
> modify the protocol to fit rather than vice-versa.

Indeed, but the client API should guarantee appropriately sized data
types :)

Alan Griffiths (alan-griffiths) wrote :

I'd rather we didn't have to do this

review: Approve
Chris Halse Rogers (raof) wrote :

Dear protobuf: Your behaviour in registering an init thing that aborts on double-load is really annoying.

Alan Griffiths (alan-griffiths) wrote :

On 20/10/14 22:04, Chris Halse Rogers wrote:
> Dear protobuf: Your behaviour in registering an init thing that aborts on double-load is really annoying.

Yes, maybe it was a mistake to roll libmirprotobuf into libmircommon and
we should split it out again.

--
Alan Griffiths +44 (0)798 9938 758
Octopull Ltd http://www.octopull.co.uk/

Alberto Aguirre (albaguirre) wrote :

Does what it claims to do

review: Approve
Alberto Aguirre (albaguirre) wrote :

Looks like a CI hiccup unrelated to MP let's try again...

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client-ABI-sha1sums'
2--- client-ABI-sha1sums 2014-10-21 16:21:14 +0000
3+++ client-ABI-sha1sums 2014-10-23 13:30:17 +0000
4@@ -1,4 +1,4 @@
5-cbe1e3ccfea6ab5865510f4f598ec11571fcc852 include/client/mir_toolkit/mir_client_library_debug.h
6+3a60fb3b2b250ca67f54ade346ef658c9259c9a7 include/client/mir_toolkit/debug/surface.h
7 b53736bcb22ddc09aab8275cfdd05c109fdd0f12 include/client/mir_toolkit/mir_client_library_drm.h
8 1522a5fcdb01c0d9a990364539c4f1255853eef7 include/client/mir_toolkit/mir_client_library.h
9 e6185b680533c5fdcf1294a4797d5c3dd01d433f include/client/mir_toolkit/mir_connection.h
10
11=== modified file 'debian/control'
12--- debian/control 2014-10-21 17:22:26 +0000
13+++ debian/control 2014-10-23 13:30:17 +0000
14@@ -165,6 +165,52 @@
15 .
16 Contains header files required to develop against Mir.
17
18+Package: libmirclient-debug-extension1
19+Section: libs
20+Architecture: i386 amd64 armhf arm64
21+Multi-Arch: same
22+Pre-Depends: ${misc:Pre-Depends}
23+Depends: ${misc:Depends},
24+ ${shlibs:Depends},
25+Description: Display server for Ubuntu - optional client debug interfaces
26+ Mir is a display server running on linux systems, with a focus on efficiency,
27+ robust operation and a well-defined driver model.
28+ .
29+ This package contains both a shared library containing the client side of
30+ various optional debugging interfaces and the development headers required
31+ to use them.
32+ .
33+ This is primarily useful for developing Mir servers, low-level client
34+ toolkits, or for automated testing in constrained environments.
35+ .
36+ Not all Mir servers have the capability to service these APIs; end-user
37+ applications SHOULD NOT depend on this library.
38+
39+Package: libmirclient-debug-extension-dev
40+Section: libdevel
41+Architecture: i386 amd64 armhf arm64
42+Multi-Arch: same
43+Pre-Depends: ${misc:Pre-Depends}
44+Depends: libmirclient-debug-extension1 (= ${binary:Version})
45+ ${misc:Depends},
46+ ${shlibs:Depends},
47+Description: Display server for Ubuntu - client debug interface headers
48+ Mir is a display server running on linux systems, with a focus on efficiency,
49+ robust operation and a well-defined driver model.
50+ .
51+ This package contains both a shared library containing the client side of
52+ various optional debugging interfaces and the development headers required
53+ to use them.
54+ .
55+ This is primarily useful for developing Mir servers, low-level client
56+ toolkits, or for automated testing in constrained environments.
57+ .
58+ Not all Mir servers have the capability to service these APIs; end-user
59+ applications SHOULD NOT depend on this library.
60+ .
61+ This package contains the development headers required to develop against
62+ the debug extensions.
63+
64 Package: mir-demos
65 Architecture: i386 amd64 armhf arm64
66 Depends: ${misc:Depends},
67
68=== added file 'debian/libmirclient-debug-extension-dev.install'
69--- debian/libmirclient-debug-extension-dev.install 1970-01-01 00:00:00 +0000
70+++ debian/libmirclient-debug-extension-dev.install 2014-10-23 13:30:17 +0000
71@@ -0,0 +1,3 @@
72+usr/include/mirclient/mir_toolkit/debug
73+usr/lib/*/pkgconfig/mirclient-debug-extension.pc
74+usr/lib/*/libmirclient-debug-extension.so
75
76=== added file 'debian/libmirclient-debug-extension1.install'
77--- debian/libmirclient-debug-extension1.install 1970-01-01 00:00:00 +0000
78+++ debian/libmirclient-debug-extension1.install 2014-10-23 13:30:17 +0000
79@@ -0,0 +1,1 @@
80+usr/lib/*/libmirclient-debug-extension.so.*
81
82=== modified file 'debian/libmirclient-dev.install'
83--- debian/libmirclient-dev.install 2013-06-24 12:15:28 +0000
84+++ debian/libmirclient-dev.install 2014-10-23 13:30:17 +0000
85@@ -1,3 +1,3 @@
86-usr/include/mirclient
87+usr/include/mirclient/mir_toolkit/*.h
88 usr/lib/*/pkgconfig/mirclient.pc
89 usr/lib/*/libmirclient.so
90
91=== added directory 'include/client/mir_toolkit/debug'
92=== renamed file 'include/client/mir_toolkit/mir_client_library_debug.h' => 'include/client/mir_toolkit/debug/surface.h'
93--- include/client/mir_toolkit/mir_client_library_debug.h 2014-10-01 06:25:56 +0000
94+++ include/client/mir_toolkit/debug/surface.h 2014-10-23 13:30:17 +0000
95@@ -28,6 +28,7 @@
96
97 /**
98 * Return the ID of a surface (only useful for debug output).
99+ * \pre The surface is valid
100 * \param [in] surface The surface
101 * \return An internal ID that identifies the surface
102 */
103@@ -43,6 +44,25 @@
104 */
105 uint32_t mir_debug_surface_current_buffer_id(MirSurface *surface);
106
107+/**
108+ * Get the screen coordinates corresponding to a pair of surface coordinates
109+ * \pre The surface is valid
110+ * \param [in] surface The surface
111+ * \param [in] x, y Surface coordinates to map to screen coordinates
112+ * \param [out] screen_x, screen_y The screen coordinates corresponding to x, y.
113+ * \return True if screen_x and screen_y contain values
114+ * \note There are many cases where such a mapping does not exist or would be expensive
115+ * to calculate. Only Mir servers started with the --debug option will ever return
116+ * values for this call, and even when --debug is enabled servers are free to
117+ * return nothing.
118+ *
119+ * This call will only be interesting for automated testing, where both the client
120+ * and shell state is known and constrained.
121+ */
122+MirBool mir_debug_surface_coords_to_screen(MirSurface* surface,
123+ int x, int y,
124+ int* screen_x, int* screen_y);
125+
126 #ifdef __cplusplus
127 }
128 #endif
129
130=== modified file 'include/platform/mir/options/configuration.h'
131--- include/platform/mir/options/configuration.h 2014-10-01 06:25:56 +0000
132+++ include/platform/mir/options/configuration.h 2014-10-23 13:30:17 +0000
133@@ -43,6 +43,7 @@
134 extern char const* const frontend_threads_opt;
135 extern char const* const touchspots_opt;
136 extern char const* const fatal_abort_opt;
137+extern char const* const debug_opt;
138
139 extern char const* const name_opt;
140 extern char const* const offscreen_opt;
141
142=== modified file 'include/server/mir/default_server_configuration.h'
143--- include/server/mir/default_server_configuration.h 2014-10-22 18:55:40 +0000
144+++ include/server/mir/default_server_configuration.h 2014-10-23 13:30:17 +0000
145@@ -101,6 +101,7 @@
146 class SceneReport;
147 class PromptSessionListener;
148 class PromptSessionManager;
149+class CoordinateTranslator;
150 }
151 namespace graphics
152 {
153@@ -286,6 +287,7 @@
154 * @{ */
155 // To customize this behaviour it is recommended you override wrap_session_coordinator().
156 virtual std::shared_ptr<scene::SessionCoordinator> the_session_coordinator();
157+ virtual std::shared_ptr<scene::CoordinateTranslator> the_coordinate_translator();
158 /** @} */
159
160
161@@ -421,6 +423,7 @@
162 CachedPtr<scene::PromptSessionListener> prompt_session_listener;
163 CachedPtr<scene::PromptSessionManager> prompt_session_manager;
164 CachedPtr<scene::SessionCoordinator> session_coordinator;
165+ CachedPtr<scene::CoordinateTranslator> coordinate_translator;
166 CachedPtr<EmergencyCleanup> emergency_cleanup;
167 CachedPtr<shell::HostLifecycleEventListener> host_lifecycle_event_listener;
168
169
170=== added file 'include/server/mir/scene/coordinate_translator.h'
171--- include/server/mir/scene/coordinate_translator.h 1970-01-01 00:00:00 +0000
172+++ include/server/mir/scene/coordinate_translator.h 2014-10-23 13:30:17 +0000
173@@ -0,0 +1,66 @@
174+/*
175+ * Copyright © 2014 Canonical Ltd.
176+ *
177+ * This program is free software: you can redistribute it and/or modify it
178+ * under the terms of the GNU General Public License version 3,
179+ * as published by the Free Software Foundation.
180+ *
181+ * This program is distributed in the hope that it will be useful,
182+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
183+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
184+ * GNU General Public License for more details.
185+ *
186+ * You should have received a copy of the GNU General Public License
187+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
188+ *
189+ * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
190+ */
191+
192+#ifndef MIR_SCENE_COORDINATE_TRANSLATOR_H_
193+#define MIR_SCENE_COORDINATE_TRANSLATOR_H_
194+
195+#include "mir/geometry/point.h"
196+#include <memory>
197+
198+namespace mir
199+{
200+namespace frontend
201+{
202+class Surface;
203+}
204+
205+namespace scene
206+{
207+
208+/**
209+ * Support for the debug "surface to screen" coordinate translation interface.
210+ * \note For shells which do surface transformations the default implementation
211+ * will return incorrect results.
212+ */
213+class CoordinateTranslator
214+{
215+public:
216+ virtual ~CoordinateTranslator() = default;
217+
218+ /**
219+ * \brief Translate a surface coordinate into the screen coordinate space
220+ * \param [in] surface A frontend::Surface. This will need to be dynamic_cast into
221+ * the scene::Surface relevant for the shell.
222+ * \param [in] x, y Coordinates to translate from the surface coordinate space
223+ * \return The coordinates in the screen coordinate space.
224+ * \throws A std::runtime_error if the translation cannot be performed
225+ * for any reason.
226+ *
227+ * \note It is acceptable for this call to unconditionally throw a std::runtime_error.
228+ * It is not required for normal functioning of the server or clients; clients which
229+ * use the debug extension will receive an appropriate failure notice.
230+ */
231+ virtual geometry::Point surface_to_screen(std::shared_ptr<frontend::Surface> surface,
232+ int32_t x, int32_t y) = 0;
233+};
234+
235+
236+}
237+}
238+
239+#endif // MIR_SCENE_COORDINATE_TRANSLATOR_H_
240
241=== modified file 'platform-ABI-sha1sums'
242--- platform-ABI-sha1sums 2014-10-21 16:21:14 +0000
243+++ platform-ABI-sha1sums 2014-10-23 13:30:17 +0000
244@@ -40,7 +40,7 @@
245 1fbe488b4581486fd01e2f03e504f31b72c09040 include/platform/mir/graphics/platform_ipc_operations.h
246 9c7712af84b6fde1970ff802ad2ea78f892c7b7e include/platform/mir/graphics/platform_ipc_package.h
247 84c063346b3bd51b4624d9f940008d4c3f8be066 include/platform/mir/graphics/renderable.h
248-f5746dab3336266cfd410ce4e4d01333df6e5b99 include/platform/mir/options/configuration.h
249+b19329d35a55f640edd72c0a953908995211d97e include/platform/mir/options/configuration.h
250 47007c783c174f8e94d332c4b13c6b01358b48fb include/platform/mir/options/default_configuration.h
251 b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h
252 3c37cc31e8b290b89c311d82f02e07d342766451 include/platform/mir/options/program_option.h
253
254=== modified file 'server-ABI-sha1sums'
255--- server-ABI-sha1sums 2014-10-22 18:55:40 +0000
256+++ server-ABI-sha1sums 2014-10-23 13:30:17 +0000
257@@ -40,7 +40,7 @@
258 1fbe488b4581486fd01e2f03e504f31b72c09040 include/platform/mir/graphics/platform_ipc_operations.h
259 9c7712af84b6fde1970ff802ad2ea78f892c7b7e include/platform/mir/graphics/platform_ipc_package.h
260 84c063346b3bd51b4624d9f940008d4c3f8be066 include/platform/mir/graphics/renderable.h
261-f5746dab3336266cfd410ce4e4d01333df6e5b99 include/platform/mir/options/configuration.h
262+b19329d35a55f640edd72c0a953908995211d97e include/platform/mir/options/configuration.h
263 47007c783c174f8e94d332c4b13c6b01358b48fb include/platform/mir/options/default_configuration.h
264 b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h
265 3c37cc31e8b290b89c311d82f02e07d342766451 include/platform/mir/options/program_option.h
266@@ -48,7 +48,7 @@
267 a9f284ba4b05d58fd3eeb628d1f56fe4ac188526 include/server/mir/compositor/compositor_id.h
268 878ab5c4007d16dac213a3eb0105421d8ffad206 include/server/mir/compositor/scene_element.h
269 4fcf34e424128b87ddc76733594e32e09ebbd486 include/server/mir/compositor/scene.h
270-7e47baf423fc61960d8e4ea92eae93caf71c93e2 include/server/mir/default_server_configuration.h
271+c14448c8f882f44b05fa56ced7c8db51083a9bd3 include/server/mir/default_server_configuration.h
272 af1ff0714be973ac76d56006a2e5991f68cd1dec include/server/mir/display_server.h
273 a35c5495d8fd28fc0e375b17495fc5caab51b329 include/server/mir/emergency_cleanup.h
274 938de641cb0e01e1098b007b39b151a7dfe4adc1 include/server/mir/frontend/display_changer.h
275@@ -75,6 +75,7 @@
276 964069b241f1e8211386bb8735ee0f752b666949 include/server/mir/main_loop.h
277 edd5a0a6be0be57ef64c5af89fc5a65dc558648c include/server/mir/report_exception.h
278 8192727cf5fa0b2b5798b2211c2c8a4ad65c9f60 include/server/mir/run_mir.h
279+c9de8b851fb22092a9a486d71cd998b4cb8392e1 include/server/mir/scene/coordinate_translator.h
280 71d9082681aa39d652c88ad3b54665695b521d24 include/server/mir/scene/depth_id.h
281 4e4e563ab429a13ddca7eead16f2b6cefb8edff6 include/server/mir/scene/null_surface_observer.h
282 d5273f3363b0b776427d5e3f1af99f0f2bcf3fa6 include/server/mir/scene/observer.h
283
284=== modified file 'src/client/CMakeLists.txt'
285--- src/client/CMakeLists.txt 2014-10-21 16:21:14 +0000
286+++ src/client/CMakeLists.txt 2014-10-23 13:30:17 +0000
287@@ -8,12 +8,18 @@
288 set(PREFIX "${CMAKE_INSTALL_PREFIX}")
289 set(EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}")
290 set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}")
291-set(INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include/mirclient")
292-set(COMMON_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include/mircommon")
293+set(INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include")
294
295 configure_file(
296 ${CMAKE_CURRENT_SOURCE_DIR}/mirclient.pc.in
297 ${CMAKE_CURRENT_BINARY_DIR}/mirclient.pc
298+ @ONLY
299+)
300+
301+configure_file(
302+ ${CMAKE_CURRENT_SOURCE_DIR}/mirclient-debug-extension.pc.in
303+ ${CMAKE_CURRENT_BINARY_DIR}/mirclient-debug-extension.pc
304+ @ONLY
305 )
306
307 include_directories(
308@@ -113,3 +119,47 @@
309 FILES ${CMAKE_CURRENT_BINARY_DIR}/mirclient.pc
310 DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
311 )
312+
313+# TODO: Extension apparatus so that mirclient-debug-extension can be a MODULE and not
314+# duplicate (almost) the entirity of mirclient
315+
316+set(MIRCLIENT_DEBUG_EXTENSION_ABI 1)
317+
318+add_library(
319+ mirclient-debug-extension SHARED
320+
321+ mir_debug_api.cpp
322+ $<TARGET_OBJECTS:mirclientobjects>
323+)
324+
325+target_link_libraries(
326+ mirclient-debug-extension
327+
328+ mirclient
329+)
330+
331+set(debug_symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols-debug.map)
332+
333+set_target_properties(
334+ mirclient-debug-extension
335+
336+ PROPERTIES
337+ SOVERSION ${MIRCLIENT_DEBUG_EXTENSION_ABI}
338+ LINK_FLAGS "-Wl,--version-script,${debug_symbol_map}"
339+)
340+
341+install(
342+ DIRECTORY ${CMAKE_SOURCE_DIR}/include/client/mir_toolkit/debug
343+ DESTINATION "include/mirclient/mir_toolkit/debug"
344+)
345+
346+install(
347+ TARGETS mirclient-debug-extension
348+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
349+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
350+
351+install(
352+ FILES ${CMAKE_CURRENT_BINARY_DIR}/mirclient-debug-extension.pc
353+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
354+)
355+
356
357=== modified file 'src/client/mir_connection.cpp'
358--- src/client/mir_connection.cpp 2014-10-01 06:25:56 +0000
359+++ src/client/mir_connection.cpp 2014-10-23 13:30:17 +0000
360@@ -87,6 +87,7 @@
361 deregisterer{this},
362 channel(),
363 server(0),
364+ debug(0),
365 error_message(error_message)
366 {
367 }
368@@ -97,6 +98,7 @@
369 platform_library{conf.the_platform_library()},
370 channel(conf.the_rpc_channel()),
371 server(channel.get(), ::google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL),
372+ debug(channel.get(), ::google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL),
373 logger(conf.the_logger()),
374 client_platform_factory(conf.the_client_platform_factory()),
375 input_platform(conf.the_input_platform()),
376@@ -133,7 +135,7 @@
377 mir_surface_callback callback,
378 void * context)
379 {
380- auto surface = new MirSurface(this, server, platform->create_buffer_factory(), input_platform, params, callback, context);
381+ auto surface = new MirSurface(this, server, &debug, platform->create_buffer_factory(), input_platform, params, callback, context);
382
383 return surface->get_create_wait_handle();
384 }
385
386=== modified file 'src/client/mir_connection.h'
387--- src/client/mir_connection.h 2014-10-01 06:25:56 +0000
388+++ src/client/mir_connection.h 2014-10-23 13:30:17 +0000
389@@ -149,6 +149,7 @@
390
391 std::shared_ptr<google::protobuf::RpcChannel> const channel;
392 mir::protobuf::DisplayServer::Stub server;
393+ mir::protobuf::Debug::Stub debug;
394 std::shared_ptr<mir::logging::Logger> const logger;
395 mir::protobuf::Void void_response;
396 mir::protobuf::Connection connect_result;
397
398=== added file 'src/client/mir_debug_api.cpp'
399--- src/client/mir_debug_api.cpp 1970-01-01 00:00:00 +0000
400+++ src/client/mir_debug_api.cpp 2014-10-23 13:30:17 +0000
401@@ -0,0 +1,39 @@
402+/*
403+ * Copyright © 2014 Canonical Ltd.
404+ *
405+ * This program is free software: you can redistribute it and/or modify it
406+ * under the terms of the GNU Lesser General Public License version 3,
407+ * as published by the Free Software Foundation.
408+ *
409+ * This program is distributed in the hope that it will be useful,
410+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
411+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
412+ * GNU Lesser General Public License for more details.
413+ *
414+ * You should have received a copy of the GNU Lesser General Public License
415+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
416+ *
417+ * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
418+ */
419+
420+#include "mir_toolkit/debug/surface.h"
421+
422+#include "mir_surface.h"
423+
424+uint32_t mir_debug_surface_current_buffer_id(MirSurface* surface)
425+{
426+ return surface->get_current_buffer_id();
427+}
428+
429+int mir_debug_surface_id(MirSurface* surface)
430+{
431+ return surface->id();
432+}
433+
434+MirBool mir_debug_surface_coords_to_screen(MirSurface* surface,
435+ int x, int y,
436+ int* screen_x, int* screen_y)
437+{
438+ return surface->translate_to_screen_coordinates(x, y, screen_x, screen_y) ?
439+ mir_true : mir_false ;
440+}
441
442=== modified file 'src/client/mir_surface.cpp'
443--- src/client/mir_surface.cpp 2014-10-21 16:21:14 +0000
444+++ src/client/mir_surface.cpp 2014-10-23 13:30:17 +0000
445@@ -51,7 +51,27 @@
446 std::shared_ptr<mircv::InputPlatform> const& input_platform,
447 MirSurfaceParameters const & params,
448 mir_surface_callback callback, void * context)
449+ : MirSurface(allocating_connection,
450+ server,
451+ nullptr,
452+ factory,
453+ input_platform,
454+ params,
455+ callback, context)
456+{
457+}
458+
459+
460+MirSurface::MirSurface(
461+ MirConnection *allocating_connection,
462+ mp::DisplayServer::Stub & server,
463+ mp::Debug::Stub* debug,
464+ std::shared_ptr<mcl::ClientBufferFactory> const& factory,
465+ std::shared_ptr<mircv::InputPlatform> const& input_platform,
466+ MirSurfaceParameters const & params,
467+ mir_surface_callback callback, void * context)
468 : server(server),
469+ debug{debug},
470 connection(allocating_connection),
471 buffer_depository(std::make_shared<mcl::ClientBufferDepository>(factory, mir::frontend::client_buffer_cache_size)),
472 input_platform(input_platform)
473@@ -373,6 +393,49 @@
474 return &configure_wait_handle;
475 }
476
477+namespace
478+{
479+void signal_response_received(MirWaitHandle* handle)
480+{
481+ handle->result_received();
482+}
483+}
484+
485+bool MirSurface::translate_to_screen_coordinates(int x, int y,
486+ int *screen_x, int *screen_y)
487+{
488+ if (!debug)
489+ {
490+ return false;
491+ }
492+
493+ mp::CoordinateTranslationRequest request;
494+
495+ request.set_x(x);
496+ request.set_y(y);
497+ *request.mutable_surfaceid() = surface.id();
498+ mp::CoordinateTranslationResponse response;
499+
500+ MirWaitHandle signal;
501+ signal.expect_result();
502+
503+ {
504+ std::lock_guard<decltype(mutex)> lock(mutex);
505+
506+ debug->translate_surface_to_screen(
507+ nullptr,
508+ &request,
509+ &response,
510+ google::protobuf::NewCallback(&signal_response_received, &signal));
511+ }
512+
513+ signal.wait_for_one();
514+
515+ *screen_x = response.x();
516+ *screen_y = response.y();
517+ return !response.has_error();
518+}
519+
520 void MirSurface::on_configured()
521 {
522 std::lock_guard<decltype(mutex)> lock(mutex);
523
524=== modified file 'src/client/mir_surface.h'
525--- src/client/mir_surface.h 2014-10-21 16:21:14 +0000
526+++ src/client/mir_surface.h 2014-10-23 13:30:17 +0000
527@@ -62,6 +62,15 @@
528 MirSurface(
529 MirConnection *allocating_connection,
530 mir::protobuf::DisplayServer::Stub & server,
531+ mir::protobuf::Debug::Stub* debug,
532+ std::shared_ptr<mir::client::ClientBufferFactory> const& buffer_factory,
533+ std::shared_ptr<mir::input::receiver::InputPlatform> const& input_platform,
534+ MirSurfaceParameters const& params,
535+ mir_surface_callback callback, void * context);
536+
537+ MirSurface(
538+ MirConnection *allocating_connection,
539+ mir::protobuf::DisplayServer::Stub & server,
540 std::shared_ptr<mir::client::ClientBufferFactory> const& buffer_factory,
541 std::shared_ptr<mir::input::receiver::InputPlatform> const& input_platform,
542 MirSurfaceParameters const& params,
543@@ -87,6 +96,11 @@
544 EGLNativeWindowType generate_native_window();
545
546 MirWaitHandle* configure(MirSurfaceAttrib a, int value);
547+
548+ // TODO: Some sort of extension mechanism so that this can be moved
549+ // out into a separate class in the libmirclient-debug DSO.
550+ bool translate_to_screen_coordinates(int x, int y,
551+ int* screen_x, int* screen_y);
552
553 // Non-blocking
554 int attrib(MirSurfaceAttrib a) const;
555@@ -115,7 +129,8 @@
556 MirPixelFormat convert_ipc_pf_to_geometry(google::protobuf::int32 pf);
557 void release_cpu_region();
558
559- mir::protobuf::DisplayServer::Stub & server;
560+ mir::protobuf::DisplayServer::Stub& server;
561+ mir::protobuf::Debug::Stub* debug;
562 mir::protobuf::Surface surface;
563 mir::protobuf::BufferRequest buffer_request;
564 std::string error_message;
565
566=== modified file 'src/client/mir_surface_api.cpp'
567--- src/client/mir_surface_api.cpp 2014-10-01 06:25:56 +0000
568+++ src/client/mir_surface_api.cpp 2014-10-23 13:30:17 +0000
569@@ -18,7 +18,6 @@
570
571 #include "mir_toolkit/mir_surface.h"
572 #include "mir_toolkit/mir_wait.h"
573-#include "mir_toolkit/mir_client_library_debug.h"
574
575 #include "mir_connection.h"
576 #include "mir_surface.h"
577@@ -152,9 +151,9 @@
578 nullptr));
579 }
580
581-int mir_surface_get_id(MirSurface* surface)
582+int mir_surface_get_id(MirSurface* /*surface*/)
583 {
584- return mir_debug_surface_id(surface);
585+ return 0;
586 }
587
588 MirWaitHandle* mir_surface_set_type(MirSurface* surf,
589
590=== added file 'src/client/mirclient-debug-extension.pc.in'
591--- src/client/mirclient-debug-extension.pc.in 1970-01-01 00:00:00 +0000
592+++ src/client/mirclient-debug-extension.pc.in 2014-10-23 13:30:17 +0000
593@@ -0,0 +1,11 @@
594+prefix=@PREFIX@
595+exec_prefix=@EXEC_PREFIX@
596+libdir=@LIBDIR@
597+includedir=@INCLUDEDIR@/mirclient-debug
598+common_includedir=@INCLUDEDIR@/mircommon
599+
600+Name: mirclient-debug
601+Description: Mir client debug library
602+Version: @MIR_VERSION@
603+Libs: -L${libdir} -lmirclient-debug
604+Cflags: -I${includedir} -I${common_includedir}
605
606=== modified file 'src/client/mirclient.pc.in'
607--- src/client/mirclient.pc.in 2014-10-01 06:25:56 +0000
608+++ src/client/mirclient.pc.in 2014-10-23 13:30:17 +0000
609@@ -1,11 +1,13 @@
610 prefix=@PREFIX@
611 exec_prefix=@EXEC_PREFIX@
612 libdir=@LIBDIR@
613-includedir=@INCLUDEDIR@
614+includedir=@INCLUDEDIR@/mirclient
615+common_includedir=@INCLUDEDIR@/mircommon
616+
617
618 Name: mirclient
619 Description: Mir client library
620 Version: @MIR_VERSION@
621 Requires.private: protobuf >= 2.4.1
622-Libs: -L@LIBDIR@ -lmirclient
623-Cflags: -I@INCLUDEDIR@ -I@COMMON_INCLUDEDIR@
624+Libs: -L${libdir} -lmirclient
625+Cflags: -I${includedir} -I${common_includedir}
626
627=== added file 'src/client/symbols-debug.map'
628--- src/client/symbols-debug.map 1970-01-01 00:00:00 +0000
629+++ src/client/symbols-debug.map 2014-10-23 13:30:17 +0000
630@@ -0,0 +1,5 @@
631+{
632+ global:
633+ mir_debug_*;
634+ local: *;
635+};
636
637=== modified file 'src/common/protobuf/mir_protobuf.proto'
638--- src/common/protobuf/mir_protobuf.proto 2014-10-21 16:21:14 +0000
639+++ src/common/protobuf/mir_protobuf.proto 2014-10-23 13:30:17 +0000
640@@ -228,3 +228,20 @@
641 rpc stop_prompt_session(Void) returns (Void);
642 rpc exchange_buffer(BufferRequest) returns (Buffer);
643 }
644+
645+message CoordinateTranslationRequest {
646+ required SurfaceId surfaceid = 1;
647+ required int32 x = 2;
648+ required int32 y = 3;
649+}
650+
651+message CoordinateTranslationResponse {
652+ optional int32 x = 1;
653+ optional int32 y = 2;
654+
655+ optional string error = 127;
656+}
657+
658+service Debug {
659+ rpc translate_surface_to_screen(CoordinateTranslationRequest) returns (CoordinateTranslationResponse);
660+}
661
662=== modified file 'src/common/symbols.map'
663--- src/common/symbols.map 2014-10-21 16:21:14 +0000
664+++ src/common/symbols.map 2014-10-23 13:30:17 +0000
665@@ -143,6 +143,42 @@
666 mir::protobuf::ConnectParameters::SerializeWithCachedSizes*;
667 mir::protobuf::ConnectParameters::SerializeWithCachedSizesToArray*;
668 mir::protobuf::ConnectParameters::Swap*;
669+ mir::protobuf::CoordinateTranslationRequest::ByteSize*;
670+ mir::protobuf::CoordinateTranslationRequest::Clear*;
671+ mir::protobuf::CoordinateTranslationRequest::?CoordinateTranslationRequest*;
672+ mir::protobuf::CoordinateTranslationRequest::CoordinateTranslationRequest*;
673+ mir::protobuf::CoordinateTranslationRequest::CopyFrom*;
674+ mir::protobuf::CoordinateTranslationRequest::default_instance*;
675+ mir::protobuf::CoordinateTranslationRequest::descriptor*;
676+ mir::protobuf::CoordinateTranslationRequest::GetMetadata*;
677+ mir::protobuf::CoordinateTranslationRequest::IsInitialized*;
678+ mir::protobuf::CoordinateTranslationRequest::kSurfaceidFieldNumber*;
679+ mir::protobuf::CoordinateTranslationRequest::kXFieldNumber*;
680+ mir::protobuf::CoordinateTranslationRequest::kYFieldNumber*;
681+ mir::protobuf::CoordinateTranslationRequest::MergeFrom*;
682+ mir::protobuf::CoordinateTranslationRequest::MergePartialFromCodedStream*;
683+ mir::protobuf::CoordinateTranslationRequest::New*;
684+ mir::protobuf::CoordinateTranslationRequest::SerializeWithCachedSizes*;
685+ mir::protobuf::CoordinateTranslationRequest::SerializeWithCachedSizesToArray*;
686+ mir::protobuf::CoordinateTranslationRequest::Swap*;
687+ mir::protobuf::CoordinateTranslationResponse::ByteSize*;
688+ mir::protobuf::CoordinateTranslationResponse::Clear*;
689+ mir::protobuf::CoordinateTranslationResponse::?CoordinateTranslationResponse*;
690+ mir::protobuf::CoordinateTranslationResponse::CoordinateTranslationResponse*;
691+ mir::protobuf::CoordinateTranslationResponse::CopyFrom*;
692+ mir::protobuf::CoordinateTranslationResponse::default_instance*;
693+ mir::protobuf::CoordinateTranslationResponse::descriptor*;
694+ mir::protobuf::CoordinateTranslationResponse::GetMetadata*;
695+ mir::protobuf::CoordinateTranslationResponse::IsInitialized*;
696+ mir::protobuf::CoordinateTranslationResponse::kErrorFieldNumber*;
697+ mir::protobuf::CoordinateTranslationResponse::kXFieldNumber*;
698+ mir::protobuf::CoordinateTranslationResponse::kYFieldNumber*;
699+ mir::protobuf::CoordinateTranslationResponse::MergeFrom*;
700+ mir::protobuf::CoordinateTranslationResponse::MergePartialFromCodedStream*;
701+ mir::protobuf::CoordinateTranslationResponse::New*;
702+ mir::protobuf::CoordinateTranslationResponse::SerializeWithCachedSizes*;
703+ mir::protobuf::CoordinateTranslationResponse::SerializeWithCachedSizesToArray*;
704+ mir::protobuf::CoordinateTranslationResponse::Swap*;
705 mir::protobuf::CursorSetting::ByteSize*;
706 mir::protobuf::CursorSetting::Clear*;
707 mir::protobuf::CursorSetting::CopyFrom*;
708@@ -160,6 +196,16 @@
709 mir::protobuf::CursorSetting::SerializeWithCachedSizes*;
710 mir::protobuf::CursorSetting::SerializeWithCachedSizesToArray*;
711 mir::protobuf::CursorSetting::Swap*;
712+ mir::protobuf::Debug::CallMethod*;
713+ mir::protobuf::Debug::?Debug*;
714+ mir::protobuf::Debug::descriptor*;
715+ mir::protobuf::Debug::GetDescriptor*;
716+ mir::protobuf::Debug::GetRequestPrototype*;
717+ mir::protobuf::Debug::GetResponsePrototype*;
718+ mir::protobuf::Debug_Stub::?Debug_Stub*;
719+ mir::protobuf::Debug_Stub::Debug_Stub*;
720+ mir::protobuf::Debug_Stub::translate_surface_to_screen*;
721+ mir::protobuf::Debug::translate_surface_to_screen*;
722 mir::protobuf::DisplayCard::ByteSize*;
723 mir::protobuf::DisplayCard::Clear*;
724 mir::protobuf::DisplayCard::CopyFrom*;
725@@ -780,7 +826,11 @@
726 typeinfo?for?mir::protobuf::BufferRequest;
727 typeinfo?for?mir::protobuf::Connection;
728 typeinfo?for?mir::protobuf::ConnectParameters;
729+ typeinfo?for?mir::protobuf::CoordinateTranslationRequest;
730+ typeinfo?for?mir::protobuf::CoordinateTranslationResponse;
731 typeinfo?for?mir::protobuf::CursorSetting;
732+ typeinfo?for?mir::protobuf::Debug;
733+ typeinfo?for?mir::protobuf::Debug_Stub;
734 typeinfo?for?mir::protobuf::DisplayCard;
735 typeinfo?for?mir::protobuf::DisplayConfiguration;
736 typeinfo?for?mir::protobuf::DisplayInfo;
737@@ -847,7 +897,11 @@
738 vtable?for?mir::protobuf::BufferRequest;
739 vtable?for?mir::protobuf::Connection;
740 vtable?for?mir::protobuf::ConnectParameters;
741+ vtable?for?mir::protobuf::CoordinateTranslationRequest;
742+ vtable?for?mir::protobuf::CoordinateTranslationResponse;
743 vtable?for?mir::protobuf::CursorSetting;
744+ vtable?for?mir::protobuf::Debug;
745+ vtable?for?mir::protobuf::Debug_Stub;
746 vtable?for?mir::protobuf::DisplayCard;
747 vtable?for?mir::protobuf::DisplayConfiguration;
748 vtable?for?mir::protobuf::DisplayInfo;
749
750=== added file 'src/include/server/mir/frontend/unsupported_feature_exception.h'
751--- src/include/server/mir/frontend/unsupported_feature_exception.h 1970-01-01 00:00:00 +0000
752+++ src/include/server/mir/frontend/unsupported_feature_exception.h 2014-10-23 13:30:17 +0000
753@@ -0,0 +1,41 @@
754+/*
755+ * Copyright © 2014 Canonical Ltd.
756+ *
757+ * This program is free software: you can redistribute it and/or modify it
758+ * under the terms of the GNU General Public License version 3,
759+ * as published by the Free Software Foundation.
760+ *
761+ * This program is distributed in the hope that it will be useful,
762+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
763+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
764+ * GNU General Public License for more details.
765+ *
766+ * You should have received a copy of the GNU General Public License
767+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
768+ *
769+ * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
770+ */
771+
772+
773+#ifndef MIR_FRONTEND_UNSUPPORTED_FEATURE_EXCEPTION_H_
774+#define MIR_FRONTEND_UNSUPPORTED_FEATURE_EXCEPTION_H_
775+
776+#include <stdexcept>
777+
778+namespace mir
779+{
780+namespace frontend
781+{
782+class unsupported_feature : public std::runtime_error
783+{
784+public:
785+ unsupported_feature()
786+ : std::runtime_error{"Unsupported feature requested"}
787+ {
788+ }
789+};
790+}
791+}
792+
793+
794+#endif /* MIR_FRONTEND_UNSUPPORTED_FEATURE_EXCEPTION_H_ */
795
796=== modified file 'src/platform/options/default_configuration.cpp'
797--- src/platform/options/default_configuration.cpp 2014-10-01 06:25:56 +0000
798+++ src/platform/options/default_configuration.cpp 2014-10-23 13:30:17 +0000
799@@ -45,6 +45,7 @@
800 char const* const mo::offscreen_opt = "offscreen";
801 char const* const mo::touchspots_opt = "enable-touchspots";
802 char const* const mo::fatal_abort_opt = "on-fatal-error-abort";
803+char const* const mo::debug_opt = "debug";
804
805 char const* const mo::glog = "glog";
806 char const* const mo::glog_stderrthreshold = "glog-stderrthreshold";
807@@ -164,7 +165,9 @@
808 (touchspots_opt,
809 "Display visualization of touchspots (e.g. for screencasting).")
810 (fatal_abort_opt, "On \"fatal error\" conditions [e.g. drivers behaving "
811- "in unexpected ways] abort (to get a core dump)");
812+ "in unexpected ways] abort (to get a core dump)")
813+ (debug_opt, "Enable extra development debugging. "
814+ "This is only interesting for people doing Mir server or client development.");
815
816 add_platform_options();
817 }
818
819=== modified file 'src/platform/symbols.map'
820--- src/platform/symbols.map 2014-10-21 16:21:14 +0000
821+++ src/platform/symbols.map 2014-10-23 13:30:17 +0000
822@@ -146,6 +146,7 @@
823 mir::options::DefaultConfiguration::parse_environment*;
824 mir::options::DefaultConfiguration::the_options*;
825 mir::options::display_report_opt*;
826+ mir::options::debug_opt*;
827 mir::options::enable_input_opt*;
828 mir::options::fatal_abort_opt*;
829 mir::options::frontend_threads_opt*;
830
831=== modified file 'src/server/frontend/CMakeLists.txt'
832--- src/server/frontend/CMakeLists.txt 2014-10-01 06:25:56 +0000
833+++ src/server/frontend/CMakeLists.txt 2014-10-23 13:30:17 +0000
834@@ -22,6 +22,7 @@
835 session_credentials.cpp
836 default_configuration.cpp
837 default_ipc_factory.cpp
838+ unsupported_coordinate_translator.cpp
839 )
840
841 add_library(
842
843=== modified file 'src/server/frontend/default_configuration.cpp'
844--- src/server/frontend/default_configuration.cpp 2014-10-01 06:25:56 +0000
845+++ src/server/frontend/default_configuration.cpp 2014-10-23 13:30:17 +0000
846@@ -22,6 +22,8 @@
847 #include "default_ipc_factory.h"
848 #include "published_socket_connector.h"
849
850+#include "unsupported_coordinate_translator.h"
851+
852 #include "mir/frontend/protobuf_connection_creator.h"
853 #include "mir/frontend/session_authorizer.h"
854 #include "mir/options/configuration.h"
855@@ -29,6 +31,7 @@
856
857 namespace mf = mir::frontend;
858 namespace mg = mir::graphics;
859+namespace ms = mir::scene;
860
861 std::shared_ptr<mf::ConnectionCreator>
862 mir::DefaultServerConfiguration::the_connection_creator()
863@@ -137,13 +140,23 @@
864 mir::DefaultServerConfiguration::new_ipc_factory(
865 std::shared_ptr<mf::SessionAuthorizer> const& session_authorizer)
866 {
867+ std::shared_ptr<ms::CoordinateTranslator> translator;
868+ if (the_options()->is_set(options::debug_opt))
869+ {
870+ translator = the_coordinate_translator();
871+ }
872+ else
873+ {
874+ translator = std::make_shared<mf::UnsupportedCoordinateTranslator>();
875+ }
876 return std::make_shared<mf::DefaultIpcFactory>(
877- the_frontend_shell(),
878- the_session_mediator_report(),
879- the_graphics_platform(),
880- the_frontend_display_changer(),
881- the_buffer_allocator(),
882- the_screencast(),
883- session_authorizer,
884- the_cursor_images());
885+ the_frontend_shell(),
886+ the_session_mediator_report(),
887+ the_graphics_platform(),
888+ the_frontend_display_changer(),
889+ the_buffer_allocator(),
890+ the_screencast(),
891+ session_authorizer,
892+ the_cursor_images(),
893+ translator);
894 }
895
896=== modified file 'src/server/frontend/default_ipc_factory.cpp'
897--- src/server/frontend/default_ipc_factory.cpp 2014-10-01 06:25:56 +0000
898+++ src/server/frontend/default_ipc_factory.cpp 2014-10-23 13:30:17 +0000
899@@ -38,7 +38,8 @@
900 std::shared_ptr<mg::GraphicBufferAllocator> const& buffer_allocator,
901 std::shared_ptr<Screencast> const& screencast,
902 std::shared_ptr<SessionAuthorizer> const& session_authorizer,
903- std::shared_ptr<mi::CursorImages> const& cursor_images) :
904+ std::shared_ptr<mi::CursorImages> const& cursor_images,
905+ std::shared_ptr<scene::CoordinateTranslator> const& translator) :
906 shell(shell),
907 no_prompt_shell(std::make_shared<NoPromptShell>(shell)),
908 sm_report(sm_report),
909@@ -48,7 +49,8 @@
910 buffer_allocator(buffer_allocator),
911 screencast(screencast),
912 session_authorizer(session_authorizer),
913- cursor_images(cursor_images)
914+ cursor_images(cursor_images),
915+ translator{translator}
916 {
917 }
918
919@@ -120,5 +122,6 @@
920 resource_cache(),
921 effective_screencast,
922 connection_context,
923- cursor_images);
924+ cursor_images,
925+ translator);
926 }
927
928=== modified file 'src/server/frontend/default_ipc_factory.h'
929--- src/server/frontend/default_ipc_factory.h 2014-10-01 06:25:56 +0000
930+++ src/server/frontend/default_ipc_factory.h 2014-10-23 13:30:17 +0000
931@@ -33,6 +33,11 @@
932 class CursorImages;
933 }
934
935+namespace scene
936+{
937+class CoordinateTranslator;
938+}
939+
940 namespace frontend
941 {
942 class Shell;
943@@ -52,7 +57,8 @@
944 std::shared_ptr<graphics::GraphicBufferAllocator> const& buffer_allocator,
945 std::shared_ptr<Screencast> const& screencast,
946 std::shared_ptr<SessionAuthorizer> const& session_authorizer,
947- std::shared_ptr<input::CursorImages> const& cursor_images);
948+ std::shared_ptr<input::CursorImages> const& cursor_images,
949+ std::shared_ptr<scene::CoordinateTranslator> const& translator);
950
951 std::shared_ptr<detail::DisplayServer> make_ipc_server(
952 SessionCredentials const& creds,
953@@ -83,6 +89,7 @@
954 std::shared_ptr<Screencast> const screencast;
955 std::shared_ptr<SessionAuthorizer> const session_authorizer;
956 std::shared_ptr<input::CursorImages> const cursor_images;
957+ std::shared_ptr<scene::CoordinateTranslator> const translator;
958 };
959 }
960 }
961
962=== modified file 'src/server/frontend/protobuf_message_processor.cpp'
963--- src/server/frontend/protobuf_message_processor.cpp 2014-10-22 18:55:40 +0000
964+++ src/server/frontend/protobuf_message_processor.cpp 2014-10-23 13:30:17 +0000
965@@ -21,6 +21,7 @@
966 #include "mir/frontend/message_processor_report.h"
967 #include "mir/frontend/protobuf_message_sender.h"
968 #include "mir/frontend/template_protobuf_message_processor.h"
969+#include "mir/frontend/unsupported_feature_exception.h"
970
971 #include "mir_protobuf_wire.pb.h"
972
973@@ -104,6 +105,24 @@
974 self->send_response(invocation.id(), result_message);
975 }
976 }
977+
978+// A partial-specialisation to handle error cases.
979+template<class Self, class ServerX, class ParameterMessage, class ResultMessage>
980+void invoke(
981+ Self* self,
982+ std::string* error,
983+ void (ServerX::*/*function*/)(
984+ ::google::protobuf::RpcController* controller,
985+ const ParameterMessage* request,
986+ ResultMessage* response,
987+ ::google::protobuf::Closure* done),
988+ Invocation const& invocation)
989+{
990+ ResultMessage result_message;
991+ result_message.set_error(error->c_str());
992+ self->send_response(invocation.id(), &result_message);
993+}
994+
995 }
996 }
997 }
998@@ -206,6 +225,24 @@
999 invoke(this, display_server.get(), &DisplayServer::disconnect, invocation);
1000 result = false;
1001 }
1002+ else if ("translate_surface_to_screen" == invocation.method_name())
1003+ {
1004+ try
1005+ {
1006+ auto debug_interface = dynamic_cast<mir::protobuf::Debug*>(display_server.get());
1007+ invoke(this, debug_interface, &mir::protobuf::Debug::translate_surface_to_screen, invocation);
1008+ }
1009+ catch (mir::frontend::unsupported_feature const&)
1010+ {
1011+ std::string message{"Server does not support the client debugging interface"};
1012+ invoke(this,
1013+ &message,
1014+ &mir::protobuf::Debug::translate_surface_to_screen,
1015+ invocation);
1016+ std::runtime_error err{"Client attempted to use unavailable debug interface"};
1017+ report->exception_handled(display_server.get(), invocation.id(), err);
1018+ }
1019+ }
1020 else
1021 {
1022 report->unknown_method(display_server.get(), invocation.id(), invocation.method_name());
1023
1024=== modified file 'src/server/frontend/session_mediator.cpp'
1025--- src/server/frontend/session_mediator.cpp 2014-10-21 16:21:14 +0000
1026+++ src/server/frontend/session_mediator.cpp 2014-10-23 13:30:17 +0000
1027@@ -17,13 +17,13 @@
1028 */
1029
1030 #include "session_mediator.h"
1031-#include "client_buffer_tracker.h"
1032
1033 #include "mir/frontend/session_mediator_report.h"
1034 #include "mir/frontend/shell.h"
1035 #include "mir/frontend/session.h"
1036 #include "mir/frontend/surface.h"
1037 #include "mir/scene/surface_creation_parameters.h"
1038+#include "mir/scene/coordinate_translator.h"
1039 #include "mir/frontend/display_changer.h"
1040 #include "resource_cache.h"
1041 #include "mir_toolkit/common.h"
1042@@ -73,7 +73,8 @@
1043 std::shared_ptr<MessageResourceCache> const& resource_cache,
1044 std::shared_ptr<Screencast> const& screencast,
1045 ConnectionContext const& connection_context,
1046- std::shared_ptr<mi::CursorImages> const& cursor_images) :
1047+ std::shared_ptr<mi::CursorImages> const& cursor_images,
1048+ std::shared_ptr<scene::CoordinateTranslator> const& translator) :
1049 client_pid_(0),
1050 shell(shell),
1051 graphics_platform(graphics_platform),
1052@@ -86,6 +87,7 @@
1053 screencast(screencast),
1054 connection_context(connection_context),
1055 cursor_images(cursor_images),
1056+ translator{translator},
1057 surface_tracker{static_cast<size_t>(client_buffer_cache_size)}
1058 {
1059 }
1060@@ -551,6 +553,32 @@
1061 done->Run();
1062 }
1063
1064+void mir::frontend::SessionMediator::translate_surface_to_screen(
1065+ ::google::protobuf::RpcController* ,
1066+ ::mir::protobuf::CoordinateTranslationRequest const* request,
1067+ ::mir::protobuf::CoordinateTranslationResponse* response,
1068+ ::google::protobuf::Closure *done)
1069+{
1070+ {
1071+ std::unique_lock<std::mutex> lock(session_mutex);
1072+
1073+ auto session = weak_session.lock();
1074+
1075+ if (session.get() == nullptr)
1076+ BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session"));
1077+
1078+ auto const id = frontend::SurfaceId(request->surfaceid().value());
1079+
1080+ auto const coords = translator->surface_to_screen(session->get_surface(id),
1081+ request->x(),
1082+ request->y());
1083+
1084+ response->set_x(coords.x.as_uint32_t());
1085+ response->set_y(coords.y.as_uint32_t());
1086+ }
1087+ done->Run();
1088+}
1089+
1090 void mf::SessionMediator::drm_auth_magic(
1091 google::protobuf::RpcController* /*controller*/,
1092 const mir::protobuf::DRMMagic* request,
1093
1094=== modified file 'src/server/frontend/session_mediator.h'
1095--- src/server/frontend/session_mediator.h 2014-10-21 16:21:14 +0000
1096+++ src/server/frontend/session_mediator.h 2014-10-23 13:30:17 +0000
1097@@ -46,6 +46,11 @@
1098 class CursorImages;
1099 }
1100
1101+namespace scene
1102+{
1103+class CoordinateTranslator;
1104+}
1105+
1106 /// Frontend interface. Mediates the interaction between client
1107 /// processes and the core of the mir system.
1108 namespace frontend
1109@@ -62,7 +67,7 @@
1110 class PromptSession;
1111
1112 // SessionMediator relays requests from the client process into the server.
1113-class SessionMediator : public detail::DisplayServer
1114+class SessionMediator : public detail::DisplayServer, public mir::protobuf::Debug
1115 {
1116 public:
1117
1118@@ -76,7 +81,8 @@
1119 std::shared_ptr<MessageResourceCache> const& resource_cache,
1120 std::shared_ptr<Screencast> const& screencast,
1121 ConnectionContext const& connection_context,
1122- std::shared_ptr<input::CursorImages> const& cursor_images);
1123+ std::shared_ptr<input::CursorImages> const& cursor_images,
1124+ std::shared_ptr<scene::CoordinateTranslator> const& translator);
1125
1126 ~SessionMediator() noexcept;
1127
1128@@ -167,6 +173,13 @@
1129 ::mir::protobuf::SocketFD* response,
1130 ::google::protobuf::Closure* done) override;
1131
1132+ // TODO: Split this into a separate thing
1133+ void translate_surface_to_screen(
1134+ ::google::protobuf::RpcController* controller,
1135+ ::mir::protobuf::CoordinateTranslationRequest const* request,
1136+ ::mir::protobuf::CoordinateTranslationResponse* response,
1137+ ::google::protobuf::Closure *done) override;
1138+
1139 private:
1140 void pack_protobuf_buffer(protobuf::Buffer& protobuf_buffer,
1141 graphics::Buffer* graphics_buffer,
1142@@ -193,6 +206,7 @@
1143 std::shared_ptr<Screencast> const screencast;
1144 ConnectionContext const connection_context;
1145 std::shared_ptr<input::CursorImages> const cursor_images;
1146+ std::shared_ptr<scene::CoordinateTranslator> const translator;
1147
1148 SurfaceTracker surface_tracker;
1149
1150
1151=== added file 'src/server/frontend/unsupported_coordinate_translator.cpp'
1152--- src/server/frontend/unsupported_coordinate_translator.cpp 1970-01-01 00:00:00 +0000
1153+++ src/server/frontend/unsupported_coordinate_translator.cpp 2014-10-23 13:30:17 +0000
1154@@ -0,0 +1,32 @@
1155+/*
1156+ * Copyright © 2014 Canonical Ltd.
1157+ *
1158+ * This program is free software: you can redistribute it and/or modify it
1159+ * under the terms of the GNU General Public License version 3,
1160+ * as published by the Free Software Foundation.
1161+ *
1162+ * This program is distributed in the hope that it will be useful,
1163+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1164+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1165+ * GNU General Public License for more details.
1166+ *
1167+ * You should have received a copy of the GNU General Public License
1168+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1169+ *
1170+ * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1171+ */
1172+
1173+#include "unsupported_coordinate_translator.h"
1174+#include "mir/frontend/unsupported_feature_exception.h"
1175+
1176+#include <boost/exception/all.hpp>
1177+
1178+namespace mg = mir::geometry;
1179+namespace mf = mir::frontend;
1180+
1181+mg::Point mf::UnsupportedCoordinateTranslator::surface_to_screen(
1182+ std::shared_ptr<mf::Surface> /*surface*/,
1183+ int32_t /*x*/, int32_t /*y*/)
1184+{
1185+ BOOST_THROW_EXCEPTION(mir::frontend::unsupported_feature());
1186+}
1187
1188=== added file 'src/server/frontend/unsupported_coordinate_translator.h'
1189--- src/server/frontend/unsupported_coordinate_translator.h 1970-01-01 00:00:00 +0000
1190+++ src/server/frontend/unsupported_coordinate_translator.h 2014-10-23 13:30:17 +0000
1191@@ -0,0 +1,37 @@
1192+/*
1193+ * Copyright © 2014 Canonical Ltd.
1194+ *
1195+ * This program is free software: you can redistribute it and/or modify it
1196+ * under the terms of the GNU General Public License version 3,
1197+ * as published by the Free Software Foundation.
1198+ *
1199+ * This program is distributed in the hope that it will be useful,
1200+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1201+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1202+ * GNU General Public License for more details.
1203+ *
1204+ * You should have received a copy of the GNU General Public License
1205+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1206+ *
1207+ * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1208+ */
1209+
1210+#ifndef MIR_FRONTEND_UNSUPPORTED_COORDINATE_TRANSLATOR_H_
1211+#define MIR_FRONTEND_UNSUPPORTED_COORDINATE_TRANSLATOR_H_
1212+
1213+#include "mir/scene/coordinate_translator.h"
1214+
1215+namespace mir
1216+{
1217+namespace frontend
1218+{
1219+class UnsupportedCoordinateTranslator : public scene::CoordinateTranslator
1220+{
1221+ geometry::Point surface_to_screen(std::shared_ptr<Surface> surface,
1222+ int32_t x, int32_t y) override;
1223+};
1224+
1225+}
1226+}
1227+
1228+#endif // MIR_FRONTEND_UNSUPPORTED_COORDINATE_TRANSLATOR_H_
1229
1230=== modified file 'src/server/scene/CMakeLists.txt'
1231--- src/server/scene/CMakeLists.txt 2014-10-01 06:25:56 +0000
1232+++ src/server/scene/CMakeLists.txt 2014-10-23 13:30:17 +0000
1233@@ -23,4 +23,5 @@
1234 prompt_session_container.cpp
1235 prompt_session_manager_impl.cpp
1236 rendering_tracker.cpp
1237+ default_coordinate_translator.cpp
1238 )
1239
1240=== modified file 'src/server/scene/default_configuration.cpp'
1241--- src/server/scene/default_configuration.cpp 2014-10-01 06:25:56 +0000
1242+++ src/server/scene/default_configuration.cpp 2014-10-23 13:30:17 +0000
1243@@ -36,6 +36,7 @@
1244 #include "surface_stack.h"
1245 #include "threaded_snapshot_strategy.h"
1246 #include "prompt_session_manager_impl.h"
1247+#include "default_coordinate_translator.h"
1248
1249 namespace mc = mir::compositor;
1250 namespace mf = mir::frontend;
1251@@ -238,3 +239,13 @@
1252 the_prompt_session_listener());
1253 });
1254 }
1255+
1256+std::shared_ptr<ms::CoordinateTranslator>
1257+mir::DefaultServerConfiguration::the_coordinate_translator()
1258+{
1259+ return coordinate_translator(
1260+ [this]()
1261+ {
1262+ return std::make_shared<ms::DefaultCoordinateTranslator>();
1263+ });
1264+}
1265
1266=== added file 'src/server/scene/default_coordinate_translator.cpp'
1267--- src/server/scene/default_coordinate_translator.cpp 1970-01-01 00:00:00 +0000
1268+++ src/server/scene/default_coordinate_translator.cpp 2014-10-23 13:30:17 +0000
1269@@ -0,0 +1,32 @@
1270+/*
1271+ * Copyright © 2014 Canonical Ltd.
1272+ *
1273+ * This program is free software: you can redistribute it and/or modify it
1274+ * under the terms of the GNU General Public License version 3,
1275+ * as published by the Free Software Foundation.
1276+ *
1277+ * This program is distributed in the hope that it will be useful,
1278+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1279+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1280+ * GNU General Public License for more details.
1281+ *
1282+ * You should have received a copy of the GNU General Public License
1283+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1284+ *
1285+ * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1286+ */
1287+
1288+#include "default_coordinate_translator.h"
1289+#include "basic_surface.h"
1290+
1291+namespace geom = mir::geometry;
1292+namespace mf = mir::frontend;
1293+namespace ms = mir::scene;
1294+
1295+geom::Point ms::DefaultCoordinateTranslator::surface_to_screen(std::shared_ptr<mf::Surface> surface, int32_t x,
1296+ int32_t y)
1297+{
1298+ auto const scene_surface = std::dynamic_pointer_cast<ms::BasicSurface>(surface);
1299+
1300+ return geom::Point{x + scene_surface->top_left().x.as_int(), y + scene_surface->top_left().y.as_int()};
1301+}
1302
1303=== added file 'src/server/scene/default_coordinate_translator.h'
1304--- src/server/scene/default_coordinate_translator.h 1970-01-01 00:00:00 +0000
1305+++ src/server/scene/default_coordinate_translator.h 2014-10-23 13:30:17 +0000
1306@@ -0,0 +1,37 @@
1307+/*
1308+ * Copyright © 2014 Canonical Ltd.
1309+ *
1310+ * This program is free software: you can redistribute it and/or modify it
1311+ * under the terms of the GNU General Public License version 3,
1312+ * as published by the Free Software Foundation.
1313+ *
1314+ * This program is distributed in the hope that it will be useful,
1315+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1316+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1317+ * GNU General Public License for more details.
1318+ *
1319+ * You should have received a copy of the GNU General Public License
1320+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1321+ *
1322+ * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1323+ */
1324+
1325+#ifndef MIR_FRONTEND_DEFAULT_COORDINATE_TRANSLATOR_H_
1326+#define MIR_FRONTEND_DEFAULT_COORDINATE_TRANSLATOR_H_
1327+
1328+#include "mir/scene/coordinate_translator.h"
1329+
1330+namespace mir
1331+{
1332+namespace scene
1333+{
1334+class DefaultCoordinateTranslator : public CoordinateTranslator
1335+{
1336+public:
1337+ geometry::Point surface_to_screen(std::shared_ptr<frontend::Surface> surface, int32_t x, int32_t y);
1338+};
1339+
1340+}
1341+}
1342+
1343+#endif // MIR_FRONTEND_DEFAULT_COORDINATE_TRANSLATOR_H_
1344
1345=== modified file 'src/server/symbols.map'
1346--- src/server/symbols.map 2014-10-22 18:55:40 +0000
1347+++ src/server/symbols.map 2014-10-23 13:30:17 +0000
1348@@ -39,6 +39,7 @@
1349 mir::DefaultServerConfiguration::the_connection_creator*;
1350 mir::DefaultServerConfiguration::the_connector*;
1351 mir::DefaultServerConfiguration::the_connector_report*;
1352+ mir::DefaultServerConfiguration::the_coordinate_translator*;
1353 mir::DefaultServerConfiguration::the_cursor*;
1354 mir::DefaultServerConfiguration::the_cursor_images*;
1355 mir::DefaultServerConfiguration::the_cursor_listener*;
1356@@ -244,6 +245,9 @@
1357 mir::report_exception*;
1358 mir::run_mir*;
1359 mir::scene::a_surface*;
1360+ mir::scene::CoordinateTranslator::?CoordinateTranslator*;
1361+ mir::scene::CoordinateTranslator::CoordinateTranslator*;
1362+ mir::scene::CoordinateTranslator::surface_to_screen*;
1363 mir::scene::NullSurfaceObserver::alpha_set_to*;
1364 mir::scene::NullSurfaceObserver::attrib_changed*;
1365 mir::scene::NullSurfaceObserver::cursor_image_set_to*;
1366@@ -648,6 +652,7 @@
1367 typeinfo?for?mir::input::TouchVisualizer;
1368 typeinfo?for?mir::input::TouchVisualizer::Spot;
1369 typeinfo?for?mir::MainLoop;
1370+ typeinfo?for?mir::scene::CoordinateTranslator;
1371 typeinfo?for?mir::scene::NullSurfaceObserver;
1372 typeinfo?for?mir::scene::Observer;
1373 typeinfo?for?mir::scene::PlacementStrategy;
1374@@ -706,6 +711,7 @@
1375 vtable?for?mir::input::TouchVisualizer;
1376 vtable?for?mir::input::TouchVisualizer::Spot;
1377 vtable?for?mir::MainLoop;
1378+ vtable?for?mir::scene::CoordinateTranslator;
1379 vtable?for?mir::scene::NullSurfaceObserver;
1380 vtable?for?mir::scene::Observer;
1381 vtable?for?mir::scene::PlacementStrategy;
1382
1383=== modified file 'tests/acceptance-tests/CMakeLists.txt'
1384--- tests/acceptance-tests/CMakeLists.txt 2014-10-21 16:21:14 +0000
1385+++ tests/acceptance-tests/CMakeLists.txt 2014-10-23 13:30:17 +0000
1386@@ -42,6 +42,7 @@
1387 test_server_without_active_outputs.cpp
1388 test_client_input.cpp
1389 test_server_startup.cpp
1390+ test_debug_api.cpp
1391 test_unresponsive_client.cpp
1392 )
1393
1394@@ -67,6 +68,7 @@
1395
1396 mirserver
1397 mirclient
1398+ mirclient-debug-extension
1399 mirplatform
1400
1401 mir-test
1402
1403=== modified file 'tests/acceptance-tests/test_client_library.cpp'
1404--- tests/acceptance-tests/test_client_library.cpp 2014-10-21 16:21:14 +0000
1405+++ tests/acceptance-tests/test_client_library.cpp 2014-10-23 13:30:17 +0000
1406@@ -17,7 +17,6 @@
1407 */
1408
1409 #include "mir_toolkit/mir_client_library.h"
1410-#include "mir_toolkit/mir_client_library_debug.h"
1411
1412 #include "mir_test_framework/stubbed_server_configuration.h"
1413 #include "mir_test_framework/in_process_server.h"
1414
1415=== modified file 'tests/acceptance-tests/test_client_surface_events.cpp'
1416--- tests/acceptance-tests/test_client_surface_events.cpp 2014-10-01 06:25:56 +0000
1417+++ tests/acceptance-tests/test_client_surface_events.cpp 2014-10-23 13:30:17 +0000
1418@@ -17,7 +17,7 @@
1419 */
1420
1421 #include "mir_toolkit/mir_client_library.h"
1422-#include "mir_toolkit/mir_client_library_debug.h"
1423+#include "mir_toolkit/debug/surface.h"
1424
1425 #include "mir/shell/surface_coordinator_wrapper.h"
1426
1427
1428=== modified file 'tests/acceptance-tests/test_client_surfaces.cpp'
1429--- tests/acceptance-tests/test_client_surfaces.cpp 2014-10-01 06:25:56 +0000
1430+++ tests/acceptance-tests/test_client_surfaces.cpp 2014-10-23 13:30:17 +0000
1431@@ -17,7 +17,7 @@
1432 */
1433
1434 #include "mir_toolkit/mir_client_library.h"
1435-#include "mir_toolkit/mir_client_library_debug.h"
1436+#include "mir_toolkit/debug/surface.h"
1437
1438 #include "mir_test_framework/stubbed_server_configuration.h"
1439 #include "mir_test_framework/basic_client_server_fixture.h"
1440
1441=== modified file 'tests/acceptance-tests/test_custom_input_dispatcher.cpp'
1442--- tests/acceptance-tests/test_custom_input_dispatcher.cpp 2014-10-01 06:25:56 +0000
1443+++ tests/acceptance-tests/test_custom_input_dispatcher.cpp 2014-10-23 13:30:17 +0000
1444@@ -133,7 +133,7 @@
1445 // may be stopped before events have been dispatched.
1446 run_in_test_process([&]
1447 {
1448- server_config.dispatching_done.wait_for_signal_ready_for(std::chrono::seconds{5});
1449+ server_config.dispatching_done.wait_for_signal_ready_for(std::chrono::seconds{50});
1450 });
1451 }
1452
1453@@ -179,6 +179,6 @@
1454 launch_client_process(client);
1455 run_in_test_process([&]
1456 {
1457- server_config.dispatching_done.wait_for_signal_ready_for(std::chrono::seconds{5});
1458+ server_config.dispatching_done.wait_for_signal_ready_for(std::chrono::seconds{50});
1459 });
1460 }
1461
1462=== added file 'tests/acceptance-tests/test_debug_api.cpp'
1463--- tests/acceptance-tests/test_debug_api.cpp 1970-01-01 00:00:00 +0000
1464+++ tests/acceptance-tests/test_debug_api.cpp 2014-10-23 13:30:17 +0000
1465@@ -0,0 +1,231 @@
1466+/*
1467+ * Copyright © 2014 Canonical Ltd.
1468+ *
1469+ * This program is free software: you can redistribute it and/or modify
1470+ * it under the terms of the GNU General Public License version 3 as
1471+ * published by the Free Software Foundation.
1472+ *
1473+ * This program is distributed in the hope that it will be useful,
1474+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1475+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1476+ * GNU General Public License for more details.
1477+ *
1478+ * You should have received a copy of the GNU General Public License
1479+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1480+ *
1481+ * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1482+ */
1483+
1484+#include "mir/options/option.h"
1485+#include "mir/scene/surface_creation_parameters.h"
1486+#include "mir/scene/placement_strategy.h"
1487+#include "mir/scene/surface.h"
1488+#include "src/server/scene/session_container.h"
1489+#include "mir/shell/surface_coordinator_wrapper.h"
1490+
1491+#include "mir_test/wait_condition.h"
1492+#include "mir_test/client_event_matchers.h"
1493+#include "mir_test/barrier.h"
1494+#include "mir_test_framework/deferred_in_process_server.h"
1495+#include "mir_test_framework/stubbed_server_configuration.h"
1496+
1497+#include "mir_toolkit/mir_client_library.h"
1498+#include "mir_toolkit/debug/surface.h"
1499+
1500+#include <gtest/gtest.h>
1501+#include <gmock/gmock.h>
1502+
1503+namespace ms = mir::scene;
1504+
1505+namespace mtf = mir_test_framework;
1506+
1507+namespace
1508+{
1509+class SimpleConfigurablePlacementStrategy : public ms::PlacementStrategy
1510+{
1511+public:
1512+ ms::SurfaceCreationParameters place(ms::Session const& /*session*/,
1513+ ms::SurfaceCreationParameters const& request_parameters) override
1514+ {
1515+ auto placed = request_parameters;
1516+ placed.top_left = placement.top_left;
1517+ placed.size = placement.size;
1518+ return placed;
1519+ }
1520+
1521+ mir::geometry::Rectangle placement;
1522+};
1523+
1524+class SurfacePlacingConfiguration : public mtf::StubbedServerConfiguration
1525+{
1526+public:
1527+ SurfacePlacingConfiguration()
1528+ : placement_strategy{std::make_shared<SimpleConfigurablePlacementStrategy>()}
1529+ {
1530+ }
1531+
1532+ std::shared_ptr<ms::PlacementStrategy> the_placement_strategy() override
1533+ {
1534+ return placement_strategy;
1535+ }
1536+
1537+ void set_surface_placement(mir::geometry::Rectangle const& where)
1538+ {
1539+ placement_strategy->placement = where;
1540+ }
1541+
1542+ bool is_debug_server()
1543+ {
1544+ return the_options()->is_set("debug");
1545+ }
1546+
1547+private:
1548+ std::shared_ptr<SimpleConfigurablePlacementStrategy> placement_strategy;
1549+};
1550+
1551+char const* debugenv = "MIR_SERVER_DEBUG";
1552+
1553+void dont_kill_me_bro(MirConnection* /*unused*/, MirLifecycleState /*unused*/, void* /*unused*/)
1554+{
1555+}
1556+
1557+class TestDebugAPI : public mtf::DeferredInProcessServer
1558+{
1559+public:
1560+ TestDebugAPI()
1561+ : old_debug_env{::getenv(debugenv)}
1562+ {
1563+ mir::geometry::Rectangle surface_location;
1564+ surface_location.top_left.x = mir::geometry::X{0};
1565+ surface_location.top_left.y = mir::geometry::Y{0};
1566+ surface_location.size.width = mir::geometry::Width{100};
1567+ surface_location.size.height = mir::geometry::Height{100};
1568+
1569+ server_configuration.set_surface_placement(surface_location);
1570+ }
1571+
1572+ ~TestDebugAPI()
1573+ {
1574+ ::unsetenv(debugenv);
1575+ if (old_debug_env)
1576+ {
1577+ ::setenv(debugenv, old_debug_env, 1);
1578+ }
1579+ }
1580+
1581+ void start_server_with_debug(bool debug)
1582+ {
1583+ if (debug)
1584+ {
1585+ ::setenv(debugenv, "", 1);
1586+ }
1587+ else
1588+ {
1589+ ::unsetenv(debugenv);
1590+ }
1591+
1592+ if (server_configuration.is_debug_server() != debug)
1593+ {
1594+ throw std::runtime_error{"Failed to set the debug flag correctly. Have you overriden this with --debug?"};
1595+ }
1596+
1597+ start_server();
1598+ connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
1599+ if (!mir_connection_is_valid(connection))
1600+ {
1601+ throw std::runtime_error{std::string{"Failed to connect to test server:"} +
1602+ mir_connection_get_error_message(connection)};
1603+ }
1604+ mir_connection_set_lifecycle_event_callback(connection, dont_kill_me_bro, nullptr);
1605+ }
1606+
1607+ void TearDown() override
1608+ {
1609+ if (connection)
1610+ {
1611+ mir_connection_release(connection);
1612+ }
1613+ DeferredInProcessServer::TearDown();
1614+ }
1615+
1616+ mir::DefaultServerConfiguration& server_config() override
1617+ {
1618+ return server_configuration;
1619+ }
1620+
1621+ SurfacePlacingConfiguration server_configuration;
1622+ MirConnection* connection{nullptr};
1623+
1624+private:
1625+ char const* old_debug_env;
1626+};
1627+}
1628+
1629+TEST_F(TestDebugAPI, TranslatesSurfaceCoordinatesToScreenCoordinates)
1630+{
1631+ start_server_with_debug(true);
1632+
1633+ mir::geometry::Rectangle surface_location;
1634+ surface_location.top_left.x = mir::geometry::X{200};
1635+ surface_location.top_left.y = mir::geometry::Y{100};
1636+ surface_location.size.width = mir::geometry::Width{800};
1637+ surface_location.size.height = mir::geometry::Height{600};
1638+
1639+ server_configuration.set_surface_placement(surface_location);
1640+
1641+ ASSERT_TRUE(mir_connection_is_valid(connection));
1642+
1643+ MirSurfaceParameters const creation_parameters = {
1644+ __PRETTY_FUNCTION__,
1645+ 800, 600,
1646+ mir_pixel_format_argb_8888,
1647+ mir_buffer_usage_hardware,
1648+ mir_display_output_id_invalid
1649+ };
1650+ auto surf = mir_connection_create_surface_sync(connection, &creation_parameters);
1651+ ASSERT_TRUE(mir_surface_is_valid(surf));
1652+
1653+ int screen_x, screen_y, x, y;
1654+ x = 35, y = 21;
1655+
1656+ ASSERT_TRUE(mir_debug_surface_coords_to_screen(surf, x, y, &screen_x, &screen_y));
1657+ EXPECT_EQ(x + surface_location.top_left.x.as_int(), screen_x);
1658+ EXPECT_EQ(y + surface_location.top_left.y.as_int(), screen_y);
1659+
1660+ mir_surface_release_sync(surf);
1661+
1662+ surface_location.top_left.x = mir::geometry::X{100};
1663+ surface_location.top_left.y = mir::geometry::Y{250};
1664+
1665+ server_configuration.set_surface_placement(surface_location);
1666+
1667+ surf = mir_connection_create_surface_sync(connection, &creation_parameters);
1668+ ASSERT_TRUE(mir_surface_is_valid(surf));
1669+
1670+ ASSERT_TRUE(mir_debug_surface_coords_to_screen(surf, x, y, &screen_x, &screen_y));
1671+ EXPECT_EQ(x + surface_location.top_left.x.as_int(), screen_x);
1672+ EXPECT_EQ(y + surface_location.top_left.y.as_int(), screen_y);
1673+
1674+ mir_surface_release_sync(surf);
1675+}
1676+
1677+TEST_F(TestDebugAPI, ApiIsUnavaliableWhenServerNotStartedWithDebug)
1678+{
1679+ start_server_with_debug(false);
1680+
1681+ MirSurfaceParameters const creation_parameters = {
1682+ __PRETTY_FUNCTION__,
1683+ 800, 600,
1684+ mir_pixel_format_argb_8888,
1685+ mir_buffer_usage_hardware,
1686+ mir_display_output_id_invalid
1687+ };
1688+ auto surf = mir_connection_create_surface_sync(connection, &creation_parameters);
1689+ ASSERT_TRUE(mir_surface_is_valid(surf));
1690+
1691+ int screen_x, screen_y;
1692+
1693+ EXPECT_FALSE(mir_debug_surface_coords_to_screen(surf, 0, 0, &screen_x, &screen_y));
1694+
1695+ mir_surface_release_sync(surf);
1696+}
1697
1698=== added file 'tests/include/mir_test_doubles/mock_coordinate_translator.h'
1699--- tests/include/mir_test_doubles/mock_coordinate_translator.h 1970-01-01 00:00:00 +0000
1700+++ tests/include/mir_test_doubles/mock_coordinate_translator.h 2014-10-23 13:30:17 +0000
1701@@ -0,0 +1,42 @@
1702+/*
1703+ * Copyright © 2014 Canonical Ltd.
1704+ *
1705+ * This program is free software: you can redistribute it and/or modify it
1706+ * under the terms of the GNU General Public License version 3,
1707+ * as published by the Free Software Foundation.
1708+ *
1709+ * This program is distributed in the hope that it will be useful,
1710+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1711+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1712+ * GNU General Public License for more details.
1713+ *
1714+ * You should have received a copy of the GNU General Public License
1715+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1716+ *
1717+ * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1718+ */
1719+
1720+#ifndef MIR_TEST_DOUBLES_MOCK_COORDINATE_TRANSLATOR_H_
1721+#define MIR_TEST_DOUBLES_MOCK_COORDINATE_TRANSLATOR_H_
1722+
1723+#include "src/server/frontend/coordinate_translator.h"
1724+
1725+#include <gmock/gmock.h>
1726+
1727+namespace mir
1728+{
1729+namespace test
1730+{
1731+namespace doubles
1732+{
1733+class MockCoordinateTranslator : public mir::frontend::CoordinateTranslator
1734+{
1735+ MOCK_METHOD3(surface_to_screen, geometry::Point(std::shared_ptr<frontend::Surface>, uint32_t, uint32_t));
1736+};
1737+
1738+using StubCoordinateTranslator = testing::NiceMock<MockCoordinateTranslator>;
1739+}
1740+}
1741+}
1742+
1743+#endif /* MIR_TEST_DOUBLES_MOCK_COORDINATE_TRANSLATOR_H_ */
1744
1745=== modified file 'tests/include/mir_test_doubles/mock_surface.h'
1746--- tests/include/mir_test_doubles/mock_surface.h 2014-10-01 06:25:56 +0000
1747+++ tests/include/mir_test_doubles/mock_surface.h 2014-10-23 13:30:17 +0000
1748@@ -21,6 +21,7 @@
1749
1750 #include "src/server/scene/basic_surface.h"
1751 #include "src/server/report/null_report_factory.h"
1752+#include "mock_buffer_stream.h"
1753
1754 #include <gmock/gmock.h>
1755
1756@@ -38,7 +39,7 @@
1757 {},
1758 {{},{}},
1759 true,
1760- {},
1761+ std::make_shared<testing::NiceMock<MockBufferStream>>(),
1762 {},
1763 {},
1764 {},
1765
1766=== modified file 'tests/integration-tests/CMakeLists.txt'
1767--- tests/integration-tests/CMakeLists.txt 2014-10-21 16:21:14 +0000
1768+++ tests/integration-tests/CMakeLists.txt 2014-10-23 13:30:17 +0000
1769@@ -82,6 +82,7 @@
1770 mir-test
1771 mir-test-framework
1772 mir-test-doubles
1773+ mirclient-debug-extension
1774
1775 mirdraw
1776 mirtestdraw
1777
1778=== modified file 'tests/integration-tests/test_stale_frames.cpp'
1779--- tests/integration-tests/test_stale_frames.cpp 2014-10-21 16:21:14 +0000
1780+++ tests/integration-tests/test_stale_frames.cpp 2014-10-23 13:30:17 +0000
1781@@ -17,7 +17,7 @@
1782 */
1783
1784 #include "mir_toolkit/mir_client_library.h"
1785-#include "mir_toolkit/mir_client_library_debug.h"
1786+#include "mir_toolkit/debug/surface.h"
1787
1788 #include "mir/compositor/compositor.h"
1789 #include "mir/compositor/renderer_factory.h"
1790
1791=== modified file 'tests/unit-tests/frontend/test_session_mediator.cpp'
1792--- tests/unit-tests/frontend/test_session_mediator.cpp 2014-10-21 16:21:14 +0000
1793+++ tests/unit-tests/frontend/test_session_mediator.cpp 2014-10-23 13:30:17 +0000
1794@@ -259,7 +259,7 @@
1795 shell, graphics_platform, graphics_changer,
1796 surface_pixel_formats, report,
1797 std::make_shared<mtd::NullEventSink>(),
1798- resource_cache, stub_screencast, &connector, nullptr}
1799+ resource_cache, stub_screencast, &connector, nullptr, nullptr}
1800 {
1801 using namespace ::testing;
1802
1803@@ -316,7 +316,7 @@
1804 shell, graphics_platform, graphics_changer,
1805 surface_pixel_formats, report,
1806 std::make_shared<mtd::NullEventSink>(),
1807- resource_cache, stub_screencast, context, nullptr};
1808+ resource_cache, stub_screencast, context, nullptr, nullptr};
1809
1810 EXPECT_THAT(connects_handled_count, Eq(0));
1811
1812@@ -421,7 +421,7 @@
1813 surface_pixel_formats, report,
1814 std::make_shared<mtd::NullEventSink>(),
1815 resource_cache, std::make_shared<mtd::NullScreencast>(),
1816- nullptr, nullptr);
1817+ nullptr, nullptr, nullptr);
1818 mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get());
1819
1820 EXPECT_THAT(connection.display_configuration(), mt::DisplayConfigMatches(std::cref(config)));
1821@@ -629,7 +629,7 @@
1822 surface_pixel_formats, report,
1823 std::make_shared<mtd::NullEventSink>(), resource_cache,
1824 std::make_shared<mtd::NullScreencast>(),
1825- nullptr, nullptr};
1826+ nullptr, nullptr, nullptr};
1827
1828 mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get());
1829
1830@@ -876,7 +876,7 @@
1831 shell, graphics_platform, graphics_changer,
1832 surface_pixel_formats, report,
1833 std::make_shared<mtd::NullEventSink>(),
1834- mt::fake_shared(mock_cache), stub_screencast, nullptr, nullptr};
1835+ mt::fake_shared(mock_cache), stub_screencast, &connector, nullptr, nullptr};
1836
1837 mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get());
1838 mediator.create_surface(nullptr, &surface_parameters, &surface_response, null_callback.get());
1839
1840=== modified file 'tests/unit-tests/frontend/test_session_mediator_android.cpp'
1841--- tests/unit-tests/frontend/test_session_mediator_android.cpp 2014-10-01 06:25:56 +0000
1842+++ tests/unit-tests/frontend/test_session_mediator_android.cpp 2014-10-23 13:30:17 +0000
1843@@ -61,7 +61,7 @@
1844 mediator{shell, graphics_platform, display_changer,
1845 surface_pixel_formats, report,
1846 std::make_shared<mtd::NullEventSink>(),
1847- resource_cache, std::make_shared<mtd::NullScreencast>(), nullptr, nullptr},
1848+ resource_cache, std::make_shared<mtd::NullScreencast>(), nullptr, nullptr, nullptr},
1849 null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}
1850 {
1851 }
1852
1853=== modified file 'tests/unit-tests/frontend/test_session_mediator_mesa.cpp'
1854--- tests/unit-tests/frontend/test_session_mediator_mesa.cpp 2014-10-21 16:21:14 +0000
1855+++ tests/unit-tests/frontend/test_session_mediator_mesa.cpp 2014-10-23 13:30:17 +0000
1856@@ -74,7 +74,8 @@
1857 mediator{shell, mock_platform, display_changer,
1858 surface_pixel_formats, report,
1859 std::make_shared<mtd::NullEventSink>(),
1860- resource_cache, std::make_shared<mtd::NullScreencast>(), nullptr, nullptr},
1861+ resource_cache, std::make_shared<mtd::NullScreencast>(), nullptr, nullptr,
1862+ nullptr},
1863 null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}
1864 {
1865 }

Subscribers

People subscribed via source and target branches