Mir

Merge lp:~raof/mir/fixish-wayland-keyboard into lp:mir

Proposed by Chris Halse Rogers
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
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.

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

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Works well enough, but looks like changes to mircore & mircommon ABI. We must do the necessary before release.

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4286
https://mir-jenkins.ubuntu.com/job/mir-ci/3704/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5078/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5316
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5304
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5304
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5304
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5122/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5122/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5122
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5122/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5122
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5122/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5122
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5122/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5122
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5122/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5122
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5122/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5122
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5122/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3704/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4287
https://mir-jenkins.ubuntu.com/job/mir-ci/3705/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5079/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5317/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5305/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5305/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5305/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5123/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5123/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5123/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5123/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5123/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5123/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5123/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5123/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3705/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4287
https://mir-jenkins.ubuntu.com/job/mir-ci/3706/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5080/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5318/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5306/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5306/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5306/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5125/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5125/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5125/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5125/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5125/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5125/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5125/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5125/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3706/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Unneccessary, conflicting change:

<<<<<<< TREE
struct MockWindowManagementPolicy : mir_test_framework::CanonicalWindowManagerPolicy,
                                    miral::WindowManagementPolicyAddendum2
=======
#if defined(__clang__)
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
struct MockWindowManager : mir::shell::CanonicalWindowManager
>>>>>>> MERGE-SOURCE
{
<<<<<<< TREE
    MockWindowManagementPolicy(
        miral::WindowManagerTools const& tools,
        MockWindowManagementPolicy*& self) :
        mir_test_framework::CanonicalWindowManagerPolicy(tools)
    {
        self = this;
    }
=======
    using mir::shell::CanonicalWindowManager::CanonicalWindowManager;
#if defined(__clang__)
    #pragma GCC diagnostic pop
#endif
>>>>>>> MERGE-SOURCE

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4288
https://mir-jenkins.ubuntu.com/job/mir-ci/3710/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5086/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5324
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5312
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5312
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5312
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5131/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5131/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5131/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5131/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5131/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5131
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5131/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5131
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5131/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5131/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3710/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Failures seem unrelated

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/1453/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5096/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/1588/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5334
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5321
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5321
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5321
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5140/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5140/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5140/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5140/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5140/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5140
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5140/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5140
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5140/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5140/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/1454/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5097/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/1589/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5335
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5322
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5322
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5322
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5141/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5141/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5141/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5141/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5141/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5141
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5141/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5141
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5141/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5141/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'examples/miral-shell/decoration_provider.cpp'
--- examples/miral-shell/decoration_provider.cpp 2017-08-21 15:58:34 +0000
+++ examples/miral-shell/decoration_provider.cpp 2017-09-29 15:32:28 +0000
@@ -421,7 +421,7 @@
421421
422 auto const title = info.name();422 auto const title = info.name();
423423
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); });
425 }425 }
426}426}
427427
@@ -534,7 +534,7 @@
534 {534 {
535 auto const title = window_info.name();535 auto const title = window_info.name();
536536
537 enqueue_work([this, stream=data->stream, title, intensity=data->intensity.load()]537 enqueue_work([stream=data->stream, title, intensity=data->intensity.load()]
538 { paint_surface(stream, title, intensity); });538 { paint_surface(stream, title, intensity); });
539 }539 }
540}540}
541541
=== renamed file 'src/platforms/common/server/anonymous_shm_file.h' => 'include/core/mir/anonymous_shm_file.h'
--- src/platforms/common/server/anonymous_shm_file.h 2017-07-28 17:00:43 +0000
+++ include/core/mir/anonymous_shm_file.h 2017-09-29 15:32:28 +0000
@@ -17,52 +17,34 @@
17 * Alexandros Frantzis <alexandros.frantzis@canonical.com>17 * Alexandros Frantzis <alexandros.frantzis@canonical.com>
18 */18 */
1919
20#ifndef MIR_GRAPHICS_MESA_ANONYMOUS_SHM_FILE_H_20#ifndef MIR_CORE_ANONYMOUS_SHM_FILE_H_
21#define MIR_GRAPHICS_MESA_ANONYMOUS_SHM_FILE_H_21#define MIR_CORE_ANONYMOUS_SHM_FILE_H_
2222
23#include "shm_file.h"23#include "shm_file.h"
24#include "mir/fd.h"24#include "mir/fd.h"
2525
26namespace mir26namespace mir
27{27{
28namespace graphics
29{
30namespace common
31{
3228
33namespace detail29namespace detail
34{30{
35class MapHandle
36{
37public:
38 MapHandle(int fd, size_t size);
39 ~MapHandle() noexcept;
40
41 operator void*() const;
42
43private:
44 MapHandle(MapHandle const&) = delete;
45 MapHandle& operator=(MapHandle const&) = delete;
46 size_t const size;
47 void* const mapping;
48};
49}31}
5032
51class AnonymousShmFile : public ShmFile33class AnonymousShmFile : public ShmFile
52{34{
53public:35public:
54 AnonymousShmFile(size_t size);36 AnonymousShmFile(size_t size);
37 ~AnonymousShmFile() noexcept;
5538
56 void* base_ptr() const;39 void* base_ptr() const override;
57 int fd() const;40 int fd() const override;
5841
59private:42private:
60 Fd const fd_;43 Fd const fd_;
61 detail::MapHandle const mapping;44 class MapHandle;
45 std::unique_ptr<MapHandle> const mapping;
62};46};
6347
64}48}
65}
66}
6749
68#endif /* MIR_GRAPHICS_MESA_ANONYMOUS_SHM_FILE_H_ */50#endif /* MIR_CORE_ANONYMOUS_SHM_FILE_H_ */
6951
=== renamed file 'include/common/mir/fd.h' => 'include/core/mir/fd.h'
=== renamed file 'src/platforms/common/server/shm_file.h' => 'include/core/mir/shm_file.h'
--- src/platforms/common/server/shm_file.h 2017-07-28 17:00:43 +0000
+++ include/core/mir/shm_file.h 2017-09-29 15:32:28 +0000
@@ -17,17 +17,13 @@
17 * Alexandros Frantzis <alexandros.frantzis@canonical.com>17 * Alexandros Frantzis <alexandros.frantzis@canonical.com>
18 */18 */
1919
20#ifndef MIR_GRAPHICS_MESA_SHM_FILE_H_20#ifndef MIR_CORE_SHM_FILE_H_
21#define MIR_GRAPHICS_MESA_SHM_FILE_H_21#define MIR_CORE_SHM_FILE_H_
2222
23#include <cstddef>23#include <cstddef>
2424
25namespace mir25namespace mir
26{26{
27namespace graphics
28{
29namespace common
30{
3127
32class ShmFile28class ShmFile
33{29{
@@ -44,7 +40,5 @@
44};40};
4541
46}42}
47}
48}
4943
50#endif /* MIR_GRAPHICS_MESA_SHM_FILE_H_ */44#endif /* MIR_CORE_SHM_FILE_H_ */
5145
=== modified file 'src/common/fd/CMakeLists.txt'
--- src/common/fd/CMakeLists.txt 2017-07-28 17:00:43 +0000
+++ src/common/fd/CMakeLists.txt 2017-09-29 15:32:28 +0000
@@ -15,7 +15,6 @@
15# Authored by: Kevin DuBois <kevin.dubois@canonical.com>15# Authored by: Kevin DuBois <kevin.dubois@canonical.com>
1616
17add_library(mirsharedfd OBJECT17add_library(mirsharedfd OBJECT
18 fd.cpp
19 fd_socket_transmission.cpp18 fd_socket_transmission.cpp
20)19)
2120
2221
=== modified file 'src/common/symbols.map'
--- src/common/symbols.map 2017-05-08 03:04:26 +0000
+++ src/common/symbols.map 2017-09-29 15:32:28 +0000
@@ -31,9 +31,6 @@
31 mir::dispatch::ThreadedDispatcher::remove_thread*;31 mir::dispatch::ThreadedDispatcher::remove_thread*;
32 mir::dispatch::ThreadedDispatcher::?ThreadedDispatcher*;32 mir::dispatch::ThreadedDispatcher::?ThreadedDispatcher*;
33 mir::dispatch::ThreadedDispatcher::ThreadedDispatcher*;33 mir::dispatch::ThreadedDispatcher::ThreadedDispatcher*;
34 mir::Fd::Fd*;
35 mir::Fd::invalid*;
36 mir::Fd::operator*;
37 mir::graphics::NativeBuffer::?NativeBuffer*;34 mir::graphics::NativeBuffer::?NativeBuffer*;
38 mir::graphics::NativeBuffer::NativeBuffer*;35 mir::graphics::NativeBuffer::NativeBuffer*;
39 mir::graphics::NativeBuffer::operator*;36 mir::graphics::NativeBuffer::operator*;
@@ -88,7 +85,6 @@
88 typeinfo?for?mir::dispatch::ThreadedDispatcher;85 typeinfo?for?mir::dispatch::ThreadedDispatcher;
89 typeinfo?for?mir::events::ContactState;86 typeinfo?for?mir::events::ContactState;
90 typeinfo?for?mir::events::InputDeviceState;87 typeinfo?for?mir::events::InputDeviceState;
91 typeinfo?for?mir::Fd;
92 typeinfo?for?mir::graphics::NativeBuffer;88 typeinfo?for?mir::graphics::NativeBuffer;
93 typeinfo?for?mir::input::Keymap;89 typeinfo?for?mir::input::Keymap;
94 typeinfo?for?mir::IntOwnedFd;90 typeinfo?for?mir::IntOwnedFd;
@@ -107,7 +103,6 @@
107 vtable?for?mir::dispatch::ThreadedDispatcher;103 vtable?for?mir::dispatch::ThreadedDispatcher;
108 vtable?for?mir::events::ContactState;104 vtable?for?mir::events::ContactState;
109 vtable?for?mir::events::InputDeviceState;105 vtable?for?mir::events::InputDeviceState;
110 vtable?for?mir::Fd;
111 vtable?for?mir::graphics::NativeBuffer;106 vtable?for?mir::graphics::NativeBuffer;
112 vtable?for?mir::input::Keymap;107 vtable?for?mir::input::Keymap;
113 vtable?for?mir::IntOwnedFd;108 vtable?for?mir::IntOwnedFd;
114109
=== modified file 'src/core/CMakeLists.txt'
--- src/core/CMakeLists.txt 2017-06-16 10:14:10 +0000
+++ src/core/CMakeLists.txt 2017-09-29 15:32:28 +0000
@@ -4,13 +4,17 @@
4string (REPLACE " -pthread " " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})4string (REPLACE " -pthread " " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
55
6add_library(mircore SHARED6add_library(mircore SHARED
7 anonymous_shm_file.cpp
7 fatal.cpp8 fatal.cpp
9 fd.cpp
8 geometry/rectangle.cpp10 geometry/rectangle.cpp
9 geometry/rectangles.cpp11 geometry/rectangles.cpp
10 geometry/ostream.cpp12 geometry/ostream.cpp
13 ${PROJECT_SOURCE_DIR}/include/core/mir/anonymous_shm_file.h
11 ${PROJECT_SOURCE_DIR}/include/core/mir/int_wrapper.h14 ${PROJECT_SOURCE_DIR}/include/core/mir/int_wrapper.h
12 ${PROJECT_SOURCE_DIR}/include/core/mir/optional_value.h15 ${PROJECT_SOURCE_DIR}/include/core/mir/optional_value.h
13 ${PROJECT_SOURCE_DIR}/include/core/mir/fatal.h16 ${PROJECT_SOURCE_DIR}/include/core/mir/fatal.h
17 ${PROJECT_SOURCE_DIR}/include/core/mir/fd.h
14 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/length.h18 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/length.h
15 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/rectangle.h19 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/rectangle.h
16 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/point.h20 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/point.h
@@ -19,10 +23,17 @@
19 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/size.h23 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/size.h
20 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/forward.h24 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/forward.h
21 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/dimensions.h25 ${PROJECT_SOURCE_DIR}/include/core/mir/geometry/dimensions.h
26 ${PROJECT_SOURCE_DIR}/include/core/mir/shm_file.h
22 ${PROJECT_SOURCE_DIR}/include/core/mir_toolkit/common.h27 ${PROJECT_SOURCE_DIR}/include/core/mir_toolkit/common.h
23 ${PROJECT_SOURCE_DIR}/include/core/mir_toolkit/mir_version_number.h28 ${PROJECT_SOURCE_DIR}/include/core/mir_toolkit/mir_version_number.h
24)29)
2530
31target_link_libraries(
32 mircore
33
34 ${Boost_SYSTEM_LIBRARY}
35)
36
26set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)37set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
2738
28set_target_properties(mircore39set_target_properties(mircore
2940
=== renamed file 'src/platforms/common/server/anonymous_shm_file.cpp' => 'src/core/anonymous_shm_file.cpp'
--- src/platforms/common/server/anonymous_shm_file.cpp 2017-07-28 17:00:43 +0000
+++ src/core/anonymous_shm_file.cpp 2017-09-29 15:32:28 +0000
@@ -17,7 +17,7 @@
17 * Alexandros Frantzis <alexandros.frantzis@canonical.com>17 * Alexandros Frantzis <alexandros.frantzis@canonical.com>
18 */18 */
1919
20#include "anonymous_shm_file.h"20#include "mir/anonymous_shm_file.h"
2121
22#include <boost/throw_exception.hpp>22#include <boost/throw_exception.hpp>
23#include <boost/filesystem.hpp>23#include <boost/filesystem.hpp>
@@ -30,8 +30,6 @@
30#include <sys/mman.h>30#include <sys/mman.h>
31#include <fcntl.h>31#include <fcntl.h>
3232
33namespace mgc = mir::graphics::common;
34
35namespace33namespace
36{34{
3735
@@ -87,43 +85,53 @@
87 * MapHandle *85 * MapHandle *
88 *************/86 *************/
8987
90mgc::detail::MapHandle::MapHandle(int fd, size_t size)88class mir::AnonymousShmFile::MapHandle
91 : size{size},89{
92 mapping{mmap(nullptr, size, PROT_READ|PROT_WRITE,90public:
93 MAP_SHARED, fd, 0)}91 MapHandle(int fd, size_t size)
94{92 : size{size},
95 if (mapping == MAP_FAILED)93 mapping{mmap(nullptr, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)}
96 BOOST_THROW_EXCEPTION(94 {
97 std::system_error(errno, std::system_category(), "Failed to map file"));95 if (mapping == MAP_FAILED)
98}96 BOOST_THROW_EXCEPTION(
9997 std::system_error(errno, std::system_category(), "Failed to map file"));
100mgc::detail::MapHandle::~MapHandle() noexcept98 }
101{99
102 munmap(mapping, size);100 ~MapHandle() noexcept
103}101 {
104102 munmap(mapping, size);
105mgc::detail::MapHandle::operator void*() const103 }
106{104
107 return mapping;105 operator void*() const
108106 {
109}107 return mapping;
108 }
109
110private:
111 MapHandle(MapHandle const&) = delete;
112 MapHandle& operator=(MapHandle const&) = delete;
113 size_t const size;
114 void* const mapping;
115};
110116
111/********************117/********************
112 * AnonymousShmFile *118 * AnonymousShmFile *
113 ********************/119 ********************/
114120
115mgc::AnonymousShmFile::AnonymousShmFile(size_t size)121mir::AnonymousShmFile::AnonymousShmFile(size_t size)
116 : fd_{create_anonymous_file(size)},122 : fd_{create_anonymous_file(size)},
117 mapping{fd_, size}123 mapping{new MapHandle(fd_, size)}
118{124{
119}125}
120126
121void* mgc::AnonymousShmFile::base_ptr() const127mir::AnonymousShmFile::~AnonymousShmFile() noexcept = default;
122{128
123 return mapping;129void* mir::AnonymousShmFile::base_ptr() const
124}130{
125131 return *mapping;
126int mgc::AnonymousShmFile::fd() const132}
133
134int mir::AnonymousShmFile::fd() const
127{135{
128 return fd_;136 return fd_;
129}137}
130138
=== renamed file 'src/common/fd/fd.cpp' => 'src/core/fd.cpp'
=== modified file 'src/core/symbols.map'
--- src/core/symbols.map 2017-05-08 03:04:26 +0000
+++ src/core/symbols.map 2017-09-29 15:32:28 +0000
@@ -47,5 +47,29 @@
47 vtable?for?mir::geometry::Rectangles;47 vtable?for?mir::geometry::Rectangles;
48 vtable?for?mir::geometry::Size;48 vtable?for?mir::geometry::Size;
49 };49 };
50 local: *;
51};50};
51
52MIR_CORE_1.0 {
53 global:
54 extern "C++" {
55 mir::Fd::Fd*;
56 mir::Fd::invalid*;
57 mir::Fd::operator*;
58 mir::AnonymousShmFile::AnonymousShmFile*;
59 mir::AnonymousShmFile::?AnonymousShmFile*;
60 mir::AnonymousShmFile::base_ptr*;
61 mir::AnonymousShmFile::fd*;
62 mir::ShmFile::ShmFile*;
63 mir::ShmFile::?ShmFile*;
64 mir::ShmFile::base_ptr*;
65 mir::ShmFile::fd*;
66
67 typeinfo?for?mir::Fd;
68 typeinfo?for?mir::AnonymousShmFile;
69 typeinfo?for?mir::ShmFile;
70 vtable?for?mir::Fd;
71 vtable?for?mir::AnonymousShmFile;
72 vtable?for?mir::ShmFile;
73 };
74 local: *;
75} MIR_CORE_0.25;
52\ No newline at end of file76\ No newline at end of file
5377
=== modified file 'src/miral/application_authorizer.cpp'
--- src/miral/application_authorizer.cpp 2017-08-21 14:18:55 +0000
+++ src/miral/application_authorizer.cpp 2017-09-29 15:32:28 +0000
@@ -96,7 +96,7 @@
9696
97void miral::BasicSetApplicationAuthorizer::operator()(mir::Server& server)97void miral::BasicSetApplicationAuthorizer::operator()(mir::Server& server)
98{98{
99 server.override_the_session_authorizer([this, &server]()99 server.override_the_session_authorizer([this]()
100 -> std::shared_ptr<mf::SessionAuthorizer>100 -> std::shared_ptr<mf::SessionAuthorizer>
101 {101 {
102 auto wrapped = self->builder();102 auto wrapped = self->builder();
103103
=== modified file 'src/platforms/common/server/CMakeLists.txt'
--- src/platforms/common/server/CMakeLists.txt 2017-05-31 17:56:19 +0000
+++ src/platforms/common/server/CMakeLists.txt 2017-09-29 15:32:28 +0000
@@ -9,9 +9,7 @@
99
10add_library(server_platform_common STATIC10add_library(server_platform_common STATIC
11 platform_authentication_wrapper.cpp11 platform_authentication_wrapper.cpp
12 anonymous_shm_file.cpp
13 shm_buffer.cpp12 shm_buffer.cpp
14 shm_file.h
15)13)
1614
17target_link_libraries(15target_link_libraries(
1816
=== modified file 'src/platforms/common/server/shm_buffer.cpp'
--- src/platforms/common/server/shm_buffer.cpp 2017-07-28 17:00:43 +0000
+++ src/platforms/common/server/shm_buffer.cpp 2017-09-29 15:32:28 +0000
@@ -18,7 +18,7 @@
18 */18 */
1919
20#include "mir/graphics/gl_format.h"20#include "mir/graphics/gl_format.h"
21#include "shm_file.h"21#include "mir/shm_file.h"
22#include "shm_buffer.h"22#include "shm_buffer.h"
23#include "buffer_texture_binder.h"23#include "buffer_texture_binder.h"
2424
2525
=== modified file 'src/platforms/common/server/shm_buffer.h'
--- src/platforms/common/server/shm_buffer.h 2017-07-28 17:00:43 +0000
+++ src/platforms/common/server/shm_buffer.h 2017-09-29 15:32:28 +0000
@@ -30,12 +30,13 @@
3030
31namespace mir31namespace mir
32{32{
33class ShmFile;
34
33namespace graphics35namespace graphics
34{36{
35namespace common37namespace common
36{38{
3739
38class ShmFile;
3940
40class ShmBuffer : public BufferBasic, public NativeBufferBase,41class ShmBuffer : public BufferBasic, public NativeBufferBase,
41 public renderer::gl::TextureSource,42 public renderer::gl::TextureSource,
4243
=== modified file 'src/platforms/eglstream-kms/server/buffer_allocator.cpp'
--- src/platforms/eglstream-kms/server/buffer_allocator.cpp 2017-07-28 17:00:43 +0000
+++ src/platforms/eglstream-kms/server/buffer_allocator.cpp 2017-09-29 15:32:28 +0000
@@ -19,7 +19,7 @@
1919
20#include "buffer_allocator.h"20#include "buffer_allocator.h"
21#include "buffer_texture_binder.h"21#include "buffer_texture_binder.h"
22#include "anonymous_shm_file.h"22#include "mir/anonymous_shm_file.h"
23#include "shm_buffer.h"23#include "shm_buffer.h"
24#include "mir/graphics/buffer_properties.h"24#include "mir/graphics/buffer_properties.h"
25#include "software_buffer.h"25#include "software_buffer.h"
@@ -58,7 +58,7 @@
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() };
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();
60 return std::make_shared<mge::SoftwareBuffer>(60 return std::make_shared<mge::SoftwareBuffer>(
61 std::make_unique<mgc::AnonymousShmFile>(size_in_bytes), size, format);61 std::make_unique<mir::AnonymousShmFile>(size_in_bytes), size, format);
62}62}
6363
64std::vector<MirPixelFormat> mge::BufferAllocator::supported_pixel_formats()64std::vector<MirPixelFormat> mge::BufferAllocator::supported_pixel_formats()
6565
=== modified file 'src/platforms/eglstream-kms/server/software_buffer.cpp'
--- src/platforms/eglstream-kms/server/software_buffer.cpp 2017-07-28 17:00:43 +0000
+++ src/platforms/eglstream-kms/server/software_buffer.cpp 2017-09-29 15:32:28 +0000
@@ -17,7 +17,7 @@
17 */17 */
1818
19#include "software_buffer.h"19#include "software_buffer.h"
20#include "shm_file.h"20#include "mir/shm_file.h"
21#include "native_buffer.h"21#include "native_buffer.h"
2222
23namespace mg = mir::graphics;23namespace mg = mir::graphics;
@@ -26,7 +26,7 @@
26namespace geom = mir::geometry;26namespace geom = mir::geometry;
2727
28mge::SoftwareBuffer::SoftwareBuffer(28mge::SoftwareBuffer::SoftwareBuffer(
29 std::unique_ptr<mgc::ShmFile> shm_file,29 std::unique_ptr<mir::ShmFile> shm_file,
30 geom::Size const& size,30 geom::Size const& size,
31 MirPixelFormat const& pixel_format) :31 MirPixelFormat const& pixel_format) :
32 ShmBuffer(std::move(shm_file), size, pixel_format),32 ShmBuffer(std::move(shm_file), size, pixel_format),
3333
=== modified file 'src/platforms/eglstream-kms/server/software_buffer.h'
--- src/platforms/eglstream-kms/server/software_buffer.h 2017-07-28 17:00:43 +0000
+++ src/platforms/eglstream-kms/server/software_buffer.h 2017-09-29 15:32:28 +0000
@@ -23,12 +23,10 @@
2323
24namespace mir24namespace mir
25{25{
26class ShmFile;
27
26namespace graphics28namespace graphics
27{29{
28namespace common
29{
30class ShmFile;
31}
32namespace eglstream30namespace eglstream
33{31{
3432
@@ -36,7 +34,7 @@
36{34{
37public:35public:
38 SoftwareBuffer(36 SoftwareBuffer(
39 std::unique_ptr<common::ShmFile> shm_file,37 std::unique_ptr<ShmFile> shm_file,
40 geometry::Size const& size,38 geometry::Size const& size,
41 MirPixelFormat const& pixel_format);39 MirPixelFormat const& pixel_format);
4240
4341
=== modified file 'src/platforms/mesa/server/buffer_allocator.cpp'
--- src/platforms/mesa/server/buffer_allocator.cpp 2017-09-21 07:24:28 +0000
+++ src/platforms/mesa/server/buffer_allocator.cpp 2017-09-29 15:32:28 +0000
@@ -20,7 +20,7 @@
20#include "buffer_allocator.h"20#include "buffer_allocator.h"
21#include "gbm_buffer.h"21#include "gbm_buffer.h"
22#include "buffer_texture_binder.h"22#include "buffer_texture_binder.h"
23#include "anonymous_shm_file.h"23#include "mir/anonymous_shm_file.h"
24#include "shm_buffer.h"24#include "shm_buffer.h"
25#include "display_helpers.h"25#include "display_helpers.h"
26#include "software_buffer.h"26#include "software_buffer.h"
@@ -295,7 +295,7 @@
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()};
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();
297 return std::make_shared<mgm::SoftwareBuffer>(297 return std::make_shared<mgm::SoftwareBuffer>(
298 std::make_unique<mgc::AnonymousShmFile>(size_in_bytes), size, format);298 std::make_unique<mir::AnonymousShmFile>(size_in_bytes), size, format);
299}299}
300300
301std::vector<MirPixelFormat> mgm::BufferAllocator::supported_pixel_formats()301std::vector<MirPixelFormat> mgm::BufferAllocator::supported_pixel_formats()
302302
=== modified file 'src/platforms/mesa/server/software_buffer.cpp'
--- src/platforms/mesa/server/software_buffer.cpp 2017-07-28 17:00:43 +0000
+++ src/platforms/mesa/server/software_buffer.cpp 2017-09-29 15:32:28 +0000
@@ -17,7 +17,7 @@
17 */17 */
1818
19#include "software_buffer.h"19#include "software_buffer.h"
20#include "shm_file.h"20#include "mir/shm_file.h"
21#include "native_buffer.h"21#include "native_buffer.h"
2222
23namespace mg = mir::graphics;23namespace mg = mir::graphics;
@@ -26,7 +26,7 @@
26namespace geom = mir::geometry;26namespace geom = mir::geometry;
2727
28mgm::SoftwareBuffer::SoftwareBuffer(28mgm::SoftwareBuffer::SoftwareBuffer(
29 std::unique_ptr<mgc::ShmFile> shm_file,29 std::unique_ptr<mir::ShmFile> shm_file,
30 geom::Size const& size,30 geom::Size const& size,
31 MirPixelFormat const& pixel_format) :31 MirPixelFormat const& pixel_format) :
32 ShmBuffer(std::move(shm_file), size, pixel_format),32 ShmBuffer(std::move(shm_file), size, pixel_format),
3333
=== modified file 'src/platforms/mesa/server/software_buffer.h'
--- src/platforms/mesa/server/software_buffer.h 2017-07-28 17:00:43 +0000
+++ src/platforms/mesa/server/software_buffer.h 2017-09-29 15:32:28 +0000
@@ -23,12 +23,10 @@
2323
24namespace mir24namespace mir
25{25{
26class ShmFile;
27
26namespace graphics28namespace graphics
27{29{
28namespace common
29{
30class ShmFile;
31}
32namespace mesa30namespace mesa
33{31{
3432
@@ -36,7 +34,7 @@
36{34{
37public:35public:
38 SoftwareBuffer(36 SoftwareBuffer(
39 std::unique_ptr<common::ShmFile> shm_file,37 std::unique_ptr<ShmFile> shm_file,
40 geometry::Size const& size,38 geometry::Size const& size,
41 MirPixelFormat const& pixel_format);39 MirPixelFormat const& pixel_format);
4240
4341
=== modified file 'src/server/frontend/wayland/wayland_connector.cpp'
--- src/server/frontend/wayland/wayland_connector.cpp 2017-09-28 02:05:19 +0000
+++ src/server/frontend/wayland/wayland_connector.cpp 2017-09-29 15:32:28 +0000
@@ -53,6 +53,7 @@
53#include <functional>53#include <functional>
54#include <type_traits>54#include <type_traits>
5555
56#include <xkbcommon/xkbcommon.h>
56#include <linux/input.h>57#include <linux/input.h>
57#include <algorithm>58#include <algorithm>
58#include <iostream>59#include <iostream>
@@ -66,6 +67,7 @@
66#include "../../../platforms/common/server/shm_buffer.h"67#include "../../../platforms/common/server/shm_buffer.h"
6768
68#include <sys/stat.h>69#include <sys/stat.h>
70#include "mir/anonymous_shm_file.h"
6971
70namespace mf = mir::frontend;72namespace mf = mir::frontend;
71namespace mg = mir::graphics;73namespace mg = mir::graphics;
@@ -799,10 +801,29 @@
799 std::function<void(WlKeyboard*)> const& on_destroy,801 std::function<void(WlKeyboard*)> const& on_destroy,
800 std::shared_ptr<mir::Executor> const& executor)802 std::shared_ptr<mir::Executor> const& executor)
801 : Keyboard(client, parent, id),803 : Keyboard(client, parent, id),
804 keymap{nullptr, &xkb_keymap_unref},
805 state{nullptr, &xkb_state_unref},
806 context{xkb_context_new(XKB_CONTEXT_NO_FLAGS), &xkb_context_unref},
802 executor{executor},807 executor{executor},
803 on_destroy{on_destroy},808 on_destroy{on_destroy},
804 destroyed{std::make_shared<bool>(false)}809 destroyed{std::make_shared<bool>(false)}
805 {810 {
811 // TODO: We should really grab the keymap for the focused surface when
812 // we receive focus.
813
814 xkb_rule_names default_rules;
815 memset(&default_rules, 0, sizeof(default_rules));
816
817 keymap = decltype(keymap){
818 xkb_keymap_new_from_names(
819 context.get(),
820 &default_rules,
821 XKB_KEYMAP_COMPILE_NO_FLAGS),
822 &xkb_keymap_unref};
823
824 state = decltype(state){
825 xkb_state_new(keymap.get()),
826 &xkb_state_unref};
806 }827 }
807828
808 ~WlKeyboard()829 ~WlKeyboard()
@@ -820,13 +841,19 @@
820 this841 this
821 ] ()842 ] ()
822 {843 {
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));
824 auto event = mir_event_get_input_event(ev);845 auto const event = mir_event_get_input_event(ev);
825 auto key_event = mir_input_event_get_keyboard_event(event);846 auto const key_event = mir_input_event_get_keyboard_event(event);
847 auto const scancode = mir_keyboard_event_scan_code(key_event);
848 /*
849 * HACK! Maintain our own XKB state, so we can serialise it for
850 * wl_keyboard_send_modifiers
851 */
826852
827 switch (mir_keyboard_event_action(key_event))853 switch (mir_keyboard_event_action(key_event))
828 {854 {
829 case mir_keyboard_action_up:855 case mir_keyboard_action_up:
856 xkb_state_update_key(state.get(), scancode + 8, XKB_KEY_UP);
830 wl_keyboard_send_key(resource,857 wl_keyboard_send_key(resource,
831 serial,858 serial,
832 mir_input_event_get_event_time(event) / 1000,859 mir_input_event_get_event_time(event) / 1000,
@@ -834,6 +861,7 @@
834 WL_KEYBOARD_KEY_STATE_RELEASED);861 WL_KEYBOARD_KEY_STATE_RELEASED);
835 break;862 break;
836 case mir_keyboard_action_down:863 case mir_keyboard_action_down:
864 xkb_state_update_key(state.get(), scancode + 8, XKB_KEY_DOWN);
837 wl_keyboard_send_key(resource,865 wl_keyboard_send_key(resource,
838 serial,866 serial,
839 mir_input_event_get_event_time(event) / 1000,867 mir_input_event_get_event_time(event) / 1000,
@@ -843,6 +871,38 @@
843 default:871 default:
844 break;872 break;
845 }873 }
874
875 auto new_depressed_mods = xkb_state_serialize_mods(
876 state.get(),
877 XKB_STATE_MODS_DEPRESSED);
878 auto new_latched_mods = xkb_state_serialize_mods(
879 state.get(),
880 XKB_STATE_MODS_LATCHED);
881 auto new_locked_mods = xkb_state_serialize_mods(
882 state.get(),
883 XKB_STATE_MODS_LOCKED);
884 auto new_group = xkb_state_serialize_layout(
885 state.get(),
886 XKB_STATE_LAYOUT_EFFECTIVE);
887
888 if ((new_depressed_mods != mods_depressed) ||
889 (new_latched_mods != mods_latched) ||
890 (new_locked_mods != mods_locked) ||
891 (new_group != group))
892 {
893 mods_depressed = new_depressed_mods;
894 mods_latched = new_latched_mods;
895 mods_locked = new_locked_mods;
896 group = new_group;
897
898 wl_keyboard_send_modifiers(
899 resource,
900 wl_display_get_serial(wl_client_get_display(client)),
901 mods_depressed,
902 mods_latched,
903 mods_locked,
904 group);
905 }
846 }));906 }));
847 }907 }
848908
@@ -861,6 +921,11 @@
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));
862 if (focussed)922 if (focussed)
863 {923 {
924 /*
925 * TODO:
926 * *) Send the actual modifier state here.
927 * *) Send the surface's keymap here.
928 */
864 wl_array key_state;929 wl_array key_state;
865 wl_array_init(&key_state);930 wl_array_init(&key_state);
866 wl_keyboard_send_enter(resource, serial, target, &key_state);931 wl_keyboard_send_enter(resource, serial, target, &key_state);
@@ -874,11 +939,47 @@
874 }939 }
875 }940 }
876941
942 void handle_event(MirKeymapEvent const* event, wl_resource* /*target*/)
943 {
944 char const* buffer;
945 size_t length;
946
947 mir_keymap_event_get_keymap_buffer(event, &buffer, &length);
948
949 mir::AnonymousShmFile shm_buffer{length};
950 memcpy(shm_buffer.base_ptr(), buffer, length);
951
952 wl_keyboard_send_keymap(
953 resource,
954 WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
955 shm_buffer.fd(),
956 length);
957
958 keymap = decltype(keymap)(xkb_keymap_new_from_buffer(
959 context.get(),
960 buffer,
961 length,
962 XKB_KEYMAP_FORMAT_TEXT_V1,
963 XKB_KEYMAP_COMPILE_NO_FLAGS),
964 &xkb_keymap_unref);
965
966 state = decltype(state)(xkb_state_new(keymap.get()), &xkb_state_unref);
967 }
968
877private:969private:
970 std::unique_ptr<xkb_keymap, decltype(&xkb_keymap_unref)> keymap;
971 std::unique_ptr<xkb_state, decltype(&xkb_state_unref)> state;
972 std::unique_ptr<xkb_context, decltype(&xkb_context_unref)> const context;
973
878 std::shared_ptr<mir::Executor> const executor;974 std::shared_ptr<mir::Executor> const executor;
879 std::function<void(WlKeyboard*)> on_destroy;975 std::function<void(WlKeyboard*)> on_destroy;
880 std::shared_ptr<bool> const destroyed;976 std::shared_ptr<bool> const destroyed;
881977
978 uint32_t mods_depressed{0};
979 uint32_t mods_latched{0};
980 uint32_t mods_locked{0};
981 uint32_t group{0};
982
882 void release() override;983 void release() override;
883};984};
884985
@@ -1202,6 +1303,15 @@
1202 }1303 }
1203 }1304 }
12041305
1306 void handle_event(MirKeymapEvent const* event, wl_resource* target) const
1307 {
1308 std::lock_guard<std::mutex> lock{mutex};
1309 for (auto& listener : listeners)
1310 {
1311 listener->handle_event(event, target);
1312 }
1313 }
1314
1205private:1315private:
1206 std::mutex mutable mutex;1316 std::mutex mutable mutex;
1207 std::vector<InputInterface*> listeners;1317 std::vector<InputInterface*> listeners;
@@ -1450,6 +1560,13 @@
1450 }1560 }
1451 break;1561 break;
1452 }1562 }
1563 case mir_event_type_keymap:
1564 {
1565 auto const map_ev = mir_event_get_keymap_event(&event);
1566
1567 seat->acquire_keyboard_reference(client).handle_event(map_ev, target);
1568 break;
1569 }
1453 case mir_event_type_window:1570 case mir_event_type_window:
1454 {1571 {
1455 auto const wev = mir_event_get_window_event(&event);1572 auto const wev = mir_event_get_window_event(&event);
14561573
=== modified file 'src/server/scene/basic_surface.cpp'
--- src/server/scene/basic_surface.cpp 2017-08-30 15:38:42 +0000
+++ src/server/scene/basic_surface.cpp 2017-09-29 15:32:28 +0000
@@ -445,7 +445,7 @@
445{445{
446 std::unique_lock<std::mutex> lg(guard);446 std::unique_lock<std::mutex> lg(guard);
447 447
448 if (t < 0 || t > mir_window_types)448 if (t > mir_window_types)
449 {449 {
450 BOOST_THROW_EXCEPTION(std::logic_error("Invalid surface "450 BOOST_THROW_EXCEPTION(std::logic_error("Invalid surface "
451 "type."));451 "type."));
452452
=== modified file 'tests/mir_test_framework/stubbed_server_configuration.cpp'
--- tests/mir_test_framework/stubbed_server_configuration.cpp 2017-08-30 11:59:02 +0000
+++ tests/mir_test_framework/stubbed_server_configuration.cpp 2017-09-29 15:32:28 +0000
@@ -139,8 +139,11 @@
139139
140mir::shell::WindowManagerBuilder mir_test_framework::StubbedServerConfiguration::the_window_manager_builder()140mir::shell::WindowManagerBuilder mir_test_framework::StubbedServerConfiguration::the_window_manager_builder()
141{141{
142#pragma GCC diagnostic push
143#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
142 return [this](msh::FocusController* focus_controller)144 return [this](msh::FocusController* focus_controller)
143 { return std::make_shared<msh::CanonicalWindowManager>(145 { return std::make_shared<msh::CanonicalWindowManager>(
144 focus_controller,146 focus_controller,
145 the_shell_display_layout()); };147 the_shell_display_layout()); };
148#pragma GCC diagnostic pop
146}149}
147150
=== modified file 'tests/miral/window_properties.cpp'
--- tests/miral/window_properties.cpp 2017-08-23 16:15:03 +0000
+++ tests/miral/window_properties.cpp 2017-09-29 15:32:28 +0000
@@ -98,7 +98,7 @@
98 paint(surface);98 paint(surface);
99 ASSERT_TRUE(window_ready.wait_for(400ms));99 ASSERT_TRUE(window_ready.wait_for(400ms));
100100
101 invoke_tools([&, this](WindowManagerTools& tools)101 invoke_tools([&](WindowManagerTools& tools)
102 {102 {
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));
104 });104 });
@@ -115,7 +115,7 @@
115 paint(surface);115 paint(surface);
116 ASSERT_TRUE(window_ready.wait_for(400ms));116 ASSERT_TRUE(window_ready.wait_for(400ms));
117117
118 invoke_tools([&, this](WindowManagerTools& tools)118 invoke_tools([&](WindowManagerTools& tools)
119 {119 {
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));
121 });121 });
@@ -136,7 +136,7 @@
136136
137 ASSERT_TRUE(window_ready.wait_for(400ms));137 ASSERT_TRUE(window_ready.wait_for(400ms));
138138
139 invoke_tools([&, this](WindowManagerTools& tools)139 invoke_tools([&](WindowManagerTools& tools)
140 {140 {
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));
142 });142 });
@@ -157,7 +157,7 @@
157 paint(surface);157 paint(surface);
158 ASSERT_TRUE(window_ready.wait_for(400ms));158 ASSERT_TRUE(window_ready.wait_for(400ms));
159159
160 invoke_tools([&, this](WindowManagerTools& tools)160 invoke_tools([&](WindowManagerTools& tools)
161 {161 {
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));
163 });163 });
164164
=== modified file 'tests/miral/workspaces.cpp'
--- tests/miral/workspaces.cpp 2017-08-23 16:15:03 +0000
+++ tests/miral/workspaces.cpp 2017-09-29 15:32:28 +0000
@@ -295,12 +295,12 @@
295 auto const client_window = create_window(original_tree);295 auto const client_window = create_window(original_tree);
296 auto const original_window= server_window(original_tree);296 auto const original_window= server_window(original_tree);
297297
298 invoke_tools([&, this](WindowManagerTools& tools)298 invoke_tools([&](WindowManagerTools& tools)
299 { tools.add_tree_to_workspace(original_window, workspace); });299 { tools.add_tree_to_workspace(original_window, workspace); });
300300
301 invoke_tools([&, this](WindowManagerTools& tools)301 invoke_tools([&](WindowManagerTools& tools)
302 { tools.add_tree_to_workspace(server_window(top_level), workspace); });302 { tools.add_tree_to_workspace(server_window(top_level), workspace); });
303 invoke_tools([&, this](WindowManagerTools& tools)303 invoke_tools([&](WindowManagerTools& tools)
304 { tools.remove_tree_from_workspace(server_window(top_level), workspace); });304 { tools.remove_tree_from_workspace(server_window(top_level), workspace); });
305305
306 EXPECT_THAT(windows_in_workspace(workspace), ElementsAre(original_window));306 EXPECT_THAT(windows_in_workspace(workspace), ElementsAre(original_window));
307307
=== modified file 'tests/unit-tests/graphics/test_anonymous_shm_file.cpp'
--- tests/unit-tests/graphics/test_anonymous_shm_file.cpp 2017-07-28 17:00:43 +0000
+++ tests/unit-tests/graphics/test_anonymous_shm_file.cpp 2017-09-29 15:32:28 +0000
@@ -16,16 +16,14 @@
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */17 */
1818
19#include "src/platforms/common/server/anonymous_shm_file.h"19#include "mir/anonymous_shm_file.h"
20#include <gtest/gtest.h>20#include <gtest/gtest.h>
2121
22namespace mgc = mir::graphics::common;
23
24TEST(AnonymousShmFile, is_created)22TEST(AnonymousShmFile, is_created)
25{23{
26 size_t const file_size{100};24 size_t const file_size{100};
2725
28 mgc::AnonymousShmFile shm_file{file_size};26 mir::AnonymousShmFile shm_file{file_size};
2927
30 EXPECT_GE(shm_file.fd(), 0);28 EXPECT_GE(shm_file.fd(), 0);
31}29}
@@ -34,7 +32,7 @@
34{32{
35 size_t const file_size{100};33 size_t const file_size{100};
3634
37 mgc::AnonymousShmFile shm_file{file_size};35 mir::AnonymousShmFile shm_file{file_size};
3836
39 struct stat stat;37 struct stat stat;
40 fstat(shm_file.fd(), &stat);38 fstat(shm_file.fd(), &stat);
@@ -46,7 +44,7 @@
46{44{
47 size_t const file_size{100};45 size_t const file_size{100};
4846
49 mgc::AnonymousShmFile shm_file{file_size};47 mir::AnonymousShmFile shm_file{file_size};
5048
51 auto base_ptr = reinterpret_cast<uint8_t*>(shm_file.base_ptr());49 auto base_ptr = reinterpret_cast<uint8_t*>(shm_file.base_ptr());
5250
5351
=== modified file 'tests/unit-tests/graphics/test_shm_buffer.cpp'
--- tests/unit-tests/graphics/test_shm_buffer.cpp 2017-07-28 17:00:43 +0000
+++ tests/unit-tests/graphics/test_shm_buffer.cpp 2017-09-29 15:32:28 +0000
@@ -17,7 +17,7 @@
17 */17 */
1818
19#include "src/platforms/common/server/shm_buffer.h"19#include "src/platforms/common/server/shm_buffer.h"
20#include "src/platforms/common/server/shm_file.h"20#include "mir/shm_file.h"
2121
22#include "mir/test/doubles/mock_gl.h"22#include "mir/test/doubles/mock_gl.h"
2323
@@ -35,7 +35,7 @@
35namespace35namespace
36{36{
3737
38struct StubShmFile : public mgc::ShmFile38struct StubShmFile : public mir::ShmFile
39{39{
40 void* base_ptr() const { return fake_mapping; }40 void* base_ptr() const { return fake_mapping; }
41 int fd() const { return fake_fd; }41 int fd() const { return fake_fd; }
@@ -47,7 +47,7 @@
47struct PlatformlessShmBuffer : mgc::ShmBuffer47struct PlatformlessShmBuffer : mgc::ShmBuffer
48{48{
49 PlatformlessShmBuffer(49 PlatformlessShmBuffer(
50 std::unique_ptr<mgc::ShmFile> shm_file,50 std::unique_ptr<mir::ShmFile> shm_file,
51 geom::Size const& size,51 geom::Size const& size,
52 MirPixelFormat const& pixel_format) :52 MirPixelFormat const& pixel_format) :
53 ShmBuffer(std::move(shm_file), size, pixel_format)53 ShmBuffer(std::move(shm_file), size, pixel_format)
5454
=== modified file 'tests/unit-tests/platforms/mesa/kms/test_software_buffer.cpp'
--- tests/unit-tests/platforms/mesa/kms/test_software_buffer.cpp 2017-07-28 17:00:43 +0000
+++ tests/unit-tests/platforms/mesa/kms/test_software_buffer.cpp 2017-09-29 15:32:28 +0000
@@ -18,7 +18,7 @@
1818
19#include "src/platforms/mesa/server/software_buffer.h"19#include "src/platforms/mesa/server/software_buffer.h"
20#include "src/platforms/mesa/include/native_buffer.h"20#include "src/platforms/mesa/include/native_buffer.h"
21#include "src/platforms/common/server/shm_file.h"21#include "mir/shm_file.h"
2222
23#include <gtest/gtest.h>23#include <gtest/gtest.h>
24#include <gmock/gmock.h>24#include <gmock/gmock.h>
@@ -29,7 +29,7 @@
2929
30namespace30namespace
31{31{
32struct StubShmFile : public mgc::ShmFile32struct StubShmFile : public mir::ShmFile
33{33{
34 void* base_ptr() const { return fake_mapping; }34 void* base_ptr() const { return fake_mapping; }
35 int fd() const { return fake_fd; }35 int fd() const { return fake_fd; }

Subscribers

People subscribed via source and target branches