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
=== modified file 'include/client/mir/event_printer.h'
--- include/client/mir/event_printer.h 2017-01-11 14:16:14 +0000
+++ include/client/mir/event_printer.h 2017-01-11 14:16:15 +0000
@@ -52,7 +52,7 @@
52std::ostream& operator<<(std::ostream& out, MirKeymapEvent const& event);52std::ostream& operator<<(std::ostream& out, MirKeymapEvent const& event);
53std::ostream& operator<<(std::ostream& out, MirWindowEvent const& event);53std::ostream& operator<<(std::ostream& out, MirWindowEvent const& event);
54std::ostream& operator<<(std::ostream& out, MirInputDeviceStateEvent const& event);54std::ostream& operator<<(std::ostream& out, MirInputDeviceStateEvent const& event);
55std::ostream& operator<<(std::ostream& out, MirSurfacePlacementEvent const& event);55std::ostream& operator<<(std::ostream& out, MirWindowPlacementEvent const& event);
56std::ostream& operator<<(std::ostream& out, MirEvent const& event);56std::ostream& operator<<(std::ostream& out, MirEvent const& event);
5757
58}58}
5959
=== modified file 'include/client/mir_toolkit/events/event.h'
--- include/client/mir_toolkit/events/event.h 2017-01-11 14:16:14 +0000
+++ include/client/mir_toolkit/events/event.h 2017-01-11 14:16:15 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2014-2016 Canonical Ltd.2 * Copyright © 2014-2017 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
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,
@@ -70,7 +70,8 @@
70typedef struct MirSurfaceOutputEvent MirSurfaceOutputEvent; /* __attribute__ ((deprecated("use MirWindowOutputEvent instead"))); */70typedef struct MirSurfaceOutputEvent MirSurfaceOutputEvent; /* __attribute__ ((deprecated("use MirWindowOutputEvent instead"))); */
71typedef struct MirSurfaceOutputEvent MirWindowOutputEvent;71typedef struct MirSurfaceOutputEvent MirWindowOutputEvent;
72typedef struct MirInputDeviceStateEvent MirInputDeviceStateEvent;72typedef struct MirInputDeviceStateEvent MirInputDeviceStateEvent;
73typedef struct MirSurfacePlacementEvent MirSurfacePlacementEvent;73typedef struct MirSurfacePlacementEvent MirSurfacePlacementEvent; /* __attribute__ ((deprecated("use MirWindowPlacementEvent instead"))); */
74typedef struct MirSurfacePlacementEvent MirWindowPlacementEvent;
7475
75typedef struct MirCookie MirCookie;76typedef struct MirCookie MirCookie;
7677
@@ -266,6 +267,17 @@
266 * \return The associated MirSurfacePlacementEvent267 * \return The associated MirSurfacePlacementEvent
267 */268 */
268MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event);269MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event);
270/* __attribute__((deprecated("use mir_event_get_window_placement_event))) */
271
272/**
273 * Retrieve the MirWindowPlacementEvent associated with a MirEvent of
274 * type mir_event_type_window_placement. The event signifies that the
275 * the server has fulfilled a request for relative window placement.
276 *
277 * \param [in] event The event
278 * \return The associated MirWindowPlacementEvent
279 */
280MirWindowPlacementEvent const* mir_event_get_window_placement_event(MirEvent const* event);
269281
270/*282/*
271 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!283 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
272284
=== added file 'include/client/mir_toolkit/events/window_placement.h'
--- include/client/mir_toolkit/events/window_placement.h 1970-01-01 00:00:00 +0000
+++ include/client/mir_toolkit/events/window_placement.h 2017-01-11 14:16:15 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright © 2017 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 * Brandon Schaefer <brandon.schaefer@canonical.com>
18 */
19
20#ifndef MIR_TOOLKIT_WINDOW_PLACEMENT_H_
21#define MIR_TOOLKIT_WINDOW_PLACEMENT_H_
22
23#include <mir_toolkit/client_types.h>
24
25#ifdef __cplusplus
26/**
27 * \addtogroup mir_toolkit
28 * @{
29 */
30extern "C" {
31#endif
32
33/**
34 * Retrieve the relative position from a placement notification
35 *
36 * \param [in] event The placement event
37 * \return The position relative to the parent window
38 */
39MirRectangle mir_window_placement_get_relative_position(MirWindowPlacementEvent const* event);
40
41#ifdef __cplusplus
42}
43/**@}*/
44#endif
45
46#endif //MIR_TOOLKIT_WINDOW_PLACEMENT_H_
047
=== modified file 'src/client/event.cpp'
--- src/client/event.cpp 2017-01-11 14:16:14 +0000
+++ src/client/event.cpp 2017-01-11 14:16:15 +0000
@@ -33,6 +33,7 @@
33#include "mir_toolkit/events/orientation_event.h"33#include "mir_toolkit/events/orientation_event.h"
34#include "mir_toolkit/events/input_device_state_event.h"34#include "mir_toolkit/events/input_device_state_event.h"
35#include "mir_toolkit/events/surface_placement.h"35#include "mir_toolkit/events/surface_placement.h"
36#include "mir_toolkit/events/window_placement.h"
3637
37#include <cstdlib>38#include <cstdlib>
38#include <cstring>39#include <cstring>
@@ -412,10 +413,20 @@
412413
413MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(414MirSurfacePlacementEvent const* mir_event_get_surface_placement_event(MirEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(
414{415{
416 return mir_event_get_window_placement_event(event);
417})
418
419MirRectangle mir_surface_placement_get_relative_position(MirSurfacePlacementEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(
420{
421 return mir_window_placement_get_relative_position(event);
422})
423
424MirWindowPlacementEvent const* mir_event_get_window_placement_event(MirEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(
425{
415 return event->to_surface_placement();426 return event->to_surface_placement();
416})427})
417428
418MirRectangle mir_surface_placement_get_relative_position(MirSurfacePlacementEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(429MirRectangle mir_window_placement_get_relative_position(MirWindowPlacementEvent const* event) MIR_HANDLE_EVENT_EXCEPTION(
419{430{
420 return event->placement();431 return event->placement();
421})432})
422433
=== modified file 'src/client/event_printer.cpp'
--- src/client/event_printer.cpp 2017-01-11 14:16:14 +0000
+++ src/client/event_printer.cpp 2017-01-11 14:16:15 +0000
@@ -319,7 +319,7 @@
319319
320std::ostream& mir::operator<<(std::ostream& out, MirCloseWindowEvent const&)320std::ostream& mir::operator<<(std::ostream& out, MirCloseWindowEvent const&)
321{321{
322 return out << "close_surface_event()";322 return out << "close_window_event()";
323}323}
324324
325std::ostream& mir::operator<<(std::ostream& out, MirWindowEvent const& event)325std::ostream& mir::operator<<(std::ostream& out, MirWindowEvent const& event)
@@ -357,10 +357,10 @@
357 return out << ')';357 return out << ')';
358}358}
359359
360std::ostream& mir::operator<<(std::ostream& out, MirSurfacePlacementEvent const& event)360std::ostream& mir::operator<<(std::ostream& out, MirWindowPlacementEvent const& event)
361{361{
362 auto const& placement = event.placement();362 auto const& placement = event.placement();
363 return out << "surface_placement_event({"363 return out << "window_placement_event({"
364 << placement.left << ", "364 << placement.left << ", "
365 << placement.top << ", "365 << placement.top << ", "
366 << placement.width << ", "366 << placement.width << ", "
367367
=== modified file 'src/client/symbols.map'
--- src/client/symbols.map 2017-01-11 14:16:14 +0000
+++ src/client/symbols.map 2017-01-11 14:16:15 +0000
@@ -560,4 +560,6 @@
560 mir_window_output_event_get_scale;560 mir_window_output_event_get_scale;
561 mir_window_output_event_get_output_id;561 mir_window_output_event_get_output_id;
562 mir_window_output_event_get_refresh_rate;562 mir_window_output_event_get_refresh_rate;
563 mir_event_get_window_placement_event;
564 mir_window_placement_get_relative_position;
563} MIR_CLIENT_0.25;565} MIR_CLIENT_0.25;
564566
=== modified file 'tests/acceptance-tests/test_custom_window_management.cpp'
--- tests/acceptance-tests/test_custom_window_management.cpp 2017-01-11 14:16:14 +0000
+++ tests/acceptance-tests/test_custom_window_management.cpp 2017-01-11 14:16:15 +0000
@@ -19,6 +19,7 @@
19#include "mir/geometry/rectangle.h"19#include "mir/geometry/rectangle.h"
20#include "mir/scene/session.h"20#include "mir/scene/session.h"
21#include "mir_toolkit/events/surface_placement.h"21#include "mir_toolkit/events/surface_placement.h"
22#include "mir_toolkit/events/window_placement.h"
22#include "mir/events/event_builders.h"23#include "mir/events/event_builders.h"
23#include "mir/scene/surface.h"24#include "mir/scene/surface.h"
2425
@@ -529,12 +530,12 @@
529{530{
530 PlacementCheck(MirRectangle const& placement) : expected_rect{placement} {}531 PlacementCheck(MirRectangle const& placement) : expected_rect{placement} {}
531532
532 void check(MirSurfacePlacementEvent const* placement_event)533 void check(MirWindowPlacementEvent const* placement_event)
533 {534 {
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));
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));
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));
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));
538539
539 received.raise();540 received.raise();
540 }541 }

Subscribers

People subscribed via source and target branches