Merge lp:~raof/mir/fixish-wayland-keyboard into lp:mir
- fixish-wayland-keyboard
- Merge into development-branch
Status: | Merged |
---|---|
Merged at revision: | 4280 |
Proposed branch: | lp:~raof/mir/fixish-wayland-keyboard |
Merge into: | lp:mir |
Diff against target: |
942 lines (+249/-123) 26 files modified
examples/miral-shell/decoration_provider.cpp (+2/-2) include/core/mir/anonymous_shm_file.h (+8/-26) include/core/mir/shm_file.h (+3/-9) src/common/fd/CMakeLists.txt (+0/-1) src/common/symbols.map (+0/-5) src/core/CMakeLists.txt (+11/-0) src/core/anonymous_shm_file.cpp (+42/-34) src/core/symbols.map (+25/-1) src/miral/application_authorizer.cpp (+1/-1) src/platforms/common/server/CMakeLists.txt (+0/-2) src/platforms/common/server/shm_buffer.cpp (+1/-1) src/platforms/common/server/shm_buffer.h (+2/-1) src/platforms/eglstream-kms/server/buffer_allocator.cpp (+2/-2) src/platforms/eglstream-kms/server/software_buffer.cpp (+2/-2) src/platforms/eglstream-kms/server/software_buffer.h (+3/-5) src/platforms/mesa/server/buffer_allocator.cpp (+2/-2) src/platforms/mesa/server/software_buffer.cpp (+2/-2) src/platforms/mesa/server/software_buffer.h (+3/-5) src/server/frontend/wayland/wayland_connector.cpp (+120/-3) src/server/scene/basic_surface.cpp (+1/-1) tests/mir_test_framework/stubbed_server_configuration.cpp (+3/-0) tests/miral/window_properties.cpp (+4/-4) tests/miral/workspaces.cpp (+3/-3) tests/unit-tests/graphics/test_anonymous_shm_file.cpp (+4/-6) tests/unit-tests/graphics/test_shm_buffer.cpp (+3/-3) tests/unit-tests/platforms/mesa/kms/test_software_buffer.cpp (+2/-2) |
To merge this branch: | bzr merge lp:~raof/mir/fixish-wayland-keyboard |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Needs Fixing | |
Alan Griffiths | Approve | ||
Review via email: mp+331520@code.launchpad.net |
Commit message
WlKeyboard: Reconstruct xkbcommon state in the frontend.
This is a hack which should be replaced by exposing the information we need in the MirKeyEvent and in mf::Surface and…
This works for now by reconstructing xkbcommon state to serialise to the Wayland client. Wayland clients will *not* have the correct keymap, however, because we don't receive the MirKeymapEvent at an appropriate time.
Description of the change
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:4286
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:4287
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:4287
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Alan Griffiths (alan-griffiths) wrote : | # |
Unneccessary, conflicting change:
<<<<<<< TREE
struct MockWindowManag
=======
#if defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-
#endif
struct MockWindowManager : mir::shell:
>>>>>>> MERGE-SOURCE
{
<<<<<<< TREE
MockWindowM
{
self = this;
}
=======
using mir::shell:
#if defined(__clang__)
#pragma GCC diagnostic pop
#endif
>>>>>>> MERGE-SOURCE
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:4288
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Alan Griffiths (alan-griffiths) wrote : | # |
Failures seem unrelated
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Brandon Schaefer (brandontschaefer) : | # |
Preview Diff
1 | === modified file 'examples/miral-shell/decoration_provider.cpp' | |||
2 | --- examples/miral-shell/decoration_provider.cpp 2017-08-21 15:58:34 +0000 | |||
3 | +++ examples/miral-shell/decoration_provider.cpp 2017-09-29 15:32:28 +0000 | |||
4 | @@ -421,7 +421,7 @@ | |||
5 | 421 | 421 | ||
6 | 422 | auto const title = info.name(); | 422 | auto const title = info.name(); |
7 | 423 | 423 | ||
9 | 424 | enqueue_work([this, stream=data->stream, title, intensity]{ paint_surface(stream, title, intensity); }); | 424 | enqueue_work([stream=data->stream, title, intensity]{ paint_surface(stream, title, intensity); }); |
10 | 425 | } | 425 | } |
11 | 426 | } | 426 | } |
12 | 427 | 427 | ||
13 | @@ -534,7 +534,7 @@ | |||
14 | 534 | { | 534 | { |
15 | 535 | auto const title = window_info.name(); | 535 | auto const title = window_info.name(); |
16 | 536 | 536 | ||
18 | 537 | enqueue_work([this, stream=data->stream, title, intensity=data->intensity.load()] | 537 | enqueue_work([stream=data->stream, title, intensity=data->intensity.load()] |
19 | 538 | { paint_surface(stream, title, intensity); }); | 538 | { paint_surface(stream, title, intensity); }); |
20 | 539 | } | 539 | } |
21 | 540 | } | 540 | } |
22 | 541 | 541 | ||
23 | === renamed file 'src/platforms/common/server/anonymous_shm_file.h' => 'include/core/mir/anonymous_shm_file.h' | |||
24 | --- src/platforms/common/server/anonymous_shm_file.h 2017-07-28 17:00:43 +0000 | |||
25 | +++ include/core/mir/anonymous_shm_file.h 2017-09-29 15:32:28 +0000 | |||
26 | @@ -17,52 +17,34 @@ | |||
27 | 17 | * Alexandros Frantzis <alexandros.frantzis@canonical.com> | 17 | * Alexandros Frantzis <alexandros.frantzis@canonical.com> |
28 | 18 | */ | 18 | */ |
29 | 19 | 19 | ||
32 | 20 | #ifndef MIR_GRAPHICS_MESA_ANONYMOUS_SHM_FILE_H_ | 20 | #ifndef MIR_CORE_ANONYMOUS_SHM_FILE_H_ |
33 | 21 | #define MIR_GRAPHICS_MESA_ANONYMOUS_SHM_FILE_H_ | 21 | #define MIR_CORE_ANONYMOUS_SHM_FILE_H_ |
34 | 22 | 22 | ||
35 | 23 | #include "shm_file.h" | 23 | #include "shm_file.h" |
36 | 24 | #include "mir/fd.h" | 24 | #include "mir/fd.h" |
37 | 25 | 25 | ||
38 | 26 | namespace mir | 26 | namespace mir |
39 | 27 | { | 27 | { |
40 | 28 | namespace graphics | ||
41 | 29 | { | ||
42 | 30 | namespace common | ||
43 | 31 | { | ||
44 | 32 | 28 | ||
45 | 33 | namespace detail | 29 | namespace detail |
46 | 34 | { | 30 | { |
47 | 35 | class MapHandle | ||
48 | 36 | { | ||
49 | 37 | public: | ||
50 | 38 | MapHandle(int fd, size_t size); | ||
51 | 39 | ~MapHandle() noexcept; | ||
52 | 40 | |||
53 | 41 | operator void*() const; | ||
54 | 42 | |||
55 | 43 | private: | ||
56 | 44 | MapHandle(MapHandle const&) = delete; | ||
57 | 45 | MapHandle& operator=(MapHandle const&) = delete; | ||
58 | 46 | size_t const size; | ||
59 | 47 | void* const mapping; | ||
60 | 48 | }; | ||
61 | 49 | } | 31 | } |
62 | 50 | 32 | ||
63 | 51 | class AnonymousShmFile : public ShmFile | 33 | class AnonymousShmFile : public ShmFile |
64 | 52 | { | 34 | { |
65 | 53 | public: | 35 | public: |
66 | 54 | AnonymousShmFile(size_t size); | 36 | AnonymousShmFile(size_t size); |
67 | 37 | ~AnonymousShmFile() noexcept; | ||
68 | 55 | 38 | ||
71 | 56 | void* base_ptr() const; | 39 | void* base_ptr() const override; |
72 | 57 | int fd() const; | 40 | int fd() const override; |
73 | 58 | 41 | ||
74 | 59 | private: | 42 | private: |
75 | 60 | Fd const fd_; | 43 | Fd const fd_; |
77 | 61 | detail::MapHandle const mapping; | 44 | class MapHandle; |
78 | 45 | std::unique_ptr<MapHandle> const mapping; | ||
79 | 62 | }; | 46 | }; |
80 | 63 | 47 | ||
81 | 64 | } | 48 | } |
82 | 65 | } | ||
83 | 66 | } | ||
84 | 67 | 49 | ||
86 | 68 | #endif /* MIR_GRAPHICS_MESA_ANONYMOUS_SHM_FILE_H_ */ | 50 | #endif /* MIR_CORE_ANONYMOUS_SHM_FILE_H_ */ |
87 | 69 | 51 | ||
88 | === renamed file 'include/common/mir/fd.h' => 'include/core/mir/fd.h' | |||
89 | === renamed file 'src/platforms/common/server/shm_file.h' => 'include/core/mir/shm_file.h' | |||
90 | --- src/platforms/common/server/shm_file.h 2017-07-28 17:00:43 +0000 | |||
91 | +++ include/core/mir/shm_file.h 2017-09-29 15:32:28 +0000 | |||
92 | @@ -17,17 +17,13 @@ | |||
93 | 17 | * Alexandros Frantzis <alexandros.frantzis@canonical.com> | 17 | * Alexandros Frantzis <alexandros.frantzis@canonical.com> |
94 | 18 | */ | 18 | */ |
95 | 19 | 19 | ||
98 | 20 | #ifndef MIR_GRAPHICS_MESA_SHM_FILE_H_ | 20 | #ifndef MIR_CORE_SHM_FILE_H_ |
99 | 21 | #define MIR_GRAPHICS_MESA_SHM_FILE_H_ | 21 | #define MIR_CORE_SHM_FILE_H_ |
100 | 22 | 22 | ||
101 | 23 | #include <cstddef> | 23 | #include <cstddef> |
102 | 24 | 24 | ||
103 | 25 | namespace mir | 25 | namespace mir |
104 | 26 | { | 26 | { |
105 | 27 | namespace graphics | ||
106 | 28 | { | ||
107 | 29 | namespace common | ||
108 | 30 | { | ||
109 | 31 | 27 | ||
110 | 32 | class ShmFile | 28 | class ShmFile |
111 | 33 | { | 29 | { |
112 | @@ -44,7 +40,5 @@ | |||
113 | 44 | }; | 40 | }; |
114 | 45 | 41 | ||
115 | 46 | } | 42 | } |
116 | 47 | } | ||
117 | 48 | } | ||
118 | 49 | 43 | ||
120 | 50 | #endif /* MIR_GRAPHICS_MESA_SHM_FILE_H_ */ | 44 | #endif /* MIR_CORE_SHM_FILE_H_ */ |
121 | 51 | 45 | ||
122 | === modified file 'src/common/fd/CMakeLists.txt' | |||
123 | --- src/common/fd/CMakeLists.txt 2017-07-28 17:00:43 +0000 | |||
124 | +++ src/common/fd/CMakeLists.txt 2017-09-29 15:32:28 +0000 | |||
125 | @@ -15,7 +15,6 @@ | |||
126 | 15 | # Authored by: Kevin DuBois <kevin.dubois@canonical.com> | 15 | # Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
127 | 16 | 16 | ||
128 | 17 | add_library(mirsharedfd OBJECT | 17 | add_library(mirsharedfd OBJECT |
129 | 18 | fd.cpp | ||
130 | 19 | fd_socket_transmission.cpp | 18 | fd_socket_transmission.cpp |
131 | 20 | ) | 19 | ) |
132 | 21 | 20 | ||
133 | 22 | 21 | ||
134 | === modified file 'src/common/symbols.map' | |||
135 | --- src/common/symbols.map 2017-05-08 03:04:26 +0000 | |||
136 | +++ src/common/symbols.map 2017-09-29 15:32:28 +0000 | |||
137 | @@ -31,9 +31,6 @@ | |||
138 | 31 | mir::dispatch::ThreadedDispatcher::remove_thread*; | 31 | mir::dispatch::ThreadedDispatcher::remove_thread*; |
139 | 32 | mir::dispatch::ThreadedDispatcher::?ThreadedDispatcher*; | 32 | mir::dispatch::ThreadedDispatcher::?ThreadedDispatcher*; |
140 | 33 | mir::dispatch::ThreadedDispatcher::ThreadedDispatcher*; | 33 | mir::dispatch::ThreadedDispatcher::ThreadedDispatcher*; |
141 | 34 | mir::Fd::Fd*; | ||
142 | 35 | mir::Fd::invalid*; | ||
143 | 36 | mir::Fd::operator*; | ||
144 | 37 | mir::graphics::NativeBuffer::?NativeBuffer*; | 34 | mir::graphics::NativeBuffer::?NativeBuffer*; |
145 | 38 | mir::graphics::NativeBuffer::NativeBuffer*; | 35 | mir::graphics::NativeBuffer::NativeBuffer*; |
146 | 39 | mir::graphics::NativeBuffer::operator*; | 36 | mir::graphics::NativeBuffer::operator*; |
147 | @@ -88,7 +85,6 @@ | |||
148 | 88 | typeinfo?for?mir::dispatch::ThreadedDispatcher; | 85 | typeinfo?for?mir::dispatch::ThreadedDispatcher; |
149 | 89 | typeinfo?for?mir::events::ContactState; | 86 | typeinfo?for?mir::events::ContactState; |
150 | 90 | typeinfo?for?mir::events::InputDeviceState; | 87 | typeinfo?for?mir::events::InputDeviceState; |
151 | 91 | typeinfo?for?mir::Fd; | ||
152 | 92 | typeinfo?for?mir::graphics::NativeBuffer; | 88 | typeinfo?for?mir::graphics::NativeBuffer; |
153 | 93 | typeinfo?for?mir::input::Keymap; | 89 | typeinfo?for?mir::input::Keymap; |
154 | 94 | typeinfo?for?mir::IntOwnedFd; | 90 | typeinfo?for?mir::IntOwnedFd; |
155 | @@ -107,7 +103,6 @@ | |||
156 | 107 | vtable?for?mir::dispatch::ThreadedDispatcher; | 103 | vtable?for?mir::dispatch::ThreadedDispatcher; |
157 | 108 | vtable?for?mir::events::ContactState; | 104 | vtable?for?mir::events::ContactState; |
158 | 109 | vtable?for?mir::events::InputDeviceState; | 105 | vtable?for?mir::events::InputDeviceState; |
159 | 110 | vtable?for?mir::Fd; | ||
160 | 111 | vtable?for?mir::graphics::NativeBuffer; | 106 | vtable?for?mir::graphics::NativeBuffer; |
161 | 112 | vtable?for?mir::input::Keymap; | 107 | vtable?for?mir::input::Keymap; |
162 | 113 | vtable?for?mir::IntOwnedFd; | 108 | vtable?for?mir::IntOwnedFd; |
163 | 114 | 109 | ||
164 | === modified file 'src/core/CMakeLists.txt' | |||
165 | --- src/core/CMakeLists.txt 2017-06-16 10:14:10 +0000 | |||
166 | +++ src/core/CMakeLists.txt 2017-09-29 15:32:28 +0000 | |||
167 | @@ -4,13 +4,17 @@ | |||
168 | 4 | string (REPLACE " -pthread " " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) | 4 | string (REPLACE " -pthread " " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
169 | 5 | 5 | ||
170 | 6 | add_library(mircore SHARED | 6 | add_library(mircore SHARED |
171 | 7 | anonymous_shm_file.cpp | ||
172 | 7 | fatal.cpp | 8 | fatal.cpp |
173 | 9 | fd.cpp | ||
174 | 8 | geometry/rectangle.cpp | 10 | geometry/rectangle.cpp |
175 | 9 | geometry/rectangles.cpp | 11 | geometry/rectangles.cpp |
176 | 10 | geometry/ostream.cpp | 12 | geometry/ostream.cpp |
177 | 13 | ${PROJECT_SOURCE_DIR}/include/core/mir/anonymous_shm_file.h | ||
178 | 11 | ${PROJECT_SOURCE_DIR}/include/core/mir/int_wrapper.h | 14 | ${PROJECT_SOURCE_DIR}/include/core/mir/int_wrapper.h |
179 | 12 | ${PROJECT_SOURCE_DIR}/include/core/mir/optional_value.h | 15 | ${PROJECT_SOURCE_DIR}/include/core/mir/optional_value.h |
180 | 13 | ${PROJECT_SOURCE_DIR}/include/core/mir/fatal.h | 16 | ${PROJECT_SOURCE_DIR}/include/core/mir/fatal.h |
181 | 17 | ${PROJECT_SOURCE_DIR}/include/core/mir/fd.h | ||
182 | 14 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/length.h | 18 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/length.h |
183 | 15 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/rectangle.h | 19 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/rectangle.h |
184 | 16 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/point.h | 20 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/point.h |
185 | @@ -19,10 +23,17 @@ | |||
186 | 19 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/size.h | 23 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/size.h |
187 | 20 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/forward.h | 24 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/forward.h |
188 | 21 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/dimensions.h | 25 | ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/dimensions.h |
189 | 26 | ${PROJECT_SOURCE_DIR}/include/core/mir/shm_file.h | ||
190 | 22 | ${PROJECT_SOURCE_DIR}/include/core/mir_toolkit/common.h | 27 | ${PROJECT_SOURCE_DIR}/include/core/mir_toolkit/common.h |
191 | 23 | ${PROJECT_SOURCE_DIR}/include/core/mir_toolkit/mir_version_number.h | 28 | ${PROJECT_SOURCE_DIR}/include/core/mir_toolkit/mir_version_number.h |
192 | 24 | ) | 29 | ) |
193 | 25 | 30 | ||
194 | 31 | target_link_libraries( | ||
195 | 32 | mircore | ||
196 | 33 | |||
197 | 34 | ${Boost_SYSTEM_LIBRARY} | ||
198 | 35 | ) | ||
199 | 36 | |||
200 | 26 | set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map) | 37 | set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map) |
201 | 27 | 38 | ||
202 | 28 | set_target_properties(mircore | 39 | set_target_properties(mircore |
203 | 29 | 40 | ||
204 | === renamed file 'src/platforms/common/server/anonymous_shm_file.cpp' => 'src/core/anonymous_shm_file.cpp' | |||
205 | --- src/platforms/common/server/anonymous_shm_file.cpp 2017-07-28 17:00:43 +0000 | |||
206 | +++ src/core/anonymous_shm_file.cpp 2017-09-29 15:32:28 +0000 | |||
207 | @@ -17,7 +17,7 @@ | |||
208 | 17 | * Alexandros Frantzis <alexandros.frantzis@canonical.com> | 17 | * Alexandros Frantzis <alexandros.frantzis@canonical.com> |
209 | 18 | */ | 18 | */ |
210 | 19 | 19 | ||
212 | 20 | #include "anonymous_shm_file.h" | 20 | #include "mir/anonymous_shm_file.h" |
213 | 21 | 21 | ||
214 | 22 | #include <boost/throw_exception.hpp> | 22 | #include <boost/throw_exception.hpp> |
215 | 23 | #include <boost/filesystem.hpp> | 23 | #include <boost/filesystem.hpp> |
216 | @@ -30,8 +30,6 @@ | |||
217 | 30 | #include <sys/mman.h> | 30 | #include <sys/mman.h> |
218 | 31 | #include <fcntl.h> | 31 | #include <fcntl.h> |
219 | 32 | 32 | ||
220 | 33 | namespace mgc = mir::graphics::common; | ||
221 | 34 | |||
222 | 35 | namespace | 33 | namespace |
223 | 36 | { | 34 | { |
224 | 37 | 35 | ||
225 | @@ -87,43 +85,53 @@ | |||
226 | 87 | * MapHandle * | 85 | * MapHandle * |
227 | 88 | *************/ | 86 | *************/ |
228 | 89 | 87 | ||
249 | 90 | mgc::detail::MapHandle::MapHandle(int fd, size_t size) | 88 | class mir::AnonymousShmFile::MapHandle |
250 | 91 | : size{size}, | 89 | { |
251 | 92 | mapping{mmap(nullptr, size, PROT_READ|PROT_WRITE, | 90 | public: |
252 | 93 | MAP_SHARED, fd, 0)} | 91 | MapHandle(int fd, size_t size) |
253 | 94 | { | 92 | : size{size}, |
254 | 95 | if (mapping == MAP_FAILED) | 93 | mapping{mmap(nullptr, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)} |
255 | 96 | BOOST_THROW_EXCEPTION( | 94 | { |
256 | 97 | std::system_error(errno, std::system_category(), "Failed to map file")); | 95 | if (mapping == MAP_FAILED) |
257 | 98 | } | 96 | BOOST_THROW_EXCEPTION( |
258 | 99 | 97 | std::system_error(errno, std::system_category(), "Failed to map file")); | |
259 | 100 | mgc::detail::MapHandle::~MapHandle() noexcept | 98 | } |
260 | 101 | { | 99 | |
261 | 102 | munmap(mapping, size); | 100 | ~MapHandle() noexcept |
262 | 103 | } | 101 | { |
263 | 104 | 102 | munmap(mapping, size); | |
264 | 105 | mgc::detail::MapHandle::operator void*() const | 103 | } |
265 | 106 | { | 104 | |
266 | 107 | return mapping; | 105 | operator void*() const |
267 | 108 | 106 | { | |
268 | 109 | } | 107 | return mapping; |
269 | 108 | } | ||
270 | 109 | |||
271 | 110 | private: | ||
272 | 111 | MapHandle(MapHandle const&) = delete; | ||
273 | 112 | MapHandle& operator=(MapHandle const&) = delete; | ||
274 | 113 | size_t const size; | ||
275 | 114 | void* const mapping; | ||
276 | 115 | }; | ||
277 | 110 | 116 | ||
278 | 111 | /******************** | 117 | /******************** |
279 | 112 | * AnonymousShmFile * | 118 | * AnonymousShmFile * |
280 | 113 | ********************/ | 119 | ********************/ |
281 | 114 | 120 | ||
283 | 115 | mgc::AnonymousShmFile::AnonymousShmFile(size_t size) | 121 | mir::AnonymousShmFile::AnonymousShmFile(size_t size) |
284 | 116 | : fd_{create_anonymous_file(size)}, | 122 | : fd_{create_anonymous_file(size)}, |
295 | 117 | mapping{fd_, size} | 123 | mapping{new MapHandle(fd_, size)} |
296 | 118 | { | 124 | { |
297 | 119 | } | 125 | } |
298 | 120 | 126 | ||
299 | 121 | void* mgc::AnonymousShmFile::base_ptr() const | 127 | mir::AnonymousShmFile::~AnonymousShmFile() noexcept = default; |
300 | 122 | { | 128 | |
301 | 123 | return mapping; | 129 | void* mir::AnonymousShmFile::base_ptr() const |
302 | 124 | } | 130 | { |
303 | 125 | 131 | return *mapping; | |
304 | 126 | int mgc::AnonymousShmFile::fd() const | 132 | } |
305 | 133 | |||
306 | 134 | int mir::AnonymousShmFile::fd() const | ||
307 | 127 | { | 135 | { |
308 | 128 | return fd_; | 136 | return fd_; |
309 | 129 | } | 137 | } |
310 | 130 | 138 | ||
311 | === renamed file 'src/common/fd/fd.cpp' => 'src/core/fd.cpp' | |||
312 | === modified file 'src/core/symbols.map' | |||
313 | --- src/core/symbols.map 2017-05-08 03:04:26 +0000 | |||
314 | +++ src/core/symbols.map 2017-09-29 15:32:28 +0000 | |||
315 | @@ -47,5 +47,29 @@ | |||
316 | 47 | vtable?for?mir::geometry::Rectangles; | 47 | vtable?for?mir::geometry::Rectangles; |
317 | 48 | vtable?for?mir::geometry::Size; | 48 | vtable?for?mir::geometry::Size; |
318 | 49 | }; | 49 | }; |
319 | 50 | local: *; | ||
320 | 51 | }; | 50 | }; |
321 | 51 | |||
322 | 52 | MIR_CORE_1.0 { | ||
323 | 53 | global: | ||
324 | 54 | extern "C++" { | ||
325 | 55 | mir::Fd::Fd*; | ||
326 | 56 | mir::Fd::invalid*; | ||
327 | 57 | mir::Fd::operator*; | ||
328 | 58 | mir::AnonymousShmFile::AnonymousShmFile*; | ||
329 | 59 | mir::AnonymousShmFile::?AnonymousShmFile*; | ||
330 | 60 | mir::AnonymousShmFile::base_ptr*; | ||
331 | 61 | mir::AnonymousShmFile::fd*; | ||
332 | 62 | mir::ShmFile::ShmFile*; | ||
333 | 63 | mir::ShmFile::?ShmFile*; | ||
334 | 64 | mir::ShmFile::base_ptr*; | ||
335 | 65 | mir::ShmFile::fd*; | ||
336 | 66 | |||
337 | 67 | typeinfo?for?mir::Fd; | ||
338 | 68 | typeinfo?for?mir::AnonymousShmFile; | ||
339 | 69 | typeinfo?for?mir::ShmFile; | ||
340 | 70 | vtable?for?mir::Fd; | ||
341 | 71 | vtable?for?mir::AnonymousShmFile; | ||
342 | 72 | vtable?for?mir::ShmFile; | ||
343 | 73 | }; | ||
344 | 74 | local: *; | ||
345 | 75 | } MIR_CORE_0.25; | ||
346 | 52 | \ No newline at end of file | 76 | \ No newline at end of file |
347 | 53 | 77 | ||
348 | === modified file 'src/miral/application_authorizer.cpp' | |||
349 | --- src/miral/application_authorizer.cpp 2017-08-21 14:18:55 +0000 | |||
350 | +++ src/miral/application_authorizer.cpp 2017-09-29 15:32:28 +0000 | |||
351 | @@ -96,7 +96,7 @@ | |||
352 | 96 | 96 | ||
353 | 97 | void miral::BasicSetApplicationAuthorizer::operator()(mir::Server& server) | 97 | void miral::BasicSetApplicationAuthorizer::operator()(mir::Server& server) |
354 | 98 | { | 98 | { |
356 | 99 | server.override_the_session_authorizer([this, &server]() | 99 | server.override_the_session_authorizer([this]() |
357 | 100 | -> std::shared_ptr<mf::SessionAuthorizer> | 100 | -> std::shared_ptr<mf::SessionAuthorizer> |
358 | 101 | { | 101 | { |
359 | 102 | auto wrapped = self->builder(); | 102 | auto wrapped = self->builder(); |
360 | 103 | 103 | ||
361 | === modified file 'src/platforms/common/server/CMakeLists.txt' | |||
362 | --- src/platforms/common/server/CMakeLists.txt 2017-05-31 17:56:19 +0000 | |||
363 | +++ src/platforms/common/server/CMakeLists.txt 2017-09-29 15:32:28 +0000 | |||
364 | @@ -9,9 +9,7 @@ | |||
365 | 9 | 9 | ||
366 | 10 | add_library(server_platform_common STATIC | 10 | add_library(server_platform_common STATIC |
367 | 11 | platform_authentication_wrapper.cpp | 11 | platform_authentication_wrapper.cpp |
368 | 12 | anonymous_shm_file.cpp | ||
369 | 13 | shm_buffer.cpp | 12 | shm_buffer.cpp |
370 | 14 | shm_file.h | ||
371 | 15 | ) | 13 | ) |
372 | 16 | 14 | ||
373 | 17 | target_link_libraries( | 15 | target_link_libraries( |
374 | 18 | 16 | ||
375 | === modified file 'src/platforms/common/server/shm_buffer.cpp' | |||
376 | --- src/platforms/common/server/shm_buffer.cpp 2017-07-28 17:00:43 +0000 | |||
377 | +++ src/platforms/common/server/shm_buffer.cpp 2017-09-29 15:32:28 +0000 | |||
378 | @@ -18,7 +18,7 @@ | |||
379 | 18 | */ | 18 | */ |
380 | 19 | 19 | ||
381 | 20 | #include "mir/graphics/gl_format.h" | 20 | #include "mir/graphics/gl_format.h" |
383 | 21 | #include "shm_file.h" | 21 | #include "mir/shm_file.h" |
384 | 22 | #include "shm_buffer.h" | 22 | #include "shm_buffer.h" |
385 | 23 | #include "buffer_texture_binder.h" | 23 | #include "buffer_texture_binder.h" |
386 | 24 | 24 | ||
387 | 25 | 25 | ||
388 | === modified file 'src/platforms/common/server/shm_buffer.h' | |||
389 | --- src/platforms/common/server/shm_buffer.h 2017-07-28 17:00:43 +0000 | |||
390 | +++ src/platforms/common/server/shm_buffer.h 2017-09-29 15:32:28 +0000 | |||
391 | @@ -30,12 +30,13 @@ | |||
392 | 30 | 30 | ||
393 | 31 | namespace mir | 31 | namespace mir |
394 | 32 | { | 32 | { |
395 | 33 | class ShmFile; | ||
396 | 34 | |||
397 | 33 | namespace graphics | 35 | namespace graphics |
398 | 34 | { | 36 | { |
399 | 35 | namespace common | 37 | namespace common |
400 | 36 | { | 38 | { |
401 | 37 | 39 | ||
402 | 38 | class ShmFile; | ||
403 | 39 | 40 | ||
404 | 40 | class ShmBuffer : public BufferBasic, public NativeBufferBase, | 41 | class ShmBuffer : public BufferBasic, public NativeBufferBase, |
405 | 41 | public renderer::gl::TextureSource, | 42 | public renderer::gl::TextureSource, |
406 | 42 | 43 | ||
407 | === modified file 'src/platforms/eglstream-kms/server/buffer_allocator.cpp' | |||
408 | --- src/platforms/eglstream-kms/server/buffer_allocator.cpp 2017-07-28 17:00:43 +0000 | |||
409 | +++ src/platforms/eglstream-kms/server/buffer_allocator.cpp 2017-09-29 15:32:28 +0000 | |||
410 | @@ -19,7 +19,7 @@ | |||
411 | 19 | 19 | ||
412 | 20 | #include "buffer_allocator.h" | 20 | #include "buffer_allocator.h" |
413 | 21 | #include "buffer_texture_binder.h" | 21 | #include "buffer_texture_binder.h" |
415 | 22 | #include "anonymous_shm_file.h" | 22 | #include "mir/anonymous_shm_file.h" |
416 | 23 | #include "shm_buffer.h" | 23 | #include "shm_buffer.h" |
417 | 24 | #include "mir/graphics/buffer_properties.h" | 24 | #include "mir/graphics/buffer_properties.h" |
418 | 25 | #include "software_buffer.h" | 25 | #include "software_buffer.h" |
419 | @@ -58,7 +58,7 @@ | |||
420 | 58 | auto const stride = geom::Stride{ MIR_BYTES_PER_PIXEL(format) * size.width.as_uint32_t() }; | 58 | auto const stride = geom::Stride{ MIR_BYTES_PER_PIXEL(format) * size.width.as_uint32_t() }; |
421 | 59 | size_t const size_in_bytes = stride.as_int() * size.height.as_int(); | 59 | size_t const size_in_bytes = stride.as_int() * size.height.as_int(); |
422 | 60 | return std::make_shared<mge::SoftwareBuffer>( | 60 | return std::make_shared<mge::SoftwareBuffer>( |
424 | 61 | std::make_unique<mgc::AnonymousShmFile>(size_in_bytes), size, format); | 61 | std::make_unique<mir::AnonymousShmFile>(size_in_bytes), size, format); |
425 | 62 | } | 62 | } |
426 | 63 | 63 | ||
427 | 64 | std::vector<MirPixelFormat> mge::BufferAllocator::supported_pixel_formats() | 64 | std::vector<MirPixelFormat> mge::BufferAllocator::supported_pixel_formats() |
428 | 65 | 65 | ||
429 | === modified file 'src/platforms/eglstream-kms/server/software_buffer.cpp' | |||
430 | --- src/platforms/eglstream-kms/server/software_buffer.cpp 2017-07-28 17:00:43 +0000 | |||
431 | +++ src/platforms/eglstream-kms/server/software_buffer.cpp 2017-09-29 15:32:28 +0000 | |||
432 | @@ -17,7 +17,7 @@ | |||
433 | 17 | */ | 17 | */ |
434 | 18 | 18 | ||
435 | 19 | #include "software_buffer.h" | 19 | #include "software_buffer.h" |
437 | 20 | #include "shm_file.h" | 20 | #include "mir/shm_file.h" |
438 | 21 | #include "native_buffer.h" | 21 | #include "native_buffer.h" |
439 | 22 | 22 | ||
440 | 23 | namespace mg = mir::graphics; | 23 | namespace mg = mir::graphics; |
441 | @@ -26,7 +26,7 @@ | |||
442 | 26 | namespace geom = mir::geometry; | 26 | namespace geom = mir::geometry; |
443 | 27 | 27 | ||
444 | 28 | mge::SoftwareBuffer::SoftwareBuffer( | 28 | mge::SoftwareBuffer::SoftwareBuffer( |
446 | 29 | std::unique_ptr<mgc::ShmFile> shm_file, | 29 | std::unique_ptr<mir::ShmFile> shm_file, |
447 | 30 | geom::Size const& size, | 30 | geom::Size const& size, |
448 | 31 | MirPixelFormat const& pixel_format) : | 31 | MirPixelFormat const& pixel_format) : |
449 | 32 | ShmBuffer(std::move(shm_file), size, pixel_format), | 32 | ShmBuffer(std::move(shm_file), size, pixel_format), |
450 | 33 | 33 | ||
451 | === modified file 'src/platforms/eglstream-kms/server/software_buffer.h' | |||
452 | --- src/platforms/eglstream-kms/server/software_buffer.h 2017-07-28 17:00:43 +0000 | |||
453 | +++ src/platforms/eglstream-kms/server/software_buffer.h 2017-09-29 15:32:28 +0000 | |||
454 | @@ -23,12 +23,10 @@ | |||
455 | 23 | 23 | ||
456 | 24 | namespace mir | 24 | namespace mir |
457 | 25 | { | 25 | { |
458 | 26 | class ShmFile; | ||
459 | 27 | |||
460 | 26 | namespace graphics | 28 | namespace graphics |
461 | 27 | { | 29 | { |
462 | 28 | namespace common | ||
463 | 29 | { | ||
464 | 30 | class ShmFile; | ||
465 | 31 | } | ||
466 | 32 | namespace eglstream | 30 | namespace eglstream |
467 | 33 | { | 31 | { |
468 | 34 | 32 | ||
469 | @@ -36,7 +34,7 @@ | |||
470 | 36 | { | 34 | { |
471 | 37 | public: | 35 | public: |
472 | 38 | SoftwareBuffer( | 36 | SoftwareBuffer( |
474 | 39 | std::unique_ptr<common::ShmFile> shm_file, | 37 | std::unique_ptr<ShmFile> shm_file, |
475 | 40 | geometry::Size const& size, | 38 | geometry::Size const& size, |
476 | 41 | MirPixelFormat const& pixel_format); | 39 | MirPixelFormat const& pixel_format); |
477 | 42 | 40 | ||
478 | 43 | 41 | ||
479 | === modified file 'src/platforms/mesa/server/buffer_allocator.cpp' | |||
480 | --- src/platforms/mesa/server/buffer_allocator.cpp 2017-09-21 07:24:28 +0000 | |||
481 | +++ src/platforms/mesa/server/buffer_allocator.cpp 2017-09-29 15:32:28 +0000 | |||
482 | @@ -20,7 +20,7 @@ | |||
483 | 20 | #include "buffer_allocator.h" | 20 | #include "buffer_allocator.h" |
484 | 21 | #include "gbm_buffer.h" | 21 | #include "gbm_buffer.h" |
485 | 22 | #include "buffer_texture_binder.h" | 22 | #include "buffer_texture_binder.h" |
487 | 23 | #include "anonymous_shm_file.h" | 23 | #include "mir/anonymous_shm_file.h" |
488 | 24 | #include "shm_buffer.h" | 24 | #include "shm_buffer.h" |
489 | 25 | #include "display_helpers.h" | 25 | #include "display_helpers.h" |
490 | 26 | #include "software_buffer.h" | 26 | #include "software_buffer.h" |
491 | @@ -295,7 +295,7 @@ | |||
492 | 295 | auto const stride = geom::Stride{MIR_BYTES_PER_PIXEL(format) * size.width.as_uint32_t()}; | 295 | auto const stride = geom::Stride{MIR_BYTES_PER_PIXEL(format) * size.width.as_uint32_t()}; |
493 | 296 | size_t const size_in_bytes = stride.as_int() * size.height.as_int(); | 296 | size_t const size_in_bytes = stride.as_int() * size.height.as_int(); |
494 | 297 | return std::make_shared<mgm::SoftwareBuffer>( | 297 | return std::make_shared<mgm::SoftwareBuffer>( |
496 | 298 | std::make_unique<mgc::AnonymousShmFile>(size_in_bytes), size, format); | 298 | std::make_unique<mir::AnonymousShmFile>(size_in_bytes), size, format); |
497 | 299 | } | 299 | } |
498 | 300 | 300 | ||
499 | 301 | std::vector<MirPixelFormat> mgm::BufferAllocator::supported_pixel_formats() | 301 | std::vector<MirPixelFormat> mgm::BufferAllocator::supported_pixel_formats() |
500 | 302 | 302 | ||
501 | === modified file 'src/platforms/mesa/server/software_buffer.cpp' | |||
502 | --- src/platforms/mesa/server/software_buffer.cpp 2017-07-28 17:00:43 +0000 | |||
503 | +++ src/platforms/mesa/server/software_buffer.cpp 2017-09-29 15:32:28 +0000 | |||
504 | @@ -17,7 +17,7 @@ | |||
505 | 17 | */ | 17 | */ |
506 | 18 | 18 | ||
507 | 19 | #include "software_buffer.h" | 19 | #include "software_buffer.h" |
509 | 20 | #include "shm_file.h" | 20 | #include "mir/shm_file.h" |
510 | 21 | #include "native_buffer.h" | 21 | #include "native_buffer.h" |
511 | 22 | 22 | ||
512 | 23 | namespace mg = mir::graphics; | 23 | namespace mg = mir::graphics; |
513 | @@ -26,7 +26,7 @@ | |||
514 | 26 | namespace geom = mir::geometry; | 26 | namespace geom = mir::geometry; |
515 | 27 | 27 | ||
516 | 28 | mgm::SoftwareBuffer::SoftwareBuffer( | 28 | mgm::SoftwareBuffer::SoftwareBuffer( |
518 | 29 | std::unique_ptr<mgc::ShmFile> shm_file, | 29 | std::unique_ptr<mir::ShmFile> shm_file, |
519 | 30 | geom::Size const& size, | 30 | geom::Size const& size, |
520 | 31 | MirPixelFormat const& pixel_format) : | 31 | MirPixelFormat const& pixel_format) : |
521 | 32 | ShmBuffer(std::move(shm_file), size, pixel_format), | 32 | ShmBuffer(std::move(shm_file), size, pixel_format), |
522 | 33 | 33 | ||
523 | === modified file 'src/platforms/mesa/server/software_buffer.h' | |||
524 | --- src/platforms/mesa/server/software_buffer.h 2017-07-28 17:00:43 +0000 | |||
525 | +++ src/platforms/mesa/server/software_buffer.h 2017-09-29 15:32:28 +0000 | |||
526 | @@ -23,12 +23,10 @@ | |||
527 | 23 | 23 | ||
528 | 24 | namespace mir | 24 | namespace mir |
529 | 25 | { | 25 | { |
530 | 26 | class ShmFile; | ||
531 | 27 | |||
532 | 26 | namespace graphics | 28 | namespace graphics |
533 | 27 | { | 29 | { |
534 | 28 | namespace common | ||
535 | 29 | { | ||
536 | 30 | class ShmFile; | ||
537 | 31 | } | ||
538 | 32 | namespace mesa | 30 | namespace mesa |
539 | 33 | { | 31 | { |
540 | 34 | 32 | ||
541 | @@ -36,7 +34,7 @@ | |||
542 | 36 | { | 34 | { |
543 | 37 | public: | 35 | public: |
544 | 38 | SoftwareBuffer( | 36 | SoftwareBuffer( |
546 | 39 | std::unique_ptr<common::ShmFile> shm_file, | 37 | std::unique_ptr<ShmFile> shm_file, |
547 | 40 | geometry::Size const& size, | 38 | geometry::Size const& size, |
548 | 41 | MirPixelFormat const& pixel_format); | 39 | MirPixelFormat const& pixel_format); |
549 | 42 | 40 | ||
550 | 43 | 41 | ||
551 | === modified file 'src/server/frontend/wayland/wayland_connector.cpp' | |||
552 | --- src/server/frontend/wayland/wayland_connector.cpp 2017-09-28 02:05:19 +0000 | |||
553 | +++ src/server/frontend/wayland/wayland_connector.cpp 2017-09-29 15:32:28 +0000 | |||
554 | @@ -53,6 +53,7 @@ | |||
555 | 53 | #include <functional> | 53 | #include <functional> |
556 | 54 | #include <type_traits> | 54 | #include <type_traits> |
557 | 55 | 55 | ||
558 | 56 | #include <xkbcommon/xkbcommon.h> | ||
559 | 56 | #include <linux/input.h> | 57 | #include <linux/input.h> |
560 | 57 | #include <algorithm> | 58 | #include <algorithm> |
561 | 58 | #include <iostream> | 59 | #include <iostream> |
562 | @@ -66,6 +67,7 @@ | |||
563 | 66 | #include "../../../platforms/common/server/shm_buffer.h" | 67 | #include "../../../platforms/common/server/shm_buffer.h" |
564 | 67 | 68 | ||
565 | 68 | #include <sys/stat.h> | 69 | #include <sys/stat.h> |
566 | 70 | #include "mir/anonymous_shm_file.h" | ||
567 | 69 | 71 | ||
568 | 70 | namespace mf = mir::frontend; | 72 | namespace mf = mir::frontend; |
569 | 71 | namespace mg = mir::graphics; | 73 | namespace mg = mir::graphics; |
570 | @@ -799,10 +801,29 @@ | |||
571 | 799 | std::function<void(WlKeyboard*)> const& on_destroy, | 801 | std::function<void(WlKeyboard*)> const& on_destroy, |
572 | 800 | std::shared_ptr<mir::Executor> const& executor) | 802 | std::shared_ptr<mir::Executor> const& executor) |
573 | 801 | : Keyboard(client, parent, id), | 803 | : Keyboard(client, parent, id), |
574 | 804 | keymap{nullptr, &xkb_keymap_unref}, | ||
575 | 805 | state{nullptr, &xkb_state_unref}, | ||
576 | 806 | context{xkb_context_new(XKB_CONTEXT_NO_FLAGS), &xkb_context_unref}, | ||
577 | 802 | executor{executor}, | 807 | executor{executor}, |
578 | 803 | on_destroy{on_destroy}, | 808 | on_destroy{on_destroy}, |
579 | 804 | destroyed{std::make_shared<bool>(false)} | 809 | destroyed{std::make_shared<bool>(false)} |
580 | 805 | { | 810 | { |
581 | 811 | // TODO: We should really grab the keymap for the focused surface when | ||
582 | 812 | // we receive focus. | ||
583 | 813 | |||
584 | 814 | xkb_rule_names default_rules; | ||
585 | 815 | memset(&default_rules, 0, sizeof(default_rules)); | ||
586 | 816 | |||
587 | 817 | keymap = decltype(keymap){ | ||
588 | 818 | xkb_keymap_new_from_names( | ||
589 | 819 | context.get(), | ||
590 | 820 | &default_rules, | ||
591 | 821 | XKB_KEYMAP_COMPILE_NO_FLAGS), | ||
592 | 822 | &xkb_keymap_unref}; | ||
593 | 823 | |||
594 | 824 | state = decltype(state){ | ||
595 | 825 | xkb_state_new(keymap.get()), | ||
596 | 826 | &xkb_state_unref}; | ||
597 | 806 | } | 827 | } |
598 | 807 | 828 | ||
599 | 808 | ~WlKeyboard() | 829 | ~WlKeyboard() |
600 | @@ -820,13 +841,19 @@ | |||
601 | 820 | this | 841 | this |
602 | 821 | ] () | 842 | ] () |
603 | 822 | { | 843 | { |
607 | 823 | int const serial = wl_display_next_serial(wl_client_get_display(client)); | 844 | auto const serial = wl_display_next_serial(wl_client_get_display(client)); |
608 | 824 | auto event = mir_event_get_input_event(ev); | 845 | auto const event = mir_event_get_input_event(ev); |
609 | 825 | auto key_event = mir_input_event_get_keyboard_event(event); | 846 | auto const key_event = mir_input_event_get_keyboard_event(event); |
610 | 847 | auto const scancode = mir_keyboard_event_scan_code(key_event); | ||
611 | 848 | /* | ||
612 | 849 | * HACK! Maintain our own XKB state, so we can serialise it for | ||
613 | 850 | * wl_keyboard_send_modifiers | ||
614 | 851 | */ | ||
615 | 826 | 852 | ||
616 | 827 | switch (mir_keyboard_event_action(key_event)) | 853 | switch (mir_keyboard_event_action(key_event)) |
617 | 828 | { | 854 | { |
618 | 829 | case mir_keyboard_action_up: | 855 | case mir_keyboard_action_up: |
619 | 856 | xkb_state_update_key(state.get(), scancode + 8, XKB_KEY_UP); | ||
620 | 830 | wl_keyboard_send_key(resource, | 857 | wl_keyboard_send_key(resource, |
621 | 831 | serial, | 858 | serial, |
622 | 832 | mir_input_event_get_event_time(event) / 1000, | 859 | mir_input_event_get_event_time(event) / 1000, |
623 | @@ -834,6 +861,7 @@ | |||
624 | 834 | WL_KEYBOARD_KEY_STATE_RELEASED); | 861 | WL_KEYBOARD_KEY_STATE_RELEASED); |
625 | 835 | break; | 862 | break; |
626 | 836 | case mir_keyboard_action_down: | 863 | case mir_keyboard_action_down: |
627 | 864 | xkb_state_update_key(state.get(), scancode + 8, XKB_KEY_DOWN); | ||
628 | 837 | wl_keyboard_send_key(resource, | 865 | wl_keyboard_send_key(resource, |
629 | 838 | serial, | 866 | serial, |
630 | 839 | mir_input_event_get_event_time(event) / 1000, | 867 | mir_input_event_get_event_time(event) / 1000, |
631 | @@ -843,6 +871,38 @@ | |||
632 | 843 | default: | 871 | default: |
633 | 844 | break; | 872 | break; |
634 | 845 | } | 873 | } |
635 | 874 | |||
636 | 875 | auto new_depressed_mods = xkb_state_serialize_mods( | ||
637 | 876 | state.get(), | ||
638 | 877 | XKB_STATE_MODS_DEPRESSED); | ||
639 | 878 | auto new_latched_mods = xkb_state_serialize_mods( | ||
640 | 879 | state.get(), | ||
641 | 880 | XKB_STATE_MODS_LATCHED); | ||
642 | 881 | auto new_locked_mods = xkb_state_serialize_mods( | ||
643 | 882 | state.get(), | ||
644 | 883 | XKB_STATE_MODS_LOCKED); | ||
645 | 884 | auto new_group = xkb_state_serialize_layout( | ||
646 | 885 | state.get(), | ||
647 | 886 | XKB_STATE_LAYOUT_EFFECTIVE); | ||
648 | 887 | |||
649 | 888 | if ((new_depressed_mods != mods_depressed) || | ||
650 | 889 | (new_latched_mods != mods_latched) || | ||
651 | 890 | (new_locked_mods != mods_locked) || | ||
652 | 891 | (new_group != group)) | ||
653 | 892 | { | ||
654 | 893 | mods_depressed = new_depressed_mods; | ||
655 | 894 | mods_latched = new_latched_mods; | ||
656 | 895 | mods_locked = new_locked_mods; | ||
657 | 896 | group = new_group; | ||
658 | 897 | |||
659 | 898 | wl_keyboard_send_modifiers( | ||
660 | 899 | resource, | ||
661 | 900 | wl_display_get_serial(wl_client_get_display(client)), | ||
662 | 901 | mods_depressed, | ||
663 | 902 | mods_latched, | ||
664 | 903 | mods_locked, | ||
665 | 904 | group); | ||
666 | 905 | } | ||
667 | 846 | })); | 906 | })); |
668 | 847 | } | 907 | } |
669 | 848 | 908 | ||
670 | @@ -861,6 +921,11 @@ | |||
671 | 861 | auto const serial = wl_display_next_serial(wl_client_get_display(client)); | 921 | auto const serial = wl_display_next_serial(wl_client_get_display(client)); |
672 | 862 | if (focussed) | 922 | if (focussed) |
673 | 863 | { | 923 | { |
674 | 924 | /* | ||
675 | 925 | * TODO: | ||
676 | 926 | * *) Send the actual modifier state here. | ||
677 | 927 | * *) Send the surface's keymap here. | ||
678 | 928 | */ | ||
679 | 864 | wl_array key_state; | 929 | wl_array key_state; |
680 | 865 | wl_array_init(&key_state); | 930 | wl_array_init(&key_state); |
681 | 866 | wl_keyboard_send_enter(resource, serial, target, &key_state); | 931 | wl_keyboard_send_enter(resource, serial, target, &key_state); |
682 | @@ -874,11 +939,47 @@ | |||
683 | 874 | } | 939 | } |
684 | 875 | } | 940 | } |
685 | 876 | 941 | ||
686 | 942 | void handle_event(MirKeymapEvent const* event, wl_resource* /*target*/) | ||
687 | 943 | { | ||
688 | 944 | char const* buffer; | ||
689 | 945 | size_t length; | ||
690 | 946 | |||
691 | 947 | mir_keymap_event_get_keymap_buffer(event, &buffer, &length); | ||
692 | 948 | |||
693 | 949 | mir::AnonymousShmFile shm_buffer{length}; | ||
694 | 950 | memcpy(shm_buffer.base_ptr(), buffer, length); | ||
695 | 951 | |||
696 | 952 | wl_keyboard_send_keymap( | ||
697 | 953 | resource, | ||
698 | 954 | WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, | ||
699 | 955 | shm_buffer.fd(), | ||
700 | 956 | length); | ||
701 | 957 | |||
702 | 958 | keymap = decltype(keymap)(xkb_keymap_new_from_buffer( | ||
703 | 959 | context.get(), | ||
704 | 960 | buffer, | ||
705 | 961 | length, | ||
706 | 962 | XKB_KEYMAP_FORMAT_TEXT_V1, | ||
707 | 963 | XKB_KEYMAP_COMPILE_NO_FLAGS), | ||
708 | 964 | &xkb_keymap_unref); | ||
709 | 965 | |||
710 | 966 | state = decltype(state)(xkb_state_new(keymap.get()), &xkb_state_unref); | ||
711 | 967 | } | ||
712 | 968 | |||
713 | 877 | private: | 969 | private: |
714 | 970 | std::unique_ptr<xkb_keymap, decltype(&xkb_keymap_unref)> keymap; | ||
715 | 971 | std::unique_ptr<xkb_state, decltype(&xkb_state_unref)> state; | ||
716 | 972 | std::unique_ptr<xkb_context, decltype(&xkb_context_unref)> const context; | ||
717 | 973 | |||
718 | 878 | std::shared_ptr<mir::Executor> const executor; | 974 | std::shared_ptr<mir::Executor> const executor; |
719 | 879 | std::function<void(WlKeyboard*)> on_destroy; | 975 | std::function<void(WlKeyboard*)> on_destroy; |
720 | 880 | std::shared_ptr<bool> const destroyed; | 976 | std::shared_ptr<bool> const destroyed; |
721 | 881 | 977 | ||
722 | 978 | uint32_t mods_depressed{0}; | ||
723 | 979 | uint32_t mods_latched{0}; | ||
724 | 980 | uint32_t mods_locked{0}; | ||
725 | 981 | uint32_t group{0}; | ||
726 | 982 | |||
727 | 882 | void release() override; | 983 | void release() override; |
728 | 883 | }; | 984 | }; |
729 | 884 | 985 | ||
730 | @@ -1202,6 +1303,15 @@ | |||
731 | 1202 | } | 1303 | } |
732 | 1203 | } | 1304 | } |
733 | 1204 | 1305 | ||
734 | 1306 | void handle_event(MirKeymapEvent const* event, wl_resource* target) const | ||
735 | 1307 | { | ||
736 | 1308 | std::lock_guard<std::mutex> lock{mutex}; | ||
737 | 1309 | for (auto& listener : listeners) | ||
738 | 1310 | { | ||
739 | 1311 | listener->handle_event(event, target); | ||
740 | 1312 | } | ||
741 | 1313 | } | ||
742 | 1314 | |||
743 | 1205 | private: | 1315 | private: |
744 | 1206 | std::mutex mutable mutex; | 1316 | std::mutex mutable mutex; |
745 | 1207 | std::vector<InputInterface*> listeners; | 1317 | std::vector<InputInterface*> listeners; |
746 | @@ -1450,6 +1560,13 @@ | |||
747 | 1450 | } | 1560 | } |
748 | 1451 | break; | 1561 | break; |
749 | 1452 | } | 1562 | } |
750 | 1563 | case mir_event_type_keymap: | ||
751 | 1564 | { | ||
752 | 1565 | auto const map_ev = mir_event_get_keymap_event(&event); | ||
753 | 1566 | |||
754 | 1567 | seat->acquire_keyboard_reference(client).handle_event(map_ev, target); | ||
755 | 1568 | break; | ||
756 | 1569 | } | ||
757 | 1453 | case mir_event_type_window: | 1570 | case mir_event_type_window: |
758 | 1454 | { | 1571 | { |
759 | 1455 | auto const wev = mir_event_get_window_event(&event); | 1572 | auto const wev = mir_event_get_window_event(&event); |
760 | 1456 | 1573 | ||
761 | === modified file 'src/server/scene/basic_surface.cpp' | |||
762 | --- src/server/scene/basic_surface.cpp 2017-08-30 15:38:42 +0000 | |||
763 | +++ src/server/scene/basic_surface.cpp 2017-09-29 15:32:28 +0000 | |||
764 | @@ -445,7 +445,7 @@ | |||
765 | 445 | { | 445 | { |
766 | 446 | std::unique_lock<std::mutex> lg(guard); | 446 | std::unique_lock<std::mutex> lg(guard); |
767 | 447 | 447 | ||
769 | 448 | if (t < 0 || t > mir_window_types) | 448 | if (t > mir_window_types) |
770 | 449 | { | 449 | { |
771 | 450 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid surface " | 450 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid surface " |
772 | 451 | "type.")); | 451 | "type.")); |
773 | 452 | 452 | ||
774 | === modified file 'tests/mir_test_framework/stubbed_server_configuration.cpp' | |||
775 | --- tests/mir_test_framework/stubbed_server_configuration.cpp 2017-08-30 11:59:02 +0000 | |||
776 | +++ tests/mir_test_framework/stubbed_server_configuration.cpp 2017-09-29 15:32:28 +0000 | |||
777 | @@ -139,8 +139,11 @@ | |||
778 | 139 | 139 | ||
779 | 140 | mir::shell::WindowManagerBuilder mir_test_framework::StubbedServerConfiguration::the_window_manager_builder() | 140 | mir::shell::WindowManagerBuilder mir_test_framework::StubbedServerConfiguration::the_window_manager_builder() |
780 | 141 | { | 141 | { |
781 | 142 | #pragma GCC diagnostic push | ||
782 | 143 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||
783 | 142 | return [this](msh::FocusController* focus_controller) | 144 | return [this](msh::FocusController* focus_controller) |
784 | 143 | { return std::make_shared<msh::CanonicalWindowManager>( | 145 | { return std::make_shared<msh::CanonicalWindowManager>( |
785 | 144 | focus_controller, | 146 | focus_controller, |
786 | 145 | the_shell_display_layout()); }; | 147 | the_shell_display_layout()); }; |
787 | 148 | #pragma GCC diagnostic pop | ||
788 | 146 | } | 149 | } |
789 | 147 | 150 | ||
790 | === modified file 'tests/miral/window_properties.cpp' | |||
791 | --- tests/miral/window_properties.cpp 2017-08-23 16:15:03 +0000 | |||
792 | +++ tests/miral/window_properties.cpp 2017-09-29 15:32:28 +0000 | |||
793 | @@ -98,7 +98,7 @@ | |||
794 | 98 | paint(surface); | 98 | paint(surface); |
795 | 99 | ASSERT_TRUE(window_ready.wait_for(400ms)); | 99 | ASSERT_TRUE(window_ready.wait_for(400ms)); |
796 | 100 | 100 | ||
798 | 101 | invoke_tools([&, this](WindowManagerTools& tools) | 101 | invoke_tools([&](WindowManagerTools& tools) |
799 | 102 | { | 102 | { |
800 | 103 | EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_normal)); | 103 | EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_normal)); |
801 | 104 | }); | 104 | }); |
802 | @@ -115,7 +115,7 @@ | |||
803 | 115 | paint(surface); | 115 | paint(surface); |
804 | 116 | ASSERT_TRUE(window_ready.wait_for(400ms)); | 116 | ASSERT_TRUE(window_ready.wait_for(400ms)); |
805 | 117 | 117 | ||
807 | 118 | invoke_tools([&, this](WindowManagerTools& tools) | 118 | invoke_tools([&](WindowManagerTools& tools) |
808 | 119 | { | 119 | { |
809 | 120 | EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_low)); | 120 | EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_low)); |
810 | 121 | }); | 121 | }); |
811 | @@ -136,7 +136,7 @@ | |||
812 | 136 | 136 | ||
813 | 137 | ASSERT_TRUE(window_ready.wait_for(400ms)); | 137 | ASSERT_TRUE(window_ready.wait_for(400ms)); |
814 | 138 | 138 | ||
816 | 139 | invoke_tools([&, this](WindowManagerTools& tools) | 139 | invoke_tools([&](WindowManagerTools& tools) |
817 | 140 | { | 140 | { |
818 | 141 | EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_low)); | 141 | EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_low)); |
819 | 142 | }); | 142 | }); |
820 | @@ -157,7 +157,7 @@ | |||
821 | 157 | paint(surface); | 157 | paint(surface); |
822 | 158 | ASSERT_TRUE(window_ready.wait_for(400ms)); | 158 | ASSERT_TRUE(window_ready.wait_for(400ms)); |
823 | 159 | 159 | ||
825 | 160 | invoke_tools([&, this](WindowManagerTools& tools) | 160 | invoke_tools([&](WindowManagerTools& tools) |
826 | 161 | { | 161 | { |
827 | 162 | EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_normal)); | 162 | EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_normal)); |
828 | 163 | }); | 163 | }); |
829 | 164 | 164 | ||
830 | === modified file 'tests/miral/workspaces.cpp' | |||
831 | --- tests/miral/workspaces.cpp 2017-08-23 16:15:03 +0000 | |||
832 | +++ tests/miral/workspaces.cpp 2017-09-29 15:32:28 +0000 | |||
833 | @@ -295,12 +295,12 @@ | |||
834 | 295 | auto const client_window = create_window(original_tree); | 295 | auto const client_window = create_window(original_tree); |
835 | 296 | auto const original_window= server_window(original_tree); | 296 | auto const original_window= server_window(original_tree); |
836 | 297 | 297 | ||
838 | 298 | invoke_tools([&, this](WindowManagerTools& tools) | 298 | invoke_tools([&](WindowManagerTools& tools) |
839 | 299 | { tools.add_tree_to_workspace(original_window, workspace); }); | 299 | { tools.add_tree_to_workspace(original_window, workspace); }); |
840 | 300 | 300 | ||
842 | 301 | invoke_tools([&, this](WindowManagerTools& tools) | 301 | invoke_tools([&](WindowManagerTools& tools) |
843 | 302 | { tools.add_tree_to_workspace(server_window(top_level), workspace); }); | 302 | { tools.add_tree_to_workspace(server_window(top_level), workspace); }); |
845 | 303 | invoke_tools([&, this](WindowManagerTools& tools) | 303 | invoke_tools([&](WindowManagerTools& tools) |
846 | 304 | { tools.remove_tree_from_workspace(server_window(top_level), workspace); }); | 304 | { tools.remove_tree_from_workspace(server_window(top_level), workspace); }); |
847 | 305 | 305 | ||
848 | 306 | EXPECT_THAT(windows_in_workspace(workspace), ElementsAre(original_window)); | 306 | EXPECT_THAT(windows_in_workspace(workspace), ElementsAre(original_window)); |
849 | 307 | 307 | ||
850 | === modified file 'tests/unit-tests/graphics/test_anonymous_shm_file.cpp' | |||
851 | --- tests/unit-tests/graphics/test_anonymous_shm_file.cpp 2017-07-28 17:00:43 +0000 | |||
852 | +++ tests/unit-tests/graphics/test_anonymous_shm_file.cpp 2017-09-29 15:32:28 +0000 | |||
853 | @@ -16,16 +16,14 @@ | |||
854 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
855 | 17 | */ | 17 | */ |
856 | 18 | 18 | ||
858 | 19 | #include "src/platforms/common/server/anonymous_shm_file.h" | 19 | #include "mir/anonymous_shm_file.h" |
859 | 20 | #include <gtest/gtest.h> | 20 | #include <gtest/gtest.h> |
860 | 21 | 21 | ||
861 | 22 | namespace mgc = mir::graphics::common; | ||
862 | 23 | |||
863 | 24 | TEST(AnonymousShmFile, is_created) | 22 | TEST(AnonymousShmFile, is_created) |
864 | 25 | { | 23 | { |
865 | 26 | size_t const file_size{100}; | 24 | size_t const file_size{100}; |
866 | 27 | 25 | ||
868 | 28 | mgc::AnonymousShmFile shm_file{file_size}; | 26 | mir::AnonymousShmFile shm_file{file_size}; |
869 | 29 | 27 | ||
870 | 30 | EXPECT_GE(shm_file.fd(), 0); | 28 | EXPECT_GE(shm_file.fd(), 0); |
871 | 31 | } | 29 | } |
872 | @@ -34,7 +32,7 @@ | |||
873 | 34 | { | 32 | { |
874 | 35 | size_t const file_size{100}; | 33 | size_t const file_size{100}; |
875 | 36 | 34 | ||
877 | 37 | mgc::AnonymousShmFile shm_file{file_size}; | 35 | mir::AnonymousShmFile shm_file{file_size}; |
878 | 38 | 36 | ||
879 | 39 | struct stat stat; | 37 | struct stat stat; |
880 | 40 | fstat(shm_file.fd(), &stat); | 38 | fstat(shm_file.fd(), &stat); |
881 | @@ -46,7 +44,7 @@ | |||
882 | 46 | { | 44 | { |
883 | 47 | size_t const file_size{100}; | 45 | size_t const file_size{100}; |
884 | 48 | 46 | ||
886 | 49 | mgc::AnonymousShmFile shm_file{file_size}; | 47 | mir::AnonymousShmFile shm_file{file_size}; |
887 | 50 | 48 | ||
888 | 51 | auto base_ptr = reinterpret_cast<uint8_t*>(shm_file.base_ptr()); | 49 | auto base_ptr = reinterpret_cast<uint8_t*>(shm_file.base_ptr()); |
889 | 52 | 50 | ||
890 | 53 | 51 | ||
891 | === modified file 'tests/unit-tests/graphics/test_shm_buffer.cpp' | |||
892 | --- tests/unit-tests/graphics/test_shm_buffer.cpp 2017-07-28 17:00:43 +0000 | |||
893 | +++ tests/unit-tests/graphics/test_shm_buffer.cpp 2017-09-29 15:32:28 +0000 | |||
894 | @@ -17,7 +17,7 @@ | |||
895 | 17 | */ | 17 | */ |
896 | 18 | 18 | ||
897 | 19 | #include "src/platforms/common/server/shm_buffer.h" | 19 | #include "src/platforms/common/server/shm_buffer.h" |
899 | 20 | #include "src/platforms/common/server/shm_file.h" | 20 | #include "mir/shm_file.h" |
900 | 21 | 21 | ||
901 | 22 | #include "mir/test/doubles/mock_gl.h" | 22 | #include "mir/test/doubles/mock_gl.h" |
902 | 23 | 23 | ||
903 | @@ -35,7 +35,7 @@ | |||
904 | 35 | namespace | 35 | namespace |
905 | 36 | { | 36 | { |
906 | 37 | 37 | ||
908 | 38 | struct StubShmFile : public mgc::ShmFile | 38 | struct StubShmFile : public mir::ShmFile |
909 | 39 | { | 39 | { |
910 | 40 | void* base_ptr() const { return fake_mapping; } | 40 | void* base_ptr() const { return fake_mapping; } |
911 | 41 | int fd() const { return fake_fd; } | 41 | int fd() const { return fake_fd; } |
912 | @@ -47,7 +47,7 @@ | |||
913 | 47 | struct PlatformlessShmBuffer : mgc::ShmBuffer | 47 | struct PlatformlessShmBuffer : mgc::ShmBuffer |
914 | 48 | { | 48 | { |
915 | 49 | PlatformlessShmBuffer( | 49 | PlatformlessShmBuffer( |
917 | 50 | std::unique_ptr<mgc::ShmFile> shm_file, | 50 | std::unique_ptr<mir::ShmFile> shm_file, |
918 | 51 | geom::Size const& size, | 51 | geom::Size const& size, |
919 | 52 | MirPixelFormat const& pixel_format) : | 52 | MirPixelFormat const& pixel_format) : |
920 | 53 | ShmBuffer(std::move(shm_file), size, pixel_format) | 53 | ShmBuffer(std::move(shm_file), size, pixel_format) |
921 | 54 | 54 | ||
922 | === modified file 'tests/unit-tests/platforms/mesa/kms/test_software_buffer.cpp' | |||
923 | --- tests/unit-tests/platforms/mesa/kms/test_software_buffer.cpp 2017-07-28 17:00:43 +0000 | |||
924 | +++ tests/unit-tests/platforms/mesa/kms/test_software_buffer.cpp 2017-09-29 15:32:28 +0000 | |||
925 | @@ -18,7 +18,7 @@ | |||
926 | 18 | 18 | ||
927 | 19 | #include "src/platforms/mesa/server/software_buffer.h" | 19 | #include "src/platforms/mesa/server/software_buffer.h" |
928 | 20 | #include "src/platforms/mesa/include/native_buffer.h" | 20 | #include "src/platforms/mesa/include/native_buffer.h" |
930 | 21 | #include "src/platforms/common/server/shm_file.h" | 21 | #include "mir/shm_file.h" |
931 | 22 | 22 | ||
932 | 23 | #include <gtest/gtest.h> | 23 | #include <gtest/gtest.h> |
933 | 24 | #include <gmock/gmock.h> | 24 | #include <gmock/gmock.h> |
934 | @@ -29,7 +29,7 @@ | |||
935 | 29 | 29 | ||
936 | 30 | namespace | 30 | namespace |
937 | 31 | { | 31 | { |
939 | 32 | struct StubShmFile : public mgc::ShmFile | 32 | struct StubShmFile : public mir::ShmFile |
940 | 33 | { | 33 | { |
941 | 34 | void* base_ptr() const { return fake_mapping; } | 34 | void* base_ptr() const { return fake_mapping; } |
942 | 35 | int fd() const { return fake_fd; } | 35 | int fd() const { return fake_fd; } |
Works well enough, but looks like changes to mircore & mircommon ABI. We must do the necessary before release.