Mir

Merge lp:~brandontschaefer/mir/usr-mir-window-placement into lp:mir

Proposed by Brandon Schaefer
Status: Merged
Merged at revision: 3922
Proposed branch: lp:~brandontschaefer/mir/usr-mir-window-placement
Merge into: lp:mir
Prerequisite: lp:~brandontschaefer/mir/use-mir-window-output-event
Diff against target: 203 lines (+84/-12)
7 files modified
include/client/mir/event_printer.h (+1/-1)
include/client/mir_toolkit/events/event.h (+14/-2)
include/client/mir_toolkit/events/window_placement.h (+46/-0)
src/client/event.cpp (+12/-1)
src/client/event_printer.cpp (+3/-3)
src/client/symbols.map (+2/-0)
tests/acceptance-tests/test_custom_window_management.cpp (+6/-5)
To merge this branch: bzr merge lp:~brandontschaefer/mir/usr-mir-window-placement
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Needs Fixing
Cemil Azizoglu (community) Needs Fixing
Review via email: mp+314477@code.launchpad.net

This proposal supersedes a proposal from 2017-01-10.

Commit message

Use MirWindowPlacementEvent vs MirSurfacePlacement

Description of the change

Use MirWindowPlacementEvent vs MirSurfacePlacement

To post a comment you must log in.
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

36 MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event);
37

Forgot to follow 'deprecated' in a comment as a reminder.
-------------------------------------------------------

71 + * Authored by: Alan Griffiths <email address hidden>
72

your name should be added?
-------------------------------------------------------

87 +typedef struct MirSurfacePlacementEvent MirWindowPlacementEvent;
88 +

Must not be typedef'ed again... Just include the right file where it was originally typedefed.
-------------------------------------------------------

132 -MirRectangle mir_surface_placement_get_relative_position(MirSurfacePlacementEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(
133 +MirRectangle mir_window_placement_get_relative_position(MirWindowPlacementEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(

Must not replace the old function. Just call the new function from the old

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

PASSED: Continuous integration, rev:3926
https://mir-jenkins.ubuntu.com/job/mir-ci/2626/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/3414
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3481
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3473
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3473
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/3473
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3443
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3443/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3443
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3443/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3443
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3443/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3443
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3443/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3443
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3443/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3443
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3443/artifact/output/*zip*/output.zip

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

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

FAILED: Continuous integration, rev:3931
https://mir-jenkins.ubuntu.com/job/mir-ci/2635/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3425/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3492
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3484
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3484
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/3484
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3454
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3454/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3454
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3454/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3454
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3454/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3454
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3454/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3454
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3454/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3454/console

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

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/client/mir/event_printer.h'
2--- include/client/mir/event_printer.h 2017-01-11 14:16:14 +0000
3+++ include/client/mir/event_printer.h 2017-01-11 14:16:15 +0000
4@@ -52,7 +52,7 @@
5 std::ostream& operator<<(std::ostream& out, MirKeymapEvent const& event);
6 std::ostream& operator<<(std::ostream& out, MirWindowEvent const& event);
7 std::ostream& operator<<(std::ostream& out, MirInputDeviceStateEvent const& event);
8-std::ostream& operator<<(std::ostream& out, MirSurfacePlacementEvent const& event);
9+std::ostream& operator<<(std::ostream& out, MirWindowPlacementEvent const& event);
10 std::ostream& operator<<(std::ostream& out, MirEvent const& event);
11
12 }
13
14=== modified file 'include/client/mir_toolkit/events/event.h'
15--- include/client/mir_toolkit/events/event.h 2017-01-11 14:16:14 +0000
16+++ include/client/mir_toolkit/events/event.h 2017-01-11 14:16:15 +0000
17@@ -1,5 +1,5 @@
18 /*
19- * Copyright © 2014-2016 Canonical Ltd.
20+ * Copyright © 2014-2017 Canonical Ltd.
21 *
22 * This program is free software: you can redistribute it and/or modify it
23 * under the terms of the GNU Lesser General Public License version 3,
24@@ -70,7 +70,8 @@
25 typedef struct MirSurfaceOutputEvent MirSurfaceOutputEvent; /* __attribute__ ((deprecated("use MirWindowOutputEvent instead"))); */
26 typedef struct MirSurfaceOutputEvent MirWindowOutputEvent;
27 typedef struct MirInputDeviceStateEvent MirInputDeviceStateEvent;
28-typedef struct MirSurfacePlacementEvent MirSurfacePlacementEvent;
29+typedef struct MirSurfacePlacementEvent MirSurfacePlacementEvent; /* __attribute__ ((deprecated("use MirWindowPlacementEvent instead"))); */
30+typedef struct MirSurfacePlacementEvent MirWindowPlacementEvent;
31
32 typedef struct MirCookie MirCookie;
33
34@@ -266,6 +267,17 @@
35 * \return The associated MirSurfacePlacementEvent
36 */
37 MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event);
38+/* __attribute__((deprecated("use mir_event_get_window_placement_event))) */
39+
40+/**
41+ * Retrieve the MirWindowPlacementEvent associated with a MirEvent of
42+ * type mir_event_type_window_placement. The event signifies that the
43+ * the server has fulfilled a request for relative window placement.
44+ *
45+ * \param [in] event The event
46+ * \return The associated MirWindowPlacementEvent
47+ */
48+MirWindowPlacementEvent const* mir_event_get_window_placement_event(MirEvent const* event);
49
50 /*
51 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
52
53=== added file 'include/client/mir_toolkit/events/window_placement.h'
54--- include/client/mir_toolkit/events/window_placement.h 1970-01-01 00:00:00 +0000
55+++ include/client/mir_toolkit/events/window_placement.h 2017-01-11 14:16:15 +0000
56@@ -0,0 +1,46 @@
57+/*
58+ * Copyright © 2017 Canonical Ltd.
59+ *
60+ * This program is free software: you can redistribute it and/or modify it
61+ * under the terms of the GNU Lesser General Public License version 3,
62+ * as published by the Free Software Foundation.
63+ *
64+ * This program is distributed in the hope that it will be useful,
65+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
66+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
67+ * GNU Lesser General Public License for more details.
68+ *
69+ * You should have received a copy of the GNU Lesser General Public License
70+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
71+ *
72+ * Authored by: Alan Griffiths <alan@octopull.co.uk>
73+ * Brandon Schaefer <brandon.schaefer@canonical.com>
74+ */
75+
76+#ifndef MIR_TOOLKIT_WINDOW_PLACEMENT_H_
77+#define MIR_TOOLKIT_WINDOW_PLACEMENT_H_
78+
79+#include <mir_toolkit/client_types.h>
80+
81+#ifdef __cplusplus
82+/**
83+ * \addtogroup mir_toolkit
84+ * @{
85+ */
86+extern "C" {
87+#endif
88+
89+/**
90+ * Retrieve the relative position from a placement notification
91+ *
92+ * \param [in] event The placement event
93+ * \return The position relative to the parent window
94+ */
95+MirRectangle mir_window_placement_get_relative_position(MirWindowPlacementEvent const* event);
96+
97+#ifdef __cplusplus
98+}
99+/**@}*/
100+#endif
101+
102+#endif //MIR_TOOLKIT_WINDOW_PLACEMENT_H_
103
104=== modified file 'src/client/event.cpp'
105--- src/client/event.cpp 2017-01-11 14:16:14 +0000
106+++ src/client/event.cpp 2017-01-11 14:16:15 +0000
107@@ -33,6 +33,7 @@
108 #include "mir_toolkit/events/orientation_event.h"
109 #include "mir_toolkit/events/input_device_state_event.h"
110 #include "mir_toolkit/events/surface_placement.h"
111+#include "mir_toolkit/events/window_placement.h"
112
113 #include <cstdlib>
114 #include <cstring>
115@@ -412,10 +413,20 @@
116
117 MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(
118 {
119+ return mir_event_get_window_placement_event(event);
120+})
121+
122+MirRectangle mir_surface_placement_get_relative_position(MirSurfacePlacementEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(
123+{
124+ return mir_window_placement_get_relative_position(event);
125+})
126+
127+MirWindowPlacementEvent const* mir_event_get_window_placement_event(MirEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(
128+{
129 return event->to_surface_placement();
130 })
131
132-MirRectangle mir_surface_placement_get_relative_position(MirSurfacePlacementEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(
133+MirRectangle mir_window_placement_get_relative_position(MirWindowPlacementEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(
134 {
135 return event->placement();
136 })
137
138=== modified file 'src/client/event_printer.cpp'
139--- src/client/event_printer.cpp 2017-01-11 14:16:14 +0000
140+++ src/client/event_printer.cpp 2017-01-11 14:16:15 +0000
141@@ -319,7 +319,7 @@
142
143 std::ostream& mir::operator<<(std::ostream& out, MirCloseWindowEvent const&)
144 {
145- return out << "close_surface_event()";
146+ return out << "close_window_event()";
147 }
148
149 std::ostream& mir::operator<<(std::ostream& out, MirWindowEvent const& event)
150@@ -357,10 +357,10 @@
151 return out << ')';
152 }
153
154-std::ostream& mir::operator<<(std::ostream& out, MirSurfacePlacementEvent const& event)
155+std::ostream& mir::operator<<(std::ostream& out, MirWindowPlacementEvent const& event)
156 {
157 auto const& placement = event.placement();
158- return out << "surface_placement_event({"
159+ return out << "window_placement_event({"
160 << placement.left << ", "
161 << placement.top << ", "
162 << placement.width << ", "
163
164=== modified file 'src/client/symbols.map'
165--- src/client/symbols.map 2017-01-11 14:16:14 +0000
166+++ src/client/symbols.map 2017-01-11 14:16:15 +0000
167@@ -560,4 +560,6 @@
168 mir_window_output_event_get_scale;
169 mir_window_output_event_get_output_id;
170 mir_window_output_event_get_refresh_rate;
171+ mir_event_get_window_placement_event;
172+ mir_window_placement_get_relative_position;
173 } MIR_CLIENT_0.25;
174
175=== modified file 'tests/acceptance-tests/test_custom_window_management.cpp'
176--- tests/acceptance-tests/test_custom_window_management.cpp 2017-01-11 14:16:14 +0000
177+++ tests/acceptance-tests/test_custom_window_management.cpp 2017-01-11 14:16:15 +0000
178@@ -19,6 +19,7 @@
179 #include "mir/geometry/rectangle.h"
180 #include "mir/scene/session.h"
181 #include "mir_toolkit/events/surface_placement.h"
182+#include "mir_toolkit/events/window_placement.h"
183 #include "mir/events/event_builders.h"
184 #include "mir/scene/surface.h"
185
186@@ -529,12 +530,12 @@
187 {
188 PlacementCheck(MirRectangle const& placement) : expected_rect{placement} {}
189
190- void check(MirSurfacePlacementEvent const* placement_event)
191+ void check(MirWindowPlacementEvent const* placement_event)
192 {
193- EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).top, Eq(expected_rect.top));
194- EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).left, Eq(expected_rect.left));
195- EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).height, Eq(expected_rect.height));
196- EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).width, Eq(expected_rect.width));
197+ EXPECT_THAT(mir_window_placement_get_relative_position(placement_event).top, Eq(expected_rect.top));
198+ EXPECT_THAT(mir_window_placement_get_relative_position(placement_event).left, Eq(expected_rect.left));
199+ EXPECT_THAT(mir_window_placement_get_relative_position(placement_event).height, Eq(expected_rect.height));
200+ EXPECT_THAT(mir_window_placement_get_relative_position(placement_event).width, Eq(expected_rect.width));
201
202 received.raise();
203 }

Subscribers

People subscribed via source and target branches