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
=== modified file 'client-ABI-sha1sums'
--- client-ABI-sha1sums 2014-12-18 12:11:25 +0000
+++ client-ABI-sha1sums 2014-12-19 05:18:04 +0000
@@ -6,7 +6,7 @@
6d739af6e64db6b314a727b5fb00be662b98ccd57 include/client/mir_toolkit/mir_platform_message.h6d739af6e64db6b314a727b5fb00be662b98ccd57 include/client/mir_toolkit/mir_platform_message.h
79d50df5a141ca03ee8a79f7e844ed4b8b3b7d5d3 include/client/mir_toolkit/mir_prompt_session.h79d50df5a141ca03ee8a79f7e844ed4b8b3b7d5d3 include/client/mir_toolkit/mir_prompt_session.h
821d07e655e85eeec8a3523e1c6f9c2252176ec01 include/client/mir_toolkit/mir_screencast.h821d07e655e85eeec8a3523e1c6f9c2252176ec01 include/client/mir_toolkit/mir_screencast.h
942bcad3a72b47f4d904e6b7033b0001b89cb9779 include/client/mir_toolkit/mir_surface.h982a2a3d219747a778284811ba0c01e0fdf167b30 include/client/mir_toolkit/mir_surface.h
10b141c4d79802ad626d969249c0004744e5c2a525 include/client/mir_toolkit/mir_wait.h10b141c4d79802ad626d969249c0004744e5c2a525 include/client/mir_toolkit/mir_wait.h
116f7b4ecc22afba923806ed2bd7d8244be90b0cfd include/client/mir_toolkit/version.h116f7b4ecc22afba923806ed2bd7d8244be90b0cfd include/client/mir_toolkit/version.h
1223a009b06de7bac17d33d988dc8d968be8bc094a include/common/mir_toolkit/client_types.h1223a009b06de7bac17d33d988dc8d968be8bc094a include/common/mir_toolkit/client_types.h
1313
=== modified file 'include/client/mir_toolkit/mir_surface.h'
--- include/client/mir_toolkit/mir_surface.h 2014-12-09 03:14:55 +0000
+++ include/client/mir_toolkit/mir_surface.h 2014-12-19 05:18:04 +0000
@@ -142,6 +142,16 @@
142bool mir_surface_spec_set_fullscreen_on_output(MirSurfaceSpec* spec, uint32_t output_id);142bool mir_surface_spec_set_fullscreen_on_output(MirSurfaceSpec* spec, uint32_t output_id);
143143
144/**144/**
145 * Set the requested preferred orientation mode.
146 * \param [in] spec Specification to mutate
147 * \param [in] mode Requested preferred orientation
148 * \return False if the mode is not valid for this surface type.
149 * \note If the server is unable to create a surface with the preferred orientation at
150 * the point mir_surface_create() is called it will instead return an invalid surface.
151 */
152bool mir_surface_spec_set_preferred_orientation(MirSurfaceSpec* spec, MirOrientationMode mode);
153
154/**
145 * Release the resources held by a MirSurfaceSpec.155 * Release the resources held by a MirSurfaceSpec.
146 *156 *
147 * \param [in] spec Specification to release157 * \param [in] spec Specification to release
148158
=== modified file 'src/client/mir_surface_api.cpp'
--- src/client/mir_surface_api.cpp 2014-12-19 05:18:04 +0000
+++ src/client/mir_surface_api.cpp 2014-12-19 05:18:04 +0000
@@ -117,6 +117,12 @@
117 return true;117 return true;
118}118}
119119
120bool mir_surface_spec_set_preferred_orientation(MirSurfaceSpec* spec, MirOrientationMode mode)
121{
122 spec->pref_orientation = mode;
123 return true;
124}
125
120void mir_surface_spec_release(MirSurfaceSpec* spec)126void mir_surface_spec_release(MirSurfaceSpec* spec)
121{127{
122 delete spec;128 delete spec;
123129
=== modified file 'src/client/symbols.map'
--- src/client/symbols.map 2014-12-08 04:03:47 +0000
+++ src/client/symbols.map 2014-12-19 05:18:04 +0000
@@ -27,3 +27,10 @@
27 mir_surface_spec_set_buffer_usage;27 mir_surface_spec_set_buffer_usage;
28 mir_surface_spec_set_fullscreen_on_output;28 mir_surface_spec_set_fullscreen_on_output;
29} MIR_CLIENT_8;29} MIR_CLIENT_8;
30
31MIR_CLIENT_8.2 {
32 global:
33 mir_surface_set_preferred_orientation;
34 mir_surface_get_preferred_orientation;
35 mir_surface_spec_set_preferred_orientation;
36} MIR_CLIENT_8.1;
30\ No newline at end of file37\ No newline at end of file
3138
=== modified file 'tests/acceptance-tests/test_client_surfaces.cpp'
--- tests/acceptance-tests/test_client_surfaces.cpp 2014-12-15 06:24:03 +0000
+++ tests/acceptance-tests/test_client_surfaces.cpp 2014-12-19 05:18:04 +0000
@@ -185,3 +185,29 @@
185 wait_for_surface_release(ssync+i);185 wait_for_surface_release(ssync+i);
186}186}
187187
188struct WithOrientation : ClientSurfaces, ::testing::WithParamInterface<MirOrientationMode> {};
189
190TEST_P(WithOrientation, have_requested_preferred_orientation)
191{
192 auto spec = mir_connection_create_spec_for_normal_surface(connection, 1, 1, mir_pixel_format_abgr_8888);
193 ASSERT_TRUE(spec != nullptr);
194
195 MirOrientationMode mode{GetParam()};
196 mir_surface_spec_set_preferred_orientation(spec, mode);
197
198 auto surface = mir_surface_create_sync(spec);
199 mir_surface_spec_release(spec);
200
201 ASSERT_TRUE(mir_surface_is_valid(surface));
202 EXPECT_EQ(mir_surface_get_preferred_orientation(surface), mode);
203
204 mir_surface_release_sync(surface);
205}
206
207INSTANTIATE_TEST_CASE_P(ClientSurfaces,
208 WithOrientation, ::testing::Values(
209 mir_orientation_mode_portrait, mir_orientation_mode_landscape,
210 mir_orientation_mode_portrait_inverted, mir_orientation_mode_landscape_inverted,
211 mir_orientation_mode_portrait_any, mir_orientation_mode_landscape_any,
212 mir_orientation_mode_any));
213

Subscribers

People subscribed via source and target branches