Mir

Merge lp:~albaguirre/mir/pref-orientation-at-create-time into lp:mir

Proposed by Alberto Aguirre
Status: Merged
Approved by: Cemil Azizoglu
Approved revision: no longer in the source branch.
Merged at revision: 2181
Proposed branch: lp:~albaguirre/mir/pref-orientation-at-create-time
Merge into: lp:mir
Prerequisite: lp:~albaguirre/mir/more-surface-create-time-params
Diff against target: 100 lines (+50/-1)
5 files modified
client-ABI-sha1sums (+1/-1)
include/client/mir_toolkit/mir_surface.h (+10/-0)
src/client/mir_surface_api.cpp (+6/-0)
src/client/symbols.map (+7/-0)
tests/acceptance-tests/test_client_surfaces.cpp (+26/-0)
To merge this branch: bzr merge lp:~albaguirre/mir/pref-orientation-at-create-time
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Approve
Kevin DuBois (community) Approve
Cemil Azizoglu (community) Approve
Robert Carr (community) Approve
Gerry Boland (community) Needs Information
Review via email: mp+244602@code.launchpad.net

Commit message

Add api to specify preferred orientation during surface creation

Description of the change

Add api to specify preferred orientation during surface creation

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

Just one? How about if app would prefer either landscape or inverse-landscape?

review: Needs Information
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

> Just one? How about if app would prefer either landscape or inverse-landscape?

It's a bitmask so one can specify any combination, here's the enum:

typedef enum MirOrientationMode
{
    mir_orientation_mode_portrait = 1 << 0,
    mir_orientation_mode_landscape = 1 << 1,
    mir_orientation_mode_portrait_inverted = 1 << 2,
    mir_orientation_mode_landscape_inverted = 1 << 3,
    mir_orientation_mode_portrait_any = mir_orientation_mode_portrait |
                                        mir_orientation_mode_portrait_inverted,
    mir_orientation_mode_landscape_any = mir_orientation_mode_landscape |
                                         mir_orientation_mode_landscape_inverted,
    mir_orientation_mode_any = mir_orientation_mode_portrait_any |
                               mir_orientation_mode_landscape_any
} MirOrientationMode;

Revision history for this message
Robert Carr (robertcarr) wrote :

I think the test would be a better if it proved that landscape wasn't just the default orientaiton.

Looks good though.

review: Approve
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Ok.

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

+1

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

There's a trivial conflict in src/client/mir_surface.cpp

~~~~

75 +TEST_F(ClientSurfaces, have_requested_preferred_orientation)

It would be good to parameterized the acceptance test (TEST_P) and instantiate on several orientations

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client-ABI-sha1sums'
2--- client-ABI-sha1sums 2014-12-18 12:11:25 +0000
3+++ client-ABI-sha1sums 2014-12-19 05:18:04 +0000
4@@ -6,7 +6,7 @@
5 d739af6e64db6b314a727b5fb00be662b98ccd57 include/client/mir_toolkit/mir_platform_message.h
6 9d50df5a141ca03ee8a79f7e844ed4b8b3b7d5d3 include/client/mir_toolkit/mir_prompt_session.h
7 21d07e655e85eeec8a3523e1c6f9c2252176ec01 include/client/mir_toolkit/mir_screencast.h
8-42bcad3a72b47f4d904e6b7033b0001b89cb9779 include/client/mir_toolkit/mir_surface.h
9+82a2a3d219747a778284811ba0c01e0fdf167b30 include/client/mir_toolkit/mir_surface.h
10 b141c4d79802ad626d969249c0004744e5c2a525 include/client/mir_toolkit/mir_wait.h
11 6f7b4ecc22afba923806ed2bd7d8244be90b0cfd include/client/mir_toolkit/version.h
12 23a009b06de7bac17d33d988dc8d968be8bc094a include/common/mir_toolkit/client_types.h
13
14=== modified file 'include/client/mir_toolkit/mir_surface.h'
15--- include/client/mir_toolkit/mir_surface.h 2014-12-09 03:14:55 +0000
16+++ include/client/mir_toolkit/mir_surface.h 2014-12-19 05:18:04 +0000
17@@ -142,6 +142,16 @@
18 bool mir_surface_spec_set_fullscreen_on_output(MirSurfaceSpec* spec, uint32_t output_id);
19
20 /**
21+ * Set the requested preferred orientation mode.
22+ * \param [in] spec Specification to mutate
23+ * \param [in] mode Requested preferred orientation
24+ * \return False if the mode is not valid for this surface type.
25+ * \note If the server is unable to create a surface with the preferred orientation at
26+ * the point mir_surface_create() is called it will instead return an invalid surface.
27+ */
28+bool mir_surface_spec_set_preferred_orientation(MirSurfaceSpec* spec, MirOrientationMode mode);
29+
30+/**
31 * Release the resources held by a MirSurfaceSpec.
32 *
33 * \param [in] spec Specification to release
34
35=== modified file 'src/client/mir_surface_api.cpp'
36--- src/client/mir_surface_api.cpp 2014-12-19 05:18:04 +0000
37+++ src/client/mir_surface_api.cpp 2014-12-19 05:18:04 +0000
38@@ -117,6 +117,12 @@
39 return true;
40 }
41
42+bool mir_surface_spec_set_preferred_orientation(MirSurfaceSpec* spec, MirOrientationMode mode)
43+{
44+ spec->pref_orientation = mode;
45+ return true;
46+}
47+
48 void mir_surface_spec_release(MirSurfaceSpec* spec)
49 {
50 delete spec;
51
52=== modified file 'src/client/symbols.map'
53--- src/client/symbols.map 2014-12-08 04:03:47 +0000
54+++ src/client/symbols.map 2014-12-19 05:18:04 +0000
55@@ -27,3 +27,10 @@
56 mir_surface_spec_set_buffer_usage;
57 mir_surface_spec_set_fullscreen_on_output;
58 } MIR_CLIENT_8;
59+
60+MIR_CLIENT_8.2 {
61+ global:
62+ mir_surface_set_preferred_orientation;
63+ mir_surface_get_preferred_orientation;
64+ mir_surface_spec_set_preferred_orientation;
65+} MIR_CLIENT_8.1;
66\ No newline at end of file
67
68=== modified file 'tests/acceptance-tests/test_client_surfaces.cpp'
69--- tests/acceptance-tests/test_client_surfaces.cpp 2014-12-15 06:24:03 +0000
70+++ tests/acceptance-tests/test_client_surfaces.cpp 2014-12-19 05:18:04 +0000
71@@ -185,3 +185,29 @@
72 wait_for_surface_release(ssync+i);
73 }
74
75+struct WithOrientation : ClientSurfaces, ::testing::WithParamInterface<MirOrientationMode> {};
76+
77+TEST_P(WithOrientation, have_requested_preferred_orientation)
78+{
79+ auto spec = mir_connection_create_spec_for_normal_surface(connection, 1, 1, mir_pixel_format_abgr_8888);
80+ ASSERT_TRUE(spec != nullptr);
81+
82+ MirOrientationMode mode{GetParam()};
83+ mir_surface_spec_set_preferred_orientation(spec, mode);
84+
85+ auto surface = mir_surface_create_sync(spec);
86+ mir_surface_spec_release(spec);
87+
88+ ASSERT_TRUE(mir_surface_is_valid(surface));
89+ EXPECT_EQ(mir_surface_get_preferred_orientation(surface), mode);
90+
91+ mir_surface_release_sync(surface);
92+}
93+
94+INSTANTIATE_TEST_CASE_P(ClientSurfaces,
95+ WithOrientation, ::testing::Values(
96+ mir_orientation_mode_portrait, mir_orientation_mode_landscape,
97+ mir_orientation_mode_portrait_inverted, mir_orientation_mode_landscape_inverted,
98+ mir_orientation_mode_portrait_any, mir_orientation_mode_landscape_any,
99+ mir_orientation_mode_any));
100+

Subscribers

People subscribed via source and target branches