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
1=== modified file 'android/default/default_ubuntu_application_ui.cpp'
2--- android/default/default_ubuntu_application_ui.cpp 2014-07-15 12:41:35 +0000
3+++ android/default/default_ubuntu_application_ui.cpp 2014-09-19 12:17:12 +0000
4@@ -443,3 +443,14 @@
5 auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
6 return p->value->to_native_window_type();
7 }
8+
9+UApplicationUiWindowOrientation
10+ua_ui_window_get_orientation(
11+ UAUiWindow *window)
12+{
13+ ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
14+
15+ auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
16+ return p->value->get_orientation();
17+}
18+
19
20=== modified file 'debian/changelog'
21--- debian/changelog 2014-09-16 19:28:22 +0000
22+++ debian/changelog 2014-09-19 12:17:12 +0000
23@@ -1,3 +1,9 @@
24+platform-api (2.4.0) UNRELEASED; urgency=medium
25+
26+ * Add window orientation property (readonly, notifyable)
27+
28+ -- Gerry Boland <gerry.boland@canonical.com> Fri, 19 Sep 2014 13:04:51 +0100
29+
30 platform-api (2.3.0+14.10.20140916.3-0ubuntu1) utopic; urgency=medium
31
32 [ Thomas Voß ]
33
34=== modified file 'debian/libubuntu-application-api2.symbols'
35--- debian/libubuntu-application-api2.symbols 2014-07-28 02:53:24 +0000
36+++ debian/libubuntu-application-api2.symbols 2014-09-19 12:17:12 +0000
37@@ -57,6 +57,8 @@
38 ua_location_service_session_stop_position_updates@Base 0.18.3+13.10.20130807
39 ua_location_service_session_stop_velocity_updates@Base 0.18.3+13.10.20130807
40 ua_location_service_session_unref@Base 0.18.3+13.10.20130807
41+ ua_location_service_try_create_session_for_high_accuracy@Base 2.4.0
42+ ua_location_service_try_create_session_for_low_accuracy@Base 2.4.0
43 ua_location_velocity_update_get_timestamp@Base 0.18.3+13.10.20130807
44 ua_location_velocity_update_get_velocity_in_meters_per_second@Base 0.18.3+13.10.20130807
45 ua_location_velocity_update_ref@Base 0.18.3+13.10.20130807
46@@ -115,6 +117,7 @@
47 ua_ui_set_clipboard_content@Base 0.18.1daily13.06.21
48 ua_ui_window_destroy@Base 0.18.1daily13.06.21
49 ua_ui_window_get_native_type@Base 0.18.1daily13.06.21
50+ ua_ui_window_get_orientation@Base 0replaceme
51 ua_ui_window_get_size@Base 2.0.0+14.10.20140612
52 ua_ui_window_hide@Base 0.18.1daily13.06.21
53 ua_ui_window_is_focused@Base 2.2.0+14.10.20140728
54
55=== modified file 'include/ubuntu/application/ui/CMakeLists.txt'
56--- include/ubuntu/application/ui/CMakeLists.txt 2013-08-18 20:33:22 +0000
57+++ include/ubuntu/application/ui/CMakeLists.txt 2014-09-19 12:17:12 +0000
58@@ -12,6 +12,7 @@
59 session.h
60 stage.h
61 window.h
62+ window_orientation.h
63 window_parent.h
64 window_properties.h
65 window_state.h
66
67=== modified file 'include/ubuntu/application/ui/input/event.h'
68--- include/ubuntu/application/ui/input/event.h 2014-08-18 11:01:17 +0000
69+++ include/ubuntu/application/ui/input/event.h 2014-09-19 12:17:12 +0000
70@@ -20,6 +20,7 @@
71 #define UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
72
73 #include <ubuntu/visibility.h>
74+#include <ubuntu/application/ui/window_orientation.h>
75
76 #include <stddef.h>
77 #include <stdint.h>
78@@ -120,7 +121,8 @@
79 KEY_WEVENT_TYPE, ///< Event originates from a keyboard.
80 MOTION_WEVENT_TYPE, ///< Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad.
81 RESIZE_WEVENT_TYPE, ///< Surface has been resized
82- SURFACE_WEVENT_TYPE //< A surface attribute has changed its value
83+ SURFACE_WEVENT_TYPE, ///< A surface attribute has changed its value
84+ ORIENTATION_WEVENT_TYPE, ///< The device orientation changed
85 } WindowEventType;
86
87 /** Information describing an event originating from a keyboard key. */
88@@ -197,6 +199,14 @@
89 int32_t height; ///< The new surface height.
90 } ResizeEvent;
91
92+/** Information describing a surface orientation change event. */
93+typedef struct
94+{
95+ WindowEventType type;
96+
97+ UApplicationUiWindowOrientation direction; ///< The new surface orientation
98+} OrientationEvent;
99+
100 typedef union
101 {
102 WindowEventType type;
103@@ -204,6 +214,7 @@
104 MotionEvent motion;
105 SurfaceEvent surface;
106 ResizeEvent resize;
107+ OrientationEvent orientation;
108 } WindowEvent;
109
110 #ifdef __cplusplus
111
112=== modified file 'include/ubuntu/application/ui/window.h'
113--- include/ubuntu/application/ui/window.h 2014-07-02 00:05:20 +0000
114+++ include/ubuntu/application/ui/window.h 2014-09-19 12:17:12 +0000
115@@ -25,6 +25,7 @@
116 #include <ubuntu/status.h>
117 #include <ubuntu/application/instance.h>
118 #include <ubuntu/application/ui/window_properties.h>
119+#include <ubuntu/application/ui/window_orientation.h>
120
121 #include <EGL/egl.h>
122
123@@ -89,6 +90,10 @@
124 ua_ui_window_is_focused(
125 UAUiWindow *window);
126
127+ UBUNTU_DLL_PUBLIC UApplicationUiWindowOrientation
128+ ua_ui_window_get_orientation(
129+ UAUiWindow *window);
130+
131 #ifdef __cplusplus
132 }
133 #endif
134
135=== added file 'include/ubuntu/application/ui/window_orientation.h'
136--- include/ubuntu/application/ui/window_orientation.h 1970-01-01 00:00:00 +0000
137+++ include/ubuntu/application/ui/window_orientation.h 2014-09-19 12:17:12 +0000
138@@ -0,0 +1,27 @@
139+/*
140+ * Copyright © 2014 Canonical Ltd.
141+ *
142+ * This program is free software: you can redistribute it and/or modify
143+ * it under the terms of the GNU Lesser General Public License version 3 as
144+ * published by the Free Software Foundation.
145+ *
146+ * This program is distributed in the hope that it will be useful,
147+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
148+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
149+ * GNU Lesser General Public License for more details.
150+ *
151+ * You should have received a copy of the GNU Lesser General Public License
152+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
153+ */
154+
155+#ifndef UBUNTU_APPLICATION_UI_WINDOW_ORIENTATION_H
156+#define UBUNTU_APPLICATION_UI_WINDOW_ORIENTATION_H
157+
158+typedef enum {
159+ U_ORIENTATION_NORMAL = 1,
160+ U_ORIENTATION_LEFT,
161+ U_ORIENTATION_RIGHT,
162+ U_ORIENTATION_INVERTED,
163+} UApplicationUiWindowOrientation;
164+
165+#endif // UBUNTU_APPLICATION_UI_WINDOW_ORIENTATION_H
166
167=== modified file 'src/ubuntu/application/common/mirclient/window_mirclient.cpp'
168--- src/ubuntu/application/common/mirclient/window_mirclient.cpp 2014-07-15 12:41:35 +0000
169+++ src/ubuntu/application/common/mirclient/window_mirclient.cpp 2014-09-19 12:17:12 +0000
170@@ -169,6 +169,19 @@
171 *height = parameters.height;
172 }
173
174+UApplicationUiWindowOrientation uamc::Window::orientation() const
175+{
176+ UApplicationUiWindowOrientation ubuntu_orientation;
177+ MirOrientation mir_orientation = mir_surface_get_orientation(surface.get());
178+
179+ if (uaum::orientation_to_ubuntu_orientation(mir_orientation, ubuntu_orientation)) {
180+ return ubuntu_orientation;
181+ } else {
182+ printf("Unknown MirOrientation!\n");
183+ return U_ORIENTATION_NORMAL;
184+ }
185+}
186+
187 void uamc::Window::hide()
188 {
189 state_before_hiding = state();
190
191=== modified file 'src/ubuntu/application/common/mirclient/window_mirclient_priv.h'
192--- src/ubuntu/application/common/mirclient/window_mirclient_priv.h 2014-07-15 12:41:35 +0000
193+++ src/ubuntu/application/common/mirclient/window_mirclient_priv.h 2014-09-19 12:17:12 +0000
194@@ -54,6 +54,7 @@
195 EGLNativeWindowType get_native_type();
196
197 UApplicationUiWindowState state() const;
198+ UApplicationUiWindowOrientation orientation() const;
199
200 void hide();
201 void show();
202
203=== modified file 'src/ubuntu/application/common/mircommon/event_helpers_mir.cpp'
204--- src/ubuntu/application/common/mircommon/event_helpers_mir.cpp 2014-07-15 12:41:35 +0000
205+++ src/ubuntu/application/common/mircommon/event_helpers_mir.cpp 2014-09-19 12:17:12 +0000
206@@ -85,6 +85,13 @@
207 } else {
208 return false;
209 }
210+ case mir_event_type_orientation:
211+ ubuntu_ev.surface.type = ORIENTATION_WEVENT_TYPE;
212+ if (orientation_to_ubuntu_orientation(mir_event->orientation.direction, ubuntu_ev.orientation.direction)) {
213+ return true;
214+ } else {
215+ return false;
216+ }
217 default:
218 return false;
219 }
220@@ -144,3 +151,24 @@
221 return false;
222 }
223 }
224+
225+bool uaum::orientation_to_ubuntu_orientation(MirOrientation const mir_orient,
226+ UApplicationUiWindowOrientation& ubuntu_orient)
227+{
228+ switch (mir_orient) {
229+ case mir_orientation_normal:
230+ ubuntu_orient = U_ORIENTATION_NORMAL;
231+ return true;
232+ case mir_orientation_left:
233+ ubuntu_orient = U_ORIENTATION_LEFT;
234+ return true;
235+ case mir_orientation_inverted:
236+ ubuntu_orient = U_ORIENTATION_INVERTED;
237+ return true;
238+ case mir_orientation_right:
239+ ubuntu_orient = U_ORIENTATION_RIGHT;
240+ return true;
241+ default:
242+ return false;
243+ }
244+}
245
246=== modified file 'src/ubuntu/application/common/mircommon/event_helpers_mir.h'
247--- src/ubuntu/application/common/mircommon/event_helpers_mir.h 2014-07-15 12:41:35 +0000
248+++ src/ubuntu/application/common/mircommon/event_helpers_mir.h 2014-09-19 12:17:12 +0000
249@@ -20,6 +20,7 @@
250 #define UBUNTU_EVENT_HELPERS_MIR_COMMON_H_
251
252 #include <ubuntu/application/ui/input/event.h>
253+#include <ubuntu/application/ui/window_orientation.h>
254 #include <mir_toolkit/event.h>
255
256 namespace ubuntu
257@@ -32,6 +33,9 @@
258 {
259 bool event_to_ubuntu_event(MirEvent const* mir_event, WindowEvent& ubuntu_ev);
260 bool event_to_ubuntu_deprecated_event(MirEvent const* mir_event, Event& ubuntu_ev);
261+
262+bool orientation_to_ubuntu_orientation(MirOrientation const mir_orient,
263+ UApplicationUiWindowOrientation& ubuntu_orient);
264 }
265 }
266 }
267
268=== modified file 'src/ubuntu/application/testbackend/test_stubs.cpp'
269--- src/ubuntu/application/testbackend/test_stubs.cpp 2014-07-15 12:41:35 +0000
270+++ src/ubuntu/application/testbackend/test_stubs.cpp 2014-09-19 12:17:12 +0000
271@@ -252,6 +252,11 @@
272 return 0;
273 }
274
275+UApplicationUiWindowOrientation ua_ui_window_get_orientation(UAUiWindow*)
276+{
277+ return U_ORIENTATION_NORMAL;
278+}
279+
280 UStatus ua_ui_window_show(UAUiWindow*)
281 {
282 return U_STATUS_ERROR;
283
284=== modified file 'src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp'
285--- src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp 2014-07-15 12:41:35 +0000
286+++ src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp 2014-09-19 12:17:12 +0000
287@@ -106,6 +106,7 @@
288 IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_show, UAUiWindow*);
289 IMPLEMENT_VOID_FUNCTION1(ua_ui_window_request_fullscreen, UAUiWindow*);
290 IMPLEMENT_FUNCTION1(EGLNativeWindowType, ua_ui_window_get_native_type, UAUiWindow*);
291+IMPLEMENT_FUNCTION1(UApplicationUiWindowOrientation, ua_ui_window_get_orientation, UAUiWindow*);
292
293 /* -------------------------------------------------------------------------- *
294 * * * * * * * * * * * * * * * Deprecated API * * * * * * * * * * * * * * * * *
295
296=== modified file 'src/ubuntu/application/ubuntu_application_api.cpp'
297--- src/ubuntu/application/ubuntu_application_api.cpp 2014-09-15 20:41:36 +0000
298+++ src/ubuntu/application/ubuntu_application_api.cpp 2014-09-19 12:17:12 +0000
299@@ -121,6 +121,7 @@
300 IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_show, UAUiWindow*);
301 IMPLEMENT_VOID_FUNCTION1(ua_ui_window_request_fullscreen, UAUiWindow*);
302 IMPLEMENT_FUNCTION1(EGLNativeWindowType, ua_ui_window_get_native_type, UAUiWindow*);
303+IMPLEMENT_FUNCTION1(UApplicationUiWindowOrientation, ua_ui_window_get_orientation, UAUiWindow*);
304
305 // Ubuntu Application Sensors
306

Subscribers

People subscribed via source and target branches