Merge lp:~unity-team/platform-api/devel-for-qtmircompositor into lp:platform-api

Proposed by Gerry Boland
Status: Merged
Approved by: Ricardo Mendoza
Approved revision: 233
Merged at revision: 247
Proposed branch: lp:~unity-team/platform-api/devel-for-qtmircompositor
Merge into: lp:platform-api
Diff against target: 1086 lines (+476/-138)
27 files modified
CMakeLists.txt (+1/-1)
android/default/default_ubuntu_application_ui.cpp (+5/-0)
debian/changelog (+7/-0)
debian/libubuntu-application-api2.symbols (+2/-0)
examples/test_c_api.cpp (+2/-2)
examples/test_multiple_surfaces_event_delivery.cpp (+3/-3)
include/ubuntu/application/ui/input/CMakeLists.txt (+4/-8)
include/ubuntu/application/ui/input/event.h (+102/-72)
include/ubuntu/application/ui/input/event_deprecated.h (+98/-0)
include/ubuntu/application/ui/window.h (+8/-1)
include/ubuntu/application/ui/window_properties.h (+12/-2)
src/ubuntu/application/base_module.h (+1/-1)
src/ubuntu/application/common/mirclient/ubuntu_application_api_mirclient.cpp (+15/-3)
src/ubuntu/application/common/mirclient/window_mirclient.cpp (+60/-21)
src/ubuntu/application/common/mirclient/window_mirclient_priv.h (+26/-4)
src/ubuntu/application/common/mirclient/window_properties_mirclient.cpp (+22/-10)
src/ubuntu/application/common/mirclient/window_properties_mirclient_priv.h (+14/-3)
src/ubuntu/application/common/mircommon/event_helpers_mir.cpp (+70/-2)
src/ubuntu/application/common/mircommon/event_helpers_mir.h (+2/-1)
src/ubuntu/application/common/mirserver/ubuntu_application_api_mirserver.cpp (+4/-0)
src/ubuntu/application/common/mirserver/window_mirserver.cpp (+1/-1)
src/ubuntu/application/desktop/module_version.h (+1/-1)
src/ubuntu/application/testbackend/module_version.h (+1/-1)
src/ubuntu/application/testbackend/test_stubs.cpp (+9/-0)
src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp (+3/-0)
src/ubuntu/application/touch/module_version.h (+1/-1)
src/ubuntu/application/ubuntu_application_api.cpp (+2/-0)
To merge this branch: bzr merge lp:~unity-team/platform-api/devel-for-qtmircompositor
Reviewer Review Type Date Requested Status
Ricardo Mendoza (community) Approve
PS Jenkins bot continuous-integration Approve
Robert Carr (community) Approve
Review via email: mp+225320@code.launchpad.net

Commit message

Add window resize & focus handling. Involves renaming "input event" to just "event"

A window resize event is not an "input event", hence the rename

Needed for QtCompositor. By Daniel d'Andrada

Description of the change

Add window resize & focus handling

Needed for QtCompositor

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

Merge trunk

229. By Gerry Boland

Restore racarr's comment

230. By Gerry Boland

Add comment to clarify code that is phone/tablet specific

231. By Gerry Boland

Bump library so number

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

Thanks :) LGTM now.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
232. By Gerry Boland

Update soname of test base to match soname, fix test fails

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

Few things:

1. If we can avoid breaking ABI, lets avoid breaking ABI. Please lets just add new functions for window event handling in addition to the existing input event ones, just mark them as deprecated in their comments. Not a big commitment to ABI stability, but in this case it looks relatively easy to *not* break it.

2. All new functions need to have stubs provided in the other modules (testbackend, for example). They also need to be added to the base ubuntu_application_api.cpp source that builds the base SO from macros. window_is_focused is not there.

3. All module_version.h files need to be updated the reflect the version. Same goes for base_module.h, neither of these are modified in here.

review: Needs Fixing
Revision history for this message
Ricardo Mendoza (ricmm) wrote :

> Few things:
>
> 1. If we can avoid breaking ABI, lets avoid breaking ABI. Please lets just add
> new functions for window event handling in addition to the existing input
> event ones, just mark them as deprecated in their comments. Not a big
> commitment to ABI stability, but in this case it looks relatively easy to
> *not* break it.
>
> 2. All new functions need to have stubs provided in the other modules
> (testbackend, for example). They also need to be added to the base
> ubuntu_application_api.cpp source that builds the base SO from macros.
> window_is_focused is not there.
>
> 3. All module_version.h files need to be updated the reflect the version. Same
> goes for base_module.h, neither of these are modified in here.

Some of these things are commented in line

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> Few things:
>
> 1. If we can avoid breaking ABI, lets avoid breaking ABI. Please lets just add
> new functions for window event handling in addition to the existing input
> event ones, just mark them as deprecated in their comments. Not a big
> commitment to ABI stability, but in this case it looks relatively easy to
> *not* break it.

And what are we gaining by keeping ABI compatibility? We are the sole consumers of platform-api currently, thus I don't see any real gain.

But I do see a big drawback of keeping ABI compatibility in this MP, which is ending up with clunkier API.

Take mir as an example: It's constantly breaking its API and ABI because it's a new project that is rapidly and constantly evolving. Freezing its API so early would severely hamper its evolution. I see the same for platform-api, as it's a thin wrapper of mir & others. It's an illusion to think you will get the API right right off the bat. So it's a moot point to enforce ABI stability right now IMHO.

Revision history for this message
kevin gunn (kgunn72) wrote :

> > Few things:
> >
> > 1. If we can avoid breaking ABI, lets avoid breaking ABI. Please lets just
> add
> > new functions for window event handling in addition to the existing input
> > event ones, just mark them as deprecated in their comments. Not a big
> > commitment to ABI stability, but in this case it looks relatively easy to
> > *not* break it.
>
> And what are we gaining by keeping ABI compatibility? We are the sole
> consumers of platform-api currently, thus I don't see any real gain.
>
> But I do see a big drawback of keeping ABI compatibility in this MP, which is
> ending up with clunkier API.
>
> Take mir as an example: It's constantly breaking its API and ABI because it's
> a new project that is rapidly and constantly evolving. Freezing its API so
> early would severely hamper its evolution. I see the same for platform-api, as
> it's a thin wrapper of mir & others. It's an illusion to think you will get
> the API right right off the bat. So it's a moot point to enforce ABI stability
> right now IMHO.

I have to agree, I don't get it either. If we own the clients, why keep the deprecated methods in place & working ? How many clients are there ? just 1 (qtubuntu)?

233. By Daniel d'Andrada

Changes as per code review feedback

1 - not breaking the ABI anymore. Instead of replacing symbols we're deprecating
    them and adding new ones instead

2 - adding stubs for new functions in other modules

3 - updating versions throughout the source tree so they all match

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> Few things:
>
> 1. If we can avoid breaking ABI, lets avoid breaking ABI. Please lets just add
> new functions for window event handling in addition to the existing input
> event ones, just mark them as deprecated in their comments. Not a big
> commitment to ABI stability, but in this case it looks relatively easy to
> *not* break it.
>
> 2. All new functions need to have stubs provided in the other modules
> (testbackend, for example). They also need to be added to the base
> ubuntu_application_api.cpp source that builds the base SO from macros.
> window_is_focused is not there.
>
> 3. All module_version.h files need to be updated the reflect the version. Same
> goes for base_module.h, neither of these are modified in here.

Anyway, all 3 points have been implemented now.

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

Thanks.

review: Approve
234. By Gerry Boland

Merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-06-20 14:54:35 +0000
3+++ CMakeLists.txt 2014-07-24 12:27:07 +0000
4@@ -3,7 +3,7 @@
5 project(ubuntu-platform-api)
6
7 set(UBUNTU_PLATFORM_API_VERSION_MAJOR 2)
8-set(UBUNTU_PLATFORM_API_VERSION_MINOR 1)
9+set(UBUNTU_PLATFORM_API_VERSION_MINOR 2)
10 set(UBUNTU_PLATFORM_API_VERSION_PATCH 0)
11
12 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
13
14=== modified file 'android/default/default_ubuntu_application_ui.cpp'
15--- android/default/default_ubuntu_application_ui.cpp 2013-12-11 06:11:34 +0000
16+++ android/default/default_ubuntu_application_ui.cpp 2014-07-24 12:27:07 +0000
17@@ -229,6 +229,11 @@
18 }
19
20 void
21+ua_ui_window_properties_set_event_cb_and_ctx(UAUiWindowProperties*, UAUiWindowEventCb, void *)
22+{
23+}
24+
25+void
26 ua_ui_window_properties_set_dimensions(
27 UAUiWindowProperties *properties,
28 uint32_t width,
29
30=== modified file 'debian/changelog'
31--- debian/changelog 2014-07-21 08:47:18 +0000
32+++ debian/changelog 2014-07-24 12:27:07 +0000
33@@ -1,3 +1,10 @@
34+platform-api (2.2.0) UNRELEASED; urgency=medium
35+
36+ * Add window resize support
37+ * Add window focus event
38+
39+ -- Gerry Boland <gerry.boland@canonical.com> Wed, 02 Jul 2014 14:07:05 +0100
40+
41 platform-api (2.1.0+14.10.20140721-0ubuntu1) utopic; urgency=low
42
43 [ thomas-voss ]
44
45=== modified file 'debian/libubuntu-application-api2.symbols'
46--- debian/libubuntu-application-api2.symbols 2014-06-30 08:54:25 +0000
47+++ debian/libubuntu-application-api2.symbols 2014-07-24 12:27:07 +0000
48@@ -117,6 +117,7 @@
49 ua_ui_window_get_native_type@Base 0.18.1daily13.06.21
50 ua_ui_window_get_size@Base 2.0.0+14.10.20140612
51 ua_ui_window_hide@Base 0.18.1daily13.06.21
52+ ua_ui_window_is_focused@Base 0replaceme
53 ua_ui_window_move@Base 0.18.1daily13.06.21
54 ua_ui_window_new_for_application_with_properties@Base 0.18.1daily13.06.21
55 ua_ui_window_properties_destroy@Base 0.18.1daily13.06.21
56@@ -124,6 +125,7 @@
57 ua_ui_window_properties_new_for_normal_window@Base 0.18.1daily13.06.21
58 ua_ui_window_properties_set_dimensions@Base 2.0.0+14.10.20140612
59 ua_ui_window_properties_set_input_cb_and_ctx@Base 0.18.1daily13.06.21
60+ ua_ui_window_properties_set_event_cb_and_ctx@Base 0replaceme
61 ua_ui_window_properties_set_role@Base 0.18.1daily13.06.21
62 ua_ui_window_properties_set_titlen@Base 0.18.1daily13.06.21
63 ua_ui_window_request_fullscreen@Base 0.18.1daily13.06.21
64
65=== modified file 'examples/test_c_api.cpp'
66--- examples/test_c_api.cpp 2014-06-11 12:19:37 +0000
67+++ examples/test_c_api.cpp 2014-07-24 12:27:07 +0000
68@@ -83,7 +83,7 @@
69 const GLfloat * color_data;
70 };
71
72-void on_new_event(void* ctx, const Event* ev)
73+void on_new_event(void* ctx, const WindowEvent* ev)
74 {
75 }
76
77@@ -110,7 +110,7 @@
78 UAUiWindowProperties* wprops = ua_ui_window_properties_new_for_normal_window();
79 ua_ui_window_properties_set_titlen(wprops, "Window 1", 8);
80 ua_ui_window_properties_set_role(wprops, U_MAIN_ROLE);
81- ua_ui_window_properties_set_input_cb_and_ctx(wprops, on_new_event, NULL);
82+ ua_ui_window_properties_set_event_cb_and_ctx(wprops, on_new_event, NULL);
83
84 UAUiWindow* surface = ua_ui_window_new_for_application_with_properties(instance, wprops);
85
86
87=== modified file 'examples/test_multiple_surfaces_event_delivery.cpp'
88--- examples/test_multiple_surfaces_event_delivery.cpp 2014-06-11 12:19:37 +0000
89+++ examples/test_multiple_surfaces_event_delivery.cpp 2014-07-24 12:27:07 +0000
90@@ -83,7 +83,7 @@
91 const GLfloat * color_data;
92 };
93
94-void on_new_event(void* ctx, const Event* ev)
95+void on_new_event(void* ctx, const WindowEvent* ev)
96 {
97 int* surface = (int*) ctx;
98
99@@ -115,14 +115,14 @@
100 UAUiWindowProperties* wprops1 = ua_ui_window_properties_new_for_normal_window();
101 ua_ui_window_properties_set_titlen(wprops1, "Window 1", 8);
102 ua_ui_window_properties_set_role(wprops1, U_MAIN_ROLE);
103- ua_ui_window_properties_set_input_cb_and_ctx(wprops1, on_new_event, &i);
104+ ua_ui_window_properties_set_event_cb_and_ctx(wprops1, on_new_event, &i);
105
106 UAUiWindow* surface1 = ua_ui_window_new_for_application_with_properties(instance, wprops1);
107
108 UAUiWindowProperties* wprops2 = ua_ui_window_properties_new_for_normal_window();
109 ua_ui_window_properties_set_titlen(wprops2, "Window 2", 8);
110 ua_ui_window_properties_set_role(wprops2, U_MAIN_ROLE);
111- ua_ui_window_properties_set_input_cb_and_ctx(wprops2, on_new_event, &j);
112+ ua_ui_window_properties_set_event_cb_and_ctx(wprops2, on_new_event, &j);
113
114 UAUiWindow* surface2 = ua_ui_window_new_for_application_with_properties(instance, wprops2);
115
116
117=== modified file 'include/ubuntu/application/ui/input/CMakeLists.txt'
118--- include/ubuntu/application/ui/input/CMakeLists.txt 2013-07-18 09:08:17 +0000
119+++ include/ubuntu/application/ui/input/CMakeLists.txt 2014-07-24 12:27:07 +0000
120@@ -1,9 +1,5 @@
121-set(
122- UBUNTU_APPLICATION_UI_INPUT_HEADERS
123- event.h
124+install(
125+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
126+ DESTINATION include/ubuntu/application/ui
127+ FILES_MATCHING PATTERN "*.h"
128 )
129-
130-install(
131- FILES ${UBUNTU_APPLICATION_UI_INPUT_HEADERS}
132- DESTINATION include/ubuntu/application/ui/input
133-)
134\ No newline at end of file
135
136=== modified file 'include/ubuntu/application/ui/input/event.h'
137--- include/ubuntu/application/ui/input/event.h 2013-08-22 06:32:14 +0000
138+++ include/ubuntu/application/ui/input/event.h 2014-07-24 12:27:07 +0000
139@@ -1,5 +1,5 @@
140 /*
141- * Copyright © 2012 Canonical Ltd.
142+ * Copyright © 2012-2014 Canonical Ltd.
143 *
144 * This program is free software: you can redistribute it and/or modify
145 * it under the terms of the GNU Lesser General Public License version 3 as
146@@ -14,6 +14,7 @@
147 * along with this program. If not, see <http://www.gnu.org/licenses/>.
148 *
149 * Authored by: Thomas Voß <thomas.voss@canonical.com>
150+ * Daniel d'Andrada <daniel.dandrada@canonical.com>
151 */
152 #ifndef UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
153 #define UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
154@@ -102,82 +103,111 @@
155 } UMotionButtonMask;
156
157
158- /** Maximum number of pointers reported within one input event. */
159+ /** Maximum number of pointers reported within one event. */
160 #define UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT (16)
161
162- /** Reference timebase, nanoseconds as measured by CLOCK_MONOTONIC. */
163- typedef int64_t nsecs_t;
164-
165- /** Describes the different event types. */
166- typedef enum
167- {
168- KEY_EVENT_TYPE, ///< Event originates from a keyboard.
169- MOTION_EVENT_TYPE, ///< Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad.
170- HW_SWITCH_EVENT_TYPE ///< Event originates from an additional button attached to the device's HW, e.g., power button.
171- } EventType;
172-
173- /** Models an input event. */
174- typedef struct
175- {
176- EventType type; ///< Type of the event.
177- int32_t device_id; ///< Device that this event originated from.
178- int32_t source_id; ///< Source that this event originated from.
179- int32_t action; ///< Action signalled by this event.
180- int32_t flags; ///< Flags associated with this event.
181- int32_t meta_state; ///< State of the meta modifiers (ALT, CTRL, SHIFT).
182- /** Information specific to key/motion event types. */
183- union
184- {
185- /** Information describing an event originating from a HW switch. */
186- struct HardwareSwitchEvent
187- {
188- nsecs_t event_time; ///< Timestamp when the event happened.
189- uint32_t policy_flags; ///< Policy flags.
190- int32_t switch_code; ///< The scan code of the switch.
191- int32_t switch_value; ///< The value reported by the switch.
192- } hw_switch;
193- /** Information describing an event originating from a keyboard key. */
194- struct KeyEvent
195- {
196- int32_t key_code;
197- int32_t scan_code;
198- int32_t repeat_count;
199- nsecs_t down_time;
200- nsecs_t event_time;
201- int is_system_key; ///< \deprecated Do not use.
202- } key;
203- /** Information describing an event originating from a
204- * "moving" device, e.g., a mouse, a mouse-wheel, a finger
205- * on a touchpad.
206- */
207- struct MotionEvent
208- {
209- int32_t edge_flags; ///< Set for touches intersecting a touchscreen's edges, requires HW support.
210- int32_t button_state; ///< State of buttons of the device
211- float x_offset; ///< Movement in x direction since down event
212- float y_offset; ///< Movement in y direction since down event
213- float x_precision; ///< Sampling precision in x direction
214- float y_precision; ///< Sampling precision in y direction
215- nsecs_t down_time; ///< Timestamp that marks the down event
216- nsecs_t event_time; ///< Timestamp that marks when this event happened
217- size_t pointer_count; ///< Number of pointers reported in this event
218- struct PointerCoordinate
219- {
220- int id; ///< Unique id of the pointer
221- float x, raw_x; ///< Processed and raw x coordinates
222- float y, raw_y; ///< Processed and raw y coordinates
223- float touch_major; ///< Touch major coordinate
224- float touch_minor; ///< Touch minor coordinate
225- float size; ///< Size of the pointer/touch
226- float pressure; ///< Pressure of the touch
227- float orientation; ///< Orientation
228- } pointer_coordinates[UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT]; ///< Pointer information, valid from [0,pointer_count).
229- } motion;
230- } details;
231- } Event;
232+/** Reference timebase, nanoseconds as measured by CLOCK_MONOTONIC. */
233+typedef int64_t nsecs_t;
234+
235+typedef enum
236+{
237+ SURFACE_ATTRIBUTE_FOCUS
238+} SurfaceAttributeType;
239+
240+/** Describes the different event types. */
241+typedef enum
242+{
243+ KEY_WEVENT_TYPE, ///< Event originates from a keyboard.
244+ MOTION_WEVENT_TYPE, ///< Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad.
245+ RESIZE_WEVENT_TYPE, ///< Surface has been resized
246+ SURFACE_WEVENT_TYPE //< A surface attribute has changed its value
247+} WindowEventType;
248+
249+/** Information describing an event originating from a keyboard key. */
250+typedef struct
251+{
252+ WindowEventType type;
253+
254+ int32_t device_id; ///< Device that this event originated from.
255+ int32_t source_id; ///< Source that this event originated from.
256+ int32_t action; ///< Action signalled by this event.
257+ int32_t flags; ///< Flags associated with this event.
258+ int32_t meta_state; ///< State of the meta modifiers (ALT, CTRL, SHIFT).
259+
260+ int32_t key_code;
261+ int32_t scan_code;
262+ int32_t repeat_count;
263+ nsecs_t down_time;
264+ nsecs_t event_time;
265+ int is_system_key; ///< \deprecated Do not use.
266+} KeyEvent;
267+
268+/** Information describing an event originating from a
269+ * "moving" device, e.g., a mouse, a mouse-wheel, a finger
270+ * on a touchpad.
271+ */
272+typedef struct
273+{
274+ WindowEventType type;
275+
276+ int32_t device_id; ///< Device that this event originated from.
277+ int32_t source_id; ///< Source that this event originated from.
278+ int32_t action; ///< Action signalled by this event.
279+ int32_t flags; ///< Flags associated with this event.
280+ int32_t meta_state; ///< State of the meta modifiers (ALT, CTRL, SHIFT).
281+
282+ int32_t edge_flags; ///< Set for touches intersecting a touchscreen's edges, requires HW support.
283+ int32_t button_state; ///< State of buttons of the device
284+ float x_offset; ///< Movement in x direction since down event
285+ float y_offset; ///< Movement in y direction since down event
286+ float x_precision; ///< Sampling precision in x direction
287+ float y_precision; ///< Sampling precision in y direction
288+ nsecs_t down_time; ///< Timestamp that marks the down event
289+ nsecs_t event_time; ///< Timestamp that marks when this event happened
290+ size_t pointer_count; ///< Number of pointers reported in this event
291+ struct PointerCoordinate
292+ {
293+ int id; ///< Unique id of the pointer
294+ float x, raw_x; ///< Processed and raw x coordinates
295+ float y, raw_y; ///< Processed and raw y coordinates
296+ float touch_major; ///< Touch major coordinate
297+ float touch_minor; ///< Touch minor coordinate
298+ float size; ///< Size of the pointer/touch
299+ float pressure; ///< Pressure of the touch
300+ float orientation; ///< Orientation
301+ } pointer_coordinates[UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT]; ///< Pointer information, valid from [0,pointer_count).
302+} MotionEvent;
303+
304+typedef struct
305+{
306+ WindowEventType type;
307+
308+ SurfaceAttributeType attribute; ///< The surface attribute that has changed
309+ int32_t value; ///< The new value of that surface attribute.
310+} SurfaceEvent;
311+
312+/** Information describing a surface resize event. */
313+typedef struct
314+{
315+ WindowEventType type;
316+
317+ int32_t width; ///< The new surface width
318+ int32_t height; ///< The new surface height.
319+} ResizeEvent;
320+
321+typedef union
322+{
323+ WindowEventType type;
324+ KeyEvent key;
325+ MotionEvent motion;
326+ SurfaceEvent surface;
327+ ResizeEvent resize;
328+} WindowEvent;
329
330 #ifdef __cplusplus
331 }
332 #endif
333
334+#include "event_deprecated.h"
335+
336 #endif // UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
337
338=== added file 'include/ubuntu/application/ui/input/event_deprecated.h'
339--- include/ubuntu/application/ui/input/event_deprecated.h 1970-01-01 00:00:00 +0000
340+++ include/ubuntu/application/ui/input/event_deprecated.h 2014-07-24 12:27:07 +0000
341@@ -0,0 +1,98 @@
342+/*
343+ * Copyright © 2014 Canonical Ltd.
344+ *
345+ * This program is free software: you can redistribute it and/or modify
346+ * it under the terms of the GNU Lesser General Public License version 3 as
347+ * published by the Free Software Foundation.
348+ *
349+ * This program is distributed in the hope that it will be useful,
350+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
351+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
352+ * GNU Lesser General Public License for more details.
353+ *
354+ * You should have received a copy of the GNU Lesser General Public License
355+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
356+ *
357+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
358+ */
359+
360+#ifndef UBUNTU_APPLICATION_UI__EVENT_DEPRECATED_H_
361+#define UBUNTU_APPLICATION_UI__EVENT_DEPRECATED_H_
362+
363+#ifdef __cplusplus
364+extern "C" {
365+#endif
366+
367+ /** Describes the different event types. */
368+ typedef enum
369+ {
370+ KEY_EVENT_TYPE, ///< Event originates from a keyboard.
371+ MOTION_EVENT_TYPE, ///< Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad.
372+ HW_SWITCH_EVENT_TYPE ///< Event originates from an additional button attached to the device's HW, e.g., power button.
373+ } EventType;
374+
375+ /** Models an input event. */
376+ typedef struct
377+ {
378+ EventType type; ///< Type of the event.
379+ int32_t device_id; ///< Device that this event originated from.
380+ int32_t source_id; ///< Source that this event originated from.
381+ int32_t action; ///< Action signalled by this event.
382+ int32_t flags; ///< Flags associated with this event.
383+ int32_t meta_state; ///< State of the meta modifiers (ALT, CTRL, SHIFT).
384+ /** Information specific to key/motion event types. */
385+ union
386+ {
387+ /** Information describing an event originating from a HW switch. */
388+ struct HardwareSwitchEvent
389+ {
390+ nsecs_t event_time; ///< Timestamp when the event happened.
391+ uint32_t policy_flags; ///< Policy flags.
392+ int32_t switch_code; ///< The scan code of the switch.
393+ int32_t switch_value; ///< The value reported by the switch.
394+ } hw_switch;
395+ /** Information describing an event originating from a keyboard key. */
396+ struct KeyEvent
397+ {
398+ int32_t key_code;
399+ int32_t scan_code;
400+ int32_t repeat_count;
401+ nsecs_t down_time;
402+ nsecs_t event_time;
403+ int is_system_key; ///< \deprecated Do not use.
404+ } key;
405+ /** Information describing an event originating from a
406+ * "moving" device, e.g., a mouse, a mouse-wheel, a finger
407+ * on a touchpad.
408+ */
409+ struct MotionEvent
410+ {
411+ int32_t edge_flags; ///< Set for touches intersecting a touchscreen's edges, requires HW support.
412+ int32_t button_state; ///< State of buttons of the device
413+ float x_offset; ///< Movement in x direction since down event
414+ float y_offset; ///< Movement in y direction since down event
415+ float x_precision; ///< Sampling precision in x direction
416+ float y_precision; ///< Sampling precision in y direction
417+ nsecs_t down_time; ///< Timestamp that marks the down event
418+ nsecs_t event_time; ///< Timestamp that marks when this event happened
419+ size_t pointer_count; ///< Number of pointers reported in this event
420+ struct PointerCoordinate
421+ {
422+ int id; ///< Unique id of the pointer
423+ float x, raw_x; ///< Processed and raw x coordinates
424+ float y, raw_y; ///< Processed and raw y coordinates
425+ float touch_major; ///< Touch major coordinate
426+ float touch_minor; ///< Touch minor coordinate
427+ float size; ///< Size of the pointer/touch
428+ float pressure; ///< Pressure of the touch
429+ float orientation; ///< Orientation
430+ } pointer_coordinates[UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT]; ///< Pointer information, valid from [0,pointer_count).
431+ } motion;
432+ } details;
433+ } Event;
434+
435+#ifdef __cplusplus
436+}
437+#endif
438+
439+#endif // UBUNTU_APPLICATION_UI__EVENT_DEPRECATED_H_
440
441=== modified file 'include/ubuntu/application/ui/window.h'
442--- include/ubuntu/application/ui/window.h 2014-05-07 12:21:22 +0000
443+++ include/ubuntu/application/ui/window.h 2014-07-24 12:27:07 +0000
444@@ -34,7 +34,10 @@
445
446 typedef void UAUiWindow;
447 typedef int32_t UAUiWindowId;
448-
449+
450+ /*
451+ Ownership of properties is given to the returned UAUiWindow
452+ */
453 UBUNTU_DLL_PUBLIC UAUiWindow*
454 ua_ui_window_new_for_application_with_properties(
455 UApplicationInstance *instance,
456@@ -82,6 +85,10 @@
457 ua_ui_window_get_native_type(
458 UAUiWindow *window);
459
460+ UBUNTU_DLL_PUBLIC int
461+ ua_ui_window_is_focused(
462+ UAUiWindow *window);
463+
464 #ifdef __cplusplus
465 }
466 #endif
467
468=== modified file 'include/ubuntu/application/ui/window_properties.h'
469--- include/ubuntu/application/ui/window_properties.h 2013-12-11 04:56:15 +0000
470+++ include/ubuntu/application/ui/window_properties.h 2014-07-24 12:27:07 +0000
471@@ -39,10 +39,13 @@
472 U_SHUTDOWN_DIALOG_ROLE,
473 } UAUiWindowRole;
474
475-
476+ // Deprecated! Use UAUiWindowEventCb instead
477 typedef void (*input_event_cb)(void* ctx, const Event* ev);
478 typedef input_event_cb UAUiWindowInputEventCb;
479
480+ typedef void (*event_cb)(void* ctx, const WindowEvent* ev);
481+ typedef event_cb UAUiWindowEventCb;
482+
483 typedef void UAUiWindowProperties;
484
485 UBUNTU_DLL_PUBLIC UAUiWindowProperties*
486@@ -70,7 +73,8 @@
487 UBUNTU_DLL_PUBLIC UAUiWindowRole
488 ua_ui_window_properties_get_role(
489 UAUiWindowProperties *properties);
490-
491+
492+ // Deprecated! Use ua_ui_window_properties_set_event_cb_and_ctx instead.
493 UBUNTU_DLL_PUBLIC void
494 ua_ui_window_properties_set_input_cb_and_ctx(
495 UAUiWindowProperties *properties,
496@@ -78,6 +82,12 @@
497 void *ctx);
498
499 UBUNTU_DLL_PUBLIC void
500+ ua_ui_window_properties_set_event_cb_and_ctx(
501+ UAUiWindowProperties *properties,
502+ UAUiWindowEventCb cb,
503+ void *ctx);
504+
505+ UBUNTU_DLL_PUBLIC void
506 ua_ui_window_properties_set_dimensions(
507 UAUiWindowProperties *properties,
508 uint32_t width,
509
510=== modified file 'src/ubuntu/application/base_module.h'
511--- src/ubuntu/application/base_module.h 2014-06-20 14:54:35 +0000
512+++ src/ubuntu/application/base_module.h 2014-07-24 12:27:07 +0000
513@@ -28,7 +28,7 @@
514 */
515
516 #define API_VERSION_MAJOR "2"
517-#define API_VERSION_MINOR "1"
518+#define API_VERSION_MINOR "2"
519 #define API_VERSION_PATCH "0"
520 #define SO_SUFFIX ".so." API_VERSION_MAJOR "." API_VERSION_MINOR "." API_VERSION_PATCH
521
522
523=== modified file 'src/ubuntu/application/common/mirclient/ubuntu_application_api_mirclient.cpp'
524--- src/ubuntu/application/common/mirclient/ubuntu_application_api_mirclient.cpp 2014-05-20 09:29:12 +0000
525+++ src/ubuntu/application/common/mirclient/ubuntu_application_api_mirclient.cpp 2014-07-24 12:27:07 +0000
526@@ -299,6 +299,12 @@
527 properties->set_input_cb_and_ctx(cb, ctx);
528 }
529
530+void ua_ui_window_properties_set_event_cb_and_ctx(UAUiWindowProperties* u_properties, UAUiWindowEventCb cb, void* ctx)
531+{
532+ auto properties = uamc::WindowProperties::from_u_window_properties(u_properties);
533+ properties->set_event_cb_and_ctx(cb, ctx);
534+}
535+
536 void ua_ui_window_properties_set_dimensions(UAUiWindowProperties *u_properties, uint32_t width, uint32_t height)
537 {
538 auto properties = uamc::WindowProperties::from_u_window_properties(u_properties);
539@@ -347,21 +353,21 @@
540 UStatus ua_ui_window_hide(UAUiWindow* u_window)
541 {
542 auto window = uamc::Window::from_u_window(u_window);
543- window->set_state(U_MINIMIZED_STATE);
544+ window->hide();
545 return (UStatus) 0;
546 }
547
548 UStatus ua_ui_window_show(UAUiWindow* u_window)
549 {
550 auto window = uamc::Window::from_u_window(u_window);
551- window->set_state(U_MAXIMIZED_STATE);
552+ window->show();
553 return (UStatus) 0;
554 }
555
556 void ua_ui_window_request_fullscreen(UAUiWindow* u_window)
557 {
558 auto window = uamc::Window::from_u_window(u_window);
559- window->set_state(U_FULLSCREEN_STATE);
560+ window->request_fullscreen();
561 }
562
563 EGLNativeWindowType ua_ui_window_get_native_type(UAUiWindow* u_window)
564@@ -370,5 +376,11 @@
565 return window->get_native_type();
566 }
567
568+int ua_ui_window_is_focused(UAUiWindow *u_window)
569+{
570+ auto window = uamc::Window::from_u_window(u_window);
571+ return window->is_focused();
572+}
573+
574 // TODO: Sensors
575 }
576
577=== modified file 'src/ubuntu/application/common/mirclient/window_mirclient.cpp'
578--- src/ubuntu/application/common/mirclient/window_mirclient.cpp 2014-05-20 09:29:12 +0000
579+++ src/ubuntu/application/common/mirclient/window_mirclient.cpp 2014-07-24 12:27:07 +0000
580@@ -35,27 +35,38 @@
581 namespace client
582 {
583
584-struct InputContext
585-{
586- UAUiWindowInputEventCb cb;
587- void *ctx;
588-};
589-
590 static void
591 ua_ui_window_mir_handle_event(MirSurface* surface, MirEvent const* mir_ev, void* ctx)
592 {
593 // TODO<mir>: Perhaps this indicates that mirclient library should not pass a surface argument here.
594 (void) surface;
595
596- Event ubuntu_ev;
597- auto translated_event = uaum::event_to_ubuntu_event(mir_ev, ubuntu_ev);
598-
599- // Mir sends some events such as focus gained/lost which the platform API does not represent as input events.
600- if (translated_event)
601- {
602- auto mir_ctx = static_cast<uamc::InputContext*>(ctx);
603- mir_ctx->cb(mir_ctx->ctx, &ubuntu_ev);
604+ WindowEvent ubuntu_ev;
605+
606+ bool translated_event = uaum::event_to_ubuntu_event(mir_ev, ubuntu_ev);
607+
608+ // Mir sends some events which platform API does not represent as platform-api events.
609+ if (!translated_event)
610+ return;
611+
612+ auto window = static_cast<uamc::Window*>(ctx);
613+ window->process_event(ubuntu_ev);
614+
615+ UAUiWindowEventCb user_callback = window->get_user_callback();
616+ if (user_callback != nullptr) {
617+ user_callback(window->get_user_callback_context(), &ubuntu_ev);
618+ } else {
619+ // Fallback to the old, deprecated, API for handling events
620+ Event ubuntu_deprecated_ev;
621+
622+ bool ok = uaum::event_to_ubuntu_deprecated_event(mir_ev, ubuntu_deprecated_ev);
623+
624+ if (ok) {
625+ UAUiWindowInputEventCb user_input_callback = window->get_user_input_callback();
626+ user_input_callback(window->get_user_callback_context(), &ubuntu_deprecated_ev);
627+ }
628 }
629+
630 }
631
632 }
633@@ -84,8 +95,13 @@
634
635 uamc::Window::Window(uamc::Instance& instance,
636 uamc::WindowProperties* properties)
637- : instance(instance)
638+ : instance(instance),
639+ focused(0)
640 {
641+ user_event_callback = properties->event_cb();
642+ user_event_callback_context = properties->event_cb_context();
643+ user_input_callback = properties->input_cb();
644+
645 window_properties = WindowPropertiesPtr(properties,
646 [](uamc::WindowProperties *p)
647 {
648@@ -98,11 +114,6 @@
649
650 auto mir_surface = mir_connection_create_surface_sync(connection, &parameters);
651 // TODO: create_surface_sync is unsafe as there is a race between setting the event handler and receiving surfaces
652- input_ctx = InputContextPtr(new uamc::InputContext{properties->input_cb(), properties->input_context()},
653- [](InputContext *c)
654- {
655- delete c;
656- });
657
658 if (properties->surface_type()) {
659 // TODO: Should I bother checking the result?
660@@ -112,7 +123,7 @@
661 MirEventDelegate delegate =
662 {
663 uamc::ua_ui_window_mir_handle_event,
664- input_ctx.get()
665+ this
666 };
667 mir_surface_set_event_handler(mir_surface, &delegate);
668 surface = SurfacePtr(mir_surface,
669@@ -120,6 +131,9 @@
670 {
671 mir_surface_release_sync(s);
672 });
673+
674+ // FIXME: this only really applicable for phone & tablet case
675+ state_before_hiding = U_MAXIMIZED_STATE;
676 }
677
678 UAUiWindow* uamc::Window::as_u_window()
679@@ -154,3 +168,28 @@
680 *width = parameters.width;
681 *height = parameters.height;
682 }
683+
684+void uamc::Window::hide()
685+{
686+ state_before_hiding = state();
687+ set_state(U_MINIMIZED_STATE);
688+}
689+
690+void uamc::Window::show()
691+{
692+ if (state() == U_MINIMIZED_STATE) {
693+ set_state(state_before_hiding);
694+ }
695+}
696+
697+void uamc::Window::request_fullscreen()
698+{
699+ set_state(U_FULLSCREEN_STATE);
700+}
701+
702+void uamc::Window::process_event(const WindowEvent &ev)
703+{
704+ if (ev.type == SURFACE_WEVENT_TYPE && ev.surface.attribute == SURFACE_ATTRIBUTE_FOCUS) {
705+ focused = ev.surface.value;
706+ }
707+}
708
709=== modified file 'src/ubuntu/application/common/mirclient/window_mirclient_priv.h'
710--- src/ubuntu/application/common/mirclient/window_mirclient_priv.h 2014-05-20 09:29:12 +0000
711+++ src/ubuntu/application/common/mirclient/window_mirclient_priv.h 2014-07-24 12:27:07 +0000
712@@ -41,7 +41,6 @@
713 {
714 class Instance;
715 class WindowProperties;
716-struct InputContext;
717
718 class Window
719 {
720@@ -55,24 +54,47 @@
721 EGLNativeWindowType get_native_type();
722
723 UApplicationUiWindowState state() const;
724- void set_state(const UApplicationUiWindowState);
725+
726+ void hide();
727+ void show();
728+ void request_fullscreen();
729
730 void get_size(uint32_t *width, uint32_t *height);
731
732+ void process_event(const WindowEvent &ev);
733+ int is_focused() const { return focused; }
734+
735+ // user as in "platform-api user"
736+ UAUiWindowEventCb get_user_callback() { return user_event_callback;}
737+ void *get_user_callback_context() { return user_event_callback_context; }
738+
739+ // Deprecated! Use get_user_callback() instead
740+ UAUiWindowInputEventCb get_user_input_callback() { return user_input_callback;}
741+
742 protected:
743 Window(Window const&) = delete;
744 Window& operator=(Window const&) = delete;
745
746 private:
747+ void set_state(const UApplicationUiWindowState);
748+
749 Instance& instance;
750
751 typedef std::unique_ptr<WindowProperties, std::function<void(WindowProperties*)>> WindowPropertiesPtr;
752 typedef std::unique_ptr<MirSurface, std::function<void(MirSurface*)>> SurfacePtr;
753- typedef std::unique_ptr<InputContext, std::function<void(InputContext*)>> InputContextPtr;
754
755 WindowPropertiesPtr window_properties;
756- InputContextPtr input_ctx;
757 SurfacePtr surface;
758+
759+ UAUiWindowEventCb user_event_callback;
760+ void *user_event_callback_context;
761+
762+ // Deprecated! Replaced by user_event_callback
763+ UAUiWindowInputEventCb user_input_callback;
764+
765+ UApplicationUiWindowState state_before_hiding;
766+
767+ int focused;
768 };
769
770 }
771
772=== modified file 'src/ubuntu/application/common/mirclient/window_properties_mirclient.cpp'
773--- src/ubuntu/application/common/mirclient/window_properties_mirclient.cpp 2013-12-11 04:36:18 +0000
774+++ src/ubuntu/application/common/mirclient/window_properties_mirclient.cpp 2014-07-24 12:27:07 +0000
775@@ -23,8 +23,9 @@
776 uamc::WindowProperties::WindowProperties()
777 : parameters(),
778 type(mir_surface_type_normal),
779- cb(nullptr),
780- input_ctx(nullptr)
781+ _input_cb(nullptr),
782+ _event_cb(nullptr),
783+ _event_cb_ctx(nullptr)
784 {
785 parameters.name = nullptr;
786 parameters.width = 0;
787@@ -50,8 +51,14 @@
788
789 void uamc::WindowProperties::set_input_cb_and_ctx(UAUiWindowInputEventCb callback, void* ctx)
790 {
791- cb = callback;
792- input_ctx = ctx;
793+ _input_cb = callback;
794+ _event_cb_ctx = ctx;
795+}
796+
797+void uamc::WindowProperties::set_event_cb_and_ctx(UAUiWindowEventCb callback, void* ctx)
798+{
799+ _event_cb = callback;
800+ _event_cb_ctx = ctx;
801 }
802
803 void uamc::WindowProperties::set_dimensions(uint32_t width, uint32_t height)
804@@ -80,10 +87,15 @@
805
806 UAUiWindowInputEventCb uamc::WindowProperties::input_cb() const
807 {
808- return cb;
809-}
810-
811-void* uamc::WindowProperties::input_context() const
812-{
813- return input_ctx;
814+ return _input_cb;
815+}
816+
817+UAUiWindowEventCb uamc::WindowProperties::event_cb() const
818+{
819+ return _event_cb;
820+}
821+
822+void* uamc::WindowProperties::event_cb_context() const
823+{
824+ return _event_cb_ctx;
825 }
826
827=== modified file 'src/ubuntu/application/common/mirclient/window_properties_mirclient_priv.h'
828--- src/ubuntu/application/common/mirclient/window_properties_mirclient_priv.h 2013-12-11 02:20:26 +0000
829+++ src/ubuntu/application/common/mirclient/window_properties_mirclient_priv.h 2014-07-24 12:27:07 +0000
830@@ -46,14 +46,24 @@
831 static WindowProperties* from_u_window_properties(UAUiWindowProperties* u_properties);
832
833 void set_title(char const* title, size_t length);
834+
835+ // Deprecated! Use set_event_cb_and_ctx()
836 void set_input_cb_and_ctx(UAUiWindowInputEventCb cb, void* ctx);
837+
838+ // sets event callback and callback context
839+ void set_event_cb_and_ctx(UAUiWindowEventCb cb, void* ctx);
840+
841 void set_dimensions(uint32_t width, uint32_t height);
842 void set_role(UAUiWindowRole role);
843
844 MirSurfaceParameters const& surface_parameters() const;
845 MirSurfaceType surface_type() const;
846+
847+ // Deprecated! Use event_cb()
848 UAUiWindowInputEventCb input_cb() const;
849- void* input_context() const;
850+
851+ UAUiWindowEventCb event_cb() const;
852+ void* event_cb_context() const;
853
854 protected:
855 WindowProperties(WindowProperties const&) = delete;
856@@ -65,8 +75,9 @@
857
858 std::string title;
859
860- UAUiWindowInputEventCb cb;
861- void *input_ctx;
862+ UAUiWindowInputEventCb _input_cb; // Deprecated! Replaced by _event_cb
863+ UAUiWindowEventCb _event_cb;
864+ void *_event_cb_ctx;
865 };
866
867 }
868
869=== modified file 'src/ubuntu/application/common/mircommon/event_helpers_mir.cpp'
870--- src/ubuntu/application/common/mircommon/event_helpers_mir.cpp 2013-10-14 21:22:49 +0000
871+++ src/ubuntu/application/common/mircommon/event_helpers_mir.cpp 2014-07-24 12:27:07 +0000
872@@ -20,10 +20,78 @@
873
874 namespace uaum = ubuntu::application::ui::mir;
875
876-// TODO<mir>: This begs the question: Why does MirEvent exist? It's difficult to ensure this function is kept in sync
877+// TODO<mir>: This begs the question: Why does MirEvent exist? It's difficult to ensure this function is kept in sync
878 // at the unit test level.
879 bool
880-uaum::event_to_ubuntu_event(MirEvent const* mir_event, Event& ubuntu_ev)
881+uaum::event_to_ubuntu_event(MirEvent const* mir_event, WindowEvent& ubuntu_ev)
882+{
883+ switch (mir_event->type)
884+ {
885+ case mir_event_type_key:
886+ ubuntu_ev.key.type = KEY_WEVENT_TYPE;
887+ ubuntu_ev.key.device_id = mir_event->key.device_id;
888+ ubuntu_ev.key.source_id = mir_event->key.source_id;
889+ ubuntu_ev.key.action = mir_event->key.action;
890+ ubuntu_ev.key.flags = mir_event->key.flags;
891+ ubuntu_ev.key.meta_state = mir_event->key.modifiers;
892+ ubuntu_ev.key.key_code = mir_event->key.key_code;
893+ ubuntu_ev.key.scan_code = mir_event->key.scan_code;
894+ ubuntu_ev.key.repeat_count = mir_event->key.repeat_count;
895+ ubuntu_ev.key.down_time = mir_event->key.down_time;
896+ ubuntu_ev.key.event_time = mir_event->key.event_time;
897+ ubuntu_ev.key.is_system_key = mir_event->key.is_system_key;
898+ return true;
899+ case mir_event_type_motion:
900+ ubuntu_ev.motion.type = MOTION_WEVENT_TYPE;
901+ ubuntu_ev.motion.device_id = mir_event->motion.device_id;
902+ ubuntu_ev.motion.source_id = mir_event->motion.source_id;
903+ ubuntu_ev.motion.action = mir_event->motion.action;
904+ ubuntu_ev.motion.flags = mir_event->motion.flags;
905+ ubuntu_ev.motion.meta_state = mir_event->motion.modifiers;
906+ ubuntu_ev.motion.edge_flags = mir_event->motion.edge_flags;
907+ ubuntu_ev.motion.button_state = mir_event->motion.button_state;
908+ ubuntu_ev.motion.x_offset = mir_event->motion.x_offset;
909+ ubuntu_ev.motion.y_offset = mir_event->motion.y_offset;
910+ ubuntu_ev.motion.x_precision = mir_event->motion.x_precision;
911+ ubuntu_ev.motion.y_precision = mir_event->motion.y_precision;
912+ ubuntu_ev.motion.down_time = mir_event->motion.down_time;
913+ ubuntu_ev.motion.event_time = mir_event->motion.event_time;
914+ ubuntu_ev.motion.pointer_count = mir_event->motion.pointer_count;
915+ for (int i = 0; i < mir_event->motion.pointer_count; i++)
916+ {
917+ ubuntu_ev.motion.pointer_coordinates[i].id = mir_event->motion.pointer_coordinates[i].id;
918+ ubuntu_ev.motion.pointer_coordinates[i].x = mir_event->motion.pointer_coordinates[i].x;
919+ ubuntu_ev.motion.pointer_coordinates[i].raw_x = mir_event->motion.pointer_coordinates[i].raw_x;
920+ ubuntu_ev.motion.pointer_coordinates[i].y = mir_event->motion.pointer_coordinates[i].y;
921+ ubuntu_ev.motion.pointer_coordinates[i].raw_y = mir_event->motion.pointer_coordinates[i].raw_y;
922+ ubuntu_ev.motion.pointer_coordinates[i].touch_major = mir_event->motion.pointer_coordinates[i].touch_major;
923+ ubuntu_ev.motion.pointer_coordinates[i].touch_minor = mir_event->motion.pointer_coordinates[i].touch_minor;
924+ ubuntu_ev.motion.pointer_coordinates[i].size = mir_event->motion.pointer_coordinates[i].size;
925+ ubuntu_ev.motion.pointer_coordinates[i].pressure = mir_event->motion.pointer_coordinates[i].pressure;
926+ ubuntu_ev.motion.pointer_coordinates[i].orientation = mir_event->motion.pointer_coordinates[i].orientation;
927+ }
928+ return true;
929+ case mir_event_type_resize:
930+ ubuntu_ev.resize.type = RESIZE_WEVENT_TYPE;
931+ ubuntu_ev.resize.width = mir_event->resize.width;
932+ ubuntu_ev.resize.height = mir_event->resize.height;
933+ return true;
934+ case mir_event_type_surface:
935+ ubuntu_ev.surface.type = SURFACE_WEVENT_TYPE;
936+ if (mir_event->surface.attrib == mir_surface_attrib_focus) {
937+ ubuntu_ev.surface.attribute = SURFACE_ATTRIBUTE_FOCUS;
938+ ubuntu_ev.surface.value = mir_event->surface.value == mir_surface_focused;
939+ return true;
940+ } else {
941+ return false;
942+ }
943+ default:
944+ return false;
945+ }
946+}
947+
948+bool
949+uaum::event_to_ubuntu_deprecated_event(MirEvent const* mir_event, Event& ubuntu_ev)
950 {
951 switch (mir_event->type)
952 {
953
954=== modified file 'src/ubuntu/application/common/mircommon/event_helpers_mir.h'
955--- src/ubuntu/application/common/mircommon/event_helpers_mir.h 2013-10-14 21:22:49 +0000
956+++ src/ubuntu/application/common/mircommon/event_helpers_mir.h 2014-07-24 12:27:07 +0000
957@@ -30,7 +30,8 @@
958 {
959 namespace mir
960 {
961-bool event_to_ubuntu_event(MirEvent const* mir_event, Event& ubuntu_ev);
962+bool event_to_ubuntu_event(MirEvent const* mir_event, WindowEvent& ubuntu_ev);
963+bool event_to_ubuntu_deprecated_event(MirEvent const* mir_event, Event& ubuntu_ev);
964 }
965 }
966 }
967
968=== modified file 'src/ubuntu/application/common/mirserver/ubuntu_application_api_mirserver.cpp'
969--- src/ubuntu/application/common/mirserver/ubuntu_application_api_mirserver.cpp 2014-05-20 09:26:33 +0000
970+++ src/ubuntu/application/common/mirserver/ubuntu_application_api_mirserver.cpp 2014-07-24 12:27:07 +0000
971@@ -255,6 +255,10 @@
972 (void) role;
973 }
974
975+void ua_ui_window_properties_set_event_cb_and_ctx(UAUiWindowProperties*, UAUiWindowEventCb, void*)
976+{
977+}
978+
979 void ua_ui_window_properties_set_input_cb_and_ctx(UAUiWindowProperties* u_properties, UAUiWindowInputEventCb cb, void* ctx)
980 {
981 auto properties = uams::WindowProperties::from_u_window_properties(u_properties);
982
983=== modified file 'src/ubuntu/application/common/mirserver/window_mirserver.cpp'
984--- src/ubuntu/application/common/mirserver/window_mirserver.cpp 2014-04-04 10:38:36 +0000
985+++ src/ubuntu/application/common/mirserver/window_mirserver.cpp 2014-07-24 12:27:07 +0000
986@@ -43,7 +43,7 @@
987 static void ua_ui_window_handle_event(UAUiWindowInputEventCb cb, void* ctx, MirEvent* mir_event)
988 {
989 Event ubuntu_ev;
990- auto translated_event = uaum::event_to_ubuntu_event(mir_event, ubuntu_ev);
991+ auto translated_event = uaum::event_to_ubuntu_deprecated_event(mir_event, ubuntu_ev);
992 if (translated_event)
993 cb(ctx, &ubuntu_ev);
994 }
995
996=== modified file 'src/ubuntu/application/desktop/module_version.h'
997--- src/ubuntu/application/desktop/module_version.h 2014-06-20 14:54:35 +0000
998+++ src/ubuntu/application/desktop/module_version.h 2014-07-24 12:27:07 +0000
999@@ -1,3 +1,3 @@
1000 #define MODULE_VERSION_MAJOR 2
1001-#define MODULE_VERSION_MINOR 1
1002+#define MODULE_VERSION_MINOR 2
1003 #define MODULE_VERSION_PATCH 0
1004
1005=== modified file 'src/ubuntu/application/testbackend/module_version.h'
1006--- src/ubuntu/application/testbackend/module_version.h 2014-06-20 14:54:35 +0000
1007+++ src/ubuntu/application/testbackend/module_version.h 2014-07-24 12:27:07 +0000
1008@@ -1,3 +1,3 @@
1009 #define MODULE_VERSION_MAJOR 2
1010-#define MODULE_VERSION_MINOR 1
1011+#define MODULE_VERSION_MINOR 2
1012 #define MODULE_VERSION_PATCH 0
1013
1014=== modified file 'src/ubuntu/application/testbackend/test_stubs.cpp'
1015--- src/ubuntu/application/testbackend/test_stubs.cpp 2014-05-29 14:14:31 +0000
1016+++ src/ubuntu/application/testbackend/test_stubs.cpp 2014-07-24 12:27:07 +0000
1017@@ -210,6 +210,10 @@
1018 {
1019 }
1020
1021+void ua_ui_window_properties_set_event_cb_and_ctx(UAUiWindowProperties*, UAUiWindowEventCb, void*)
1022+{
1023+}
1024+
1025 void ua_ui_window_properties_set_dimensions(UAUiWindowProperties*, uint32_t, uint32_t)
1026 {
1027 }
1028@@ -243,6 +247,11 @@
1029 return U_STATUS_ERROR;
1030 }
1031
1032+int ua_ui_window_is_focused(UAUiWindow *window)
1033+{
1034+ return 0;
1035+}
1036+
1037 UStatus ua_ui_window_show(UAUiWindow*)
1038 {
1039 return U_STATUS_ERROR;
1040
1041=== modified file 'src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp'
1042--- src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp 2014-05-20 12:45:42 +0000
1043+++ src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp 2014-07-24 12:27:07 +0000
1044@@ -92,11 +92,14 @@
1045 IMPLEMENT_FUNCTION1(const char*, ua_ui_window_properties_get_title, UAUiWindowProperties*);
1046 IMPLEMENT_VOID_FUNCTION2(ua_ui_window_properties_set_role, UAUiWindowProperties*, UAUiWindowRole);
1047 IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_input_cb_and_ctx, UAUiWindowProperties*, UAUiWindowInputEventCb, void*);
1048+IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_event_cb_and_ctx, UAUiWindowProperties*, UAUiWindowEventCb, void*);
1049 IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_dimensions, UAUiWindowProperties*, uint32_t, uint32_t);
1050
1051 // UAUiWindow
1052 IMPLEMENT_FUNCTION2(UAUiWindow*, ua_ui_window_new_for_application_with_properties, UApplicationInstance*, UAUiWindowProperties*);
1053 IMPLEMENT_VOID_FUNCTION1(ua_ui_window_destroy, UAUiWindow*);
1054+IMPLEMENT_VOID_FUNCTION3(ua_ui_window_get_size, UAUiWindow*, uint32_t*, uint32_t*);
1055+IMPLEMENT_FUNCTION1(int, ua_ui_window_is_focused, UAUiWindow*);
1056 IMPLEMENT_FUNCTION3(UStatus, ua_ui_window_move, UAUiWindow*, uint32_t, uint32_t);
1057 IMPLEMENT_FUNCTION3(UStatus, ua_ui_window_resize, UAUiWindow*, uint32_t, uint32_t);
1058 IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_hide, UAUiWindow*);
1059
1060=== modified file 'src/ubuntu/application/touch/module_version.h'
1061--- src/ubuntu/application/touch/module_version.h 2014-06-20 14:54:35 +0000
1062+++ src/ubuntu/application/touch/module_version.h 2014-07-24 12:27:07 +0000
1063@@ -1,3 +1,3 @@
1064 #define MODULE_VERSION_MAJOR 2
1065-#define MODULE_VERSION_MINOR 1
1066+#define MODULE_VERSION_MINOR 2
1067 #define MODULE_VERSION_PATCH 0
1068
1069=== modified file 'src/ubuntu/application/ubuntu_application_api.cpp'
1070--- src/ubuntu/application/ubuntu_application_api.cpp 2014-06-24 11:09:30 +0000
1071+++ src/ubuntu/application/ubuntu_application_api.cpp 2014-07-24 12:27:07 +0000
1072@@ -107,12 +107,14 @@
1073 IMPLEMENT_FUNCTION1(const char*, ua_ui_window_properties_get_title, UAUiWindowProperties*);
1074 IMPLEMENT_VOID_FUNCTION2(ua_ui_window_properties_set_role, UAUiWindowProperties*, UAUiWindowRole);
1075 IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_input_cb_and_ctx, UAUiWindowProperties*, UAUiWindowInputEventCb, void*);
1076+IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_event_cb_and_ctx, UAUiWindowProperties*, UAUiWindowEventCb, void*);
1077 IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_dimensions, UAUiWindowProperties*, uint32_t, uint32_t);
1078
1079 // UAUiWindow
1080 IMPLEMENT_FUNCTION2(UAUiWindow*, ua_ui_window_new_for_application_with_properties, UApplicationInstance*, UAUiWindowProperties*);
1081 IMPLEMENT_VOID_FUNCTION1(ua_ui_window_destroy, UAUiWindow*);
1082 IMPLEMENT_VOID_FUNCTION3(ua_ui_window_get_size, UAUiWindow*, uint32_t*, uint32_t*);
1083+IMPLEMENT_FUNCTION1(int, ua_ui_window_is_focused, UAUiWindow*);
1084 IMPLEMENT_FUNCTION3(UStatus, ua_ui_window_move, UAUiWindow*, uint32_t, uint32_t);
1085 IMPLEMENT_FUNCTION3(UStatus, ua_ui_window_resize, UAUiWindow*, uint32_t, uint32_t);
1086 IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_hide, UAUiWindow*);

Subscribers

People subscribed via source and target branches