Merge lp:~mir-team/miral/miral-0.26 into lp:miral/release
- miral-0.26
- Merge into release
Proposed by
Cemil Azizoglu
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Cemil Azizoglu | ||||||||
Approved revision: | 497 | ||||||||
Merged at revision: | 351 | ||||||||
Proposed branch: | lp:~mir-team/miral/miral-0.26 | ||||||||
Merge into: | lp:miral/release | ||||||||
Diff against target: |
4244 lines (+1486/-502) 52 files modified
CMakeLists.txt (+13/-9) debian/changelog (+17/-0) debian/control (+1/-0) debian/libmiral2.symbols (+8/-1) include/miral/canonical_window_manager.h (+1/-2) include/miral/detail/mir_forward_compatibility.h (+42/-0) include/miral/toolkit/persistent_id.h (+11/-1) include/miral/toolkit/window.h (+21/-14) include/miral/toolkit/window_spec.h (+136/-43) include/miral/window_info.h (+6/-6) include/miral/window_management_policy.h (+5/-3) include/miral/window_specification.h (+5/-5) miral-kiosk/kiosk_window_manager.cpp (+4/-4) miral-kiosk/sw_splash.cpp (+28/-3) miral-shell/miral-screencast.sh (+3/-1) miral-shell/spinner/eglapp.cpp (+37/-1) miral-shell/spinner/miregl.cpp (+58/-23) miral-shell/spinner/miregl.h (+4/-4) miral-shell/tiling_window_manager.cpp (+16/-16) miral-shell/tiling_window_manager.h (+3/-3) miral-shell/titlebar_provider.cpp (+28/-16) miral-shell/titlebar_provider.h (+4/-4) miral-shell/titlebar_window_manager.cpp (+12/-12) miral-shell/titlebar_window_manager.h (+3/-3) miral/CMakeLists.txt (+4/-3) miral/active_outputs.cpp (+5/-0) miral/basic_window_manager.cpp (+118/-115) miral/basic_window_manager.h (+2/-2) miral/both_versions.h (+48/-0) miral/canonical_window_manager.cpp (+8/-1) miral/coordinate_translator.cpp (+5/-0) miral/coordinate_translator.h (+10/-0) miral/keymap.cpp (+8/-1) miral/symbols.map (+41/-5) miral/window_info.cpp (+66/-51) miral/window_management_policy.cpp (+6/-1) miral/window_management_trace.cpp (+97/-45) miral/window_management_trace.h (+2/-2) miral/window_specification.cpp (+6/-6) scripts/process_doxygen_xml.py (+346/-3) test/CMakeLists.txt (+10/-7) test/active_window.cpp (+53/-16) test/display_reconfiguration.cpp (+4/-4) test/drag_active_window.cpp (+2/-2) test/modify_window_state.cpp (+15/-15) test/persistent_surface_store.cpp (+12/-12) test/raise_tree.cpp (+95/-0) test/select_active_window.cpp (+6/-6) test/test_window_manager_tools.h (+14/-13) test/window_placement.cpp (+3/-3) test/window_placement_anchors_to_parent.cpp (+1/-1) test/window_placement_client_api.cpp (+33/-14) |
||||||||
To merge this branch: | bzr merge lp:~mir-team/miral/miral-0.26 | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alan Griffiths | Approve | ||
Review via email: mp+315599@code.launchpad.net |
Commit message
Adaptations for Mir 0.26.
Description of the change
Adaptations for Mir 0.26.
To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) : | # |
review:
Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote : | # |
> The hack for generating backward-compatible synonyms fails to account for the
> case of building against earlier versions of Mir. In which case it fails to
> generate forward-compatible synonyms.
>
> That is, MirAL 1.1 built against Mir 0.25 is not ABI compatible with MirAL 1.1
> built against Mir 0.26.
I've an MP against lp:miral that addresses this. My preference would be to land that (and anything else that's been approved) and re-sync this release branch.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote : | # |
LGTM now
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2017-01-18 18:15:55 +0000 | |||
3 | +++ CMakeLists.txt 2017-01-26 16:46:42 +0000 | |||
4 | @@ -1,4 +1,4 @@ | |||
6 | 1 | cmake_minimum_required(VERSION 3.0) | 1 | cmake_minimum_required(VERSION 3.1) |
7 | 2 | project(miral) | 2 | project(miral) |
8 | 3 | 3 | ||
9 | 4 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | 4 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
10 | @@ -16,16 +16,20 @@ | |||
11 | 16 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | 16 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) |
12 | 17 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | 17 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) |
13 | 18 | 18 | ||
14 | 19 | set(CMAKE_CXX_STANDARD 14) | ||
15 | 20 | set(CMAKE_CXX_STANDARD_REQUIRED on) | ||
16 | 21 | set(CMAKE_CXX_EXTENSIONS off) | ||
17 | 22 | |||
18 | 23 | set(CMAKE_C_STANDARD 99) | ||
19 | 24 | set(CMAKE_C_STANDARD_REQUIRED on) | ||
20 | 25 | set(CMAKE_C_EXTENSIONS off) | ||
21 | 26 | |||
22 | 19 | set(MIRAL_COMPILER_FLAGS "-pthread -g -Werror -Wall -pedantic -Wextra -fPIC") | 27 | set(MIRAL_COMPILER_FLAGS "-pthread -g -Werror -Wall -pedantic -Wextra -fPIC") |
23 | 20 | set(MIRAL_LINKER_FLAGS "-Wl,-z,defs") | 28 | set(MIRAL_LINKER_FLAGS "-Wl,-z,defs") |
24 | 21 | 29 | ||
25 | 22 | check_cxx_compiler_flag(-Wno-mismatched-tags MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS) | ||
26 | 23 | if (MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS) | ||
27 | 24 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags") | ||
28 | 25 | endif() | ||
29 | 26 | |||
30 | 27 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MIRAL_COMPILER_FLAGS}") | 30 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MIRAL_COMPILER_FLAGS}") |
32 | 28 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MIRAL_COMPILER_FLAGS} -Wnon-virtual-dtor -std=c++14") | 31 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MIRAL_COMPILER_FLAGS} -Wnon-virtual-dtor") |
33 | 32 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long") # fix spurious FTBFS on X+O | ||
34 | 29 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MIRAL_LINKER_FLAGS}") | 33 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MIRAL_LINKER_FLAGS}") |
35 | 30 | set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${MIRAL_LINKER_FLAGS}") | 34 | set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${MIRAL_LINKER_FLAGS}") |
36 | 31 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MIRAL_LINKER_FLAGS}") | 35 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MIRAL_LINKER_FLAGS}") |
37 | @@ -37,8 +41,8 @@ | |||
38 | 37 | include_directories(include SYSTEM ${MIRCLIENT_INCLUDE_DIRS}) | 41 | include_directories(include SYSTEM ${MIRCLIENT_INCLUDE_DIRS}) |
39 | 38 | 42 | ||
40 | 39 | set(MIRAL_VERSION_MAJOR 1) | 43 | set(MIRAL_VERSION_MAJOR 1) |
43 | 40 | set(MIRAL_VERSION_MINOR 0) | 44 | set(MIRAL_VERSION_MINOR 1) |
44 | 41 | set(MIRAL_VERSION_PATCH 2) | 45 | set(MIRAL_VERSION_PATCH 0) |
45 | 42 | 46 | ||
46 | 43 | set(MIRAL_VERSION ${MIRAL_VERSION_MAJOR}.${MIRAL_VERSION_MINOR}.${MIRAL_VERSION_PATCH}) | 47 | set(MIRAL_VERSION ${MIRAL_VERSION_MAJOR}.${MIRAL_VERSION_MINOR}.${MIRAL_VERSION_PATCH}) |
47 | 44 | 48 | ||
48 | 45 | 49 | ||
49 | === modified file 'debian/changelog' | |||
50 | --- debian/changelog 2017-01-18 18:17:47 +0000 | |||
51 | +++ debian/changelog 2017-01-26 16:46:42 +0000 | |||
52 | @@ -1,3 +1,20 @@ | |||
53 | 1 | miral (1.1.0) UNRELEASED; urgency=medium | ||
54 | 2 | |||
55 | 3 | * New upstream release 1.1.0 (https://launchpad.net/miral/+milestone/1.1) | ||
56 | 4 | - ABI summary: | ||
57 | 5 | . miral ABI unchanged at 2 | ||
58 | 6 | - Enhancements: | ||
59 | 7 | . Compatibility with Mir 0.26 and update API to use the new Mir types and | ||
60 | 8 | enums. | ||
61 | 9 | . Logging of exceptions added to --window-management-trace | ||
62 | 10 | . Rename WindowManagementPolicy::place_new_surface => place_new_window" | ||
63 | 11 | - Bugs fixed: | ||
64 | 12 | . top-level window is not raised along with its child (LP: #1658085) | ||
65 | 13 | . miral-shell depends on default cursor theme being installed | ||
66 | 14 | (LP: #1658159) | ||
67 | 15 | |||
68 | 16 | -- Alan Griffiths <alan.griffiths@canonical.com> Wed, 14 Dec 2016 16:31:08 +0000 | ||
69 | 17 | |||
70 | 1 | miral (1.0.2+17.04.20170118.1-0ubuntu1) zesty; urgency=medium | 18 | miral (1.0.2+17.04.20170118.1-0ubuntu1) zesty; urgency=medium |
71 | 2 | 19 | ||
72 | 3 | * New upstream release 1.0.1 (https://launchpad.net/miral/+milestone/1.0) | 20 | * New upstream release 1.0.1 (https://launchpad.net/miral/+milestone/1.0) |
73 | 4 | 21 | ||
74 | === modified file 'debian/control' | |||
75 | --- debian/control 2016-12-20 15:45:29 +0000 | |||
76 | +++ debian/control 2017-01-26 16:46:42 +0000 | |||
77 | @@ -63,6 +63,7 @@ | |||
78 | 63 | Architecture: linux-any | 63 | Architecture: linux-any |
79 | 64 | Depends: ${misc:Depends}, | 64 | Depends: ${misc:Depends}, |
80 | 65 | ${shlibs:Depends}, | 65 | ${shlibs:Depends}, |
81 | 66 | Recommends: dmz-cursor-theme, | ||
82 | 66 | Description: Display server for Ubuntu - demonstration programs | 67 | Description: Display server for Ubuntu - demonstration programs |
83 | 67 | MirAL provides an ABI-stable abstraction layer for Mir based shells, | 68 | MirAL provides an ABI-stable abstraction layer for Mir based shells, |
84 | 68 | insulating them from mirserver ABI breaks. | 69 | insulating them from mirserver ABI breaks. |
85 | 69 | 70 | ||
86 | === modified file 'debian/libmiral2.symbols' | |||
87 | --- debian/libmiral2.symbols 2016-12-13 13:07:15 +0000 | |||
88 | +++ debian/libmiral2.symbols 2017-01-26 16:46:42 +0000 | |||
89 | @@ -354,4 +354,11 @@ | |||
90 | 354 | (c++)"typeinfo for miral::CanonicalWindowManagerPolicy@MIRAL_1.0" 1.0.0 | 354 | (c++)"typeinfo for miral::CanonicalWindowManagerPolicy@MIRAL_1.0" 1.0.0 |
91 | 355 | (c++)"vtable for miral::ActiveOutputsListener@MIRAL_1.0" 1.0.0 | 355 | (c++)"vtable for miral::ActiveOutputsListener@MIRAL_1.0" 1.0.0 |
92 | 356 | (c++)"vtable for miral::WindowManagementPolicy@MIRAL_1.0" 1.0.0 | 356 | (c++)"vtable for miral::WindowManagementPolicy@MIRAL_1.0" 1.0.0 |
93 | 357 | (c++)"vtable for miral::CanonicalWindowManagerPolicy@MIRAL_1.0" 1.0.0 | ||
94 | 358 | \ No newline at end of file | 357 | \ No newline at end of file |
95 | 358 | (c++)"vtable for miral::CanonicalWindowManagerPolicy@MIRAL_1.0" 1.0.0 | ||
96 | 359 | MIRAL_1.1@MIRAL_1.1 1.1.0 | ||
97 | 360 | (c++)"miral::WindowInfo::needs_titlebar(MirWindowType)@MIRAL_1.1" 1.1.0 | ||
98 | 361 | (c++)"miral::WindowInfo::type(MirWindowType)@MIRAL_1.1" 1.1.0 | ||
99 | 362 | (c++)"miral::WindowInfo::state(MirWindowState)@MIRAL_1.1" 1.1.0 | ||
100 | 363 | (c++)"miral::WindowManagementPolicy::advise_state_change(miral::WindowInfo const&, MirWindowState)@MIRAL_1.1" 1.1.0 | ||
101 | 364 | (c++)"miral::WindowInfo::can_morph_to(MirWindowType) const@MIRAL_1.1" 1.1.0 | ||
102 | 365 | (c++)"miral::CanonicalWindowManagerPolicy::place_new_window(miral::ApplicationInfo const&, miral::WindowSpecification const&)@MIRAL_1.1" 1.1.0 | ||
103 | 359 | \ No newline at end of file | 366 | \ No newline at end of file |
104 | 360 | 367 | ||
105 | === modified file 'include/miral/canonical_window_manager.h' | |||
106 | --- include/miral/canonical_window_manager.h 2016-12-05 09:46:35 +0000 | |||
107 | +++ include/miral/canonical_window_manager.h 2017-01-26 16:46:42 +0000 | |||
108 | @@ -31,8 +31,7 @@ | |||
109 | 31 | 31 | ||
110 | 32 | explicit CanonicalWindowManagerPolicy(WindowManagerTools const& tools); | 32 | explicit CanonicalWindowManagerPolicy(WindowManagerTools const& tools); |
111 | 33 | 33 | ||
114 | 34 | /// places the surfaces as requested | 34 | auto place_new_window( |
113 | 35 | auto place_new_surface( | ||
115 | 36 | ApplicationInfo const& app_info, | 35 | ApplicationInfo const& app_info, |
116 | 37 | WindowSpecification const& request_parameters) | 36 | WindowSpecification const& request_parameters) |
117 | 38 | -> WindowSpecification override; | 37 | -> WindowSpecification override; |
118 | 39 | 38 | ||
119 | === modified file 'include/miral/detail/mir_forward_compatibility.h' | |||
120 | --- include/miral/detail/mir_forward_compatibility.h 2016-09-23 13:59:34 +0000 | |||
121 | +++ include/miral/detail/mir_forward_compatibility.h 2017-01-26 16:46:42 +0000 | |||
122 | @@ -20,8 +20,50 @@ | |||
123 | 20 | #define MIRAL_MIR_FORWARD_COMPATIBILITY_H | 20 | #define MIRAL_MIR_FORWARD_COMPATIBILITY_H |
124 | 21 | 21 | ||
125 | 22 | #include <mir_toolkit/version.h> | 22 | #include <mir_toolkit/version.h> |
126 | 23 | #include <mir_toolkit/common.h> | ||
127 | 23 | #include <miral/detail/mir_features.h> | 24 | #include <miral/detail/mir_features.h> |
128 | 24 | 25 | ||
129 | 26 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | ||
130 | 27 | using MirWindowAttrib = MirSurfaceAttrib; | ||
131 | 28 | auto const mir_window_attrib_type = mir_surface_attrib_type; | ||
132 | 29 | auto const mir_window_attrib_state = mir_surface_attrib_state; | ||
133 | 30 | auto const mir_window_attrib_swapinterval = mir_surface_attrib_swapinterval; | ||
134 | 31 | auto const mir_window_attrib_focus = mir_surface_attrib_focus; | ||
135 | 32 | auto const mir_window_attrib_dpi = mir_surface_attrib_dpi; | ||
136 | 33 | auto const mir_window_attrib_visibility = mir_surface_attrib_visibility; | ||
137 | 34 | auto const mir_window_attrib_preferred_orientation = mir_surface_attrib_preferred_orientation; | ||
138 | 35 | auto const mir_window_attribs = mir_surface_attribs; | ||
139 | 36 | |||
140 | 37 | using MirWindowType = MirSurfaceType; | ||
141 | 38 | auto const mir_window_type_normal = mir_surface_type_normal; | ||
142 | 39 | auto const mir_window_type_utility = mir_surface_type_utility; | ||
143 | 40 | auto const mir_window_type_dialog = mir_surface_type_dialog; | ||
144 | 41 | auto const mir_window_type_gloss = mir_surface_type_gloss; | ||
145 | 42 | auto const mir_window_type_freestyle = mir_surface_type_freestyle; | ||
146 | 43 | auto const mir_window_type_menu = mir_surface_type_menu; | ||
147 | 44 | auto const mir_window_type_inputmethod = mir_surface_type_inputmethod; | ||
148 | 45 | auto const mir_window_type_satellite = mir_surface_type_satellite; | ||
149 | 46 | auto const mir_window_type_tip = mir_surface_type_tip; | ||
150 | 47 | auto const mir_window_types = mir_surface_types; | ||
151 | 48 | |||
152 | 49 | using MirWindowState = MirSurfaceState; | ||
153 | 50 | auto const mir_window_state_unknown = mir_surface_state_unknown; | ||
154 | 51 | auto const mir_window_state_restored = mir_surface_state_restored; | ||
155 | 52 | auto const mir_window_state_minimized = mir_surface_state_minimized; | ||
156 | 53 | auto const mir_window_state_maximized = mir_surface_state_maximized; | ||
157 | 54 | auto const mir_window_state_vertmaximized = mir_surface_state_vertmaximized; | ||
158 | 55 | auto const mir_window_state_fullscreen = mir_surface_state_fullscreen; | ||
159 | 56 | auto const mir_window_state_horizmaximized = mir_surface_state_horizmaximized; | ||
160 | 57 | auto const mir_window_state_hidden = mir_surface_state_hidden; | ||
161 | 58 | auto const mir_window_states = mir_surface_states; | ||
162 | 59 | |||
163 | 60 | typedef struct MirSurface MirWindow; | ||
164 | 61 | typedef struct MirSurfaceParameters MirWindowParameters; | ||
165 | 62 | typedef struct MirSurfacePlacementEvent MirWindowPlacementEvent; | ||
166 | 63 | typedef struct MirSurfaceSpec MirWindowSpec; | ||
167 | 64 | #endif | ||
168 | 65 | |||
169 | 66 | |||
170 | 25 | // Types that don't exist in earlier versions of Mir's toolkit | 67 | // Types that don't exist in earlier versions of Mir's toolkit |
171 | 26 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 4, 0) | 68 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 4, 0) |
172 | 27 | 69 | ||
173 | 28 | 70 | ||
174 | === modified file 'include/miral/toolkit/persistent_id.h' | |||
175 | --- include/miral/toolkit/persistent_id.h 2016-08-11 10:53:11 +0000 | |||
176 | +++ include/miral/toolkit/persistent_id.h 2017-01-26 16:46:42 +0000 | |||
177 | @@ -19,7 +19,13 @@ | |||
178 | 19 | #ifndef MIRAL_TOOLKIT_PERSISTENT_ID_H | 19 | #ifndef MIRAL_TOOLKIT_PERSISTENT_ID_H |
179 | 20 | #define MIRAL_TOOLKIT_PERSISTENT_ID_H | 20 | #define MIRAL_TOOLKIT_PERSISTENT_ID_H |
180 | 21 | 21 | ||
181 | 22 | #include <miral/detail/mir_forward_compatibility.h> | ||
182 | 23 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | ||
183 | 22 | #include <mir_toolkit/mir_surface.h> | 24 | #include <mir_toolkit/mir_surface.h> |
184 | 25 | #else | ||
185 | 26 | #include <mir_toolkit/mir_window.h> | ||
186 | 27 | #include <mir_toolkit/mir_persistent_id.h> | ||
187 | 28 | #endif | ||
188 | 23 | 29 | ||
189 | 24 | #include <memory> | 30 | #include <memory> |
190 | 25 | 31 | ||
191 | @@ -32,7 +38,11 @@ | |||
192 | 32 | { | 38 | { |
193 | 33 | public: | 39 | public: |
194 | 34 | explicit PersistentId(MirPersistentId* id) : self{id, deleter} {} | 40 | explicit PersistentId(MirPersistentId* id) : self{id, deleter} {} |
196 | 35 | explicit PersistentId(MirSurface* surface) : PersistentId{mir_surface_request_persistent_id_sync(surface)} {} | 41 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
197 | 42 | explicit PersistentId(MirWindow* surface) : PersistentId{mir_surface_request_persistent_id_sync(surface)} {} | ||
198 | 43 | #else | ||
199 | 44 | explicit PersistentId(MirWindow* surface) : PersistentId{mir_window_request_persistent_id_sync(surface)} {} | ||
200 | 45 | #endif | ||
201 | 36 | 46 | ||
202 | 37 | auto c_str() const -> char const* { return mir_persistent_id_as_string(self.get()); } | 47 | auto c_str() const -> char const* { return mir_persistent_id_as_string(self.get()); } |
203 | 38 | 48 | ||
204 | 39 | 49 | ||
205 | === renamed file 'include/miral/toolkit/surface.h' => 'include/miral/toolkit/window.h' | |||
206 | --- include/miral/toolkit/surface.h 2016-09-13 17:09:04 +0000 | |||
207 | +++ include/miral/toolkit/window.h 2017-01-26 16:46:42 +0000 | |||
208 | @@ -1,5 +1,5 @@ | |||
209 | 1 | /* | 1 | /* |
211 | 2 | * Copyright © 2016 Canonical Ltd. | 2 | * Copyright © 2016-2017 Canonical Ltd. |
212 | 3 | * | 3 | * |
213 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
214 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
215 | @@ -16,10 +16,17 @@ | |||
216 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
217 | 17 | */ | 17 | */ |
218 | 18 | 18 | ||
222 | 19 | #ifndef MIRAL_TOOLKIT_SURFACE_H | 19 | #ifndef MIRAL_TOOLKIT_WINDOW_H |
223 | 20 | #define MIRAL_TOOLKIT_SURFACE_H | 20 | #define MIRAL_TOOLKIT_WINDOW_H |
224 | 21 | 21 | ||
225 | 22 | #include <miral/detail/mir_forward_compatibility.h> | ||
226 | 23 | |||
227 | 24 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | ||
228 | 22 | #include <mir_toolkit/mir_surface.h> | 25 | #include <mir_toolkit/mir_surface.h> |
229 | 26 | auto const mir_window_release_sync = mir_surface_release_sync; | ||
230 | 27 | #else | ||
231 | 28 | #include <mir_toolkit/mir_window.h> | ||
232 | 29 | #endif | ||
233 | 23 | 30 | ||
234 | 24 | #include <memory> | 31 | #include <memory> |
235 | 25 | 32 | ||
236 | @@ -27,23 +34,23 @@ | |||
237 | 27 | { | 34 | { |
238 | 28 | namespace toolkit | 35 | namespace toolkit |
239 | 29 | { | 36 | { |
242 | 30 | /// Handle class for MirSurface - provides automatic reference counting. | 37 | /// Handle class for MirWindow - provides automatic reference counting. |
243 | 31 | class Surface | 38 | class Window |
244 | 32 | { | 39 | { |
245 | 33 | public: | 40 | public: |
251 | 34 | Surface() = default; | 41 | Window() = default; |
252 | 35 | explicit Surface(MirSurface* spec) : self{spec, deleter} {} | 42 | explicit Window(MirWindow* spec) : self{spec, deleter} {} |
253 | 36 | 43 | ||
254 | 37 | 44 | ||
255 | 38 | operator MirSurface*() const { return self.get(); } | 45 | operator MirWindow*() const { return self.get(); } |
256 | 39 | 46 | ||
257 | 40 | void reset() { self.reset(); } | 47 | void reset() { self.reset(); } |
258 | 41 | 48 | ||
259 | 42 | private: | 49 | private: |
262 | 43 | static void deleter(MirSurface* surface) { mir_surface_release_sync(surface); } | 50 | static void deleter(MirWindow* window) { mir_window_release_sync(window); } |
263 | 44 | std::shared_ptr<MirSurface> self; | 51 | std::shared_ptr<MirWindow> self; |
264 | 45 | }; | 52 | }; |
265 | 46 | } | 53 | } |
266 | 47 | } | 54 | } |
267 | 48 | 55 | ||
269 | 49 | #endif //MIRAL_TOOLKIT_SURFACE_H | 56 | #endif //MIRAL_TOOLKIT_WINDOW_H |
270 | 50 | 57 | ||
271 | === renamed file 'include/miral/toolkit/surface_spec.h' => 'include/miral/toolkit/window_spec.h' | |||
272 | --- include/miral/toolkit/surface_spec.h 2016-11-30 08:22:39 +0000 | |||
273 | +++ include/miral/toolkit/window_spec.h 2017-01-26 16:46:42 +0000 | |||
274 | @@ -16,10 +16,11 @@ | |||
275 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
276 | 17 | */ | 17 | */ |
277 | 18 | 18 | ||
280 | 19 | #ifndef MIRAL_TOOLKIT_SURFACE_SPEC_H | 19 | #ifndef MIRAL_TOOLKIT_WINDOW_SPEC_H |
281 | 20 | #define MIRAL_TOOLKIT_SURFACE_SPEC_H | 20 | #define MIRAL_TOOLKIT_WINDOW_SPEC_H |
282 | 21 | 21 | ||
284 | 22 | #include <miral/toolkit/surface.h> | 22 | #include <miral/toolkit/window.h> |
285 | 23 | #include <miral/detail/mir_forward_compatibility.h> | ||
286 | 23 | 24 | ||
287 | 24 | #include <mir_toolkit/mir_surface.h> | 25 | #include <mir_toolkit/mir_surface.h> |
288 | 25 | #include <mir_toolkit/mir_connection.h> | 26 | #include <mir_toolkit/mir_connection.h> |
289 | @@ -31,26 +32,38 @@ | |||
290 | 31 | { | 32 | { |
291 | 32 | namespace toolkit | 33 | namespace toolkit |
292 | 33 | { | 34 | { |
295 | 34 | /// Handle class for MirSurfaceSpec - provides automatic reference counting, method chaining. | 35 | /// Handle class for MirWindowSpec - provides automatic reference counting, method chaining. |
296 | 35 | class SurfaceSpec | 36 | class WindowSpec |
297 | 36 | { | 37 | { |
298 | 37 | public: | 38 | public: |
300 | 38 | explicit SurfaceSpec(MirSurfaceSpec* spec) : self{spec, deleter} {} | 39 | explicit WindowSpec(MirWindowSpec* spec) : self{spec, deleter} {} |
301 | 39 | 40 | ||
303 | 40 | static auto for_normal_surface(MirConnection* connection, int width, int height, MirPixelFormat format) -> SurfaceSpec | 41 | static auto for_normal_surface(MirConnection* connection, int width, int height, MirPixelFormat format) -> WindowSpec |
304 | 41 | { | 42 | { |
306 | 42 | return SurfaceSpec{mir_connection_create_spec_for_normal_surface(connection, width, height, format)}; | 43 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
307 | 44 | return WindowSpec{mir_connection_create_spec_for_normal_surface(connection, width, height, format)}; | ||
308 | 45 | #else | ||
309 | 46 | auto spec = WindowSpec{mir_create_normal_window_spec(connection, width, height)}; | ||
310 | 47 | mir_window_spec_set_pixel_format(spec, format); | ||
311 | 48 | return spec; | ||
312 | 49 | #endif | ||
313 | 43 | } | 50 | } |
314 | 44 | 51 | ||
315 | 45 | static auto for_menu(MirConnection* connection, | 52 | static auto for_menu(MirConnection* connection, |
316 | 46 | int width, | 53 | int width, |
317 | 47 | int height, | 54 | int height, |
318 | 48 | MirPixelFormat format, | 55 | MirPixelFormat format, |
320 | 49 | MirSurface* parent, | 56 | MirWindow* parent, |
321 | 50 | MirRectangle* rect, | 57 | MirRectangle* rect, |
323 | 51 | MirEdgeAttachment edge) -> SurfaceSpec | 58 | MirEdgeAttachment edge) -> WindowSpec |
324 | 52 | { | 59 | { |
326 | 53 | return SurfaceSpec{mir_connection_create_spec_for_menu(connection, width, height, format, parent, rect, edge)}; | 60 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
327 | 61 | return WindowSpec{mir_connection_create_spec_for_menu(connection, width, height, format, parent, rect, edge)}; | ||
328 | 62 | #else | ||
329 | 63 | auto spec = WindowSpec{mir_create_menu_window_spec(connection, width, height, parent, rect, edge)}; | ||
330 | 64 | mir_window_spec_set_pixel_format(spec, format); | ||
331 | 65 | return spec; | ||
332 | 66 | #endif | ||
333 | 54 | } | 67 | } |
334 | 55 | 68 | ||
335 | 56 | #if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0) | 69 | #if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0) |
336 | @@ -58,87 +71,143 @@ | |||
337 | 58 | int width, | 71 | int width, |
338 | 59 | int height, | 72 | int height, |
339 | 60 | MirPixelFormat format, | 73 | MirPixelFormat format, |
341 | 61 | MirSurface* parent, | 74 | MirWindow* parent, |
342 | 62 | MirRectangle* rect, | 75 | MirRectangle* rect, |
344 | 63 | MirEdgeAttachment edge) -> SurfaceSpec | 76 | MirEdgeAttachment edge) -> WindowSpec |
345 | 64 | { | 77 | { |
347 | 65 | return SurfaceSpec{mir_connection_create_spec_for_tip(connection, width, height, format, parent, rect, edge)}; | 78 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
348 | 79 | return WindowSpec{mir_connection_create_spec_for_tip(connection, width, height, format, parent, rect, edge)}; | ||
349 | 80 | #else | ||
350 | 81 | auto spec = WindowSpec{mir_create_tip_window_spec(connection, width, height, parent, rect, edge)}; | ||
351 | 82 | mir_window_spec_set_pixel_format(spec, format); | ||
352 | 83 | return spec; | ||
353 | 84 | #endif | ||
354 | 66 | } | 85 | } |
355 | 67 | #endif | 86 | #endif |
356 | 68 | 87 | ||
357 | 69 | static auto for_dialog(MirConnection* connection, | 88 | static auto for_dialog(MirConnection* connection, |
358 | 70 | int width, | 89 | int width, |
359 | 71 | int height, | 90 | int height, |
361 | 72 | MirPixelFormat format)-> SurfaceSpec | 91 | MirPixelFormat format)-> WindowSpec |
362 | 73 | { | 92 | { |
364 | 74 | return SurfaceSpec{mir_connection_create_spec_for_dialog(connection, width, height, format)}; | 93 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
365 | 94 | return WindowSpec{mir_connection_create_spec_for_dialog(connection, width, height, format)}; | ||
366 | 95 | #else | ||
367 | 96 | auto spec = WindowSpec{mir_create_dialog_window_spec(connection, width, height)}; | ||
368 | 97 | mir_window_spec_set_pixel_format(spec, format); | ||
369 | 98 | return spec; | ||
370 | 99 | #endif | ||
371 | 75 | } | 100 | } |
372 | 76 | 101 | ||
373 | 77 | static auto for_dialog(MirConnection* connection, | 102 | static auto for_dialog(MirConnection* connection, |
374 | 78 | int width, | 103 | int width, |
375 | 79 | int height, | 104 | int height, |
376 | 80 | MirPixelFormat format, | 105 | MirPixelFormat format, |
378 | 81 | MirSurface* parent) -> SurfaceSpec | 106 | MirWindow* parent) -> WindowSpec |
379 | 82 | { | 107 | { |
380 | 83 | return for_dialog(connection, width, height, format).set_parent(parent); | 108 | return for_dialog(connection, width, height, format).set_parent(parent); |
381 | 84 | } | 109 | } |
382 | 85 | 110 | ||
384 | 86 | static auto for_changes(MirConnection* connection) -> SurfaceSpec | 111 | static auto for_changes(MirConnection* connection) -> WindowSpec |
385 | 87 | { | 112 | { |
387 | 88 | return SurfaceSpec{mir_connection_create_spec_for_changes(connection)}; | 113 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
388 | 114 | return WindowSpec{mir_connection_create_spec_for_changes(connection)}; | ||
389 | 115 | #else | ||
390 | 116 | return WindowSpec{mir_create_window_spec(connection)}; | ||
391 | 117 | #endif | ||
392 | 89 | } | 118 | } |
393 | 90 | 119 | ||
395 | 91 | auto set_buffer_usage(MirBufferUsage usage) -> SurfaceSpec& | 120 | auto set_buffer_usage(MirBufferUsage usage) -> WindowSpec& |
396 | 92 | { | 121 | { |
397 | 122 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
398 | 93 | mir_surface_spec_set_buffer_usage(*this, usage); | 123 | mir_surface_spec_set_buffer_usage(*this, usage); |
399 | 124 | #else | ||
400 | 125 | mir_window_spec_set_buffer_usage(*this, usage); | ||
401 | 126 | #endif | ||
402 | 94 | return *this; | 127 | return *this; |
403 | 95 | } | 128 | } |
404 | 96 | 129 | ||
406 | 97 | auto set_type(MirSurfaceType type) -> SurfaceSpec& | 130 | auto set_type(MirWindowType type) -> WindowSpec& |
407 | 98 | { | 131 | { |
408 | 132 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
409 | 99 | mir_surface_spec_set_type(*this, type); | 133 | mir_surface_spec_set_type(*this, type); |
410 | 134 | #else | ||
411 | 135 | mir_window_spec_set_type(*this, type); | ||
412 | 136 | #endif | ||
413 | 100 | return *this; | 137 | return *this; |
414 | 101 | } | 138 | } |
415 | 102 | 139 | ||
417 | 103 | auto set_min_size(int min_width, int min_height) -> SurfaceSpec& | 140 | auto set_min_size(int min_width, int min_height) -> WindowSpec& |
418 | 104 | { | 141 | { |
419 | 142 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
420 | 105 | mir_surface_spec_set_min_width(*this, min_width); | 143 | mir_surface_spec_set_min_width(*this, min_width); |
421 | 106 | mir_surface_spec_set_min_height(*this, min_height); | 144 | mir_surface_spec_set_min_height(*this, min_height); |
422 | 145 | #else | ||
423 | 146 | mir_window_spec_set_min_width(*this, min_width); | ||
424 | 147 | mir_window_spec_set_min_height(*this, min_height); | ||
425 | 148 | #endif | ||
426 | 107 | return *this; | 149 | return *this; |
427 | 108 | } | 150 | } |
428 | 109 | 151 | ||
430 | 110 | auto set_max_size(int max_width, int max_height) -> SurfaceSpec& | 152 | auto set_max_size(int max_width, int max_height) -> WindowSpec& |
431 | 111 | { | 153 | { |
432 | 154 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
433 | 112 | mir_surface_spec_set_max_width(*this, max_width); | 155 | mir_surface_spec_set_max_width(*this, max_width); |
434 | 113 | mir_surface_spec_set_max_height(*this, max_height); | 156 | mir_surface_spec_set_max_height(*this, max_height); |
435 | 157 | #else | ||
436 | 158 | mir_window_spec_set_max_width(*this, max_width); | ||
437 | 159 | mir_window_spec_set_max_height(*this, max_height); | ||
438 | 160 | #endif | ||
439 | 114 | return *this; | 161 | return *this; |
440 | 115 | } | 162 | } |
441 | 116 | 163 | ||
443 | 117 | auto set_size_inc(int width_inc, int height_inc) -> SurfaceSpec& | 164 | auto set_size_inc(int width_inc, int height_inc) -> WindowSpec& |
444 | 118 | { | 165 | { |
445 | 166 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
446 | 119 | mir_surface_spec_set_width_increment(*this, width_inc); | 167 | mir_surface_spec_set_width_increment(*this, width_inc); |
447 | 120 | mir_surface_spec_set_height_increment(*this, height_inc); | 168 | mir_surface_spec_set_height_increment(*this, height_inc); |
448 | 169 | #else | ||
449 | 170 | mir_window_spec_set_width_increment(*this, width_inc); | ||
450 | 171 | mir_window_spec_set_height_increment(*this, height_inc); | ||
451 | 172 | #endif | ||
452 | 121 | return *this; | 173 | return *this; |
453 | 122 | } | 174 | } |
454 | 123 | 175 | ||
456 | 124 | auto set_size(int width, int height) -> SurfaceSpec& | 176 | auto set_size(int width, int height) -> WindowSpec& |
457 | 125 | { | 177 | { |
458 | 178 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
459 | 126 | mir_surface_spec_set_width(*this, width); | 179 | mir_surface_spec_set_width(*this, width); |
460 | 127 | mir_surface_spec_set_height(*this, height); | 180 | mir_surface_spec_set_height(*this, height); |
461 | 181 | #else | ||
462 | 182 | mir_window_spec_set_width(*this, width); | ||
463 | 183 | mir_window_spec_set_height(*this, height); | ||
464 | 184 | #endif | ||
465 | 128 | return *this; | 185 | return *this; |
466 | 129 | } | 186 | } |
467 | 130 | 187 | ||
469 | 131 | auto set_name(char const* name) -> SurfaceSpec& | 188 | auto set_name(char const* name) -> WindowSpec& |
470 | 132 | { | 189 | { |
471 | 190 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
472 | 133 | mir_surface_spec_set_name(*this, name); | 191 | mir_surface_spec_set_name(*this, name); |
473 | 192 | #else | ||
474 | 193 | mir_window_spec_set_name(*this, name); | ||
475 | 194 | #endif | ||
476 | 134 | return *this; | 195 | return *this; |
477 | 135 | } | 196 | } |
478 | 136 | 197 | ||
480 | 137 | auto set_event_handler(mir_surface_event_callback callback, void* context) -> SurfaceSpec& | 198 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
481 | 199 | auto set_event_handler(mir_surface_event_callback callback, void* context) -> WindowSpec& | ||
482 | 138 | { | 200 | { |
483 | 139 | mir_surface_spec_set_event_handler(*this, callback, context); | 201 | mir_surface_spec_set_event_handler(*this, callback, context); |
484 | 140 | return *this; | 202 | return *this; |
485 | 141 | } | 203 | } |
486 | 204 | #else | ||
487 | 205 | auto set_event_handler(MirWindowEventCallback callback, void* context) -> WindowSpec& | ||
488 | 206 | { | ||
489 | 207 | mir_window_spec_set_event_handler(*this, callback, context); | ||
490 | 208 | return *this; | ||
491 | 209 | } | ||
492 | 210 | #endif | ||
493 | 142 | 211 | ||
494 | 143 | #if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0) | 212 | #if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0) |
495 | 144 | auto set_placement(const MirRectangle* rect, | 213 | auto set_placement(const MirRectangle* rect, |
496 | @@ -146,42 +215,66 @@ | |||
497 | 146 | MirPlacementGravity surface_gravity, | 215 | MirPlacementGravity surface_gravity, |
498 | 147 | MirPlacementHints placement_hints, | 216 | MirPlacementHints placement_hints, |
499 | 148 | int offset_dx, | 217 | int offset_dx, |
501 | 149 | int offset_dy) -> SurfaceSpec& | 218 | int offset_dy) -> WindowSpec& |
502 | 150 | { | 219 | { |
503 | 220 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
504 | 151 | mir_surface_spec_set_placement(*this, rect, rect_gravity, surface_gravity, placement_hints, offset_dx, offset_dy); | 221 | mir_surface_spec_set_placement(*this, rect, rect_gravity, surface_gravity, placement_hints, offset_dx, offset_dy); |
505 | 222 | #else | ||
506 | 223 | mir_window_spec_set_placement(*this, rect, rect_gravity, surface_gravity, placement_hints, offset_dx, offset_dy); | ||
507 | 224 | #endif | ||
508 | 152 | return *this; | 225 | return *this; |
509 | 153 | } | 226 | } |
510 | 154 | #endif | 227 | #endif |
511 | 155 | 228 | ||
513 | 156 | auto set_parent(MirSurface* parent) -> SurfaceSpec& | 229 | auto set_parent(MirWindow* parent) -> WindowSpec& |
514 | 157 | { | 230 | { |
515 | 231 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
516 | 158 | mir_surface_spec_set_parent(*this, parent); | 232 | mir_surface_spec_set_parent(*this, parent); |
517 | 233 | #else | ||
518 | 234 | mir_window_spec_set_parent(*this, parent); | ||
519 | 235 | #endif | ||
520 | 159 | return *this; | 236 | return *this; |
521 | 160 | } | 237 | } |
522 | 161 | 238 | ||
523 | 162 | template<typename Context> | 239 | template<typename Context> |
525 | 163 | void create_surface(void (*callback)(MirSurface*, Context*), Context* context) const | 240 | void create_surface(void (*callback)(MirWindow*, Context*), Context* context) const |
526 | 164 | { | 241 | { |
527 | 242 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
528 | 165 | mir_surface_create(*this, reinterpret_cast<mir_surface_callback>(callback), context); | 243 | mir_surface_create(*this, reinterpret_cast<mir_surface_callback>(callback), context); |
538 | 166 | } | 244 | #else |
539 | 167 | 245 | mir_create_window(*this, reinterpret_cast<MirWindowCallback>(callback), context); | |
540 | 168 | auto create_surface() const -> Surface | 246 | #endif |
541 | 169 | { | 247 | } |
542 | 170 | return Surface{mir_surface_create_sync(*this)}; | 248 | |
543 | 171 | } | 249 | auto create_surface() const -> Window |
544 | 172 | 250 | { | |
545 | 173 | void apply_to(MirSurface* surface) const | 251 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
546 | 174 | { | 252 | return Window{mir_surface_create_sync(*this)}; |
547 | 253 | #else | ||
548 | 254 | return Window{mir_create_window_sync(*this)}; | ||
549 | 255 | #endif | ||
550 | 256 | } | ||
551 | 257 | |||
552 | 258 | void apply_to(MirWindow* surface) const | ||
553 | 259 | { | ||
554 | 260 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
555 | 175 | mir_surface_apply_spec(surface, *this); | 261 | mir_surface_apply_spec(surface, *this); |
556 | 262 | #else | ||
557 | 263 | mir_window_apply_spec(surface, *this); | ||
558 | 264 | #endif | ||
559 | 176 | } | 265 | } |
560 | 177 | 266 | ||
562 | 178 | operator MirSurfaceSpec*() const { return self.get(); } | 267 | operator MirWindowSpec*() const { return self.get(); } |
563 | 179 | 268 | ||
564 | 180 | private: | 269 | private: |
567 | 181 | static void deleter(MirSurfaceSpec* spec) { mir_surface_spec_release(spec); } | 270 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) |
568 | 182 | std::shared_ptr<MirSurfaceSpec> self; | 271 | static void deleter(MirWindowSpec* spec) { mir_surface_spec_release(spec); } |
569 | 272 | #else | ||
570 | 273 | static void deleter(MirWindowSpec* spec) { mir_window_spec_release(spec); } | ||
571 | 274 | #endif | ||
572 | 275 | std::shared_ptr<MirWindowSpec> self; | ||
573 | 183 | }; | 276 | }; |
574 | 184 | } | 277 | } |
575 | 185 | } | 278 | } |
576 | 186 | 279 | ||
578 | 187 | #endif //MIRAL_TOOLKIT_SURFACE_SPEC_H_H | 280 | #endif //MIRAL_TOOLKIT_WINDOW_SPEC_H_H |
579 | 188 | 281 | ||
580 | === modified file 'include/miral/window_info.h' | |||
581 | --- include/miral/window_info.h 2016-12-13 13:07:15 +0000 | |||
582 | +++ include/miral/window_info.h 2017-01-26 16:46:42 +0000 | |||
583 | @@ -41,7 +41,7 @@ | |||
584 | 41 | 41 | ||
585 | 42 | bool can_be_active() const; | 42 | bool can_be_active() const; |
586 | 43 | 43 | ||
588 | 44 | bool can_morph_to(MirSurfaceType new_type) const; | 44 | bool can_morph_to(MirWindowType new_type) const; |
589 | 45 | 45 | ||
590 | 46 | bool must_have_parent() const; | 46 | bool must_have_parent() const; |
591 | 47 | 47 | ||
592 | @@ -49,7 +49,7 @@ | |||
593 | 49 | 49 | ||
594 | 50 | bool is_visible() const; | 50 | bool is_visible() const; |
595 | 51 | 51 | ||
597 | 52 | static bool needs_titlebar(MirSurfaceType type); | 52 | static bool needs_titlebar(MirWindowType type); |
598 | 53 | 53 | ||
599 | 54 | void constrain_resize(mir::geometry::Point& requested_pos, mir::geometry::Size& requested_size) const; | 54 | void constrain_resize(mir::geometry::Point& requested_pos, mir::geometry::Size& requested_size) const; |
600 | 55 | 55 | ||
601 | @@ -58,11 +58,11 @@ | |||
602 | 58 | auto name() const -> std::string; | 58 | auto name() const -> std::string; |
603 | 59 | void name(std::string const& name); | 59 | void name(std::string const& name); |
604 | 60 | 60 | ||
607 | 61 | auto type() const -> MirSurfaceType; | 61 | auto type() const -> MirWindowType; |
608 | 62 | void type(MirSurfaceType type); | 62 | void type(MirWindowType type); |
609 | 63 | 63 | ||
612 | 64 | auto state() const -> MirSurfaceState; | 64 | auto state() const -> MirWindowState; |
613 | 65 | void state(MirSurfaceState state); | 65 | void state(MirWindowState state); |
614 | 66 | 66 | ||
615 | 67 | auto restore_rect() const -> mir::geometry::Rectangle; | 67 | auto restore_rect() const -> mir::geometry::Rectangle; |
616 | 68 | void restore_rect(mir::geometry::Rectangle const& restore_rect); | 68 | void restore_rect(mir::geometry::Rectangle const& restore_rect); |
617 | 69 | 69 | ||
618 | === modified file 'include/miral/window_management_policy.h' | |||
619 | --- include/miral/window_management_policy.h 2016-12-05 09:46:35 +0000 | |||
620 | +++ include/miral/window_management_policy.h 2017-01-26 16:46:42 +0000 | |||
621 | @@ -23,6 +23,8 @@ | |||
622 | 23 | #include <mir/geometry/rectangles.h> | 23 | #include <mir/geometry/rectangles.h> |
623 | 24 | #include <mir_toolkit/event.h> | 24 | #include <mir_toolkit/event.h> |
624 | 25 | 25 | ||
625 | 26 | #include <miral/detail/mir_forward_compatibility.h> | ||
626 | 27 | |||
627 | 26 | namespace miral | 28 | namespace miral |
628 | 27 | { | 29 | { |
629 | 28 | class Window; | 30 | class Window; |
630 | @@ -44,11 +46,11 @@ | |||
631 | 44 | 46 | ||
632 | 45 | /** Customize initial window placement | 47 | /** Customize initial window placement |
633 | 46 | * | 48 | * |
635 | 47 | * @param app_info the application requesting a new surface | 49 | * @param app_info the application requesting a new window |
636 | 48 | * @param requested_specification the requested specification (updated with default placement) | 50 | * @param requested_specification the requested specification (updated with default placement) |
637 | 49 | * @return the customized specification | 51 | * @return the customized specification |
638 | 50 | */ | 52 | */ |
640 | 51 | virtual auto place_new_surface( | 53 | virtual auto place_new_window( |
641 | 52 | ApplicationInfo const& app_info, | 54 | ApplicationInfo const& app_info, |
642 | 53 | WindowSpecification const& requested_specification) -> WindowSpecification = 0; | 55 | WindowSpecification const& requested_specification) -> WindowSpecification = 0; |
643 | 54 | 56 | ||
644 | @@ -141,7 +143,7 @@ | |||
645 | 141 | * @param window_info the window | 143 | * @param window_info the window |
646 | 142 | * @param state the new state | 144 | * @param state the new state |
647 | 143 | */ | 145 | */ |
649 | 144 | virtual void advise_state_change(WindowInfo const& window_info, MirSurfaceState state); | 146 | virtual void advise_state_change(WindowInfo const& window_info, MirWindowState state); |
650 | 145 | 147 | ||
651 | 146 | /** Notification that a window is about to move | 148 | /** Notification that a window is about to move |
652 | 147 | * | 149 | * |
653 | 148 | 150 | ||
654 | === modified file 'include/miral/window_specification.h' | |||
655 | --- include/miral/window_specification.h 2016-09-30 16:29:43 +0000 | |||
656 | +++ include/miral/window_specification.h 2017-01-26 16:46:42 +0000 | |||
657 | @@ -21,7 +21,7 @@ | |||
658 | 21 | 21 | ||
659 | 22 | #include <mir_toolkit/common.h> | 22 | #include <mir_toolkit/common.h> |
660 | 23 | 23 | ||
662 | 24 | #include "miral/detail/mir_forward_compatibility.h" | 24 | #include <miral/detail/mir_forward_compatibility.h> |
663 | 25 | 25 | ||
664 | 26 | #include <mir/geometry/displacement.h> | 26 | #include <mir/geometry/displacement.h> |
665 | 27 | #include <mir/geometry/rectangles.h> | 27 | #include <mir/geometry/rectangles.h> |
666 | @@ -76,8 +76,8 @@ | |||
667 | 76 | auto size() const -> mir::optional_value<Size> const&; | 76 | auto size() const -> mir::optional_value<Size> const&; |
668 | 77 | auto name() const -> mir::optional_value<std::string> const&; | 77 | auto name() const -> mir::optional_value<std::string> const&; |
669 | 78 | auto output_id() const -> mir::optional_value<int> const&; | 78 | auto output_id() const -> mir::optional_value<int> const&; |
672 | 79 | auto type() const -> mir::optional_value<MirSurfaceType> const&; | 79 | auto type() const -> mir::optional_value<MirWindowType> const&; |
673 | 80 | auto state() const -> mir::optional_value<MirSurfaceState> const&; | 80 | auto state() const -> mir::optional_value<MirWindowState> const&; |
674 | 81 | auto preferred_orientation() const -> mir::optional_value<MirOrientationMode> const&; | 81 | auto preferred_orientation() const -> mir::optional_value<MirOrientationMode> const&; |
675 | 82 | auto aux_rect() const -> mir::optional_value<Rectangle> const&; | 82 | auto aux_rect() const -> mir::optional_value<Rectangle> const&; |
676 | 83 | auto placement_hints() const -> mir::optional_value<MirPlacementHints> const&; | 83 | auto placement_hints() const -> mir::optional_value<MirPlacementHints> const&; |
677 | @@ -104,8 +104,8 @@ | |||
678 | 104 | auto size() -> mir::optional_value<Size>&; | 104 | auto size() -> mir::optional_value<Size>&; |
679 | 105 | auto name() -> mir::optional_value<std::string>&; | 105 | auto name() -> mir::optional_value<std::string>&; |
680 | 106 | auto output_id() -> mir::optional_value<int>&; | 106 | auto output_id() -> mir::optional_value<int>&; |
683 | 107 | auto type() -> mir::optional_value<MirSurfaceType>&; | 107 | auto type() -> mir::optional_value<MirWindowType>&; |
684 | 108 | auto state() -> mir::optional_value<MirSurfaceState>&; | 108 | auto state() -> mir::optional_value<MirWindowState>&; |
685 | 109 | auto preferred_orientation() -> mir::optional_value<MirOrientationMode>&; | 109 | auto preferred_orientation() -> mir::optional_value<MirOrientationMode>&; |
686 | 110 | auto aux_rect() -> mir::optional_value<Rectangle>&; | 110 | auto aux_rect() -> mir::optional_value<Rectangle>&; |
687 | 111 | auto placement_hints() -> mir::optional_value<MirPlacementHints>&; | 111 | auto placement_hints() -> mir::optional_value<MirPlacementHints>&; |
688 | 112 | 112 | ||
689 | === modified file 'miral-kiosk/kiosk_window_manager.cpp' | |||
690 | --- miral-kiosk/kiosk_window_manager.cpp 2016-11-08 11:16:10 +0000 | |||
691 | +++ miral-kiosk/kiosk_window_manager.cpp 2017-01-26 16:46:42 +0000 | |||
692 | @@ -125,16 +125,16 @@ | |||
693 | 125 | 125 | ||
694 | 126 | void KioskWindowManagerPolicy::advise_new_window(WindowInfo const& window_info) | 126 | void KioskWindowManagerPolicy::advise_new_window(WindowInfo const& window_info) |
695 | 127 | { | 127 | { |
697 | 128 | // We do this here, not in place_new_surface() so that clients get a resize event. | 128 | // We do this here, not in place_new_window() so that clients get a resize event. |
698 | 129 | // This shouldn't be necessary, but works better with the gtk-mir backend. | 129 | // This shouldn't be necessary, but works better with the gtk-mir backend. |
699 | 130 | if (maximize_root_windows && | 130 | if (maximize_root_windows && |
701 | 131 | window_info.type() == mir_surface_type_normal && | 131 | window_info.type() == mir_window_type_normal && |
702 | 132 | !window_info.parent() && | 132 | !window_info.parent() && |
704 | 133 | window_info.state() == mir_surface_state_restored) | 133 | window_info.state() == mir_window_state_restored) |
705 | 134 | { | 134 | { |
706 | 135 | WindowSpecification specification; | 135 | WindowSpecification specification; |
707 | 136 | 136 | ||
709 | 137 | specification.state() = mir_surface_state_maximized; | 137 | specification.state() = mir_window_state_maximized; |
710 | 138 | 138 | ||
711 | 139 | tools.place_and_size_for_state(specification, window_info); | 139 | tools.place_and_size_for_state(specification, window_info); |
712 | 140 | tools.modify_window(window_info.window(), specification); | 140 | tools.modify_window(window_info.window(), specification); |
713 | 141 | 141 | ||
714 | === modified file 'miral-kiosk/sw_splash.cpp' | |||
715 | --- miral-kiosk/sw_splash.cpp 2016-05-11 11:45:10 +0000 | |||
716 | +++ miral-kiosk/sw_splash.cpp 2017-01-26 16:46:42 +0000 | |||
717 | @@ -18,8 +18,14 @@ | |||
718 | 18 | 18 | ||
719 | 19 | #include "sw_splash.h" | 19 | #include "sw_splash.h" |
720 | 20 | 20 | ||
721 | 21 | #include <miral/detail/mir_forward_compatibility.h> | ||
722 | 22 | |||
723 | 21 | #include <mir_toolkit/mir_connection.h> | 23 | #include <mir_toolkit/mir_connection.h> |
724 | 24 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | ||
725 | 22 | #include <mir_toolkit/mir_surface.h> | 25 | #include <mir_toolkit/mir_surface.h> |
726 | 26 | #else | ||
727 | 27 | #include <mir_toolkit/mir_window.h> | ||
728 | 28 | #endif | ||
729 | 23 | #include <mir_toolkit/mir_buffer_stream.h> | 29 | #include <mir_toolkit/mir_buffer_stream.h> |
730 | 24 | 30 | ||
731 | 25 | #include <chrono> | 31 | #include <chrono> |
732 | @@ -59,9 +65,9 @@ | |||
733 | 59 | return *pixel_formats; | 65 | return *pixel_formats; |
734 | 60 | } | 66 | } |
735 | 61 | 67 | ||
737 | 62 | auto create_surface(MirConnection* connection, MirPixelFormat pixel_format) -> MirSurface* | 68 | auto create_window(MirConnection* connection, MirPixelFormat pixel_format) -> MirWindow* |
738 | 63 | { | 69 | { |
740 | 64 | 70 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | |
741 | 65 | auto* spec = mir_connection_create_spec_for_normal_surface(connection, 42, 42, pixel_format); | 71 | auto* spec = mir_connection_create_spec_for_normal_surface(connection, 42, 42, pixel_format); |
742 | 66 | 72 | ||
743 | 67 | mir_surface_spec_set_name(spec, "splash"); | 73 | mir_surface_spec_set_name(spec, "splash"); |
744 | @@ -70,6 +76,17 @@ | |||
745 | 70 | 76 | ||
746 | 71 | auto const surface = mir_surface_create_sync(spec); | 77 | auto const surface = mir_surface_create_sync(spec); |
747 | 72 | mir_surface_spec_release(spec); | 78 | mir_surface_spec_release(spec); |
748 | 79 | #else | ||
749 | 80 | auto* spec = mir_create_normal_window_spec(connection, 42, 42); | ||
750 | 81 | |||
751 | 82 | mir_window_spec_set_name(spec, "splash"); | ||
752 | 83 | mir_window_spec_set_buffer_usage(spec, mir_buffer_usage_software); | ||
753 | 84 | mir_window_spec_set_fullscreen_on_output(spec, 0); | ||
754 | 85 | mir_window_spec_set_pixel_format(spec, pixel_format); | ||
755 | 86 | |||
756 | 87 | auto const surface = mir_create_window_sync(spec); | ||
757 | 88 | mir_window_spec_release(spec); | ||
758 | 89 | #endif | ||
759 | 73 | 90 | ||
760 | 74 | return surface; | 91 | return surface; |
761 | 75 | } | 92 | } |
762 | @@ -133,10 +150,14 @@ | |||
763 | 133 | return; | 150 | return; |
764 | 134 | }; | 151 | }; |
765 | 135 | 152 | ||
767 | 136 | auto const surface = create_surface(connection, pixel_format); | 153 | auto const surface = create_window(connection, pixel_format); |
768 | 137 | 154 | ||
769 | 138 | MirGraphicsRegion graphics_region; | 155 | MirGraphicsRegion graphics_region; |
770 | 156 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | ||
771 | 139 | MirBufferStream* buffer_stream = mir_surface_get_buffer_stream(surface); | 157 | MirBufferStream* buffer_stream = mir_surface_get_buffer_stream(surface); |
772 | 158 | #else | ||
773 | 159 | MirBufferStream* buffer_stream = mir_window_get_buffer_stream(surface); | ||
774 | 160 | #endif | ||
775 | 140 | 161 | ||
776 | 141 | auto const time_limit = std::chrono::steady_clock::now() + std::chrono::seconds(2); | 162 | auto const time_limit = std::chrono::steady_clock::now() + std::chrono::seconds(2); |
777 | 142 | 163 | ||
778 | @@ -154,5 +175,9 @@ | |||
779 | 154 | } | 175 | } |
780 | 155 | while (std::chrono::steady_clock::now() < time_limit); | 176 | while (std::chrono::steady_clock::now() < time_limit); |
781 | 156 | 177 | ||
782 | 178 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | ||
783 | 157 | mir_surface_release_sync(surface); | 179 | mir_surface_release_sync(surface); |
784 | 180 | #else | ||
785 | 181 | mir_window_release_sync(surface); | ||
786 | 182 | #endif | ||
787 | 158 | } | 183 | } |
788 | 159 | 184 | ||
789 | === modified file 'miral-shell/miral-screencast.sh' | |||
790 | --- miral-shell/miral-screencast.sh 2016-11-10 15:10:32 +0000 | |||
791 | +++ miral-shell/miral-screencast.sh 2017-01-26 16:46:42 +0000 | |||
792 | @@ -16,11 +16,13 @@ | |||
793 | 16 | echo " --height set the capture height [${height}]" | 16 | echo " --height set the capture height [${height}]" |
794 | 17 | echo " --output set the output filename [${output}]" | 17 | echo " --output set the output filename [${output}]" |
795 | 18 | echo " --socket set the mir socket [${socket}]" | 18 | echo " --socket set the mir socket [${socket}]" |
796 | 19 | echo " --tmpfile specify the temporary work file" | ||
797 | 19 | exit 0 | 20 | exit 0 |
798 | 20 | elif [ "$1" == "--socket" ]; then shift; socket=$1 | 21 | elif [ "$1" == "--socket" ]; then shift; socket=$1 |
799 | 21 | elif [ "$1" == "--output" ]; then shift; output=$1 | 22 | elif [ "$1" == "--output" ]; then shift; output=$1 |
800 | 22 | elif [ "$1" == "--width" ]; then shift; width=$1 | 23 | elif [ "$1" == "--width" ]; then shift; width=$1 |
801 | 23 | elif [ "$1" == "--height" ]; then shift; height=$1 | 24 | elif [ "$1" == "--height" ]; then shift; height=$1 |
802 | 25 | elif [ "$1" == "--tmpfile" ]; then shift; tempfile=$1 | ||
803 | 24 | fi | 26 | fi |
804 | 25 | shift | 27 | shift |
805 | 26 | done | 28 | done |
806 | @@ -36,7 +38,7 @@ | |||
807 | 36 | if [ -e ${output} ]; then echo "Output exists, moving to ${output}~"; mv ${output} ${output}~ ;fi | 38 | if [ -e ${output} ]; then echo "Output exists, moving to ${output}~"; mv ${output} ${output}~ ;fi |
808 | 37 | while [ ! -e "${socket}" ]; do echo "waiting for ${socket}"; sleep 1 ;done | 39 | while [ ! -e "${socket}" ]; do echo "waiting for ${socket}"; sleep 1 ;done |
809 | 38 | 40 | ||
811 | 39 | tempfile=$(mktemp) | 41 | if [ ! -v tempfile ]; then tempfile=$(mktemp); fi |
812 | 40 | mirscreencast --size ${width} ${height} -m ${socket} -f ${tempfile}& mirscreencast_pid=$! | 42 | mirscreencast --size ${width} ${height} -m ${socket} -f ${tempfile}& mirscreencast_pid=$! |
813 | 41 | trap 'kill ${mirscreencast_pid}; rm -f -- "${tempfile}"; exit 0' INT TERM HUP EXIT | 43 | trap 'kill ${mirscreencast_pid}; rm -f -- "${tempfile}"; exit 0' INT TERM HUP EXIT |
814 | 42 | 44 | ||
815 | 43 | 45 | ||
816 | === modified file 'miral-shell/spinner/eglapp.cpp' | |||
817 | --- miral-shell/spinner/eglapp.cpp 2016-10-07 11:06:14 +0000 | |||
818 | +++ miral-shell/spinner/eglapp.cpp 2017-01-26 16:46:42 +0000 | |||
819 | @@ -18,6 +18,7 @@ | |||
820 | 18 | 18 | ||
821 | 19 | #include "miregl.h" | 19 | #include "miregl.h" |
822 | 20 | 20 | ||
823 | 21 | #include <mir_toolkit/version.h> | ||
824 | 21 | 22 | ||
825 | 22 | 23 | ||
826 | 23 | float mir_eglapp_background_opacity = 1.0f; | 24 | float mir_eglapp_background_opacity = 1.0f; |
827 | @@ -31,6 +32,7 @@ | |||
828 | 31 | { | 32 | { |
829 | 32 | /* eglapps are interested in the screen size, so | 33 | /* eglapps are interested in the screen size, so |
830 | 33 | use mir_connection_create_display_config */ | 34 | use mir_connection_create_display_config */ |
831 | 35 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | ||
832 | 34 | MirDisplayConfiguration* display_config = | 36 | MirDisplayConfiguration* display_config = |
833 | 35 | mir_connection_create_display_config(connection); | 37 | mir_connection_create_display_config(connection); |
834 | 36 | 38 | ||
835 | @@ -48,6 +50,25 @@ | |||
836 | 48 | } | 50 | } |
837 | 49 | 51 | ||
838 | 50 | mir_display_config_destroy(display_config); | 52 | mir_display_config_destroy(display_config); |
839 | 53 | #else | ||
840 | 54 | MirDisplayConfig* display_config = | ||
841 | 55 | mir_connection_create_display_configuration(connection); | ||
842 | 56 | |||
843 | 57 | int const n = mir_display_config_get_num_outputs(display_config); | ||
844 | 58 | |||
845 | 59 | for (int i = 0; i != n; ++i) | ||
846 | 60 | { | ||
847 | 61 | MirOutput const *const output = mir_display_config_get_output(display_config, i); | ||
848 | 62 | if (mir_output_is_enabled(output) && | ||
849 | 63 | mir_output_get_connection_state(output) == mir_output_connection_state_connected && | ||
850 | 64 | mir_output_get_num_modes(output) && | ||
851 | 65 | mir_output_get_current_mode_index(output) < (size_t)mir_output_get_num_modes(output)) | ||
852 | 66 | { | ||
853 | 67 | handler(output); | ||
854 | 68 | } | ||
855 | 69 | } | ||
856 | 70 | mir_display_config_release(display_config); | ||
857 | 71 | #endif | ||
858 | 51 | } | 72 | } |
859 | 52 | 73 | ||
860 | 53 | MirPixelFormat select_pixel_format(MirConnection* connection) | 74 | MirPixelFormat select_pixel_format(MirConnection* connection) |
861 | @@ -72,7 +93,7 @@ | |||
862 | 72 | 93 | ||
863 | 73 | std::vector<std::shared_ptr<MirEglSurface>> mir_eglapp_init(MirConnection* const connection) | 94 | std::vector<std::shared_ptr<MirEglSurface>> mir_eglapp_init(MirConnection* const connection) |
864 | 74 | { | 95 | { |
866 | 75 | MirSurfaceParameters surfaceparm = | 96 | MirWindowParameters surfaceparm = |
867 | 76 | { | 97 | { |
868 | 77 | "eglappsurface", | 98 | "eglappsurface", |
869 | 78 | 0, 0, | 99 | 0, 0, |
870 | @@ -108,6 +129,7 @@ | |||
871 | 108 | } | 129 | } |
872 | 109 | 130 | ||
873 | 110 | // but normally, we're fullscreen on every active output | 131 | // but normally, we're fullscreen on every active output |
874 | 132 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | ||
875 | 111 | for_each_active_output(connection, [&](MirDisplayOutput const* output) | 133 | for_each_active_output(connection, [&](MirDisplayOutput const* output) |
876 | 112 | { | 134 | { |
877 | 113 | auto const& mode = output->modes[output->current_mode]; | 135 | auto const& mode = output->modes[output->current_mode]; |
878 | @@ -120,6 +142,20 @@ | |||
879 | 120 | surfaceparm.output_id = output->output_id; | 142 | surfaceparm.output_id = output->output_id; |
880 | 121 | result.push_back(std::make_shared<MirEglSurface>(mir_egl_app, surfaceparm, swapinterval)); | 143 | result.push_back(std::make_shared<MirEglSurface>(mir_egl_app, surfaceparm, swapinterval)); |
881 | 122 | }); | 144 | }); |
882 | 145 | #else | ||
883 | 146 | for_each_active_output(connection, [&](MirOutput const* output) | ||
884 | 147 | { | ||
885 | 148 | auto const& mode = mir_output_get_current_mode(output); | ||
886 | 149 | |||
887 | 150 | printf("Active output [%u] at (%d, %d) is %dx%d\n", | ||
888 | 151 | mir_output_get_id(output), | ||
889 | 152 | mir_output_get_position_x(output), mir_output_get_position_y(output), | ||
890 | 153 | mir_output_mode_get_width(mode), mir_output_mode_get_height(mode)); | ||
891 | 154 | |||
892 | 155 | surfaceparm.output_id = mir_output_get_id(output); | ||
893 | 156 | result.push_back(std::make_shared<MirEglSurface>(mir_egl_app, surfaceparm, swapinterval)); | ||
894 | 157 | }); | ||
895 | 158 | #endif | ||
896 | 123 | 159 | ||
897 | 124 | if (result.empty()) | 160 | if (result.empty()) |
898 | 125 | throw std::runtime_error("No active outputs found."); | 161 | throw std::runtime_error("No active outputs found."); |
899 | 126 | 162 | ||
900 | === modified file 'miral-shell/spinner/miregl.cpp' | |||
901 | --- miral-shell/spinner/miregl.cpp 2016-09-16 16:07:56 +0000 | |||
902 | +++ miral-shell/spinner/miregl.cpp 2017-01-26 16:46:42 +0000 | |||
903 | @@ -15,6 +15,7 @@ | |||
904 | 15 | */ | 15 | */ |
905 | 16 | 16 | ||
906 | 17 | #include "miregl.h" | 17 | #include "miregl.h" |
907 | 18 | #include <mir_toolkit/version.h> | ||
908 | 18 | 19 | ||
909 | 19 | #include <cstring> | 20 | #include <cstring> |
910 | 20 | 21 | ||
911 | @@ -25,7 +26,7 @@ | |||
912 | 25 | public: | 26 | public: |
913 | 26 | MirEglApp(MirConnection* const connection, MirPixelFormat pixel_format); | 27 | MirEglApp(MirConnection* const connection, MirPixelFormat pixel_format); |
914 | 27 | 28 | ||
916 | 28 | EGLSurface create_surface(MirSurface* surface); | 29 | EGLSurface create_surface(MirWindow* window); |
917 | 29 | 30 | ||
918 | 30 | void make_current(EGLSurface eglsurface) const; | 31 | void make_current(EGLSurface eglsurface) const; |
919 | 31 | 32 | ||
920 | @@ -58,19 +59,20 @@ | |||
921 | 58 | 59 | ||
922 | 59 | namespace | 60 | namespace |
923 | 60 | { | 61 | { |
925 | 61 | MirSurface* create_surface(MirConnection* const connection, MirSurfaceParameters const& surfaceparm) | 62 | MirWindow* create_surface(MirConnection* const connection, MirWindowParameters const& parameters) |
926 | 62 | { | 63 | { |
927 | 64 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | ||
928 | 63 | auto const spec = mir_connection_create_spec_for_normal_surface( | 65 | auto const spec = mir_connection_create_spec_for_normal_surface( |
929 | 64 | connection, | 66 | connection, |
939 | 65 | surfaceparm.width, | 67 | parameters.width, |
940 | 66 | surfaceparm.height, | 68 | parameters.height, |
941 | 67 | surfaceparm.pixel_format); | 69 | parameters.pixel_format); |
942 | 68 | 70 | ||
943 | 69 | mir_surface_spec_set_name(spec, surfaceparm.name); | 71 | mir_surface_spec_set_name(spec, parameters.name); |
944 | 70 | mir_surface_spec_set_buffer_usage(spec, surfaceparm.buffer_usage); | 72 | mir_surface_spec_set_buffer_usage(spec, parameters.buffer_usage); |
945 | 71 | 73 | ||
946 | 72 | if (!surfaceparm.width && !surfaceparm.height) | 74 | if (!parameters.width && !parameters.height) |
947 | 73 | mir_surface_spec_set_fullscreen_on_output(spec, surfaceparm.output_id); | 75 | mir_surface_spec_set_fullscreen_on_output(spec, parameters.output_id); |
948 | 74 | 76 | ||
949 | 75 | auto const surface = mir_surface_create_sync(spec); | 77 | auto const surface = mir_surface_create_sync(spec); |
950 | 76 | mir_surface_spec_release(spec); | 78 | mir_surface_spec_release(spec); |
951 | @@ -78,17 +80,39 @@ | |||
952 | 78 | if (!mir_surface_is_valid(surface)) | 80 | if (!mir_surface_is_valid(surface)) |
953 | 79 | throw std::runtime_error(std::string("Can't create a surface ") + mir_surface_get_error_message(surface)); | 81 | throw std::runtime_error(std::string("Can't create a surface ") + mir_surface_get_error_message(surface)); |
954 | 80 | 82 | ||
956 | 81 | if (surfaceparm.output_id != mir_display_output_id_invalid) | 83 | if (parameters.output_id != mir_display_output_id_invalid) |
957 | 82 | mir_surface_set_state(surface, mir_surface_state_fullscreen); | 84 | mir_surface_set_state(surface, mir_surface_state_fullscreen); |
959 | 83 | 85 | #else | |
960 | 86 | auto const spec = mir_create_normal_window_spec( | ||
961 | 87 | connection, | ||
962 | 88 | parameters.width, | ||
963 | 89 | parameters.height); | ||
964 | 90 | |||
965 | 91 | mir_window_spec_set_pixel_format(spec, parameters.pixel_format); | ||
966 | 92 | mir_window_spec_set_name(spec, parameters.name); | ||
967 | 93 | mir_window_spec_set_buffer_usage(spec, parameters.buffer_usage); | ||
968 | 94 | |||
969 | 95 | if (!parameters.width && !parameters.height) | ||
970 | 96 | mir_window_spec_set_fullscreen_on_output(spec, parameters.output_id); | ||
971 | 97 | |||
972 | 98 | auto const surface = mir_create_window_sync(spec); | ||
973 | 99 | mir_window_spec_release(spec); | ||
974 | 100 | |||
975 | 101 | if (!mir_window_is_valid(surface)) | ||
976 | 102 | throw std::runtime_error(std::string("Can't create a surface ") + mir_window_get_error_message(surface)); | ||
977 | 103 | |||
978 | 104 | if (parameters.output_id != mir_display_output_id_invalid) | ||
979 | 105 | mir_window_set_state(surface, mir_window_state_fullscreen); | ||
980 | 106 | #endif | ||
981 | 84 | return surface; | 107 | return surface; |
982 | 85 | } | 108 | } |
983 | 86 | } | 109 | } |
984 | 87 | 110 | ||
986 | 88 | MirEglSurface::MirEglSurface(std::shared_ptr<MirEglApp> const& mir_egl_app, MirSurfaceParameters const& surfaceparm, int swapinterval) : | 111 | MirEglSurface::MirEglSurface( |
987 | 112 | std::shared_ptr<MirEglApp> const& mir_egl_app, MirWindowParameters const& parm, int swapinterval) : | ||
988 | 89 | mir_egl_app{mir_egl_app}, | 113 | mir_egl_app{mir_egl_app}, |
991 | 90 | surface{create_surface(mir_egl_app->connection, surfaceparm)}, | 114 | window{create_surface(mir_egl_app->connection, parm)}, |
992 | 91 | eglsurface{mir_egl_app->create_surface(surface)}, | 115 | eglsurface{mir_egl_app->create_surface(window)}, |
993 | 92 | width_{0}, | 116 | width_{0}, |
994 | 93 | height_{0} | 117 | height_{0} |
995 | 94 | { | 118 | { |
996 | @@ -98,7 +122,11 @@ | |||
997 | 98 | MirEglSurface::~MirEglSurface() | 122 | MirEglSurface::~MirEglSurface() |
998 | 99 | { | 123 | { |
999 | 100 | mir_egl_app->destroy_surface(eglsurface); | 124 | mir_egl_app->destroy_surface(eglsurface); |
1001 | 101 | mir_surface_release_sync(surface); | 125 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
1002 | 126 | mir_surface_release_sync(window); | ||
1003 | 127 | #else | ||
1004 | 128 | mir_window_release_sync(window); | ||
1005 | 129 | #endif | ||
1006 | 102 | } | 130 | } |
1007 | 103 | 131 | ||
1008 | 104 | void MirEglSurface::egl_make_current() | 132 | void MirEglSurface::egl_make_current() |
1009 | @@ -173,7 +201,7 @@ | |||
1010 | 173 | EGL_HEIGHT, 1, | 201 | EGL_HEIGHT, 1, |
1011 | 174 | EGL_NONE | 202 | EGL_NONE |
1012 | 175 | }; | 203 | }; |
1014 | 176 | 204 | ||
1015 | 177 | dummy_surface = eglCreatePbufferSurface(egldisplay, eglconfig, dummy_pbuffer_attribs); | 205 | dummy_surface = eglCreatePbufferSurface(egldisplay, eglconfig, dummy_pbuffer_attribs); |
1016 | 178 | if (dummy_surface == EGL_NO_SURFACE) | 206 | if (dummy_surface == EGL_NO_SURFACE) |
1017 | 179 | throw std::runtime_error("eglCreatePbufferSurface failed"); | 207 | throw std::runtime_error("eglCreatePbufferSurface failed"); |
1018 | @@ -182,12 +210,19 @@ | |||
1019 | 182 | make_current(dummy_surface); | 210 | make_current(dummy_surface); |
1020 | 183 | } | 211 | } |
1021 | 184 | 212 | ||
1023 | 185 | EGLSurface MirEglApp::create_surface(MirSurface* surface) | 213 | EGLSurface MirEglApp::create_surface(MirWindow* window) |
1024 | 186 | { | 214 | { |
1029 | 187 | auto const eglsurface = eglCreateWindowSurface( | 215 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
1030 | 188 | egldisplay, | 216 | auto const eglsurface = eglCreateWindowSurface( |
1031 | 189 | eglconfig, | 217 | egldisplay, |
1032 | 190 | (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window(mir_surface_get_buffer_stream(surface)), NULL); | 218 | eglconfig, |
1033 | 219 | (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window(mir_surface_get_buffer_stream(window)), NULL); | ||
1034 | 220 | #else | ||
1035 | 221 | auto const eglsurface = eglCreateWindowSurface( | ||
1036 | 222 | egldisplay, | ||
1037 | 223 | eglconfig, | ||
1038 | 224 | (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window(mir_window_get_buffer_stream(window)), NULL); | ||
1039 | 225 | #endif | ||
1040 | 191 | 226 | ||
1041 | 192 | if (eglsurface == EGL_NO_SURFACE) | 227 | if (eglsurface == EGL_NO_SURFACE) |
1042 | 193 | throw std::runtime_error("eglCreateWindowSurface failed"); | 228 | throw std::runtime_error("eglCreateWindowSurface failed"); |
1043 | 194 | 229 | ||
1044 | === modified file 'miral-shell/spinner/miregl.h' | |||
1045 | --- miral-shell/spinner/miregl.h 2016-09-16 16:07:56 +0000 | |||
1046 | +++ miral-shell/spinner/miregl.h 2017-01-26 16:46:42 +0000 | |||
1047 | @@ -17,7 +17,7 @@ | |||
1048 | 17 | #ifndef UNITYSYSTEMCOMPOSITOR_MIREGL_H | 17 | #ifndef UNITYSYSTEMCOMPOSITOR_MIREGL_H |
1049 | 18 | #define UNITYSYSTEMCOMPOSITOR_MIREGL_H | 18 | #define UNITYSYSTEMCOMPOSITOR_MIREGL_H |
1050 | 19 | 19 | ||
1052 | 20 | #include <mir_toolkit/common.h> | 20 | #include <miral/detail/mir_forward_compatibility.h> |
1053 | 21 | #include <mir_toolkit/client_types.h> | 21 | #include <mir_toolkit/client_types.h> |
1054 | 22 | #include "mir_toolkit/mir_client_library.h" | 22 | #include "mir_toolkit/mir_client_library.h" |
1055 | 23 | 23 | ||
1056 | @@ -37,7 +37,7 @@ | |||
1057 | 37 | public: | 37 | public: |
1058 | 38 | MirEglSurface( | 38 | MirEglSurface( |
1059 | 39 | std::shared_ptr<MirEglApp> const& mir_egl_app, | 39 | std::shared_ptr<MirEglApp> const& mir_egl_app, |
1061 | 40 | MirSurfaceParameters const& surfaceparm, | 40 | MirWindowParameters const& parm, |
1062 | 41 | int swapinterval); | 41 | int swapinterval); |
1063 | 42 | 42 | ||
1064 | 43 | ~MirEglSurface(); | 43 | ~MirEglSurface(); |
1065 | @@ -50,7 +50,7 @@ | |||
1066 | 50 | swap_buffers(); | 50 | swap_buffers(); |
1067 | 51 | } | 51 | } |
1068 | 52 | 52 | ||
1070 | 53 | MirSurface* mir_surface() { return surface; } | 53 | MirWindow* mir_window() { return window; } |
1071 | 54 | 54 | ||
1072 | 55 | private: | 55 | private: |
1073 | 56 | void egl_make_current(); | 56 | void egl_make_current(); |
1074 | @@ -60,7 +60,7 @@ | |||
1075 | 60 | unsigned int height() const; | 60 | unsigned int height() const; |
1076 | 61 | 61 | ||
1077 | 62 | std::shared_ptr<MirEglApp> const mir_egl_app; | 62 | std::shared_ptr<MirEglApp> const mir_egl_app; |
1079 | 63 | MirSurface* const surface; | 63 | MirWindow* const window; |
1080 | 64 | EGLSurface const eglsurface; | 64 | EGLSurface const eglsurface; |
1081 | 65 | int width_; | 65 | int width_; |
1082 | 66 | int height_; | 66 | int height_; |
1083 | 67 | 67 | ||
1084 | === modified file 'miral-shell/tiling_window_manager.cpp' | |||
1085 | --- miral-shell/tiling_window_manager.cpp 2017-01-18 17:41:46 +0000 | |||
1086 | +++ miral-shell/tiling_window_manager.cpp 2017-01-26 16:46:42 +0000 | |||
1087 | @@ -108,7 +108,7 @@ | |||
1088 | 108 | } | 108 | } |
1089 | 109 | } | 109 | } |
1090 | 110 | 110 | ||
1092 | 111 | auto TilingWindowManagerPolicy::place_new_surface( | 111 | auto TilingWindowManagerPolicy::place_new_window( |
1093 | 112 | ApplicationInfo const& app_info, | 112 | ApplicationInfo const& app_info, |
1094 | 113 | WindowSpecification const& request_parameters) | 113 | WindowSpecification const& request_parameters) |
1095 | 114 | -> WindowSpecification | 114 | -> WindowSpecification |
1096 | @@ -117,7 +117,7 @@ | |||
1097 | 117 | 117 | ||
1098 | 118 | parameters.userdata() = app_info.userdata(); | 118 | parameters.userdata() = app_info.userdata(); |
1099 | 119 | parameters.state() = parameters.state().is_set() ? | 119 | parameters.state() = parameters.state().is_set() ? |
1101 | 120 | transform_set_state(parameters.state().value()) : mir_surface_state_restored; | 120 | transform_set_state(parameters.state().value()) : mir_window_state_restored; |
1102 | 121 | 121 | ||
1103 | 122 | if (app_info.application() != spinner.session()) | 122 | if (app_info.application() != spinner.session()) |
1104 | 123 | { | 123 | { |
1105 | @@ -147,13 +147,13 @@ | |||
1106 | 147 | 147 | ||
1107 | 148 | void TilingWindowManagerPolicy::advise_new_window(WindowInfo const& window_info) | 148 | void TilingWindowManagerPolicy::advise_new_window(WindowInfo const& window_info) |
1108 | 149 | { | 149 | { |
1110 | 150 | if (window_info.type() == mir_surface_type_normal && | 150 | if (window_info.type() == mir_window_type_normal && |
1111 | 151 | !window_info.parent() && | 151 | !window_info.parent() && |
1113 | 152 | window_info.state() == mir_surface_state_restored) | 152 | window_info.state() == mir_window_state_restored) |
1114 | 153 | { | 153 | { |
1115 | 154 | WindowSpecification specification; | 154 | WindowSpecification specification; |
1116 | 155 | 155 | ||
1118 | 156 | specification.state() = mir_surface_state_maximized; | 156 | specification.state() = mir_window_state_maximized; |
1119 | 157 | 157 | ||
1120 | 158 | tools.place_and_size_for_state(specification, window_info); | 158 | tools.place_and_size_for_state(specification, window_info); |
1121 | 159 | constrain_size_and_place(specification, window_info.window(), tile_for(window_info)); | 159 | constrain_size_and_place(specification, window_info.window(), tile_for(window_info)); |
1122 | @@ -229,17 +229,17 @@ | |||
1123 | 229 | reset(mods.top_left()); | 229 | reset(mods.top_left()); |
1124 | 230 | } | 230 | } |
1125 | 231 | 231 | ||
1128 | 232 | auto TilingWindowManagerPolicy::transform_set_state(MirSurfaceState value) | 232 | auto TilingWindowManagerPolicy::transform_set_state(MirWindowState value) |
1129 | 233 | -> MirSurfaceState | 233 | -> MirWindowState |
1130 | 234 | { | 234 | { |
1131 | 235 | switch (value) | 235 | switch (value) |
1132 | 236 | { | 236 | { |
1133 | 237 | default: | 237 | default: |
1135 | 238 | return mir_surface_state_restored; | 238 | return mir_window_state_restored; |
1136 | 239 | 239 | ||
1140 | 240 | case mir_surface_state_hidden: | 240 | case mir_window_state_hidden: |
1141 | 241 | case mir_surface_state_minimized: | 241 | case mir_window_state_minimized: |
1142 | 242 | return mir_surface_state_hidden; | 242 | return mir_window_state_hidden; |
1143 | 243 | } | 243 | } |
1144 | 244 | } | 244 | } |
1145 | 245 | 245 | ||
1146 | @@ -285,15 +285,15 @@ | |||
1147 | 285 | switch (modifiers & modifier_mask) | 285 | switch (modifiers & modifier_mask) |
1148 | 286 | { | 286 | { |
1149 | 287 | case mir_input_event_modifier_alt: | 287 | case mir_input_event_modifier_alt: |
1151 | 288 | toggle(mir_surface_state_maximized); | 288 | toggle(mir_window_state_maximized); |
1152 | 289 | return true; | 289 | return true; |
1153 | 290 | 290 | ||
1154 | 291 | case mir_input_event_modifier_shift: | 291 | case mir_input_event_modifier_shift: |
1156 | 292 | toggle(mir_surface_state_vertmaximized); | 292 | toggle(mir_window_state_vertmaximized); |
1157 | 293 | return true; | 293 | return true; |
1158 | 294 | 294 | ||
1159 | 295 | case mir_input_event_modifier_ctrl: | 295 | case mir_input_event_modifier_ctrl: |
1161 | 296 | toggle(mir_surface_state_horizmaximized); | 296 | toggle(mir_window_state_horizmaximized); |
1162 | 297 | return true; | 297 | return true; |
1163 | 298 | 298 | ||
1164 | 299 | default: | 299 | default: |
1165 | @@ -427,14 +427,14 @@ | |||
1166 | 427 | return consumes_event; | 427 | return consumes_event; |
1167 | 428 | } | 428 | } |
1168 | 429 | 429 | ||
1170 | 430 | void TilingWindowManagerPolicy::toggle(MirSurfaceState state) | 430 | void TilingWindowManagerPolicy::toggle(MirWindowState state) |
1171 | 431 | { | 431 | { |
1172 | 432 | if (auto window = tools.active_window()) | 432 | if (auto window = tools.active_window()) |
1173 | 433 | { | 433 | { |
1174 | 434 | auto& window_info = tools.info_for(window); | 434 | auto& window_info = tools.info_for(window); |
1175 | 435 | 435 | ||
1176 | 436 | if (window_info.state() == state) | 436 | if (window_info.state() == state) |
1178 | 437 | state = mir_surface_state_restored; | 437 | state = mir_window_state_restored; |
1179 | 438 | 438 | ||
1180 | 439 | WindowSpecification mods; | 439 | WindowSpecification mods; |
1181 | 440 | mods.state() = transform_set_state(state); | 440 | mods.state() = transform_set_state(state); |
1182 | 441 | 441 | ||
1183 | === modified file 'miral-shell/tiling_window_manager.h' | |||
1184 | --- miral-shell/tiling_window_manager.h 2016-12-05 09:46:35 +0000 | |||
1185 | +++ miral-shell/tiling_window_manager.h 2017-01-26 16:46:42 +0000 | |||
1186 | @@ -54,7 +54,7 @@ | |||
1187 | 54 | 54 | ||
1188 | 55 | ~TilingWindowManagerPolicy(); | 55 | ~TilingWindowManagerPolicy(); |
1189 | 56 | 56 | ||
1191 | 57 | auto place_new_surface( | 57 | auto place_new_window( |
1192 | 58 | miral::ApplicationInfo const& app_info, | 58 | miral::ApplicationInfo const& app_info, |
1193 | 59 | miral::WindowSpecification const& request_parameters) | 59 | miral::WindowSpecification const& request_parameters) |
1194 | 60 | -> miral::WindowSpecification override; | 60 | -> miral::WindowSpecification override; |
1195 | @@ -91,14 +91,14 @@ | |||
1196 | 91 | void click(Point cursor); | 91 | void click(Point cursor); |
1197 | 92 | void resize(Point cursor); | 92 | void resize(Point cursor); |
1198 | 93 | void drag(Point cursor); | 93 | void drag(Point cursor); |
1200 | 94 | void toggle(MirSurfaceState state); | 94 | void toggle(MirWindowState state); |
1201 | 95 | 95 | ||
1202 | 96 | miral::Application application_under(Point position); | 96 | miral::Application application_under(Point position); |
1203 | 97 | 97 | ||
1204 | 98 | void update_tiles(Rectangles const& displays); | 98 | void update_tiles(Rectangles const& displays); |
1205 | 99 | void update_surfaces(miral::ApplicationInfo& info, Rectangle const& old_tile, Rectangle const& new_tile); | 99 | void update_surfaces(miral::ApplicationInfo& info, Rectangle const& old_tile, Rectangle const& new_tile); |
1206 | 100 | 100 | ||
1208 | 101 | auto transform_set_state(MirSurfaceState value) -> MirSurfaceState; | 101 | auto transform_set_state(MirWindowState value) -> MirWindowState; |
1209 | 102 | 102 | ||
1210 | 103 | static void clip_to_tile(miral::WindowSpecification& parameters, Rectangle const& tile); | 103 | static void clip_to_tile(miral::WindowSpecification& parameters, Rectangle const& tile); |
1211 | 104 | static void resize(miral::Window window, Point cursor, Point old_cursor, Rectangle bounds); | 104 | static void resize(miral::Window window, Point cursor, Point old_cursor, Rectangle bounds); |
1212 | 105 | 105 | ||
1213 | === modified file 'miral-shell/titlebar_provider.cpp' | |||
1214 | --- miral-shell/titlebar_provider.cpp 2016-10-27 14:07:51 +0000 | |||
1215 | +++ miral-shell/titlebar_provider.cpp 2017-01-26 16:46:42 +0000 | |||
1216 | @@ -19,7 +19,7 @@ | |||
1217 | 19 | #include "titlebar_provider.h" | 19 | #include "titlebar_provider.h" |
1218 | 20 | #include "titlebar_config.h" | 20 | #include "titlebar_config.h" |
1219 | 21 | 21 | ||
1221 | 22 | #include <miral/toolkit/surface_spec.h> | 22 | #include <miral/toolkit/window_spec.h> |
1222 | 23 | 23 | ||
1223 | 24 | #include <mir_toolkit/mir_buffer_stream.h> | 24 | #include <mir_toolkit/mir_buffer_stream.h> |
1224 | 25 | 25 | ||
1225 | @@ -38,7 +38,7 @@ | |||
1226 | 38 | { | 38 | { |
1227 | 39 | int const title_bar_height = 12; | 39 | int const title_bar_height = 12; |
1228 | 40 | 40 | ||
1230 | 41 | void null_surface_callback(MirSurface*, void*) {} | 41 | void null_surface_callback(MirWindow*, void*) {} |
1231 | 42 | 42 | ||
1232 | 43 | struct Printer | 43 | struct Printer |
1233 | 44 | { | 44 | { |
1234 | @@ -57,9 +57,13 @@ | |||
1235 | 57 | FT_Face face; | 57 | FT_Face face; |
1236 | 58 | }; | 58 | }; |
1237 | 59 | 59 | ||
1239 | 60 | void paint_surface(MirSurface* surface, std::string const& title, int const intensity) | 60 | void paint_surface(MirWindow* surface, std::string const& title, int const intensity) |
1240 | 61 | { | 61 | { |
1241 | 62 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
1242 | 62 | MirBufferStream* buffer_stream = mir_surface_get_buffer_stream(surface); | 63 | MirBufferStream* buffer_stream = mir_surface_get_buffer_stream(surface); |
1243 | 64 | #else | ||
1244 | 65 | MirBufferStream* buffer_stream = mir_window_get_buffer_stream(surface); | ||
1245 | 66 | #endif | ||
1246 | 63 | 67 | ||
1247 | 64 | // TODO sometimes buffer_stream is nullptr - find out why (and fix). | 68 | // TODO sometimes buffer_stream is nullptr - find out why (and fix). |
1248 | 65 | // (Only observed when creating a lot of clients at once) | 69 | // (Only observed when creating a lot of clients at once) |
1249 | @@ -204,10 +208,10 @@ | |||
1250 | 204 | 208 | ||
1251 | 205 | buffer << std::shared_ptr<mir::scene::Surface>(window).get(); | 209 | buffer << std::shared_ptr<mir::scene::Surface>(window).get(); |
1252 | 206 | 210 | ||
1254 | 207 | auto const spec = SurfaceSpec::for_normal_surface( | 211 | auto const spec = WindowSpec::for_normal_surface( |
1255 | 208 | connection, window.size().width.as_int(), title_bar_height, mir_pixel_format_xrgb_8888) | 212 | connection, window.size().width.as_int(), title_bar_height, mir_pixel_format_xrgb_8888) |
1256 | 209 | .set_buffer_usage(mir_buffer_usage_software) | 213 | .set_buffer_usage(mir_buffer_usage_software) |
1258 | 210 | .set_type(mir_surface_type_gloss) | 214 | .set_type(mir_window_type_gloss) |
1259 | 211 | .set_name(buffer.str().c_str()); | 215 | .set_name(buffer.str().c_str()); |
1260 | 212 | 216 | ||
1261 | 213 | std::lock_guard<decltype(mutex)> lock{mutex}; | 217 | std::lock_guard<decltype(mutex)> lock{mutex}; |
1262 | @@ -230,7 +234,7 @@ | |||
1263 | 230 | } | 234 | } |
1264 | 231 | else | 235 | else |
1265 | 232 | { | 236 | { |
1267 | 233 | data->on_create = [this, title, intensity](MirSurface* surface) | 237 | data->on_create = [this, title, intensity](MirWindow* surface) |
1268 | 234 | { enqueue_work([this, surface, title, intensity]{ paint_surface(surface, title, intensity); }); }; | 238 | { enqueue_work([this, surface, title, intensity]{ paint_surface(surface, title, intensity); }); }; |
1269 | 235 | } | 239 | } |
1270 | 236 | } | 240 | } |
1271 | @@ -244,7 +248,11 @@ | |||
1272 | 244 | { | 248 | { |
1273 | 245 | enqueue_work([surface] | 249 | enqueue_work([surface] |
1274 | 246 | { | 250 | { |
1275 | 251 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
1276 | 247 | mir_surface_release(surface, &null_surface_callback, nullptr); | 252 | mir_surface_release(surface, &null_surface_callback, nullptr); |
1277 | 253 | #else | ||
1278 | 254 | mir_window_release(surface, &null_surface_callback, nullptr); | ||
1279 | 255 | #endif | ||
1280 | 248 | }); | 256 | }); |
1281 | 249 | } | 257 | } |
1282 | 250 | 258 | ||
1283 | @@ -299,23 +307,23 @@ | |||
1284 | 299 | tools.raise_tree(window_info.parent()); | 307 | tools.raise_tree(window_info.parent()); |
1285 | 300 | } | 308 | } |
1286 | 301 | 309 | ||
1288 | 302 | void TitlebarProvider::advise_state_change(miral::WindowInfo const& window_info, MirSurfaceState state) | 310 | void TitlebarProvider::advise_state_change(miral::WindowInfo const& window_info, MirWindowState state) |
1289 | 303 | { | 311 | { |
1290 | 304 | if (auto titlebar = find_titlebar_window(window_info.window())) | 312 | if (auto titlebar = find_titlebar_window(window_info.window())) |
1291 | 305 | { | 313 | { |
1292 | 306 | miral::WindowSpecification modifications; | 314 | miral::WindowSpecification modifications; |
1293 | 307 | switch (state) | 315 | switch (state) |
1294 | 308 | { | 316 | { |
1301 | 309 | case mir_surface_state_maximized: | 317 | case mir_window_state_maximized: |
1302 | 310 | case mir_surface_state_vertmaximized: | 318 | case mir_window_state_vertmaximized: |
1303 | 311 | case mir_surface_state_hidden: | 319 | case mir_window_state_hidden: |
1304 | 312 | case mir_surface_state_minimized: | 320 | case mir_window_state_minimized: |
1305 | 313 | case mir_surface_state_fullscreen: | 321 | case mir_window_state_fullscreen: |
1306 | 314 | modifications.state() = mir_surface_state_hidden; | 322 | modifications.state() = mir_window_state_hidden; |
1307 | 315 | break; | 323 | break; |
1308 | 316 | 324 | ||
1309 | 317 | default: | 325 | default: |
1311 | 318 | modifications.state() = mir_surface_state_restored; | 326 | modifications.state() = mir_window_state_restored; |
1312 | 319 | break; | 327 | break; |
1313 | 320 | } | 328 | } |
1314 | 321 | 329 | ||
1315 | @@ -338,10 +346,14 @@ | |||
1316 | 338 | TitlebarProvider::Data::~Data() | 346 | TitlebarProvider::Data::~Data() |
1317 | 339 | { | 347 | { |
1318 | 340 | if (auto surface = titlebar.exchange(nullptr)) | 348 | if (auto surface = titlebar.exchange(nullptr)) |
1319 | 349 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
1320 | 341 | mir_surface_release(surface, &null_surface_callback, nullptr); | 350 | mir_surface_release(surface, &null_surface_callback, nullptr); |
1321 | 351 | #else | ||
1322 | 352 | mir_window_release(surface, &null_surface_callback, nullptr); | ||
1323 | 353 | #endif | ||
1324 | 342 | } | 354 | } |
1325 | 343 | 355 | ||
1327 | 344 | void TitlebarProvider::insert(MirSurface* surface, Data* data) | 356 | void TitlebarProvider::insert(MirWindow* surface, Data* data) |
1328 | 345 | { | 357 | { |
1329 | 346 | data->on_create(surface); | 358 | data->on_create(surface); |
1330 | 347 | data->titlebar = surface; | 359 | data->titlebar = surface; |
1331 | @@ -401,4 +413,4 @@ | |||
1332 | 401 | void Worker::stop_work() | 413 | void Worker::stop_work() |
1333 | 402 | { | 414 | { |
1334 | 403 | enqueue_work([this] { work_done = true; }); | 415 | enqueue_work([this] { work_done = true; }); |
1335 | 404 | } | ||
1336 | 405 | \ No newline at end of file | 416 | \ No newline at end of file |
1337 | 417 | } | ||
1338 | 406 | 418 | ||
1339 | === modified file 'miral-shell/titlebar_provider.h' | |||
1340 | --- miral-shell/titlebar_provider.h 2016-10-27 14:04:09 +0000 | |||
1341 | +++ miral-shell/titlebar_provider.h 2017-01-26 16:46:42 +0000 | |||
1342 | @@ -71,15 +71,15 @@ | |||
1343 | 71 | void destroy_titlebar_for(miral::Window const& window); | 71 | void destroy_titlebar_for(miral::Window const& window); |
1344 | 72 | void resize_titlebar_for(miral::WindowInfo const& window_info, mir::geometry::Size const& size); | 72 | void resize_titlebar_for(miral::WindowInfo const& window_info, mir::geometry::Size const& size); |
1345 | 73 | void advise_new_titlebar(miral::WindowInfo const& window_info); | 73 | void advise_new_titlebar(miral::WindowInfo const& window_info); |
1347 | 74 | void advise_state_change(miral::WindowInfo const& window_info, MirSurfaceState state); | 74 | void advise_state_change(miral::WindowInfo const& window_info, MirWindowState state); |
1348 | 75 | 75 | ||
1349 | 76 | void stop(); | 76 | void stop(); |
1350 | 77 | 77 | ||
1351 | 78 | private: | 78 | private: |
1352 | 79 | struct Data | 79 | struct Data |
1353 | 80 | { | 80 | { |
1356 | 81 | std::atomic<MirSurface*> titlebar{nullptr}; | 81 | std::atomic<MirWindow*> titlebar{nullptr}; |
1357 | 82 | std::function<void(MirSurface* surface)> on_create{[](MirSurface*){}}; | 82 | std::function<void(MirWindow* surface)> on_create{[](MirWindow*){}}; |
1358 | 83 | miral::Window window; | 83 | miral::Window window; |
1359 | 84 | 84 | ||
1360 | 85 | ~Data(); | 85 | ~Data(); |
1361 | @@ -97,7 +97,7 @@ | |||
1362 | 97 | SurfaceMap window_to_titlebar; | 97 | SurfaceMap window_to_titlebar; |
1363 | 98 | TitleMap windows_awaiting_titlebar; | 98 | TitleMap windows_awaiting_titlebar; |
1364 | 99 | 99 | ||
1366 | 100 | static void insert(MirSurface* surface, Data* data); | 100 | static void insert(MirWindow* surface, Data* data); |
1367 | 101 | Data* find_titlebar_data(miral::Window const& window); | 101 | Data* find_titlebar_data(miral::Window const& window); |
1368 | 102 | miral::Window find_titlebar_window(miral::Window const& window) const; | 102 | miral::Window find_titlebar_window(miral::Window const& window) const; |
1369 | 103 | void repaint_titlebar_for(miral::WindowInfo const& window_info); | 103 | void repaint_titlebar_for(miral::WindowInfo const& window_info); |
1370 | 104 | 104 | ||
1371 | === modified file 'miral-shell/titlebar_window_manager.cpp' | |||
1372 | --- miral-shell/titlebar_window_manager.cpp 2016-10-27 14:04:09 +0000 | |||
1373 | +++ miral-shell/titlebar_window_manager.cpp 2017-01-26 16:46:42 +0000 | |||
1374 | @@ -109,7 +109,7 @@ | |||
1375 | 109 | } | 109 | } |
1376 | 110 | } | 110 | } |
1377 | 111 | } | 111 | } |
1379 | 112 | 112 | ||
1380 | 113 | if (resizing && !is_resize_event) | 113 | if (resizing && !is_resize_event) |
1381 | 114 | end_resize(); | 114 | end_resize(); |
1382 | 115 | 115 | ||
1383 | @@ -312,7 +312,7 @@ | |||
1384 | 312 | } | 312 | } |
1385 | 313 | } | 313 | } |
1386 | 314 | 314 | ||
1388 | 315 | void TitlebarWindowManagerPolicy::advise_state_change(WindowInfo const& window_info, MirSurfaceState state) | 315 | void TitlebarWindowManagerPolicy::advise_state_change(WindowInfo const& window_info, MirWindowState state) |
1389 | 316 | { | 316 | { |
1390 | 317 | CanonicalWindowManagerPolicy::advise_state_change(window_info, state); | 317 | CanonicalWindowManagerPolicy::advise_state_change(window_info, state); |
1391 | 318 | 318 | ||
1392 | @@ -347,15 +347,15 @@ | |||
1393 | 347 | switch (modifiers) | 347 | switch (modifiers) |
1394 | 348 | { | 348 | { |
1395 | 349 | case mir_input_event_modifier_alt: | 349 | case mir_input_event_modifier_alt: |
1397 | 350 | toggle(mir_surface_state_maximized); | 350 | toggle(mir_window_state_maximized); |
1398 | 351 | return true; | 351 | return true; |
1399 | 352 | 352 | ||
1400 | 353 | case mir_input_event_modifier_shift: | 353 | case mir_input_event_modifier_shift: |
1402 | 354 | toggle(mir_surface_state_vertmaximized); | 354 | toggle(mir_window_state_vertmaximized); |
1403 | 355 | return true; | 355 | return true; |
1404 | 356 | 356 | ||
1405 | 357 | case mir_input_event_modifier_ctrl: | 357 | case mir_input_event_modifier_ctrl: |
1407 | 358 | toggle(mir_surface_state_horizmaximized); | 358 | toggle(mir_window_state_horizmaximized); |
1408 | 359 | return true; | 359 | return true; |
1409 | 360 | 360 | ||
1410 | 361 | default: | 361 | default: |
1411 | @@ -418,8 +418,8 @@ | |||
1412 | 418 | break; | 418 | break; |
1413 | 419 | 419 | ||
1414 | 420 | case KEY_UP: | 420 | case KEY_UP: |
1417 | 421 | if (window_info.state() != mir_surface_state_vertmaximized && | 421 | if (window_info.state() != mir_window_state_vertmaximized && |
1418 | 422 | window_info.state() != mir_surface_state_maximized) | 422 | window_info.state() != mir_window_state_maximized) |
1419 | 423 | { | 423 | { |
1420 | 424 | modifications.top_left() = | 424 | modifications.top_left() = |
1421 | 425 | Point{active_window.top_left().x, active_display.top_left.y} + DeltaY{title_bar_height}; | 425 | Point{active_window.top_left().x, active_display.top_left.y} + DeltaY{title_bar_height}; |
1422 | @@ -455,7 +455,7 @@ | |||
1423 | 455 | return false; | 455 | return false; |
1424 | 456 | } | 456 | } |
1425 | 457 | 457 | ||
1427 | 458 | void TitlebarWindowManagerPolicy::toggle(MirSurfaceState state) | 458 | void TitlebarWindowManagerPolicy::toggle(MirWindowState state) |
1428 | 459 | { | 459 | { |
1429 | 460 | if (auto const window = tools.active_window()) | 460 | if (auto const window = tools.active_window()) |
1430 | 461 | { | 461 | { |
1431 | @@ -463,7 +463,7 @@ | |||
1432 | 463 | 463 | ||
1433 | 464 | WindowSpecification modifications; | 464 | WindowSpecification modifications; |
1434 | 465 | 465 | ||
1436 | 466 | modifications.state() = (info.state() == state) ? mir_surface_state_restored : state; | 466 | modifications.state() = (info.state() == state) ? mir_window_state_restored : state; |
1437 | 467 | tools.place_and_size_for_state(modifications, info); | 467 | tools.place_and_size_for_state(modifications, info); |
1438 | 468 | tools.modify_window(info, modifications); | 468 | tools.modify_window(info, modifications); |
1439 | 469 | } | 469 | } |
1440 | @@ -558,14 +558,14 @@ | |||
1441 | 558 | } | 558 | } |
1442 | 559 | } | 559 | } |
1443 | 560 | 560 | ||
1445 | 561 | WindowSpecification TitlebarWindowManagerPolicy::place_new_surface( | 561 | WindowSpecification TitlebarWindowManagerPolicy::place_new_window( |
1446 | 562 | ApplicationInfo const& app_info, WindowSpecification const& request_parameters) | 562 | ApplicationInfo const& app_info, WindowSpecification const& request_parameters) |
1447 | 563 | { | 563 | { |
1449 | 564 | auto parameters = CanonicalWindowManagerPolicy::place_new_surface(app_info, request_parameters); | 564 | auto parameters = CanonicalWindowManagerPolicy::place_new_window(app_info, request_parameters); |
1450 | 565 | 565 | ||
1451 | 566 | bool const needs_titlebar = WindowInfo::needs_titlebar(parameters.type().value()); | 566 | bool const needs_titlebar = WindowInfo::needs_titlebar(parameters.type().value()); |
1452 | 567 | 567 | ||
1454 | 568 | if (parameters.state().value() != mir_surface_state_fullscreen && needs_titlebar) | 568 | if (parameters.state().value() != mir_window_state_fullscreen && needs_titlebar) |
1455 | 569 | parameters.top_left() = Point{parameters.top_left().value().x, parameters.top_left().value().y + DeltaY{title_bar_height}}; | 569 | parameters.top_left() = Point{parameters.top_left().value().x, parameters.top_left().value().y + DeltaY{title_bar_height}}; |
1456 | 570 | 570 | ||
1457 | 571 | if (app_info.application() == titlebar_provider->session()) | 571 | if (app_info.application() == titlebar_provider->session()) |
1458 | 572 | 572 | ||
1459 | === modified file 'miral-shell/titlebar_window_manager.h' | |||
1460 | --- miral-shell/titlebar_window_manager.h 2016-09-28 11:42:35 +0000 | |||
1461 | +++ miral-shell/titlebar_window_manager.h 2017-01-26 16:46:42 +0000 | |||
1462 | @@ -37,7 +37,7 @@ | |||
1463 | 37 | TitlebarWindowManagerPolicy(miral::WindowManagerTools const& tools, SpinnerSplash const& spinner, miral::InternalClientLauncher const& launcher); | 37 | TitlebarWindowManagerPolicy(miral::WindowManagerTools const& tools, SpinnerSplash const& spinner, miral::InternalClientLauncher const& launcher); |
1464 | 38 | ~TitlebarWindowManagerPolicy(); | 38 | ~TitlebarWindowManagerPolicy(); |
1465 | 39 | 39 | ||
1467 | 40 | virtual miral::WindowSpecification place_new_surface( | 40 | virtual miral::WindowSpecification place_new_window( |
1468 | 41 | miral::ApplicationInfo const& app_info, miral::WindowSpecification const& request_parameters) override; | 41 | miral::ApplicationInfo const& app_info, miral::WindowSpecification const& request_parameters) override; |
1469 | 42 | 42 | ||
1470 | 43 | /** @name example event handling: | 43 | /** @name example event handling: |
1471 | @@ -60,7 +60,7 @@ | |||
1472 | 60 | void handle_window_ready(miral::WindowInfo& window_info) override; | 60 | void handle_window_ready(miral::WindowInfo& window_info) override; |
1473 | 61 | void advise_focus_lost(miral::WindowInfo const& info) override; | 61 | void advise_focus_lost(miral::WindowInfo const& info) override; |
1474 | 62 | void advise_focus_gained(miral::WindowInfo const& info) override; | 62 | void advise_focus_gained(miral::WindowInfo const& info) override; |
1476 | 63 | void advise_state_change(miral::WindowInfo const& window_info, MirSurfaceState state) override; | 63 | void advise_state_change(miral::WindowInfo const& window_info, MirWindowState state) override; |
1477 | 64 | void advise_resize(miral::WindowInfo const& window_info, Size const& new_size) override; | 64 | void advise_resize(miral::WindowInfo const& window_info, Size const& new_size) override; |
1478 | 65 | void advise_delete_window(miral::WindowInfo const& window_info) override; | 65 | void advise_delete_window(miral::WindowInfo const& window_info) override; |
1479 | 66 | /** @} */ | 66 | /** @} */ |
1480 | @@ -74,7 +74,7 @@ | |||
1481 | 74 | mir_input_event_modifier_meta; | 74 | mir_input_event_modifier_meta; |
1482 | 75 | 75 | ||
1483 | 76 | private: | 76 | private: |
1485 | 77 | void toggle(MirSurfaceState state); | 77 | void toggle(MirWindowState state); |
1486 | 78 | 78 | ||
1487 | 79 | bool resize(miral::Window const& window, Point cursor, Point old_cursor); | 79 | bool resize(miral::Window const& window, Point cursor, Point old_cursor); |
1488 | 80 | 80 | ||
1489 | 81 | 81 | ||
1490 | === modified file 'miral/CMakeLists.txt' | |||
1491 | --- miral/CMakeLists.txt 2016-12-13 13:07:15 +0000 | |||
1492 | +++ miral/CMakeLists.txt 2017-01-26 16:46:42 +0000 | |||
1493 | @@ -21,9 +21,10 @@ | |||
1494 | 21 | window_management_trace.cpp window_management_trace.h | 21 | window_management_trace.cpp window_management_trace.h |
1495 | 22 | xcursor_loader.cpp xcursor_loader.h | 22 | xcursor_loader.cpp xcursor_loader.h |
1496 | 23 | xcursor.c xcursor.h | 23 | xcursor.c xcursor.h |
1497 | 24 | both_versions.h | ||
1498 | 24 | ) | 25 | ) |
1499 | 25 | 26 | ||
1501 | 26 | set_source_files_properties(xcursor.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -std=c99 -D_GNU_SOURCE") | 27 | set_source_files_properties(xcursor.c PROPERTIES COMPILE_DEFINITIONS _GNU_SOURCE) |
1502 | 27 | 28 | ||
1503 | 28 | add_library(miral SHARED | 29 | add_library(miral SHARED |
1504 | 29 | active_outputs.cpp ${CMAKE_SOURCE_DIR}/include/miral/active_outputs.h | 30 | active_outputs.cpp ${CMAKE_SOURCE_DIR}/include/miral/active_outputs.h |
1505 | @@ -50,10 +51,10 @@ | |||
1506 | 50 | set_window_managment_policy.cpp ${CMAKE_SOURCE_DIR}/include/miral/set_window_managment_policy.h | 51 | set_window_managment_policy.cpp ${CMAKE_SOURCE_DIR}/include/miral/set_window_managment_policy.h |
1507 | 51 | window_management_policy.cpp ${CMAKE_SOURCE_DIR}/include/miral/window_management_policy.h | 52 | window_management_policy.cpp ${CMAKE_SOURCE_DIR}/include/miral/window_management_policy.h |
1508 | 52 | window_manager_tools.cpp ${CMAKE_SOURCE_DIR}/include/miral/window_manager_tools.h | 53 | window_manager_tools.cpp ${CMAKE_SOURCE_DIR}/include/miral/window_manager_tools.h |
1510 | 53 | ${CMAKE_SOURCE_DIR}/include/miral/toolkit/surface_spec.h | 54 | ${CMAKE_SOURCE_DIR}/include/miral/toolkit/window_spec.h |
1511 | 54 | ${CMAKE_SOURCE_DIR}/include/miral/toolkit/persistent_id.h | 55 | ${CMAKE_SOURCE_DIR}/include/miral/toolkit/persistent_id.h |
1512 | 55 | ${CMAKE_SOURCE_DIR}/include/miral/toolkit/connection.h | 56 | ${CMAKE_SOURCE_DIR}/include/miral/toolkit/connection.h |
1514 | 56 | ${CMAKE_SOURCE_DIR}/include/miral/toolkit/surface.h | 57 | ${CMAKE_SOURCE_DIR}/include/miral/toolkit/window.h |
1515 | 57 | ${CMAKE_SOURCE_DIR}/include/miral/detail/mir_forward_compatibility.h | 58 | ${CMAKE_SOURCE_DIR}/include/miral/detail/mir_forward_compatibility.h |
1516 | 58 | ) | 59 | ) |
1517 | 59 | 60 | ||
1518 | 60 | 61 | ||
1519 | === modified file 'miral/active_outputs.cpp' | |||
1520 | --- miral/active_outputs.cpp 2016-12-13 13:07:15 +0000 | |||
1521 | +++ miral/active_outputs.cpp 2017-01-26 16:46:42 +0000 | |||
1522 | @@ -70,6 +70,11 @@ | |||
1523 | 70 | 70 | ||
1524 | 71 | void base_configuration_updated(std::shared_ptr<mir::graphics::DisplayConfiguration const> const& ) override {} | 71 | void base_configuration_updated(std::shared_ptr<mir::graphics::DisplayConfiguration const> const& ) override {} |
1525 | 72 | 72 | ||
1526 | 73 | void session_configuration_applied(std::shared_ptr<mir::frontend::Session> const&, | ||
1527 | 74 | std::shared_ptr<mir::graphics::DisplayConfiguration> const&) override {} | ||
1528 | 75 | |||
1529 | 76 | void session_configuration_removed(std::shared_ptr<mir::frontend::Session> const&) override {} | ||
1530 | 77 | |||
1531 | 73 | std::mutex mutex; | 78 | std::mutex mutex; |
1532 | 74 | std::vector<ActiveOutputsListener*> listeners; | 79 | std::vector<ActiveOutputsListener*> listeners; |
1533 | 75 | std::vector<Output> outputs; | 80 | std::vector<Output> outputs; |
1534 | 76 | 81 | ||
1535 | === modified file 'miral/basic_window_manager.cpp' | |||
1536 | --- miral/basic_window_manager.cpp 2017-01-18 17:41:46 +0000 | |||
1537 | +++ miral/basic_window_manager.cpp 2017-01-26 16:46:42 +0000 | |||
1538 | @@ -92,7 +92,7 @@ | |||
1539 | 92 | 92 | ||
1540 | 93 | auto& session_info = info_for(session); | 93 | auto& session_info = info_for(session); |
1541 | 94 | 94 | ||
1543 | 95 | WindowSpecification const& spec = policy->place_new_surface(session_info, place_new_surface(session_info, params)); | 95 | WindowSpecification const& spec = policy->place_new_window(session_info, place_new_surface(session_info, params)); |
1544 | 96 | scene::SurfaceCreationParameters parameters; | 96 | scene::SurfaceCreationParameters parameters; |
1545 | 97 | spec.update(parameters); | 97 | spec.update(parameters); |
1546 | 98 | auto const surface_id = build(session, parameters); | 98 | auto const surface_id = build(session, parameters); |
1547 | @@ -112,7 +112,7 @@ | |||
1548 | 112 | if (parent) | 112 | if (parent) |
1549 | 113 | info_for(parent).add_child(window); | 113 | info_for(parent).add_child(window); |
1550 | 114 | 114 | ||
1552 | 115 | if (window_info.state() == mir_surface_state_fullscreen) | 115 | if (window_info.state() == mir_window_state_fullscreen) |
1553 | 116 | fullscreen_surfaces.insert(window_info.window()); | 116 | fullscreen_surfaces.insert(window_info.window()); |
1554 | 117 | 117 | ||
1555 | 118 | policy->advise_new_window(window_info); | 118 | policy->advise_new_window(window_info); |
1556 | @@ -282,35 +282,35 @@ | |||
1557 | 282 | int miral::BasicWindowManager::set_surface_attribute( | 282 | int miral::BasicWindowManager::set_surface_attribute( |
1558 | 283 | std::shared_ptr<scene::Session> const& /*application*/, | 283 | std::shared_ptr<scene::Session> const& /*application*/, |
1559 | 284 | std::shared_ptr<scene::Surface> const& surface, | 284 | std::shared_ptr<scene::Surface> const& surface, |
1561 | 285 | MirSurfaceAttrib attrib, | 285 | MirWindowAttrib attrib, |
1562 | 286 | int value) | 286 | int value) |
1563 | 287 | { | 287 | { |
1564 | 288 | WindowSpecification modification; | 288 | WindowSpecification modification; |
1565 | 289 | switch (attrib) | 289 | switch (attrib) |
1566 | 290 | { | 290 | { |
1569 | 291 | case mir_surface_attrib_type: | 291 | case mir_window_attrib_type: |
1570 | 292 | modification.type() = MirSurfaceType(value); | 292 | modification.type() = MirWindowType(value); |
1571 | 293 | break; | 293 | break; |
1574 | 294 | case mir_surface_attrib_state: | 294 | case mir_window_attrib_state: |
1575 | 295 | modification.state() = MirSurfaceState(value); | 295 | modification.state() = MirWindowState(value); |
1576 | 296 | break; | 296 | break; |
1577 | 297 | 297 | ||
1579 | 298 | case mir_surface_attrib_preferred_orientation: | 298 | case mir_window_attrib_preferred_orientation: |
1580 | 299 | modification.preferred_orientation() = MirOrientationMode(value); | 299 | modification.preferred_orientation() = MirOrientationMode(value); |
1581 | 300 | break; | 300 | break; |
1582 | 301 | 301 | ||
1595 | 302 | case mir_surface_attrib_visibility: | 302 | case mir_window_attrib_visibility: |
1596 | 303 | // The client really shouldn't be trying to set this. | 303 | // The client really shouldn't be trying to set this. |
1597 | 304 | // But, as the legacy API exists, we treat it as a query | 304 | // But, as the legacy API exists, we treat it as a query |
1598 | 305 | return surface->query(mir_surface_attrib_visibility); | 305 | return surface->query(mir_window_attrib_visibility); |
1599 | 306 | 306 | ||
1600 | 307 | case mir_surface_attrib_focus: | 307 | case mir_window_attrib_focus: |
1601 | 308 | // The client really shouldn't be trying to set this. | 308 | // The client really shouldn't be trying to set this. |
1602 | 309 | // But, as the legacy API exists, we treat it as a query | 309 | // But, as the legacy API exists, we treat it as a query |
1603 | 310 | return surface->query(mir_surface_attrib_focus); | 310 | return surface->query(mir_window_attrib_focus); |
1604 | 311 | 311 | ||
1605 | 312 | case mir_surface_attrib_swapinterval: | 312 | case mir_window_attrib_swapinterval: |
1606 | 313 | case mir_surface_attrib_dpi: | 313 | case mir_window_attrib_dpi: |
1607 | 314 | default: | 314 | default: |
1608 | 315 | return surface->configure(attrib, value); | 315 | return surface->configure(attrib, value); |
1609 | 316 | } | 316 | } |
1610 | @@ -324,13 +324,13 @@ | |||
1611 | 324 | 324 | ||
1612 | 325 | switch (attrib) | 325 | switch (attrib) |
1613 | 326 | { | 326 | { |
1615 | 327 | case mir_surface_attrib_type: | 327 | case mir_window_attrib_type: |
1616 | 328 | return info.type(); | 328 | return info.type(); |
1617 | 329 | 329 | ||
1619 | 330 | case mir_surface_attrib_state: | 330 | case mir_window_attrib_state: |
1620 | 331 | return info.state(); | 331 | return info.state(); |
1621 | 332 | 332 | ||
1623 | 333 | case mir_surface_attrib_preferred_orientation: | 333 | case mir_window_attrib_preferred_orientation: |
1624 | 334 | return info.preferred_orientation(); | 334 | return info.preferred_orientation(); |
1625 | 335 | break; | 335 | break; |
1626 | 336 | 336 | ||
1627 | @@ -496,6 +496,11 @@ | |||
1628 | 496 | 496 | ||
1629 | 497 | void miral::BasicWindowManager::raise_tree(Window const& root) | 497 | void miral::BasicWindowManager::raise_tree(Window const& root) |
1630 | 498 | { | 498 | { |
1631 | 499 | auto const& info = info_for(root); | ||
1632 | 500 | |||
1633 | 501 | if (auto parent = info.parent()) | ||
1634 | 502 | raise_tree(parent); | ||
1635 | 503 | |||
1636 | 499 | std::vector<Window> windows; | 504 | std::vector<Window> windows; |
1637 | 500 | 505 | ||
1638 | 501 | std::function<void(WindowInfo const& info)> const add_children = | 506 | std::function<void(WindowInfo const& info)> const add_children = |
1639 | @@ -509,7 +514,7 @@ | |||
1640 | 509 | }; | 514 | }; |
1641 | 510 | 515 | ||
1642 | 511 | windows.push_back(root); | 516 | windows.push_back(root); |
1644 | 512 | add_children(info_for(root)); | 517 | add_children(info); |
1645 | 513 | 518 | ||
1646 | 514 | policy->advise_raise(windows); | 519 | policy->advise_raise(windows); |
1647 | 515 | focus_controller->raise({begin(windows), end(windows)}); | 520 | focus_controller->raise({begin(windows), end(windows)}); |
1648 | @@ -589,7 +594,7 @@ | |||
1649 | 589 | auto& window = window_info.window(); | 594 | auto& window = window_info.window(); |
1650 | 590 | 595 | ||
1651 | 591 | if (window_info.type() != window_info_tmp.type()) | 596 | if (window_info.type() != window_info_tmp.type()) |
1653 | 592 | std::shared_ptr<scene::Surface>(window)->configure(mir_surface_attrib_type, window_info.type()); | 597 | std::shared_ptr<scene::Surface>(window)->configure(mir_window_attrib_type, window_info.type()); |
1654 | 593 | 598 | ||
1655 | 594 | if (window_info.parent() != window_info_tmp.parent()) | 599 | if (window_info.parent() != window_info_tmp.parent()) |
1656 | 595 | { | 600 | { |
1657 | @@ -616,12 +621,12 @@ | |||
1658 | 616 | { | 621 | { |
1659 | 617 | switch (window_info.state()) | 622 | switch (window_info.state()) |
1660 | 618 | { | 623 | { |
1663 | 619 | case mir_surface_state_restored: | 624 | case mir_window_state_restored: |
1664 | 620 | case mir_surface_state_hidden: | 625 | case mir_window_state_hidden: |
1665 | 621 | window_info.restore_rect({window.top_left(), window.size()}); | 626 | window_info.restore_rect({window.top_left(), window.size()}); |
1666 | 622 | break; | 627 | break; |
1667 | 623 | 628 | ||
1669 | 624 | case mir_surface_state_vertmaximized: | 629 | case mir_window_state_vertmaximized: |
1670 | 625 | { | 630 | { |
1671 | 626 | auto restore_rect = window_info.restore_rect(); | 631 | auto restore_rect = window_info.restore_rect(); |
1672 | 627 | restore_rect.top_left.x = window.top_left().x; | 632 | restore_rect.top_left.x = window.top_left().x; |
1673 | @@ -630,7 +635,7 @@ | |||
1674 | 630 | break; | 635 | break; |
1675 | 631 | } | 636 | } |
1676 | 632 | 637 | ||
1678 | 633 | case mir_surface_state_horizmaximized: | 638 | case mir_window_state_horizmaximized: |
1679 | 634 | { | 639 | { |
1680 | 635 | auto restore_rect = window_info.restore_rect(); | 640 | auto restore_rect = window_info.restore_rect(); |
1681 | 636 | restore_rect.top_left.y = window.top_left().y; | 641 | restore_rect.top_left.y = window.top_left().y; |
1682 | @@ -740,7 +745,7 @@ | |||
1683 | 740 | 745 | ||
1684 | 741 | switch (new_state) | 746 | switch (new_state) |
1685 | 742 | { | 747 | { |
1687 | 743 | case mir_surface_state_fullscreen: | 748 | case mir_window_state_fullscreen: |
1688 | 744 | if (modifications.output_id().is_set() && | 749 | if (modifications.output_id().is_set() && |
1689 | 745 | (!window_info.has_output_id() || modifications.output_id().value() != window_info.output_id())) | 750 | (!window_info.has_output_id() || modifications.output_id().value() != window_info.output_id())) |
1690 | 746 | break; | 751 | break; |
1691 | @@ -758,19 +763,19 @@ | |||
1692 | 758 | // window_info.restore_rect() was cached on last state change, update to reflect current window position | 763 | // window_info.restore_rect() was cached on last state change, update to reflect current window position |
1693 | 759 | switch (window_info.state()) | 764 | switch (window_info.state()) |
1694 | 760 | { | 765 | { |
1697 | 761 | case mir_surface_state_restored: | 766 | case mir_window_state_restored: |
1698 | 762 | case mir_surface_state_hidden: | 767 | case mir_window_state_hidden: |
1699 | 763 | restore_rect = {window.top_left(), window.size()}; | 768 | restore_rect = {window.top_left(), window.size()}; |
1700 | 764 | break; | 769 | break; |
1701 | 765 | 770 | ||
1703 | 766 | case mir_surface_state_vertmaximized: | 771 | case mir_window_state_vertmaximized: |
1704 | 767 | { | 772 | { |
1705 | 768 | restore_rect.top_left.x = window.top_left().x; | 773 | restore_rect.top_left.x = window.top_left().x; |
1706 | 769 | restore_rect.size.width = window.size().width; | 774 | restore_rect.size.width = window.size().width; |
1707 | 770 | break; | 775 | break; |
1708 | 771 | } | 776 | } |
1709 | 772 | 777 | ||
1711 | 773 | case mir_surface_state_horizmaximized: | 778 | case mir_window_state_horizmaximized: |
1712 | 774 | { | 779 | { |
1713 | 775 | restore_rect.top_left.y = window.top_left().y; | 780 | restore_rect.top_left.y = window.top_left().y; |
1714 | 776 | restore_rect.size.height= window.size().height; | 781 | restore_rect.size.height= window.size().height; |
1715 | @@ -793,33 +798,33 @@ | |||
1716 | 793 | 798 | ||
1717 | 794 | switch (new_state) | 799 | switch (new_state) |
1718 | 795 | { | 800 | { |
1720 | 796 | case mir_surface_state_restored: | 801 | case mir_window_state_restored: |
1721 | 797 | rect = restore_rect; | 802 | rect = restore_rect; |
1722 | 798 | break; | 803 | break; |
1723 | 799 | 804 | ||
1725 | 800 | case mir_surface_state_maximized: | 805 | case mir_window_state_maximized: |
1726 | 801 | rect = display_area; | 806 | rect = display_area; |
1727 | 802 | break; | 807 | break; |
1728 | 803 | 808 | ||
1730 | 804 | case mir_surface_state_horizmaximized: | 809 | case mir_window_state_horizmaximized: |
1731 | 805 | rect.top_left = {display_area.top_left.x, restore_rect.top_left.y}; | 810 | rect.top_left = {display_area.top_left.x, restore_rect.top_left.y}; |
1732 | 806 | rect.size = {display_area.size.width, restore_rect.size.height}; | 811 | rect.size = {display_area.size.width, restore_rect.size.height}; |
1733 | 807 | break; | 812 | break; |
1734 | 808 | 813 | ||
1736 | 809 | case mir_surface_state_vertmaximized: | 814 | case mir_window_state_vertmaximized: |
1737 | 810 | rect.top_left = {restore_rect.top_left.x, display_area.top_left.y}; | 815 | rect.top_left = {restore_rect.top_left.x, display_area.top_left.y}; |
1738 | 811 | rect.size = {restore_rect.size.width, display_area.size.height}; | 816 | rect.size = {restore_rect.size.width, display_area.size.height}; |
1739 | 812 | break; | 817 | break; |
1740 | 813 | 818 | ||
1742 | 814 | case mir_surface_state_fullscreen: | 819 | case mir_window_state_fullscreen: |
1743 | 815 | { | 820 | { |
1744 | 816 | rect = fullscreen_rect_for(window_info); | 821 | rect = fullscreen_rect_for(window_info); |
1745 | 817 | 822 | ||
1746 | 818 | break; | 823 | break; |
1747 | 819 | } | 824 | } |
1748 | 820 | 825 | ||
1751 | 821 | case mir_surface_state_hidden: | 826 | case mir_window_state_hidden: |
1752 | 822 | case mir_surface_state_minimized: | 827 | case mir_window_state_minimized: |
1753 | 823 | default: | 828 | default: |
1754 | 824 | return; | 829 | return; |
1755 | 825 | } | 830 | } |
1756 | @@ -845,12 +850,12 @@ | |||
1757 | 845 | return r; | 850 | return r; |
1758 | 846 | } | 851 | } |
1759 | 847 | 852 | ||
1761 | 848 | void miral::BasicWindowManager::set_state(miral::WindowInfo& window_info, MirSurfaceState value) | 853 | void miral::BasicWindowManager::set_state(miral::WindowInfo& window_info, MirWindowState value) |
1762 | 849 | { | 854 | { |
1763 | 850 | auto const window = window_info.window(); | 855 | auto const window = window_info.window(); |
1764 | 851 | auto const mir_surface = std::shared_ptr<scene::Surface>(window); | 856 | auto const mir_surface = std::shared_ptr<scene::Surface>(window); |
1765 | 852 | 857 | ||
1767 | 853 | if (value != mir_surface_state_fullscreen) | 858 | if (value != mir_window_state_fullscreen) |
1768 | 854 | { | 859 | { |
1769 | 855 | fullscreen_surfaces.erase(window); | 860 | fullscreen_surfaces.erase(window); |
1770 | 856 | } | 861 | } |
1771 | @@ -864,18 +869,18 @@ | |||
1772 | 864 | return; | 869 | return; |
1773 | 865 | } | 870 | } |
1774 | 866 | 871 | ||
1777 | 867 | bool const was_hidden = window_info.state() == mir_surface_state_hidden || | 872 | bool const was_hidden = window_info.state() == mir_window_state_hidden || |
1778 | 868 | window_info.state() == mir_surface_state_minimized; | 873 | window_info.state() == mir_window_state_minimized; |
1779 | 869 | 874 | ||
1780 | 870 | policy->advise_state_change(window_info, value); | 875 | policy->advise_state_change(window_info, value); |
1781 | 871 | window_info.state(value); | 876 | window_info.state(value); |
1782 | 872 | 877 | ||
1784 | 873 | mir_surface->configure(mir_surface_attrib_state, value); | 878 | mir_surface->configure(mir_window_attrib_state, value); |
1785 | 874 | 879 | ||
1786 | 875 | switch (value) | 880 | switch (value) |
1787 | 876 | { | 881 | { |
1790 | 877 | case mir_surface_state_hidden: | 882 | case mir_window_state_hidden: |
1791 | 878 | case mir_surface_state_minimized: | 883 | case mir_window_state_minimized: |
1792 | 879 | mir_surface->hide(); | 884 | mir_surface->hide(); |
1793 | 880 | 885 | ||
1794 | 881 | if (window == active_window()) | 886 | if (window == active_window()) |
1795 | @@ -885,8 +890,6 @@ | |||
1796 | 885 | { | 890 | { |
1797 | 886 | if (candidate == window) | 891 | if (candidate == window) |
1798 | 887 | return true; | 892 | return true; |
1799 | 888 | if (!std::shared_ptr<scene::Surface>(candidate)->visible()) | ||
1800 | 889 | return true; | ||
1801 | 890 | auto const w = candidate; | 893 | auto const w = candidate; |
1802 | 891 | return !(select_active_window(w)); | 894 | return !(select_active_window(w)); |
1803 | 892 | }); | 895 | }); |
1804 | @@ -966,7 +969,7 @@ | |||
1805 | 966 | { | 969 | { |
1806 | 967 | if (std::shared_ptr<mir::scene::Surface> surface = child) | 970 | if (std::shared_ptr<mir::scene::Surface> surface = child) |
1807 | 968 | { | 971 | { |
1809 | 969 | if (surface->type() == mir_surface_type_dialog && surface->visible()) | 972 | if (surface->type() == mir_window_type_dialog && surface->visible()) |
1810 | 970 | return select_active_window(child); | 973 | return select_active_window(child); |
1811 | 971 | } | 974 | } |
1812 | 972 | } | 975 | } |
1813 | @@ -1009,43 +1012,43 @@ | |||
1814 | 1009 | // Mir and Unity: Surfaces, input, and displays (v0.3) | 1012 | // Mir and Unity: Surfaces, input, and displays (v0.3) |
1815 | 1010 | switch (window_info.type()) | 1013 | switch (window_info.type()) |
1816 | 1011 | { | 1014 | { |
1822 | 1012 | case mir_surface_type_normal: // regular | 1015 | case mir_window_type_normal: // regular |
1823 | 1013 | case mir_surface_type_utility: // floating regular | 1016 | case mir_window_type_utility: // floating regular |
1824 | 1014 | case mir_surface_type_dialog: // dialog | 1017 | case mir_window_type_dialog: // dialog |
1825 | 1015 | case mir_surface_type_satellite:// satellite | 1018 | case mir_window_type_satellite:// satellite |
1826 | 1016 | case mir_surface_type_freestyle:// freestyle | 1019 | case mir_window_type_freestyle:// freestyle |
1827 | 1017 | break; | 1020 | break; |
1828 | 1018 | 1021 | ||
1834 | 1019 | case mir_surface_type_gloss: | 1022 | case mir_window_type_gloss: |
1835 | 1020 | case mir_surface_type_menu: | 1023 | case mir_window_type_menu: |
1836 | 1021 | case mir_surface_type_inputmethod: | 1024 | case mir_window_type_inputmethod: |
1837 | 1022 | case mir_surface_type_tip: | 1025 | case mir_window_type_tip: |
1838 | 1023 | case mir_surface_types: | 1026 | case mir_window_types: |
1839 | 1024 | return; | 1027 | return; |
1840 | 1025 | } | 1028 | } |
1841 | 1026 | 1029 | ||
1842 | 1027 | switch (window_info.state()) | 1030 | switch (window_info.state()) |
1843 | 1028 | { | 1031 | { |
1845 | 1029 | case mir_surface_state_restored: | 1032 | case mir_window_state_restored: |
1846 | 1030 | break; | 1033 | break; |
1847 | 1031 | 1034 | ||
1848 | 1032 | // "A vertically maximised window is anchored to the top and bottom of | 1035 | // "A vertically maximised window is anchored to the top and bottom of |
1849 | 1033 | // the available workspace and can have any width." | 1036 | // the available workspace and can have any width." |
1851 | 1034 | case mir_surface_state_vertmaximized: | 1037 | case mir_window_state_vertmaximized: |
1852 | 1035 | movement.dy = DeltaY(0); | 1038 | movement.dy = DeltaY(0); |
1853 | 1036 | break; | 1039 | break; |
1854 | 1037 | 1040 | ||
1855 | 1038 | // "A horizontally maximised window is anchored to the left and right of | 1041 | // "A horizontally maximised window is anchored to the left and right of |
1856 | 1039 | // the available workspace and can have any height" | 1042 | // the available workspace and can have any height" |
1858 | 1040 | case mir_surface_state_horizmaximized: | 1043 | case mir_window_state_horizmaximized: |
1859 | 1041 | movement.dx = DeltaX(0); | 1044 | movement.dx = DeltaX(0); |
1860 | 1042 | break; | 1045 | break; |
1861 | 1043 | 1046 | ||
1862 | 1044 | // "A maximised window is anchored to the top, bottom, left and right of the | 1047 | // "A maximised window is anchored to the top, bottom, left and right of the |
1863 | 1045 | // available workspace. For example, if the launcher is always-visible then | 1048 | // available workspace. For example, if the launcher is always-visible then |
1864 | 1046 | // the left-edge of the window is anchored to the right-edge of the launcher." | 1049 | // the left-edge of the window is anchored to the right-edge of the launcher." |
1867 | 1047 | case mir_surface_state_maximized: | 1050 | case mir_window_state_maximized: |
1868 | 1048 | case mir_surface_state_fullscreen: | 1051 | case mir_window_state_fullscreen: |
1869 | 1049 | default: | 1052 | default: |
1870 | 1050 | return; | 1053 | return; |
1871 | 1051 | } | 1054 | } |
1872 | @@ -1071,10 +1074,10 @@ | |||
1873 | 1071 | -> WindowSpecification | 1074 | -> WindowSpecification |
1874 | 1072 | { | 1075 | { |
1875 | 1073 | if (!parameters.type().is_set()) | 1076 | if (!parameters.type().is_set()) |
1877 | 1074 | parameters.type() = mir_surface_type_normal; | 1077 | parameters.type() = mir_window_type_normal; |
1878 | 1075 | 1078 | ||
1879 | 1076 | if (!parameters.state().is_set()) | 1079 | if (!parameters.state().is_set()) |
1881 | 1077 | parameters.state() = mir_surface_state_restored; | 1080 | parameters.state() = mir_window_state_restored; |
1882 | 1078 | 1081 | ||
1883 | 1079 | auto const active_display_area = active_display(); | 1082 | auto const active_display_area = active_display(); |
1884 | 1080 | auto const height = parameters.size().value().height.as_int(); | 1083 | auto const height = parameters.size().value().height.as_int(); |
1885 | @@ -1090,7 +1093,7 @@ | |||
1886 | 1090 | display_layout->place_in_output(id, rect); | 1093 | display_layout->place_in_output(id, rect); |
1887 | 1091 | parameters.top_left() = rect.top_left; | 1094 | parameters.top_left() = rect.top_left; |
1888 | 1092 | parameters.size() = rect.size; | 1095 | parameters.size() = rect.size; |
1890 | 1093 | parameters.state() = mir_surface_state_fullscreen; | 1096 | parameters.state() = mir_window_state_fullscreen; |
1891 | 1094 | positioned = true; | 1097 | positioned = true; |
1892 | 1095 | } | 1098 | } |
1893 | 1096 | else if (!has_parent) // No parent => client can't suggest positioning | 1099 | else if (!has_parent) // No parent => client can't suggest positioning |
1894 | @@ -1157,19 +1160,19 @@ | |||
1895 | 1157 | 1160 | ||
1896 | 1158 | switch (parameters.state().value()) | 1161 | switch (parameters.state().value()) |
1897 | 1159 | { | 1162 | { |
1900 | 1160 | case mir_surface_state_fullscreen: | 1163 | case mir_window_state_fullscreen: |
1901 | 1161 | case mir_surface_state_maximized: | 1164 | case mir_window_state_maximized: |
1902 | 1162 | parameters.top_left() = active_display_area.top_left; | 1165 | parameters.top_left() = active_display_area.top_left; |
1903 | 1163 | parameters.size() = active_display_area.size; | 1166 | parameters.size() = active_display_area.size; |
1904 | 1164 | break; | 1167 | break; |
1905 | 1165 | 1168 | ||
1907 | 1166 | case mir_surface_state_vertmaximized: | 1169 | case mir_window_state_vertmaximized: |
1908 | 1167 | centred.y = active_display_area.top_left.y; | 1170 | centred.y = active_display_area.top_left.y; |
1909 | 1168 | parameters.top_left() = centred; | 1171 | parameters.top_left() = centred; |
1910 | 1169 | parameters.size() = Size{parameters.size().value().width, active_display_area.size.height}; | 1172 | parameters.size() = Size{parameters.size().value().width, active_display_area.size.height}; |
1911 | 1170 | break; | 1173 | break; |
1912 | 1171 | 1174 | ||
1914 | 1172 | case mir_surface_state_horizmaximized: | 1175 | case mir_window_state_horizmaximized: |
1915 | 1173 | centred.x = active_display_area.top_left.x; | 1176 | centred.x = active_display_area.top_left.x; |
1916 | 1174 | parameters.top_left() = centred; | 1177 | parameters.top_left() = centred; |
1917 | 1175 | parameters.size() = Size{active_display_area.size.width, parameters.size().value().height}; | 1178 | parameters.size() = Size{active_display_area.size.width, parameters.size().value().height}; |
1918 | @@ -1525,37 +1528,37 @@ | |||
1919 | 1525 | 1528 | ||
1920 | 1526 | switch (original_type) | 1529 | switch (original_type) |
1921 | 1527 | { | 1530 | { |
1953 | 1528 | case mir_surface_type_normal: | 1531 | case mir_window_type_normal: |
1954 | 1529 | case mir_surface_type_utility: | 1532 | case mir_window_type_utility: |
1955 | 1530 | case mir_surface_type_dialog: | 1533 | case mir_window_type_dialog: |
1956 | 1531 | case mir_surface_type_satellite: | 1534 | case mir_window_type_satellite: |
1957 | 1532 | switch (target_type) | 1535 | switch (target_type) |
1958 | 1533 | { | 1536 | { |
1959 | 1534 | case mir_surface_type_normal: | 1537 | case mir_window_type_normal: |
1960 | 1535 | case mir_surface_type_utility: | 1538 | case mir_window_type_utility: |
1961 | 1536 | case mir_surface_type_dialog: | 1539 | case mir_window_type_dialog: |
1962 | 1537 | case mir_surface_type_satellite: | 1540 | case mir_window_type_satellite: |
1963 | 1538 | break; | 1541 | break; |
1964 | 1539 | 1542 | ||
1965 | 1540 | default: | 1543 | default: |
1966 | 1541 | BOOST_THROW_EXCEPTION(std::runtime_error("Invalid surface type change")); | 1544 | BOOST_THROW_EXCEPTION(std::runtime_error("Invalid surface type change")); |
1967 | 1542 | } | 1545 | } |
1968 | 1543 | 1546 | ||
1969 | 1544 | case mir_surface_type_menu: | 1547 | case mir_window_type_menu: |
1970 | 1545 | switch (target_type) | 1548 | switch (target_type) |
1971 | 1546 | { | 1549 | { |
1972 | 1547 | case mir_surface_type_menu: | 1550 | case mir_window_type_menu: |
1973 | 1548 | case mir_surface_type_satellite: | 1551 | case mir_window_type_satellite: |
1974 | 1549 | break; | 1552 | break; |
1975 | 1550 | 1553 | ||
1976 | 1551 | default: | 1554 | default: |
1977 | 1552 | BOOST_THROW_EXCEPTION(std::runtime_error("Invalid surface type change")); | 1555 | BOOST_THROW_EXCEPTION(std::runtime_error("Invalid surface type change")); |
1978 | 1553 | } | 1556 | } |
1979 | 1554 | 1557 | ||
1980 | 1555 | case mir_surface_type_gloss: | 1558 | case mir_window_type_gloss: |
1981 | 1556 | case mir_surface_type_freestyle: | 1559 | case mir_window_type_freestyle: |
1982 | 1557 | case mir_surface_type_inputmethod: | 1560 | case mir_window_type_inputmethod: |
1983 | 1558 | case mir_surface_type_tip: | 1561 | case mir_window_type_tip: |
1984 | 1559 | if (target_type != original_type) | 1562 | if (target_type != original_type) |
1985 | 1560 | BOOST_THROW_EXCEPTION(std::runtime_error("Invalid surface type change")); | 1563 | BOOST_THROW_EXCEPTION(std::runtime_error("Invalid surface type change")); |
1986 | 1561 | break; | 1564 | break; |
1987 | @@ -1567,23 +1570,23 @@ | |||
1988 | 1567 | 1570 | ||
1989 | 1568 | switch (target_type) | 1571 | switch (target_type) |
1990 | 1569 | { | 1572 | { |
1993 | 1570 | case mir_surface_type_normal: | 1573 | case mir_window_type_normal: |
1994 | 1571 | case mir_surface_type_utility: | 1574 | case mir_window_type_utility: |
1995 | 1572 | if (modifications.parent().is_set() ? modifications.parent().value().lock() : window_info.parent()) | 1575 | if (modifications.parent().is_set() ? modifications.parent().value().lock() : window_info.parent()) |
1997 | 1573 | BOOST_THROW_EXCEPTION(std::runtime_error("Surface type must not have a parent")); | 1576 | BOOST_THROW_EXCEPTION(std::runtime_error("Window type must not have a parent")); |
1998 | 1574 | break; | 1577 | break; |
1999 | 1575 | 1578 | ||
2003 | 1576 | case mir_surface_type_satellite: | 1579 | case mir_window_type_satellite: |
2004 | 1577 | case mir_surface_type_gloss: | 1580 | case mir_window_type_gloss: |
2005 | 1578 | case mir_surface_type_tip: | 1581 | case mir_window_type_tip: |
2006 | 1579 | if (modifications.parent().is_set() ? !modifications.parent().value().lock() : !window_info.parent()) | 1582 | if (modifications.parent().is_set() ? !modifications.parent().value().lock() : !window_info.parent()) |
2008 | 1580 | BOOST_THROW_EXCEPTION(std::runtime_error("Surface type must have a parent")); | 1583 | BOOST_THROW_EXCEPTION(std::runtime_error("Window type must have a parent")); |
2009 | 1581 | break; | 1584 | break; |
2010 | 1582 | 1585 | ||
2015 | 1583 | case mir_surface_type_inputmethod: | 1586 | case mir_window_type_inputmethod: |
2016 | 1584 | case mir_surface_type_dialog: | 1587 | case mir_window_type_dialog: |
2017 | 1585 | case mir_surface_type_menu: | 1588 | case mir_window_type_menu: |
2018 | 1586 | case mir_surface_type_freestyle: | 1589 | case mir_window_type_freestyle: |
2019 | 1587 | break; | 1590 | break; |
2020 | 1588 | 1591 | ||
2021 | 1589 | default: | 1592 | default: |
2022 | 1590 | 1593 | ||
2023 | === modified file 'miral/basic_window_manager.h' | |||
2024 | --- miral/basic_window_manager.h 2016-12-20 15:34:11 +0000 | |||
2025 | +++ miral/basic_window_manager.h 2017-01-26 16:46:42 +0000 | |||
2026 | @@ -94,7 +94,7 @@ | |||
2027 | 94 | int set_surface_attribute( | 94 | int set_surface_attribute( |
2028 | 95 | std::shared_ptr<mir::scene::Session> const& /*application*/, | 95 | std::shared_ptr<mir::scene::Session> const& /*application*/, |
2029 | 96 | std::shared_ptr<mir::scene::Surface> const& surface, | 96 | std::shared_ptr<mir::scene::Surface> const& surface, |
2031 | 97 | MirSurfaceAttrib attrib, | 97 | MirWindowAttrib attrib, |
2032 | 98 | int value) override; | 98 | int value) override; |
2033 | 99 | 99 | ||
2034 | 100 | auto count_applications() const -> unsigned int override; | 100 | auto count_applications() const -> unsigned int override; |
2035 | @@ -172,7 +172,7 @@ | |||
2036 | 172 | void erase(miral::WindowInfo const& info); | 172 | void erase(miral::WindowInfo const& info); |
2037 | 173 | void validate_modification_request(WindowSpecification const& modifications, WindowInfo const& window_info) const; | 173 | void validate_modification_request(WindowSpecification const& modifications, WindowInfo const& window_info) const; |
2038 | 174 | void place_and_size(WindowInfo& root, Point const& new_pos, Size const& new_size); | 174 | void place_and_size(WindowInfo& root, Point const& new_pos, Size const& new_size); |
2040 | 175 | void set_state(miral::WindowInfo& window_info, MirSurfaceState value); | 175 | void set_state(miral::WindowInfo& window_info, MirWindowState value); |
2041 | 176 | auto fullscreen_rect_for(WindowInfo const& window_info) const -> Rectangle; | 176 | auto fullscreen_rect_for(WindowInfo const& window_info) const -> Rectangle; |
2042 | 177 | void remove_window(Application const& application, miral::WindowInfo const& info); | 177 | void remove_window(Application const& application, miral::WindowInfo const& info); |
2043 | 178 | }; | 178 | }; |
2044 | 179 | 179 | ||
2045 | === added file 'miral/both_versions.h' | |||
2046 | --- miral/both_versions.h 1970-01-01 00:00:00 +0000 | |||
2047 | +++ miral/both_versions.h 2017-01-26 16:46:42 +0000 | |||
2048 | @@ -0,0 +1,48 @@ | |||
2049 | 1 | /* | ||
2050 | 2 | * Copyright © 2017 Canonical Ltd. | ||
2051 | 3 | * | ||
2052 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2053 | 5 | * under the terms of the GNU General Public License version 3, | ||
2054 | 6 | * as published by the Free Software Foundation. | ||
2055 | 7 | * | ||
2056 | 8 | * This program is distributed in the hope that it will be useful, | ||
2057 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2058 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2059 | 11 | * GNU General Public License for more details. | ||
2060 | 12 | * | ||
2061 | 13 | * You should have received a copy of the GNU General Public License | ||
2062 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2063 | 15 | * | ||
2064 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
2065 | 17 | */ | ||
2066 | 18 | |||
2067 | 19 | #ifndef MIRAL_BOTH_VERSIONS_H | ||
2068 | 20 | #define MIRAL_BOTH_VERSIONS_H | ||
2069 | 21 | |||
2070 | 22 | #include <mir/version.h> | ||
2071 | 23 | |||
2072 | 24 | #if (MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 26, 0)) | ||
2073 | 25 | #ifndef __clang__ | ||
2074 | 26 | #define MIRAL_BOTH_VERSIONS(old_sym, old_version, new_sym, new_version)\ | ||
2075 | 27 | extern "C" __attribute__((alias(#new_sym))) void old_sym();\ | ||
2076 | 28 | __asm__(".symver old_sym,old_sym@" #old_version);\ | ||
2077 | 29 | __asm__(".symver new_sym,new_sym@@" #new_version); | ||
2078 | 30 | #else | ||
2079 | 31 | #define MIRAL_BOTH_VERSIONS(old_sym, old_version, new_sym, new_version)\ | ||
2080 | 32 | __asm__(".symver new_sym,old_sym@" #old_version);\ | ||
2081 | 33 | __asm__(".symver new_sym,new_sym@@@" #new_version); | ||
2082 | 34 | #endif | ||
2083 | 35 | #else | ||
2084 | 36 | #ifndef __clang__ | ||
2085 | 37 | #define MIRAL_BOTH_VERSIONS(old_sym, old_version, new_sym, new_version)\ | ||
2086 | 38 | extern "C" __attribute__((alias(#old_sym))) void new_sym();\ | ||
2087 | 39 | __asm__(".symver old_sym,old_sym@" #old_version);\ | ||
2088 | 40 | __asm__(".symver new_sym,new_sym@@" #new_version); | ||
2089 | 41 | #else | ||
2090 | 42 | #define MIRAL_BOTH_VERSIONS(old_sym, old_version, new_sym, new_version)\ | ||
2091 | 43 | __asm__(".symver old_sym,old_sym@" #old_version);\ | ||
2092 | 44 | __asm__(".symver old_sym,new_sym@@@" #new_version); | ||
2093 | 45 | #endif | ||
2094 | 46 | #endif | ||
2095 | 47 | |||
2096 | 48 | #endif //MIRAL_BOTH_VERSIONS_H | ||
2097 | 0 | 49 | ||
2098 | === modified file 'miral/canonical_window_manager.cpp' | |||
2099 | --- miral/canonical_window_manager.cpp 2017-01-18 17:41:46 +0000 | |||
2100 | +++ miral/canonical_window_manager.cpp 2017-01-26 16:46:42 +0000 | |||
2101 | @@ -30,7 +30,14 @@ | |||
2102 | 30 | { | 30 | { |
2103 | 31 | } | 31 | } |
2104 | 32 | 32 | ||
2106 | 33 | auto miral::CanonicalWindowManagerPolicy::place_new_surface( | 33 | #ifndef __clang__ |
2107 | 34 | extern "C" __attribute__((alias("_ZN5miral28CanonicalWindowManagerPolicy16place_new_windowERKNS_15ApplicationInfoERKNS_19WindowSpecificationE"))) void _ZN5miral28CanonicalWindowManagerPolicy17place_new_surfaceERKNS_15ApplicationInfoERKNS_19WindowSpecificationE(); | ||
2108 | 35 | __asm__(".symver _ZN5miral28CanonicalWindowManagerPolicy17place_new_surfaceERKNS_15ApplicationInfoERKNS_19WindowSpecificationE,_ZN5miral28CanonicalWindowManagerPolicy17place_new_surfaceERKNS_15ApplicationInfoERKNS_19WindowSpecificationE@MIRAL_1.0"); | ||
2109 | 36 | #else | ||
2110 | 37 | __asm__(".symver _ZN5miral28CanonicalWindowManagerPolicy16place_new_windowERKNS_15ApplicationInfoERKNS_19WindowSpecificationE,_ZN5miral28CanonicalWindowManagerPolicy17place_new_surfaceERKNS_15ApplicationInfoERKNS_19WindowSpecificationE@MIRAL_1.0"); | ||
2111 | 38 | __asm__(".symver _ZN5miral28CanonicalWindowManagerPolicy16place_new_windowERKNS_15ApplicationInfoERKNS_19WindowSpecificationE,_ZN5miral28CanonicalWindowManagerPolicy16place_new_windowERKNS_15ApplicationInfoERKNS_19WindowSpecificationE@@@MIRAL_1.1"); | ||
2112 | 39 | #endif | ||
2113 | 40 | auto miral::CanonicalWindowManagerPolicy::place_new_window( | ||
2114 | 34 | miral::ApplicationInfo const& /*app_info*/, | 41 | miral::ApplicationInfo const& /*app_info*/, |
2115 | 35 | miral::WindowSpecification const& request_parameters) | 42 | miral::WindowSpecification const& request_parameters) |
2116 | 36 | -> miral::WindowSpecification | 43 | -> miral::WindowSpecification |
2117 | 37 | 44 | ||
2118 | === modified file 'miral/coordinate_translator.cpp' | |||
2119 | --- miral/coordinate_translator.cpp 2016-11-14 10:49:35 +0000 | |||
2120 | +++ miral/coordinate_translator.cpp 2017-01-26 16:46:42 +0000 | |||
2121 | @@ -44,3 +44,8 @@ | |||
2122 | 44 | auto const& scene_surface = std::dynamic_pointer_cast<mir::scene::Surface>(surface); | 44 | auto const& scene_surface = std::dynamic_pointer_cast<mir::scene::Surface>(surface); |
2123 | 45 | return scene_surface->top_left() + mir::geometry::Displacement{x, y}; | 45 | return scene_surface->top_left() + mir::geometry::Displacement{x, y}; |
2124 | 46 | } | 46 | } |
2125 | 47 | |||
2126 | 48 | bool miral::CoordinateTranslator::translation_supported() const | ||
2127 | 49 | { | ||
2128 | 50 | return enabled; | ||
2129 | 51 | } | ||
2130 | 47 | 52 | ||
2131 | === modified file 'miral/coordinate_translator.h' | |||
2132 | --- miral/coordinate_translator.h 2016-11-14 10:49:35 +0000 | |||
2133 | +++ miral/coordinate_translator.h 2017-01-26 16:46:42 +0000 | |||
2134 | @@ -23,6 +23,11 @@ | |||
2135 | 23 | 23 | ||
2136 | 24 | #include <atomic> | 24 | #include <atomic> |
2137 | 25 | 25 | ||
2138 | 26 | #ifdef __clang__ | ||
2139 | 27 | #pragma clang diagnostic push | ||
2140 | 28 | #pragma clang diagnostic ignored "-Winconsistent-missing-override" | ||
2141 | 29 | #endif | ||
2142 | 30 | |||
2143 | 26 | namespace miral | 31 | namespace miral |
2144 | 27 | { | 32 | { |
2145 | 28 | class CoordinateTranslator : public mir::scene::CoordinateTranslator | 33 | class CoordinateTranslator : public mir::scene::CoordinateTranslator |
2146 | @@ -34,9 +39,14 @@ | |||
2147 | 34 | auto surface_to_screen(std::shared_ptr<mir::frontend::Surface> surface, int32_t x, int32_t y) | 39 | auto surface_to_screen(std::shared_ptr<mir::frontend::Surface> surface, int32_t x, int32_t y) |
2148 | 35 | -> mir::geometry::Point override; | 40 | -> mir::geometry::Point override; |
2149 | 36 | 41 | ||
2150 | 42 | bool translation_supported() const; | ||
2151 | 43 | |||
2152 | 37 | private: | 44 | private: |
2153 | 38 | std::atomic<bool> enabled{false}; | 45 | std::atomic<bool> enabled{false}; |
2154 | 39 | }; | 46 | }; |
2155 | 40 | } | 47 | } |
2156 | 48 | #ifdef __clang__ | ||
2157 | 49 | #pragma clang diagnostic pop | ||
2158 | 50 | #endif | ||
2159 | 41 | 51 | ||
2160 | 42 | #endif //MIRAL_COORDINATE_TRANSLATOR_H | 52 | #endif //MIRAL_COORDINATE_TRANSLATOR_H |
2161 | 43 | 53 | ||
2162 | === modified file 'miral/keymap.cpp' | |||
2163 | --- miral/keymap.cpp 2016-10-20 07:34:53 +0000 | |||
2164 | +++ miral/keymap.cpp 2017-01-26 16:46:42 +0000 | |||
2165 | @@ -25,7 +25,10 @@ | |||
2166 | 25 | #include <mir/server.h> | 25 | #include <mir/server.h> |
2167 | 26 | #include <mir/version.h> | 26 | #include <mir/version.h> |
2168 | 27 | 27 | ||
2170 | 28 | #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 24, 1) | 28 | #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 26, 0) |
2171 | 29 | #include <mir/input/keymap.h> | ||
2172 | 30 | #include <mir/input/mir_keyboard_config.h> | ||
2173 | 31 | #elif MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 24, 1) | ||
2174 | 29 | #include <mir/input/keymap.h> | 32 | #include <mir/input/keymap.h> |
2175 | 30 | #include <mir/input/keyboard_configuration.h> | 33 | #include <mir/input/keyboard_configuration.h> |
2176 | 31 | #endif | 34 | #endif |
2177 | @@ -112,7 +115,11 @@ | |||
2178 | 112 | 115 | ||
2179 | 113 | if (keyboard_config.is_set()) | 116 | if (keyboard_config.is_set()) |
2180 | 114 | { | 117 | { |
2181 | 118 | #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 26, 0) | ||
2182 | 119 | keymap = keyboard_config.value().device_keymap(); | ||
2183 | 120 | #else | ||
2184 | 115 | keymap = keyboard_config.value().device_keymap; | 121 | keymap = keyboard_config.value().device_keymap; |
2185 | 122 | #endif | ||
2186 | 116 | } | 123 | } |
2187 | 117 | 124 | ||
2188 | 118 | keymap.layout = layout; | 125 | keymap.layout = layout; |
2189 | 119 | 126 | ||
2190 | === modified file 'miral/symbols.map' | |||
2191 | --- miral/symbols.map 2016-12-13 13:07:15 +0000 | |||
2192 | +++ miral/symbols.map 2017-01-26 16:46:42 +0000 | |||
2193 | @@ -112,7 +112,6 @@ | |||
2194 | 112 | miral::WindowInfo::WindowInfo*; | 112 | miral::WindowInfo::WindowInfo*; |
2195 | 113 | miral::WindowInfo::add_child*; | 113 | miral::WindowInfo::add_child*; |
2196 | 114 | miral::WindowInfo::can_be_active*; | 114 | miral::WindowInfo::can_be_active*; |
2197 | 115 | miral::WindowInfo::can_morph_to*; | ||
2198 | 116 | miral::WindowInfo::children*; | 115 | miral::WindowInfo::children*; |
2199 | 117 | miral::WindowInfo::confine_pointer*; | 116 | miral::WindowInfo::confine_pointer*; |
2200 | 118 | miral::WindowInfo::constrain_resize*; | 117 | miral::WindowInfo::constrain_resize*; |
2201 | @@ -128,15 +127,12 @@ | |||
2202 | 128 | miral::WindowInfo::must_have_parent*; | 127 | miral::WindowInfo::must_have_parent*; |
2203 | 129 | miral::WindowInfo::must_not_have_parent*; | 128 | miral::WindowInfo::must_not_have_parent*; |
2204 | 130 | miral::WindowInfo::name*; | 129 | miral::WindowInfo::name*; |
2205 | 131 | miral::WindowInfo::needs_titlebar*; | ||
2206 | 132 | miral::WindowInfo::operator*; | 130 | miral::WindowInfo::operator*; |
2207 | 133 | miral::WindowInfo::output_id*; | 131 | miral::WindowInfo::output_id*; |
2208 | 134 | miral::WindowInfo::parent*; | 132 | miral::WindowInfo::parent*; |
2209 | 135 | miral::WindowInfo::preferred_orientation*; | 133 | miral::WindowInfo::preferred_orientation*; |
2210 | 136 | miral::WindowInfo::remove_child*; | 134 | miral::WindowInfo::remove_child*; |
2211 | 137 | miral::WindowInfo::restore_rect*; | 135 | miral::WindowInfo::restore_rect*; |
2212 | 138 | miral::WindowInfo::state*; | ||
2213 | 139 | miral::WindowInfo::type*; | ||
2214 | 140 | miral::WindowInfo::userdata*; | 136 | miral::WindowInfo::userdata*; |
2215 | 141 | miral::WindowInfo::width_inc*; | 137 | miral::WindowInfo::width_inc*; |
2216 | 142 | miral::WindowInfo::window*; | 138 | miral::WindowInfo::window*; |
2217 | @@ -153,7 +149,6 @@ | |||
2218 | 153 | miral::WindowManagementPolicy::advise_new_window*; | 149 | miral::WindowManagementPolicy::advise_new_window*; |
2219 | 154 | miral::WindowManagementPolicy::advise_raise*; | 150 | miral::WindowManagementPolicy::advise_raise*; |
2220 | 155 | miral::WindowManagementPolicy::advise_resize*; | 151 | miral::WindowManagementPolicy::advise_resize*; |
2221 | 156 | miral::WindowManagementPolicy::advise_state_change*; | ||
2222 | 157 | miral::WindowManagementPolicy::operator*; | 152 | miral::WindowManagementPolicy::operator*; |
2223 | 158 | miral::WindowManagerOptions::WindowManagerOptions*; | 153 | miral::WindowManagerOptions::WindowManagerOptions*; |
2224 | 159 | miral::WindowManagerOptions::operator*; | 154 | miral::WindowManagerOptions::operator*; |
2225 | @@ -311,5 +306,46 @@ | |||
2226 | 311 | vtable?for?miral::toolkit::Surface; | 306 | vtable?for?miral::toolkit::Surface; |
2227 | 312 | vtable?for?miral::toolkit::SurfaceSpec; | 307 | vtable?for?miral::toolkit::SurfaceSpec; |
2228 | 313 | }; | 308 | }; |
2229 | 309 | # miral::WindowInfo::can_morph_to*; | ||
2230 | 310 | _ZNK5miral10WindowInfo12can_morph_toE14MirSurfaceType; | ||
2231 | 311 | |||
2232 | 312 | # miral::WindowInfo::needs_titlebar*; | ||
2233 | 313 | _ZN5miral10WindowInfo14needs_titlebarE14MirSurfaceType; | ||
2234 | 314 | |||
2235 | 315 | # miral::WindowInfo::state*; | ||
2236 | 316 | _ZNK5miral10WindowInfo5stateEv; | ||
2237 | 317 | _ZN5miral10WindowInfo5stateE15MirSurfaceState; | ||
2238 | 318 | |||
2239 | 319 | # miral::WindowInfo::type*; | ||
2240 | 320 | _ZN5miral10WindowInfo4typeE14MirSurfaceType; | ||
2241 | 321 | _ZNK5miral10WindowInfo4typeEv; | ||
2242 | 322 | |||
2243 | 323 | # miral::WindowManagementPolicy::advise_state_change*; | ||
2244 | 324 | _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE15MirSurfaceState; | ||
2245 | 314 | local: *; | 325 | local: *; |
2246 | 315 | }; | 326 | }; |
2247 | 327 | |||
2248 | 328 | MIRAL_1.1 { | ||
2249 | 329 | global: | ||
2250 | 330 | # miral::WindowInfo::can_morph_to* | ||
2251 | 331 | _ZNK5miral10WindowInfo12can_morph_toE13MirWindowType; | ||
2252 | 332 | |||
2253 | 333 | #miral::WindowInfo::needs_titlebar*; | ||
2254 | 334 | _ZN5miral10WindowInfo14needs_titlebarE13MirWindowType; | ||
2255 | 335 | |||
2256 | 336 | # miral::WindowInfo::state*; | ||
2257 | 337 | _ZNK5miral10WindowInfo5stateEv; | ||
2258 | 338 | _ZN5miral10WindowInfo5stateE14MirWindowState; | ||
2259 | 339 | |||
2260 | 340 | miral::WindowInfo::type*; | ||
2261 | 341 | _ZN5miral10WindowInfo4typeE13MirWindowType; | ||
2262 | 342 | _ZNK5miral10WindowInfo4typeEv; | ||
2263 | 343 | |||
2264 | 344 | # miral::WindowManagementPolicy::advise_state_change*; | ||
2265 | 345 | _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE14MirWindowState; | ||
2266 | 346 | |||
2267 | 347 | extern "C++" { | ||
2268 | 348 | miral::CanonicalWindowManagerPolicy::place_new_window*; | ||
2269 | 349 | non-virtual?thunk?to?miral::CanonicalWindowManagerPolicy::place_new_window*; | ||
2270 | 350 | }; | ||
2271 | 351 | } MIRAL_1.0; | ||
2272 | 316 | 352 | ||
2273 | === modified file 'miral/window_info.cpp' | |||
2274 | --- miral/window_info.cpp 2016-12-13 13:07:15 +0000 | |||
2275 | +++ miral/window_info.cpp 2017-01-26 16:46:42 +0000 | |||
2276 | @@ -18,7 +18,10 @@ | |||
2277 | 18 | 18 | ||
2278 | 19 | #include "miral/window_info.h" | 19 | #include "miral/window_info.h" |
2279 | 20 | 20 | ||
2280 | 21 | #include "both_versions.h" | ||
2281 | 22 | |||
2282 | 21 | #include <mir/scene/surface.h> | 23 | #include <mir/scene/surface.h> |
2283 | 24 | #include <mir/version.h> | ||
2284 | 22 | 25 | ||
2285 | 23 | #include <limits> | 26 | #include <limits> |
2286 | 24 | 27 | ||
2287 | @@ -41,8 +44,8 @@ | |||
2288 | 41 | 44 | ||
2289 | 42 | Window window; | 45 | Window window; |
2290 | 43 | std::string name; | 46 | std::string name; |
2293 | 44 | MirSurfaceType type; | 47 | MirWindowType type; |
2294 | 45 | MirSurfaceState state; | 48 | MirWindowState state; |
2295 | 46 | mir::geometry::Rectangle restore_rect; | 49 | mir::geometry::Rectangle restore_rect; |
2296 | 47 | Window parent; | 50 | Window parent; |
2297 | 48 | std::vector <Window> children; | 51 | std::vector <Window> children; |
2298 | @@ -64,8 +67,8 @@ | |||
2299 | 64 | miral::WindowInfo::Self::Self(Window window, WindowSpecification const& params) : | 67 | miral::WindowInfo::Self::Self(Window window, WindowSpecification const& params) : |
2300 | 65 | window{window}, | 68 | window{window}, |
2301 | 66 | name{params.name().value()}, | 69 | name{params.name().value()}, |
2304 | 67 | type{optional_value_or_default(params.type(), mir_surface_type_normal)}, | 70 | type{optional_value_or_default(params.type(), mir_window_type_normal)}, |
2305 | 68 | state{optional_value_or_default(params.state(), mir_surface_state_restored)}, | 71 | state{optional_value_or_default(params.state(), mir_window_state_restored)}, |
2306 | 69 | restore_rect{params.top_left().value(), params.size().value()}, | 72 | restore_rect{params.top_left().value(), params.size().value()}, |
2307 | 70 | min_width{optional_value_or_default(params.min_width())}, | 73 | min_width{optional_value_or_default(params.min_width())}, |
2308 | 71 | min_height{optional_value_or_default(params.min_height())}, | 74 | min_height{optional_value_or_default(params.min_height())}, |
2309 | @@ -86,8 +89,8 @@ | |||
2310 | 86 | } | 89 | } |
2311 | 87 | 90 | ||
2312 | 88 | miral::WindowInfo::Self::Self() : | 91 | miral::WindowInfo::Self::Self() : |
2315 | 89 | type{mir_surface_type_normal}, | 92 | type{mir_window_type_normal}, |
2316 | 90 | state{mir_surface_state_unknown}, | 93 | state{mir_window_state_unknown}, |
2317 | 91 | preferred_orientation{mir_orientation_mode_any} | 94 | preferred_orientation{mir_orientation_mode_any} |
2318 | 92 | { | 95 | { |
2319 | 93 | } | 96 | } |
2320 | @@ -123,17 +126,17 @@ | |||
2321 | 123 | { | 126 | { |
2322 | 124 | switch (type()) | 127 | switch (type()) |
2323 | 125 | { | 128 | { |
2331 | 126 | case mir_surface_type_normal: /**< AKA "regular" */ | 129 | case mir_window_type_normal: /**< AKA "regular" */ |
2332 | 127 | case mir_surface_type_utility: /**< AKA "floating" */ | 130 | case mir_window_type_utility: /**< AKA "floating" */ |
2333 | 128 | case mir_surface_type_dialog: | 131 | case mir_window_type_dialog: |
2334 | 129 | case mir_surface_type_satellite: /**< AKA "toolbox"/"toolbar" */ | 132 | case mir_window_type_satellite: /**< AKA "toolbox"/"toolbar" */ |
2335 | 130 | case mir_surface_type_freestyle: | 133 | case mir_window_type_freestyle: |
2336 | 131 | case mir_surface_type_menu: | 134 | case mir_window_type_menu: |
2337 | 132 | case mir_surface_type_inputmethod: /**< AKA "OSK" or handwriting etc. */ | 135 | case mir_window_type_inputmethod: /**< AKA "OSK" or handwriting etc. */ |
2338 | 133 | return true; | 136 | return true; |
2339 | 134 | 137 | ||
2342 | 135 | case mir_surface_type_gloss: | 138 | case mir_window_type_gloss: |
2343 | 136 | case mir_surface_type_tip: /**< AKA "tooltip" */ | 139 | case mir_window_type_tip: /**< AKA "tooltip" */ |
2344 | 137 | default: | 140 | default: |
2345 | 138 | // Cannot have input focus | 141 | // Cannot have input focus |
2346 | 139 | return false; | 142 | return false; |
2347 | @@ -144,10 +147,10 @@ | |||
2348 | 144 | { | 147 | { |
2349 | 145 | switch (type()) | 148 | switch (type()) |
2350 | 146 | { | 149 | { |
2355 | 147 | case mir_surface_type_overlay:; | 150 | case mir_window_type_gloss:; |
2356 | 148 | case mir_surface_type_inputmethod: | 151 | case mir_window_type_inputmethod: |
2357 | 149 | case mir_surface_type_satellite: | 152 | case mir_window_type_satellite: |
2358 | 150 | case mir_surface_type_tip: | 153 | case mir_window_type_tip: |
2359 | 151 | return true; | 154 | return true; |
2360 | 152 | 155 | ||
2361 | 153 | default: | 156 | default: |
2362 | @@ -155,19 +158,22 @@ | |||
2363 | 155 | } | 158 | } |
2364 | 156 | } | 159 | } |
2365 | 157 | 160 | ||
2367 | 158 | bool miral::WindowInfo::can_morph_to(MirSurfaceType new_type) const | 161 | MIRAL_BOTH_VERSIONS( |
2368 | 162 | _ZNK5miral10WindowInfo12can_morph_toE14MirSurfaceType, MIRAL_1.0, | ||
2369 | 163 | _ZNK5miral10WindowInfo12can_morph_toE13MirWindowType, MIRAL_1.1) | ||
2370 | 164 | bool miral::WindowInfo::can_morph_to(MirWindowType new_type) const | ||
2371 | 159 | { | 165 | { |
2372 | 160 | switch (new_type) | 166 | switch (new_type) |
2373 | 161 | { | 167 | { |
2377 | 162 | case mir_surface_type_normal: | 168 | case mir_window_type_normal: |
2378 | 163 | case mir_surface_type_utility: | 169 | case mir_window_type_utility: |
2379 | 164 | case mir_surface_type_satellite: | 170 | case mir_window_type_satellite: |
2380 | 165 | switch (type()) | 171 | switch (type()) |
2381 | 166 | { | 172 | { |
2386 | 167 | case mir_surface_type_normal: | 173 | case mir_window_type_normal: |
2387 | 168 | case mir_surface_type_utility: | 174 | case mir_window_type_utility: |
2388 | 169 | case mir_surface_type_dialog: | 175 | case mir_window_type_dialog: |
2389 | 170 | case mir_surface_type_satellite: | 176 | case mir_window_type_satellite: |
2390 | 171 | return true; | 177 | return true; |
2391 | 172 | 178 | ||
2392 | 173 | default: | 179 | default: |
2393 | @@ -175,14 +181,14 @@ | |||
2394 | 175 | } | 181 | } |
2395 | 176 | break; | 182 | break; |
2396 | 177 | 183 | ||
2398 | 178 | case mir_surface_type_dialog: | 184 | case mir_window_type_dialog: |
2399 | 179 | switch (type()) | 185 | switch (type()) |
2400 | 180 | { | 186 | { |
2406 | 181 | case mir_surface_type_normal: | 187 | case mir_window_type_normal: |
2407 | 182 | case mir_surface_type_utility: | 188 | case mir_window_type_utility: |
2408 | 183 | case mir_surface_type_dialog: | 189 | case mir_window_type_dialog: |
2409 | 184 | case mir_surface_type_popover: | 190 | case mir_window_type_menu: |
2410 | 185 | case mir_surface_type_satellite: | 191 | case mir_window_type_satellite: |
2411 | 186 | return true; | 192 | return true; |
2412 | 187 | 193 | ||
2413 | 188 | default: | 194 | default: |
2414 | @@ -201,8 +207,8 @@ | |||
2415 | 201 | { | 207 | { |
2416 | 202 | switch (type()) | 208 | switch (type()) |
2417 | 203 | { | 209 | { |
2420 | 204 | case mir_surface_type_normal: | 210 | case mir_window_type_normal: |
2421 | 205 | case mir_surface_type_utility: | 211 | case mir_window_type_utility: |
2422 | 206 | return true; | 212 | return true; |
2423 | 207 | 213 | ||
2424 | 208 | default: | 214 | default: |
2425 | @@ -214,8 +220,8 @@ | |||
2426 | 214 | { | 220 | { |
2427 | 215 | switch (state()) | 221 | switch (state()) |
2428 | 216 | { | 222 | { |
2431 | 217 | case mir_surface_state_hidden: | 223 | case mir_window_state_hidden: |
2432 | 218 | case mir_surface_state_minimized: | 224 | case mir_window_state_minimized: |
2433 | 219 | return false; | 225 | return false; |
2434 | 220 | default: | 226 | default: |
2435 | 221 | if (std::shared_ptr<mir::scene::Surface> surface = window()) | 227 | if (std::shared_ptr<mir::scene::Surface> surface = window()) |
2436 | @@ -312,19 +318,19 @@ | |||
2437 | 312 | 318 | ||
2438 | 313 | switch (state()) | 319 | switch (state()) |
2439 | 314 | { | 320 | { |
2441 | 315 | case mir_surface_state_restored: | 321 | case mir_window_state_restored: |
2442 | 316 | break; | 322 | break; |
2443 | 317 | 323 | ||
2444 | 318 | // "A vertically maximised window is anchored to the top and bottom of | 324 | // "A vertically maximised window is anchored to the top and bottom of |
2445 | 319 | // the available workspace and can have any width." | 325 | // the available workspace and can have any width." |
2447 | 320 | case mir_surface_state_vertmaximized: | 326 | case mir_window_state_vertmaximized: |
2448 | 321 | new_pos.y = self->window.top_left().y; | 327 | new_pos.y = self->window.top_left().y; |
2449 | 322 | new_size.height = self->window.size().height; | 328 | new_size.height = self->window.size().height; |
2450 | 323 | break; | 329 | break; |
2451 | 324 | 330 | ||
2452 | 325 | // "A horizontally maximised window is anchored to the left and right of | 331 | // "A horizontally maximised window is anchored to the left and right of |
2453 | 326 | // the available workspace and can have any height" | 332 | // the available workspace and can have any height" |
2455 | 327 | case mir_surface_state_horizmaximized: | 333 | case mir_window_state_horizmaximized: |
2456 | 328 | new_pos.x = self->window.top_left().x; | 334 | new_pos.x = self->window.top_left().x; |
2457 | 329 | new_size.width = self->window.size().width; | 335 | new_size.width = self->window.size().width; |
2458 | 330 | break; | 336 | break; |
2459 | @@ -332,7 +338,7 @@ | |||
2460 | 332 | // "A maximised window is anchored to the top, bottom, left and right of the | 338 | // "A maximised window is anchored to the top, bottom, left and right of the |
2461 | 333 | // available workspace. For example, if the launcher is always-visible then | 339 | // available workspace. For example, if the launcher is always-visible then |
2462 | 334 | // the left-edge of the window is anchored to the right-edge of the launcher." | 340 | // the left-edge of the window is anchored to the right-edge of the launcher." |
2464 | 335 | case mir_surface_state_maximized: | 341 | case mir_window_state_maximized: |
2465 | 336 | default: | 342 | default: |
2466 | 337 | new_pos.x = self->window.top_left().x; | 343 | new_pos.x = self->window.top_left().x; |
2467 | 338 | new_pos.y = self->window.top_left().y; | 344 | new_pos.y = self->window.top_left().y; |
2468 | @@ -345,15 +351,18 @@ | |||
2469 | 345 | requested_size = new_size; | 351 | requested_size = new_size; |
2470 | 346 | } | 352 | } |
2471 | 347 | 353 | ||
2473 | 348 | bool miral::WindowInfo::needs_titlebar(MirSurfaceType type) | 354 | MIRAL_BOTH_VERSIONS( |
2474 | 355 | _ZN5miral10WindowInfo14needs_titlebarE14MirSurfaceType, MIRAL_1.0, | ||
2475 | 356 | _ZN5miral10WindowInfo14needs_titlebarE13MirWindowType, MIRAL_1.1) | ||
2476 | 357 | bool miral::WindowInfo::needs_titlebar(MirWindowType type) | ||
2477 | 349 | { | 358 | { |
2478 | 350 | switch (type) | 359 | switch (type) |
2479 | 351 | { | 360 | { |
2485 | 352 | case mir_surface_type_freestyle: | 361 | case mir_window_type_freestyle: |
2486 | 353 | case mir_surface_type_menu: | 362 | case mir_window_type_menu: |
2487 | 354 | case mir_surface_type_inputmethod: | 363 | case mir_window_type_inputmethod: |
2488 | 355 | case mir_surface_type_gloss: | 364 | case mir_window_type_gloss: |
2489 | 356 | case mir_surface_type_tip: | 365 | case mir_window_type_tip: |
2490 | 357 | // No decorations for these surface types | 366 | // No decorations for these surface types |
2491 | 358 | return false; | 367 | return false; |
2492 | 359 | default: | 368 | default: |
2493 | @@ -361,22 +370,28 @@ | |||
2494 | 361 | } | 370 | } |
2495 | 362 | } | 371 | } |
2496 | 363 | 372 | ||
2498 | 364 | auto miral::WindowInfo::type() const -> MirSurfaceType | 373 | auto miral::WindowInfo::type() const -> MirWindowType |
2499 | 365 | { | 374 | { |
2500 | 366 | return self->type; | 375 | return self->type; |
2501 | 367 | } | 376 | } |
2502 | 368 | 377 | ||
2504 | 369 | void miral::WindowInfo::type(MirSurfaceType type) | 378 | MIRAL_BOTH_VERSIONS( |
2505 | 379 | _ZN5miral10WindowInfo4typeE14MirSurfaceType, MIRAL_1.0, | ||
2506 | 380 | _ZN5miral10WindowInfo4typeE13MirWindowType, MIRAL_1.1) | ||
2507 | 381 | void miral::WindowInfo::type(MirWindowType type) | ||
2508 | 370 | { | 382 | { |
2509 | 371 | self->type = type; | 383 | self->type = type; |
2510 | 372 | } | 384 | } |
2511 | 373 | 385 | ||
2513 | 374 | auto miral::WindowInfo::state() const -> MirSurfaceState | 386 | auto miral::WindowInfo::state() const -> MirWindowState |
2514 | 375 | { | 387 | { |
2515 | 376 | return self->state; | 388 | return self->state; |
2516 | 377 | } | 389 | } |
2517 | 378 | 390 | ||
2519 | 379 | void miral::WindowInfo::state(MirSurfaceState state) | 391 | MIRAL_BOTH_VERSIONS( |
2520 | 392 | _ZN5miral10WindowInfo5stateE15MirSurfaceState, MIRAL_1.0, | ||
2521 | 393 | _ZN5miral10WindowInfo5stateE14MirWindowState, MIRAL_1.1) | ||
2522 | 394 | void miral::WindowInfo::state(MirWindowState state) | ||
2523 | 380 | { | 395 | { |
2524 | 381 | self->state = state; | 396 | self->state = state; |
2525 | 382 | } | 397 | } |
2526 | 383 | 398 | ||
2527 | === modified file 'miral/window_management_policy.cpp' | |||
2528 | --- miral/window_management_policy.cpp 2016-08-10 11:48:02 +0000 | |||
2529 | +++ miral/window_management_policy.cpp 2017-01-26 16:46:42 +0000 | |||
2530 | @@ -17,6 +17,7 @@ | |||
2531 | 17 | */ | 17 | */ |
2532 | 18 | 18 | ||
2533 | 19 | #include "miral/window_management_policy.h" | 19 | #include "miral/window_management_policy.h" |
2534 | 20 | #include "both_versions.h" | ||
2535 | 20 | 21 | ||
2536 | 21 | void miral::WindowManagementPolicy::advise_begin() {} | 22 | void miral::WindowManagementPolicy::advise_begin() {} |
2537 | 22 | void miral::WindowManagementPolicy::advise_end() {} | 23 | void miral::WindowManagementPolicy::advise_end() {} |
2538 | @@ -25,7 +26,11 @@ | |||
2539 | 25 | void miral::WindowManagementPolicy::advise_new_window(WindowInfo const& /*window_info*/) {} | 26 | void miral::WindowManagementPolicy::advise_new_window(WindowInfo const& /*window_info*/) {} |
2540 | 26 | void miral::WindowManagementPolicy::advise_focus_lost(WindowInfo const& /*info*/) {} | 27 | void miral::WindowManagementPolicy::advise_focus_lost(WindowInfo const& /*info*/) {} |
2541 | 27 | void miral::WindowManagementPolicy::advise_focus_gained(WindowInfo const& /*info*/) {} | 28 | void miral::WindowManagementPolicy::advise_focus_gained(WindowInfo const& /*info*/) {} |
2543 | 28 | void miral::WindowManagementPolicy::advise_state_change(WindowInfo const& /*window_info*/, MirSurfaceState /*state*/) {} | 29 | |
2544 | 30 | MIRAL_BOTH_VERSIONS( | ||
2545 | 31 | _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE15MirSurfaceState, MIRAL_1.0, | ||
2546 | 32 | _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE14MirWindowState, MIRAL_1.1) | ||
2547 | 33 | void miral::WindowManagementPolicy::advise_state_change(WindowInfo const& /*window_info*/, MirWindowState /*state*/) {} | ||
2548 | 29 | void miral::WindowManagementPolicy::advise_move_to(WindowInfo const& /*window_info*/, Point /*top_left*/) {} | 34 | void miral::WindowManagementPolicy::advise_move_to(WindowInfo const& /*window_info*/, Point /*top_left*/) {} |
2549 | 30 | void miral::WindowManagementPolicy::advise_resize(WindowInfo const& /*window_info*/, Size const& /*new_size*/) {} | 35 | void miral::WindowManagementPolicy::advise_resize(WindowInfo const& /*window_info*/, Size const& /*new_size*/) {} |
2550 | 31 | void miral::WindowManagementPolicy::advise_delete_window(WindowInfo const& /*window_info*/) {} | 36 | void miral::WindowManagementPolicy::advise_delete_window(WindowInfo const& /*window_info*/) {} |
2551 | 32 | 37 | ||
2552 | === modified file 'miral/window_management_trace.cpp' | |||
2553 | --- miral/window_management_trace.cpp 2016-12-05 09:46:35 +0000 | |||
2554 | +++ miral/window_management_trace.cpp 2017-01-26 16:46:42 +0000 | |||
2555 | @@ -29,9 +29,20 @@ | |||
2556 | 29 | 29 | ||
2557 | 30 | #define MIR_LOG_COMPONENT "miral::Window Management" | 30 | #define MIR_LOG_COMPONENT "miral::Window Management" |
2558 | 31 | #include <mir/log.h> | 31 | #include <mir/log.h> |
2559 | 32 | #include <mir/report_exception.h> | ||
2560 | 32 | 33 | ||
2561 | 33 | using mir::operator<<; | 34 | using mir::operator<<; |
2562 | 34 | 35 | ||
2563 | 36 | #define MIRAL_TRACE_EXCEPTION \ | ||
2564 | 37 | catch (std::exception const& x)\ | ||
2565 | 38 | {\ | ||
2566 | 39 | std::stringstream out;\ | ||
2567 | 40 | mir::report_exception(out);\ | ||
2568 | 41 | mir::log_warning("%s throws %s", __func__, out.str().c_str());\ | ||
2569 | 42 | throw;\ | ||
2570 | 43 | } | ||
2571 | 44 | |||
2572 | 45 | |||
2573 | 35 | namespace | 46 | namespace |
2574 | 36 | { | 47 | { |
2575 | 37 | std::string const null_ptr{"(null)"}; | 48 | std::string const null_ptr{"(null)"}; |
2576 | @@ -273,7 +284,7 @@ | |||
2577 | 273 | return out.str(); | 284 | return out.str(); |
2578 | 274 | } | 285 | } |
2579 | 275 | 286 | ||
2581 | 276 | auto dump_of(MirSurfaceState state) -> std::string | 287 | auto dump_of(MirWindowState state) -> std::string |
2582 | 277 | { | 288 | { |
2583 | 278 | std::stringstream out; | 289 | std::stringstream out; |
2584 | 279 | out << state; | 290 | out << state; |
2585 | @@ -304,95 +315,105 @@ | |||
2586 | 304 | } | 315 | } |
2587 | 305 | 316 | ||
2588 | 306 | auto miral::WindowManagementTrace::count_applications() const -> unsigned int | 317 | auto miral::WindowManagementTrace::count_applications() const -> unsigned int |
2590 | 307 | { | 318 | try { |
2591 | 308 | log_input(); | 319 | log_input(); |
2592 | 309 | auto const result = wrapped.count_applications(); | 320 | auto const result = wrapped.count_applications(); |
2593 | 310 | mir::log_info("%s -> %d", __func__, result); | 321 | mir::log_info("%s -> %d", __func__, result); |
2594 | 311 | trace_count++; | 322 | trace_count++; |
2595 | 312 | return result; | 323 | return result; |
2596 | 313 | } | 324 | } |
2597 | 325 | MIRAL_TRACE_EXCEPTION | ||
2598 | 314 | 326 | ||
2599 | 315 | void miral::WindowManagementTrace::for_each_application(std::function<void(miral::ApplicationInfo&)> const& functor) | 327 | void miral::WindowManagementTrace::for_each_application(std::function<void(miral::ApplicationInfo&)> const& functor) |
2601 | 316 | { | 328 | try { |
2602 | 317 | log_input(); | 329 | log_input(); |
2603 | 318 | mir::log_info("%s", __func__); | 330 | mir::log_info("%s", __func__); |
2604 | 319 | trace_count++; | 331 | trace_count++; |
2605 | 320 | wrapped.for_each_application(functor); | 332 | wrapped.for_each_application(functor); |
2606 | 321 | } | 333 | } |
2607 | 334 | MIRAL_TRACE_EXCEPTION | ||
2608 | 322 | 335 | ||
2609 | 323 | auto miral::WindowManagementTrace::find_application(std::function<bool(ApplicationInfo const& info)> const& predicate) | 336 | auto miral::WindowManagementTrace::find_application(std::function<bool(ApplicationInfo const& info)> const& predicate) |
2610 | 324 | -> Application | 337 | -> Application |
2612 | 325 | { | 338 | try { |
2613 | 326 | log_input(); | 339 | log_input(); |
2614 | 327 | auto result = wrapped.find_application(predicate); | 340 | auto result = wrapped.find_application(predicate); |
2615 | 328 | mir::log_info("%s -> %s", __func__, dump_of(result).c_str()); | 341 | mir::log_info("%s -> %s", __func__, dump_of(result).c_str()); |
2616 | 329 | trace_count++; | 342 | trace_count++; |
2617 | 330 | return result; | 343 | return result; |
2618 | 331 | } | 344 | } |
2619 | 345 | MIRAL_TRACE_EXCEPTION | ||
2620 | 332 | 346 | ||
2621 | 333 | auto miral::WindowManagementTrace::info_for(std::weak_ptr<mir::scene::Session> const& session) const -> ApplicationInfo& | 347 | auto miral::WindowManagementTrace::info_for(std::weak_ptr<mir::scene::Session> const& session) const -> ApplicationInfo& |
2623 | 334 | { | 348 | try { |
2624 | 335 | log_input(); | 349 | log_input(); |
2625 | 336 | auto& result = wrapped.info_for(session); | 350 | auto& result = wrapped.info_for(session); |
2626 | 337 | mir::log_info("%s -> %s", __func__, result.application()->name().c_str()); | 351 | mir::log_info("%s -> %s", __func__, result.application()->name().c_str()); |
2627 | 338 | trace_count++; | 352 | trace_count++; |
2628 | 339 | return result; | 353 | return result; |
2629 | 340 | } | 354 | } |
2630 | 355 | MIRAL_TRACE_EXCEPTION | ||
2631 | 341 | 356 | ||
2632 | 342 | auto miral::WindowManagementTrace::info_for(std::weak_ptr<mir::scene::Surface> const& surface) const -> WindowInfo& | 357 | auto miral::WindowManagementTrace::info_for(std::weak_ptr<mir::scene::Surface> const& surface) const -> WindowInfo& |
2634 | 343 | { | 358 | try { |
2635 | 344 | log_input(); | 359 | log_input(); |
2636 | 345 | auto& result = wrapped.info_for(surface); | 360 | auto& result = wrapped.info_for(surface); |
2637 | 346 | mir::log_info("%s -> %s", __func__, result.name().c_str()); | 361 | mir::log_info("%s -> %s", __func__, result.name().c_str()); |
2638 | 347 | trace_count++; | 362 | trace_count++; |
2639 | 348 | return result; | 363 | return result; |
2640 | 349 | } | 364 | } |
2641 | 365 | MIRAL_TRACE_EXCEPTION | ||
2642 | 350 | 366 | ||
2643 | 351 | auto miral::WindowManagementTrace::info_for(Window const& window) const -> WindowInfo& | 367 | auto miral::WindowManagementTrace::info_for(Window const& window) const -> WindowInfo& |
2645 | 352 | { | 368 | try { |
2646 | 353 | log_input(); | 369 | log_input(); |
2647 | 354 | auto& result = wrapped.info_for(window); | 370 | auto& result = wrapped.info_for(window); |
2648 | 355 | mir::log_info("%s -> %s", __func__, result.name().c_str()); | 371 | mir::log_info("%s -> %s", __func__, result.name().c_str()); |
2649 | 356 | trace_count++; | 372 | trace_count++; |
2650 | 357 | return result; | 373 | return result; |
2651 | 358 | } | 374 | } |
2652 | 375 | MIRAL_TRACE_EXCEPTION | ||
2653 | 359 | 376 | ||
2654 | 360 | void miral::WindowManagementTrace::ask_client_to_close(miral::Window const& window) | 377 | void miral::WindowManagementTrace::ask_client_to_close(miral::Window const& window) |
2656 | 361 | { | 378 | try { |
2657 | 362 | log_input(); | 379 | log_input(); |
2658 | 363 | mir::log_info("%s -> %s", __func__, dump_of(window).c_str()); | 380 | mir::log_info("%s -> %s", __func__, dump_of(window).c_str()); |
2659 | 364 | trace_count++; | 381 | trace_count++; |
2660 | 365 | wrapped.ask_client_to_close(window); | 382 | wrapped.ask_client_to_close(window); |
2661 | 366 | } | 383 | } |
2662 | 384 | MIRAL_TRACE_EXCEPTION | ||
2663 | 367 | 385 | ||
2664 | 368 | void miral::WindowManagementTrace::force_close(miral::Window const& window) | 386 | void miral::WindowManagementTrace::force_close(miral::Window const& window) |
2666 | 369 | { | 387 | try { |
2667 | 370 | log_input(); | 388 | log_input(); |
2668 | 371 | mir::log_info("%s -> %s", __func__, dump_of(window).c_str()); | 389 | mir::log_info("%s -> %s", __func__, dump_of(window).c_str()); |
2669 | 372 | trace_count++; | 390 | trace_count++; |
2670 | 373 | wrapped.force_close(window); | 391 | wrapped.force_close(window); |
2671 | 374 | } | 392 | } |
2672 | 393 | MIRAL_TRACE_EXCEPTION | ||
2673 | 375 | 394 | ||
2674 | 376 | auto miral::WindowManagementTrace::active_window() const -> Window | 395 | auto miral::WindowManagementTrace::active_window() const -> Window |
2676 | 377 | { | 396 | try { |
2677 | 378 | log_input(); | 397 | log_input(); |
2678 | 379 | auto result = wrapped.active_window(); | 398 | auto result = wrapped.active_window(); |
2679 | 380 | mir::log_info("%s -> %s", __func__, dump_of(result).c_str()); | 399 | mir::log_info("%s -> %s", __func__, dump_of(result).c_str()); |
2680 | 381 | trace_count++; | 400 | trace_count++; |
2681 | 382 | return result; | 401 | return result; |
2682 | 383 | } | 402 | } |
2683 | 403 | MIRAL_TRACE_EXCEPTION | ||
2684 | 384 | 404 | ||
2685 | 385 | auto miral::WindowManagementTrace::select_active_window(Window const& hint) -> Window | 405 | auto miral::WindowManagementTrace::select_active_window(Window const& hint) -> Window |
2687 | 386 | { | 406 | try { |
2688 | 387 | log_input(); | 407 | log_input(); |
2689 | 388 | auto result = wrapped.select_active_window(hint); | 408 | auto result = wrapped.select_active_window(hint); |
2690 | 389 | mir::log_info("%s hint=%s -> %s", __func__, dump_of(hint).c_str(), dump_of(result).c_str()); | 409 | mir::log_info("%s hint=%s -> %s", __func__, dump_of(hint).c_str(), dump_of(result).c_str()); |
2691 | 390 | trace_count++; | 410 | trace_count++; |
2692 | 391 | return result; | 411 | return result; |
2693 | 392 | } | 412 | } |
2694 | 413 | MIRAL_TRACE_EXCEPTION | ||
2695 | 393 | 414 | ||
2696 | 394 | auto miral::WindowManagementTrace::window_at(mir::geometry::Point cursor) const -> Window | 415 | auto miral::WindowManagementTrace::window_at(mir::geometry::Point cursor) const -> Window |
2698 | 395 | { | 416 | try { |
2699 | 396 | log_input(); | 417 | log_input(); |
2700 | 397 | auto result = wrapped.window_at(cursor); | 418 | auto result = wrapped.window_at(cursor); |
2701 | 398 | std::stringstream out; | 419 | std::stringstream out; |
2702 | @@ -401,9 +422,10 @@ | |||
2703 | 401 | trace_count++; | 422 | trace_count++; |
2704 | 402 | return result; | 423 | return result; |
2705 | 403 | } | 424 | } |
2706 | 425 | MIRAL_TRACE_EXCEPTION | ||
2707 | 404 | 426 | ||
2708 | 405 | auto miral::WindowManagementTrace::active_display() -> mir::geometry::Rectangle const | 427 | auto miral::WindowManagementTrace::active_display() -> mir::geometry::Rectangle const |
2710 | 406 | { | 428 | try { |
2711 | 407 | log_input(); | 429 | log_input(); |
2712 | 408 | auto result = wrapped.active_display(); | 430 | auto result = wrapped.active_display(); |
2713 | 409 | std::stringstream out; | 431 | std::stringstream out; |
2714 | @@ -412,35 +434,39 @@ | |||
2715 | 412 | trace_count++; | 434 | trace_count++; |
2716 | 413 | return result; | 435 | return result; |
2717 | 414 | } | 436 | } |
2718 | 437 | MIRAL_TRACE_EXCEPTION | ||
2719 | 415 | 438 | ||
2720 | 416 | auto miral::WindowManagementTrace::info_for_window_id(std::string const& id) const -> WindowInfo& | 439 | auto miral::WindowManagementTrace::info_for_window_id(std::string const& id) const -> WindowInfo& |
2722 | 417 | { | 440 | try { |
2723 | 418 | log_input(); | 441 | log_input(); |
2724 | 419 | auto& result = wrapped.info_for_window_id(id); | 442 | auto& result = wrapped.info_for_window_id(id); |
2725 | 420 | mir::log_info("%s id=%s -> %s", __func__, id.c_str(), dump_of(result).c_str()); | 443 | mir::log_info("%s id=%s -> %s", __func__, id.c_str(), dump_of(result).c_str()); |
2726 | 421 | trace_count++; | 444 | trace_count++; |
2727 | 422 | return result; | 445 | return result; |
2728 | 423 | } | 446 | } |
2729 | 447 | MIRAL_TRACE_EXCEPTION | ||
2730 | 424 | 448 | ||
2731 | 425 | auto miral::WindowManagementTrace::id_for_window(Window const& window) const -> std::string | 449 | auto miral::WindowManagementTrace::id_for_window(Window const& window) const -> std::string |
2733 | 426 | { | 450 | try { |
2734 | 427 | log_input(); | 451 | log_input(); |
2735 | 428 | auto result = wrapped.id_for_window(window); | 452 | auto result = wrapped.id_for_window(window); |
2736 | 429 | mir::log_info("%s window=%s -> %s", __func__, dump_of(window).c_str(), result.c_str()); | 453 | mir::log_info("%s window=%s -> %s", __func__, dump_of(window).c_str(), result.c_str()); |
2737 | 430 | trace_count++; | 454 | trace_count++; |
2738 | 431 | return result; | 455 | return result; |
2739 | 432 | } | 456 | } |
2740 | 457 | MIRAL_TRACE_EXCEPTION | ||
2741 | 433 | 458 | ||
2742 | 434 | void miral::WindowManagementTrace::place_and_size_for_state( | 459 | void miral::WindowManagementTrace::place_and_size_for_state( |
2743 | 435 | WindowSpecification& modifications, WindowInfo const& window_info) const | 460 | WindowSpecification& modifications, WindowInfo const& window_info) const |
2745 | 436 | { | 461 | try { |
2746 | 437 | log_input(); | 462 | log_input(); |
2747 | 438 | mir::log_info("%s modifications=%s window_info=%s", __func__, dump_of(modifications).c_str(), dump_of(window_info).c_str()); | 463 | mir::log_info("%s modifications=%s window_info=%s", __func__, dump_of(modifications).c_str(), dump_of(window_info).c_str()); |
2748 | 439 | wrapped.place_and_size_for_state(modifications, window_info); | 464 | wrapped.place_and_size_for_state(modifications, window_info); |
2749 | 440 | } | 465 | } |
2750 | 466 | MIRAL_TRACE_EXCEPTION | ||
2751 | 441 | 467 | ||
2752 | 442 | void miral::WindowManagementTrace::drag_active_window(mir::geometry::Displacement movement) | 468 | void miral::WindowManagementTrace::drag_active_window(mir::geometry::Displacement movement) |
2754 | 443 | { | 469 | try { |
2755 | 444 | log_input(); | 470 | log_input(); |
2756 | 445 | std::stringstream out; | 471 | std::stringstream out; |
2757 | 446 | out << movement; | 472 | out << movement; |
2758 | @@ -448,79 +474,89 @@ | |||
2759 | 448 | trace_count++; | 474 | trace_count++; |
2760 | 449 | wrapped.drag_active_window(movement); | 475 | wrapped.drag_active_window(movement); |
2761 | 450 | } | 476 | } |
2762 | 477 | MIRAL_TRACE_EXCEPTION | ||
2763 | 451 | 478 | ||
2764 | 452 | void miral::WindowManagementTrace::focus_next_application() | 479 | void miral::WindowManagementTrace::focus_next_application() |
2766 | 453 | { | 480 | try { |
2767 | 454 | log_input(); | 481 | log_input(); |
2768 | 455 | mir::log_info("%s", __func__); | 482 | mir::log_info("%s", __func__); |
2769 | 456 | trace_count++; | 483 | trace_count++; |
2770 | 457 | wrapped.focus_next_application(); | 484 | wrapped.focus_next_application(); |
2771 | 458 | } | 485 | } |
2772 | 486 | MIRAL_TRACE_EXCEPTION | ||
2773 | 459 | 487 | ||
2774 | 460 | void miral::WindowManagementTrace::focus_next_within_application() | 488 | void miral::WindowManagementTrace::focus_next_within_application() |
2776 | 461 | { | 489 | try { |
2777 | 462 | log_input(); | 490 | log_input(); |
2778 | 463 | mir::log_info("%s", __func__); | 491 | mir::log_info("%s", __func__); |
2779 | 464 | trace_count++; | 492 | trace_count++; |
2780 | 465 | wrapped.focus_next_within_application(); | 493 | wrapped.focus_next_within_application(); |
2781 | 466 | } | 494 | } |
2782 | 495 | MIRAL_TRACE_EXCEPTION | ||
2783 | 467 | 496 | ||
2784 | 468 | void miral::WindowManagementTrace::raise_tree(miral::Window const& root) | 497 | void miral::WindowManagementTrace::raise_tree(miral::Window const& root) |
2786 | 469 | { | 498 | try { |
2787 | 470 | log_input(); | 499 | log_input(); |
2788 | 471 | mir::log_info("%s root=%s", __func__, dump_of(root).c_str()); | 500 | mir::log_info("%s root=%s", __func__, dump_of(root).c_str()); |
2789 | 472 | trace_count++; | 501 | trace_count++; |
2790 | 473 | wrapped.raise_tree(root); | 502 | wrapped.raise_tree(root); |
2791 | 474 | } | 503 | } |
2792 | 504 | MIRAL_TRACE_EXCEPTION | ||
2793 | 475 | 505 | ||
2794 | 476 | void miral::WindowManagementTrace::modify_window( | 506 | void miral::WindowManagementTrace::modify_window( |
2795 | 477 | miral::WindowInfo& window_info, miral::WindowSpecification const& modifications) | 507 | miral::WindowInfo& window_info, miral::WindowSpecification const& modifications) |
2797 | 478 | { | 508 | try { |
2798 | 479 | log_input(); | 509 | log_input(); |
2799 | 480 | mir::log_info("%s window_info=%s, modifications=%s", | 510 | mir::log_info("%s window_info=%s, modifications=%s", |
2800 | 481 | __func__, dump_of(window_info).c_str(), dump_of(modifications).c_str()); | 511 | __func__, dump_of(window_info).c_str(), dump_of(modifications).c_str()); |
2801 | 482 | trace_count++; | 512 | trace_count++; |
2802 | 483 | wrapped.modify_window(window_info, modifications); | 513 | wrapped.modify_window(window_info, modifications); |
2803 | 484 | } | 514 | } |
2804 | 515 | MIRAL_TRACE_EXCEPTION | ||
2805 | 485 | 516 | ||
2806 | 486 | void miral::WindowManagementTrace::invoke_under_lock(std::function<void()> const& callback) | 517 | void miral::WindowManagementTrace::invoke_under_lock(std::function<void()> const& callback) |
2808 | 487 | { | 518 | try { |
2809 | 488 | mir::log_info("%s", __func__); | 519 | mir::log_info("%s", __func__); |
2810 | 489 | wrapped.invoke_under_lock(callback); | 520 | wrapped.invoke_under_lock(callback); |
2811 | 490 | } | 521 | } |
2812 | 522 | MIRAL_TRACE_EXCEPTION | ||
2813 | 491 | 523 | ||
2815 | 492 | auto miral::WindowManagementTrace::place_new_surface( | 524 | auto miral::WindowManagementTrace::place_new_window( |
2816 | 493 | ApplicationInfo const& app_info, | 525 | ApplicationInfo const& app_info, |
2817 | 494 | WindowSpecification const& requested_specification) -> WindowSpecification | 526 | WindowSpecification const& requested_specification) -> WindowSpecification |
2820 | 495 | { | 527 | try { |
2821 | 496 | auto const result = policy->place_new_surface(app_info, requested_specification); | 528 | auto const result = policy->place_new_window(app_info, requested_specification); |
2822 | 497 | mir::log_info("%s app_info=%s, requested_specification=%s -> %s", | 529 | mir::log_info("%s app_info=%s, requested_specification=%s -> %s", |
2823 | 498 | __func__, dump_of(app_info).c_str(), dump_of(requested_specification).c_str(), dump_of(result).c_str()); | 530 | __func__, dump_of(app_info).c_str(), dump_of(requested_specification).c_str(), dump_of(result).c_str()); |
2824 | 499 | return result; | 531 | return result; |
2825 | 500 | } | 532 | } |
2826 | 533 | MIRAL_TRACE_EXCEPTION | ||
2827 | 501 | 534 | ||
2828 | 502 | void miral::WindowManagementTrace::handle_window_ready(miral::WindowInfo& window_info) | 535 | void miral::WindowManagementTrace::handle_window_ready(miral::WindowInfo& window_info) |
2830 | 503 | { | 536 | try { |
2831 | 504 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); | 537 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); |
2832 | 505 | policy->handle_window_ready(window_info); | 538 | policy->handle_window_ready(window_info); |
2833 | 506 | } | 539 | } |
2834 | 540 | MIRAL_TRACE_EXCEPTION | ||
2835 | 507 | 541 | ||
2836 | 508 | void miral::WindowManagementTrace::handle_modify_window( | 542 | void miral::WindowManagementTrace::handle_modify_window( |
2837 | 509 | miral::WindowInfo& window_info, miral::WindowSpecification const& modifications) | 543 | miral::WindowInfo& window_info, miral::WindowSpecification const& modifications) |
2839 | 510 | { | 544 | try { |
2840 | 511 | mir::log_info("%s window_info=%s, modifications=%s", | 545 | mir::log_info("%s window_info=%s, modifications=%s", |
2841 | 512 | __func__, dump_of(window_info).c_str(), dump_of(modifications).c_str()); | 546 | __func__, dump_of(window_info).c_str(), dump_of(modifications).c_str()); |
2842 | 513 | policy->handle_modify_window(window_info, modifications); | 547 | policy->handle_modify_window(window_info, modifications); |
2843 | 514 | } | 548 | } |
2844 | 549 | MIRAL_TRACE_EXCEPTION | ||
2845 | 515 | 550 | ||
2846 | 516 | void miral::WindowManagementTrace::handle_raise_window(miral::WindowInfo& window_info) | 551 | void miral::WindowManagementTrace::handle_raise_window(miral::WindowInfo& window_info) |
2848 | 517 | { | 552 | try { |
2849 | 518 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); | 553 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); |
2850 | 519 | policy->handle_raise_window(window_info); | 554 | policy->handle_raise_window(window_info); |
2851 | 520 | } | 555 | } |
2852 | 556 | MIRAL_TRACE_EXCEPTION | ||
2853 | 521 | 557 | ||
2854 | 522 | bool miral::WindowManagementTrace::handle_keyboard_event(MirKeyboardEvent const* event) | 558 | bool miral::WindowManagementTrace::handle_keyboard_event(MirKeyboardEvent const* event) |
2856 | 523 | { | 559 | try { |
2857 | 524 | log_input = [event, this] | 560 | log_input = [event, this] |
2858 | 525 | { | 561 | { |
2859 | 526 | mir::log_info("handle_keyboard_event event=%s", dump_of(event).c_str()); | 562 | mir::log_info("handle_keyboard_event event=%s", dump_of(event).c_str()); |
2860 | @@ -529,9 +565,10 @@ | |||
2861 | 529 | 565 | ||
2862 | 530 | return policy->handle_keyboard_event(event); | 566 | return policy->handle_keyboard_event(event); |
2863 | 531 | } | 567 | } |
2864 | 568 | MIRAL_TRACE_EXCEPTION | ||
2865 | 532 | 569 | ||
2866 | 533 | bool miral::WindowManagementTrace::handle_touch_event(MirTouchEvent const* event) | 570 | bool miral::WindowManagementTrace::handle_touch_event(MirTouchEvent const* event) |
2868 | 534 | { | 571 | try { |
2869 | 535 | log_input = [event, this] | 572 | log_input = [event, this] |
2870 | 536 | { | 573 | { |
2871 | 537 | mir::log_info("handle_touch_event event=%s", dump_of(event).c_str()); | 574 | mir::log_info("handle_touch_event event=%s", dump_of(event).c_str()); |
2872 | @@ -540,9 +577,10 @@ | |||
2873 | 540 | 577 | ||
2874 | 541 | return policy->handle_touch_event(event); | 578 | return policy->handle_touch_event(event); |
2875 | 542 | } | 579 | } |
2876 | 580 | MIRAL_TRACE_EXCEPTION | ||
2877 | 543 | 581 | ||
2878 | 544 | bool miral::WindowManagementTrace::handle_pointer_event(MirPointerEvent const* event) | 582 | bool miral::WindowManagementTrace::handle_pointer_event(MirPointerEvent const* event) |
2880 | 545 | { | 583 | try { |
2881 | 546 | log_input = [event, this] | 584 | log_input = [event, this] |
2882 | 547 | { | 585 | { |
2883 | 548 | mir::log_info("handle_pointer_event event=%s", dump_of(event).c_str()); | 586 | mir::log_info("handle_pointer_event event=%s", dump_of(event).c_str()); |
2884 | @@ -551,87 +589,101 @@ | |||
2885 | 551 | 589 | ||
2886 | 552 | return policy->handle_pointer_event(event); | 590 | return policy->handle_pointer_event(event); |
2887 | 553 | } | 591 | } |
2888 | 592 | MIRAL_TRACE_EXCEPTION | ||
2889 | 554 | 593 | ||
2890 | 555 | auto miral::WindowManagementTrace::confirm_inherited_move(WindowInfo const& window_info, Displacement movement) | 594 | auto miral::WindowManagementTrace::confirm_inherited_move(WindowInfo const& window_info, Displacement movement) |
2891 | 556 | -> Rectangle | 595 | -> Rectangle |
2893 | 557 | { | 596 | try { |
2894 | 558 | std::stringstream out; | 597 | std::stringstream out; |
2895 | 559 | out << movement; | 598 | out << movement; |
2896 | 560 | mir::log_info("%s window_info=%s, movement=%s", __func__, dump_of(window_info).c_str(), out.str().c_str()); | 599 | mir::log_info("%s window_info=%s, movement=%s", __func__, dump_of(window_info).c_str(), out.str().c_str()); |
2897 | 561 | 600 | ||
2898 | 562 | return policy->confirm_inherited_move(window_info, movement); | 601 | return policy->confirm_inherited_move(window_info, movement); |
2899 | 563 | } | 602 | } |
2900 | 603 | MIRAL_TRACE_EXCEPTION | ||
2901 | 564 | 604 | ||
2902 | 565 | void miral::WindowManagementTrace::advise_begin() | 605 | void miral::WindowManagementTrace::advise_begin() |
2904 | 566 | { | 606 | try { |
2905 | 567 | log_input = []{}; | 607 | log_input = []{}; |
2906 | 568 | trace_count.store(0); | 608 | trace_count.store(0); |
2907 | 569 | policy->advise_begin(); | 609 | policy->advise_begin(); |
2908 | 570 | } | 610 | } |
2909 | 611 | MIRAL_TRACE_EXCEPTION | ||
2910 | 571 | 612 | ||
2911 | 572 | void miral::WindowManagementTrace::advise_end() | 613 | void miral::WindowManagementTrace::advise_end() |
2913 | 573 | { | 614 | try { |
2914 | 574 | if (trace_count.load() > 0) | 615 | if (trace_count.load() > 0) |
2915 | 575 | mir::log_info("===="); | 616 | mir::log_info("===="); |
2916 | 576 | policy->advise_end(); | 617 | policy->advise_end(); |
2917 | 577 | } | 618 | } |
2918 | 619 | MIRAL_TRACE_EXCEPTION | ||
2919 | 578 | 620 | ||
2920 | 579 | void miral::WindowManagementTrace::advise_new_app(miral::ApplicationInfo& application) | 621 | void miral::WindowManagementTrace::advise_new_app(miral::ApplicationInfo& application) |
2922 | 580 | { | 622 | try { |
2923 | 581 | mir::log_info("%s application=%s", __func__, dump_of(application).c_str()); | 623 | mir::log_info("%s application=%s", __func__, dump_of(application).c_str()); |
2924 | 582 | policy->advise_new_app(application); | 624 | policy->advise_new_app(application); |
2925 | 583 | } | 625 | } |
2926 | 626 | MIRAL_TRACE_EXCEPTION | ||
2927 | 584 | 627 | ||
2928 | 585 | void miral::WindowManagementTrace::advise_delete_app(miral::ApplicationInfo const& application) | 628 | void miral::WindowManagementTrace::advise_delete_app(miral::ApplicationInfo const& application) |
2930 | 586 | { | 629 | try { |
2931 | 587 | mir::log_info("%s application=%s", __func__, dump_of(application).c_str()); | 630 | mir::log_info("%s application=%s", __func__, dump_of(application).c_str()); |
2932 | 588 | policy->advise_delete_app(application); | 631 | policy->advise_delete_app(application); |
2933 | 589 | } | 632 | } |
2934 | 633 | MIRAL_TRACE_EXCEPTION | ||
2935 | 590 | 634 | ||
2936 | 591 | void miral::WindowManagementTrace::advise_new_window(miral::WindowInfo const& window_info) | 635 | void miral::WindowManagementTrace::advise_new_window(miral::WindowInfo const& window_info) |
2938 | 592 | { | 636 | try { |
2939 | 593 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); | 637 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); |
2940 | 594 | policy->advise_new_window(window_info); | 638 | policy->advise_new_window(window_info); |
2941 | 595 | } | 639 | } |
2942 | 640 | MIRAL_TRACE_EXCEPTION | ||
2943 | 596 | 641 | ||
2944 | 597 | void miral::WindowManagementTrace::advise_focus_lost(miral::WindowInfo const& window_info) | 642 | void miral::WindowManagementTrace::advise_focus_lost(miral::WindowInfo const& window_info) |
2946 | 598 | { | 643 | try { |
2947 | 599 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); | 644 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); |
2948 | 600 | policy->advise_focus_lost(window_info); | 645 | policy->advise_focus_lost(window_info); |
2949 | 601 | } | 646 | } |
2950 | 647 | MIRAL_TRACE_EXCEPTION | ||
2951 | 602 | 648 | ||
2952 | 603 | void miral::WindowManagementTrace::advise_focus_gained(miral::WindowInfo const& window_info) | 649 | void miral::WindowManagementTrace::advise_focus_gained(miral::WindowInfo const& window_info) |
2954 | 604 | { | 650 | try { |
2955 | 605 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); | 651 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); |
2956 | 606 | policy->advise_focus_gained(window_info); | 652 | policy->advise_focus_gained(window_info); |
2957 | 607 | } | 653 | } |
2958 | 654 | MIRAL_TRACE_EXCEPTION | ||
2959 | 608 | 655 | ||
2962 | 609 | void miral::WindowManagementTrace::advise_state_change(miral::WindowInfo const& window_info, MirSurfaceState state) | 656 | void miral::WindowManagementTrace::advise_state_change(miral::WindowInfo const& window_info, MirWindowState state) |
2963 | 610 | { | 657 | try { |
2964 | 611 | mir::log_info("%s window_info=%s, state=%s", __func__, dump_of(window_info).c_str(), dump_of(state).c_str()); | 658 | mir::log_info("%s window_info=%s, state=%s", __func__, dump_of(window_info).c_str(), dump_of(state).c_str()); |
2965 | 612 | policy->advise_state_change(window_info, state); | 659 | policy->advise_state_change(window_info, state); |
2966 | 613 | } | 660 | } |
2967 | 661 | MIRAL_TRACE_EXCEPTION | ||
2968 | 614 | 662 | ||
2969 | 615 | void miral::WindowManagementTrace::advise_move_to(miral::WindowInfo const& window_info, mir::geometry::Point top_left) | 663 | void miral::WindowManagementTrace::advise_move_to(miral::WindowInfo const& window_info, mir::geometry::Point top_left) |
2971 | 616 | { | 664 | try { |
2972 | 617 | mir::log_info("%s window_info=%s, top_left=%s", __func__, dump_of(window_info).c_str(), dump_of(top_left).c_str()); | 665 | mir::log_info("%s window_info=%s, top_left=%s", __func__, dump_of(window_info).c_str(), dump_of(top_left).c_str()); |
2973 | 618 | policy->advise_move_to(window_info, top_left); | 666 | policy->advise_move_to(window_info, top_left); |
2974 | 619 | } | 667 | } |
2975 | 668 | MIRAL_TRACE_EXCEPTION | ||
2976 | 620 | 669 | ||
2977 | 621 | void miral::WindowManagementTrace::advise_resize(miral::WindowInfo const& window_info, mir::geometry::Size const& new_size) | 670 | void miral::WindowManagementTrace::advise_resize(miral::WindowInfo const& window_info, mir::geometry::Size const& new_size) |
2979 | 622 | { | 671 | try { |
2980 | 623 | mir::log_info("%s window_info=%s, new_size=%s", __func__, dump_of(window_info).c_str(), dump_of(new_size).c_str()); | 672 | mir::log_info("%s window_info=%s, new_size=%s", __func__, dump_of(window_info).c_str(), dump_of(new_size).c_str()); |
2981 | 624 | policy->advise_resize(window_info, new_size); | 673 | policy->advise_resize(window_info, new_size); |
2982 | 625 | } | 674 | } |
2983 | 675 | MIRAL_TRACE_EXCEPTION | ||
2984 | 626 | 676 | ||
2985 | 627 | void miral::WindowManagementTrace::advise_delete_window(miral::WindowInfo const& window_info) | 677 | void miral::WindowManagementTrace::advise_delete_window(miral::WindowInfo const& window_info) |
2987 | 628 | { | 678 | try { |
2988 | 629 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); | 679 | mir::log_info("%s window_info=%s", __func__, dump_of(window_info).c_str()); |
2989 | 630 | policy->advise_delete_window(window_info); | 680 | policy->advise_delete_window(window_info); |
2990 | 631 | } | 681 | } |
2991 | 682 | MIRAL_TRACE_EXCEPTION | ||
2992 | 632 | 683 | ||
2993 | 633 | void miral::WindowManagementTrace::advise_raise(std::vector<miral::Window> const& windows) | 684 | void miral::WindowManagementTrace::advise_raise(std::vector<miral::Window> const& windows) |
2995 | 634 | { | 685 | try { |
2996 | 635 | mir::log_info("%s window_info=%s", __func__, dump_of(windows).c_str()); | 686 | mir::log_info("%s window_info=%s", __func__, dump_of(windows).c_str()); |
2997 | 636 | policy->advise_raise(windows); | 687 | policy->advise_raise(windows); |
2998 | 637 | } | 688 | } |
2999 | 689 | MIRAL_TRACE_EXCEPTION | ||
3000 | 638 | 690 | ||
3001 | === modified file 'miral/window_management_trace.h' | |||
3002 | --- miral/window_management_trace.h 2016-12-05 09:46:35 +0000 | |||
3003 | +++ miral/window_management_trace.h 2017-01-26 16:46:42 +0000 | |||
3004 | @@ -71,7 +71,7 @@ | |||
3005 | 71 | 71 | ||
3006 | 72 | virtual void invoke_under_lock(std::function<void()> const& callback) override; | 72 | virtual void invoke_under_lock(std::function<void()> const& callback) override; |
3007 | 73 | 73 | ||
3009 | 74 | virtual auto place_new_surface( | 74 | virtual auto place_new_window( |
3010 | 75 | ApplicationInfo const& app_info, | 75 | ApplicationInfo const& app_info, |
3011 | 76 | WindowSpecification const& requested_specification) -> WindowSpecification override; | 76 | WindowSpecification const& requested_specification) -> WindowSpecification override; |
3012 | 77 | virtual void handle_window_ready(WindowInfo& window_info) override; | 77 | virtual void handle_window_ready(WindowInfo& window_info) override; |
3013 | @@ -103,7 +103,7 @@ | |||
3014 | 103 | 103 | ||
3015 | 104 | virtual void advise_focus_gained(WindowInfo const& window_info) override; | 104 | virtual void advise_focus_gained(WindowInfo const& window_info) override; |
3016 | 105 | 105 | ||
3018 | 106 | virtual void advise_state_change(WindowInfo const& window_info, MirSurfaceState state) override; | 106 | virtual void advise_state_change(WindowInfo const& window_info, MirWindowState state) override; |
3019 | 107 | 107 | ||
3020 | 108 | virtual void advise_move_to(WindowInfo const& window_info, Point top_left) override; | 108 | virtual void advise_move_to(WindowInfo const& window_info, Point top_left) override; |
3021 | 109 | 109 | ||
3022 | 110 | 110 | ||
3023 | === modified file 'miral/window_specification.cpp' | |||
3024 | --- miral/window_specification.cpp 2016-10-25 15:07:46 +0000 | |||
3025 | +++ miral/window_specification.cpp 2017-01-26 16:46:42 +0000 | |||
3026 | @@ -37,8 +37,8 @@ | |||
3027 | 37 | mir::optional_value<BufferUsage> buffer_usage; | 37 | mir::optional_value<BufferUsage> buffer_usage; |
3028 | 38 | mir::optional_value<std::string> name; | 38 | mir::optional_value<std::string> name; |
3029 | 39 | mir::optional_value<int> output_id; | 39 | mir::optional_value<int> output_id; |
3032 | 40 | mir::optional_value<MirSurfaceType> type; | 40 | mir::optional_value<MirWindowType> type; |
3033 | 41 | mir::optional_value<MirSurfaceState> state; | 41 | mir::optional_value<MirWindowState> state; |
3034 | 42 | mir::optional_value<MirOrientationMode> preferred_orientation; | 42 | mir::optional_value<MirOrientationMode> preferred_orientation; |
3035 | 43 | mir::optional_value<BufferStreamId> content_id; | 43 | mir::optional_value<BufferStreamId> content_id; |
3036 | 44 | mir::optional_value<Rectangle> aux_rect; | 44 | mir::optional_value<Rectangle> aux_rect; |
3037 | @@ -403,12 +403,12 @@ | |||
3038 | 403 | return self->output_id; | 403 | return self->output_id; |
3039 | 404 | } | 404 | } |
3040 | 405 | 405 | ||
3042 | 406 | auto miral::WindowSpecification::type() const -> mir::optional_value<MirSurfaceType> const& | 406 | auto miral::WindowSpecification::type() const -> mir::optional_value<MirWindowType> const& |
3043 | 407 | { | 407 | { |
3044 | 408 | return self->type; | 408 | return self->type; |
3045 | 409 | } | 409 | } |
3046 | 410 | 410 | ||
3048 | 411 | auto miral::WindowSpecification::state() const -> mir::optional_value<MirSurfaceState> const& | 411 | auto miral::WindowSpecification::state() const -> mir::optional_value<MirWindowState> const& |
3049 | 412 | { | 412 | { |
3050 | 413 | return self->state; | 413 | return self->state; |
3051 | 414 | } | 414 | } |
3052 | @@ -533,12 +533,12 @@ | |||
3053 | 533 | return self->output_id; | 533 | return self->output_id; |
3054 | 534 | } | 534 | } |
3055 | 535 | 535 | ||
3057 | 536 | auto miral::WindowSpecification::type() -> mir::optional_value<MirSurfaceType>& | 536 | auto miral::WindowSpecification::type() -> mir::optional_value<MirWindowType>& |
3058 | 537 | { | 537 | { |
3059 | 538 | return self->type; | 538 | return self->type; |
3060 | 539 | } | 539 | } |
3061 | 540 | 540 | ||
3063 | 541 | auto miral::WindowSpecification::state() -> mir::optional_value<MirSurfaceState>& | 541 | auto miral::WindowSpecification::state() -> mir::optional_value<MirWindowState>& |
3064 | 542 | { | 542 | { |
3065 | 543 | return self->state; | 543 | return self->state; |
3066 | 544 | } | 544 | } |
3067 | 545 | 545 | ||
3068 | === modified file 'scripts/process_doxygen_xml.py' | |||
3069 | --- scripts/process_doxygen_xml.py 2016-12-13 13:07:15 +0000 | |||
3070 | +++ scripts/process_doxygen_xml.py 2017-01-26 16:46:42 +0000 | |||
3071 | @@ -83,17 +83,360 @@ | |||
3072 | 83 | 83 | ||
3073 | 84 | OLD_STANZAS = '''MIRAL_1.0 { | 84 | OLD_STANZAS = '''MIRAL_1.0 { |
3074 | 85 | global: | 85 | global: |
3075 | 86 | extern "C++" { | ||
3076 | 87 | miral::ActiveOutputsListener::?ActiveOutputsListener*; | ||
3077 | 88 | miral::ActiveOutputsListener::ActiveOutputsListener*; | ||
3078 | 89 | miral::ActiveOutputsListener::advise_output_begin*; | ||
3079 | 90 | miral::ActiveOutputsListener::advise_output_create*; | ||
3080 | 91 | miral::ActiveOutputsListener::advise_output_delete*; | ||
3081 | 92 | miral::ActiveOutputsListener::advise_output_end*; | ||
3082 | 93 | miral::ActiveOutputsListener::advise_output_update*; | ||
3083 | 94 | miral::ActiveOutputsListener::operator*; | ||
3084 | 95 | miral::ActiveOutputsMonitor::?ActiveOutputsMonitor*; | ||
3085 | 96 | miral::ActiveOutputsMonitor::ActiveOutputsMonitor*; | ||
3086 | 97 | miral::ActiveOutputsMonitor::add_listener*; | ||
3087 | 98 | miral::ActiveOutputsMonitor::delete_listener*; | ||
3088 | 99 | miral::ActiveOutputsMonitor::operator*; | ||
3089 | 100 | miral::ActiveOutputsMonitor::process_outputs*; | ||
3090 | 101 | miral::AddInitCallback::?AddInitCallback*; | ||
3091 | 102 | miral::AddInitCallback::AddInitCallback*; | ||
3092 | 103 | miral::AddInitCallback::operator*; | ||
3093 | 104 | miral::AppendEventFilter::AppendEventFilter*; | ||
3094 | 105 | miral::AppendEventFilter::operator*; | ||
3095 | 106 | miral::ApplicationAuthorizer::?ApplicationAuthorizer*; | ||
3096 | 107 | miral::ApplicationAuthorizer::ApplicationAuthorizer*; | ||
3097 | 108 | miral::ApplicationAuthorizer::operator*; | ||
3098 | 109 | miral::ApplicationCredentials::ApplicationCredentials*; | ||
3099 | 110 | miral::ApplicationCredentials::gid*; | ||
3100 | 111 | miral::ApplicationCredentials::pid*; | ||
3101 | 112 | miral::ApplicationCredentials::uid*; | ||
3102 | 113 | miral::ApplicationInfo::?ApplicationInfo*; | ||
3103 | 114 | miral::ApplicationInfo::ApplicationInfo*; | ||
3104 | 115 | miral::ApplicationInfo::add_window*; | ||
3105 | 116 | miral::ApplicationInfo::application*; | ||
3106 | 117 | miral::ApplicationInfo::name*; | ||
3107 | 118 | miral::ApplicationInfo::operator*; | ||
3108 | 119 | miral::ApplicationInfo::remove_window*; | ||
3109 | 120 | miral::ApplicationInfo::userdata*; | ||
3110 | 121 | miral::ApplicationInfo::windows*; | ||
3111 | 122 | miral::BasicSetApplicationAuthorizer::?BasicSetApplicationAuthorizer*; | ||
3112 | 123 | miral::BasicSetApplicationAuthorizer::BasicSetApplicationAuthorizer*; | ||
3113 | 124 | miral::BasicSetApplicationAuthorizer::operator*; | ||
3114 | 125 | miral::BasicSetApplicationAuthorizer::the_application_authorizer*; | ||
3115 | 126 | miral::CanonicalWindowManagerPolicy::CanonicalWindowManagerPolicy*; | ||
3116 | 127 | miral::CanonicalWindowManagerPolicy::advise_focus_gained*; | ||
3117 | 128 | miral::CanonicalWindowManagerPolicy::confirm_inherited_move*; | ||
3118 | 129 | miral::CanonicalWindowManagerPolicy::handle_modify_window*; | ||
3119 | 130 | miral::CanonicalWindowManagerPolicy::handle_raise_window*; | ||
3120 | 131 | miral::CanonicalWindowManagerPolicy::handle_window_ready*; | ||
3121 | 132 | miral::CanonicalWindowManagerPolicy::place_new_surface*; | ||
3122 | 133 | miral::CommandLineOption::?CommandLineOption*; | ||
3123 | 134 | miral::CommandLineOption::CommandLineOption*; | ||
3124 | 135 | miral::CommandLineOption::operator*; | ||
3125 | 136 | miral::CursorTheme::?CursorTheme*; | ||
3126 | 137 | miral::CursorTheme::CursorTheme*; | ||
3127 | 138 | miral::CursorTheme::operator*; | ||
3128 | 139 | miral::DebugExtension::DebugExtension*; | ||
3129 | 140 | miral::DebugExtension::disable*; | ||
3130 | 141 | miral::DebugExtension::enable*; | ||
3131 | 142 | miral::DebugExtension::operator*; | ||
3132 | 143 | miral::InternalClientLauncher::?InternalClientLauncher*; | ||
3133 | 144 | miral::InternalClientLauncher::InternalClientLauncher*; | ||
3134 | 145 | miral::InternalClientLauncher::launch*; | ||
3135 | 146 | miral::InternalClientLauncher::operator*; | ||
3136 | 147 | miral::Keymap::?Keymap*; | ||
3137 | 148 | miral::Keymap::Keymap*; | ||
3138 | 149 | miral::Keymap::operator*; | ||
3139 | 150 | miral::Keymap::set_keymap*; | ||
3140 | 151 | miral::MirRunner::?MirRunner*; | ||
3141 | 152 | miral::MirRunner::MirRunner*; | ||
3142 | 153 | miral::MirRunner::add_start_callback*; | ||
3143 | 154 | miral::MirRunner::add_stop_callback*; | ||
3144 | 155 | miral::MirRunner::run_with*; | ||
3145 | 156 | miral::MirRunner::set_exception_handler*; | ||
3146 | 157 | miral::MirRunner::stop*; | ||
3147 | 158 | miral::Output::?Output*; | ||
3148 | 159 | miral::Output::Output*; | ||
3149 | 160 | miral::Output::connected*; | ||
3150 | 161 | miral::Output::extents*; | ||
3151 | 162 | miral::Output::form_factor*; | ||
3152 | 163 | miral::Output::is_same_output*; | ||
3153 | 164 | miral::Output::operator*; | ||
3154 | 165 | miral::Output::orientation*; | ||
3155 | 166 | miral::Output::physical_size_mm*; | ||
3156 | 167 | miral::Output::pixel_format*; | ||
3157 | 168 | miral::Output::power_mode*; | ||
3158 | 169 | miral::Output::refresh_rate*; | ||
3159 | 170 | miral::Output::scale*; | ||
3160 | 171 | miral::Output::type*; | ||
3161 | 172 | miral::Output::used*; | ||
3162 | 173 | miral::Output::valid*; | ||
3163 | 174 | miral::SetCommandLineHandler::?SetCommandLineHandler*; | ||
3164 | 175 | miral::SetCommandLineHandler::SetCommandLineHandler*; | ||
3165 | 176 | miral::SetCommandLineHandler::operator*; | ||
3166 | 177 | miral::SetTerminator::?SetTerminator*; | ||
3167 | 178 | miral::SetTerminator::SetTerminator*; | ||
3168 | 179 | miral::SetTerminator::operator*; | ||
3169 | 180 | miral::SetWindowManagmentPolicy::?SetWindowManagmentPolicy*; | ||
3170 | 181 | miral::SetWindowManagmentPolicy::SetWindowManagmentPolicy*; | ||
3171 | 182 | miral::SetWindowManagmentPolicy::operator*; | ||
3172 | 183 | miral::StartupInternalClient::?StartupInternalClient*; | ||
3173 | 184 | miral::StartupInternalClient::StartupInternalClient*; | ||
3174 | 185 | miral::StartupInternalClient::operator*; | ||
3175 | 186 | miral::Window::?Window*; | ||
3176 | 187 | miral::Window::Window*; | ||
3177 | 188 | miral::Window::application*; | ||
3178 | 189 | miral::Window::move_to*; | ||
3179 | 190 | miral::Window::operator*; | ||
3180 | 191 | miral::Window::resize*; | ||
3181 | 192 | miral::Window::size*; | ||
3182 | 193 | miral::Window::top_left*; | ||
3183 | 194 | miral::WindowInfo::?WindowInfo*; | ||
3184 | 195 | miral::WindowInfo::WindowInfo*; | ||
3185 | 196 | miral::WindowInfo::add_child*; | ||
3186 | 197 | miral::WindowInfo::can_be_active*; | ||
3187 | 198 | miral::WindowInfo::children*; | ||
3188 | 199 | miral::WindowInfo::confine_pointer*; | ||
3189 | 200 | miral::WindowInfo::constrain_resize*; | ||
3190 | 201 | miral::WindowInfo::has_output_id*; | ||
3191 | 202 | miral::WindowInfo::height_inc*; | ||
3192 | 203 | miral::WindowInfo::is_visible*; | ||
3193 | 204 | miral::WindowInfo::max_aspect*; | ||
3194 | 205 | miral::WindowInfo::max_height*; | ||
3195 | 206 | miral::WindowInfo::max_width*; | ||
3196 | 207 | miral::WindowInfo::min_aspect*; | ||
3197 | 208 | miral::WindowInfo::min_height*; | ||
3198 | 209 | miral::WindowInfo::min_width*; | ||
3199 | 210 | miral::WindowInfo::must_have_parent*; | ||
3200 | 211 | miral::WindowInfo::must_not_have_parent*; | ||
3201 | 212 | miral::WindowInfo::name*; | ||
3202 | 213 | miral::WindowInfo::operator*; | ||
3203 | 214 | miral::WindowInfo::output_id*; | ||
3204 | 215 | miral::WindowInfo::parent*; | ||
3205 | 216 | miral::WindowInfo::preferred_orientation*; | ||
3206 | 217 | miral::WindowInfo::remove_child*; | ||
3207 | 218 | miral::WindowInfo::restore_rect*; | ||
3208 | 219 | miral::WindowInfo::userdata*; | ||
3209 | 220 | miral::WindowInfo::width_inc*; | ||
3210 | 221 | miral::WindowInfo::window*; | ||
3211 | 222 | miral::WindowManagementPolicy::?WindowManagementPolicy*; | ||
3212 | 223 | miral::WindowManagementPolicy::WindowManagementPolicy*; | ||
3213 | 224 | miral::WindowManagementPolicy::advise_begin*; | ||
3214 | 225 | miral::WindowManagementPolicy::advise_delete_app*; | ||
3215 | 226 | miral::WindowManagementPolicy::advise_delete_window*; | ||
3216 | 227 | miral::WindowManagementPolicy::advise_end*; | ||
3217 | 228 | miral::WindowManagementPolicy::advise_focus_gained*; | ||
3218 | 229 | miral::WindowManagementPolicy::advise_focus_lost*; | ||
3219 | 230 | miral::WindowManagementPolicy::advise_move_to*; | ||
3220 | 231 | miral::WindowManagementPolicy::advise_new_app*; | ||
3221 | 232 | miral::WindowManagementPolicy::advise_new_window*; | ||
3222 | 233 | miral::WindowManagementPolicy::advise_raise*; | ||
3223 | 234 | miral::WindowManagementPolicy::advise_resize*; | ||
3224 | 235 | miral::WindowManagementPolicy::operator*; | ||
3225 | 236 | miral::WindowManagerOptions::WindowManagerOptions*; | ||
3226 | 237 | miral::WindowManagerOptions::operator*; | ||
3227 | 238 | miral::WindowManagerTools::?WindowManagerTools*; | ||
3228 | 239 | miral::WindowManagerTools::WindowManagerTools*; | ||
3229 | 240 | miral::WindowManagerTools::active_display*; | ||
3230 | 241 | miral::WindowManagerTools::active_window*; | ||
3231 | 242 | miral::WindowManagerTools::ask_client_to_close*; | ||
3232 | 243 | miral::WindowManagerTools::count_applications*; | ||
3233 | 244 | miral::WindowManagerTools::drag_active_window*; | ||
3234 | 245 | miral::WindowManagerTools::find_application*; | ||
3235 | 246 | miral::WindowManagerTools::focus_next_application*; | ||
3236 | 247 | miral::WindowManagerTools::focus_next_within_application*; | ||
3237 | 248 | miral::WindowManagerTools::for_each_application*; | ||
3238 | 249 | miral::WindowManagerTools::force_close*; | ||
3239 | 250 | miral::WindowManagerTools::id_for_window*; | ||
3240 | 251 | miral::WindowManagerTools::info_for*; | ||
3241 | 252 | miral::WindowManagerTools::info_for_window_id*; | ||
3242 | 253 | miral::WindowManagerTools::invoke_under_lock*; | ||
3243 | 254 | miral::WindowManagerTools::modify_window*; | ||
3244 | 255 | miral::WindowManagerTools::operator*; | ||
3245 | 256 | miral::WindowManagerTools::place_and_size_for_state*; | ||
3246 | 257 | miral::WindowManagerTools::raise_tree*; | ||
3247 | 258 | miral::WindowManagerTools::select_active_window*; | ||
3248 | 259 | miral::WindowManagerTools::window_at*; | ||
3249 | 260 | miral::WindowSpecification::?WindowSpecification*; | ||
3250 | 261 | miral::WindowSpecification::WindowSpecification*; | ||
3251 | 262 | miral::WindowSpecification::aux_rect*; | ||
3252 | 263 | miral::WindowSpecification::aux_rect_placement_gravity*; | ||
3253 | 264 | miral::WindowSpecification::aux_rect_placement_offset*; | ||
3254 | 265 | miral::WindowSpecification::confine_pointer*; | ||
3255 | 266 | miral::WindowSpecification::height_inc*; | ||
3256 | 267 | miral::WindowSpecification::input_mode*; | ||
3257 | 268 | miral::WindowSpecification::input_shape*; | ||
3258 | 269 | miral::WindowSpecification::max_aspect*; | ||
3259 | 270 | miral::WindowSpecification::max_height*; | ||
3260 | 271 | miral::WindowSpecification::max_width*; | ||
3261 | 272 | miral::WindowSpecification::min_aspect*; | ||
3262 | 273 | miral::WindowSpecification::min_height*; | ||
3263 | 274 | miral::WindowSpecification::min_width*; | ||
3264 | 275 | miral::WindowSpecification::name*; | ||
3265 | 276 | miral::WindowSpecification::operator*; | ||
3266 | 277 | miral::WindowSpecification::output_id*; | ||
3267 | 278 | miral::WindowSpecification::parent*; | ||
3268 | 279 | miral::WindowSpecification::placement_hints*; | ||
3269 | 280 | miral::WindowSpecification::preferred_orientation*; | ||
3270 | 281 | miral::WindowSpecification::shell_chrome*; | ||
3271 | 282 | miral::WindowSpecification::size*; | ||
3272 | 283 | miral::WindowSpecification::state*; | ||
3273 | 284 | miral::WindowSpecification::top_left*; | ||
3274 | 285 | miral::WindowSpecification::type*; | ||
3275 | 286 | miral::WindowSpecification::update*; | ||
3276 | 287 | miral::WindowSpecification::userdata*; | ||
3277 | 288 | miral::WindowSpecification::width_inc*; | ||
3278 | 289 | miral::WindowSpecification::window_placement_gravity*; | ||
3279 | 290 | miral::apply_lifecycle_state_to*; | ||
3280 | 291 | miral::display_configuration_options*; | ||
3281 | 292 | miral::equivalent_display_area*; | ||
3282 | 293 | miral::kill*; | ||
3283 | 294 | miral::name_of*; | ||
3284 | 295 | miral::operator*; | ||
3285 | 296 | miral::pid_of*; | ||
3286 | 297 | miral::toolkit::Connection::Connection*; | ||
3287 | 298 | miral::toolkit::Surface::Surface*; | ||
3288 | 299 | non-virtual?thunk?to?miral::ActiveOutputsListener::?ActiveOutputsListener*; | ||
3289 | 300 | non-virtual?thunk?to?miral::ActiveOutputsListener::advise_output_begin*; | ||
3290 | 301 | non-virtual?thunk?to?miral::ActiveOutputsListener::advise_output_create*; | ||
3291 | 302 | non-virtual?thunk?to?miral::ActiveOutputsListener::advise_output_delete*; | ||
3292 | 303 | non-virtual?thunk?to?miral::ActiveOutputsListener::advise_output_end*; | ||
3293 | 304 | non-virtual?thunk?to?miral::ActiveOutputsListener::advise_output_update*; | ||
3294 | 305 | non-virtual?thunk?to?miral::ApplicationAuthorizer::?ApplicationAuthorizer*; | ||
3295 | 306 | non-virtual?thunk?to?miral::CanonicalWindowManagerPolicy::advise_focus_gained*; | ||
3296 | 307 | non-virtual?thunk?to?miral::CanonicalWindowManagerPolicy::confirm_inherited_move*; | ||
3297 | 308 | non-virtual?thunk?to?miral::CanonicalWindowManagerPolicy::handle_modify_window*; | ||
3298 | 309 | non-virtual?thunk?to?miral::CanonicalWindowManagerPolicy::handle_raise_window*; | ||
3299 | 310 | non-virtual?thunk?to?miral::CanonicalWindowManagerPolicy::handle_window_ready*; | ||
3300 | 311 | non-virtual?thunk?to?miral::CanonicalWindowManagerPolicy::place_new_surface*; | ||
3301 | 312 | non-virtual?thunk?to?miral::WindowManagementPolicy::?WindowManagementPolicy*; | ||
3302 | 313 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_begin*; | ||
3303 | 314 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_delete_app*; | ||
3304 | 315 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_delete_window*; | ||
3305 | 316 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_end*; | ||
3306 | 317 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_focus_gained*; | ||
3307 | 318 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_focus_lost*; | ||
3308 | 319 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_move_to*; | ||
3309 | 320 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_new_app*; | ||
3310 | 321 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_new_window*; | ||
3311 | 322 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_raise*; | ||
3312 | 323 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_resize*; | ||
3313 | 324 | non-virtual?thunk?to?miral::WindowManagementPolicy::advise_state_change*; | ||
3314 | 325 | typeinfo?for?miral::ActiveOutputsListener; | ||
3315 | 326 | typeinfo?for?miral::ActiveOutputsMonitor; | ||
3316 | 327 | typeinfo?for?miral::AddInitCallback; | ||
3317 | 328 | typeinfo?for?miral::AppendEventFilter; | ||
3318 | 329 | typeinfo?for?miral::ApplicationAuthorizer; | ||
3319 | 330 | typeinfo?for?miral::ApplicationCredentials; | ||
3320 | 331 | typeinfo?for?miral::ApplicationInfo; | ||
3321 | 332 | typeinfo?for?miral::BasicSetApplicationAuthorizer; | ||
3322 | 333 | typeinfo?for?miral::CanonicalWindowManagerPolicy; | ||
3323 | 334 | typeinfo?for?miral::CommandLineOption; | ||
3324 | 335 | typeinfo?for?miral::CursorTheme; | ||
3325 | 336 | typeinfo?for?miral::DebugExtension; | ||
3326 | 337 | typeinfo?for?miral::InternalClientLauncher; | ||
3327 | 338 | typeinfo?for?miral::Keymap; | ||
3328 | 339 | typeinfo?for?miral::MirRunner; | ||
3329 | 340 | typeinfo?for?miral::Output; | ||
3330 | 341 | typeinfo?for?miral::Output::PhysicalSizeMM; | ||
3331 | 342 | typeinfo?for?miral::SetCommandLineHandler; | ||
3332 | 343 | typeinfo?for?miral::SetTerminator; | ||
3333 | 344 | typeinfo?for?miral::SetWindowManagmentPolicy; | ||
3334 | 345 | typeinfo?for?miral::StartupInternalClient; | ||
3335 | 346 | typeinfo?for?miral::Window; | ||
3336 | 347 | typeinfo?for?miral::WindowInfo; | ||
3337 | 348 | typeinfo?for?miral::WindowManagementPolicy; | ||
3338 | 349 | typeinfo?for?miral::WindowManagerOption; | ||
3339 | 350 | typeinfo?for?miral::WindowManagerOptions; | ||
3340 | 351 | typeinfo?for?miral::WindowManagerTools; | ||
3341 | 352 | typeinfo?for?miral::WindowSpecification; | ||
3342 | 353 | typeinfo?for?miral::WindowSpecification::AspectRatio; | ||
3343 | 354 | typeinfo?for?miral::toolkit::Connection; | ||
3344 | 355 | typeinfo?for?miral::toolkit::PersistentId; | ||
3345 | 356 | typeinfo?for?miral::toolkit::Surface; | ||
3346 | 357 | typeinfo?for?miral::toolkit::SurfaceSpec; | ||
3347 | 358 | vtable?for?miral::ActiveOutputsListener; | ||
3348 | 359 | vtable?for?miral::ActiveOutputsMonitor; | ||
3349 | 360 | vtable?for?miral::AddInitCallback; | ||
3350 | 361 | vtable?for?miral::AppendEventFilter; | ||
3351 | 362 | vtable?for?miral::ApplicationAuthorizer; | ||
3352 | 363 | vtable?for?miral::ApplicationCredentials; | ||
3353 | 364 | vtable?for?miral::ApplicationInfo; | ||
3354 | 365 | vtable?for?miral::BasicSetApplicationAuthorizer; | ||
3355 | 366 | vtable?for?miral::CanonicalWindowManagerPolicy; | ||
3356 | 367 | vtable?for?miral::CommandLineOption; | ||
3357 | 368 | vtable?for?miral::CursorTheme; | ||
3358 | 369 | vtable?for?miral::DebugExtension; | ||
3359 | 370 | vtable?for?miral::InternalClientLauncher; | ||
3360 | 371 | vtable?for?miral::Keymap; | ||
3361 | 372 | vtable?for?miral::MirRunner; | ||
3362 | 373 | vtable?for?miral::Output; | ||
3363 | 374 | vtable?for?miral::Output::PhysicalSizeMM; | ||
3364 | 375 | vtable?for?miral::SetCommandLineHandler; | ||
3365 | 376 | vtable?for?miral::SetTerminator; | ||
3366 | 377 | vtable?for?miral::SetWindowManagmentPolicy; | ||
3367 | 378 | vtable?for?miral::StartupInternalClient; | ||
3368 | 379 | vtable?for?miral::Window; | ||
3369 | 380 | vtable?for?miral::WindowInfo; | ||
3370 | 381 | vtable?for?miral::WindowManagementPolicy; | ||
3371 | 382 | vtable?for?miral::WindowManagerOption; | ||
3372 | 383 | vtable?for?miral::WindowManagerOptions; | ||
3373 | 384 | vtable?for?miral::WindowManagerTools; | ||
3374 | 385 | vtable?for?miral::WindowSpecification; | ||
3375 | 386 | vtable?for?miral::WindowSpecification::AspectRatio; | ||
3376 | 387 | vtable?for?miral::toolkit::Connection; | ||
3377 | 388 | vtable?for?miral::toolkit::PersistentId; | ||
3378 | 389 | vtable?for?miral::toolkit::Surface; | ||
3379 | 390 | vtable?for?miral::toolkit::SurfaceSpec; | ||
3380 | 391 | }; | ||
3381 | 392 | # miral::WindowInfo::can_morph_to*; | ||
3382 | 393 | _ZNK5miral10WindowInfo12can_morph_toE14MirSurfaceType; | ||
3383 | 394 | |||
3384 | 395 | # miral::WindowInfo::needs_titlebar*; | ||
3385 | 396 | _ZN5miral10WindowInfo14needs_titlebarE14MirSurfaceType; | ||
3386 | 397 | |||
3387 | 398 | # miral::WindowInfo::state*; | ||
3388 | 399 | _ZNK5miral10WindowInfo5stateEv; | ||
3389 | 400 | _ZN5miral10WindowInfo5stateE15MirSurfaceState; | ||
3390 | 401 | |||
3391 | 402 | # miral::WindowInfo::type*; | ||
3392 | 403 | _ZN5miral10WindowInfo4typeE14MirSurfaceType; | ||
3393 | 404 | _ZNK5miral10WindowInfo4typeEv; | ||
3394 | 405 | |||
3395 | 406 | # miral::WindowManagementPolicy::advise_state_change*; | ||
3396 | 407 | _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE15MirSurfaceState; | ||
3397 | 408 | local: *; | ||
3398 | 409 | }; | ||
3399 | 410 | |||
3400 | 411 | MIRAL_1.1 { | ||
3401 | 412 | global: | ||
3402 | 413 | # miral::WindowInfo::can_morph_to* | ||
3403 | 414 | _ZNK5miral10WindowInfo12can_morph_toE13MirWindowType; | ||
3404 | 415 | |||
3405 | 416 | #miral::WindowInfo::needs_titlebar*; | ||
3406 | 417 | _ZN5miral10WindowInfo14needs_titlebarE13MirWindowType; | ||
3407 | 418 | |||
3408 | 419 | # miral::WindowInfo::state*; | ||
3409 | 420 | _ZNK5miral10WindowInfo5stateEv; | ||
3410 | 421 | _ZN5miral10WindowInfo5stateE14MirWindowState; | ||
3411 | 422 | |||
3412 | 423 | miral::WindowInfo::type*; | ||
3413 | 424 | _ZN5miral10WindowInfo4typeE13MirWindowType; | ||
3414 | 425 | _ZNK5miral10WindowInfo4typeEv; | ||
3415 | 426 | |||
3416 | 427 | # miral::WindowManagementPolicy::advise_state_change*; | ||
3417 | 428 | _ZN5miral22WindowManagementPolicy19advise_state_changeERKNS_10WindowInfoE14MirWindowState; | ||
3418 | 429 | |||
3419 | 86 | extern "C++" {''' | 430 | extern "C++" {''' |
3420 | 87 | 431 | ||
3421 | 88 | END_NEW_STANZA = ''' }; | 432 | END_NEW_STANZA = ''' }; |
3424 | 89 | local: *; | 433 | } MIRAL_1.0;''' |
3423 | 90 | };''' | ||
3425 | 91 | 434 | ||
3426 | 92 | def _print_report(): | 435 | def _print_report(): |
3427 | 93 | print OLD_STANZAS | 436 | print OLD_STANZAS |
3428 | 94 | for symbol in sorted(SYMBOLS['public']): | 437 | for symbol in sorted(SYMBOLS['public']): |
3429 | 95 | formatted_symbol = ' {};'.format(symbol) | 438 | formatted_symbol = ' {};'.format(symbol) |
3431 | 96 | if formatted_symbol not in OLD_STANZAS: | 439 | if formatted_symbol not in OLD_STANZAS and 'miral::toolkit::' not in formatted_symbol: |
3432 | 97 | print formatted_symbol | 440 | print formatted_symbol |
3433 | 98 | print END_NEW_STANZA | 441 | print END_NEW_STANZA |
3434 | 99 | 442 | ||
3435 | 100 | 443 | ||
3436 | === modified file 'test/CMakeLists.txt' | |||
3437 | --- test/CMakeLists.txt 2016-11-29 10:33:42 +0000 | |||
3438 | +++ test/CMakeLists.txt 2017-01-26 16:46:42 +0000 | |||
3439 | @@ -1,11 +1,11 @@ | |||
3441 | 1 | if (MIRTEST_VERSION VERSION_LESS 0.25) | 1 | if (MIRTEST_VERSION VERSION_LESS 0.26) |
3442 | 2 | # Mir used mix struct and class in public test headers (fixed -r 3606 in lp:mir) | 2 | # Mir used mix struct and class in public test headers (fixed -r 3606 in lp:mir) |
3443 | 3 | check_cxx_compiler_flag(-Wno-mismatched-tags MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS) | 3 | check_cxx_compiler_flag(-Wno-mismatched-tags MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS) |
3444 | 4 | if (MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS) | 4 | if (MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS) |
3445 | 5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags") | 5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags") |
3446 | 6 | endif() | 6 | endif() |
3447 | 7 | 7 | ||
3449 | 8 | if (NOT MIRTEST_VERSION VERSION_LESS 0.24) | 8 | if (MIRTEST_VERSION VERSION_EQUAL 0.24) |
3450 | 9 | # Mir 0.24 shipped with inconsistent override use in mirtest/mir/test/doubles/stub_session.h (lp:1609612) | 9 | # Mir 0.24 shipped with inconsistent override use in mirtest/mir/test/doubles/stub_session.h (lp:1609612) |
3451 | 10 | check_cxx_compiler_flag(-Wno-inconsistent-missing-override MIRAL_COMPILE_WITH_W_NO_INCONSISTENT_MISSING_OVERRIDE) | 10 | check_cxx_compiler_flag(-Wno-inconsistent-missing-override MIRAL_COMPILE_WITH_W_NO_INCONSISTENT_MISSING_OVERRIDE) |
3452 | 11 | if (MIRAL_COMPILE_WITH_W_NO_INCONSISTENT_MISSING_OVERRIDE) | 11 | if (MIRAL_COMPILE_WITH_W_NO_INCONSISTENT_MISSING_OVERRIDE) |
3453 | @@ -13,11 +13,13 @@ | |||
3454 | 13 | endif() | 13 | endif() |
3455 | 14 | endif() | 14 | endif() |
3456 | 15 | 15 | ||
3462 | 16 | # Mir uses "C" linkage to avoid name-mangling some functions that are not | 16 | if (MIRTEST_VERSION VERSION_LESS 0.25) |
3463 | 17 | # intended not for C compatibility (lp:1615587) (fixed -r 3668 in lp:mir) | 17 | # Mir uses "C" linkage to avoid name-mangling some functions that are not |
3464 | 18 | check_cxx_compiler_flag(-Wno-return-type-c-linkage MIRAL_COMPILE_WITH_W_RETURN_TYPE_C_LINKAGE) | 18 | # intended not for C compatibility (lp:1615587) (fixed -r 3668 in lp:mir) |
3465 | 19 | if (MIRAL_COMPILE_WITH_W_RETURN_TYPE_C_LINKAGE) | 19 | check_cxx_compiler_flag(-Wno-return-type-c-linkage MIRAL_COMPILE_WITH_W_RETURN_TYPE_C_LINKAGE) |
3466 | 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage") | 20 | if (MIRAL_COMPILE_WITH_W_RETURN_TYPE_C_LINKAGE) |
3467 | 21 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage") | ||
3468 | 22 | endif() | ||
3469 | 21 | endif() | 23 | endif() |
3470 | 22 | endif() | 24 | endif() |
3471 | 23 | 25 | ||
3472 | @@ -52,6 +54,7 @@ | |||
3473 | 52 | test_window_manager_tools.h | 54 | test_window_manager_tools.h |
3474 | 53 | display_reconfiguration.cpp | 55 | display_reconfiguration.cpp |
3475 | 54 | active_window.cpp | 56 | active_window.cpp |
3476 | 57 | raise_tree.cpp | ||
3477 | 55 | ) | 58 | ) |
3478 | 56 | 59 | ||
3479 | 57 | target_link_libraries(miral-test | 60 | target_link_libraries(miral-test |
3480 | 58 | 61 | ||
3481 | === modified file 'test/active_window.cpp' | |||
3482 | --- test/active_window.cpp 2016-11-30 17:01:17 +0000 | |||
3483 | +++ test/active_window.cpp 2017-01-26 16:46:42 +0000 | |||
3484 | @@ -18,8 +18,8 @@ | |||
3485 | 18 | 18 | ||
3486 | 19 | #include "test_server.h" | 19 | #include "test_server.h" |
3487 | 20 | 20 | ||
3490 | 21 | #include <miral/toolkit/surface.h> | 21 | #include <miral/toolkit/window.h> |
3491 | 22 | #include <miral/toolkit/surface_spec.h> | 22 | #include <miral/toolkit/window_spec.h> |
3492 | 23 | #include <mir_toolkit/mir_buffer_stream.h> | 23 | #include <mir_toolkit/mir_buffer_stream.h> |
3493 | 24 | #include <mir_toolkit/version.h> | 24 | #include <mir_toolkit/version.h> |
3494 | 25 | 25 | ||
3495 | @@ -30,9 +30,9 @@ | |||
3496 | 30 | #include <gtest/gtest.h> | 30 | #include <gtest/gtest.h> |
3497 | 31 | 31 | ||
3498 | 32 | using namespace testing; | 32 | using namespace testing; |
3499 | 33 | using namespace miral; | ||
3500 | 34 | using namespace miral::toolkit; | 33 | using namespace miral::toolkit; |
3501 | 35 | using namespace std::chrono_literals; | 34 | using namespace std::chrono_literals; |
3502 | 35 | using miral::WindowManagerTools; | ||
3503 | 36 | 36 | ||
3504 | 37 | namespace | 37 | namespace |
3505 | 38 | { | 38 | { |
3506 | @@ -46,10 +46,15 @@ | |||
3507 | 46 | signal.wait_for(100ms); | 46 | signal.wait_for(100ms); |
3508 | 47 | } | 47 | } |
3509 | 48 | 48 | ||
3511 | 49 | static void raise_signal_on_focus_change(MirSurface* /*surface*/, MirEvent const* event, void* context) | 49 | static void raise_signal_on_focus_change(MirWindow* /*surface*/, MirEvent const* event, void* context) |
3512 | 50 | { | 50 | { |
3513 | 51 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | ||
3514 | 51 | if (mir_event_get_type(event) == mir_event_type_surface && | 52 | if (mir_event_get_type(event) == mir_event_type_surface && |
3515 | 52 | mir_surface_event_get_attribute(mir_event_get_surface_event(event)) == mir_surface_attrib_focus) | 53 | mir_surface_event_get_attribute(mir_event_get_surface_event(event)) == mir_surface_attrib_focus) |
3516 | 54 | #else | ||
3517 | 55 | if (mir_event_get_type(event) == mir_event_type_window && | ||
3518 | 56 | mir_window_event_get_attribute(mir_event_get_window_event(event)) == mir_window_attrib_focus) | ||
3519 | 57 | #endif | ||
3520 | 53 | { | 58 | { |
3521 | 54 | ((FocusChangeSync*)context)->signal.raise(); | 59 | ((FocusChangeSync*)context)->signal.raise(); |
3522 | 55 | } | 60 | } |
3523 | @@ -61,55 +66,67 @@ | |||
3524 | 61 | mir::test::Signal signal; | 66 | mir::test::Signal signal; |
3525 | 62 | }; | 67 | }; |
3526 | 63 | 68 | ||
3528 | 64 | struct ActiveWindow : public TestServer | 69 | struct ActiveWindow : public miral::TestServer |
3529 | 65 | { | 70 | { |
3530 | 66 | FocusChangeSync sync1; | 71 | FocusChangeSync sync1; |
3531 | 67 | FocusChangeSync sync2; | 72 | FocusChangeSync sync2; |
3532 | 68 | 73 | ||
3534 | 69 | auto create_surface(Connection const& connection, char const* name, FocusChangeSync& sync) -> Surface | 74 | auto create_surface(Connection const& connection, char const* name, FocusChangeSync& sync) -> Window |
3535 | 70 | { | 75 | { |
3537 | 71 | auto const spec = SurfaceSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) | 76 | auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
3538 | 72 | .set_buffer_usage(mir_buffer_usage_software) | 77 | .set_buffer_usage(mir_buffer_usage_software) |
3539 | 73 | .set_event_handler(&FocusChangeSync::raise_signal_on_focus_change, &sync) | 78 | .set_event_handler(&FocusChangeSync::raise_signal_on_focus_change, &sync) |
3540 | 74 | .set_name(name); | 79 | .set_name(name); |
3541 | 75 | 80 | ||
3543 | 76 | Surface const surface{spec.create_surface()}; | 81 | Window const surface{spec.create_surface()}; |
3544 | 77 | 82 | ||
3545 | 83 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
3546 | 78 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_surface_get_buffer_stream(surface)); }); | 84 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_surface_get_buffer_stream(surface)); }); |
3547 | 85 | #else | ||
3548 | 86 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(surface)); }); | ||
3549 | 87 | #endif | ||
3550 | 79 | EXPECT_TRUE(sync.signal_raised()); | 88 | EXPECT_TRUE(sync.signal_raised()); |
3551 | 80 | 89 | ||
3552 | 81 | return surface; | 90 | return surface; |
3553 | 82 | } | 91 | } |
3554 | 83 | 92 | ||
3555 | 84 | #if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0) | 93 | #if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0) |
3557 | 85 | auto create_tip(Connection const& connection, char const* name, Surface const& parent, FocusChangeSync& sync) -> Surface | 94 | auto create_tip(Connection const& connection, char const* name, Window const& parent, FocusChangeSync& sync) -> Window |
3558 | 86 | { | 95 | { |
3559 | 87 | MirRectangle aux_rect{10, 10, 10, 10}; | 96 | MirRectangle aux_rect{10, 10, 10, 10}; |
3561 | 88 | auto const spec = SurfaceSpec::for_tip(connection, 50, 50, mir_pixel_format_argb_8888, parent, &aux_rect, mir_edge_attachment_any) | 97 | auto const spec = WindowSpec::for_tip(connection, 50, 50, mir_pixel_format_argb_8888, parent, &aux_rect, mir_edge_attachment_any) |
3562 | 89 | .set_buffer_usage(mir_buffer_usage_software) | 98 | .set_buffer_usage(mir_buffer_usage_software) |
3563 | 90 | .set_event_handler(&FocusChangeSync::raise_signal_on_focus_change, &sync) | 99 | .set_event_handler(&FocusChangeSync::raise_signal_on_focus_change, &sync) |
3564 | 91 | .set_name(name); | 100 | .set_name(name); |
3565 | 92 | 101 | ||
3567 | 93 | Surface const surface{spec.create_surface()}; | 102 | Window const surface{spec.create_surface()}; |
3568 | 94 | 103 | ||
3569 | 95 | // Expect this to timeout: A tip should not receive focus | 104 | // Expect this to timeout: A tip should not receive focus |
3570 | 105 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
3571 | 96 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_surface_get_buffer_stream(surface)); }); | 106 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_surface_get_buffer_stream(surface)); }); |
3572 | 107 | #else | ||
3573 | 108 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(surface)); }); | ||
3574 | 109 | #endif | ||
3575 | 97 | EXPECT_FALSE(sync.signal_raised()); | 110 | EXPECT_FALSE(sync.signal_raised()); |
3576 | 98 | 111 | ||
3577 | 99 | return surface; | 112 | return surface; |
3578 | 100 | } | 113 | } |
3579 | 101 | #endif | 114 | #endif |
3580 | 102 | 115 | ||
3582 | 103 | auto create_dialog(Connection const& connection, char const* name, Surface const& parent, FocusChangeSync& sync) -> Surface | 116 | auto create_dialog(Connection const& connection, char const* name, Window const& parent, FocusChangeSync& sync) -> Window |
3583 | 104 | { | 117 | { |
3585 | 105 | auto const spec = SurfaceSpec::for_dialog(connection, 50, 50, mir_pixel_format_argb_8888, parent) | 118 | auto const spec = WindowSpec::for_dialog(connection, 50, 50, mir_pixel_format_argb_8888, parent) |
3586 | 106 | .set_buffer_usage(mir_buffer_usage_software) | 119 | .set_buffer_usage(mir_buffer_usage_software) |
3587 | 107 | .set_event_handler(&FocusChangeSync::raise_signal_on_focus_change, &sync) | 120 | .set_event_handler(&FocusChangeSync::raise_signal_on_focus_change, &sync) |
3588 | 108 | .set_name(name); | 121 | .set_name(name); |
3589 | 109 | 122 | ||
3591 | 110 | Surface const surface{spec.create_surface()}; | 123 | Window const surface{spec.create_surface()}; |
3592 | 111 | 124 | ||
3593 | 125 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
3594 | 112 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_surface_get_buffer_stream(surface)); }); | 126 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_surface_get_buffer_stream(surface)); }); |
3595 | 127 | #else | ||
3596 | 128 | sync.exec([&]{ mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(surface)); }); | ||
3597 | 129 | #endif | ||
3598 | 113 | EXPECT_TRUE(sync.signal_raised()); | 130 | EXPECT_TRUE(sync.signal_raised()); |
3599 | 114 | 131 | ||
3600 | 115 | return surface; | 132 | return surface; |
3601 | @@ -155,7 +172,11 @@ | |||
3602 | 155 | auto const connection = connect_client(test_name); | 172 | auto const connection = connect_client(test_name); |
3603 | 156 | auto const surface = create_surface(connection, test_name, sync1); | 173 | auto const surface = create_surface(connection, test_name, sync1); |
3604 | 157 | 174 | ||
3605 | 175 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
3606 | 158 | sync1.exec([&]{ mir_surface_set_state(surface, mir_surface_state_hidden); }); | 176 | sync1.exec([&]{ mir_surface_set_state(surface, mir_surface_state_hidden); }); |
3607 | 177 | #else | ||
3608 | 178 | sync1.exec([&]{ mir_window_set_state(surface, mir_window_state_hidden); }); | ||
3609 | 179 | #endif | ||
3610 | 159 | 180 | ||
3611 | 160 | EXPECT_TRUE(sync1.signal_raised()); | 181 | EXPECT_TRUE(sync1.signal_raised()); |
3612 | 161 | assert_no_active_window(); | 182 | assert_no_active_window(); |
3613 | @@ -166,9 +187,15 @@ | |||
3614 | 166 | char const* const test_name = __PRETTY_FUNCTION__; | 187 | char const* const test_name = __PRETTY_FUNCTION__; |
3615 | 167 | auto const connection = connect_client(test_name); | 188 | auto const connection = connect_client(test_name); |
3616 | 168 | auto const surface = create_surface(connection, test_name, sync1); | 189 | auto const surface = create_surface(connection, test_name, sync1); |
3617 | 190 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
3618 | 169 | sync1.exec([&]{ mir_surface_set_state(surface, mir_surface_state_hidden); }); | 191 | sync1.exec([&]{ mir_surface_set_state(surface, mir_surface_state_hidden); }); |
3619 | 170 | 192 | ||
3620 | 171 | sync1.exec([&]{ mir_surface_set_state(surface, mir_surface_state_restored); }); | 193 | sync1.exec([&]{ mir_surface_set_state(surface, mir_surface_state_restored); }); |
3621 | 194 | #else | ||
3622 | 195 | sync1.exec([&]{ mir_window_set_state(surface, mir_window_state_hidden); }); | ||
3623 | 196 | |||
3624 | 197 | sync1.exec([&]{ mir_window_set_state(surface, mir_window_state_restored); }); | ||
3625 | 198 | #endif | ||
3626 | 172 | EXPECT_TRUE(sync1.signal_raised()); | 199 | EXPECT_TRUE(sync1.signal_raised()); |
3627 | 173 | 200 | ||
3628 | 174 | assert_active_window_is(test_name); | 201 | assert_active_window_is(test_name); |
3629 | @@ -193,7 +220,11 @@ | |||
3630 | 193 | auto const first_surface = create_surface(connection, test_name, sync1); | 220 | auto const first_surface = create_surface(connection, test_name, sync1); |
3631 | 194 | auto const surface = create_surface(connection, another_name, sync2); | 221 | auto const surface = create_surface(connection, another_name, sync2); |
3632 | 195 | 222 | ||
3633 | 223 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
3634 | 196 | sync2.exec([&]{ mir_surface_set_state(surface, mir_surface_state_hidden); }); | 224 | sync2.exec([&]{ mir_surface_set_state(surface, mir_surface_state_hidden); }); |
3635 | 225 | #else | ||
3636 | 226 | sync2.exec([&]{ mir_window_set_state(surface, mir_window_state_hidden); }); | ||
3637 | 227 | #endif | ||
3638 | 197 | 228 | ||
3639 | 198 | EXPECT_TRUE(sync2.signal_raised()); | 229 | EXPECT_TRUE(sync2.signal_raised()); |
3640 | 199 | assert_active_window_is(test_name); | 230 | assert_active_window_is(test_name); |
3641 | @@ -207,11 +238,17 @@ | |||
3642 | 207 | auto const first_surface = create_surface(connection, test_name, sync1); | 238 | auto const first_surface = create_surface(connection, test_name, sync1); |
3643 | 208 | auto const surface = create_surface(connection, another_name, sync2); | 239 | auto const surface = create_surface(connection, another_name, sync2); |
3644 | 209 | 240 | ||
3645 | 241 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
3646 | 210 | sync1.exec([&]{ mir_surface_set_state(surface, mir_surface_state_hidden); }); | 242 | sync1.exec([&]{ mir_surface_set_state(surface, mir_surface_state_hidden); }); |
3647 | 211 | 243 | ||
3648 | 212 | // Expect this to timeout | 244 | // Expect this to timeout |
3649 | 213 | sync2.exec([&]{ mir_surface_set_state(surface, mir_surface_state_restored); }); | 245 | sync2.exec([&]{ mir_surface_set_state(surface, mir_surface_state_restored); }); |
3650 | 246 | #else | ||
3651 | 247 | sync1.exec([&]{ mir_window_set_state(surface, mir_window_state_hidden); }); | ||
3652 | 214 | 248 | ||
3653 | 249 | // Expect this to timeout | ||
3654 | 250 | sync2.exec([&]{ mir_window_set_state(surface, mir_window_state_restored); }); | ||
3655 | 251 | #endif | ||
3656 | 215 | EXPECT_THAT(sync2.signal_raised(), Eq(false)); | 252 | EXPECT_THAT(sync2.signal_raised(), Eq(false)); |
3657 | 216 | assert_active_window_is(test_name); | 253 | assert_active_window_is(test_name); |
3658 | 217 | } | 254 | } |
3659 | @@ -271,7 +308,7 @@ | |||
3660 | 271 | 308 | ||
3661 | 272 | auto const parent = create_surface(connection, test_name, sync1); | 309 | auto const parent = create_surface(connection, test_name, sync1); |
3662 | 273 | 310 | ||
3664 | 274 | Window parent_window; | 311 | miral::Window parent_window; |
3665 | 275 | invoke_tools([&](WindowManagerTools& tools){ parent_window = tools.active_window(); }); | 312 | invoke_tools([&](WindowManagerTools& tools){ parent_window = tools.active_window(); }); |
3666 | 276 | 313 | ||
3667 | 277 | // Steal the focus | 314 | // Steal the focus |
3668 | @@ -299,7 +336,7 @@ | |||
3669 | 299 | 336 | ||
3670 | 300 | auto const parent = create_surface(connection, test_name, sync1); | 337 | auto const parent = create_surface(connection, test_name, sync1); |
3671 | 301 | 338 | ||
3673 | 302 | Window parent_window; | 339 | miral::Window parent_window; |
3674 | 303 | invoke_tools([&](WindowManagerTools& tools){ parent_window = tools.active_window(); }); | 340 | invoke_tools([&](WindowManagerTools& tools){ parent_window = tools.active_window(); }); |
3675 | 304 | 341 | ||
3676 | 305 | auto const dialog = create_dialog(connection, dialog_name, parent, sync2); | 342 | auto const dialog = create_dialog(connection, dialog_name, parent, sync2); |
3677 | 306 | 343 | ||
3678 | === modified file 'test/display_reconfiguration.cpp' | |||
3679 | --- test/display_reconfiguration.cpp 2016-11-10 17:25:38 +0000 | |||
3680 | +++ test/display_reconfiguration.cpp 2017-01-26 16:46:42 +0000 | |||
3681 | @@ -51,9 +51,9 @@ | |||
3682 | 51 | void create_fullscreen_window() | 51 | void create_fullscreen_window() |
3683 | 52 | { | 52 | { |
3684 | 53 | mir::scene::SurfaceCreationParameters creation_parameters; | 53 | mir::scene::SurfaceCreationParameters creation_parameters; |
3686 | 54 | creation_parameters.type = mir_surface_type_normal; | 54 | creation_parameters.type = mir_window_type_normal; |
3687 | 55 | creation_parameters.size = initial_window_size; | 55 | creation_parameters.size = initial_window_size; |
3689 | 56 | creation_parameters.state = mir_surface_state_fullscreen; | 56 | creation_parameters.state = mir_window_state_fullscreen; |
3690 | 57 | creation_parameters.output_id = mir::graphics::DisplayConfigurationOutputId{0}; | 57 | creation_parameters.output_id = mir::graphics::DisplayConfigurationOutputId{0}; |
3691 | 58 | 58 | ||
3692 | 59 | EXPECT_CALL(*window_manager_policy, advise_new_window(_)) | 59 | EXPECT_CALL(*window_manager_policy, advise_new_window(_)) |
3693 | @@ -77,9 +77,9 @@ | |||
3694 | 77 | create_fullscreen_window(); | 77 | create_fullscreen_window(); |
3695 | 78 | 78 | ||
3696 | 79 | WindowSpecification mods; | 79 | WindowSpecification mods; |
3698 | 80 | mods.state() = mir_surface_state_hidden; | 80 | mods.state() = mir_window_state_hidden; |
3699 | 81 | window_manager_tools.modify_window(window, mods); | 81 | window_manager_tools.modify_window(window, mods); |
3701 | 82 | mods.state() = mir_surface_state_fullscreen; | 82 | mods.state() = mir_window_state_fullscreen; |
3702 | 83 | window_manager_tools.modify_window(window, mods); | 83 | window_manager_tools.modify_window(window, mods); |
3703 | 84 | 84 | ||
3704 | 85 | Rectangle const new_display{display_area.top_left+as_displacement({display_width, Height{0}}), display_area.size}; | 85 | Rectangle const new_display{display_area.top_left+as_displacement({display_width, Height{0}}), display_area.size}; |
3705 | 86 | 86 | ||
3706 | === modified file 'test/drag_active_window.cpp' | |||
3707 | --- test/drag_active_window.cpp 2016-11-07 12:09:04 +0000 | |||
3708 | +++ test/drag_active_window.cpp 2017-01-26 16:46:42 +0000 | |||
3709 | @@ -36,7 +36,7 @@ | |||
3710 | 36 | 36 | ||
3711 | 37 | auto const null_window = Window{}; | 37 | auto const null_window = Window{}; |
3712 | 38 | 38 | ||
3714 | 39 | struct DragActiveWindow : TestWindowManagerTools, WithParamInterface<MirSurfaceType> | 39 | struct DragActiveWindow : TestWindowManagerTools, WithParamInterface<MirWindowType> |
3715 | 40 | { | 40 | { |
3716 | 41 | Size const initial_parent_size{600, 400}; | 41 | Size const initial_parent_size{600, 400}; |
3717 | 42 | 42 | ||
3718 | @@ -48,7 +48,7 @@ | |||
3719 | 48 | basic_window_manager.add_session(session); | 48 | basic_window_manager.add_session(session); |
3720 | 49 | } | 49 | } |
3721 | 50 | 50 | ||
3723 | 51 | void create_window_of_type(MirSurfaceType type) | 51 | void create_window_of_type(MirWindowType type) |
3724 | 52 | { | 52 | { |
3725 | 53 | mir::scene::SurfaceCreationParameters creation_parameters; | 53 | mir::scene::SurfaceCreationParameters creation_parameters; |
3726 | 54 | creation_parameters.type = type; | 54 | creation_parameters.type = type; |
3727 | 55 | 55 | ||
3728 | === modified file 'test/modify_window_state.cpp' | |||
3729 | --- test/modify_window_state.cpp 2016-11-07 12:09:11 +0000 | |||
3730 | +++ test/modify_window_state.cpp 2017-01-26 16:46:42 +0000 | |||
3731 | @@ -36,7 +36,7 @@ | |||
3732 | 36 | 36 | ||
3733 | 37 | auto const null_window = Window{}; | 37 | auto const null_window = Window{}; |
3734 | 38 | 38 | ||
3736 | 39 | struct ModifyWindowState : TestWindowManagerTools, WithParamInterface<MirSurfaceType> | 39 | struct ModifyWindowState : TestWindowManagerTools, WithParamInterface<MirWindowType> |
3737 | 40 | { | 40 | { |
3738 | 41 | Size const initial_parent_size{600, 400}; | 41 | Size const initial_parent_size{600, 400}; |
3739 | 42 | 42 | ||
3740 | @@ -48,7 +48,7 @@ | |||
3741 | 48 | basic_window_manager.add_session(session); | 48 | basic_window_manager.add_session(session); |
3742 | 49 | } | 49 | } |
3743 | 50 | 50 | ||
3745 | 51 | void create_window_of_type(MirSurfaceType type) | 51 | void create_window_of_type(MirWindowType type) |
3746 | 52 | { | 52 | { |
3747 | 53 | mir::scene::SurfaceCreationParameters creation_parameters; | 53 | mir::scene::SurfaceCreationParameters creation_parameters; |
3748 | 54 | creation_parameters.type = type; | 54 | creation_parameters.type = type; |
3749 | @@ -72,11 +72,11 @@ | |||
3750 | 72 | 72 | ||
3751 | 73 | TEST_P(ForNormalSurface, state) | 73 | TEST_P(ForNormalSurface, state) |
3752 | 74 | { | 74 | { |
3756 | 75 | auto const original_state = mir_surface_state_restored; | 75 | auto const original_state = mir_window_state_restored; |
3757 | 76 | auto const new_state = MirSurfaceState(GetParam()); | 76 | auto const new_state = MirWindowState(GetParam()); |
3758 | 77 | auto const state_is_visible = (new_state != mir_surface_state_minimized) && (new_state != mir_surface_state_hidden); | 77 | auto const state_is_visible = (new_state != mir_window_state_minimized) && (new_state != mir_window_state_hidden); |
3759 | 78 | 78 | ||
3761 | 79 | create_window_of_type(mir_surface_type_normal); | 79 | create_window_of_type(mir_window_type_normal); |
3762 | 80 | auto const& info = window_manager_tools.info_for(window); | 80 | auto const& info = window_manager_tools.info_for(window); |
3763 | 81 | 81 | ||
3764 | 82 | WindowSpecification mods; | 82 | WindowSpecification mods; |
3765 | @@ -95,13 +95,13 @@ | |||
3766 | 95 | } | 95 | } |
3767 | 96 | 96 | ||
3768 | 97 | INSTANTIATE_TEST_CASE_P(ModifyWindowState, ForNormalSurface, ::testing::Values( | 97 | INSTANTIATE_TEST_CASE_P(ModifyWindowState, ForNormalSurface, ::testing::Values( |
3778 | 98 | // mir_surface_state_unknown, | 98 | // mir_window_state_unknown, |
3779 | 99 | mir_surface_state_restored, | 99 | mir_window_state_restored, |
3780 | 100 | mir_surface_state_minimized, | 100 | mir_window_state_minimized, |
3781 | 101 | mir_surface_state_maximized, | 101 | mir_window_state_maximized, |
3782 | 102 | mir_surface_state_vertmaximized, | 102 | mir_window_state_vertmaximized, |
3783 | 103 | mir_surface_state_fullscreen, | 103 | mir_window_state_fullscreen, |
3784 | 104 | mir_surface_state_horizmaximized, | 104 | mir_window_state_horizmaximized, |
3785 | 105 | mir_surface_state_hidden | 105 | mir_window_state_hidden |
3786 | 106 | // mir_surface_states | 106 | // mir_window_states |
3787 | 107 | )); | 107 | )); |
3788 | 108 | 108 | ||
3789 | === modified file 'test/persistent_surface_store.cpp' | |||
3790 | --- test/persistent_surface_store.cpp 2016-11-23 09:51:02 +0000 | |||
3791 | +++ test/persistent_surface_store.cpp 2017-01-26 16:46:42 +0000 | |||
3792 | @@ -17,8 +17,8 @@ | |||
3793 | 17 | */ | 17 | */ |
3794 | 18 | 18 | ||
3795 | 19 | #include <miral/toolkit/persistent_id.h> | 19 | #include <miral/toolkit/persistent_id.h> |
3798 | 20 | #include <miral/toolkit/surface.h> | 20 | #include <miral/toolkit/window.h> |
3799 | 21 | #include <miral/toolkit/surface_spec.h> | 21 | #include <miral/toolkit/window_spec.h> |
3800 | 22 | 22 | ||
3801 | 23 | #include <miral/application_info.h> | 23 | #include <miral/application_info.h> |
3802 | 24 | 24 | ||
3803 | @@ -49,10 +49,10 @@ | |||
3804 | 49 | using namespace miral::toolkit; | 49 | using namespace miral::toolkit; |
3805 | 50 | 50 | ||
3806 | 51 | auto const connection = connect_client(test_name); | 51 | auto const connection = connect_client(test_name); |
3808 | 52 | auto const spec = SurfaceSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) | 52 | auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
3809 | 53 | .set_name(test_name); | 53 | .set_name(test_name); |
3810 | 54 | 54 | ||
3812 | 55 | Surface const surface{spec.create_surface()}; | 55 | Window const surface{spec.create_surface()}; |
3813 | 56 | 56 | ||
3814 | 57 | miral::toolkit::PersistentId client_surface_id{surface}; | 57 | miral::toolkit::PersistentId client_surface_id{surface}; |
3815 | 58 | 58 | ||
3816 | @@ -71,10 +71,10 @@ | |||
3817 | 71 | using namespace miral::toolkit; | 71 | using namespace miral::toolkit; |
3818 | 72 | 72 | ||
3819 | 73 | auto const connection = connect_client(test_name); | 73 | auto const connection = connect_client(test_name); |
3821 | 74 | auto const spec = SurfaceSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) | 74 | auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
3822 | 75 | .set_name(test_name); | 75 | .set_name(test_name); |
3823 | 76 | 76 | ||
3825 | 77 | Surface const surface{spec.create_surface()}; | 77 | Window const surface{spec.create_surface()}; |
3826 | 78 | 78 | ||
3827 | 79 | miral::toolkit::PersistentId client_surface_id{surface}; | 79 | miral::toolkit::PersistentId client_surface_id{surface}; |
3828 | 80 | 80 | ||
3829 | @@ -93,10 +93,10 @@ | |||
3830 | 93 | using namespace miral::toolkit; | 93 | using namespace miral::toolkit; |
3831 | 94 | 94 | ||
3832 | 95 | auto const connection = connect_client(test_name); | 95 | auto const connection = connect_client(test_name); |
3834 | 96 | auto const spec = SurfaceSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) | 96 | auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
3835 | 97 | .set_name(test_name); | 97 | .set_name(test_name); |
3836 | 98 | 98 | ||
3838 | 99 | Surface const surface{spec.create_surface()}; | 99 | Window const surface{spec.create_surface()}; |
3839 | 100 | 100 | ||
3840 | 101 | miral::toolkit::PersistentId client_surface_id{surface}; | 101 | miral::toolkit::PersistentId client_surface_id{surface}; |
3841 | 102 | 102 | ||
3842 | @@ -112,10 +112,10 @@ | |||
3843 | 112 | using namespace miral::toolkit; | 112 | using namespace miral::toolkit; |
3844 | 113 | 113 | ||
3845 | 114 | auto const connection = connect_client(test_name); | 114 | auto const connection = connect_client(test_name); |
3847 | 115 | auto const spec = SurfaceSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) | 115 | auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
3848 | 116 | .set_name(test_name); | 116 | .set_name(test_name); |
3849 | 117 | 117 | ||
3851 | 118 | Surface const surface{spec.create_surface()}; | 118 | Window const surface{spec.create_surface()}; |
3852 | 119 | 119 | ||
3853 | 120 | miral::toolkit::PersistentId client_surface_id{surface}; | 120 | miral::toolkit::PersistentId client_surface_id{surface}; |
3854 | 121 | 121 | ||
3855 | @@ -133,10 +133,10 @@ | |||
3856 | 133 | using namespace miral::toolkit; | 133 | using namespace miral::toolkit; |
3857 | 134 | 134 | ||
3858 | 135 | auto const connection = connect_client(test_name); | 135 | auto const connection = connect_client(test_name); |
3860 | 136 | auto const spec = SurfaceSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) | 136 | auto const spec = WindowSpec::for_normal_surface(connection, 50, 50, mir_pixel_format_argb_8888) |
3861 | 137 | .set_name(test_name); | 137 | .set_name(test_name); |
3862 | 138 | 138 | ||
3864 | 139 | Surface const surface{spec.create_surface()}; | 139 | Window const surface{spec.create_surface()}; |
3865 | 140 | 140 | ||
3866 | 141 | miral::toolkit::PersistentId client_surface_id{surface}; | 141 | miral::toolkit::PersistentId client_surface_id{surface}; |
3867 | 142 | 142 | ||
3868 | 143 | 143 | ||
3869 | === added file 'test/raise_tree.cpp' | |||
3870 | --- test/raise_tree.cpp 1970-01-01 00:00:00 +0000 | |||
3871 | +++ test/raise_tree.cpp 2017-01-26 16:46:42 +0000 | |||
3872 | @@ -0,0 +1,95 @@ | |||
3873 | 1 | /* | ||
3874 | 2 | * Copyright © 2017 Canonical Ltd. | ||
3875 | 3 | * | ||
3876 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3877 | 5 | * under the terms of the GNU General Public License version 3, | ||
3878 | 6 | * as published by the Free Software Foundation. | ||
3879 | 7 | * | ||
3880 | 8 | * This program is distributed in the hope that it will be useful, | ||
3881 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3882 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3883 | 11 | * GNU General Public License for more details. | ||
3884 | 12 | * | ||
3885 | 13 | * You should have received a copy of the GNU General Public License | ||
3886 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3887 | 15 | * | ||
3888 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
3889 | 17 | */ | ||
3890 | 18 | |||
3891 | 19 | #include "test_window_manager_tools.h" | ||
3892 | 20 | |||
3893 | 21 | using namespace miral; | ||
3894 | 22 | using namespace testing; | ||
3895 | 23 | namespace mt = mir::test; | ||
3896 | 24 | |||
3897 | 25 | namespace | ||
3898 | 26 | { | ||
3899 | 27 | X const display_left{0}; | ||
3900 | 28 | Y const display_top{0}; | ||
3901 | 29 | Width const display_width{640}; | ||
3902 | 30 | Height const display_height{480}; | ||
3903 | 31 | |||
3904 | 32 | Rectangle const display_area{{display_left, display_top}, {display_width, display_height}}; | ||
3905 | 33 | |||
3906 | 34 | struct RaiseTree : TestWindowManagerTools | ||
3907 | 35 | { | ||
3908 | 36 | Size const initial_parent_size{600, 400}; | ||
3909 | 37 | Size const initial_child_size{300, 300}; | ||
3910 | 38 | Rectangle const rectangle_away_from_rhs{{20, 20}, {20, 20}}; | ||
3911 | 39 | Rectangle const rectangle_near_rhs{{590, 20}, {10, 20}}; | ||
3912 | 40 | Rectangle const rectangle_away_from_bottom{{20, 20}, {20, 20}}; | ||
3913 | 41 | Rectangle const rectangle_near_bottom{{20, 380}, {20, 20}}; | ||
3914 | 42 | Rectangle const rectangle_near_both_sides{{0, 20}, {600, 20}}; | ||
3915 | 43 | Rectangle const rectangle_near_both_sides_and_bottom{{0, 380}, {600, 20}}; | ||
3916 | 44 | Rectangle const rectangle_near_all_sides{{0, 20}, {600, 380}}; | ||
3917 | 45 | Rectangle const rectangle_near_both_bottom_right{{400, 380}, {200, 20}}; | ||
3918 | 46 | |||
3919 | 47 | Window parent; | ||
3920 | 48 | Window child; | ||
3921 | 49 | Window another_window; | ||
3922 | 50 | |||
3923 | 51 | WindowSpecification modification; | ||
3924 | 52 | |||
3925 | 53 | void SetUp() override | ||
3926 | 54 | { | ||
3927 | 55 | basic_window_manager.add_display(display_area); | ||
3928 | 56 | |||
3929 | 57 | mir::scene::SurfaceCreationParameters creation_parameters; | ||
3930 | 58 | basic_window_manager.add_session(session); | ||
3931 | 59 | |||
3932 | 60 | EXPECT_CALL(*window_manager_policy, advise_new_window(_)) | ||
3933 | 61 | .WillOnce(Invoke([this](WindowInfo const& window_info){ parent = window_info.window(); })) | ||
3934 | 62 | .WillOnce(Invoke([this](WindowInfo const& window_info){ child = window_info.window(); })) | ||
3935 | 63 | .WillOnce(Invoke([this](WindowInfo const& window_info){ another_window = window_info.window(); })); | ||
3936 | 64 | |||
3937 | 65 | creation_parameters.size = initial_parent_size; | ||
3938 | 66 | basic_window_manager.add_surface(session, creation_parameters, &create_surface); | ||
3939 | 67 | |||
3940 | 68 | creation_parameters.type = mir_window_type_menu; | ||
3941 | 69 | creation_parameters.parent = parent; | ||
3942 | 70 | creation_parameters.size = initial_child_size; | ||
3943 | 71 | basic_window_manager.add_surface(session, creation_parameters, &create_surface); | ||
3944 | 72 | |||
3945 | 73 | creation_parameters.type = mir_window_type_normal; | ||
3946 | 74 | creation_parameters.parent.reset(); | ||
3947 | 75 | creation_parameters.size = display_area.size; | ||
3948 | 76 | basic_window_manager.add_surface(session, creation_parameters, &create_surface); | ||
3949 | 77 | |||
3950 | 78 | // Clear the expectations used to capture parent & child | ||
3951 | 79 | Mock::VerifyAndClearExpectations(window_manager_policy); | ||
3952 | 80 | } | ||
3953 | 81 | }; | ||
3954 | 82 | } | ||
3955 | 83 | |||
3956 | 84 | TEST_F(RaiseTree, when_parent_is_raised_child_is_raised) | ||
3957 | 85 | { | ||
3958 | 86 | EXPECT_CALL(*window_manager_policy, advise_raise(ElementsAre(parent, child))); | ||
3959 | 87 | basic_window_manager.raise_tree(parent); | ||
3960 | 88 | } | ||
3961 | 89 | |||
3962 | 90 | TEST_F(RaiseTree, when_child_is_raised_parent_is_raised) | ||
3963 | 91 | { | ||
3964 | 92 | EXPECT_CALL(*window_manager_policy, advise_raise(ElementsAre(parent, child))); | ||
3965 | 93 | EXPECT_CALL(*window_manager_policy, advise_raise(ElementsAre(child))); | ||
3966 | 94 | basic_window_manager.raise_tree(child); | ||
3967 | 95 | } | ||
3968 | 0 | 96 | ||
3969 | === modified file 'test/select_active_window.cpp' | |||
3970 | --- test/select_active_window.cpp 2016-10-10 14:53:39 +0000 | |||
3971 | +++ test/select_active_window.cpp 2017-01-26 16:46:42 +0000 | |||
3972 | @@ -82,13 +82,13 @@ | |||
3973 | 82 | { | 82 | { |
3974 | 83 | mir::scene::SurfaceCreationParameters creation_parameters; | 83 | mir::scene::SurfaceCreationParameters creation_parameters; |
3975 | 84 | creation_parameters.name = "parent"; | 84 | creation_parameters.name = "parent"; |
3977 | 85 | creation_parameters.type = mir_surface_type_normal; | 85 | creation_parameters.type = mir_window_type_normal; |
3978 | 86 | creation_parameters.size = Size{600, 400}; | 86 | creation_parameters.size = Size{600, 400}; |
3979 | 87 | 87 | ||
3980 | 88 | auto parent = create_window(creation_parameters); | 88 | auto parent = create_window(creation_parameters); |
3981 | 89 | 89 | ||
3982 | 90 | creation_parameters.name = "dialog"; | 90 | creation_parameters.name = "dialog"; |
3984 | 91 | creation_parameters.type = mir_surface_type_dialog; | 91 | creation_parameters.type = mir_window_type_dialog; |
3985 | 92 | creation_parameters.parent = parent; | 92 | creation_parameters.parent = parent; |
3986 | 93 | 93 | ||
3987 | 94 | auto dialog = create_window(creation_parameters); | 94 | auto dialog = create_window(creation_parameters); |
3988 | @@ -102,22 +102,22 @@ | |||
3989 | 102 | { | 102 | { |
3990 | 103 | mir::scene::SurfaceCreationParameters creation_parameters; | 103 | mir::scene::SurfaceCreationParameters creation_parameters; |
3991 | 104 | creation_parameters.name = "parent"; | 104 | creation_parameters.name = "parent"; |
3993 | 105 | creation_parameters.type = mir_surface_type_normal; | 105 | creation_parameters.type = mir_window_type_normal; |
3994 | 106 | creation_parameters.size = Size{600, 400}; | 106 | creation_parameters.size = Size{600, 400}; |
3995 | 107 | 107 | ||
3996 | 108 | auto parent = create_window(creation_parameters); | 108 | auto parent = create_window(creation_parameters); |
3997 | 109 | 109 | ||
3998 | 110 | creation_parameters.name = "dialog"; | 110 | creation_parameters.name = "dialog"; |
4000 | 111 | creation_parameters.type = mir_surface_type_dialog; | 111 | creation_parameters.type = mir_window_type_dialog; |
4001 | 112 | creation_parameters.parent = parent; | 112 | creation_parameters.parent = parent; |
4002 | 113 | 113 | ||
4003 | 114 | auto dialog = create_window(creation_parameters); | 114 | auto dialog = create_window(creation_parameters); |
4004 | 115 | 115 | ||
4005 | 116 | WindowSpecification mods; | 116 | WindowSpecification mods; |
4007 | 117 | mods.state() = mir_surface_state_hidden; | 117 | mods.state() = mir_window_state_hidden; |
4008 | 118 | basic_window_manager.modify_window(basic_window_manager.info_for(dialog), mods); | 118 | basic_window_manager.modify_window(basic_window_manager.info_for(dialog), mods); |
4009 | 119 | 119 | ||
4010 | 120 | auto actual = basic_window_manager.select_active_window(parent); | 120 | auto actual = basic_window_manager.select_active_window(parent); |
4011 | 121 | EXPECT_THAT(actual, Eq(parent)) | 121 | EXPECT_THAT(actual, Eq(parent)) |
4012 | 122 | << "actual=" << actual << ", expected=" << parent; | 122 | << "actual=" << actual << ", expected=" << parent; |
4013 | 123 | } | ||
4014 | 124 | \ No newline at end of file | 123 | \ No newline at end of file |
4015 | 124 | } | ||
4016 | 125 | 125 | ||
4017 | === modified file 'test/test_window_manager_tools.h' | |||
4018 | --- test/test_window_manager_tools.h 2016-10-10 14:53:39 +0000 | |||
4019 | +++ test/test_window_manager_tools.h 2017-01-26 16:46:42 +0000 | |||
4020 | @@ -74,11 +74,11 @@ | |||
4021 | 74 | 74 | ||
4022 | 75 | struct StubSurface : mir::test::doubles::StubSurface | 75 | struct StubSurface : mir::test::doubles::StubSurface |
4023 | 76 | { | 76 | { |
4025 | 77 | StubSurface(std::string name, MirSurfaceType type, mir::geometry::Point top_left, mir::geometry::Size size) : | 77 | StubSurface(std::string name, MirWindowType type, mir::geometry::Point top_left, mir::geometry::Size size) : |
4026 | 78 | name_{name}, type_{type}, top_left_{top_left}, size_{size} {} | 78 | name_{name}, type_{type}, top_left_{top_left}, size_{size} {} |
4027 | 79 | 79 | ||
4028 | 80 | std::string name() const override { return name_; }; | 80 | std::string name() const override { return name_; }; |
4030 | 81 | MirSurfaceType type() const { return type_; } | 81 | MirWindowType type() const override { return type_; } |
4031 | 82 | 82 | ||
4032 | 83 | mir::geometry::Point top_left() const override { return top_left_; } | 83 | mir::geometry::Point top_left() const override { return top_left_; } |
4033 | 84 | void move_to(mir::geometry::Point const& top_left) override { top_left_ = top_left; } | 84 | void move_to(mir::geometry::Point const& top_left) override { top_left_ = top_left; } |
4034 | @@ -86,25 +86,25 @@ | |||
4035 | 86 | mir::geometry::Size size() const override { return size_; } | 86 | mir::geometry::Size size() const override { return size_; } |
4036 | 87 | void resize(mir::geometry::Size const& size) override { size_ = size; } | 87 | void resize(mir::geometry::Size const& size) override { size_ = size; } |
4037 | 88 | 88 | ||
4040 | 89 | auto state() const -> MirSurfaceState override { return state_; } | 89 | auto state() const -> MirWindowState override { return state_; } |
4041 | 90 | auto configure(MirSurfaceAttrib attrib, int value) -> int override { | 90 | auto configure(MirWindowAttrib attrib, int value) -> int override { |
4042 | 91 | switch (attrib) | 91 | switch (attrib) |
4043 | 92 | { | 92 | { |
4046 | 93 | case mir_surface_attrib_state: | 93 | case mir_window_attrib_state: |
4047 | 94 | state_ = MirSurfaceState(value); | 94 | state_ = MirWindowState(value); |
4048 | 95 | return state_; | 95 | return state_; |
4049 | 96 | default: | 96 | default: |
4050 | 97 | return value; | 97 | return value; |
4051 | 98 | } | 98 | } |
4052 | 99 | } | 99 | } |
4053 | 100 | 100 | ||
4055 | 101 | bool visible() const override { return state() != mir_surface_state_hidden; } | 101 | bool visible() const override { return state() != mir_window_state_hidden; } |
4056 | 102 | 102 | ||
4057 | 103 | std::string name_; | 103 | std::string name_; |
4059 | 104 | MirSurfaceType type_; | 104 | MirWindowType type_; |
4060 | 105 | mir::geometry::Point top_left_; | 105 | mir::geometry::Point top_left_; |
4061 | 106 | mir::geometry::Size size_; | 106 | mir::geometry::Size size_; |
4063 | 107 | MirSurfaceState state_ = mir_surface_state_restored; | 107 | MirWindowState state_ = mir_window_state_restored; |
4064 | 108 | }; | 108 | }; |
4065 | 109 | 109 | ||
4066 | 110 | struct StubStubSession : mir::test::doubles::StubSession | 110 | struct StubStubSession : mir::test::doubles::StubSession |
4067 | @@ -133,13 +133,14 @@ | |||
4068 | 133 | { | 133 | { |
4069 | 134 | using miral::CanonicalWindowManagerPolicy::CanonicalWindowManagerPolicy; | 134 | using miral::CanonicalWindowManagerPolicy::CanonicalWindowManagerPolicy; |
4070 | 135 | 135 | ||
4074 | 136 | bool handle_touch_event(MirTouchEvent const* /*event*/) override { return false; } | 136 | bool handle_touch_event(MirTouchEvent const* /*event*/) { return false; } |
4075 | 137 | bool handle_pointer_event(MirPointerEvent const* /*event*/) override { return false; } | 137 | bool handle_pointer_event(MirPointerEvent const* /*event*/) { return false; } |
4076 | 138 | bool handle_keyboard_event(MirKeyboardEvent const* /*event*/) override { return false; } | 138 | bool handle_keyboard_event(MirKeyboardEvent const* /*event*/) { return false; } |
4077 | 139 | 139 | ||
4078 | 140 | MOCK_METHOD1(advise_new_window, void (miral::WindowInfo const& window_info)); | 140 | MOCK_METHOD1(advise_new_window, void (miral::WindowInfo const& window_info)); |
4079 | 141 | MOCK_METHOD2(advise_move_to, void(miral::WindowInfo const& window_info, mir::geometry::Point top_left)); | 141 | MOCK_METHOD2(advise_move_to, void(miral::WindowInfo const& window_info, mir::geometry::Point top_left)); |
4080 | 142 | MOCK_METHOD2(advise_resize, void(miral::WindowInfo const& window_info, mir::geometry::Size const& new_size)); | 142 | MOCK_METHOD2(advise_resize, void(miral::WindowInfo const& window_info, mir::geometry::Size const& new_size)); |
4081 | 143 | MOCK_METHOD1(advise_raise, void(std::vector<miral::Window> const&)); | ||
4082 | 143 | }; | 144 | }; |
4083 | 144 | 145 | ||
4084 | 145 | struct TestWindowManagerTools : testing::Test | 146 | struct TestWindowManagerTools : testing::Test |
4085 | @@ -158,7 +159,7 @@ | |||
4086 | 158 | mir::test::fake_shared(persistent_surface_store), | 159 | mir::test::fake_shared(persistent_surface_store), |
4087 | 159 | [this](miral::WindowManagerTools const& tools) -> std::unique_ptr<miral::WindowManagementPolicy> | 160 | [this](miral::WindowManagerTools const& tools) -> std::unique_ptr<miral::WindowManagementPolicy> |
4088 | 160 | { | 161 | { |
4090 | 161 | auto policy = std::make_unique<MockWindowManagerPolicy>(tools); | 162 | auto policy = std::make_unique<testing::NiceMock<MockWindowManagerPolicy>>(tools); |
4091 | 162 | window_manager_policy = policy.get(); | 163 | window_manager_policy = policy.get(); |
4092 | 163 | window_manager_tools = tools; | 164 | window_manager_tools = tools; |
4093 | 164 | return std::move(policy); | 165 | return std::move(policy); |
4094 | 165 | 166 | ||
4095 | === modified file 'test/window_placement.cpp' | |||
4096 | --- test/window_placement.cpp 2016-09-19 12:04:12 +0000 | |||
4097 | +++ test/window_placement.cpp 2017-01-26 16:46:42 +0000 | |||
4098 | @@ -73,7 +73,7 @@ | |||
4099 | 73 | creation_parameters.size = initial_parent_size; | 73 | creation_parameters.size = initial_parent_size; |
4100 | 74 | basic_window_manager.add_surface(session, creation_parameters, &create_surface); | 74 | basic_window_manager.add_surface(session, creation_parameters, &create_surface); |
4101 | 75 | 75 | ||
4103 | 76 | creation_parameters.type = mir_surface_type_menu; | 76 | creation_parameters.type = mir_window_type_menu; |
4104 | 77 | creation_parameters.parent = parent; | 77 | creation_parameters.parent = parent; |
4105 | 78 | creation_parameters.size = initial_child_size; | 78 | creation_parameters.size = initial_child_size; |
4106 | 79 | basic_window_manager.add_surface(session, creation_parameters, &create_surface); | 79 | basic_window_manager.add_surface(session, creation_parameters, &create_surface); |
4107 | @@ -121,12 +121,12 @@ | |||
4108 | 121 | ASSERT_THAT(parent, Ne(null_window)); | 121 | ASSERT_THAT(parent, Ne(null_window)); |
4109 | 122 | ASSERT_THAT(parent.size(), Eq(initial_parent_size)); | 122 | ASSERT_THAT(parent.size(), Eq(initial_parent_size)); |
4110 | 123 | ASSERT_THAT(basic_window_manager.info_for(parent).children(), ElementsAre(child)); | 123 | ASSERT_THAT(basic_window_manager.info_for(parent).children(), ElementsAre(child)); |
4112 | 124 | ASSERT_THAT(basic_window_manager.info_for(parent).type(), Eq(mir_surface_type_normal)); | 124 | ASSERT_THAT(basic_window_manager.info_for(parent).type(), Eq(mir_window_type_normal)); |
4113 | 125 | 125 | ||
4114 | 126 | ASSERT_THAT(child, Ne(null_window)); | 126 | ASSERT_THAT(child, Ne(null_window)); |
4115 | 127 | ASSERT_THAT(child.size(), Eq(initial_child_size)); | 127 | ASSERT_THAT(child.size(), Eq(initial_child_size)); |
4116 | 128 | ASSERT_THAT(basic_window_manager.info_for(child).parent(), Eq(parent)); | 128 | ASSERT_THAT(basic_window_manager.info_for(child).parent(), Eq(parent)); |
4118 | 129 | ASSERT_THAT(basic_window_manager.info_for(child).type(), Eq(mir_surface_type_menu)); | 129 | ASSERT_THAT(basic_window_manager.info_for(child).type(), Eq(mir_window_type_menu)); |
4119 | 130 | } | 130 | } |
4120 | 131 | 131 | ||
4121 | 132 | 132 | ||
4122 | 133 | 133 | ||
4123 | === modified file 'test/window_placement_anchors_to_parent.cpp' | |||
4124 | --- test/window_placement_anchors_to_parent.cpp 2016-09-19 14:06:02 +0000 | |||
4125 | +++ test/window_placement_anchors_to_parent.cpp 2017-01-26 16:46:42 +0000 | |||
4126 | @@ -71,7 +71,7 @@ | |||
4127 | 71 | creation_parameters.size = parent_size; | 71 | creation_parameters.size = parent_size; |
4128 | 72 | basic_window_manager.add_surface(session, creation_parameters, &create_surface); | 72 | basic_window_manager.add_surface(session, creation_parameters, &create_surface); |
4129 | 73 | 73 | ||
4131 | 74 | creation_parameters.type = mir_surface_type_tip; | 74 | creation_parameters.type = mir_window_type_tip; |
4132 | 75 | creation_parameters.parent = parent; | 75 | creation_parameters.parent = parent; |
4133 | 76 | creation_parameters.size = initial_child_size; | 76 | creation_parameters.size = initial_child_size; |
4134 | 77 | basic_window_manager.add_surface(session, creation_parameters, &create_surface); | 77 | basic_window_manager.add_surface(session, creation_parameters, &create_surface); |
4135 | 78 | 78 | ||
4136 | === modified file 'test/window_placement_client_api.cpp' | |||
4137 | --- test/window_placement_client_api.cpp 2016-09-15 13:50:33 +0000 | |||
4138 | +++ test/window_placement_client_api.cpp 2017-01-26 16:46:42 +0000 | |||
4139 | @@ -17,13 +17,19 @@ | |||
4140 | 17 | */ | 17 | */ |
4141 | 18 | 18 | ||
4142 | 19 | #include <mir/version.h> | 19 | #include <mir/version.h> |
4143 | 20 | #include <mir_toolkit/version.h> | ||
4144 | 20 | 21 | ||
4145 | 21 | #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0) | 22 | #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0) |
4146 | 23 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) | ||
4147 | 22 | #include <mir_toolkit/events/surface_placement.h> | 24 | #include <mir_toolkit/events/surface_placement.h> |
4148 | 25 | #else | ||
4149 | 26 | #include <mir_toolkit/events/window_placement.h> | ||
4150 | 27 | #endif | ||
4151 | 23 | #endif | 28 | #endif |
4152 | 24 | 29 | ||
4155 | 25 | #include <miral/toolkit/surface_spec.h> | 30 | #include <miral/detail/mir_forward_compatibility.h> |
4156 | 26 | #include <miral/toolkit/surface.h> | 31 | #include <miral/toolkit/window_spec.h> |
4157 | 32 | #include <miral/toolkit/window.h> | ||
4158 | 27 | 33 | ||
4159 | 28 | #include <mir/test/signal.h> | 34 | #include <mir/test/signal.h> |
4160 | 29 | #include "test_server.h" | 35 | #include "test_server.h" |
4161 | @@ -50,7 +56,7 @@ | |||
4162 | 50 | char const* const test_name = __PRETTY_FUNCTION__; | 56 | char const* const test_name = __PRETTY_FUNCTION__; |
4163 | 51 | 57 | ||
4164 | 52 | connection = connect_client(test_name); | 58 | connection = connect_client(test_name); |
4166 | 53 | auto spec = SurfaceSpec::for_normal_surface(connection, 400, 400, mir_pixel_format_argb_8888) | 59 | auto spec = WindowSpec::for_normal_surface(connection, 400, 400, mir_pixel_format_argb_8888) |
4167 | 54 | .set_name(test_name); | 60 | .set_name(test_name); |
4168 | 55 | 61 | ||
4169 | 56 | parent = spec.create_surface(); | 62 | parent = spec.create_surface(); |
4170 | @@ -66,13 +72,17 @@ | |||
4171 | 66 | } | 72 | } |
4172 | 67 | 73 | ||
4173 | 68 | Connection connection; | 74 | Connection connection; |
4176 | 69 | Surface parent; | 75 | Window parent; |
4177 | 70 | Surface child; | 76 | Window child; |
4178 | 71 | }; | 77 | }; |
4179 | 72 | } | 78 | } |
4180 | 73 | 79 | ||
4181 | 74 | #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0) | 80 | #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0) |
4182 | 75 | 81 | ||
4183 | 82 | #if MIR_CLIENT_VERSION == MIR_VERSION_NUMBER(3, 4, 0) | ||
4184 | 83 | auto const mir_event_type_window_placement = mir_event_type_surface_placement; | ||
4185 | 84 | #endif | ||
4186 | 85 | |||
4187 | 76 | namespace | 86 | namespace |
4188 | 77 | { | 87 | { |
4189 | 78 | struct CheckPlacement | 88 | struct CheckPlacement |
4190 | @@ -80,21 +90,30 @@ | |||
4191 | 80 | CheckPlacement(int left, int top, unsigned int width, unsigned int height) : | 90 | CheckPlacement(int left, int top, unsigned int width, unsigned int height) : |
4192 | 81 | expected{left, top, width, height} {} | 91 | expected{left, top, width, height} {} |
4193 | 82 | 92 | ||
4195 | 83 | void check(MirSurfacePlacementEvent const* placement_event) | 93 | void check(MirWindowPlacementEvent const* placement_event) |
4196 | 84 | { | 94 | { |
4201 | 85 | EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).top, Eq(expected.top)); | 95 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0) |
4202 | 86 | EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).left, Eq(expected.left)); | 96 | auto relative_position = mir_surface_placement_get_relative_position(placement_event); |
4203 | 87 | EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).height, Eq(expected.height)); | 97 | #else |
4204 | 88 | EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).width, Eq(expected.width)); | 98 | auto relative_position = mir_window_placement_get_relative_position(placement_event); |
4205 | 99 | #endif | ||
4206 | 100 | EXPECT_THAT(relative_position.top, Eq(expected.top)); | ||
4207 | 101 | EXPECT_THAT(relative_position.left, Eq(expected.left)); | ||
4208 | 102 | EXPECT_THAT(relative_position.height, Eq(expected.height)); | ||
4209 | 103 | EXPECT_THAT(relative_position.width, Eq(expected.width)); | ||
4210 | 89 | 104 | ||
4211 | 90 | received.raise(); | 105 | received.raise(); |
4212 | 91 | } | 106 | } |
4213 | 92 | 107 | ||
4215 | 93 | static void callback(MirSurface* /*surface*/, MirEvent const* event, void* context) | 108 | static void callback(MirWindow* /*surface*/, MirEvent const* event, void* context) |
4216 | 94 | { | 109 | { |
4218 | 95 | if (mir_event_get_type(event) == mir_event_type_surface_placement) | 110 | if (mir_event_get_type(event) == mir_event_type_window_placement) |
4219 | 96 | { | 111 | { |
4220 | 112 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
4221 | 97 | auto const placement_event = mir_event_get_surface_placement_event(event); | 113 | auto const placement_event = mir_event_get_surface_placement_event(event); |
4222 | 114 | #else | ||
4223 | 115 | auto const placement_event = mir_event_get_window_placement_event(event); | ||
4224 | 116 | #endif | ||
4225 | 98 | static_cast<CheckPlacement*>(context)->check(placement_event); | 117 | static_cast<CheckPlacement*>(context)->check(placement_event); |
4226 | 99 | } | 118 | } |
4227 | 100 | } | 119 | } |
4228 | @@ -123,7 +142,7 @@ | |||
4229 | 123 | MirRectangle aux_rect{10, 20, 3, 4}; | 142 | MirRectangle aux_rect{10, 20, 3, 4}; |
4230 | 124 | CheckPlacement expected{aux_rect.left+(int)aux_rect.width, aux_rect.top, dx, dy}; | 143 | CheckPlacement expected{aux_rect.left+(int)aux_rect.width, aux_rect.top, dx, dy}; |
4231 | 125 | 144 | ||
4233 | 126 | auto const spec = SurfaceSpec:: | 145 | auto const spec = WindowSpec:: |
4234 | 127 | for_menu(connection, dx, dy, mir_pixel_format_argb_8888, parent, &aux_rect, mir_edge_attachment_any) | 146 | for_menu(connection, dx, dy, mir_pixel_format_argb_8888, parent, &aux_rect, mir_edge_attachment_any) |
4235 | 128 | .set_event_handler(&CheckPlacement::callback, &expected) | 147 | .set_event_handler(&CheckPlacement::callback, &expected) |
4236 | 129 | .set_name(test_name); | 148 | .set_name(test_name); |
4237 | @@ -136,7 +155,7 @@ | |||
4238 | 136 | MirRectangle aux_rect{50, 60, 5, 7}; | 155 | MirRectangle aux_rect{50, 60, 5, 7}; |
4239 | 137 | CheckPlacement expected{aux_rect.left-dx, aux_rect.top, dx, dy}; | 156 | CheckPlacement expected{aux_rect.left-dx, aux_rect.top, dx, dy}; |
4240 | 138 | 157 | ||
4242 | 139 | auto const spec = SurfaceSpec::for_changes(connection) | 158 | auto const spec = WindowSpec::for_changes(connection) |
4243 | 140 | .set_event_handler(&CheckPlacement::callback, &expected) | 159 | .set_event_handler(&CheckPlacement::callback, &expected) |
4244 | 141 | .set_placement(&aux_rect, mir_placement_gravity_northwest, mir_placement_gravity_northeast, mir_placement_hints_flip_x, 0, 0); | 160 | .set_placement(&aux_rect, mir_placement_gravity_northwest, mir_placement_gravity_northeast, mir_placement_hints_flip_x, 0, 0); |
4245 | 142 | 161 |
The hack for generating backward-compatible synonyms fails to account for the case of building against earlier versions of Mir. In which case it fails to generate forward-compatible synonyms.
That is, MirAL 1.1 built against Mir 0.25 is not ABI compatible with MirAL 1.1 built against Mir 0.26.