Merge lp:~gerboland/platform-api/exposeOrientation into lp:platform-api

Proposed by Gerry Boland
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: 262
Merged at revision: 266
Proposed branch: lp:~gerboland/platform-api/exposeOrientation
Merge into: lp:platform-api
Diff against target: 305 lines (+118/-1)
14 files modified
android/default/default_ubuntu_application_ui.cpp (+11/-0)
debian/changelog (+6/-0)
debian/libubuntu-application-api2.symbols (+3/-0)
include/ubuntu/application/ui/CMakeLists.txt (+1/-0)
include/ubuntu/application/ui/input/event.h (+12/-1)
include/ubuntu/application/ui/window.h (+5/-0)
include/ubuntu/application/ui/window_orientation.h (+27/-0)
src/ubuntu/application/common/mirclient/window_mirclient.cpp (+13/-0)
src/ubuntu/application/common/mirclient/window_mirclient_priv.h (+1/-0)
src/ubuntu/application/common/mircommon/event_helpers_mir.cpp (+28/-0)
src/ubuntu/application/common/mircommon/event_helpers_mir.h (+4/-0)
src/ubuntu/application/testbackend/test_stubs.cpp (+5/-0)
src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp (+1/-0)
src/ubuntu/application/ubuntu_application_api.cpp (+1/-0)
To merge this branch: bzr merge lp:~gerboland/platform-api/exposeOrientation
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) Approve
PS Jenkins bot continuous-integration Approve
Gerry Boland Pending
Review via email: mp+232250@code.launchpad.net

Commit message

Add readonly notifyable property "orientation" to Window

Description of the change

Add window orientation property

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
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

"""
 ua_ui_window_get_orientation@Base 2.2.1+14.10.20140812
"""

Instead of specifying a version (which is wrong anyway as the date part certainly will change), let the magic release scripts do the trick:

 ua_ui_window_get_orientation@Base 0replaceme

review: Needs Fixing
Revision history for this message
Gerry Boland (gerboland) wrote :

> """
> ua_ui_window_get_orientation@Base 2.2.1+14.10.20140812
> """
>
> Instead of specifying a version (which is wrong anyway as the date part
> certainly will change), let the magic release scripts do the trick:
>
> ua_ui_window_get_orientation@Base 0replaceme

Ah that's cool, I didn't know that

261. By Gerry Boland

Add newline to warning message

262. By Gerry Boland

[debian] symbols file - let magic release scripts figure out new symbol version

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) :
review: Approve
263. By Gerry Boland

Merge trunk. Bump to version 2.4.0

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'android/default/default_ubuntu_application_ui.cpp'
--- android/default/default_ubuntu_application_ui.cpp 2014-07-15 12:41:35 +0000
+++ android/default/default_ubuntu_application_ui.cpp 2014-09-19 12:17:12 +0000
@@ -443,3 +443,14 @@
443 auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);443 auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
444 return p->value->to_native_window_type();444 return p->value->to_native_window_type();
445}445}
446
447UApplicationUiWindowOrientation
448ua_ui_window_get_orientation(
449 UAUiWindow *window)
450{
451 ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
452
453 auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
454 return p->value->get_orientation();
455}
456
446457
=== modified file 'debian/changelog'
--- debian/changelog 2014-09-16 19:28:22 +0000
+++ debian/changelog 2014-09-19 12:17:12 +0000
@@ -1,3 +1,9 @@
1platform-api (2.4.0) UNRELEASED; urgency=medium
2
3 * Add window orientation property (readonly, notifyable)
4
5 -- Gerry Boland <gerry.boland@canonical.com> Fri, 19 Sep 2014 13:04:51 +0100
6
1platform-api (2.3.0+14.10.20140916.3-0ubuntu1) utopic; urgency=medium7platform-api (2.3.0+14.10.20140916.3-0ubuntu1) utopic; urgency=medium
28
3 [ Thomas Voß ]9 [ Thomas Voß ]
410
=== modified file 'debian/libubuntu-application-api2.symbols'
--- debian/libubuntu-application-api2.symbols 2014-07-28 02:53:24 +0000
+++ debian/libubuntu-application-api2.symbols 2014-09-19 12:17:12 +0000
@@ -57,6 +57,8 @@
57 ua_location_service_session_stop_position_updates@Base 0.18.3+13.10.2013080757 ua_location_service_session_stop_position_updates@Base 0.18.3+13.10.20130807
58 ua_location_service_session_stop_velocity_updates@Base 0.18.3+13.10.2013080758 ua_location_service_session_stop_velocity_updates@Base 0.18.3+13.10.20130807
59 ua_location_service_session_unref@Base 0.18.3+13.10.2013080759 ua_location_service_session_unref@Base 0.18.3+13.10.20130807
60 ua_location_service_try_create_session_for_high_accuracy@Base 2.4.0
61 ua_location_service_try_create_session_for_low_accuracy@Base 2.4.0
60 ua_location_velocity_update_get_timestamp@Base 0.18.3+13.10.2013080762 ua_location_velocity_update_get_timestamp@Base 0.18.3+13.10.20130807
61 ua_location_velocity_update_get_velocity_in_meters_per_second@Base 0.18.3+13.10.2013080763 ua_location_velocity_update_get_velocity_in_meters_per_second@Base 0.18.3+13.10.20130807
62 ua_location_velocity_update_ref@Base 0.18.3+13.10.2013080764 ua_location_velocity_update_ref@Base 0.18.3+13.10.20130807
@@ -115,6 +117,7 @@
115 ua_ui_set_clipboard_content@Base 0.18.1daily13.06.21117 ua_ui_set_clipboard_content@Base 0.18.1daily13.06.21
116 ua_ui_window_destroy@Base 0.18.1daily13.06.21118 ua_ui_window_destroy@Base 0.18.1daily13.06.21
117 ua_ui_window_get_native_type@Base 0.18.1daily13.06.21119 ua_ui_window_get_native_type@Base 0.18.1daily13.06.21
120 ua_ui_window_get_orientation@Base 0replaceme
118 ua_ui_window_get_size@Base 2.0.0+14.10.20140612121 ua_ui_window_get_size@Base 2.0.0+14.10.20140612
119 ua_ui_window_hide@Base 0.18.1daily13.06.21122 ua_ui_window_hide@Base 0.18.1daily13.06.21
120 ua_ui_window_is_focused@Base 2.2.0+14.10.20140728123 ua_ui_window_is_focused@Base 2.2.0+14.10.20140728
121124
=== modified file 'include/ubuntu/application/ui/CMakeLists.txt'
--- include/ubuntu/application/ui/CMakeLists.txt 2013-08-18 20:33:22 +0000
+++ include/ubuntu/application/ui/CMakeLists.txt 2014-09-19 12:17:12 +0000
@@ -12,6 +12,7 @@
12 session.h12 session.h
13 stage.h13 stage.h
14 window.h14 window.h
15 window_orientation.h
15 window_parent.h16 window_parent.h
16 window_properties.h17 window_properties.h
17 window_state.h18 window_state.h
1819
=== modified file 'include/ubuntu/application/ui/input/event.h'
--- include/ubuntu/application/ui/input/event.h 2014-08-18 11:01:17 +0000
+++ include/ubuntu/application/ui/input/event.h 2014-09-19 12:17:12 +0000
@@ -20,6 +20,7 @@
20#define UBUNTU_APPLICATION_UI_INPUT_EVENT_H_20#define UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
2121
22#include <ubuntu/visibility.h>22#include <ubuntu/visibility.h>
23#include <ubuntu/application/ui/window_orientation.h>
2324
24#include <stddef.h>25#include <stddef.h>
25#include <stdint.h>26#include <stdint.h>
@@ -120,7 +121,8 @@
120 KEY_WEVENT_TYPE, ///< Event originates from a keyboard.121 KEY_WEVENT_TYPE, ///< Event originates from a keyboard.
121 MOTION_WEVENT_TYPE, ///< Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad.122 MOTION_WEVENT_TYPE, ///< Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad.
122 RESIZE_WEVENT_TYPE, ///< Surface has been resized123 RESIZE_WEVENT_TYPE, ///< Surface has been resized
123 SURFACE_WEVENT_TYPE //< A surface attribute has changed its value124 SURFACE_WEVENT_TYPE, ///< A surface attribute has changed its value
125 ORIENTATION_WEVENT_TYPE, ///< The device orientation changed
124} WindowEventType;126} WindowEventType;
125127
126/** Information describing an event originating from a keyboard key. */128/** Information describing an event originating from a keyboard key. */
@@ -197,6 +199,14 @@
197 int32_t height; ///< The new surface height.199 int32_t height; ///< The new surface height.
198} ResizeEvent;200} ResizeEvent;
199201
202/** Information describing a surface orientation change event. */
203typedef struct
204{
205 WindowEventType type;
206
207 UApplicationUiWindowOrientation direction; ///< The new surface orientation
208} OrientationEvent;
209
200typedef union210typedef union
201{211{
202 WindowEventType type;212 WindowEventType type;
@@ -204,6 +214,7 @@
204 MotionEvent motion;214 MotionEvent motion;
205 SurfaceEvent surface;215 SurfaceEvent surface;
206 ResizeEvent resize;216 ResizeEvent resize;
217 OrientationEvent orientation;
207} WindowEvent;218} WindowEvent;
208219
209#ifdef __cplusplus220#ifdef __cplusplus
210221
=== modified file 'include/ubuntu/application/ui/window.h'
--- include/ubuntu/application/ui/window.h 2014-07-02 00:05:20 +0000
+++ include/ubuntu/application/ui/window.h 2014-09-19 12:17:12 +0000
@@ -25,6 +25,7 @@
25#include <ubuntu/status.h>25#include <ubuntu/status.h>
26#include <ubuntu/application/instance.h>26#include <ubuntu/application/instance.h>
27#include <ubuntu/application/ui/window_properties.h>27#include <ubuntu/application/ui/window_properties.h>
28#include <ubuntu/application/ui/window_orientation.h>
2829
29#include <EGL/egl.h>30#include <EGL/egl.h>
3031
@@ -89,6 +90,10 @@
89 ua_ui_window_is_focused(90 ua_ui_window_is_focused(
90 UAUiWindow *window);91 UAUiWindow *window);
9192
93 UBUNTU_DLL_PUBLIC UApplicationUiWindowOrientation
94 ua_ui_window_get_orientation(
95 UAUiWindow *window);
96
92#ifdef __cplusplus97#ifdef __cplusplus
93}98}
94#endif99#endif
95100
=== added file 'include/ubuntu/application/ui/window_orientation.h'
--- include/ubuntu/application/ui/window_orientation.h 1970-01-01 00:00:00 +0000
+++ include/ubuntu/application/ui/window_orientation.h 2014-09-19 12:17:12 +0000
@@ -0,0 +1,27 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 3 as
6 * 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
17#ifndef UBUNTU_APPLICATION_UI_WINDOW_ORIENTATION_H
18#define UBUNTU_APPLICATION_UI_WINDOW_ORIENTATION_H
19
20typedef enum {
21 U_ORIENTATION_NORMAL = 1,
22 U_ORIENTATION_LEFT,
23 U_ORIENTATION_RIGHT,
24 U_ORIENTATION_INVERTED,
25} UApplicationUiWindowOrientation;
26
27#endif // UBUNTU_APPLICATION_UI_WINDOW_ORIENTATION_H
028
=== modified file 'src/ubuntu/application/common/mirclient/window_mirclient.cpp'
--- src/ubuntu/application/common/mirclient/window_mirclient.cpp 2014-07-15 12:41:35 +0000
+++ src/ubuntu/application/common/mirclient/window_mirclient.cpp 2014-09-19 12:17:12 +0000
@@ -169,6 +169,19 @@
169 *height = parameters.height;169 *height = parameters.height;
170}170}
171171
172UApplicationUiWindowOrientation uamc::Window::orientation() const
173{
174 UApplicationUiWindowOrientation ubuntu_orientation;
175 MirOrientation mir_orientation = mir_surface_get_orientation(surface.get());
176
177 if (uaum::orientation_to_ubuntu_orientation(mir_orientation, ubuntu_orientation)) {
178 return ubuntu_orientation;
179 } else {
180 printf("Unknown MirOrientation!\n");
181 return U_ORIENTATION_NORMAL;
182 }
183}
184
172void uamc::Window::hide()185void uamc::Window::hide()
173{186{
174 state_before_hiding = state();187 state_before_hiding = state();
175188
=== modified file 'src/ubuntu/application/common/mirclient/window_mirclient_priv.h'
--- src/ubuntu/application/common/mirclient/window_mirclient_priv.h 2014-07-15 12:41:35 +0000
+++ src/ubuntu/application/common/mirclient/window_mirclient_priv.h 2014-09-19 12:17:12 +0000
@@ -54,6 +54,7 @@
54 EGLNativeWindowType get_native_type();54 EGLNativeWindowType get_native_type();
5555
56 UApplicationUiWindowState state() const;56 UApplicationUiWindowState state() const;
57 UApplicationUiWindowOrientation orientation() const;
5758
58 void hide();59 void hide();
59 void show();60 void show();
6061
=== modified file 'src/ubuntu/application/common/mircommon/event_helpers_mir.cpp'
--- src/ubuntu/application/common/mircommon/event_helpers_mir.cpp 2014-07-15 12:41:35 +0000
+++ src/ubuntu/application/common/mircommon/event_helpers_mir.cpp 2014-09-19 12:17:12 +0000
@@ -85,6 +85,13 @@
85 } else {85 } else {
86 return false;86 return false;
87 }87 }
88 case mir_event_type_orientation:
89 ubuntu_ev.surface.type = ORIENTATION_WEVENT_TYPE;
90 if (orientation_to_ubuntu_orientation(mir_event->orientation.direction, ubuntu_ev.orientation.direction)) {
91 return true;
92 } else {
93 return false;
94 }
88 default:95 default:
89 return false;96 return false;
90 }97 }
@@ -144,3 +151,24 @@
144 return false;151 return false;
145 }152 }
146}153}
154
155bool uaum::orientation_to_ubuntu_orientation(MirOrientation const mir_orient,
156 UApplicationUiWindowOrientation& ubuntu_orient)
157{
158 switch (mir_orient) {
159 case mir_orientation_normal:
160 ubuntu_orient = U_ORIENTATION_NORMAL;
161 return true;
162 case mir_orientation_left:
163 ubuntu_orient = U_ORIENTATION_LEFT;
164 return true;
165 case mir_orientation_inverted:
166 ubuntu_orient = U_ORIENTATION_INVERTED;
167 return true;
168 case mir_orientation_right:
169 ubuntu_orient = U_ORIENTATION_RIGHT;
170 return true;
171 default:
172 return false;
173 }
174}
147175
=== modified file 'src/ubuntu/application/common/mircommon/event_helpers_mir.h'
--- src/ubuntu/application/common/mircommon/event_helpers_mir.h 2014-07-15 12:41:35 +0000
+++ src/ubuntu/application/common/mircommon/event_helpers_mir.h 2014-09-19 12:17:12 +0000
@@ -20,6 +20,7 @@
20#define UBUNTU_EVENT_HELPERS_MIR_COMMON_H_20#define UBUNTU_EVENT_HELPERS_MIR_COMMON_H_
2121
22#include <ubuntu/application/ui/input/event.h>22#include <ubuntu/application/ui/input/event.h>
23#include <ubuntu/application/ui/window_orientation.h>
23#include <mir_toolkit/event.h>24#include <mir_toolkit/event.h>
2425
25namespace ubuntu26namespace ubuntu
@@ -32,6 +33,9 @@
32{33{
33bool event_to_ubuntu_event(MirEvent const* mir_event, WindowEvent& ubuntu_ev);34bool event_to_ubuntu_event(MirEvent const* mir_event, WindowEvent& ubuntu_ev);
34bool event_to_ubuntu_deprecated_event(MirEvent const* mir_event, Event& ubuntu_ev);35bool event_to_ubuntu_deprecated_event(MirEvent const* mir_event, Event& ubuntu_ev);
36
37bool orientation_to_ubuntu_orientation(MirOrientation const mir_orient,
38 UApplicationUiWindowOrientation& ubuntu_orient);
35}39}
36}40}
37}41}
3842
=== modified file 'src/ubuntu/application/testbackend/test_stubs.cpp'
--- src/ubuntu/application/testbackend/test_stubs.cpp 2014-07-15 12:41:35 +0000
+++ src/ubuntu/application/testbackend/test_stubs.cpp 2014-09-19 12:17:12 +0000
@@ -252,6 +252,11 @@
252 return 0;252 return 0;
253}253}
254254
255UApplicationUiWindowOrientation ua_ui_window_get_orientation(UAUiWindow*)
256{
257 return U_ORIENTATION_NORMAL;
258}
259
255UStatus ua_ui_window_show(UAUiWindow*)260UStatus ua_ui_window_show(UAUiWindow*)
256{261{
257 return U_STATUS_ERROR;262 return U_STATUS_ERROR;
258263
=== modified file 'src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp'
--- src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp 2014-07-15 12:41:35 +0000
+++ src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp 2014-09-19 12:17:12 +0000
@@ -106,6 +106,7 @@
106IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_show, UAUiWindow*);106IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_show, UAUiWindow*);
107IMPLEMENT_VOID_FUNCTION1(ua_ui_window_request_fullscreen, UAUiWindow*);107IMPLEMENT_VOID_FUNCTION1(ua_ui_window_request_fullscreen, UAUiWindow*);
108IMPLEMENT_FUNCTION1(EGLNativeWindowType, ua_ui_window_get_native_type, UAUiWindow*);108IMPLEMENT_FUNCTION1(EGLNativeWindowType, ua_ui_window_get_native_type, UAUiWindow*);
109IMPLEMENT_FUNCTION1(UApplicationUiWindowOrientation, ua_ui_window_get_orientation, UAUiWindow*);
109110
110/* -------------------------------------------------------------------------- *111/* -------------------------------------------------------------------------- *
111 * * * * * * * * * * * * * * * Deprecated API * * * * * * * * * * * * * * * * *112 * * * * * * * * * * * * * * * Deprecated API * * * * * * * * * * * * * * * * *
112113
=== modified file 'src/ubuntu/application/ubuntu_application_api.cpp'
--- src/ubuntu/application/ubuntu_application_api.cpp 2014-09-15 20:41:36 +0000
+++ src/ubuntu/application/ubuntu_application_api.cpp 2014-09-19 12:17:12 +0000
@@ -121,6 +121,7 @@
121IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_show, UAUiWindow*);121IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_show, UAUiWindow*);
122IMPLEMENT_VOID_FUNCTION1(ua_ui_window_request_fullscreen, UAUiWindow*);122IMPLEMENT_VOID_FUNCTION1(ua_ui_window_request_fullscreen, UAUiWindow*);
123IMPLEMENT_FUNCTION1(EGLNativeWindowType, ua_ui_window_get_native_type, UAUiWindow*);123IMPLEMENT_FUNCTION1(EGLNativeWindowType, ua_ui_window_get_native_type, UAUiWindow*);
124IMPLEMENT_FUNCTION1(UApplicationUiWindowOrientation, ua_ui_window_get_orientation, UAUiWindow*);
124125
125// Ubuntu Application Sensors126// Ubuntu Application Sensors
126127

Subscribers

People subscribed via source and target branches