Merge lp:~alan-griffiths/miral/1.2 into lp:miral/release
- 1.2
- Merge into release
Proposed by
Alan Griffiths
Status: | Merged |
---|---|
Approved by: | Alan Griffiths |
Approved revision: | 355 |
Merged at revision: | 353 |
Proposed branch: | lp:~alan-griffiths/miral/1.2 |
Merge into: | lp:miral/release |
Diff against target: |
2893 lines (+892/-529) 60 files modified
.bzrignore (+1/-1) CMakeLists.txt (+1/-1) README.md (+2/-2) debian/changelog (+24/-0) debian/control (+14/-0) debian/libmiral-dev.install (+1/-1) debian/libmiral2.symbols (+9/-1) debian/libmirclientcpp-dev.install (+2/-0) doc/Doxyfile.in (+1/-13) doc/mainpage.md (+1/-1) getting_and_using_miral.md (+141/-93) include/mir/client/connection.h (+6/-6) include/mir/client/detail/mir_forward_compatibility.h (+2/-2) include/mir/client/window.h (+12/-7) include/mir/client/window_id.h (+30/-20) include/mir/client/window_spec.h (+132/-87) include/miral/application_authorizer.h (+15/-0) include/miral/internal_client.h (+4/-4) include/miral/keymap.h (+2/-1) include/miral/window_info.h (+3/-0) include/miral/window_management_policy.h (+3/-3) include/miral/window_manager_tools.h (+4/-1) include/miral/window_specification.h (+1/-1) miral-kiosk/kiosk_main.cpp (+2/-0) miral-kiosk/sw_splash.cpp (+8/-36) miral-shell/miral-app.sh (+6/-4) miral-shell/miral-desktop.sh (+5/-3) miral-shell/spinner/miregl.cpp (+24/-57) miral-shell/spinner/miregl.h (+1/-1) miral-shell/titlebar_provider.cpp (+5/-5) miral-shell/titlebar_provider.h (+3/-3) miral/CMakeLists.txt (+15/-10) miral/application_authorizer.cpp (+17/-1) miral/basic_window_manager.cpp (+6/-0) miral/basic_window_manager.h (+2/-0) miral/both_versions.h (+10/-20) miral/internal_client.cpp (+22/-7) miral/miral.pc.in (+1/-1) miral/mirclientcpp.pc.in (+7/-0) miral/mru_window_list.cpp (+5/-5) miral/mru_window_list.h (+1/-1) miral/symbols.map (+20/-2) miral/window_info.cpp (+27/-14) miral/window_management_policy.cpp (+2/-2) miral/window_management_trace.cpp (+11/-0) miral/window_management_trace.h (+2/-0) miral/window_manager_tools.cpp (+3/-0) miral/window_manager_tools_implementation.h (+1/-0) scripts/process_doxygen_xml.py (+20/-4) tasks_for_the_interested_reader.md (+1/-17) test/CMakeLists.txt (+2/-1) test/active_window.cpp (+45/-19) test/drag_active_window.cpp (+38/-24) test/test_server.cpp (+2/-2) test/test_server.h (+2/-2) test/test_window_manager_tools.h (+1/-1) test/window_id.cpp (+26/-26) test/window_placement.cpp (+1/-1) test/window_placement_client_api.cpp (+9/-15) test/window_properties.cpp (+128/-0) |
To merge this branch: | bzr merge lp:~alan-griffiths/miral/1.2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cemil Azizoglu (community) | Approve | ||
Review via email: mp+317308@code.launchpad.net |
Commit message
Miral Release 1.2
Description of the change
To post a comment you must log in.
lp:~alan-griffiths/miral/1.2
updated
- 355. By Alan Griffiths
-
Track cherry-picks for Mir 0.26.1
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2016-10-25 15:07:46 +0000 |
3 | +++ .bzrignore 2017-02-15 14:04:27 +0000 |
4 | @@ -1,3 +1,3 @@ |
5 | -include/miral/detail/mir_features.h |
6 | +include/mir/client/detail/mir_features.h |
7 | include/miral/version.h |
8 | .idea |
9 | |
10 | === modified file 'CMakeLists.txt' |
11 | --- CMakeLists.txt 2017-01-20 11:35:32 +0000 |
12 | +++ CMakeLists.txt 2017-02-15 14:04:27 +0000 |
13 | @@ -41,7 +41,7 @@ |
14 | include_directories(include SYSTEM ${MIRCLIENT_INCLUDE_DIRS}) |
15 | |
16 | set(MIRAL_VERSION_MAJOR 1) |
17 | -set(MIRAL_VERSION_MINOR 1) |
18 | +set(MIRAL_VERSION_MINOR 2) |
19 | set(MIRAL_VERSION_PATCH 0) |
20 | |
21 | set(MIRAL_VERSION ${MIRAL_VERSION_MAJOR}.${MIRAL_VERSION_MINOR}.${MIRAL_VERSION_PATCH}) |
22 | |
23 | === modified file 'README.md' |
24 | --- README.md 2016-04-11 10:27:12 +0000 |
25 | +++ README.md 2017-02-15 14:04:27 +0000 |
26 | @@ -25,7 +25,7 @@ |
27 | |
28 | See also: |
29 | |
30 | - - \ref building_and_using_miral "Building and using Miral" |
31 | + - \ref getting_and_using_miral "Getting and using Miral" |
32 | - \ref tasks_for_the_interested_reader "Tasks for the interested reader" |
33 | |
34 | License |
35 | @@ -42,5 +42,5 @@ |
36 | You should have received a copy of the GNU General Public License |
37 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
38 | |
39 | -\copyright Copyright © 2016 Canonical Ltd. |
40 | +\copyright Copyright © 2016-2017 Canonical Ltd. |
41 | \author Alan Griffiths <alan@octopull.co.uk> |
42 | |
43 | === modified file 'debian/changelog' |
44 | --- debian/changelog 2017-01-27 03:02:28 +0000 |
45 | +++ debian/changelog 2017-02-15 14:04:27 +0000 |
46 | @@ -1,3 +1,27 @@ |
47 | +miral (1.2.0) UNRELEASED; urgency=medium |
48 | + |
49 | + * New upstream release 1.2.0 (https://launchpad.net/miral/+milestone/1.2) |
50 | + |
51 | + - ABI summary: |
52 | + . miral ABI unchanged at 2 |
53 | + - Enhancements: |
54 | + . New libmirclientcpp-dev package "C++ wrapper for libmirclient". (Split |
55 | + from libmiral-dev) |
56 | + . Give miral-app and miral-desktop a good default for -bindir |
57 | + . More surface to window renaming to reflect Mir name changes |
58 | + . Refresh the "Building and Using MirAL" doc |
59 | + - Bugs fixed: |
60 | + . Chrome-less shell hint does not work any more (LP: #1658117) |
61 | + . WindowSpec::set_state() wrapper for mir_window_spec_set_state() |
62 | + (LP: #1661256) |
63 | + . "$ miral-app -kiosk" fails with "Unknown command line options: |
64 | + --desktop_file_hint=miral-shell.desktop" (LP: #1660933) |
65 | + . libmiral] Fix focus and movement rules for Input Method and Satellite |
66 | + windows. (LP: #1660691) |
67 | + |
68 | + |
69 | + -- Alan Griffiths <alan.griffiths@canonical.com> Thu, 02 Feb 2017 17:26:54 +0000 |
70 | + |
71 | miral (1.1.0+17.04.20170127-0ubuntu1) zesty; urgency=medium |
72 | |
73 | [ Alan Griffiths ] |
74 | |
75 | === modified file 'debian/control' |
76 | --- debian/control 2017-01-23 12:39:03 +0000 |
77 | +++ debian/control 2017-02-15 14:04:27 +0000 |
78 | @@ -51,6 +51,7 @@ |
79 | Multi-Arch: same |
80 | Pre-Depends: ${misc:Pre-Depends} |
81 | Depends: libmiral2 (= ${binary:Version}), |
82 | + libmirclientcpp-dev (= ${binary:Version}), |
83 | ${misc:Depends}, |
84 | Description: Developer files for the Mir ABI-stable abstraction layer |
85 | MirAL provides an ABI-stable abstraction layer for Mir based shells, |
86 | @@ -59,6 +60,19 @@ |
87 | Contains header files required for development using the MirAL abstraction |
88 | layer. |
89 | |
90 | +Package: libmirclientcpp-dev |
91 | +Section: libdevel |
92 | +Architecture: linux-any |
93 | +Multi-Arch: same |
94 | +Pre-Depends: ${misc:Pre-Depends} |
95 | +Depends: libmirclient-dev, |
96 | +Description: Developer files for the Mir ABI-stable abstraction layer |
97 | + MirAL provides an ABI-stable abstraction layer for Mir based shells, |
98 | + insulating them from mirserver ABI breaks. |
99 | + . |
100 | + Contains header files required for development using the MirAL abstraction |
101 | + layer. |
102 | + |
103 | Package: miral-examples |
104 | Architecture: linux-any |
105 | Depends: ${misc:Depends}, |
106 | |
107 | === modified file 'debian/libmiral-dev.install' |
108 | --- debian/libmiral-dev.install 2016-08-08 13:20:28 +0000 |
109 | +++ debian/libmiral-dev.install 2017-02-15 14:04:27 +0000 |
110 | @@ -1,3 +1,3 @@ |
111 | -usr/include/miral |
112 | +usr/include/miral/miral/* |
113 | usr/lib/*/pkgconfig/miral.pc |
114 | usr/lib/*/libmiral.so |
115 | |
116 | === modified file 'debian/libmiral2.symbols' |
117 | --- debian/libmiral2.symbols 2017-01-26 11:30:51 +0000 |
118 | +++ debian/libmiral2.symbols 2017-02-15 14:04:27 +0000 |
119 | @@ -1,5 +1,7 @@ |
120 | libmiral.so.2 libmiral2 #MINVER# |
121 | MIRAL_1.0@MIRAL_1.0 1.0.0 |
122 | + (c++)"miral::WindowInfo::shell_chrome(MirShellChrome)@MIRAL_1.2" 1.2.0 |
123 | + (c++)"miral::WindowInfo::shell_chrome() const@MIRAL_1.2" 1.2.0 |
124 | (c++)"miral::WindowInfo::height_inc(mir::geometry::detail::IntWrapper<mir::geometry::DeltaYTag>)@MIRAL_1.0" 1.0.0 |
125 | (c++)"miral::WindowInfo::max_aspect(miral::WindowSpecification::AspectRatio)@MIRAL_1.0" 1.0.0 |
126 | (c++)"miral::WindowInfo::max_height(mir::geometry::detail::IntWrapper<mir::geometry::HeightTag>)@MIRAL_1.0" 1.0.0 |
127 | @@ -361,4 +363,10 @@ |
128 | (c++)"miral::WindowInfo::state(MirWindowState)@MIRAL_1.1" 1.1.0 |
129 | (c++)"miral::WindowManagementPolicy::advise_state_change(miral::WindowInfo const&, MirWindowState)@MIRAL_1.1" 1.1.0 |
130 | (c++)"miral::WindowInfo::can_morph_to(MirWindowType) const@MIRAL_1.1" 1.1.0 |
131 | - (c++)"miral::CanonicalWindowManagerPolicy::place_new_window(miral::ApplicationInfo const&, miral::WindowSpecification const&)@MIRAL_1.1" 1.1.0 |
132 | \ No newline at end of file |
133 | + (c++)"miral::CanonicalWindowManagerPolicy::place_new_window(miral::ApplicationInfo const&, miral::WindowSpecification const&)@MIRAL_1.1" 1.1.0 |
134 | + MIRAL_1.2@MIRAL_1.2 1.2.0 |
135 | + (c++)"miral::StartupInternalClient::StartupInternalClient(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<void (mir::client::Connection)>, std::function<void (std::weak_ptr<mir::scene::Session>)>)@MIRAL_1.2" 1.2.0 |
136 | + (c++)"miral::InternalClientLauncher::launch(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (mir::client::Connection)> const&, std::function<void (std::weak_ptr<mir::scene::Session>)> const&) const@MIRAL_1.2" 1.2.0 |
137 | + (c++)"miral::WindowManagerTools::drag_window(miral::Window const&, mir::geometry::Displacement)@MIRAL_1.2" 1.2.0 |
138 | + (c++)"typeinfo for miral::ApplicationAuthorizer@MIRAL_1.0" 1.2.0 |
139 | + (c++)"typeinfo for miral::ApplicationAuthorizer1@MIRAL_1.2" 1.2.0 |
140 | |
141 | === added file 'debian/libmirclientcpp-dev.install' |
142 | --- debian/libmirclientcpp-dev.install 1970-01-01 00:00:00 +0000 |
143 | +++ debian/libmirclientcpp-dev.install 2017-02-15 14:04:27 +0000 |
144 | @@ -0,0 +1,2 @@ |
145 | +usr/include/miral/mir/*/* |
146 | +usr/lib/*/pkgconfig/mirclientcpp.pc |
147 | |
148 | === modified file 'doc/Doxyfile.in' |
149 | --- doc/Doxyfile.in 2016-08-01 15:54:21 +0000 |
150 | +++ doc/Doxyfile.in 2017-02-15 14:04:27 +0000 |
151 | @@ -666,7 +666,7 @@ |
152 | |
153 | INPUT = @CMAKE_CURRENT_SOURCE_DIR@/doc \ |
154 | @CMAKE_CURRENT_SOURCE_DIR@/include \ |
155 | - @CMAKE_CURRENT_SOURCE_DIR@/building_and_using_miral.md \ |
156 | + @CMAKE_CURRENT_SOURCE_DIR@/getting_and_using_miral.md \ |
157 | @CMAKE_CURRENT_SOURCE_DIR@/tasks_for_the_interested_reader.md |
158 | |
159 | # This tag can be used to specify the character encoding of the source files |
160 | @@ -1519,18 +1519,6 @@ |
161 | |
162 | XML_OUTPUT = xml |
163 | |
164 | -# The XML_SCHEMA tag can be used to specify an XML schema, |
165 | -# which can be used by a validating XML parser to check the |
166 | -# syntax of the XML files. |
167 | - |
168 | -XML_SCHEMA = |
169 | - |
170 | -# The XML_DTD tag can be used to specify an XML DTD, |
171 | -# which can be used by a validating XML parser to check the |
172 | -# syntax of the XML files. |
173 | - |
174 | -XML_DTD = |
175 | - |
176 | # If the XML_PROGRAMLISTING tag is set to YES Doxygen will |
177 | # dump the program listings (including syntax highlighting |
178 | # and cross-referencing information) to the XML output. Note that |
179 | |
180 | === modified file 'doc/mainpage.md' |
181 | --- doc/mainpage.md 2016-08-03 14:51:57 +0000 |
182 | +++ doc/mainpage.md 2017-02-15 14:04:27 +0000 |
183 | @@ -49,6 +49,6 @@ |
184 | Notes for Developers |
185 | -------------------- |
186 | |
187 | - - \ref building_and_using_miral |
188 | + - \ref getting_and_using_miral |
189 | - \ref introducing_the_miral_api |
190 | - \ref tasks_for_the_interested_reader |
191 | \ No newline at end of file |
192 | |
193 | === renamed file 'building_and_using_miral.md' => 'getting_and_using_miral.md' |
194 | --- building_and_using_miral.md 2016-12-02 10:15:24 +0000 |
195 | +++ getting_and_using_miral.md 2017-02-15 14:04:27 +0000 |
196 | @@ -1,5 +1,135 @@ |
197 | -Building and using MirAL {#building_and_using_miral} |
198 | -======================== |
199 | +Getting and Using MirAL {#getting_and_using_miral} |
200 | +======================= |
201 | + |
202 | +Getting MirAL |
203 | +------------- |
204 | + |
205 | +Depending upon your needs you can: |
206 | + |
207 | +1. Install and use the MirAL examples [Using MirAL examples]; |
208 | +2. Use MirAL to develop your own Mir server [Using MirAL for development]; or, |
209 | +3. Build MirAL yourself [Building MirAL]. |
210 | + |
211 | +Using MirAL examples |
212 | +-------------------- |
213 | + |
214 | +You can install the MirAL examples as follows: |
215 | + |
216 | + $ sudo apt install libmiral-examples |
217 | + $ sudo apt install mir-graphics-drivers-desktop qtubuntu-desktop |
218 | + |
219 | +For convenient testing there's a "miral-app" script that wraps the commands used |
220 | +in the last section to start the server and then launches the gnome-terminal (as |
221 | +the current user): |
222 | + |
223 | + $ miral-app |
224 | + |
225 | +To run independently of X11 you need to grant access to the graphics hardware |
226 | +(by running as root) and specify a VT to run in. There's a "miral-desktop" |
227 | +script that wraps to start the server (as root) and then launch gnome-terminal |
228 | +(as the current user): |
229 | + |
230 | + $ miral-desktop |
231 | + |
232 | +For more options see [Options when running the MirAL example shell] below. |
233 | + |
234 | +### Running applications on MirAL |
235 | + |
236 | +If you use the command-line launched by miral-app or miral-desktop native Mir |
237 | +applications (which include native Mir clients and those that use SDL or the |
238 | +GTK+, Qt toolkits) can be started as usual: |
239 | + |
240 | + $ sudo apt install mir-demos kate neverball |
241 | + $ mir_demo_client_egltriangle |
242 | + $ gedit |
243 | + $ kate |
244 | + $ neverball |
245 | + |
246 | +From outside the MirAL session GTK+, Qt and SDL applications can still be run |
247 | +using the miral-run script: |
248 | + |
249 | + $ miral-run gedit |
250 | + $ miral-run 7kaa |
251 | + |
252 | +### Running for X11 applications |
253 | + |
254 | +If you want to run X11 applications that do not have native Mir support in the |
255 | +toolkit they use then the answer is Xmir: an X11 server that runs on Mir. First |
256 | +you need Xmir installed: |
257 | + |
258 | + $ sudo apt install xmir |
259 | + |
260 | +Then once you have started a miral shell (as above) you can use miral-xrun to |
261 | +run applications under Xmir: |
262 | + |
263 | + $ miral-xrun firefox |
264 | + |
265 | +This automatically starts a Xmir X11 server on a new $DISPLAY for the |
266 | +application to use. You can use miral-xrun both from a command-line outside the |
267 | +miral-shell or, for example, from the terminal running in the shell. |
268 | + |
269 | +### Options when running the MirAL example shell |
270 | + |
271 | +#### Script Options |
272 | + |
273 | +Both the "miral-app" and "miral-desktop" scripts provide options for using an |
274 | +alternative example shell (miral-kiosk) and an alternative to gnome-terminal. |
275 | + |
276 | + -kiosk use miral-kiosk instead of miral-shell |
277 | + -launcher <launcher> use <launcher> instead of |
278 | + 'gnome-terminal --app-id com.canonical.miral.Terminal' |
279 | + |
280 | +In addition miral-desktop has the option to set the VT that is used: |
281 | + |
282 | + -vt <termid> set the virtual terminal [4] |
283 | + |
284 | +There are some additional options (listed with "-h") but those are the important |
285 | +ones. |
286 | + |
287 | +#### MirAL Options |
288 | + |
289 | +The scripts can also be used to pass options to MirAL: they pass everything on |
290 | +the command-line following the first thing they don't understand. These can be |
291 | +listed by `miral-shell --help`. Most of these options are inherited from Mir, |
292 | +but the following MirAL specific are likely to be of interest: |
293 | + |
294 | + --window-management-trace log trace message |
295 | + |
296 | +Probably the main use for MirAL is to test window-management (either of a |
297 | +toolkit or of a server) and this logs all calls to and from the window |
298 | +management policy. This option is supported directly in the MirAL library and |
299 | +works for any MirAL based shell - even one you write yourself. |
300 | + |
301 | + --keymap arg (=us) keymap <layout>[+<variant>[+<options>]] |
302 | + , e,g, "gb" or "cz+qwerty" or |
303 | + "de++compose:caps" |
304 | + |
305 | +For those of us not in the USA this is very useful. Both the -shell and -kiosk |
306 | +examples support this option. |
307 | + |
308 | + --window-manager arg (=titlebar) window management strategy |
309 | + [{titlebar|tiling|system-compositor}] |
310 | + |
311 | +Is only supported by miral-shell and its main use is to allow an alternative |
312 | +"tiling" window manager to be selected. |
313 | + |
314 | +Using MirAL for development |
315 | +--------------------------- |
316 | + |
317 | +Install the headers and libraries for using libmiral in development: |
318 | + |
319 | + $ sudo apt install libmiral-dev |
320 | + |
321 | +A `miral.pc` file is provided for use with `pkg-config` or other tools. For |
322 | +example: `pkg-config --cflags miral` |
323 | + |
324 | +The MirAL documentation can be installed and read like this: |
325 | + |
326 | + $ sudo apt install miral-doc |
327 | + $ xdg-open /usr/share/doc/miral-doc/html/index.html |
328 | + |
329 | +Building MirAL |
330 | +-------------- |
331 | |
332 | These instructions assume that you’re using Ubuntu 16.04LTS or later, I’ve not |
333 | earlier Ubuntu versions or other distributions. |
334 | @@ -7,8 +137,8 @@ |
335 | You’ll need a few development and utility packages installed, along with the |
336 | Mir graphics drivers: |
337 | |
338 | - $ sudo apt-get install devscripts equivs bzr |
339 | - $ sudo apt-get install mir-graphics-drivers-desktop |
340 | + $ sudo apt install devscripts equivs bzr |
341 | + $ sudo apt install mir-graphics-drivers-desktop |
342 | |
343 | (If you’re working on a phone or tablet use mir-graphics-drivers-android in |
344 | place of mir-graphics-drivers-desktop.) |
345 | @@ -16,7 +146,7 @@ |
346 | With these installed you can checkout and build miral: |
347 | |
348 | $ bzr branch lp:miral |
349 | - $ sudo mk-build-deps -i --build-dep miral/debian/control |
350 | + $ sudo mk-build-deps -i |
351 | $ mkdir miral/build |
352 | $ cd miral/build |
353 | $ cmake .. |
354 | @@ -41,91 +171,9 @@ |
355 | |
356 | To exit from miral-shell press Ctrl-Alt-BkSp. |
357 | |
358 | -To run independently of X11 you need to grant access to the graphics hardware |
359 | -(by running as root) and specify a VT to run in. For example: |
360 | - |
361 | - $ sudo bin/miral-shell --vt 4 --arw-file --file $XDG_RUNTIME_DIR/mir_socket |
362 | - |
363 | -For convenient testing there's a "miral-desktop" script that wraps this command |
364 | -to start the server (as root) and then launches the gnome-terminal (as the |
365 | -current user): |
366 | - |
367 | - $ bin/miral-desktop -bindir bin |
368 | - |
369 | -Support for X11 applications |
370 | ----------------------------- |
371 | - |
372 | -If you want to run X11 applications that do not have native Mir support in the |
373 | -toolkit they use then the answer is Xmir: an X11 server that runs on Mir. First |
374 | -you need Xmir installed: |
375 | - |
376 | - $ sudo apt install xmir |
377 | - |
378 | -Then once you have started miral-shell (as above) you can use miral-xrun to run |
379 | -applications under Xmir: |
380 | - |
381 | - $ bin/miral-xrun firefox |
382 | - |
383 | -This automatically starts a Xmir X11 server on a new $DISPLAY for the |
384 | -application to use. You can use miral-xrun both from a command-line outside the |
385 | -miral-shell or, for example, from a terminal running in the shell. |
386 | - |
387 | -Running applications on Miral |
388 | ------------------------------ |
389 | - |
390 | -Assuming you have a Mir server running, native Mir applications can be started |
391 | -from the command-line: |
392 | - |
393 | - $ sudo apt-get install mir-demos |
394 | - $ mir_demo_client_egltriangle |
395 | - |
396 | -Similarly, GTK+, Qt and SDL applications can be run with the miral-run script: |
397 | - |
398 | - $ bin/miral-run gedit |
399 | - $ bin/miral-run 7kaa |
400 | - |
401 | -Configuration options |
402 | ---------------------- |
403 | - |
404 | -You can list the configuration options for miral-shell with "--help": |
405 | - |
406 | - $ bin/miral-shell --help |
407 | - |
408 | -Most of these options are inherited from Mir. These can be set on the command |
409 | -line, by environment variables or in a config file. For example, if you want to |
410 | -start the gnome-terminal when you run miral-shell you can: |
411 | - |
412 | -Set supply the option on the command line: |
413 | - |
414 | - $ bin/miral-shell --startup-apps gnome-terminal |
415 | - |
416 | -Set the corresponding MIR_SERVER_<option> environment variable: |
417 | - |
418 | - $ export MIR_SERVER_STARTUP_APPS=gnome-terminal |
419 | - ... |
420 | - $ bin/miral-shell |
421 | - |
422 | -Create a miral-shell config file: |
423 | - |
424 | - $ echo startup-apps=gnome-terminal > ~/.config/miral-shell.config |
425 | - ... |
426 | - $ bin/miral-shell |
427 | - |
428 | -Running Qt applications |
429 | ------------------------ |
430 | - |
431 | -To run Qt applications under Mir you may need to install qtubuntu-desktop: |
432 | - |
433 | - $ sudo apt-get install qtubuntu-desktop |
434 | - |
435 | -Building the tests |
436 | ------------------- |
437 | - |
438 | -MirAL comes with a set of tests, if you intend to build these then add the |
439 | -following packages: |
440 | - |
441 | - $ sudo apt-get install cmake-extras google-mock mirtest-dev mir-test-tools |
442 | - $ sudo apt-get install libboost-filesystem-dev libboost-system-dev |
443 | - |
444 | -Note that this is not possible for Mir versions prior to 0.24 as there were |
445 | -bugs in mirtest-dev. At the time of writing Ubuntu 16.4 has Mir-0.21. |
446 | +You can install the MirAL examples, headers and libraries you've built with: |
447 | + |
448 | + $ sudo make install |
449 | + |
450 | +Otherwise, you just need to add "bin/" to the beginning of the commands shown |
451 | +in the previous section. |
452 | |
453 | === added directory 'include/mir' |
454 | === renamed directory 'include/miral/toolkit' => 'include/mir/client' |
455 | === modified file 'include/mir/client/connection.h' |
456 | --- include/miral/toolkit/connection.h 2016-08-01 15:54:21 +0000 |
457 | +++ include/mir/client/connection.h 2017-02-15 14:04:27 +0000 |
458 | @@ -16,19 +16,19 @@ |
459 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
460 | */ |
461 | |
462 | -#ifndef MIRAL_TOOLKIT_CONNECTION_H |
463 | -#define MIRAL_TOOLKIT_CONNECTION_H |
464 | +#ifndef MIR_CLIENT_CONNECTION_H |
465 | +#define MIR_CLIENT_CONNECTION_H |
466 | |
467 | #include <mir_toolkit/mir_connection.h> |
468 | |
469 | #include <memory> |
470 | |
471 | -namespace miral |
472 | +namespace mir |
473 | { |
474 | -/// Convinent C++ wrappers around the Mir toolkit API. |
475 | +/// Convenient C++ wrappers around the Mir toolkit API. |
476 | /// |
477 | /// These wrappers are intentionally inline adapters: the compiled code depend directly on the Mir toolkit API. |
478 | -namespace toolkit |
479 | +namespace client |
480 | { |
481 | /// Handle class for MirConnection - provides automatic reference counting. |
482 | class Connection |
483 | @@ -48,4 +48,4 @@ |
484 | } |
485 | } |
486 | |
487 | -#endif //MIRAL_TOOLKIT_CONNECTION_H |
488 | +#endif //MIR_CLIENT_CONNECTION_H |
489 | |
490 | === renamed directory 'include/miral/detail' => 'include/mir/client/detail' |
491 | === modified file 'include/mir/client/detail/mir_forward_compatibility.h' |
492 | --- include/miral/detail/mir_forward_compatibility.h 2017-01-25 09:57:51 +0000 |
493 | +++ include/mir/client/detail/mir_forward_compatibility.h 2017-02-15 14:04:27 +0000 |
494 | @@ -21,7 +21,7 @@ |
495 | |
496 | #include <mir_toolkit/version.h> |
497 | #include <mir_toolkit/common.h> |
498 | -#include <miral/detail/mir_features.h> |
499 | +#include <mir/client/detail/mir_features.h> |
500 | |
501 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
502 | using MirWindowAttrib = MirSurfaceAttrib; |
503 | @@ -64,7 +64,7 @@ |
504 | #endif |
505 | |
506 | |
507 | -// Types that don't exist in earlier versions of Mir's toolkit |
508 | +// Types that don't exist in earlier versions of Mir's client |
509 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 4, 0) |
510 | |
511 | // Inspired by GdkGravity |
512 | |
513 | === modified file 'include/mir/client/window.h' |
514 | --- include/miral/toolkit/window.h 2017-01-26 15:11:27 +0000 |
515 | +++ include/mir/client/window.h 2017-02-15 14:04:27 +0000 |
516 | @@ -16,23 +16,28 @@ |
517 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
518 | */ |
519 | |
520 | -#ifndef MIRAL_TOOLKIT_WINDOW_H |
521 | -#define MIRAL_TOOLKIT_WINDOW_H |
522 | +#ifndef MIR_CLIENT_WINDOW_H |
523 | +#define MIR_CLIENT_WINDOW_H |
524 | |
525 | -#include <miral/detail/mir_forward_compatibility.h> |
526 | +#include <mir/client/detail/mir_forward_compatibility.h> |
527 | |
528 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
529 | #include <mir_toolkit/mir_surface.h> |
530 | -auto const mir_window_release_sync = mir_surface_release_sync; |
531 | +auto const mir_window_release_sync = mir_surface_release_sync; |
532 | +auto const mir_window_release = mir_surface_release; |
533 | +auto const mir_window_get_buffer_stream = mir_surface_get_buffer_stream; |
534 | +auto const mir_window_is_valid = mir_surface_is_valid; |
535 | +auto const mir_window_get_error_message = mir_surface_get_error_message; |
536 | +auto const mir_window_set_state = mir_surface_set_state; |
537 | #else |
538 | #include <mir_toolkit/mir_window.h> |
539 | #endif |
540 | |
541 | #include <memory> |
542 | |
543 | -namespace miral |
544 | +namespace mir |
545 | { |
546 | -namespace toolkit |
547 | +namespace client |
548 | { |
549 | /// Handle class for MirWindow - provides automatic reference counting. |
550 | class Window |
551 | @@ -53,4 +58,4 @@ |
552 | } |
553 | } |
554 | |
555 | -#endif //MIRAL_TOOLKIT_WINDOW_H |
556 | +#endif //MIR_CLIENT_WINDOW_H |
557 | |
558 | === renamed file 'include/miral/toolkit/persistent_id.h' => 'include/mir/client/window_id.h' |
559 | --- include/miral/toolkit/persistent_id.h 2017-01-25 09:57:51 +0000 |
560 | +++ include/mir/client/window_id.h 2017-02-15 14:04:27 +0000 |
561 | @@ -16,10 +16,10 @@ |
562 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
563 | */ |
564 | |
565 | -#ifndef MIRAL_TOOLKIT_PERSISTENT_ID_H |
566 | -#define MIRAL_TOOLKIT_PERSISTENT_ID_H |
567 | +#ifndef MIR_CLIENT_WINDOW_ID_H |
568 | +#define MIR_CLIENT_WINDOW_ID_H |
569 | |
570 | -#include <miral/detail/mir_forward_compatibility.h> |
571 | +#include <mir/client/detail/mir_forward_compatibility.h> |
572 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
573 | #include <mir_toolkit/mir_surface.h> |
574 | #else |
575 | @@ -27,30 +27,40 @@ |
576 | #include <mir_toolkit/mir_persistent_id.h> |
577 | #endif |
578 | |
579 | +#if MIR_CLIENT_API_VERSION < MIR_VERSION_NUMBER(0, 26, 1) |
580 | +#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
581 | +auto const mir_window_request_window_id_sync = mir_surface_request_persistent_id_sync; |
582 | +#else |
583 | +auto const mir_window_request_window_id_sync = mir_window_request_persistent_id_sync; |
584 | +#endif |
585 | +auto const mir_window_id_as_string = mir_persistent_id_as_string; |
586 | +auto const mir_window_id_release = mir_persistent_id_release; |
587 | +typedef struct MirPersistentId MirWindowId; |
588 | +#else |
589 | +#include <mir_toolkit/mir_window_id.h> |
590 | +#endif |
591 | + |
592 | #include <memory> |
593 | |
594 | -namespace miral |
595 | -{ |
596 | -namespace toolkit |
597 | -{ |
598 | -/// Handle class for MirPersistentId - provides automatic reference counting |
599 | -class PersistentId |
600 | +namespace mir |
601 | +{ |
602 | +namespace client |
603 | +{ |
604 | +/// Handle class for MirWindowId - provides automatic reference counting |
605 | +class WindowId |
606 | { |
607 | public: |
608 | - explicit PersistentId(MirPersistentId* id) : self{id, deleter} {} |
609 | -#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
610 | - explicit PersistentId(MirWindow* surface) : PersistentId{mir_surface_request_persistent_id_sync(surface)} {} |
611 | -#else |
612 | - explicit PersistentId(MirWindow* surface) : PersistentId{mir_window_request_persistent_id_sync(surface)} {} |
613 | -#endif |
614 | - |
615 | - auto c_str() const -> char const* { return mir_persistent_id_as_string(self.get()); } |
616 | + explicit WindowId(MirWindowId* id) : self{id, deleter} {} |
617 | + |
618 | + explicit WindowId(MirWindow* window) : WindowId{mir_window_request_window_id_sync(window)} {} |
619 | + |
620 | + auto c_str() const -> char const* { return mir_window_id_as_string(self.get()); } |
621 | |
622 | private: |
623 | - static void deleter(MirPersistentId* id) { mir_persistent_id_release(id); } |
624 | - std::shared_ptr<MirPersistentId> self; |
625 | + static void deleter(MirWindowId* id) { mir_window_id_release(id); } |
626 | + std::shared_ptr<MirWindowId> self; |
627 | }; |
628 | } |
629 | } |
630 | |
631 | -#endif //MIRAL_TOOLKIT_PERSISTENT_ID_H |
632 | +#endif //MIR_CLIENT_WINDOW_ID_H |
633 | |
634 | === modified file 'include/mir/client/window_spec.h' |
635 | --- include/miral/toolkit/window_spec.h 2017-01-26 15:11:27 +0000 |
636 | +++ include/mir/client/window_spec.h 2017-02-15 14:04:27 +0000 |
637 | @@ -1,5 +1,5 @@ |
638 | /* |
639 | - * Copyright © 2016 Canonical Ltd. |
640 | + * Copyright © 2016-2017 Canonical Ltd. |
641 | * |
642 | * This program is free software: you can redistribute it and/or modify it |
643 | * under the terms of the GNU General Public License version 3, |
644 | @@ -16,21 +16,57 @@ |
645 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
646 | */ |
647 | |
648 | -#ifndef MIRAL_TOOLKIT_WINDOW_SPEC_H |
649 | -#define MIRAL_TOOLKIT_WINDOW_SPEC_H |
650 | - |
651 | -#include <miral/toolkit/window.h> |
652 | -#include <miral/detail/mir_forward_compatibility.h> |
653 | - |
654 | +#ifndef MIR_CLIENT_WINDOW_SPEC_H |
655 | +#define MIR_CLIENT_WINDOW_SPEC_H |
656 | + |
657 | +#include <mir/client/window.h> |
658 | +#include <mir/client/detail/mir_forward_compatibility.h> |
659 | + |
660 | +#include <mir_toolkit/mir_connection.h> |
661 | + |
662 | +#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
663 | #include <mir_toolkit/mir_surface.h> |
664 | -#include <mir_toolkit/mir_connection.h> |
665 | -#include <mir_toolkit/version.h> |
666 | +#else |
667 | +#include <mir_toolkit/mir_window.h> |
668 | +#endif |
669 | |
670 | #include <memory> |
671 | |
672 | -namespace miral |
673 | +// Forward compatibility hacks for earlier Mir versions |
674 | +#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
675 | +using MirWindowCallback = mir_surface_callback; |
676 | +using MirWindowEventCallback = mir_surface_event_callback; |
677 | +auto const mir_create_window_spec = mir_connection_create_spec_for_changes; |
678 | +auto const mir_window_spec_set_event_handler = mir_surface_spec_set_event_handler; |
679 | +auto const mir_window_spec_set_name = mir_surface_spec_set_name; |
680 | +auto const mir_window_spec_set_width = mir_surface_spec_set_width; |
681 | +auto const mir_window_spec_set_height = mir_surface_spec_set_height; |
682 | +auto const mir_window_spec_set_width_increment = mir_surface_spec_set_width_increment; |
683 | +auto const mir_window_spec_set_height_increment = mir_surface_spec_set_height_increment; |
684 | +auto const mir_window_spec_set_buffer_usage = mir_surface_spec_set_buffer_usage; |
685 | +auto const mir_window_spec_set_pixel_format = mir_surface_spec_set_pixel_format; |
686 | +auto const mir_window_spec_set_type = mir_surface_spec_set_type; |
687 | +auto const mir_window_spec_set_shell_chrome = mir_surface_spec_set_shell_chrome; |
688 | +auto const mir_window_spec_set_min_width = mir_surface_spec_set_min_width; |
689 | +auto const mir_window_spec_set_min_height = mir_surface_spec_set_min_height; |
690 | +auto const mir_window_spec_set_max_width = mir_surface_spec_set_max_width; |
691 | +auto const mir_window_spec_set_max_height = mir_surface_spec_set_max_height; |
692 | +auto const mir_window_spec_set_parent = mir_surface_spec_set_parent; |
693 | +auto const mir_window_spec_set_state = mir_surface_spec_set_state; |
694 | +auto const mir_window_spec_set_fullscreen_on_output = mir_surface_spec_set_fullscreen_on_output; |
695 | +auto const mir_create_window = mir_surface_create; |
696 | +auto const mir_create_window_sync = mir_surface_create_sync; |
697 | +auto const mir_window_apply_spec = mir_surface_apply_spec; |
698 | +auto const mir_window_spec_release = mir_surface_spec_release; |
699 | + |
700 | +#if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0) |
701 | +auto const mir_window_spec_set_placement = mir_surface_spec_set_placement; |
702 | +#endif |
703 | +#endif |
704 | + |
705 | +namespace mir |
706 | { |
707 | -namespace toolkit |
708 | +namespace client |
709 | { |
710 | /// Handle class for MirWindowSpec - provides automatic reference counting, method chaining. |
711 | class WindowSpec |
712 | @@ -38,7 +74,7 @@ |
713 | public: |
714 | explicit WindowSpec(MirWindowSpec* spec) : self{spec, deleter} {} |
715 | |
716 | - static auto for_normal_surface(MirConnection* connection, int width, int height, MirPixelFormat format) -> WindowSpec |
717 | + static auto for_normal_window(MirConnection* connection, int width, int height, MirPixelFormat format) -> WindowSpec |
718 | { |
719 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
720 | return WindowSpec{mir_connection_create_spec_for_normal_surface(connection, width, height, format)}; |
721 | @@ -49,6 +85,13 @@ |
722 | #endif |
723 | } |
724 | |
725 | +#if MIR_CLIENT_VERSION > MIR_VERSION_NUMBER(3, 4, 0) |
726 | + static auto for_normal_window(MirConnection* connection, int width, int height) -> WindowSpec |
727 | + { |
728 | + return WindowSpec{mir_create_normal_window_spec(connection, width, height)}; |
729 | + } |
730 | +#endif |
731 | + |
732 | static auto for_menu(MirConnection* connection, |
733 | int width, |
734 | int height, |
735 | @@ -57,7 +100,7 @@ |
736 | MirRectangle* rect, |
737 | MirEdgeAttachment edge) -> WindowSpec |
738 | { |
739 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
740 | +#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
741 | return WindowSpec{mir_connection_create_spec_for_menu(connection, width, height, format, parent, rect, edge)}; |
742 | #else |
743 | auto spec = WindowSpec{mir_create_menu_window_spec(connection, width, height, parent, rect, edge)}; |
744 | @@ -75,7 +118,7 @@ |
745 | MirRectangle* rect, |
746 | MirEdgeAttachment edge) -> WindowSpec |
747 | { |
748 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
749 | +#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
750 | return WindowSpec{mir_connection_create_spec_for_tip(connection, width, height, format, parent, rect, edge)}; |
751 | #else |
752 | auto spec = WindowSpec{mir_create_tip_window_spec(connection, width, height, parent, rect, edge)}; |
753 | @@ -90,7 +133,7 @@ |
754 | int height, |
755 | MirPixelFormat format)-> WindowSpec |
756 | { |
757 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
758 | +#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
759 | return WindowSpec{mir_connection_create_spec_for_dialog(connection, width, height, format)}; |
760 | #else |
761 | auto spec = WindowSpec{mir_create_dialog_window_spec(connection, width, height)}; |
762 | @@ -108,106 +151,116 @@ |
763 | return for_dialog(connection, width, height, format).set_parent(parent); |
764 | } |
765 | |
766 | + static auto for_input_method(MirConnection* connection, int width, int height, MirWindow* parent) |
767 | + { |
768 | +#if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 5, 0) |
769 | + auto spec = WindowSpec{mir_create_input_method_window_spec(connection, width, height)} |
770 | +#else |
771 | + auto spec = WindowSpec{mir_create_surface_spec(connection)} |
772 | + .set_buffer_usage(mir_buffer_usage_hardware) // Required protobuf field for create_window() |
773 | + .set_pixel_format(mir_pixel_format_invalid) // Required protobuf field for create_window() |
774 | + .set_size(width, height) |
775 | + .set_type(mir_window_type_inputmethod) |
776 | +#endif |
777 | + .set_parent(parent); |
778 | + return spec; |
779 | + } |
780 | + |
781 | + static auto for_satellite(MirConnection* connection, int width, int height, MirWindow* parent) |
782 | + { |
783 | + // There's no mir_create_satellite_window_spec() |
784 | + return WindowSpec{mir_create_window_spec(connection)} |
785 | + .set_buffer_usage(mir_buffer_usage_hardware) // Required protobuf field for create_window() |
786 | + .set_pixel_format(mir_pixel_format_invalid) // Required protobuf field for create_window() |
787 | + .set_size(width, height) |
788 | + .set_type(mir_window_type_satellite) |
789 | + .set_parent(parent); |
790 | + } |
791 | + |
792 | + static auto for_gloss(MirConnection* connection, int width, int height) |
793 | + { |
794 | + // There's no mir_create_gloss_window_spec() |
795 | + return WindowSpec{mir_create_window_spec(connection)} |
796 | + .set_buffer_usage(mir_buffer_usage_hardware) // Required protobuf field for create_window() |
797 | + .set_pixel_format(mir_pixel_format_invalid) // Required protobuf field for create_window() |
798 | + .set_size(width, height) |
799 | + .set_type(mir_window_type_gloss); |
800 | + } |
801 | + |
802 | static auto for_changes(MirConnection* connection) -> WindowSpec |
803 | { |
804 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
805 | - return WindowSpec{mir_connection_create_spec_for_changes(connection)}; |
806 | -#else |
807 | return WindowSpec{mir_create_window_spec(connection)}; |
808 | -#endif |
809 | } |
810 | |
811 | auto set_buffer_usage(MirBufferUsage usage) -> WindowSpec& |
812 | { |
813 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
814 | - mir_surface_spec_set_buffer_usage(*this, usage); |
815 | -#else |
816 | mir_window_spec_set_buffer_usage(*this, usage); |
817 | -#endif |
818 | + return *this; |
819 | + } |
820 | + |
821 | + auto set_pixel_format(MirPixelFormat format) -> WindowSpec& |
822 | + { |
823 | + mir_window_spec_set_pixel_format(*this, format); |
824 | return *this; |
825 | } |
826 | |
827 | auto set_type(MirWindowType type) -> WindowSpec& |
828 | { |
829 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
830 | - mir_surface_spec_set_type(*this, type); |
831 | -#else |
832 | mir_window_spec_set_type(*this, type); |
833 | -#endif |
834 | + return *this; |
835 | + } |
836 | + |
837 | + auto set_shell_chrome(MirShellChrome chrome) -> WindowSpec& |
838 | + { |
839 | + mir_window_spec_set_shell_chrome(*this, chrome); |
840 | return *this; |
841 | } |
842 | |
843 | auto set_min_size(int min_width, int min_height) -> WindowSpec& |
844 | { |
845 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
846 | - mir_surface_spec_set_min_width(*this, min_width); |
847 | - mir_surface_spec_set_min_height(*this, min_height); |
848 | -#else |
849 | mir_window_spec_set_min_width(*this, min_width); |
850 | mir_window_spec_set_min_height(*this, min_height); |
851 | -#endif |
852 | return *this; |
853 | } |
854 | |
855 | auto set_max_size(int max_width, int max_height) -> WindowSpec& |
856 | { |
857 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
858 | - mir_surface_spec_set_max_width(*this, max_width); |
859 | - mir_surface_spec_set_max_height(*this, max_height); |
860 | -#else |
861 | mir_window_spec_set_max_width(*this, max_width); |
862 | mir_window_spec_set_max_height(*this, max_height); |
863 | -#endif |
864 | return *this; |
865 | } |
866 | |
867 | auto set_size_inc(int width_inc, int height_inc) -> WindowSpec& |
868 | { |
869 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
870 | - mir_surface_spec_set_width_increment(*this, width_inc); |
871 | - mir_surface_spec_set_height_increment(*this, height_inc); |
872 | -#else |
873 | mir_window_spec_set_width_increment(*this, width_inc); |
874 | mir_window_spec_set_height_increment(*this, height_inc); |
875 | -#endif |
876 | return *this; |
877 | } |
878 | |
879 | auto set_size(int width, int height) -> WindowSpec& |
880 | { |
881 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
882 | - mir_surface_spec_set_width(*this, width); |
883 | - mir_surface_spec_set_height(*this, height); |
884 | -#else |
885 | mir_window_spec_set_width(*this, width); |
886 | mir_window_spec_set_height(*this, height); |
887 | -#endif |
888 | return *this; |
889 | } |
890 | |
891 | auto set_name(char const* name) -> WindowSpec& |
892 | { |
893 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
894 | - mir_surface_spec_set_name(*this, name); |
895 | -#else |
896 | mir_window_spec_set_name(*this, name); |
897 | -#endif |
898 | return *this; |
899 | } |
900 | |
901 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
902 | - auto set_event_handler(mir_surface_event_callback callback, void* context) -> WindowSpec& |
903 | - { |
904 | - mir_surface_spec_set_event_handler(*this, callback, context); |
905 | - return *this; |
906 | - } |
907 | -#else |
908 | auto set_event_handler(MirWindowEventCallback callback, void* context) -> WindowSpec& |
909 | { |
910 | mir_window_spec_set_event_handler(*this, callback, context); |
911 | return *this; |
912 | } |
913 | -#endif |
914 | + |
915 | + auto set_fullscreen_on_output(uint32_t output_id) -> WindowSpec& |
916 | + { |
917 | + mir_window_spec_set_fullscreen_on_output(*this, output_id); |
918 | + return *this; |
919 | + } |
920 | |
921 | #if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0) |
922 | auto set_placement(const MirRectangle* rect, |
923 | @@ -217,61 +270,53 @@ |
924 | int offset_dx, |
925 | int offset_dy) -> WindowSpec& |
926 | { |
927 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
928 | - mir_surface_spec_set_placement(*this, rect, rect_gravity, surface_gravity, placement_hints, offset_dx, offset_dy); |
929 | -#else |
930 | mir_window_spec_set_placement(*this, rect, rect_gravity, surface_gravity, placement_hints, offset_dx, offset_dy); |
931 | -#endif |
932 | + return *this; |
933 | + } |
934 | +#else |
935 | + auto set_placement(const MirRectangle* /*rect*/, |
936 | + MirPlacementGravity /*rect_gravity*/, |
937 | + MirPlacementGravity /*surface_gravity*/, |
938 | + MirPlacementHints /*placement_hints*/, |
939 | + int /*offset_dx*/, |
940 | + int /*offset_dy*/) -> WindowSpec& |
941 | + { |
942 | return *this; |
943 | } |
944 | #endif |
945 | |
946 | auto set_parent(MirWindow* parent) -> WindowSpec& |
947 | { |
948 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
949 | - mir_surface_spec_set_parent(*this, parent); |
950 | -#else |
951 | mir_window_spec_set_parent(*this, parent); |
952 | -#endif |
953 | + return *this; |
954 | + } |
955 | + |
956 | + auto set_state(MirWindowState state) -> WindowSpec& |
957 | + { |
958 | + mir_window_spec_set_state(*this, state); |
959 | return *this; |
960 | } |
961 | |
962 | template<typename Context> |
963 | - void create_surface(void (*callback)(MirWindow*, Context*), Context* context) const |
964 | + void create_window(void (* callback)(MirWindow*, Context*), Context* context) const |
965 | { |
966 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
967 | - mir_surface_create(*this, reinterpret_cast<mir_surface_callback>(callback), context); |
968 | -#else |
969 | mir_create_window(*this, reinterpret_cast<MirWindowCallback>(callback), context); |
970 | -#endif |
971 | } |
972 | |
973 | - auto create_surface() const -> Window |
974 | + auto create_window() const -> Window |
975 | { |
976 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
977 | - return Window{mir_surface_create_sync(*this)}; |
978 | -#else |
979 | return Window{mir_create_window_sync(*this)}; |
980 | -#endif |
981 | } |
982 | |
983 | - void apply_to(MirWindow* surface) const |
984 | + void apply_to(MirWindow* window) const |
985 | { |
986 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
987 | - mir_surface_apply_spec(surface, *this); |
988 | -#else |
989 | - mir_window_apply_spec(surface, *this); |
990 | -#endif |
991 | + mir_window_apply_spec(window, *this); |
992 | } |
993 | |
994 | operator MirWindowSpec*() const { return self.get(); } |
995 | |
996 | private: |
997 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
998 | - static void deleter(MirWindowSpec* spec) { mir_surface_spec_release(spec); } |
999 | -#else |
1000 | static void deleter(MirWindowSpec* spec) { mir_window_spec_release(spec); } |
1001 | -#endif |
1002 | std::shared_ptr<MirWindowSpec> self; |
1003 | }; |
1004 | } |
1005 | |
1006 | === modified file 'include/miral/application_authorizer.h' |
1007 | --- include/miral/application_authorizer.h 2016-06-07 13:49:47 +0000 |
1008 | +++ include/miral/application_authorizer.h 2017-02-15 14:04:27 +0000 |
1009 | @@ -19,6 +19,8 @@ |
1010 | #ifndef MIRAL_APPLICATION_AUTHORIZER_H |
1011 | #define MIRAL_APPLICATION_AUTHORIZER_H |
1012 | |
1013 | +#include <miral/version.h> |
1014 | + |
1015 | #include <sys/types.h> |
1016 | #include <memory> |
1017 | |
1018 | @@ -57,6 +59,19 @@ |
1019 | virtual bool prompt_session_is_allowed(ApplicationCredentials const& creds) = 0; |
1020 | }; |
1021 | |
1022 | +// Mir has introduced new functions. We can't introduce new functions to ApplicationAuthorizer |
1023 | +// without breaking ABI, but we can offer an extension interface: |
1024 | +class ApplicationAuthorizer1 : public ApplicationAuthorizer |
1025 | +{ |
1026 | +public: |
1027 | + virtual bool configure_input_is_allowed(ApplicationCredentials const& creds) = 0; |
1028 | + virtual bool set_base_input_configuration_is_allowed(ApplicationCredentials const& creds) = 0; |
1029 | + |
1030 | +#if MIRAL_VERSION >= MIR_VERSION_NUMBER(2, 0, 0) |
1031 | +#error "We've presumably broken ABI - please roll this interface into ApplicationAuthorizer" |
1032 | +#endif |
1033 | +}; |
1034 | + |
1035 | class BasicSetApplicationAuthorizer |
1036 | { |
1037 | public: |
1038 | |
1039 | === modified file 'include/miral/internal_client.h' |
1040 | --- include/miral/internal_client.h 2016-06-17 16:50:29 +0000 |
1041 | +++ include/miral/internal_client.h 2017-02-15 14:04:27 +0000 |
1042 | @@ -19,7 +19,7 @@ |
1043 | #ifndef MIRAL_INTERNAL_CLIENT_H |
1044 | #define MIRAL_INTERNAL_CLIENT_H |
1045 | |
1046 | -#include <miral/toolkit/connection.h> |
1047 | +#include <mir/client/connection.h> |
1048 | |
1049 | #include <functional> |
1050 | #include <memory> |
1051 | @@ -41,7 +41,7 @@ |
1052 | public: |
1053 | explicit StartupInternalClient( |
1054 | std::string name, |
1055 | - std::function<void(toolkit::Connection connection)> client_code, |
1056 | + std::function<void(mir::client::Connection connection)> client_code, |
1057 | std::function<void(std::weak_ptr<mir::scene::Session> const session)> connect_notification); |
1058 | |
1059 | template <typename ClientObject> |
1060 | @@ -67,7 +67,7 @@ |
1061 | |
1062 | void launch( |
1063 | std::string const& name, |
1064 | - std::function<void(toolkit::Connection connection)> const& client_code, |
1065 | + std::function<void(mir::client::Connection connection)> const& client_code, |
1066 | std::function<void(std::weak_ptr<mir::scene::Session> const session)> const& connect_notification) const; |
1067 | |
1068 | template <typename ClientObject> |
1069 | @@ -75,7 +75,7 @@ |
1070 | { |
1071 | launch( |
1072 | name, |
1073 | - [&](toolkit::Connection connection) { client_object(connection); }, |
1074 | + [&](mir::client::Connection connection) { client_object(connection); }, |
1075 | [&](std::weak_ptr<mir::scene::Session> const session) { client_object(session); }); |
1076 | } |
1077 | |
1078 | |
1079 | === modified file 'include/miral/keymap.h' |
1080 | --- include/miral/keymap.h 2016-10-20 07:54:52 +0000 |
1081 | +++ include/miral/keymap.h 2017-02-15 14:04:27 +0000 |
1082 | @@ -35,7 +35,8 @@ |
1083 | Keymap(); |
1084 | |
1085 | /// Specify a keymap. |
1086 | - /// Format is <language>[+<variant>[+<options>]] |
1087 | + /// Format is: |
1088 | + /// \verbatim <language>[+<variant>[+<options>]] \endverbatim |
1089 | /// Options is a comma separated list. |
1090 | /// e.g. "uk" or "us+dvorak" |
1091 | explicit Keymap(std::string const& keymap); |
1092 | |
1093 | === modified file 'include/miral/window_info.h' |
1094 | --- include/miral/window_info.h 2017-01-13 18:17:01 +0000 |
1095 | +++ include/miral/window_info.h 2017-02-15 14:04:27 +0000 |
1096 | @@ -108,6 +108,9 @@ |
1097 | auto confine_pointer() const -> MirPointerConfinementState; |
1098 | void confine_pointer(MirPointerConfinementState confinement); |
1099 | |
1100 | + auto shell_chrome() const -> MirShellChrome; |
1101 | + void shell_chrome(MirShellChrome chrome); |
1102 | + |
1103 | /// This can be used by client code to store window manager specific information |
1104 | auto userdata() const -> std::shared_ptr<void>; |
1105 | void userdata(std::shared_ptr<void> userdata); |
1106 | |
1107 | === modified file 'include/miral/window_management_policy.h' |
1108 | --- include/miral/window_management_policy.h 2017-01-26 11:30:51 +0000 |
1109 | +++ include/miral/window_management_policy.h 2017-02-15 14:04:27 +0000 |
1110 | @@ -23,7 +23,7 @@ |
1111 | #include <mir/geometry/rectangles.h> |
1112 | #include <mir_toolkit/event.h> |
1113 | |
1114 | -#include <miral/detail/mir_forward_compatibility.h> |
1115 | +#include <mir/client/detail/mir_forward_compatibility.h> |
1116 | |
1117 | namespace miral |
1118 | { |
1119 | @@ -130,13 +130,13 @@ |
1120 | * |
1121 | * @param window_info the window |
1122 | */ |
1123 | - virtual void advise_focus_lost(WindowInfo const& info); |
1124 | + virtual void advise_focus_lost(WindowInfo const& window_info); |
1125 | |
1126 | /** Notification that a window has gained focus |
1127 | * |
1128 | * @param window_info the window |
1129 | */ |
1130 | - virtual void advise_focus_gained(WindowInfo const& info); |
1131 | + virtual void advise_focus_gained(WindowInfo const& window_info); |
1132 | |
1133 | /** Notification that a window is about to change state |
1134 | * |
1135 | |
1136 | === modified file 'include/miral/window_manager_tools.h' |
1137 | --- include/miral/window_manager_tools.h 2016-11-03 10:15:24 +0000 |
1138 | +++ include/miral/window_manager_tools.h 2017-02-15 14:04:27 +0000 |
1139 | @@ -107,7 +107,7 @@ |
1140 | |
1141 | /** retrieve the persistent surface id for a window |
1142 | * |
1143 | - * @param id the window |
1144 | + * @param window the window |
1145 | * @return the persistent surface id |
1146 | */ |
1147 | auto id_for_window(Window const& window) const -> std::string; |
1148 | @@ -132,6 +132,9 @@ |
1149 | /// move the active window |
1150 | void drag_active_window(mir::geometry::Displacement movement); |
1151 | |
1152 | + /// move the window |
1153 | + void drag_window(Window const& window, mir::geometry::Displacement movement); |
1154 | + |
1155 | /// make the next application active |
1156 | void focus_next_application(); |
1157 | |
1158 | |
1159 | === modified file 'include/miral/window_specification.h' |
1160 | --- include/miral/window_specification.h 2017-01-17 17:10:52 +0000 |
1161 | +++ include/miral/window_specification.h 2017-02-15 14:04:27 +0000 |
1162 | @@ -21,7 +21,7 @@ |
1163 | |
1164 | #include <mir_toolkit/common.h> |
1165 | |
1166 | -#include <miral/detail/mir_forward_compatibility.h> |
1167 | +#include <mir/client/detail/mir_forward_compatibility.h> |
1168 | |
1169 | #include <mir/geometry/displacement.h> |
1170 | #include <mir/geometry/rectangles.h> |
1171 | |
1172 | === modified file 'miral-kiosk/kiosk_main.cpp' |
1173 | --- miral-kiosk/kiosk_main.cpp 2016-11-08 10:44:17 +0000 |
1174 | +++ miral-kiosk/kiosk_main.cpp 2017-02-15 14:04:27 +0000 |
1175 | @@ -89,6 +89,8 @@ |
1176 | |
1177 | return MirRunner{argc, argv}.run_with( |
1178 | { |
1179 | + CommandLineOption{[&](std::string const& ) { }, |
1180 | + "desktop_file_hint", "Ignored for Unity8 compatability", "miral-shell.desktop"}, |
1181 | set_window_managment_policy<KioskWindowManagerPolicy>(splash), |
1182 | SetApplicationAuthorizer<KioskAuthorizer>{splash}, |
1183 | Keymap{}, |
1184 | |
1185 | === modified file 'miral-kiosk/sw_splash.cpp' |
1186 | --- miral-kiosk/sw_splash.cpp 2017-01-24 17:42:26 +0000 |
1187 | +++ miral-kiosk/sw_splash.cpp 2017-02-15 14:04:27 +0000 |
1188 | @@ -18,20 +18,16 @@ |
1189 | |
1190 | #include "sw_splash.h" |
1191 | |
1192 | -#include <miral/detail/mir_forward_compatibility.h> |
1193 | +#include <mir/client/window.h> |
1194 | |
1195 | #include <mir_toolkit/mir_connection.h> |
1196 | -#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
1197 | -#include <mir_toolkit/mir_surface.h> |
1198 | -#else |
1199 | -#include <mir_toolkit/mir_window.h> |
1200 | -#endif |
1201 | #include <mir_toolkit/mir_buffer_stream.h> |
1202 | |
1203 | #include <chrono> |
1204 | #include <cstring> |
1205 | #include <thread> |
1206 | #include <mutex> |
1207 | +#include <mir/client/window_spec.h> |
1208 | |
1209 | namespace |
1210 | { |
1211 | @@ -67,28 +63,12 @@ |
1212 | |
1213 | auto create_window(MirConnection* connection, MirPixelFormat pixel_format) -> MirWindow* |
1214 | { |
1215 | -#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
1216 | - auto* spec = mir_connection_create_spec_for_normal_surface(connection, 42, 42, pixel_format); |
1217 | - |
1218 | - mir_surface_spec_set_name(spec, "splash"); |
1219 | - mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_software); |
1220 | - mir_surface_spec_set_fullscreen_on_output(spec, 0); |
1221 | - |
1222 | - auto const surface = mir_surface_create_sync(spec); |
1223 | - mir_surface_spec_release(spec); |
1224 | -#else |
1225 | - auto* spec = mir_create_normal_window_spec(connection, 42, 42); |
1226 | - |
1227 | - mir_window_spec_set_name(spec, "splash"); |
1228 | - mir_window_spec_set_buffer_usage(spec, mir_buffer_usage_software); |
1229 | - mir_window_spec_set_fullscreen_on_output(spec, 0); |
1230 | - mir_window_spec_set_pixel_format(spec, pixel_format); |
1231 | - |
1232 | - auto const surface = mir_create_window_sync(spec); |
1233 | - mir_window_spec_release(spec); |
1234 | -#endif |
1235 | - |
1236 | - return surface; |
1237 | + auto const spec = mir::client::WindowSpec::for_normal_window(connection, 42, 42, pixel_format) |
1238 | + .set_name("splash") |
1239 | + .set_buffer_usage(mir_buffer_usage_software) |
1240 | + .set_fullscreen_on_output(0); |
1241 | + |
1242 | + return mir_create_window_sync(spec); |
1243 | } |
1244 | |
1245 | void render_pattern(MirGraphicsRegion *region, uint8_t pattern[]) |
1246 | @@ -153,11 +133,7 @@ |
1247 | auto const surface = create_window(connection, pixel_format); |
1248 | |
1249 | MirGraphicsRegion graphics_region; |
1250 | -#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
1251 | - MirBufferStream* buffer_stream = mir_surface_get_buffer_stream(surface); |
1252 | -#else |
1253 | MirBufferStream* buffer_stream = mir_window_get_buffer_stream(surface); |
1254 | -#endif |
1255 | |
1256 | auto const time_limit = std::chrono::steady_clock::now() + std::chrono::seconds(2); |
1257 | |
1258 | @@ -175,9 +151,5 @@ |
1259 | } |
1260 | while (std::chrono::steady_clock::now() < time_limit); |
1261 | |
1262 | -#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
1263 | - mir_surface_release_sync(surface); |
1264 | -#else |
1265 | mir_window_release_sync(surface); |
1266 | -#endif |
1267 | } |
1268 | |
1269 | === modified file 'miral-shell/miral-app.sh' |
1270 | --- miral-shell/miral-app.sh 2016-12-14 15:35:50 +0000 |
1271 | +++ miral-shell/miral-app.sh 2017-02-15 14:04:27 +0000 |
1272 | @@ -3,7 +3,7 @@ |
1273 | miral_server=miral-shell |
1274 | launcher='gnome-terminal --app-id com.canonical.miral.Terminal' |
1275 | hostsocket= |
1276 | -bindir= |
1277 | +bindir=$(dirname $0) |
1278 | |
1279 | if [ -n "${MIR_SOCKET}" ] |
1280 | then |
1281 | @@ -23,22 +23,24 @@ |
1282 | if [ "$1" == "--help" -o "$1" == "-h" ] |
1283 | then |
1284 | echo "$(basename $0) - Handy launch script for a hosted miral \"desktop session\"" |
1285 | - echo "Usage: $0 [options] [shell options]" |
1286 | + echo "Usage: $(basename $0) [options] [shell options]" |
1287 | echo "Options are:" |
1288 | echo " -kiosk use miral-kiosk instead of ${miral_server}" |
1289 | echo " -launcher <launcher> use <launcher> instead of '${launcher}'" |
1290 | echo " -socket <socket> set the mir socket [${socket}]" |
1291 | - echo " -bindir <bindir> path to the miral executable" |
1292 | + echo " -bindir <bindir> path to the miral executable [${bindir}]" |
1293 | exit 0 |
1294 | elif [ "$1" == "-kiosk" ]; then miral_server=miral-kiosk |
1295 | elif [ "$1" == "-launcher" ]; then shift; launcher=$1 |
1296 | elif [ "$1" == "-socket" ]; then shift; socket=$1 |
1297 | - elif [ "$1" == "-bindir" ]; then shift; bindir=$1/ |
1298 | + elif [ "$1" == "-bindir" ]; then shift; bindir=$1 |
1299 | elif [ "${1:0:2}" == "--" ]; then break |
1300 | fi |
1301 | shift |
1302 | done |
1303 | |
1304 | +if [ "${bindir}" != "" ]; then bindir="${bindir}/"; fi |
1305 | + |
1306 | if [ -e "${socket}" ]; then echo "Error: session endpoint '${socket}' already exists"; exit 1 ;fi |
1307 | |
1308 | sh -c "${bindir}${miral_server} $* ${hostsocket} --file ${socket} --desktop_file_hint=miral-shell.desktop"& |
1309 | |
1310 | === modified file 'miral-shell/miral-desktop.sh' |
1311 | --- miral-shell/miral-desktop.sh 2016-11-17 10:44:33 +0000 |
1312 | +++ miral-shell/miral-desktop.sh 2017-02-15 14:04:27 +0000 |
1313 | @@ -3,7 +3,7 @@ |
1314 | socket=${XDG_RUNTIME_DIR}/mir_socket |
1315 | miral_server=miral-shell |
1316 | launcher='gnome-terminal --app-id com.canonical.miral.Terminal' |
1317 | -bindir= |
1318 | +bindir=$(dirname $0) |
1319 | vt=4 |
1320 | |
1321 | while [ $# -gt 0 ] |
1322 | @@ -11,13 +11,13 @@ |
1323 | if [ "$1" == "--help" -o "$1" == "-h" ] |
1324 | then |
1325 | echo "$(basename $0) - Handy launch script for a miral \"desktop session\"" |
1326 | - echo "Usage: $0 [options] [shell options]" |
1327 | + echo "Usage: $(basename $0) [options] [shell options]" |
1328 | echo "Options are:" |
1329 | echo " -kiosk use miral-kiosk instead of ${miral_server}" |
1330 | echo " -launcher <launcher> use <launcher> instead of '${launcher}'" |
1331 | echo " -vt <termid> set the virtual terminal [${vt}]" |
1332 | echo " -socket <socket> set the mir socket [${socket}]" |
1333 | - echo " -bindir <bindir> path to the miral executable" |
1334 | + echo " -bindir <bindir> path to the miral executable [${bindir}]" |
1335 | exit 0 |
1336 | elif [ "$1" == "-kiosk" ]; then miral_server=miral-kiosk |
1337 | elif [ "$1" == "-launcher" ]; then shift; launcher=$1 |
1338 | @@ -29,6 +29,8 @@ |
1339 | shift |
1340 | done |
1341 | |
1342 | +if [ "${bindir}" != "" ]; then bindir="${bindir}/"; fi |
1343 | + |
1344 | if [ -e "${socket}" ]; then echo "Error: '${socket}' already exists"; exit 1 ;fi |
1345 | |
1346 | sudo ls >> /dev/null |
1347 | |
1348 | === modified file 'miral-shell/spinner/miregl.cpp' |
1349 | --- miral-shell/spinner/miregl.cpp 2017-01-17 17:20:56 +0000 |
1350 | +++ miral-shell/spinner/miregl.cpp 2017-02-15 14:04:27 +0000 |
1351 | @@ -15,11 +15,14 @@ |
1352 | */ |
1353 | |
1354 | #include "miregl.h" |
1355 | +#include <mir/client/window_spec.h> |
1356 | #include <mir_toolkit/version.h> |
1357 | |
1358 | #include <cstring> |
1359 | |
1360 | #include <GLES2/gl2.h> |
1361 | +#include <miral/window_specification.h> |
1362 | +#include <mir/client/window_spec.h> |
1363 | |
1364 | class MirEglApp |
1365 | { |
1366 | @@ -59,59 +62,34 @@ |
1367 | |
1368 | namespace |
1369 | { |
1370 | -MirWindow* create_surface(MirConnection* const connection, MirWindowParameters const& parameters) |
1371 | +MirWindow* create_window(MirConnection* const connection, MirWindowParameters const& parameters) |
1372 | { |
1373 | -#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
1374 | - auto const spec = mir_connection_create_spec_for_normal_surface( |
1375 | - connection, |
1376 | - parameters.width, |
1377 | - parameters.height, |
1378 | - parameters.pixel_format); |
1379 | - |
1380 | - mir_surface_spec_set_name(spec, parameters.name); |
1381 | - mir_surface_spec_set_buffer_usage(spec, parameters.buffer_usage); |
1382 | - |
1383 | - if (!parameters.width && !parameters.height) |
1384 | - mir_surface_spec_set_fullscreen_on_output(spec, parameters.output_id); |
1385 | - |
1386 | - auto const surface = mir_surface_create_sync(spec); |
1387 | - mir_surface_spec_release(spec); |
1388 | - |
1389 | - if (!mir_surface_is_valid(surface)) |
1390 | - throw std::runtime_error(std::string("Can't create a surface ") + mir_surface_get_error_message(surface)); |
1391 | - |
1392 | - if (parameters.output_id != mir_display_output_id_invalid) |
1393 | - mir_surface_set_state(surface, mir_surface_state_fullscreen); |
1394 | -#else |
1395 | - auto const spec = mir_create_normal_window_spec( |
1396 | - connection, |
1397 | - parameters.width, |
1398 | - parameters.height); |
1399 | - |
1400 | - mir_window_spec_set_pixel_format(spec, parameters.pixel_format); |
1401 | - mir_window_spec_set_name(spec, parameters.name); |
1402 | - mir_window_spec_set_buffer_usage(spec, parameters.buffer_usage); |
1403 | - |
1404 | - if (!parameters.width && !parameters.height) |
1405 | - mir_window_spec_set_fullscreen_on_output(spec, parameters.output_id); |
1406 | - |
1407 | - auto const surface = mir_create_window_sync(spec); |
1408 | - mir_window_spec_release(spec); |
1409 | - |
1410 | - if (!mir_window_is_valid(surface)) |
1411 | - throw std::runtime_error(std::string("Can't create a surface ") + mir_window_get_error_message(surface)); |
1412 | - |
1413 | - if (parameters.output_id != mir_display_output_id_invalid) |
1414 | - mir_window_set_state(surface, mir_window_state_fullscreen); |
1415 | -#endif |
1416 | - return surface; |
1417 | + |
1418 | + auto spec = mir::client::WindowSpec::for_normal_window( |
1419 | + connection, parameters.width, parameters.height, parameters.pixel_format) |
1420 | + .set_name(parameters.name) |
1421 | + .set_buffer_usage(parameters.buffer_usage); |
1422 | + |
1423 | + |
1424 | + if (!parameters.width && !parameters.height) |
1425 | + spec.set_fullscreen_on_output(parameters.output_id); |
1426 | + |
1427 | + auto const window = mir_create_window_sync(spec); |
1428 | + |
1429 | + if (!mir_window_is_valid(window)) |
1430 | + throw std::runtime_error(std::string("Can't create a window ") + mir_window_get_error_message(window)); |
1431 | + |
1432 | + if (parameters.output_id != mir_display_output_id_invalid) |
1433 | + mir_window_set_state(window, mir_window_state_fullscreen); |
1434 | + |
1435 | + return window; |
1436 | } |
1437 | } |
1438 | |
1439 | MirEglSurface::MirEglSurface( |
1440 | std::shared_ptr<MirEglApp> const& mir_egl_app, MirWindowParameters const& parm, int swapinterval) : |
1441 | mir_egl_app{mir_egl_app}, |
1442 | - window{create_surface(mir_egl_app->connection, parm)}, |
1443 | + window{create_window(mir_egl_app->connection, parm)}, |
1444 | eglsurface{mir_egl_app->create_surface(window)}, |
1445 | width_{0}, |
1446 | height_{0} |
1447 | @@ -122,11 +100,7 @@ |
1448 | MirEglSurface::~MirEglSurface() |
1449 | { |
1450 | mir_egl_app->destroy_surface(eglsurface); |
1451 | -#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
1452 | - mir_surface_release_sync(window); |
1453 | -#else |
1454 | mir_window_release_sync(window); |
1455 | -#endif |
1456 | } |
1457 | |
1458 | void MirEglSurface::egl_make_current() |
1459 | @@ -212,17 +186,10 @@ |
1460 | |
1461 | EGLSurface MirEglApp::create_surface(MirWindow* window) |
1462 | { |
1463 | -#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
1464 | - auto const eglsurface = eglCreateWindowSurface( |
1465 | - egldisplay, |
1466 | - eglconfig, |
1467 | - (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window(mir_surface_get_buffer_stream(window)), NULL); |
1468 | -#else |
1469 | auto const eglsurface = eglCreateWindowSurface( |
1470 | egldisplay, |
1471 | eglconfig, |
1472 | (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window(mir_window_get_buffer_stream(window)), NULL); |
1473 | -#endif |
1474 | |
1475 | if (eglsurface == EGL_NO_SURFACE) |
1476 | throw std::runtime_error("eglCreateWindowSurface failed"); |
1477 | |
1478 | === modified file 'miral-shell/spinner/miregl.h' |
1479 | --- miral-shell/spinner/miregl.h 2017-01-17 17:10:52 +0000 |
1480 | +++ miral-shell/spinner/miregl.h 2017-02-15 14:04:27 +0000 |
1481 | @@ -17,7 +17,7 @@ |
1482 | #ifndef UNITYSYSTEMCOMPOSITOR_MIREGL_H |
1483 | #define UNITYSYSTEMCOMPOSITOR_MIREGL_H |
1484 | |
1485 | -#include <miral/detail/mir_forward_compatibility.h> |
1486 | +#include <mir/client/detail/mir_forward_compatibility.h> |
1487 | #include <mir_toolkit/client_types.h> |
1488 | #include "mir_toolkit/mir_client_library.h" |
1489 | |
1490 | |
1491 | === modified file 'miral-shell/titlebar_provider.cpp' |
1492 | --- miral-shell/titlebar_provider.cpp 2017-01-26 15:11:27 +0000 |
1493 | +++ miral-shell/titlebar_provider.cpp 2017-02-15 14:04:27 +0000 |
1494 | @@ -19,7 +19,7 @@ |
1495 | #include "titlebar_provider.h" |
1496 | #include "titlebar_config.h" |
1497 | |
1498 | -#include <miral/toolkit/window_spec.h> |
1499 | +#include <mir/client/window_spec.h> |
1500 | |
1501 | #include <mir_toolkit/mir_buffer_stream.h> |
1502 | |
1503 | @@ -154,7 +154,7 @@ |
1504 | } |
1505 | } |
1506 | |
1507 | -using namespace miral::toolkit; |
1508 | +using namespace mir::client; |
1509 | using namespace mir::geometry; |
1510 | |
1511 | TitlebarProvider::TitlebarProvider(miral::WindowManagerTools const& tools) : tools{tools} |
1512 | @@ -182,7 +182,7 @@ |
1513 | }); |
1514 | } |
1515 | |
1516 | -void TitlebarProvider::operator()(miral::toolkit::Connection connection) |
1517 | +void TitlebarProvider::operator()(mir::client::Connection connection) |
1518 | { |
1519 | this->connection = connection; |
1520 | start_work(); |
1521 | @@ -208,7 +208,7 @@ |
1522 | |
1523 | buffer << std::shared_ptr<mir::scene::Surface>(window).get(); |
1524 | |
1525 | - auto const spec = WindowSpec::for_normal_surface( |
1526 | + auto const spec = WindowSpec::for_normal_window( |
1527 | connection, window.size().width.as_int(), title_bar_height, mir_pixel_format_xrgb_8888) |
1528 | .set_buffer_usage(mir_buffer_usage_software) |
1529 | .set_type(mir_window_type_gloss) |
1530 | @@ -216,7 +216,7 @@ |
1531 | |
1532 | std::lock_guard<decltype(mutex)> lock{mutex}; |
1533 | windows_awaiting_titlebar[buffer.str()] = window; |
1534 | - spec.create_surface(insert, &window_to_titlebar[window]); |
1535 | + spec.create_window(insert, &window_to_titlebar[window]); |
1536 | }); |
1537 | } |
1538 | |
1539 | |
1540 | === modified file 'miral-shell/titlebar_provider.h' |
1541 | --- miral-shell/titlebar_provider.h 2017-01-17 16:42:33 +0000 |
1542 | +++ miral-shell/titlebar_provider.h 2017-02-15 14:04:27 +0000 |
1543 | @@ -28,7 +28,7 @@ |
1544 | #include <atomic> |
1545 | #include <map> |
1546 | #include <mutex> |
1547 | -#include <miral/toolkit/connection.h> |
1548 | +#include <mir/client/connection.h> |
1549 | #include <thread> |
1550 | #include <condition_variable> |
1551 | #include <queue> |
1552 | @@ -60,7 +60,7 @@ |
1553 | TitlebarProvider(miral::WindowManagerTools const& tools); |
1554 | ~TitlebarProvider(); |
1555 | |
1556 | - void operator()(miral::toolkit::Connection connection); |
1557 | + void operator()(mir::client::Connection connection); |
1558 | void operator()(std::weak_ptr<mir::scene::Session> const& session); |
1559 | |
1560 | auto session() const -> std::shared_ptr<mir::scene::Session>; |
1561 | @@ -90,7 +90,7 @@ |
1562 | |
1563 | miral::WindowManagerTools tools; |
1564 | std::mutex mutable mutex; |
1565 | - miral::toolkit::Connection connection; |
1566 | + mir::client::Connection connection; |
1567 | std::weak_ptr<mir::scene::Session> weak_session; |
1568 | std::atomic<int> intensity{0xff}; |
1569 | |
1570 | |
1571 | === modified file 'miral/CMakeLists.txt' |
1572 | --- miral/CMakeLists.txt 2017-01-26 15:51:25 +0000 |
1573 | +++ miral/CMakeLists.txt 2017-02-15 14:04:27 +0000 |
1574 | @@ -51,11 +51,11 @@ |
1575 | set_window_managment_policy.cpp ${CMAKE_SOURCE_DIR}/include/miral/set_window_managment_policy.h |
1576 | window_management_policy.cpp ${CMAKE_SOURCE_DIR}/include/miral/window_management_policy.h |
1577 | window_manager_tools.cpp ${CMAKE_SOURCE_DIR}/include/miral/window_manager_tools.h |
1578 | - ${CMAKE_SOURCE_DIR}/include/miral/toolkit/window_spec.h |
1579 | - ${CMAKE_SOURCE_DIR}/include/miral/toolkit/persistent_id.h |
1580 | - ${CMAKE_SOURCE_DIR}/include/miral/toolkit/connection.h |
1581 | - ${CMAKE_SOURCE_DIR}/include/miral/toolkit/window.h |
1582 | - ${CMAKE_SOURCE_DIR}/include/miral/detail/mir_forward_compatibility.h |
1583 | + ${CMAKE_SOURCE_DIR}/include/mir/client/window_spec.h |
1584 | + ${CMAKE_SOURCE_DIR}/include/mir/client/window_id.h |
1585 | + ${CMAKE_SOURCE_DIR}/include/mir/client/connection.h |
1586 | + ${CMAKE_SOURCE_DIR}/include/mir/client/window.h |
1587 | + ${CMAKE_SOURCE_DIR}/include/mir/client/detail/mir_forward_compatibility.h |
1588 | ) |
1589 | |
1590 | target_link_libraries(miral |
1591 | @@ -74,7 +74,6 @@ |
1592 | LINK_DEPENDS ${symbol_map} |
1593 | ) |
1594 | |
1595 | - |
1596 | add_custom_target(check-symbols ALL |
1597 | DEPENDS miral ${PROJECT_SOURCE_DIR}/debian/libmiral${MIRAL_ABI}.symbols |
1598 | COMMAND dpkg-gensymbols -e${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libmiral.so.${MIRAL_ABI} -plibmiral${MIRAL_ABI} | scripts/filter_symbols_diff.sh |
1599 | @@ -90,6 +89,11 @@ |
1600 | @ONLY |
1601 | ) |
1602 | |
1603 | +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mirclientcpp.pc.in |
1604 | + ${CMAKE_CURRENT_BINARY_DIR}/mirclientcpp.pc |
1605 | + @ONLY |
1606 | +) |
1607 | + |
1608 | if (MIRSERVER_VERSION VERSION_LESS 0.24) |
1609 | set(MIR_POINTER_CONFINEMENT 0) |
1610 | else() |
1611 | @@ -98,7 +102,7 @@ |
1612 | |
1613 | configure_file( |
1614 | ${CMAKE_CURRENT_SOURCE_DIR}/mir_features.h.in |
1615 | - ${PROJECT_SOURCE_DIR}/include/miral/detail/mir_features.h |
1616 | + ${PROJECT_SOURCE_DIR}/include/mir/client/detail/mir_features.h |
1617 | ) |
1618 | |
1619 | configure_file( |
1620 | @@ -106,6 +110,7 @@ |
1621 | ${PROJECT_SOURCE_DIR}/include/miral/version.h |
1622 | ) |
1623 | |
1624 | -install(TARGETS miral LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}") |
1625 | -install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION "${INCLUDEDIR}") |
1626 | -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/miral.pc DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") |
1627 | +install(TARGETS miral LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}") |
1628 | +install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION "${INCLUDEDIR}") |
1629 | +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/miral.pc |
1630 | + ${CMAKE_CURRENT_BINARY_DIR}/mirclientcpp.pc DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") |
1631 | |
1632 | === modified file 'miral/application_authorizer.cpp' |
1633 | --- miral/application_authorizer.cpp 2016-06-07 13:49:47 +0000 |
1634 | +++ miral/application_authorizer.cpp 2017-02-15 14:04:27 +0000 |
1635 | @@ -21,6 +21,7 @@ |
1636 | #include <mir/frontend/session_credentials.h> |
1637 | #include <mir/frontend/session_authorizer.h> |
1638 | #include <mir/server.h> |
1639 | +#include <mir/version.h> |
1640 | |
1641 | namespace mf = mir::frontend; |
1642 | |
1643 | @@ -29,7 +30,9 @@ |
1644 | struct SessionAuthorizerAdapter : mf::SessionAuthorizer |
1645 | { |
1646 | SessionAuthorizerAdapter(std::shared_ptr<miral::ApplicationAuthorizer> const& app_auth) : |
1647 | - app_auth{app_auth} {} |
1648 | + app_auth{app_auth}, |
1649 | + a1{dynamic_cast<miral::ApplicationAuthorizer1*>(app_auth.get())} |
1650 | + {} |
1651 | |
1652 | virtual bool connection_is_allowed(mf::SessionCredentials const& creds) override |
1653 | { |
1654 | @@ -56,7 +59,20 @@ |
1655 | return app_auth->prompt_session_is_allowed(creds); |
1656 | } |
1657 | |
1658 | +#if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 27, 0) |
1659 | + bool configure_input_is_allowed(mf::SessionCredentials const& creds) override |
1660 | + { |
1661 | + return a1 == nullptr || a1->configure_input_is_allowed(creds); |
1662 | + } |
1663 | + |
1664 | + bool set_base_input_configuration_is_allowed(mf::SessionCredentials const& creds) override |
1665 | + { |
1666 | + return a1 == nullptr || a1->set_base_input_configuration_is_allowed(creds); |
1667 | + } |
1668 | +#endif |
1669 | + |
1670 | std::shared_ptr<miral::ApplicationAuthorizer> const app_auth; |
1671 | + miral::ApplicationAuthorizer1* const a1; |
1672 | }; |
1673 | } |
1674 | |
1675 | |
1676 | === modified file 'miral/basic_window_manager.cpp' |
1677 | --- miral/basic_window_manager.cpp 2017-01-26 15:51:25 +0000 |
1678 | +++ miral/basic_window_manager.cpp 2017-02-15 14:04:27 +0000 |
1679 | @@ -560,6 +560,7 @@ |
1680 | COPY_IF_SET(preferred_orientation); |
1681 | COPY_IF_SET(confine_pointer); |
1682 | COPY_IF_SET(userdata); |
1683 | + COPY_IF_SET(shell_chrome); |
1684 | |
1685 | #undef COPY_IF_SET |
1686 | |
1687 | @@ -999,6 +1000,11 @@ |
1688 | { |
1689 | auto const window = active_window(); |
1690 | |
1691 | + drag_window(window, movement); |
1692 | +} |
1693 | + |
1694 | +void miral::BasicWindowManager::drag_window(miral::Window const& window, Displacement& movement) |
1695 | +{ |
1696 | if (!window) |
1697 | return; |
1698 | |
1699 | |
1700 | === modified file 'miral/basic_window_manager.h' |
1701 | --- miral/basic_window_manager.h 2017-01-13 18:17:01 +0000 |
1702 | +++ miral/basic_window_manager.h 2017-02-15 14:04:27 +0000 |
1703 | @@ -120,6 +120,8 @@ |
1704 | |
1705 | void drag_active_window(mir::geometry::Displacement movement) override; |
1706 | |
1707 | + void drag_window(Window const& window, Displacement& movement) override; |
1708 | + |
1709 | void focus_next_application() override; |
1710 | |
1711 | void focus_next_within_application() override; |
1712 | |
1713 | === modified file 'miral/both_versions.h' |
1714 | --- miral/both_versions.h 2017-01-26 12:30:52 +0000 |
1715 | +++ miral/both_versions.h 2017-02-15 14:04:27 +0000 |
1716 | @@ -21,28 +21,18 @@ |
1717 | |
1718 | #include <mir/version.h> |
1719 | |
1720 | +#define MIRAL_FAKE_OLD_SYMBOL(old_sym, new_sym)\ |
1721 | + extern "C" __attribute__((alias(#new_sym))) void old_sym(); |
1722 | + |
1723 | +#define MIRAL_FAKE_NEW_SYMBOL(old_sym, new_sym)\ |
1724 | + extern "C" __attribute__((alias(#old_sym))) void new_sym(); |
1725 | + |
1726 | #if (MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 26, 0)) |
1727 | - #ifndef __clang__ |
1728 | - #define MIRAL_BOTH_VERSIONS(old_sym, old_version, new_sym, new_version)\ |
1729 | - extern "C" __attribute__((alias(#new_sym))) void old_sym();\ |
1730 | - __asm__(".symver old_sym,old_sym@" #old_version);\ |
1731 | - __asm__(".symver new_sym,new_sym@@" #new_version); |
1732 | - #else |
1733 | - #define MIRAL_BOTH_VERSIONS(old_sym, old_version, new_sym, new_version)\ |
1734 | - __asm__(".symver new_sym,old_sym@" #old_version);\ |
1735 | - __asm__(".symver new_sym,new_sym@@@" #new_version); |
1736 | - #endif |
1737 | + #define MIRAL_BOTH_VERSIONS(old_sym, new_sym)\ |
1738 | + MIRAL_FAKE_OLD_SYMBOL(old_sym, new_sym) |
1739 | #else |
1740 | - #ifndef __clang__ |
1741 | - #define MIRAL_BOTH_VERSIONS(old_sym, old_version, new_sym, new_version)\ |
1742 | - extern "C" __attribute__((alias(#old_sym))) void new_sym();\ |
1743 | - __asm__(".symver old_sym,old_sym@" #old_version);\ |
1744 | - __asm__(".symver new_sym,new_sym@@" #new_version); |
1745 | - #else |
1746 | -#define MIRAL_BOTH_VERSIONS(old_sym, old_version, new_sym, new_version)\ |
1747 | - __asm__(".symver old_sym,old_sym@" #old_version);\ |
1748 | - __asm__(".symver old_sym,new_sym@@@" #new_version); |
1749 | - #endif |
1750 | + #define MIRAL_BOTH_VERSIONS(old_sym, new_sym)\ |
1751 | + MIRAL_FAKE_NEW_SYMBOL(old_sym, new_sym) |
1752 | #endif |
1753 | |
1754 | #endif //MIRAL_BOTH_VERSIONS_H |
1755 | |
1756 | === modified file 'miral/internal_client.cpp' |
1757 | --- miral/internal_client.cpp 2016-06-17 16:04:02 +0000 |
1758 | +++ miral/internal_client.cpp 2017-02-15 14:04:27 +0000 |
1759 | @@ -17,6 +17,7 @@ |
1760 | */ |
1761 | |
1762 | #include "miral/internal_client.h" |
1763 | +#include "both_versions.h" |
1764 | |
1765 | #include <mir/fd.h> |
1766 | #include <mir/server.h> |
1767 | @@ -34,7 +35,7 @@ |
1768 | { |
1769 | public: |
1770 | InternalClientRunner(std::string name, |
1771 | - std::function<void(miral::toolkit::Connection connection)> client_code, |
1772 | + std::function<void(mir::client::Connection connection)> client_code, |
1773 | std::function<void(std::weak_ptr<mir::scene::Session> const session)> connect_notification); |
1774 | |
1775 | void run(mir::Server& server); |
1776 | @@ -47,8 +48,8 @@ |
1777 | std::condition_variable mutable cv; |
1778 | mir::Fd fd; |
1779 | std::weak_ptr<mir::scene::Session> session; |
1780 | - miral::toolkit::Connection connection; |
1781 | - std::function<void(miral::toolkit::Connection connection)> const client_code; |
1782 | + mir::client::Connection connection; |
1783 | + std::function<void(mir::client::Connection connection)> const client_code; |
1784 | std::function<void(std::weak_ptr<mir::scene::Session> const session)> connect_notification; |
1785 | }; |
1786 | } |
1787 | @@ -62,7 +63,7 @@ |
1788 | |
1789 | InternalClientRunner::InternalClientRunner( |
1790 | std::string const name, |
1791 | - std::function<void(miral::toolkit::Connection connection)> client_code, |
1792 | + std::function<void(mir::client::Connection connection)> client_code, |
1793 | std::function<void(std::weak_ptr<mir::scene::Session> const session)> connect_notification) : |
1794 | name(name), |
1795 | client_code(std::move(client_code)), |
1796 | @@ -83,7 +84,7 @@ |
1797 | char connect_string[64] = {0}; |
1798 | sprintf(connect_string, "fd://%d", fd.operator int()); |
1799 | |
1800 | - connection = miral::toolkit::Connection{mir_connect_sync(connect_string, name.c_str())}; |
1801 | + connection = mir::client::Connection{mir_connect_sync(connect_string, name.c_str())}; |
1802 | |
1803 | std::unique_lock<decltype(mutex)> lock{mutex}; |
1804 | cv.wait(lock, [&] { return !!session.lock(); }); |
1805 | @@ -103,9 +104,19 @@ |
1806 | } |
1807 | } |
1808 | |
1809 | +#ifndef __clang__ |
1810 | +MIRAL_FAKE_OLD_SYMBOL( |
1811 | + _ZN5miral21StartupInternalClientC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvNS_7toolkit10ConnectionEEES7_IFvSt8weak_ptrIN3mir5scene7SessionEEEE, |
1812 | + _ZN5miral21StartupInternalClientC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvN3mir6client10ConnectionEEES7_IFvSt8weak_ptrINS8_5scene7SessionEEEE) |
1813 | +#else |
1814 | +MIRAL_FAKE_OLD_SYMBOL( |
1815 | + _ZN5miral21StartupInternalClientC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvNS_7toolkit10ConnectionEEES7_IFvSt8weak_ptrIN3mir5scene7SessionEEEE, |
1816 | + _ZN5miral21StartupInternalClientC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvN3mir6client10ConnectionEEES7_IFvSt8weak_ptrINS8_5scene7SessionEEEE) |
1817 | +// clang emits a different symbol ---^ |
1818 | +#endif |
1819 | miral::StartupInternalClient::StartupInternalClient( |
1820 | std::string name, |
1821 | - std::function<void(toolkit::Connection connection)> client_code, |
1822 | + std::function<void(mir::client::Connection connection)> client_code, |
1823 | std::function<void(std::weak_ptr<mir::scene::Session> const session)> connect_notification) : |
1824 | internal_client(std::make_shared<Self>(std::move(name), std::move(client_code), std::move(connect_notification))) |
1825 | { |
1826 | @@ -135,9 +146,13 @@ |
1827 | self->server = &server; |
1828 | } |
1829 | |
1830 | + |
1831 | +MIRAL_FAKE_OLD_SYMBOL( |
1832 | + _ZNK5miral22InternalClientLauncher6launchERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt8functionIFvNS_7toolkit10ConnectionEEERKS9_IFvSt8weak_ptrIN3mir5scene7SessionEEEE, |
1833 | + _ZNK5miral22InternalClientLauncher6launchERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt8functionIFvN3mir6client10ConnectionEEERKS9_IFvSt8weak_ptrINSA_5scene7SessionEEEE) |
1834 | void miral::InternalClientLauncher::launch( |
1835 | std::string const& name, |
1836 | - std::function<void(toolkit::Connection connection)> const& client_code, |
1837 | + std::function<void(mir::client::Connection connection)> const& client_code, |
1838 | std::function<void(std::weak_ptr<mir::scene::Session> const session)> const& connect_notification) const |
1839 | { |
1840 | self->runner = std::make_unique<InternalClientRunner>(name, client_code, connect_notification); |
1841 | |
1842 | === modified file 'miral/miral.pc.in' |
1843 | --- miral/miral.pc.in 2016-04-28 13:42:44 +0000 |
1844 | +++ miral/miral.pc.in 2017-02-15 14:04:27 +0000 |
1845 | @@ -4,6 +4,6 @@ |
1846 | Name: miral |
1847 | Description: Mir Abstraction Layer library |
1848 | Version: @MIRAL_VERSION@ |
1849 | -Requires: mirclient |
1850 | +Requires: mirclientcpp |
1851 | Libs: -L${libdir} -lmiral |
1852 | Cflags: -I${includedir} |
1853 | |
1854 | === added file 'miral/mirclientcpp.pc.in' |
1855 | --- miral/mirclientcpp.pc.in 1970-01-01 00:00:00 +0000 |
1856 | +++ miral/mirclientcpp.pc.in 2017-02-15 14:04:27 +0000 |
1857 | @@ -0,0 +1,7 @@ |
1858 | +includedir=@INCLUDEDIR@ |
1859 | + |
1860 | +Name: mirclientcpp |
1861 | +Description: Mir Abstraction Layer C++ wrapper for mirclient |
1862 | +Version: @MIRAL_VERSION@ |
1863 | +Requires: mirclient |
1864 | +Cflags: -I${includedir} |
1865 | |
1866 | === modified file 'miral/mru_window_list.cpp' |
1867 | --- miral/mru_window_list.cpp 2016-06-07 14:41:51 +0000 |
1868 | +++ miral/mru_window_list.cpp 2017-02-15 14:04:27 +0000 |
1869 | @@ -22,23 +22,23 @@ |
1870 | |
1871 | void miral::MRUWindowList::push(Window const& window) |
1872 | { |
1873 | - surfaces.erase(remove(begin(surfaces), end(surfaces), window), end(surfaces)); |
1874 | - surfaces.push_back(window); |
1875 | + windows.erase(remove(begin(windows), end(windows), window), end(windows)); |
1876 | + windows.push_back(window); |
1877 | } |
1878 | |
1879 | void miral::MRUWindowList::erase(Window const& window) |
1880 | { |
1881 | - surfaces.erase(remove(begin(surfaces), end(surfaces), window), end(surfaces)); |
1882 | + windows.erase(remove(begin(windows), end(windows), window), end(windows)); |
1883 | } |
1884 | |
1885 | auto miral::MRUWindowList::top() const -> Window |
1886 | { |
1887 | - return (!surfaces.empty()) ? surfaces.back() : Window{}; |
1888 | + return (!windows.empty()) ? windows.back() : Window{}; |
1889 | } |
1890 | |
1891 | void miral::MRUWindowList::enumerate(Enumerator const& enumerator) const |
1892 | { |
1893 | - for (auto i = surfaces.rbegin(); i != surfaces.rend(); ++i) |
1894 | + for (auto i = windows.rbegin(); i != windows.rend(); ++i) |
1895 | if (!enumerator(const_cast<Window&>(*i))) |
1896 | break; |
1897 | } |
1898 | |
1899 | === modified file 'miral/mru_window_list.h' |
1900 | --- miral/mru_window_list.h 2016-06-07 14:41:51 +0000 |
1901 | +++ miral/mru_window_list.h 2017-02-15 14:04:27 +0000 |
1902 | @@ -39,7 +39,7 @@ |
1903 | void enumerate(Enumerator const& enumerator) const; |
1904 | |
1905 | private: |
1906 | - std::vector<Window> surfaces; |
1907 | + std::vector<Window> windows; |
1908 | }; |
1909 | } |
1910 | |
1911 | |
1912 | === modified file 'miral/symbols.map' |
1913 | --- miral/symbols.map 2017-01-26 11:30:51 +0000 |
1914 | +++ miral/symbols.map 2017-02-15 14:04:27 +0000 |
1915 | @@ -59,7 +59,6 @@ |
1916 | miral::DebugExtension::operator*; |
1917 | miral::InternalClientLauncher::?InternalClientLauncher*; |
1918 | miral::InternalClientLauncher::InternalClientLauncher*; |
1919 | - miral::InternalClientLauncher::launch*; |
1920 | miral::InternalClientLauncher::operator*; |
1921 | miral::Keymap::?Keymap*; |
1922 | miral::Keymap::Keymap*; |
1923 | @@ -98,7 +97,6 @@ |
1924 | miral::SetWindowManagmentPolicy::SetWindowManagmentPolicy*; |
1925 | miral::SetWindowManagmentPolicy::operator*; |
1926 | miral::StartupInternalClient::?StartupInternalClient*; |
1927 | - miral::StartupInternalClient::StartupInternalClient*; |
1928 | miral::StartupInternalClient::operator*; |
1929 | miral::Window::?Window*; |
1930 | miral::Window::Window*; |
1931 | @@ -322,6 +320,11 @@ |
1932 | |
1933 | # miral::WindowManagementPolicy::advise_state_change*; |
1934 | _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE15MirSurfaceState; |
1935 | + |
1936 | +# miral::StartupInternalClient::StartupInternalClient*; |
1937 | + _ZN5miral21StartupInternalClientC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvNS_7toolkit10ConnectionEEES7_IFvSt8weak_ptrIN3mir5scene7SessionEEEE; |
1938 | +# miral::InternalClientLauncher::launch*; |
1939 | + _ZNK5miral22InternalClientLauncher6launchERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt8functionIFvNS_7toolkit10ConnectionEEERKS9_IFvSt8weak_ptrIN3mir5scene7SessionEEEE; |
1940 | local: *; |
1941 | }; |
1942 | |
1943 | @@ -349,3 +352,18 @@ |
1944 | non-virtual?thunk?to?miral::CanonicalWindowManagerPolicy::place_new_window*; |
1945 | }; |
1946 | } MIRAL_1.0; |
1947 | + |
1948 | +MIRAL_1.2 { |
1949 | +global: |
1950 | +# miral::InternalClientLauncher::launch*; |
1951 | + _ZNK5miral22InternalClientLauncher6launchERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt8functionIFvN3mir6client10ConnectionEEERKS9_IFvSt8weak_ptrINSA_5scene7SessionEEEE; |
1952 | + |
1953 | +# miral::StartupInternalClient::StartupInternalClient*; |
1954 | + _ZN5miral21StartupInternalClientC?ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvN3mir6client10ConnectionEEES7_IFvSt8weak_ptrINS8_5scene7SessionEEEE; |
1955 | + extern "C++" { |
1956 | + miral::WindowInfo::shell_chrome*; |
1957 | + miral::WindowManagerTools::drag_window*; |
1958 | + typeinfo?for?miral::ApplicationAuthorizer1; |
1959 | + vtable?for?miral::ApplicationAuthorizer1; |
1960 | + }; |
1961 | +} MIRAL_1.1; |
1962 | |
1963 | === modified file 'miral/window_info.cpp' |
1964 | --- miral/window_info.cpp 2017-01-26 12:21:51 +0000 |
1965 | +++ miral/window_info.cpp 2017-02-15 14:04:27 +0000 |
1966 | @@ -61,6 +61,7 @@ |
1967 | AspectRatio min_aspect; |
1968 | AspectRatio max_aspect; |
1969 | mir::optional_value<int> output_id; |
1970 | + MirShellChrome shell_chrome; |
1971 | std::shared_ptr<void> userdata; |
1972 | }; |
1973 | |
1974 | @@ -79,7 +80,8 @@ |
1975 | width_inc{optional_value_or_default(params.width_inc(), DeltaX{1})}, |
1976 | height_inc{optional_value_or_default(params.height_inc(), DeltaY{1})}, |
1977 | min_aspect(optional_value_or_default(params.min_aspect(), AspectRatio{0U, std::numeric_limits<unsigned>::max()})), |
1978 | - max_aspect(optional_value_or_default(params.max_aspect(), AspectRatio{std::numeric_limits<unsigned>::max(), 0U})) |
1979 | + max_aspect(optional_value_or_default(params.max_aspect(), AspectRatio{std::numeric_limits<unsigned>::max(), 0U})), |
1980 | + shell_chrome(optional_value_or_default(params.shell_chrome(), mir_shell_chrome_normal)) |
1981 | { |
1982 | if (params.output_id().is_set()) |
1983 | output_id = params.output_id().value(); |
1984 | @@ -91,7 +93,8 @@ |
1985 | miral::WindowInfo::Self::Self() : |
1986 | type{mir_window_type_normal}, |
1987 | state{mir_window_state_unknown}, |
1988 | - preferred_orientation{mir_orientation_mode_any} |
1989 | + preferred_orientation{mir_orientation_mode_any}, |
1990 | + shell_chrome{mir_shell_chrome_normal} |
1991 | { |
1992 | } |
1993 | |
1994 | @@ -129,12 +132,12 @@ |
1995 | case mir_window_type_normal: /**< AKA "regular" */ |
1996 | case mir_window_type_utility: /**< AKA "floating" */ |
1997 | case mir_window_type_dialog: |
1998 | + case mir_window_type_freestyle: |
1999 | + case mir_window_type_menu: |
2000 | + return true; |
2001 | + |
2002 | case mir_window_type_satellite: /**< AKA "toolbox"/"toolbar" */ |
2003 | - case mir_window_type_freestyle: |
2004 | - case mir_window_type_menu: |
2005 | case mir_window_type_inputmethod: /**< AKA "OSK" or handwriting etc. */ |
2006 | - return true; |
2007 | - |
2008 | case mir_window_type_gloss: |
2009 | case mir_window_type_tip: /**< AKA "tooltip" */ |
2010 | default: |
2011 | @@ -159,8 +162,8 @@ |
2012 | } |
2013 | |
2014 | MIRAL_BOTH_VERSIONS( |
2015 | - _ZNK5miral10WindowInfo12can_morph_toE14MirSurfaceType, MIRAL_1.0, |
2016 | - _ZNK5miral10WindowInfo12can_morph_toE13MirWindowType, MIRAL_1.1) |
2017 | + _ZNK5miral10WindowInfo12can_morph_toE14MirSurfaceType, |
2018 | + _ZNK5miral10WindowInfo12can_morph_toE13MirWindowType) |
2019 | bool miral::WindowInfo::can_morph_to(MirWindowType new_type) const |
2020 | { |
2021 | switch (new_type) |
2022 | @@ -352,8 +355,8 @@ |
2023 | } |
2024 | |
2025 | MIRAL_BOTH_VERSIONS( |
2026 | - _ZN5miral10WindowInfo14needs_titlebarE14MirSurfaceType, MIRAL_1.0, |
2027 | - _ZN5miral10WindowInfo14needs_titlebarE13MirWindowType, MIRAL_1.1) |
2028 | + _ZN5miral10WindowInfo14needs_titlebarE14MirSurfaceType, |
2029 | + _ZN5miral10WindowInfo14needs_titlebarE13MirWindowType) |
2030 | bool miral::WindowInfo::needs_titlebar(MirWindowType type) |
2031 | { |
2032 | switch (type) |
2033 | @@ -376,8 +379,8 @@ |
2034 | } |
2035 | |
2036 | MIRAL_BOTH_VERSIONS( |
2037 | - _ZN5miral10WindowInfo4typeE14MirSurfaceType, MIRAL_1.0, |
2038 | - _ZN5miral10WindowInfo4typeE13MirWindowType, MIRAL_1.1) |
2039 | + _ZN5miral10WindowInfo4typeE14MirSurfaceType, |
2040 | + _ZN5miral10WindowInfo4typeE13MirWindowType) |
2041 | void miral::WindowInfo::type(MirWindowType type) |
2042 | { |
2043 | self->type = type; |
2044 | @@ -389,8 +392,8 @@ |
2045 | } |
2046 | |
2047 | MIRAL_BOTH_VERSIONS( |
2048 | - _ZN5miral10WindowInfo5stateE15MirSurfaceState, MIRAL_1.0, |
2049 | - _ZN5miral10WindowInfo5stateE14MirWindowState, MIRAL_1.1) |
2050 | + _ZN5miral10WindowInfo5stateE15MirSurfaceState, |
2051 | + _ZN5miral10WindowInfo5stateE14MirWindowState) |
2052 | void miral::WindowInfo::state(MirWindowState state) |
2053 | { |
2054 | self->state = state; |
2055 | @@ -570,6 +573,16 @@ |
2056 | self->confine_pointer = confinement; |
2057 | } |
2058 | |
2059 | +auto miral::WindowInfo::shell_chrome() const -> MirShellChrome |
2060 | +{ |
2061 | + return self->shell_chrome; |
2062 | +} |
2063 | + |
2064 | +void miral::WindowInfo::shell_chrome(MirShellChrome chrome) |
2065 | +{ |
2066 | + self->shell_chrome = chrome; |
2067 | +} |
2068 | + |
2069 | auto miral::WindowInfo::name() const -> std::string |
2070 | { |
2071 | return self->name; |
2072 | |
2073 | === modified file 'miral/window_management_policy.cpp' |
2074 | --- miral/window_management_policy.cpp 2017-01-26 12:21:51 +0000 |
2075 | +++ miral/window_management_policy.cpp 2017-02-15 14:04:27 +0000 |
2076 | @@ -28,8 +28,8 @@ |
2077 | void miral::WindowManagementPolicy::advise_focus_gained(WindowInfo const& /*info*/) {} |
2078 | |
2079 | MIRAL_BOTH_VERSIONS( |
2080 | - _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE15MirSurfaceState, MIRAL_1.0, |
2081 | - _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE14MirWindowState, MIRAL_1.1) |
2082 | + _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE15MirSurfaceState, |
2083 | + _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE14MirWindowState) |
2084 | void miral::WindowManagementPolicy::advise_state_change(WindowInfo const& /*window_info*/, MirWindowState /*state*/) {} |
2085 | void miral::WindowManagementPolicy::advise_move_to(WindowInfo const& /*window_info*/, Point /*top_left*/) {} |
2086 | void miral::WindowManagementPolicy::advise_resize(WindowInfo const& /*window_info*/, Size const& /*new_size*/) {} |
2087 | |
2088 | === modified file 'miral/window_management_trace.cpp' |
2089 | --- miral/window_management_trace.cpp 2017-01-26 11:30:51 +0000 |
2090 | +++ miral/window_management_trace.cpp 2017-02-15 14:04:27 +0000 |
2091 | @@ -476,6 +476,17 @@ |
2092 | } |
2093 | MIRAL_TRACE_EXCEPTION |
2094 | |
2095 | +void miral::WindowManagementTrace::drag_window(Window const& window, mir::geometry::Displacement& movement) |
2096 | +try { |
2097 | + log_input(); |
2098 | + std::stringstream out; |
2099 | + out << movement; |
2100 | + mir::log_info("%s window=%s -> %s", __func__, dump_of(window).c_str(), out.str().c_str()); |
2101 | + trace_count++; |
2102 | + wrapped.drag_window(window, movement); |
2103 | +} |
2104 | +MIRAL_TRACE_EXCEPTION |
2105 | + |
2106 | void miral::WindowManagementTrace::focus_next_application() |
2107 | try { |
2108 | log_input(); |
2109 | |
2110 | === modified file 'miral/window_management_trace.h' |
2111 | --- miral/window_management_trace.h 2017-01-26 11:30:51 +0000 |
2112 | +++ miral/window_management_trace.h 2017-02-15 14:04:27 +0000 |
2113 | @@ -61,6 +61,8 @@ |
2114 | |
2115 | virtual void drag_active_window(mir::geometry::Displacement movement) override; |
2116 | |
2117 | + void drag_window(Window const& window, mir::geometry::Displacement& movement) override; |
2118 | + |
2119 | virtual void focus_next_application() override; |
2120 | |
2121 | virtual void focus_next_within_application() override; |
2122 | |
2123 | === modified file 'miral/window_manager_tools.cpp' |
2124 | --- miral/window_manager_tools.cpp 2016-11-03 10:15:24 +0000 |
2125 | +++ miral/window_manager_tools.cpp 2017-02-15 14:04:27 +0000 |
2126 | @@ -62,6 +62,9 @@ |
2127 | void miral::WindowManagerTools::drag_active_window(mir::geometry::Displacement movement) |
2128 | { tools->drag_active_window(movement); } |
2129 | |
2130 | +void miral::WindowManagerTools::drag_window(Window const& window, mir::geometry::Displacement movement) |
2131 | +{ tools->drag_window(window, movement); } |
2132 | + |
2133 | void miral::WindowManagerTools::focus_next_application() |
2134 | { tools->focus_next_application(); } |
2135 | |
2136 | |
2137 | === modified file 'miral/window_manager_tools_implementation.h' |
2138 | --- miral/window_manager_tools_implementation.h 2016-11-03 10:15:24 +0000 |
2139 | +++ miral/window_manager_tools_implementation.h 2017-02-15 14:04:27 +0000 |
2140 | @@ -58,6 +58,7 @@ |
2141 | virtual auto active_window() const -> Window = 0; |
2142 | virtual auto select_active_window(Window const& hint) -> Window = 0; |
2143 | virtual void drag_active_window(mir::geometry::Displacement movement) = 0; |
2144 | + virtual void drag_window(Window const& window, mir::geometry::Displacement& movement) = 0; |
2145 | virtual void focus_next_application() = 0; |
2146 | virtual void focus_next_within_application() = 0; |
2147 | virtual auto window_at(mir::geometry::Point cursor) const -> Window = 0; |
2148 | |
2149 | === modified file 'scripts/process_doxygen_xml.py' |
2150 | --- scripts/process_doxygen_xml.py 2017-01-26 15:51:25 +0000 |
2151 | +++ scripts/process_doxygen_xml.py 2017-02-15 14:04:27 +0000 |
2152 | @@ -142,7 +142,6 @@ |
2153 | miral::DebugExtension::operator*; |
2154 | miral::InternalClientLauncher::?InternalClientLauncher*; |
2155 | miral::InternalClientLauncher::InternalClientLauncher*; |
2156 | - miral::InternalClientLauncher::launch*; |
2157 | miral::InternalClientLauncher::operator*; |
2158 | miral::Keymap::?Keymap*; |
2159 | miral::Keymap::Keymap*; |
2160 | @@ -181,7 +180,6 @@ |
2161 | miral::SetWindowManagmentPolicy::SetWindowManagmentPolicy*; |
2162 | miral::SetWindowManagmentPolicy::operator*; |
2163 | miral::StartupInternalClient::?StartupInternalClient*; |
2164 | - miral::StartupInternalClient::StartupInternalClient*; |
2165 | miral::StartupInternalClient::operator*; |
2166 | miral::Window::?Window*; |
2167 | miral::Window::Window*; |
2168 | @@ -405,6 +403,11 @@ |
2169 | |
2170 | # miral::WindowManagementPolicy::advise_state_change*; |
2171 | _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE15MirSurfaceState; |
2172 | + |
2173 | +# miral::StartupInternalClient::StartupInternalClient*; |
2174 | + _ZN5miral21StartupInternalClientC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvNS_7toolkit10ConnectionEEES7_IFvSt8weak_ptrIN3mir5scene7SessionEEEE; |
2175 | +# miral::InternalClientLauncher::launch*; |
2176 | + _ZNK5miral22InternalClientLauncher6launchERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt8functionIFvNS_7toolkit10ConnectionEEERKS9_IFvSt8weak_ptrIN3mir5scene7SessionEEEE; |
2177 | local: *; |
2178 | }; |
2179 | |
2180 | @@ -427,16 +430,29 @@ |
2181 | # miral::WindowManagementPolicy::advise_state_change*; |
2182 | _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE14MirWindowState; |
2183 | |
2184 | + extern "C++" { |
2185 | + miral::CanonicalWindowManagerPolicy::place_new_window*; |
2186 | + non-virtual?thunk?to?miral::CanonicalWindowManagerPolicy::place_new_window*; |
2187 | + }; |
2188 | +} MIRAL_1.0; |
2189 | + |
2190 | +MIRAL_1.2 { |
2191 | +global: |
2192 | +# miral::InternalClientLauncher::launch*; |
2193 | + _ZNK5miral22InternalClientLauncher6launchERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt8functionIFvN3mir6client10ConnectionEEERKS9_IFvSt8weak_ptrINSA_5scene7SessionEEEE; |
2194 | + |
2195 | +# miral::StartupInternalClient::StartupInternalClient*; |
2196 | + _ZN5miral21StartupInternalClientC?ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvN3mir6client10ConnectionEEES7_IFvSt8weak_ptrINS8_5scene7SessionEEEE; |
2197 | extern "C++" {''' |
2198 | |
2199 | END_NEW_STANZA = ''' }; |
2200 | -} MIRAL_1.0;''' |
2201 | +} MIRAL_1.1;''' |
2202 | |
2203 | def _print_report(): |
2204 | print OLD_STANZAS |
2205 | for symbol in sorted(SYMBOLS['public']): |
2206 | formatted_symbol = ' {};'.format(symbol) |
2207 | - if formatted_symbol not in OLD_STANZAS and 'miral::toolkit::' not in formatted_symbol: |
2208 | + if formatted_symbol not in OLD_STANZAS and 'mir::client::' not in formatted_symbol: |
2209 | print formatted_symbol |
2210 | print END_NEW_STANZA |
2211 | |
2212 | |
2213 | === modified file 'tasks_for_the_interested_reader.md' |
2214 | --- tasks_for_the_interested_reader.md 2016-11-09 12:42:27 +0000 |
2215 | +++ tasks_for_the_interested_reader.md 2017-02-15 14:04:27 +0000 |
2216 | @@ -6,21 +6,6 @@ |
2217 | is, it can be used but isn't very satisfying. Also the encapsulation provided |
2218 | by libmiral is leaky. |
2219 | |
2220 | -ABI design and stability |
2221 | ------------------------- |
2222 | - |
2223 | -There are some aspects of the current interface that are of concern for the |
2224 | -stability of the ABI. In particular, classes with accessible data members or |
2225 | -with virtual function tables can only be modified in restricted ways. |
2226 | - |
2227 | - - There are neither tests of MirAL code, nor of the sample code using it. |
2228 | - (This comes from its origin as a proof-of-concept "spike", but needs |
2229 | - correcting.) The test doubles supplied by mir-test-tools should be helpful. |
2230 | - (NB the version of mir-test-tools in Xenial is broken. lp:1583536) |
2231 | - |
2232 | - - There's a lack of documentation of the preconditions and postconditions of |
2233 | - the API. |
2234 | - |
2235 | Missing functionality |
2236 | --------------------- |
2237 | |
2238 | @@ -29,8 +14,7 @@ |
2239 | additions to libmiral to expose additional Mir functionality. |
2240 | |
2241 | - Titlebars. The default "titlebar" window management strategy paints |
2242 | - grey rectangles for titlebars. They should contain the window title and |
2243 | - sizing controls. |
2244 | + grey rectangles for titlebars. They should contain sizing controls. |
2245 | |
2246 | - Titlebars. The "tiling" window does not offer them at all. |
2247 | |
2248 | |
2249 | === modified file 'test/CMakeLists.txt' |
2250 | --- test/CMakeLists.txt 2017-01-20 15:02:54 +0000 |
2251 | +++ test/CMakeLists.txt 2017-02-15 14:04:27 +0000 |
2252 | @@ -42,12 +42,13 @@ |
2253 | add_executable(miral-test |
2254 | mru_window_list.cpp |
2255 | active_outputs.cpp |
2256 | - persistent_surface_store.cpp |
2257 | + window_id.cpp |
2258 | runner.cpp |
2259 | select_active_window.cpp |
2260 | window_placement.cpp |
2261 | window_placement_anchors_to_parent.cpp |
2262 | window_placement_client_api.cpp |
2263 | + window_properties.cpp |
2264 | drag_active_window.cpp |
2265 | modify_window_state.cpp |
2266 | test_server.cpp test_server.h |
2267 | |
2268 | === modified file 'test/active_window.cpp' |
2269 | --- test/active_window.cpp 2017-01-26 15:11:27 +0000 |
2270 | +++ test/active_window.cpp 2017-02-15 14:04:27 +0000 |
2271 | @@ -18,8 +18,8 @@ |
2272 | |
2273 | #include "test_server.h" |
2274 | |
2275 | -#include <miral/toolkit/window.h> |
2276 | -#include <miral/toolkit/window_spec.h> |
2277 | +#include <mir/client/window.h> |
2278 | +#include <mir/client/window_spec.h> |
2279 | #include <mir_toolkit/mir_buffer_stream.h> |
2280 | #include <mir_toolkit/version.h> |
2281 | |
2282 | @@ -30,7 +30,7 @@ |
2283 | #include <gtest/gtest.h> |
2284 | |
2285 | using namespace testing; |
2286 | -using namespace miral::toolkit; |
2287 | +using namespace mir::client; |
2288 | using namespace std::chrono_literals; |
2289 | using miral::WindowManagerTools; |
2290 | |
2291 | @@ -73,18 +73,14 @@ |
2292 | |
2293 | auto create_surface(Connection const& connection, char const* name, FocusChangeSync& sync) -> Window |
2294 | { |
2295 | - auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
2296 | + auto const spec = WindowSpec::for_normal_window(connection, 50, 50, mir_pixel_format_argb_8888) |
2297 | .set_buffer_usage(mir_buffer_usage_software) |
2298 | .set_event_handler(&FocusChangeSync::raise_signal_on_focus_change, &sync) |
2299 | .set_name(name); |
2300 | |
2301 | - Window const surface{spec.create_surface()}; |
2302 | + Window const surface{spec.create_window()}; |
2303 | |
2304 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
2305 | - sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_surface_get_buffer_stream(surface)); }); |
2306 | -#else |
2307 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(surface)); }); |
2308 | -#endif |
2309 | EXPECT_TRUE(sync.signal_raised()); |
2310 | |
2311 | return surface; |
2312 | @@ -99,14 +95,10 @@ |
2313 | .set_event_handler(&FocusChangeSync::raise_signal_on_focus_change, &sync) |
2314 | .set_name(name); |
2315 | |
2316 | - Window const surface{spec.create_surface()}; |
2317 | + Window const surface{spec.create_window()}; |
2318 | |
2319 | // Expect this to timeout: A tip should not receive focus |
2320 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
2321 | - sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_surface_get_buffer_stream(surface)); }); |
2322 | -#else |
2323 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(surface)); }); |
2324 | -#endif |
2325 | EXPECT_FALSE(sync.signal_raised()); |
2326 | |
2327 | return surface; |
2328 | @@ -120,13 +112,9 @@ |
2329 | .set_event_handler(&FocusChangeSync::raise_signal_on_focus_change, &sync) |
2330 | .set_name(name); |
2331 | |
2332 | - Window const surface{spec.create_surface()}; |
2333 | + Window const surface{spec.create_window()}; |
2334 | |
2335 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
2336 | - sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_surface_get_buffer_stream(surface)); }); |
2337 | -#else |
2338 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(surface)); }); |
2339 | -#endif |
2340 | EXPECT_TRUE(sync.signal_raised()); |
2341 | |
2342 | return surface; |
2343 | @@ -350,3 +338,41 @@ |
2344 | EXPECT_TRUE(sync2.signal_raised()); |
2345 | assert_active_window_is(dialog_name); |
2346 | } |
2347 | + |
2348 | +TEST_F(ActiveWindow, input_methods_are_not_focussed) |
2349 | +{ |
2350 | + char const* const test_name = __PRETTY_FUNCTION__; |
2351 | + auto const connection = connect_client(test_name); |
2352 | + |
2353 | + auto const parent = create_surface(connection, test_name, sync1); |
2354 | + auto const input_method = WindowSpec::for_input_method(connection, 50, 50, parent).create_window(); |
2355 | + |
2356 | + assert_active_window_is(test_name); |
2357 | + |
2358 | + invoke_tools([&](WindowManagerTools& tools) |
2359 | + { |
2360 | + auto const& info = tools.info_for(tools.active_window()); |
2361 | + tools.select_active_window(info.children().at(0)); |
2362 | + }); |
2363 | + |
2364 | + assert_active_window_is(test_name); |
2365 | +} |
2366 | + |
2367 | +TEST_F(ActiveWindow, satellites_are_not_focussed) |
2368 | +{ |
2369 | + char const* const test_name = __PRETTY_FUNCTION__; |
2370 | + auto const connection = connect_client(test_name); |
2371 | + |
2372 | + auto const parent = create_surface(connection, test_name, sync1); |
2373 | + auto const satellite = WindowSpec::for_satellite(connection, 50, 50, parent).create_window(); |
2374 | + |
2375 | + assert_active_window_is(test_name); |
2376 | + |
2377 | + invoke_tools([&](WindowManagerTools& tools) |
2378 | + { |
2379 | + auto const& info = tools.info_for(tools.active_window()); |
2380 | + tools.select_active_window(info.children().at(0)); |
2381 | + }); |
2382 | + |
2383 | + assert_active_window_is(test_name); |
2384 | +} |
2385 | |
2386 | === modified file 'test/drag_active_window.cpp' |
2387 | --- test/drag_active_window.cpp 2017-01-13 18:17:01 +0000 |
2388 | +++ test/drag_active_window.cpp 2017-02-15 14:04:27 +0000 |
2389 | @@ -110,32 +110,46 @@ |
2390 | // Freestyle surfaces may or may not be, as specified by the app. |
2391 | // Mir and Unity: Surfaces, input, and displays (v0.3) |
2392 | INSTANTIATE_TEST_CASE_P(DragActiveWindow, ForMoveableTypes, ::testing::Values( |
2393 | - mir_surface_type_normal, |
2394 | - mir_surface_type_utility, |
2395 | - mir_surface_type_dialog, |
2396 | -// mir_surface_type_overlay, |
2397 | -// mir_surface_type_gloss, |
2398 | - mir_surface_type_freestyle, |
2399 | -// mir_surface_type_popover, |
2400 | -// mir_surface_type_menu, |
2401 | -// mir_surface_type_inputmethod, |
2402 | - mir_surface_type_satellite |
2403 | -// mir_surface_type_tip, |
2404 | -// mir_surface_types |
2405 | + mir_window_type_normal, |
2406 | + mir_window_type_utility, |
2407 | + mir_window_type_dialog, |
2408 | +// mir_window_type_gloss, |
2409 | + mir_window_type_freestyle |
2410 | +// mir_window_type_menu, |
2411 | +// mir_window_type_inputmethod, |
2412 | +// mir_window_type_satellite, |
2413 | +// mir_window_type_tip, |
2414 | +// mir_window_types |
2415 | )); |
2416 | |
2417 | |
2418 | INSTANTIATE_TEST_CASE_P(DragActiveWindow, ForUnmoveableTypes, ::testing::Values( |
2419 | -// mir_surface_type_normal, |
2420 | -// mir_surface_type_utility, |
2421 | -// mir_surface_type_dialog, |
2422 | - mir_surface_type_overlay, |
2423 | - mir_surface_type_gloss, |
2424 | -// mir_surface_type_freestyle, |
2425 | - mir_surface_type_popover, |
2426 | - mir_surface_type_menu, |
2427 | - mir_surface_type_inputmethod, |
2428 | -// mir_surface_type_satellite, |
2429 | - mir_surface_type_tip |
2430 | -// mir_surface_types |
2431 | +// mir_window_type_normal, |
2432 | +// mir_window_type_utility, |
2433 | +// mir_window_type_dialog, |
2434 | + mir_window_type_gloss, |
2435 | +// mir_window_type_freestyle, |
2436 | + mir_window_type_menu, |
2437 | + mir_window_type_inputmethod, |
2438 | +// mir_window_type_satellite, |
2439 | + mir_window_type_tip |
2440 | +// mir_window_types |
2441 | )); |
2442 | + |
2443 | +using DragWindow = DragActiveWindow; |
2444 | + |
2445 | +TEST_F(DragWindow, can_drag_satellite) |
2446 | +{ |
2447 | + create_window_of_type(mir_window_type_satellite); |
2448 | + |
2449 | + Displacement const movement{10, 10}; |
2450 | + auto const initial_position = window.top_left(); |
2451 | + auto const expected_position = initial_position + movement; |
2452 | + |
2453 | + EXPECT_CALL(*window_manager_policy, advise_move_to(_, expected_position)); |
2454 | + |
2455 | + window_manager_tools.drag_window(window, movement); |
2456 | + |
2457 | + EXPECT_THAT(window.top_left(), Eq(expected_position)) |
2458 | + << "Type: " << GetParam(); |
2459 | +} |
2460 | \ No newline at end of file |
2461 | |
2462 | === modified file 'test/test_server.cpp' |
2463 | --- test/test_server.cpp 2016-11-14 17:58:34 +0000 |
2464 | +++ test/test_server.cpp 2017-02-15 14:04:27 +0000 |
2465 | @@ -160,7 +160,7 @@ |
2466 | server_thread.stop(); |
2467 | } |
2468 | |
2469 | -auto miral::TestServer::connect_client(std::string name) -> toolkit::Connection |
2470 | +auto miral::TestServer::connect_client(std::string name) -> mir::client::Connection |
2471 | { |
2472 | std::lock_guard<std::mutex> lock(mutex); |
2473 | |
2474 | @@ -170,7 +170,7 @@ |
2475 | char connect_string[64] = {0}; |
2476 | sprintf(connect_string, "fd://%d", dup(server_running->open_client_socket())); |
2477 | |
2478 | - return toolkit::Connection{mir_connect_sync(connect_string, name.c_str())}; |
2479 | + return mir::client::Connection{mir_connect_sync(connect_string, name.c_str())}; |
2480 | } |
2481 | |
2482 | void miral::TestServer::invoke_tools(std::function<void(WindowManagerTools& tools)> const& f) |
2483 | |
2484 | === modified file 'test/test_server.h' |
2485 | --- test/test_server.h 2016-11-14 17:58:34 +0000 |
2486 | +++ test/test_server.h 2017-02-15 14:04:27 +0000 |
2487 | @@ -19,7 +19,7 @@ |
2488 | #ifndef MIRAL_TEST_SERVER_H |
2489 | #define MIRAL_TEST_SERVER_H |
2490 | |
2491 | -#include <miral/toolkit/connection.h> |
2492 | +#include <mir/client/connection.h> |
2493 | |
2494 | #include <miral/runner.h> |
2495 | #include <miral/window_manager_tools.h> |
2496 | @@ -54,7 +54,7 @@ |
2497 | void SetUp() override; |
2498 | void TearDown() override; |
2499 | |
2500 | - auto connect_client(std::string name) -> toolkit::Connection; |
2501 | + auto connect_client(std::string name) -> mir::client::Connection; |
2502 | |
2503 | using TestRuntimeEnvironment::add_to_environment; |
2504 | |
2505 | |
2506 | === modified file 'test/test_window_manager_tools.h' |
2507 | --- test/test_window_manager_tools.h 2017-01-20 15:02:54 +0000 |
2508 | +++ test/test_window_manager_tools.h 2017-02-15 14:04:27 +0000 |
2509 | @@ -49,7 +49,7 @@ |
2510 | |
2511 | auto focused_surface() const -> std::shared_ptr<mir::scene::Surface> override { return {}; } |
2512 | |
2513 | - void raise(mir::shell::SurfaceSet const& /*surfaces*/) override {} |
2514 | + void raise(mir::shell::SurfaceSet const& /*windows*/) override {} |
2515 | |
2516 | virtual auto surface_at(mir::geometry::Point /*cursor*/) const -> std::shared_ptr<mir::scene::Surface> override |
2517 | { return {}; } |
2518 | |
2519 | === renamed file 'test/persistent_surface_store.cpp' => 'test/window_id.cpp' |
2520 | --- test/persistent_surface_store.cpp 2017-01-26 15:11:27 +0000 |
2521 | +++ test/window_id.cpp 2017-02-15 14:04:27 +0000 |
2522 | @@ -16,9 +16,9 @@ |
2523 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
2524 | */ |
2525 | |
2526 | -#include <miral/toolkit/persistent_id.h> |
2527 | -#include <miral/toolkit/window.h> |
2528 | -#include <miral/toolkit/window_spec.h> |
2529 | +#include <mir/client/window_id.h> |
2530 | +#include <mir/client/window.h> |
2531 | +#include <mir/client/window_spec.h> |
2532 | |
2533 | #include <miral/application_info.h> |
2534 | |
2535 | @@ -32,7 +32,7 @@ |
2536 | using namespace testing; |
2537 | |
2538 | |
2539 | -struct PersistentSurfaceId : public miral::TestServer |
2540 | +struct WindowId : public miral::TestServer |
2541 | { |
2542 | auto get_first_window(miral::WindowManagerTools& tools) -> miral::Window |
2543 | { |
2544 | @@ -43,18 +43,18 @@ |
2545 | }; |
2546 | |
2547 | #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 24, 0) |
2548 | -TEST_F(PersistentSurfaceId, server_can_identify_window_specified_by_client) |
2549 | +TEST_F(WindowId, server_can_identify_window_specified_by_client) |
2550 | { |
2551 | char const* const test_name = __PRETTY_FUNCTION__; |
2552 | - using namespace miral::toolkit; |
2553 | + using namespace mir::client; |
2554 | |
2555 | auto const connection = connect_client(test_name); |
2556 | - auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
2557 | + auto const spec = WindowSpec::for_normal_window(connection, 50, 50, mir_pixel_format_argb_8888) |
2558 | .set_name(test_name); |
2559 | |
2560 | - Window const surface{spec.create_surface()}; |
2561 | + Window const surface{spec.create_window()}; |
2562 | |
2563 | - miral::toolkit::PersistentId client_surface_id{surface}; |
2564 | + mir::client::WindowId client_surface_id{surface}; |
2565 | |
2566 | invoke_tools([&](miral::WindowManagerTools& tools) |
2567 | { |
2568 | @@ -65,18 +65,18 @@ |
2569 | }); |
2570 | } |
2571 | |
2572 | -TEST_F(PersistentSurfaceId, server_returns_correct_id_for_window) |
2573 | +TEST_F(WindowId, server_returns_correct_id_for_window) |
2574 | { |
2575 | char const* const test_name = __PRETTY_FUNCTION__; |
2576 | - using namespace miral::toolkit; |
2577 | + using namespace mir::client; |
2578 | |
2579 | auto const connection = connect_client(test_name); |
2580 | - auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
2581 | + auto const spec = WindowSpec::for_normal_window(connection, 50, 50, mir_pixel_format_argb_8888) |
2582 | .set_name(test_name); |
2583 | |
2584 | - Window const surface{spec.create_surface()}; |
2585 | + Window const surface{spec.create_window()}; |
2586 | |
2587 | - miral::toolkit::PersistentId client_surface_id{surface}; |
2588 | + mir::client::WindowId client_surface_id{surface}; |
2589 | |
2590 | invoke_tools([&](miral::WindowManagerTools& tools) |
2591 | { |
2592 | @@ -87,10 +87,10 @@ |
2593 | }); |
2594 | } |
2595 | #else |
2596 | -TEST_F(PersistentSurfaceId, server_fails_gracefully_to_identify_window_specified_by_client) |
2597 | +TEST_F(WindowId, server_fails_gracefully_to_identify_window_specified_by_client) |
2598 | { |
2599 | char const* const test_name = __PRETTY_FUNCTION__; |
2600 | - using namespace miral::toolkit; |
2601 | + using namespace mir::client; |
2602 | |
2603 | auto const connection = connect_client(test_name); |
2604 | auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
2605 | @@ -98,7 +98,7 @@ |
2606 | |
2607 | Window const surface{spec.create_surface()}; |
2608 | |
2609 | - miral::toolkit::PersistentId client_surface_id{surface}; |
2610 | + mir::client::PersistentId client_surface_id{surface}; |
2611 | |
2612 | invoke_tools([&](miral::WindowManagerTools& tools) |
2613 | { |
2614 | @@ -106,10 +106,10 @@ |
2615 | }); |
2616 | } |
2617 | |
2618 | -TEST_F(PersistentSurfaceId, server_fails_gracefully_to_return_id_for_window) |
2619 | +TEST_F(WindowId, server_fails_gracefully_to_return_id_for_window) |
2620 | { |
2621 | char const* const test_name = __PRETTY_FUNCTION__; |
2622 | - using namespace miral::toolkit; |
2623 | + using namespace mir::client; |
2624 | |
2625 | auto const connection = connect_client(test_name); |
2626 | auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
2627 | @@ -117,7 +117,7 @@ |
2628 | |
2629 | Window const surface{spec.create_surface()}; |
2630 | |
2631 | - miral::toolkit::PersistentId client_surface_id{surface}; |
2632 | + mir::client::PersistentId client_surface_id{surface}; |
2633 | |
2634 | invoke_tools([](miral::WindowManagerTools& tools) |
2635 | { |
2636 | @@ -127,18 +127,18 @@ |
2637 | } |
2638 | #endif |
2639 | |
2640 | -TEST_F(PersistentSurfaceId, server_fails_gracefully_to_identify_window_from_garbage_id) |
2641 | +TEST_F(WindowId, server_fails_gracefully_to_identify_window_from_garbage_id) |
2642 | { |
2643 | char const* const test_name = __PRETTY_FUNCTION__; |
2644 | - using namespace miral::toolkit; |
2645 | + using namespace mir::client; |
2646 | |
2647 | auto const connection = connect_client(test_name); |
2648 | - auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
2649 | + auto const spec = WindowSpec::for_normal_window(connection, 50, 50, mir_pixel_format_argb_8888) |
2650 | .set_name(test_name); |
2651 | |
2652 | - Window const surface{spec.create_surface()}; |
2653 | + Window const surface{spec.create_window()}; |
2654 | |
2655 | - miral::toolkit::PersistentId client_surface_id{surface}; |
2656 | + mir::client::WindowId client_surface_id{surface}; |
2657 | |
2658 | invoke_tools([](miral::WindowManagerTools& tools) |
2659 | { |
2660 | @@ -146,7 +146,7 @@ |
2661 | }); |
2662 | } |
2663 | |
2664 | -TEST_F(PersistentSurfaceId, server_fails_gracefully_when_id_for_null_window_requested) |
2665 | +TEST_F(WindowId, server_fails_gracefully_when_id_for_null_window_requested) |
2666 | { |
2667 | invoke_tools([](miral::WindowManagerTools& tools) |
2668 | { |
2669 | |
2670 | === modified file 'test/window_placement.cpp' |
2671 | --- test/window_placement.cpp 2017-01-13 18:17:01 +0000 |
2672 | +++ test/window_placement.cpp 2017-02-15 14:04:27 +0000 |
2673 | @@ -130,7 +130,7 @@ |
2674 | } |
2675 | |
2676 | |
2677 | -/* From the Mir toolkit API: |
2678 | +/* From the Mir client API: |
2679 | * Positioning of the surface is specified with respect to the parent surface |
2680 | * via an adjacency rectangle. The server will attempt to choose an edge of the |
2681 | * adjacency rectangle on which to place the surface taking in to account |
2682 | |
2683 | === modified file 'test/window_placement_client_api.cpp' |
2684 | --- test/window_placement_client_api.cpp 2017-01-26 15:11:27 +0000 |
2685 | +++ test/window_placement_client_api.cpp 2017-02-15 14:04:27 +0000 |
2686 | @@ -22,14 +22,15 @@ |
2687 | #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0) |
2688 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
2689 | #include <mir_toolkit/events/surface_placement.h> |
2690 | +auto const mir_event_get_window_placement_event = mir_event_get_surface_placement_event; |
2691 | #else |
2692 | #include <mir_toolkit/events/window_placement.h> |
2693 | #endif |
2694 | #endif |
2695 | |
2696 | -#include <miral/detail/mir_forward_compatibility.h> |
2697 | -#include <miral/toolkit/window_spec.h> |
2698 | -#include <miral/toolkit/window.h> |
2699 | +#include <mir/client/detail/mir_forward_compatibility.h> |
2700 | +#include <mir/client/window_spec.h> |
2701 | +#include <mir/client/window.h> |
2702 | |
2703 | #include <mir/test/signal.h> |
2704 | #include "test_server.h" |
2705 | @@ -43,7 +44,7 @@ |
2706 | namespace mt = mir::test; |
2707 | namespace mtf = mir_test_framework; |
2708 | |
2709 | -using namespace miral::toolkit; |
2710 | +using namespace mir::client; |
2711 | |
2712 | namespace |
2713 | { |
2714 | @@ -56,10 +57,10 @@ |
2715 | char const* const test_name = __PRETTY_FUNCTION__; |
2716 | |
2717 | connection = connect_client(test_name); |
2718 | - auto spec = WindowSpec::for_normal_surface(connection, 400, 400, mir_pixel_format_argb_8888) |
2719 | + auto spec = WindowSpec::for_normal_window(connection, 400, 400, mir_pixel_format_argb_8888) |
2720 | .set_name(test_name); |
2721 | |
2722 | - parent = spec.create_surface(); |
2723 | + parent = spec.create_window(); |
2724 | } |
2725 | |
2726 | void TearDown() override |
2727 | @@ -92,11 +93,8 @@ |
2728 | |
2729 | void check(MirWindowPlacementEvent const* placement_event) |
2730 | { |
2731 | -#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
2732 | - auto relative_position = mir_surface_placement_get_relative_position(placement_event); |
2733 | -#else |
2734 | auto relative_position = mir_window_placement_get_relative_position(placement_event); |
2735 | -#endif |
2736 | + |
2737 | EXPECT_THAT(relative_position.top, Eq(expected.top)); |
2738 | EXPECT_THAT(relative_position.left, Eq(expected.left)); |
2739 | EXPECT_THAT(relative_position.height, Eq(expected.height)); |
2740 | @@ -109,11 +107,7 @@ |
2741 | { |
2742 | if (mir_event_get_type(event) == mir_event_type_window_placement) |
2743 | { |
2744 | -#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
2745 | - auto const placement_event = mir_event_get_surface_placement_event(event); |
2746 | -#else |
2747 | auto const placement_event = mir_event_get_window_placement_event(event); |
2748 | -#endif |
2749 | static_cast<CheckPlacement*>(context)->check(placement_event); |
2750 | } |
2751 | } |
2752 | @@ -147,7 +141,7 @@ |
2753 | .set_event_handler(&CheckPlacement::callback, &expected) |
2754 | .set_name(test_name); |
2755 | |
2756 | - child = spec.create_surface(); |
2757 | + child = spec.create_window(); |
2758 | } |
2759 | |
2760 | // subsequent movement |
2761 | |
2762 | === added file 'test/window_properties.cpp' |
2763 | --- test/window_properties.cpp 1970-01-01 00:00:00 +0000 |
2764 | +++ test/window_properties.cpp 2017-02-15 14:04:27 +0000 |
2765 | @@ -0,0 +1,128 @@ |
2766 | +/* |
2767 | + * Copyright © 2017 Canonical Ltd. |
2768 | + * |
2769 | + * This program is free software: you can redistribute it and/or modify it |
2770 | + * under the terms of the GNU General Public License version 3, |
2771 | + * as published by the Free Software Foundation. |
2772 | + * |
2773 | + * This program is distributed in the hope that it will be useful, |
2774 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2775 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2776 | + * GNU General Public License for more details. |
2777 | + * |
2778 | + * You should have received a copy of the GNU General Public License |
2779 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2780 | + * |
2781 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
2782 | + */ |
2783 | + |
2784 | +#include <miral/window_manager_tools.h> |
2785 | + |
2786 | +#include <mir/client/window.h> |
2787 | +#include <mir/client/window_spec.h> |
2788 | +#include <mir_toolkit/mir_buffer_stream.h> |
2789 | + |
2790 | +#include "test_server.h" |
2791 | + |
2792 | +#include <gmock/gmock.h> |
2793 | +#include <mir/test/signal.h> |
2794 | + |
2795 | + |
2796 | +using namespace testing; |
2797 | +using namespace mir::client; |
2798 | +using namespace std::chrono_literals; |
2799 | +using miral::WindowManagerTools; |
2800 | + |
2801 | +namespace |
2802 | +{ |
2803 | +std::string const a_window{"a window"}; |
2804 | + |
2805 | +struct WindowProperties; |
2806 | + |
2807 | +struct WindowProperties : public miral::TestServer |
2808 | +{ |
2809 | + void SetUp() override |
2810 | + { |
2811 | + miral::TestServer::SetUp(); |
2812 | + client_connection = connect_client("WindowProperties"); |
2813 | + } |
2814 | + |
2815 | + void TearDown() override |
2816 | + { |
2817 | + client_connection.reset(); |
2818 | + miral::TestServer::TearDown(); |
2819 | + } |
2820 | + |
2821 | + Connection client_connection; |
2822 | +}; |
2823 | +} |
2824 | + |
2825 | +TEST_F(WindowProperties, on_creation_default_shell_chrome_is_normal) |
2826 | +{ |
2827 | + auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888) |
2828 | + .set_buffer_usage(mir_buffer_usage_software) |
2829 | + .set_name(a_window.c_str()) |
2830 | + .create_window(); |
2831 | + |
2832 | + mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window)); |
2833 | + |
2834 | + invoke_tools([&, this](WindowManagerTools& tools) |
2835 | + { |
2836 | + EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_normal)); |
2837 | + }); |
2838 | +} |
2839 | + |
2840 | +TEST_F(WindowProperties, on_creation_client_setting_shell_chrome_low_is_seen_by_window_manager) |
2841 | +{ |
2842 | + auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888) |
2843 | + .set_buffer_usage(mir_buffer_usage_software) |
2844 | + .set_name(a_window.c_str()) |
2845 | + .set_shell_chrome(mir_shell_chrome_low) |
2846 | + .create_window(); |
2847 | + |
2848 | + mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window)); |
2849 | + |
2850 | + invoke_tools([&, this](WindowManagerTools& tools) |
2851 | + { |
2852 | + EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_low)); |
2853 | + }); |
2854 | +} |
2855 | + |
2856 | +TEST_F(WindowProperties, after_creation_client_setting_shell_chrome_low_is_seen_by_window_manager) |
2857 | +{ |
2858 | + auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888) |
2859 | + .set_buffer_usage(mir_buffer_usage_software) |
2860 | + .set_name(a_window.c_str()) |
2861 | + .create_window(); |
2862 | + |
2863 | + WindowSpec::for_changes(client_connection) |
2864 | + .set_shell_chrome(mir_shell_chrome_low) |
2865 | + .apply_to(window); |
2866 | + |
2867 | + mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window)); |
2868 | + |
2869 | + invoke_tools([&, this](WindowManagerTools& tools) |
2870 | + { |
2871 | + EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_low)); |
2872 | + }); |
2873 | +} |
2874 | + |
2875 | +TEST_F(WindowProperties, after_creation_client_setting_shell_chrome_normal_is_seen_by_window_manager) |
2876 | +{ |
2877 | + auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888) |
2878 | + .set_buffer_usage(mir_buffer_usage_software) |
2879 | + .set_name(a_window.c_str()) |
2880 | + .set_shell_chrome(mir_shell_chrome_low) |
2881 | + .create_window(); |
2882 | + |
2883 | + WindowSpec::for_changes(client_connection) |
2884 | + .set_shell_chrome(mir_shell_chrome_normal) |
2885 | + .apply_to(window); |
2886 | + |
2887 | + mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window)); |
2888 | + |
2889 | + invoke_tools([&, this](WindowManagerTools& tools) |
2890 | + { |
2891 | + EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_normal)); |
2892 | + }); |
2893 | +} |
LGTM