Mir

Merge lp:~alan-griffiths/mir/fix-1717561 into lp:mir

Proposed by Alan Griffiths on 2017-09-19
Status: Merged
Approved by: Gerry Boland on 2017-09-22
Approved revision: 4259
Merged at revision: 4263
Proposed branch: lp:~alan-griffiths/mir/fix-1717561
Merge into: lp:mir
Diff against target: 143 lines (+54/-8)
2 files modified
include/server/mir/frontend/buffer_stream.h (+1/-0)
src/server/frontend/wayland/wayland_connector.cpp (+53/-8)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-1717561
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve on 2017-09-22
Gerry Boland 2017-09-19 Approve on 2017-09-22
Review via email: mp+330992@code.launchpad.net

Commit message

A first pass at getting fullscreen wayland windows fullscreen

Description of the change

A first pass at getting fullscreen wayland windows fullscreen

This still seems a little racy on surface creation: e.g. kiosk doesn't always end up with a maximized window.

But other resizing (including client initiated fullscreen) seems to work.

To post a comment you must log in.
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4255
https://mir-jenkins.ubuntu.com/job/mir-ci/3671/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5026/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5259
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5247
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5247
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5247
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5069
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5069/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5069
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5069/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5069/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5069
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5069/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5069
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5069/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/5069
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5069/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/5069
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5069/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5069
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5069/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
lp:~alan-griffiths/mir/fix-1717561 updated on 2017-09-22
4256. By Alan Griffiths on 2017-09-21

merge :parent

4257. By Alan Griffiths on 2017-09-22

merge :parent

4258. By Alan Griffiths on 2017-09-22

Move the resize notification to a sensible place

4259. By Alan Griffiths on 2017-09-22

Use executor to send notifications

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4257
https://mir-jenkins.ubuntu.com/job/mir-ci/3677/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5040/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5276
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5264
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5264
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5264
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5083
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5083/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5083/console
    ABORTED: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5083/console
    ABORTED: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5083/console
    ABORTED: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5083/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5083
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5083/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/5083
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5083/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5083
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5083/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Gerry Boland (gerboland) wrote :

Works, and code looks correct

review: Approve
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4259
https://mir-jenkins.ubuntu.com/job/mir-ci/3678/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/5041
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5277
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5265
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5265
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5265
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5084/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5084/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5084/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5084/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5084/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/5084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5084/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/5084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5084/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5084/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/server/mir/frontend/buffer_stream.h'
2--- include/server/mir/frontend/buffer_stream.h 2017-09-01 05:03:55 +0000
3+++ include/server/mir/frontend/buffer_stream.h 2017-09-22 11:48:21 +0000
4@@ -21,6 +21,7 @@
5
6 #include <mir_toolkit/common.h>
7 #include "mir/graphics/buffer_id.h"
8+#include "mir/geometry/size.h"
9 #include <functional>
10 #include <memory>
11
12
13=== modified file 'src/server/frontend/wayland/wayland_connector.cpp'
14--- src/server/frontend/wayland/wayland_connector.cpp 2017-09-21 11:30:51 +0000
15+++ src/server/frontend/wayland/wayland_connector.cpp 2017-09-22 11:48:21 +0000
16@@ -21,6 +21,7 @@
17 #include "core_generated_interfaces.h"
18
19 #include "mir/frontend/shell.h"
20+#include "mir/frontend/surface.h"
21
22 #include "mir/compositor/buffer_stream.h"
23
24@@ -1028,6 +1029,11 @@
25 InputCtx<WlKeyboard> const& acquire_keyboard_reference(wl_client* client) const;
26 InputCtx<WlTouch> const& acquire_touch_reference(wl_client* client) const;
27
28+ void spawn(std::function<void()>&& work)
29+ {
30+ executor->spawn(std::move(work));
31+ }
32+
33 private:
34 std::unordered_map<wl_client*, InputCtx<WlPointer>> mutable pointer;
35 std::unordered_map<wl_client*, InputCtx<WlKeyboard>> mutable keyboard;
36@@ -1146,13 +1152,14 @@
37 {
38 }
39
40-class SurfaceInputSink : public mf::EventSink
41+class SurfaceEventSink : public mf::EventSink
42 {
43 public:
44- SurfaceInputSink(WlSeat* seat, wl_client* client, wl_resource* target)
45+ SurfaceEventSink(WlSeat* seat, wl_client* client, wl_resource* target, wl_resource* event_sink)
46 : seat{seat},
47 client{client},
48- target{target}
49+ target{target},
50+ event_sink{event_sink}
51 {
52 }
53
54@@ -1172,12 +1179,24 @@
55 WlSeat* const seat;
56 wl_client* const client;
57 wl_resource* const target;
58+ wl_resource* const event_sink;
59 };
60
61-void SurfaceInputSink::handle_event(MirEvent const& event)
62+void SurfaceEventSink::handle_event(MirEvent const& event)
63 {
64 switch (mir_event_get_type(&event))
65 {
66+ case mir_event_type_resize:
67+ {
68+ auto resize = mir_event_get_resize_event(&event);
69+ seat->spawn([event_sink=event_sink,
70+ width = mir_resize_event_get_width(resize),
71+ height = mir_resize_event_get_height(resize)]()
72+ {
73+ wl_shell_surface_send_configure(event_sink, WL_SHELL_SURFACE_RESIZE_NONE, width, height);
74+ });
75+ break;
76+ }
77 case mir_event_type_input:
78 {
79 auto input_event = mir_event_get_input_event(&event);
80@@ -1362,7 +1381,7 @@
81 shell{shell}
82 {
83 auto* tmp = wl_resource_get_user_data(surface);
84- auto& mir_surface = *static_cast<WlSurface*>(reinterpret_cast<wayland::Surface*>(tmp));
85+ auto& mir_surface = *static_cast<WlSurface*>(tmp);
86
87 auto const session = session_for_client(client);
88
89@@ -1374,7 +1393,15 @@
90 surface_id = shell->create_surface(
91 session,
92 params,
93- std::make_shared<SurfaceInputSink>(&seat, client, surface));
94+ std::make_shared<SurfaceEventSink>(&seat, client, surface, resource));
95+
96+ {
97+ // The shell isn't guaranteed to respect the requested size
98+ auto const window = session->get_surface(surface_id);
99+ auto const size = window->client_size();
100+ seat.spawn([resource=resource, height = size.height.as_int(), width = size.width.as_int()]()
101+ { wl_shell_surface_send_configure(resource, WL_SHELL_SURFACE_RESIZE_NONE, width, height); });
102+ }
103
104 mir_surface.set_resize_handler(
105 [shell, session, id = surface_id](geom::Size new_size)
106@@ -1429,8 +1456,18 @@
107 void set_fullscreen(
108 uint32_t /*method*/,
109 uint32_t /*framerate*/,
110- std::experimental::optional<struct wl_resource*> const& /*output*/) override
111+ std::experimental::optional<struct wl_resource*> const& output) override
112 {
113+ mir::shell::SurfaceSpecification mods;
114+ mods.state = mir_window_state_fullscreen;
115+ if (output)
116+ {
117+ // TODO{alan_g} mods.output_id = DisplayConfigurationOutputId_from(output)
118+ }
119+
120+ auto const session = session_for_client(client);
121+ shell->modify_surface(session, surface_id, mods);
122+
123 }
124
125 void set_popup(
126@@ -1443,8 +1480,16 @@
127 {
128 }
129
130- void set_maximized(std::experimental::optional<struct wl_resource*> const& /*output*/) override
131+ void set_maximized(std::experimental::optional<struct wl_resource*> const& output) override
132 {
133+ mir::shell::SurfaceSpecification mods;
134+ mods.state = mir_window_state_maximized;
135+ if (output)
136+ {
137+ // TODO{alan_g} mods.output_id = DisplayConfigurationOutputId_from(output)
138+ }
139+ auto const session = session_for_client(client);
140+ shell->modify_surface(session, surface_id, mods);
141 }
142
143 void set_title(std::string const& /*title*/) override

Subscribers

People subscribed via source and target branches