Merge lp:~brandontschaefer/mir/usr-mir-window-placement into lp:mir
- usr-mir-window-placement
- Merge into development-branch
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 |
Related bugs: |
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 MirWindowPlacem
Description of the change
Use MirWindowPlacem
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3926
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: 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:3931
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3933
https:/
Executed test runs:
ABORTED: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
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 | 52 | std::ostream& operator<<(std::ostream& out, MirKeymapEvent const& event); | 52 | std::ostream& operator<<(std::ostream& out, MirKeymapEvent const& event); |
6 | 53 | std::ostream& operator<<(std::ostream& out, MirWindowEvent const& event); | 53 | std::ostream& operator<<(std::ostream& out, MirWindowEvent const& event); |
7 | 54 | std::ostream& operator<<(std::ostream& out, MirInputDeviceStateEvent const& event); | 54 | std::ostream& operator<<(std::ostream& out, MirInputDeviceStateEvent const& event); |
9 | 55 | std::ostream& operator<<(std::ostream& out, MirSurfacePlacementEvent const& event); | 55 | std::ostream& operator<<(std::ostream& out, MirWindowPlacementEvent const& event); |
10 | 56 | std::ostream& operator<<(std::ostream& out, MirEvent const& event); | 56 | std::ostream& operator<<(std::ostream& out, MirEvent const& event); |
11 | 57 | 57 | ||
12 | 58 | } | 58 | } |
13 | 59 | 59 | ||
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 | 1 | /* | 1 | /* |
20 | 2 | * Copyright © 2014-2016 Canonical Ltd. | 2 | * Copyright © 2014-2017 Canonical Ltd. |
21 | 3 | * | 3 | * |
22 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
23 | 5 | * under the terms of the GNU Lesser General Public License version 3, | 5 | * under the terms of the GNU Lesser General Public License version 3, |
24 | @@ -70,7 +70,8 @@ | |||
25 | 70 | typedef struct MirSurfaceOutputEvent MirSurfaceOutputEvent; /* __attribute__ ((deprecated("use MirWindowOutputEvent instead"))); */ | 70 | typedef struct MirSurfaceOutputEvent MirSurfaceOutputEvent; /* __attribute__ ((deprecated("use MirWindowOutputEvent instead"))); */ |
26 | 71 | typedef struct MirSurfaceOutputEvent MirWindowOutputEvent; | 71 | typedef struct MirSurfaceOutputEvent MirWindowOutputEvent; |
27 | 72 | typedef struct MirInputDeviceStateEvent MirInputDeviceStateEvent; | 72 | typedef struct MirInputDeviceStateEvent MirInputDeviceStateEvent; |
29 | 73 | typedef struct MirSurfacePlacementEvent MirSurfacePlacementEvent; | 73 | typedef struct MirSurfacePlacementEvent MirSurfacePlacementEvent; /* __attribute__ ((deprecated("use MirWindowPlacementEvent instead"))); */ |
30 | 74 | typedef struct MirSurfacePlacementEvent MirWindowPlacementEvent; | ||
31 | 74 | 75 | ||
32 | 75 | typedef struct MirCookie MirCookie; | 76 | typedef struct MirCookie MirCookie; |
33 | 76 | 77 | ||
34 | @@ -266,6 +267,17 @@ | |||
35 | 266 | * \return The associated MirSurfacePlacementEvent | 267 | * \return The associated MirSurfacePlacementEvent |
36 | 267 | */ | 268 | */ |
37 | 268 | MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event); | 269 | MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event); |
38 | 270 | /* __attribute__((deprecated("use mir_event_get_window_placement_event))) */ | ||
39 | 271 | |||
40 | 272 | /** | ||
41 | 273 | * Retrieve the MirWindowPlacementEvent associated with a MirEvent of | ||
42 | 274 | * type mir_event_type_window_placement. The event signifies that the | ||
43 | 275 | * the server has fulfilled a request for relative window placement. | ||
44 | 276 | * | ||
45 | 277 | * \param [in] event The event | ||
46 | 278 | * \return The associated MirWindowPlacementEvent | ||
47 | 279 | */ | ||
48 | 280 | MirWindowPlacementEvent const* mir_event_get_window_placement_event(MirEvent const* event); | ||
49 | 269 | 281 | ||
50 | 270 | /* | 282 | /* |
51 | 271 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 283 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
52 | 272 | 284 | ||
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 | 1 | /* | ||
58 | 2 | * Copyright © 2017 Canonical Ltd. | ||
59 | 3 | * | ||
60 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
61 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
62 | 6 | * as published by the Free Software Foundation. | ||
63 | 7 | * | ||
64 | 8 | * This program is distributed in the hope that it will be useful, | ||
65 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
66 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
67 | 11 | * GNU Lesser General Public License for more details. | ||
68 | 12 | * | ||
69 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
70 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
71 | 15 | * | ||
72 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
73 | 17 | * Brandon Schaefer <brandon.schaefer@canonical.com> | ||
74 | 18 | */ | ||
75 | 19 | |||
76 | 20 | #ifndef MIR_TOOLKIT_WINDOW_PLACEMENT_H_ | ||
77 | 21 | #define MIR_TOOLKIT_WINDOW_PLACEMENT_H_ | ||
78 | 22 | |||
79 | 23 | #include <mir_toolkit/client_types.h> | ||
80 | 24 | |||
81 | 25 | #ifdef __cplusplus | ||
82 | 26 | /** | ||
83 | 27 | * \addtogroup mir_toolkit | ||
84 | 28 | * @{ | ||
85 | 29 | */ | ||
86 | 30 | extern "C" { | ||
87 | 31 | #endif | ||
88 | 32 | |||
89 | 33 | /** | ||
90 | 34 | * Retrieve the relative position from a placement notification | ||
91 | 35 | * | ||
92 | 36 | * \param [in] event The placement event | ||
93 | 37 | * \return The position relative to the parent window | ||
94 | 38 | */ | ||
95 | 39 | MirRectangle mir_window_placement_get_relative_position(MirWindowPlacementEvent const* event); | ||
96 | 40 | |||
97 | 41 | #ifdef __cplusplus | ||
98 | 42 | } | ||
99 | 43 | /**@}*/ | ||
100 | 44 | #endif | ||
101 | 45 | |||
102 | 46 | #endif //MIR_TOOLKIT_WINDOW_PLACEMENT_H_ | ||
103 | 0 | 47 | ||
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 | 33 | #include "mir_toolkit/events/orientation_event.h" | 33 | #include "mir_toolkit/events/orientation_event.h" |
109 | 34 | #include "mir_toolkit/events/input_device_state_event.h" | 34 | #include "mir_toolkit/events/input_device_state_event.h" |
110 | 35 | #include "mir_toolkit/events/surface_placement.h" | 35 | #include "mir_toolkit/events/surface_placement.h" |
111 | 36 | #include "mir_toolkit/events/window_placement.h" | ||
112 | 36 | 37 | ||
113 | 37 | #include <cstdlib> | 38 | #include <cstdlib> |
114 | 38 | #include <cstring> | 39 | #include <cstring> |
115 | @@ -412,10 +413,20 @@ | |||
116 | 412 | 413 | ||
117 | 413 | MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event) MIR_HANDLE_EVENT_EXCEPTION( | 414 | MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event) MIR_HANDLE_EVENT_EXCEPTION( |
118 | 414 | { | 415 | { |
119 | 416 | return mir_event_get_window_placement_event(event); | ||
120 | 417 | }) | ||
121 | 418 | |||
122 | 419 | MirRectangle mir_surface_placement_get_relative_position(MirSurfacePlacementEvent const* event) MIR_HANDLE_EVENT_EXCEPTION( | ||
123 | 420 | { | ||
124 | 421 | return mir_window_placement_get_relative_position(event); | ||
125 | 422 | }) | ||
126 | 423 | |||
127 | 424 | MirWindowPlacementEvent const* mir_event_get_window_placement_event(MirEvent const* event) MIR_HANDLE_EVENT_EXCEPTION( | ||
128 | 425 | { | ||
129 | 415 | return event->to_surface_placement(); | 426 | return event->to_surface_placement(); |
130 | 416 | }) | 427 | }) |
131 | 417 | 428 | ||
133 | 418 | MirRectangle mir_surface_placement_get_relative_position(MirSurfacePlacementEvent const* event) MIR_HANDLE_EVENT_EXCEPTION( | 429 | MirRectangle mir_window_placement_get_relative_position(MirWindowPlacementEvent const* event) MIR_HANDLE_EVENT_EXCEPTION( |
134 | 419 | { | 430 | { |
135 | 420 | return event->placement(); | 431 | return event->placement(); |
136 | 421 | }) | 432 | }) |
137 | 422 | 433 | ||
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 | 319 | 319 | ||
143 | 320 | std::ostream& mir::operator<<(std::ostream& out, MirCloseWindowEvent const&) | 320 | std::ostream& mir::operator<<(std::ostream& out, MirCloseWindowEvent const&) |
144 | 321 | { | 321 | { |
146 | 322 | return out << "close_surface_event()"; | 322 | return out << "close_window_event()"; |
147 | 323 | } | 323 | } |
148 | 324 | 324 | ||
149 | 325 | std::ostream& mir::operator<<(std::ostream& out, MirWindowEvent const& event) | 325 | std::ostream& mir::operator<<(std::ostream& out, MirWindowEvent const& event) |
150 | @@ -357,10 +357,10 @@ | |||
151 | 357 | return out << ')'; | 357 | return out << ')'; |
152 | 358 | } | 358 | } |
153 | 359 | 359 | ||
155 | 360 | std::ostream& mir::operator<<(std::ostream& out, MirSurfacePlacementEvent const& event) | 360 | std::ostream& mir::operator<<(std::ostream& out, MirWindowPlacementEvent const& event) |
156 | 361 | { | 361 | { |
157 | 362 | auto const& placement = event.placement(); | 362 | auto const& placement = event.placement(); |
159 | 363 | return out << "surface_placement_event({" | 363 | return out << "window_placement_event({" |
160 | 364 | << placement.left << ", " | 364 | << placement.left << ", " |
161 | 365 | << placement.top << ", " | 365 | << placement.top << ", " |
162 | 366 | << placement.width << ", " | 366 | << placement.width << ", " |
163 | 367 | 367 | ||
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 | 560 | mir_window_output_event_get_scale; | 560 | mir_window_output_event_get_scale; |
169 | 561 | mir_window_output_event_get_output_id; | 561 | mir_window_output_event_get_output_id; |
170 | 562 | mir_window_output_event_get_refresh_rate; | 562 | mir_window_output_event_get_refresh_rate; |
171 | 563 | mir_event_get_window_placement_event; | ||
172 | 564 | mir_window_placement_get_relative_position; | ||
173 | 563 | } MIR_CLIENT_0.25; | 565 | } MIR_CLIENT_0.25; |
174 | 564 | 566 | ||
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 | 19 | #include "mir/geometry/rectangle.h" | 19 | #include "mir/geometry/rectangle.h" |
180 | 20 | #include "mir/scene/session.h" | 20 | #include "mir/scene/session.h" |
181 | 21 | #include "mir_toolkit/events/surface_placement.h" | 21 | #include "mir_toolkit/events/surface_placement.h" |
182 | 22 | #include "mir_toolkit/events/window_placement.h" | ||
183 | 22 | #include "mir/events/event_builders.h" | 23 | #include "mir/events/event_builders.h" |
184 | 23 | #include "mir/scene/surface.h" | 24 | #include "mir/scene/surface.h" |
185 | 24 | 25 | ||
186 | @@ -529,12 +530,12 @@ | |||
187 | 529 | { | 530 | { |
188 | 530 | PlacementCheck(MirRectangle const& placement) : expected_rect{placement} {} | 531 | PlacementCheck(MirRectangle const& placement) : expected_rect{placement} {} |
189 | 531 | 532 | ||
191 | 532 | void check(MirSurfacePlacementEvent const* placement_event) | 533 | void check(MirWindowPlacementEvent const* placement_event) |
192 | 533 | { | 534 | { |
197 | 534 | EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).top, Eq(expected_rect.top)); | 535 | EXPECT_THAT(mir_window_placement_get_relative_position(placement_event).top, Eq(expected_rect.top)); |
198 | 535 | EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).left, Eq(expected_rect.left)); | 536 | EXPECT_THAT(mir_window_placement_get_relative_position(placement_event).left, Eq(expected_rect.left)); |
199 | 536 | EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).height, Eq(expected_rect.height)); | 537 | EXPECT_THAT(mir_window_placement_get_relative_position(placement_event).height, Eq(expected_rect.height)); |
200 | 537 | EXPECT_THAT(mir_surface_placement_get_relative_position(placement_event).width, Eq(expected_rect.width)); | 538 | EXPECT_THAT(mir_window_placement_get_relative_position(placement_event).width, Eq(expected_rect.width)); |
201 | 538 | 539 | ||
202 | 539 | received.raise(); | 540 | received.raise(); |
203 | 540 | } | 541 | } |
36 MirSurfacePlace mentEvent 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 MirSurfacePlace mentEvent MirWindowPlacem entEvent;
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( MirSurfacePlace mentEvent const* event) MIR_HANDLE_ EVENT_EXCEPTION ( placement_ get_relative_ position( MirWindowPlacem entEvent const* event) MIR_HANDLE_ EVENT_EXCEPTION (
133 +MirRectangle mir_window_
Must not replace the old function. Just call the new function from the old