Merge lp:~ricmm/platform-api/add-location-service-api-take-2 into lp:platform-api

Proposed by Ricardo Mendoza
Status: Rejected
Rejected by: Gerry Boland
Proposed branch: lp:~ricmm/platform-api/add-location-service-api-take-2
Merge into: lp:platform-api
Diff against target: 10604 lines (+5416/-4588)
102 files modified
debian/control (+4/-2)
debian/libplatform-api1-doc.doc-base (+2/-1)
debian/libubuntu-application-api1.symbols (+28/-0)
doc/Doxyfile.in (+6/-6)
include/ubuntu/application/CMakeLists.txt (+1/-0)
include/ubuntu/application/location/CMakeLists.txt (+14/-0)
include/ubuntu/application/location/heading_update.h (+78/-0)
include/ubuntu/application/location/position_update.h (+108/-0)
include/ubuntu/application/location/service.h (+94/-0)
include/ubuntu/application/location/session.h (+169/-0)
include/ubuntu/application/location/velocity_update.h (+78/-0)
src/CMakeLists.txt (+1/-15)
src/hybris/CMakeLists.txt (+0/-53)
src/hybris/bridge.h (+0/-202)
src/hybris/tests/CMakeLists.txt (+0/-25)
src/hybris/tests/test_c_api.cpp (+0/-329)
src/hybris/tests/test_gps_api.cpp (+0/-252)
src/hybris/tests/test_multiple_surfaces_event_delivery.cpp (+0/-351)
src/hybris/tests/test_sensors_api.cpp (+0/-88)
src/hybris/tests/test_session_c_api.cpp (+0/-229)
src/hybris/ubuntu_application_api_hybris.cpp (+0/-130)
src/hybris/ubuntu_application_sensors_hybris.cpp (+0/-70)
src/hybris/ubuntu_platform_hardware_api.cpp (+0/-78)
src/mirclient/CMakeLists.txt (+0/-34)
src/mirclient/application_instance_mirclient.cpp (+0/-68)
src/mirclient/application_instance_mirclient_priv.h (+0/-68)
src/mirclient/ubuntu_application_api_mirclient.cpp (+0/-279)
src/mirclient/window_mirclient.cpp (+0/-128)
src/mirclient/window_mirclient_priv.h (+0/-76)
src/mirclient/window_properties_mirclient.cpp (+0/-68)
src/mirclient/window_properties_mirclient_priv.h (+0/-72)
src/mircommon/CMakeLists.txt (+0/-43)
src/mircommon/application_description_mir.cpp (+0/-94)
src/mircommon/application_description_mir_priv.h (+0/-56)
src/mircommon/application_id_mir.cpp (+0/-56)
src/mircommon/application_id_mir_priv.h (+0/-53)
src/mircommon/application_options_mir.cpp (+0/-170)
src/mircommon/application_options_mir_priv.h (+0/-58)
src/mircommon/event_helpers_mir.cpp (+0/-77)
src/mircommon/event_helpers_mir.h (+0/-39)
src/mircommon/lifecycle_delegate_mir.cpp (+0/-136)
src/mircommon/lifecycle_delegate_mir_priv.h (+0/-59)
src/mircommon/session_mir.cpp (+0/-51)
src/mircommon/ubuntu_application_sensors_desktop.cpp (+0/-190)
src/mirserver/CMakeLists.txt (+0/-38)
src/mirserver/application_instance_mirserver.cpp (+0/-83)
src/mirserver/application_instance_mirserver_priv.h (+0/-85)
src/mirserver/ubuntu_application_api_mirserver.cpp (+0/-320)
src/mirserver/ubuntu_application_api_mirserver_priv.h (+0/-41)
src/mirserver/window_mirserver.cpp (+0/-81)
src/mirserver/window_mirserver_priv.h (+0/-92)
src/mirserver/window_properties_mirserver.cpp (+0/-73)
src/mirserver/window_properties_mirserver_priv.h (+0/-69)
src/ubuntu/CMakeLists.txt (+27/-0)
src/ubuntu/application/CMakeLists.txt (+1/-0)
src/ubuntu/application/location/CMakeLists.txt (+10/-0)
src/ubuntu/application/location/heading_update.cpp (+32/-0)
src/ubuntu/application/location/position_update.cpp (+60/-0)
src/ubuntu/application/location/service.cpp (+15/-0)
src/ubuntu/application/location/session.cpp (+87/-0)
src/ubuntu/application/location/velocity_update.cpp (+32/-0)
src/ubuntu/hybris/CMakeLists.txt (+57/-0)
src/ubuntu/hybris/bridge.h (+202/-0)
src/ubuntu/hybris/tests/CMakeLists.txt (+25/-0)
src/ubuntu/hybris/tests/test_c_api.cpp (+329/-0)
src/ubuntu/hybris/tests/test_gps_api.cpp (+252/-0)
src/ubuntu/hybris/tests/test_multiple_surfaces_event_delivery.cpp (+351/-0)
src/ubuntu/hybris/tests/test_sensors_api.cpp (+88/-0)
src/ubuntu/hybris/tests/test_session_c_api.cpp (+229/-0)
src/ubuntu/hybris/ubuntu_application_api_hybris.cpp (+130/-0)
src/ubuntu/hybris/ubuntu_application_sensors_hybris.cpp (+70/-0)
src/ubuntu/hybris/ubuntu_platform_hardware_api.cpp (+78/-0)
src/ubuntu/mirclient/CMakeLists.txt (+34/-0)
src/ubuntu/mirclient/application_instance_mirclient.cpp (+68/-0)
src/ubuntu/mirclient/application_instance_mirclient_priv.h (+68/-0)
src/ubuntu/mirclient/ubuntu_application_api_mirclient.cpp (+279/-0)
src/ubuntu/mirclient/window_mirclient.cpp (+128/-0)
src/ubuntu/mirclient/window_mirclient_priv.h (+76/-0)
src/ubuntu/mirclient/window_properties_mirclient.cpp (+68/-0)
src/ubuntu/mirclient/window_properties_mirclient_priv.h (+72/-0)
src/ubuntu/mircommon/CMakeLists.txt (+44/-0)
src/ubuntu/mircommon/application_description_mir.cpp (+94/-0)
src/ubuntu/mircommon/application_description_mir_priv.h (+56/-0)
src/ubuntu/mircommon/application_id_mir.cpp (+56/-0)
src/ubuntu/mircommon/application_id_mir_priv.h (+53/-0)
src/ubuntu/mircommon/application_options_mir.cpp (+170/-0)
src/ubuntu/mircommon/application_options_mir_priv.h (+58/-0)
src/ubuntu/mircommon/event_helpers_mir.cpp (+77/-0)
src/ubuntu/mircommon/event_helpers_mir.h (+39/-0)
src/ubuntu/mircommon/lifecycle_delegate_mir.cpp (+136/-0)
src/ubuntu/mircommon/lifecycle_delegate_mir_priv.h (+59/-0)
src/ubuntu/mircommon/session_mir.cpp (+51/-0)
src/ubuntu/mircommon/ubuntu_application_sensors_desktop.cpp (+190/-0)
src/ubuntu/mirserver/CMakeLists.txt (+38/-0)
src/ubuntu/mirserver/application_instance_mirserver.cpp (+83/-0)
src/ubuntu/mirserver/application_instance_mirserver_priv.h (+85/-0)
src/ubuntu/mirserver/ubuntu_application_api_mirserver.cpp (+320/-0)
src/ubuntu/mirserver/ubuntu_application_api_mirserver_priv.h (+41/-0)
src/ubuntu/mirserver/window_mirserver.cpp (+81/-0)
src/ubuntu/mirserver/window_mirserver_priv.h (+92/-0)
src/ubuntu/mirserver/window_properties_mirserver.cpp (+73/-0)
src/ubuntu/mirserver/window_properties_mirserver_priv.h (+69/-0)
To merge this branch: bzr merge lp:~ricmm/platform-api/add-location-service-api-take-2
Reviewer Review Type Date Requested Status
Gerry Boland (community) Needs Resubmitting
PS Jenkins bot continuous-integration Approve
Review via email: mp+177468@code.launchpad.net

Commit message

Add the location service API together with respective documentation.

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

Over a year old, think this can die no? If not, please resubmit

review: Needs Resubmitting

Unmerged revisions

96. By Ricardo Mendoza

Merge trunk

95. By Thomas Voß

Merged trunk.

94. By Thomas Voß

Merged trunk.

93. By Thomas Voß

Fix lintian warnings for the doc-base package.

92. By Thomas Voß

Fix line-length in debian/control.

91. By Thomas Voß

[ Thomas Voß ]
[ Ubuntu daily release ]
* debian/*symbols: auto-update new symbols to released version
[ Thomas Voß ]
* Add first wave of doxygen documentation and make the documentation
  known to the packaging setup.
[ Ubuntu daily release ]
* Automatic snapshot from revision 87

90. By Thomas Voß

Update symbols file to account for removed symbols.

89. By Thomas Voß

 * Do not include full-paths in documentation.

88. By Thomas Voß

Add documentation for the location service.

87. By Thomas Voß

 * Refactored the src folder
 * Added the location service API

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2013-07-18 23:55:59 +0000
3+++ debian/control 2013-07-29 20:25:28 +0000
4@@ -38,7 +38,8 @@
5 Depends: ${misc:Depends},
6 libplatform-api-headers,
7 Description: Platform API for system level capabilities (API headers)
8- This package provides the library headers for the hw-access parts of the Platform API.
9+ This package provides the library headers for the hw-access parts
10+ of the Platform API.
11 .
12 Unless a new backend for the Platform API is developed, packages
13 should build depend on the libplatform-hardware-api-dev package instead, which
14@@ -91,7 +92,8 @@
15 ${shlibs:Depends},
16 libhybris,
17 Description: Hybris implementation of the hw-access parts of the Platform API (runtime)
18- This package provides the hybris implementation of the hw-access parts of the Platform API.
19+ This package provides the hybris implementation of the hw-access parts
20+ of the Platform API.
21 .
22 The produced library should be used via libhybris, to communicate with the
23 Android userspace, which is where the device drivers live.
24
25=== modified file 'debian/libplatform-api1-doc.doc-base'
26--- debian/libplatform-api1-doc.doc-base 2013-07-05 16:34:47 +0000
27+++ debian/libplatform-api1-doc.doc-base 2013-07-29 20:25:28 +0000
28@@ -1,8 +1,9 @@
29-Document: ubuntu-platform-api
30+Document: ubuntu-platform-api
31 Title: Ubuntu Platform API Reference Documentation
32 Author: Thomas Voß
33 Abstract: This is the reference documentation for the Ubuntu Platform API
34 Section: Debian
35+
36 Format: HTML
37 Index: /usr/share/doc/ubuntu-platform-api/html/index.html
38 Files: /usr/share/doc/ubuntu-platform-api/html/*.html
39
40=== modified file 'debian/libubuntu-application-api1.symbols'
41--- debian/libubuntu-application-api1.symbols 2013-07-17 14:29:04 +0000
42+++ debian/libubuntu-application-api1.symbols 2013-07-29 20:25:28 +0000
43@@ -17,6 +17,34 @@
44 u_application_options_get_form_factor@Base 0.18.1daily13.06.21
45 u_application_options_get_stage@Base 0.18.1daily13.06.21
46 u_application_options_new_from_cmd_line@Base 0.18.1daily13.06.21
47+ ua_location_heading_update_get_timestamp@Base 0replaceme
48+ ua_location_heading_update_ref@Base 0replaceme
49+ ua_location_heading_update_unref@Base 0replaceme
50+ ua_location_position_update_get_altitude_in_meter@Base 0replaceme
51+ ua_location_position_update_get_heading_in_degree@Base 0replaceme
52+ ua_location_position_update_get_latitude_in_degree@Base 0replaceme
53+ ua_location_position_update_get_longitude_in_degree@Base 0replaceme
54+ ua_location_position_update_get_timestamp@Base 0replaceme
55+ ua_location_position_update_has_altitude@Base 0replaceme
56+ ua_location_position_update_ref@Base 0replaceme
57+ ua_location_position_update_unref@Base 0replaceme
58+ ua_location_service_create_session_for_high_accuracy@Base 0replaceme
59+ ua_location_service_create_session_for_low_accuracy@Base 0replaceme
60+ ua_location_service_session_ref@Base 0replaceme
61+ ua_location_service_session_set_heading_updates_handler@Base 0replaceme
62+ ua_location_service_session_set_position_updates_handler@Base 0replaceme
63+ ua_location_service_session_set_velocity_updates_handler@Base 0replaceme
64+ ua_location_service_session_start_heading_updates@Base 0replaceme
65+ ua_location_service_session_start_position_updates@Base 0replaceme
66+ ua_location_service_session_start_velocity_updates@Base 0replaceme
67+ ua_location_service_session_stop_heading_updates@Base 0replaceme
68+ ua_location_service_session_stop_position_updates@Base 0replaceme
69+ ua_location_service_session_stop_velocity_updates@Base 0replaceme
70+ ua_location_service_session_unref@Base 0replaceme
71+ ua_location_velocity_update_get_timestamp@Base 0replaceme
72+ ua_location_velocity_update_get_velocity_in_meters_per_second@Base 0replaceme
73+ ua_location_velocity_update_ref@Base 0replaceme
74+ ua_location_velocity_update_unref@Base 0replaceme
75 ua_sensors_accelerometer_disable@Base 0.18.1daily13.06.21
76 ua_sensors_accelerometer_enable@Base 0.18.1daily13.06.21
77 ua_sensors_accelerometer_get_max_value@Base 0.18.1daily13.06.21
78
79=== modified file 'doc/Doxyfile.in'
80--- doc/Doxyfile.in 2013-07-05 09:13:31 +0000
81+++ doc/Doxyfile.in 2013-07-29 20:25:28 +0000
82@@ -119,7 +119,7 @@
83 # path before files name in the file list and in the header files. If set
84 # to NO the shortest path that makes the file name unique will be used.
85
86-FULL_PATH_NAMES = YES
87+FULL_PATH_NAMES = NO
88
89 # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
90 # can be used to strip a user-defined part of the path. Stripping is
91@@ -1293,7 +1293,7 @@
92 # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
93 # generate Latex output.
94
95-GENERATE_LATEX = NO
96+GENERATE_LATEX = YES
97
98 # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
99 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
100@@ -1319,7 +1319,7 @@
101 # LaTeX documents. This may be useful for small projects and may help to
102 # save some trees in general.
103
104-COMPACT_LATEX = NO
105+COMPACT_LATEX = YES
106
107 # The PAPER_TYPE tag can be used to set the paper type that is used
108 # by the printer. Possible values are: a4, letter, legal and
109@@ -1364,20 +1364,20 @@
110 # running if errors occur, instead of asking the user for help.
111 # This option is also used when generating formulas in HTML.
112
113-LATEX_BATCHMODE = NO
114+LATEX_BATCHMODE = YES
115
116 # If LATEX_HIDE_INDICES is set to YES then doxygen will not
117 # include the index chapters (such as File Index, Compound Index, etc.)
118 # in the output.
119
120-LATEX_HIDE_INDICES = NO
121+LATEX_HIDE_INDICES = YES
122
123 # If LATEX_SOURCE_CODE is set to YES then doxygen will include
124 # source code with syntax highlighting in the LaTeX output.
125 # Note that which sources are shown also depends on other settings
126 # such as SOURCE_BROWSER.
127
128-LATEX_SOURCE_CODE = NO
129+LATEX_SOURCE_CODE = YES
130
131 # The LATEX_BIB_STYLE tag can be used to specify the style to use for the
132 # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
133
134=== modified file 'include/ubuntu/application/CMakeLists.txt'
135--- include/ubuntu/application/CMakeLists.txt 2013-07-18 09:08:17 +0000
136+++ include/ubuntu/application/CMakeLists.txt 2013-07-29 20:25:28 +0000
137@@ -14,5 +14,6 @@
138 DESTINATION include/ubuntu/application
139 )
140
141+add_subdirectory(location)
142 add_subdirectory(sensors)
143 add_subdirectory(ui)
144
145=== added directory 'include/ubuntu/application/location'
146=== added file 'include/ubuntu/application/location/CMakeLists.txt'
147--- include/ubuntu/application/location/CMakeLists.txt 1970-01-01 00:00:00 +0000
148+++ include/ubuntu/application/location/CMakeLists.txt 2013-07-29 20:25:28 +0000
149@@ -0,0 +1,14 @@
150+set(
151+ UBUNTU_APPLICATION_SENSORS_HEADERS
152+
153+ heading_update.h
154+ position_update.h
155+ service.h
156+ session.h
157+ velocity_update.h
158+)
159+
160+install(
161+ FILES ${UBUNTU_APPLICATION_SENSORS_HEADERS}
162+ DESTINATION include/ubuntu-${UBUNTU_PLATFORM_API_VERSION_MAJOR}/application/location
163+)
164\ No newline at end of file
165
166=== added file 'include/ubuntu/application/location/heading_update.h'
167--- include/ubuntu/application/location/heading_update.h 1970-01-01 00:00:00 +0000
168+++ include/ubuntu/application/location/heading_update.h 2013-07-29 20:25:28 +0000
169@@ -0,0 +1,78 @@
170+/*
171+ * Copyright © 2013 Canonical Ltd.
172+ *
173+ * This program is free software: you can redistribute it and/or modify
174+ * it under the terms of the GNU Lesser General Public License version 3 as
175+ * published by the Free Software Foundation.
176+ *
177+ * This program is distributed in the hope that it will be useful,
178+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
179+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
180+ * GNU Lesser General Public License for more details.
181+ *
182+ * You should have received a copy of the GNU Lesser General Public License
183+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
184+ *
185+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
186+ */
187+
188+#ifndef UBUNTU_APPLICATION_LOCATION_HEADING_UPDATE_H_
189+#define UBUNTU_APPLICATION_LOCATION_HEADING_UPDATE_H_
190+
191+#include <stdbool.h>
192+#include <stdint.h>
193+
194+#ifdef __cplusplus
195+extern "C"
196+{
197+#endif
198+
199+ /**
200+ * \brief Opaque type encapsulating a heading update.
201+ * \ingroup location_service
202+ */
203+ typedef struct UbuntuApplicationLocationHeadingUpdate UALocationHeadingUpdate;
204+
205+ /**
206+ * \brief Increments the reference count of the heading update instance.
207+ * \ingroup location_service
208+ * \param[in] update The heading update instance to increment the reference count for.
209+ */
210+ void
211+ ua_location_heading_update_ref(
212+ UALocationHeadingUpdate *update);
213+
214+ /**
215+ * \brief Decrements the reference count of the heading update instance.
216+ * \ingroup location_service
217+ * \param[in] update The heading update instance to decrement the reference count for.
218+ */
219+ void
220+ ua_location_heading_update_unref(
221+ UALocationHeadingUpdate *update);
222+
223+ /**
224+ * \brief Queries the timestamp of the heading update.
225+ * \ingroup location_service
226+ * \returns The timestamp of the heading update in [µs].
227+ * \param[in] update The heading update instance to be queried.
228+ */
229+ uint64_t
230+ ua_location_heading_update_get_timestamp(
231+ UALocationHeadingUpdate *update);
232+
233+ /**
234+ * \brief Queries the new heading from the update.
235+ * \ingroup location_service
236+ * \returns The new heading from the update in [°].
237+ * \param[in] update The heading update instance to be queried.
238+ */
239+ double
240+ ua_location_position_update_get_heading_in_degree(
241+ UALocationHeadingUpdate *update);
242+
243+#ifdef __cplusplus
244+}
245+#endif
246+
247+#endif // UBUNTU_APPLICATION_LOCATION_HEADING_UPDATE_H_
248
249=== added file 'include/ubuntu/application/location/position_update.h'
250--- include/ubuntu/application/location/position_update.h 1970-01-01 00:00:00 +0000
251+++ include/ubuntu/application/location/position_update.h 2013-07-29 20:25:28 +0000
252@@ -0,0 +1,108 @@
253+/*
254+ * Copyright © 2013 Canonical Ltd.
255+ *
256+ * This program is free software: you can redistribute it and/or modify
257+ * it under the terms of the GNU Lesser General Public License version 3 as
258+ * published by the Free Software Foundation.
259+ *
260+ * This program is distributed in the hope that it will be useful,
261+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
262+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
263+ * GNU Lesser General Public License for more details.
264+ *
265+ * You should have received a copy of the GNU Lesser General Public License
266+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
267+ *
268+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
269+ */
270+
271+#ifndef UBUNTU_APPLICATION_LOCATION_POSITION_UPDATE_H_
272+#define UBUNTU_APPLICATION_LOCATION_POSITION_UPDATE_H_
273+
274+#include <stdbool.h>
275+#include <stdint.h>
276+
277+#ifdef __cplusplus
278+extern "C"
279+{
280+#endif
281+
282+ /**
283+ * \brief Opaque type encapsulating a location update.
284+ * \ingroup location_service
285+ */
286+ typedef struct UbuntuApplicationLocationPositionUpdate UALocationPositionUpdate;
287+
288+ /**
289+ * \brief Increments the reference count of the position update instance.
290+ * \ingroup location_service
291+ * \param[in] update The position update instance to increment the reference count for.
292+ */
293+ void
294+ ua_location_position_update_ref(
295+ UALocationPositionUpdate *update);
296+
297+ /**
298+ * \brief Decrements the reference count of the position update instance.
299+ * \ingroup location_service
300+ * \param[in] update The position update instance to decrement the reference count for.
301+ */
302+ void
303+ ua_location_position_update_unref(
304+ UALocationPositionUpdate *update);
305+
306+ /**
307+ * \brief Queries the timestamp of the position update.
308+ * \ingroup location_service
309+ * \returns The timestamp of the position update in [µs].
310+ * \param[in] update The position update instance to be queried.
311+ */
312+ uint64_t
313+ ua_location_position_update_get_timestamp(
314+ UALocationPositionUpdate *update);
315+
316+ /**
317+ * \brief Queries the latitude contained in the position update.
318+ * \ingroup location_service
319+ * \returns The latitude of the position update in [°].
320+ * \param[in] update The position update instance to be queried.
321+ */
322+ double
323+ ua_location_position_update_get_latitude_in_degree(
324+ UALocationPositionUpdate *update);
325+
326+ /**
327+ * \brief Queries the longitude contained in the position update.
328+ * \ingroup location_service
329+ * \returns The longitude of the position update in [°].
330+ * \param[in] update The position update instance to be queried.
331+ */
332+ double
333+ ua_location_position_update_get_longitude_in_degree(
334+ UALocationPositionUpdate *update);
335+
336+ /**
337+ * \brief Checks if the position update contains an altitude.
338+ * \ingroup location_service
339+ * \returns TRUE if the update contains an altitude, else FALSE.
340+ * \param[in] update The position update instance to be queried.
341+ */
342+ bool
343+ ua_location_position_update_has_altitude(
344+ UALocationPositionUpdate *update);
345+
346+ /**
347+ * \brief Queries the altitude contained in the position update.
348+ * \ingroup location_service
349+ * \returns The altitude of the position update in [m].
350+ * \param[in] update The position update instance to be queried.
351+ */
352+ double
353+ ua_location_position_update_get_altitude_in_meter(
354+ UALocationPositionUpdate *update);
355+
356+#ifdef __cplusplus
357+}
358+#endif
359+
360+#endif // UBUNTU_APPLICATION_LOCATION_POSITION_UPDATE_H_
361
362=== added file 'include/ubuntu/application/location/service.h'
363--- include/ubuntu/application/location/service.h 1970-01-01 00:00:00 +0000
364+++ include/ubuntu/application/location/service.h 2013-07-29 20:25:28 +0000
365@@ -0,0 +1,94 @@
366+/*
367+ * Copyright © 2013 Canonical Ltd.
368+ *
369+ * This program is free software: you can redistribute it and/or modify
370+ * it under the terms of the GNU Lesser General Public License version 3 as
371+ * published by the Free Software Foundation.
372+ *
373+ * This program is distributed in the hope that it will be useful,
374+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
375+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376+ * GNU Lesser General Public License for more details.
377+ *
378+ * You should have received a copy of the GNU Lesser General Public License
379+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
380+ *
381+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
382+ */
383+
384+#ifndef UBUNTU_APPLICATION_LOCATION_SERVICE_H_
385+#define UBUNTU_APPLICATION_LOCATION_SERVICE_H_
386+
387+#include "ubuntu/application/location/session.h"
388+
389+#ifdef __cplusplus
390+extern "C"
391+{
392+#endif
393+ /**
394+ * \defgroup location_service Functions and types to provide location services to applications.
395+ *
396+ * Applications in Ubuntu do not access positioning hardware
397+ * directly but instead rely on a system-wide location service to
398+ * be provided with position, heading and velocity updates. An
399+ * application that wants to receive position, heading or
400+ * velocity updates needs to start a session with the location
401+ * service and specify its requirements with the help
402+ * UALocationServiceRequirementsFlags. After the session has been
403+ * created, position, heading and velocity updates need to be
404+ * started by the application for its session. The actual updates
405+ * are delivered via callbacks. Please note that the location
406+ * service caches updates as good as possible. That is, if an
407+ * application is only interested in a single position fix, and a
408+ * reasonable fix is already known to the service, the
409+ * information is immediately delivered to the application when
410+ * the respecitve updates are started.
411+ *
412+ */
413+
414+ /**
415+ * \brief Application-specific requirements.
416+ * \ingroup location_service
417+ */
418+ typedef enum
419+ {
420+ UA_LOCATION_SERVICE_REQUIRE_ALTITUDE = 1 << 0, /**< The application requires altitude updates. */
421+ UA_LOCATION_SERVICE_REQUIRE_HEADING = 1 << 1, /**< The application requires heading updates. */
422+ UA_LOCATION_SERVICE_REQUIRE_VELOCITY = 1 << 2 /**< The application requires velocity updates. */
423+ } UbuntuApplicationLocationServiceRequirement;
424+
425+ typedef UbuntuApplicationLocationServiceRequirement UALocationServiceRequirement;
426+
427+ /**
428+ * \brief Bitfield type for summarizing an application's requirements.
429+ * \ingroup location_service
430+ */
431+ typedef unsigned int UALocationServiceRequirementsFlags;
432+
433+ /**
434+ * \brief Creates a new session with the location service for low positional accuracy requirements.
435+ * \returns A new session or NULL if the requirements cannot be
436+ * satisfied or if the app lacks permissions to access the
437+ * location service.
438+ * \param[in] Bitfield describing the application's requirements.
439+ */
440+ UALocationServiceSession*
441+ ua_location_service_create_session_for_low_accuracy(
442+ UALocationServiceRequirementsFlags flags);
443+
444+ /**
445+ * \brief Creates a new session with the location service for high positional accuracy requirements.
446+ * \returns A new session or NULL if the requirements cannot be
447+ * satisfied or if the app lacks permissions to access the
448+ * location service.
449+ * \param[in] Bitfield describing the application's requirements.
450+ */
451+ UALocationServiceSession*
452+ ua_location_service_create_session_for_high_accuracy(
453+ UALocationServiceRequirementsFlags flags);
454+
455+#ifdef __cplusplus
456+}
457+#endif
458+
459+#endif // UBUNTU_APPLICATION_LOCATION_SERVICE_H_
460
461=== added file 'include/ubuntu/application/location/session.h'
462--- include/ubuntu/application/location/session.h 1970-01-01 00:00:00 +0000
463+++ include/ubuntu/application/location/session.h 2013-07-29 20:25:28 +0000
464@@ -0,0 +1,169 @@
465+/*
466+ * Copyright © 2013 Canonical Ltd.
467+ *
468+ * This program is free software: you can redistribute it and/or modify
469+ * it under the terms of the GNU Lesser General Public License version 3 as
470+ * published by the Free Software Foundation.
471+ *
472+ * This program is distributed in the hope that it will be useful,
473+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
474+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
475+ * GNU Lesser General Public License for more details.
476+ *
477+ * You should have received a copy of the GNU Lesser General Public License
478+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
479+ *
480+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
481+ */
482+
483+#ifndef UBUNTU_APPLICATION_LOCATION_SESSION_H_
484+#define UBUNTU_APPLICATION_LOCATION_SESSION_H_
485+
486+#include "ubuntu/status.h"
487+#include "ubuntu/application/location/heading_update.h"
488+#include "ubuntu/application/location/position_update.h"
489+#include "ubuntu/application/location/velocity_update.h"
490+
491+#ifdef __cplusplus
492+extern "C"
493+{
494+#endif
495+
496+ /**
497+ * \brief Opaque type encapsulating a session with the location service.
498+ * \ingroup location_service
499+ */
500+ typedef struct UbuntuApplicationLocationServiceSession UALocationServiceSession;
501+
502+ /**
503+ * \brief Callback type that is invoked for position updates.
504+ * \ingroup location_service
505+ */
506+
507+ typedef void (*UALocationServiceSessionPositionUpdatesHandler)(UALocationPositionUpdate *position);
508+
509+ /**
510+ * \brief Callback type that is invoked for heading updates.
511+ * \ingroup location_service
512+ */
513+ typedef void (*UALocationServiceSessionHeadingUpdatesHandler)(UALocationHeadingUpdate *heading);
514+
515+ /**
516+ * \brief Callback type that is invoked for velocity updates.
517+ * \ingroup location_service
518+ */
519+ typedef void (*UALocationServiceSessionVelocityUpdatesHandler)(UALocationVelocityUpdate *heading);
520+
521+ /**
522+ * \brief Increments the reference count of the session instance.
523+ * \ingroup location_service
524+ * \param[in] session The session instance to increment the reference count for.
525+ */
526+ void
527+ ua_location_service_session_ref(
528+ UALocationServiceSession *session);
529+
530+ /**
531+ * \brief Decrements the reference count of the session instance.
532+ * \ingroup location_service
533+ * \param[in] session The session instance to decrement the reference count for.
534+ */
535+ void
536+ ua_location_service_session_unref(
537+ UALocationServiceSession *session);
538+
539+ /**
540+ * \brief Installs an app-specific position update handler for the session.
541+ * \ingroup location_service
542+ * \param[in] session The session instance to install the handler for.
543+ * \param[in] handler The position update handler.
544+ */
545+ void
546+ ua_location_service_session_set_position_updates_handler(
547+ UALocationServiceSession *session,
548+ UALocationServiceSessionPositionUpdatesHandler *handler);
549+
550+ /**
551+ * \brief Installs an app-specific heading update handler for the session.
552+ * \ingroup location_service
553+ * \param[in] session The session instance to install the handler for.
554+ * \param[in] handler The heading update handler.
555+ */
556+ void
557+ ua_location_service_session_set_heading_updates_handler(
558+ UALocationServiceSession *session,
559+ UALocationServiceSessionHeadingUpdatesHandler *handler);
560+
561+ /**
562+ * \brief Installs an app-specific velocity update handler for the session.
563+ * \ingroup location_service
564+ * \param[in] session The session instance to install the handler for.
565+ * \param[in] handler The velocity update handler.
566+ */
567+ void
568+ ua_location_service_session_set_velocity_updates_handler(
569+ UALocationServiceSession *session,
570+ UALocationServiceSessionVelocityUpdatesHandler *handler);
571+
572+ /**
573+ * \brief Starts position updates for the supplied session.
574+ * \ingroup location_service
575+ * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR.
576+ * \param[in] session The session instance to start position updates for.
577+ */
578+ UStatus
579+ ua_location_service_session_start_position_updates(
580+ UALocationServiceSession *session);
581+
582+ /**
583+ * \brief Stops position updates for the supplied session.
584+ * \ingroup location_service
585+ * \param[in] session The session instance to stop position updates for.
586+ */
587+ void
588+ ua_location_service_session_stop_position_updates(
589+ UALocationServiceSession *session);
590+
591+ /**
592+ * \brief Starts heading updates for the supplied session.
593+ * \ingroup location_service
594+ * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR.
595+ * \param[in] session The session instance to start heading updates for.
596+ */
597+ UStatus
598+ ua_location_service_session_start_heading_updates(
599+ UALocationServiceSession *session);
600+
601+ /**
602+ * \brief Stops heading updates for the supplied session.
603+ * \ingroup location_service
604+ * \param[in] session The session instance to stop heading updates for.
605+ */
606+ void
607+ ua_location_service_session_stop_heading_updates(
608+ UALocationServiceSession *session);
609+
610+ /**
611+ * \brief Starts velocity updates for the supplied session.
612+ * \ingroup location_service
613+ * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR.
614+ * \param[in] session The session instance to start velocity updates for.
615+ */
616+ UStatus
617+ ua_location_service_session_start_velocity_updates(
618+ UALocationServiceSession *session);
619+
620+ /**
621+ * \brief Stops velocity updates for the supplied session.
622+ * \ingroup location_service
623+ * \param[in] session The session instance to stop velocity updates for.
624+ */
625+ void
626+ ua_location_service_session_stop_velocity_updates(
627+ UALocationServiceSession *session);
628+
629+#ifdef __cplusplus
630+}
631+#endif
632+
633+#endif // UBUNTU_APPLICATION_LOCATION_SESSION_H_
634
635=== added file 'include/ubuntu/application/location/velocity_update.h'
636--- include/ubuntu/application/location/velocity_update.h 1970-01-01 00:00:00 +0000
637+++ include/ubuntu/application/location/velocity_update.h 2013-07-29 20:25:28 +0000
638@@ -0,0 +1,78 @@
639+/*
640+ * Copyright © 2013 Canonical Ltd.
641+ *
642+ * This program is free software: you can redistribute it and/or modify
643+ * it under the terms of the GNU Lesser General Public License version 3 as
644+ * published by the Free Software Foundation.
645+ *
646+ * This program is distributed in the hope that it will be useful,
647+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
648+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
649+ * GNU Lesser General Public License for more details.
650+ *
651+ * You should have received a copy of the GNU Lesser General Public License
652+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
653+ *
654+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
655+ */
656+
657+#ifndef UBUNTU_APPLICATION_LOCATION_VELOCITY_UPDATE_H_
658+#define UBUNTU_APPLICATION_LOCATION_VELOCITY_UPDATE_H_
659+
660+#include <stdbool.h>
661+#include <stdint.h>
662+
663+#ifdef __cplusplus
664+extern "C"
665+{
666+#endif
667+
668+ /**
669+ * \brief Opaque type encapsulating a velocity update.
670+ * \ingroup location_service
671+ */
672+ typedef struct UbuntuApplicationLocationVelocityUpdate UALocationVelocityUpdate;
673+
674+ /**
675+ * \brief Increments the reference count of the velocity update instance.
676+ * \ingroup location_service
677+ * \param[in] update The velocity update instance to increment the reference count for.
678+ */
679+ void
680+ ua_location_velocity_update_ref(
681+ UALocationVelocityUpdate *update);
682+
683+ /**
684+ * \brief Decrements the reference count of the velocity update instance.
685+ * \ingroup location_service
686+ * \param[in] update The velocity update instance to decrement the reference count for.
687+ */
688+ void
689+ ua_location_velocity_update_unref(
690+ UALocationVelocityUpdate *update);
691+
692+ /**
693+ * \brief Queries the timestamp of the velocity update.
694+ * \ingroup location_service
695+ * \returns The timestamp of the position update in [µs].
696+ * \param[in] update The velocity update instance to be queried.
697+ */
698+ uint64_t
699+ ua_location_velocity_update_get_timestamp(
700+ UALocationVelocityUpdate *update);
701+
702+ /**
703+ * \brief Queries the velocity contained in the position update.
704+ * \ingroup location_service
705+ * \returns The velocity in the position update in [m/s].
706+ * \param[in] update The velocity update instance to be queried.
707+ */
708+ double
709+ ua_location_velocity_update_get_velocity_in_meters_per_second(
710+ UALocationVelocityUpdate *update);
711+
712+#ifdef __cplusplus
713+}
714+#endif
715+
716+#endif // UBUNTU_APPLICATION_LOCATION_VELOCITY_UPDATE_H_
717
718=== modified file 'src/CMakeLists.txt'
719--- src/CMakeLists.txt 2013-06-17 23:37:58 +0000
720+++ src/CMakeLists.txt 2013-07-29 20:25:28 +0000
721@@ -2,18 +2,4 @@
722 ${CMAKE_CURRENT_SOURCE_DIR}
723 )
724
725-if(ENABLE_HYBRIS_IMPLEMENTATION)
726- add_subdirectory(hybris/)
727-endif()
728-
729-if(ENABLE_MIRSERVER_IMPLEMENTATION OR ENABLE_MIRCLIENT_IMPLEMENTATION)
730- add_subdirectory(mircommon/)
731-endif()
732-
733-if(ENABLE_MIRSERVER_IMPLEMENTATION)
734- add_subdirectory(mirserver/)
735-endif()
736-
737-if(ENABLE_MIRCLIENT_IMPLEMENTATION)
738- add_subdirectory(mirclient/)
739-endif()
740+add_subdirectory(ubuntu)
741\ No newline at end of file
742
743=== removed directory 'src/hybris'
744=== removed file 'src/hybris/CMakeLists.txt'
745--- src/hybris/CMakeLists.txt 2013-06-20 12:37:44 +0000
746+++ src/hybris/CMakeLists.txt 1970-01-01 00:00:00 +0000
747@@ -1,53 +0,0 @@
748-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++0x")
749-
750-add_library(
751- ubuntu_application_api SHARED
752-
753- ubuntu_application_api_hybris.cpp
754- ubuntu_application_sensors_hybris.cpp
755-)
756-
757-add_library(
758- ubuntu_platform_hardware_api SHARED
759- ubuntu_platform_hardware_api.cpp
760-)
761-
762-include_directories(
763- ${CMAKE_BINARY_DIR}/include
764-)
765-
766-target_link_libraries(
767- ubuntu_application_api
768- hybris-common
769-)
770-
771-target_link_libraries(
772- ubuntu_platform_hardware_api
773- hybris-common
774-)
775-
776-set_target_properties(
777- ubuntu_application_api
778- PROPERTIES
779- VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH}
780- SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}
781-)
782-
783-set_target_properties(
784- ubuntu_platform_hardware_api
785- PROPERTIES
786- VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH}
787- SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}
788-)
789-
790-install(
791- TARGETS ubuntu_application_api
792- ${INSTALL_TARGETS_DEFAULT_ARGS}
793-)
794-
795-install(
796- TARGETS ubuntu_platform_hardware_api
797- ${INSTALL_TARGETS_DEFAULT_ARGS}
798-)
799-
800-add_subdirectory(tests/)
801
802=== removed file 'src/hybris/bridge.h'
803--- src/hybris/bridge.h 2013-07-05 10:30:08 +0000
804+++ src/hybris/bridge.h 1970-01-01 00:00:00 +0000
805@@ -1,202 +0,0 @@
806-/*
807- * Copyright (C) 2012 Canonical Ltd
808- *
809- * This program is free software: you can redistribute it and/or modify
810- * it under the terms of the GNU Lesser General Public License version 3 as
811- * published by the Free Software Foundation.
812- *
813- * This program is distributed in the hope that it will be useful,
814- * but WITHOUT ANY WARRANTY; without even the implied warranty of
815- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
816- * GNU Lesser General Public License for more details.
817- *
818- * You should have received a copy of the GNU Lesser General Public License
819- * along with this program. If not, see <http://www.gnu.org/licenses/>.
820- *
821- * Authored by: Thomas Voss <thomas.voss@canonical.com>
822- * Ricardo Mendoza <ricardo.mendoza@canonical.com>
823- */
824-#ifndef BRIDGE_H_
825-#define BRIDGE_H_
826-
827-#include <assert.h>
828-#include <dlfcn.h>
829-#include <stddef.h>
830-
831-#define HIDDEN_SYMBOL __attribute__ ((visibility ("hidden")))
832-
833-#ifdef __cplusplus
834-extern "C" {
835-#endif
836-
837-extern void *android_dlopen(const char *filename, int flag);
838-extern void *android_dlsym(void *handle, const char *symbol);
839-
840-#ifdef __cplusplus
841-}
842-#endif
843-
844-namespace internal
845-{
846-
847-struct HIDDEN_SYMBOL ToApplication
848-{
849- static const char* path()
850- {
851- return "/system/lib/libubuntu_application_api.so";
852- }
853-};
854-
855-struct HIDDEN_SYMBOL ToHardware
856-{
857- static const char* path()
858- {
859- return "/system/lib/libubuntu_platform_hardware_api.so";
860- }
861-};
862-
863-template<typename Scope = ToApplication>
864-class HIDDEN_SYMBOL Bridge
865-{
866- public:
867- static Bridge<Scope>& instance()
868- {
869- static Bridge<Scope> bridge;
870- return bridge;
871- }
872-
873- void* resolve_symbol(const char* symbol) const
874- {
875- return android_dlsym(lib_handle, symbol);
876- }
877-
878- protected:
879- Bridge() : lib_handle(android_dlopen(Scope::path(), RTLD_LAZY))
880- {
881- assert(lib_handle && "Error loading ubuntu_application_api");
882- }
883-
884- ~Bridge()
885- {
886- // TODO android_dlclose(libcamera_handle);
887- }
888-
889- void* lib_handle;
890-};
891-
892-}
893-
894-#ifdef __cplusplus
895-extern "C" {
896-#endif
897-
898-/**********************************************************/
899-/*********** Implementation starts here *******************/
900-/**********************************************************/
901-
902-#define DLSYM(fptr, sym) if (*(fptr) == NULL) { *((void**)fptr) = (void *) internal::Bridge<>::instance().resolve_symbol(sym); }
903-
904-#define IMPLEMENT_FUNCTION0(return_type, symbol) \
905- return_type symbol() \
906- { \
907- static return_type (*f)() = NULL; \
908- DLSYM(&f, #symbol); \
909- return f();}
910-
911-#define IMPLEMENT_VOID_FUNCTION0(symbol) \
912- void symbol() \
913- { \
914- static void (*f)() = NULL; \
915- DLSYM(&f, #symbol); \
916- f();}
917-
918-#define IMPLEMENT_FUNCTION1(return_type, symbol, arg1) \
919- return_type symbol(arg1 _1) \
920- { \
921- static return_type (*f)(arg1) = NULL; \
922- DLSYM(&f, #symbol); \
923- return f(_1); }
924-
925-#define IMPLEMENT_SF_FUNCTION1(return_type, symbol, arg1) \
926- return_type symbol(arg1 _1) \
927- { \
928- static return_type (*f)(arg1) __attribute__((pcs("aapcs"))) = NULL; \
929- DLSYM(&f, #symbol); \
930- return f(_1); }
931-
932-
933-#define IMPLEMENT_VOID_FUNCTION1(symbol, arg1) \
934- void symbol(arg1 _1) \
935- { \
936- static void (*f)(arg1) = NULL; \
937- DLSYM(&f, #symbol); \
938- f(_1); }
939-
940-#define IMPLEMENT_FUNCTION2(return_type, symbol, arg1, arg2) \
941- return_type symbol(arg1 _1, arg2 _2) \
942- { \
943- static return_type (*f)(arg1, arg2) = NULL; \
944- DLSYM(&f, #symbol); \
945- return f(_1, _2); }
946-
947-#define IMPLEMENT_VOID_FUNCTION2(symbol, arg1, arg2) \
948- void symbol(arg1 _1, arg2 _2) \
949- { \
950- static void (*f)(arg1, arg2) = NULL; \
951- DLSYM(&f, #symbol); \
952- f(_1, _2); }
953-
954-#define IMPLEMENT_FUNCTION3(return_type, symbol, arg1, arg2, arg3) \
955- return_type symbol(arg1 _1, arg2 _2, arg3 _3) \
956- { \
957- static return_type (*f)(arg1, arg2, arg3) = NULL; \
958- DLSYM(&f, #symbol); \
959- return f(_1, _2, _3); }
960-
961-#define IMPLEMENT_VOID_FUNCTION3(symbol, arg1, arg2, arg3) \
962- void symbol(arg1 _1, arg2 _2, arg3 _3) \
963- { \
964- static void (*f)(arg1, arg2, arg3) = NULL; \
965- DLSYM(&f, #symbol); \
966- f(_1, _2, _3); }
967-
968-#define IMPLEMENT_VOID_FUNCTION4(symbol, arg1, arg2, arg3, arg4) \
969- void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \
970- { \
971- static void (*f)(arg1, arg2, arg3, arg4) = NULL; \
972- DLSYM(&f, #symbol); \
973- f(_1, _2, _3, _4); }
974-
975-#define IMPLEMENT_FUNCTION4(return_type, symbol, arg1, arg2, arg3, arg4) \
976- return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \
977- { \
978- static return_type (*f)(arg1, arg2, arg3, arg4) = NULL; \
979- DLSYM(&f, #symbol); \
980- return f(_1, _2, _3, _4); }
981-
982-#define IMPLEMENT_FUNCTION6(return_type, symbol, arg1, arg2, arg3, arg4, arg5, arg6) \
983- return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6) \
984- { \
985- static return_type (*f)(arg1, arg2, arg3, arg4, arg5, arg6) = NULL; \
986- DLSYM(&f, #symbol); \
987- return f(_1, _2, _3, _4, _5, _6); }
988-
989-#define IMPLEMENT_VOID_FUNCTION7(symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
990- void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7) \
991- { \
992- static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7) = NULL; \
993- DLSYM(&f, #symbol); \
994- f(_1, _2, _3, _4, _5, _6, _7); }
995-
996-#define IMPLEMENT_VOID_FUNCTION8(symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
997- void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7, arg8 _8) \
998- { \
999- static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) = NULL; \
1000- DLSYM(&f, #symbol); \
1001- f(_1, _2, _3, _4, _5, _6, _7, _8); }
1002-
1003-#ifdef __cplusplus
1004-}
1005-#endif
1006-
1007-#endif // BRIDGE_H_
1008
1009=== removed directory 'src/hybris/tests'
1010=== removed file 'src/hybris/tests/CMakeLists.txt'
1011--- src/hybris/tests/CMakeLists.txt 2013-06-20 12:37:44 +0000
1012+++ src/hybris/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000
1013@@ -1,25 +0,0 @@
1014-set(SOURCES ubuntu_application_api_hybris.cpp)
1015-
1016-add_executable(test_android_ubuntu_app_api test_c_api.cpp)
1017-target_link_libraries(test_android_ubuntu_app_api ubuntu_application_api EGL GLESv2)
1018-
1019-add_executable(test_android_gps_api test_gps_api.cpp)
1020-target_link_libraries(test_android_gps_api ubuntu_platform_hardware_api)
1021-
1022-add_executable(test_android_ubuntu_app_api_multiple_surfaces test_multiple_surfaces_event_delivery.cpp)
1023-target_link_libraries(test_android_ubuntu_app_api_multiple_surfaces ubuntu_application_api EGL GLESv2)
1024-
1025-add_executable(test_android_sensors_api test_sensors_api.cpp)
1026-target_link_libraries(test_android_sensors_api ubuntu_application_api)
1027-
1028-add_executable(test_android_ubuntu_session_api test_session_c_api.cpp)
1029-target_link_libraries(test_android_ubuntu_session_api ubuntu_application_api)
1030-
1031-install(TARGETS
1032- test_android_ubuntu_app_api
1033- test_android_gps_api
1034- test_android_ubuntu_app_api_multiple_surfaces
1035- test_android_sensors_api
1036- test_android_ubuntu_session_api
1037- DESTINATION bin
1038-)
1039
1040=== removed file 'src/hybris/tests/test_c_api.cpp'
1041--- src/hybris/tests/test_c_api.cpp 2013-05-21 22:14:40 +0000
1042+++ src/hybris/tests/test_c_api.cpp 1970-01-01 00:00:00 +0000
1043@@ -1,329 +0,0 @@
1044-/*
1045- * Copyright © 2012 Canonical Ltd.
1046- *
1047- * This program is free software: you can redistribute it and/or modify
1048- * it under the terms of the GNU General Public License version 3 as
1049- * published by the Free Software Foundation.
1050- *
1051- * This program is distributed in the hope that it will be useful,
1052- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1053- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1054- * GNU General Public License for more details.
1055- *
1056- * You should have received a copy of the GNU General Public License
1057- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1058- *
1059- * Authored by: Thomas Voß <thomas.voss@canonical.com>
1060- */
1061-
1062-#include <ubuntu/application/ui/window.h>
1063-#include <ubuntu/application/ui/options.h>
1064-#include <ubuntu/application/ui/display.h>
1065-#include <ubuntu/application/ui/session.h>
1066-
1067-#include <EGL/egl.h>
1068-#include <GLES2/gl2.h>
1069-#include <GLES2/gl2ext.h>
1070-
1071-#include <cassert>
1072-#include <cstdio>
1073-#include <cstdlib>
1074-#include <cstring>
1075-
1076-struct View
1077-{
1078- static const char* vertex_shader();
1079- static const char* fragment_shader();
1080-
1081- static GLuint load_shader(GLenum shaderType, const char* pSource);
1082- static GLuint create_program(const char* pVertexSource, const char* pFragmentSource);
1083-
1084- static const GLfloat* triangle()
1085- {
1086- static const GLfloat result[] =
1087- {
1088- -0.125f, -0.125f, 0.0f, 0.5f,
1089- 0.0f, 0.125f, 0.0f, 0.5f,
1090- 0.125f, -0.125f, 0.0f, 0.5f
1091- };
1092-
1093- return result;
1094- }
1095-
1096- static const GLfloat* color_triangle()
1097- {
1098- static const GLfloat result[] =
1099- {
1100- 0.0f, 0.0f, 1.0f, 1.0f,
1101- 0.0f, 1.0f, 0.0f, 1.0f,
1102- 1.0f, 0.0f, 0.0f, 0.0f
1103- };
1104-
1105- return result;
1106- }
1107-
1108- View(UAUiWindow* surface);
1109-
1110- void render();
1111- void step();
1112-
1113- UAUiWindow* surface;
1114- EGLDisplay egl_display;
1115- EGLSurface egl_surface;
1116- EGLConfig egl_config;
1117- EGLContext egl_context;
1118-
1119- GLfloat rotation_angle;
1120-
1121- GLuint gProgram;
1122- GLuint gvPositionHandle, gvColorHandle;
1123- GLuint rotation_uniform;
1124- GLint num_vertex;
1125- const GLfloat * vertex_data;
1126- const GLfloat * color_data;
1127-};
1128-
1129-void on_new_event(void* ctx, const Event* ev)
1130-{
1131-}
1132-
1133-int main(int argc, char** argv)
1134-{
1135- UApplicationOptions* options = u_application_options_new_from_cmd_line(argc, argv);
1136-
1137- UApplicationDescription* desc = u_application_description_new();
1138- UApplicationId* id = u_application_id_new_from_stringn("UbuntuApplicationCAPI", 21);
1139- u_application_description_set_application_id(desc, id);
1140- UApplicationInstance* instance = u_application_instance_new_from_description_with_options(desc, options);
1141-
1142- UAUiSessionProperties* props = ua_ui_session_properties_new();
1143- ua_ui_session_properties_set_type(props, U_USER_SESSION);
1144-
1145- UAUiSession* ua_ui_session_new_with_properties(props);
1146-
1147- UAUiDisplay* display = ua_ui_display_new_with_index(0);
1148-
1149- printf("Display resolution: (x,y) = (%d,%d)\n",
1150- ua_ui_display_query_horizontal_res(display),
1151- ua_ui_display_query_vertical_res(display));
1152-
1153- UAUiWindowProperties* wprops = ua_ui_window_properties_new_for_normal_window();
1154- ua_ui_window_properties_set_titlen(wprops, "Window 1", 8);
1155- ua_ui_window_properties_set_role(wprops, U_MAIN_ROLE);
1156- ua_ui_window_properties_set_input_cb_and_ctx(wprops, on_new_event, NULL);
1157-
1158- UAUiWindow* surface = ua_ui_window_new_for_application_with_properties(instance, wprops);
1159-
1160- View view(surface);
1161- while(true)
1162- {
1163- view.render();
1164- view.step();
1165- }
1166-}
1167-
1168-const char* View::vertex_shader()
1169-{
1170- static const char shader[] =
1171- "attribute vec4 vPosition;\n"
1172- "attribute vec4 vColor;\n"
1173- "uniform float angle;\n"
1174- "varying vec4 colorinfo;\n"
1175- "void main() {\n"
1176- " mat3 rot_z = mat3( vec3( cos(angle), sin(angle), 0.0),\n"
1177- " vec3(-sin(angle), cos(angle), 0.0),\n"
1178- " vec3( 0.0, 0.0, 1.0));\n"
1179- " gl_Position = vec4(rot_z * vPosition.xyz, 1.0);\n"
1180- " colorinfo = vColor;\n"
1181- "}\n";
1182-
1183- return shader;
1184-}
1185-
1186-const char* View::fragment_shader()
1187-{
1188- static const char shader[] =
1189- "precision mediump float;\n"
1190- "varying vec4 colorinfo;\n"
1191- "void main() {\n"
1192- " gl_FragColor = colorinfo;\n"
1193- "}\n";
1194-
1195- return shader;
1196-}
1197-
1198-GLuint View::load_shader(GLenum shaderType, const char* pSource) {
1199- GLuint shader = glCreateShader(shaderType);
1200- if (shader) {
1201- glShaderSource(shader, 1, &pSource, NULL);
1202- glCompileShader(shader);
1203- GLint compiled = 0;
1204- glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
1205- if (!compiled) {
1206- GLint infoLen = 0;
1207- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
1208- if (infoLen) {
1209- char* buf = (char*) malloc(infoLen);
1210- if (buf) {
1211- glGetShaderInfoLog(shader, infoLen, NULL, buf);
1212- fprintf(stderr, "Could not compile shader %d:\n%s\n",
1213- shaderType, buf);
1214- free(buf);
1215- }
1216- glDeleteShader(shader);
1217- shader = 0;
1218- }
1219- }
1220- } else
1221- {
1222- printf("Error, during shader creation: %i\n", glGetError());
1223- }
1224- return shader;
1225-}
1226-
1227-GLuint View::create_program(const char* pVertexSource, const char* pFragmentSource) {
1228- GLuint vertexShader = load_shader(GL_VERTEX_SHADER, pVertexSource);
1229- if (!vertexShader) {
1230- printf("vertex shader not compiled\n");
1231- return 0;
1232- }
1233-
1234- GLuint pixelShader = load_shader(GL_FRAGMENT_SHADER, pFragmentSource);
1235- if (!pixelShader) {
1236- printf("frag shader not compiled\n");
1237- return 0;
1238- }
1239-
1240- GLuint program = glCreateProgram();
1241- if (program) {
1242- glAttachShader(program, vertexShader);
1243- glAttachShader(program, pixelShader);
1244- glLinkProgram(program);
1245- GLint linkStatus = GL_FALSE;
1246- glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
1247- if (linkStatus != GL_TRUE) {
1248- GLint bufLength = 0;
1249- glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
1250- if (bufLength) {
1251- char* buf = (char*) malloc(bufLength);
1252- if (buf) {
1253- glGetProgramInfoLog(program, bufLength, NULL, buf);
1254- fprintf(stderr, "Could not link program:\n%s\n", buf);
1255- free(buf);
1256- }
1257- }
1258- glDeleteProgram(program);
1259- program = 0;
1260- }
1261- }
1262- return program;
1263-}
1264-
1265-View::View(UAUiWindow* surface)
1266- : surface(surface),
1267- rotation_angle(0.f),
1268- num_vertex(3)
1269-{
1270- // assert(eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE);
1271- egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
1272- assert(egl_display != EGL_NO_DISPLAY);
1273- EGLint major, minor;
1274- if (EGL_FALSE == eglInitialize(egl_display, &major, &minor))
1275- {
1276- printf("egl error: problem initializing.\n");
1277- exit(1);
1278- }
1279-
1280- EGLint attribs[] =
1281- {
1282- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
1283- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1284- EGL_NONE
1285- };
1286- EGLint n;
1287- if (EGL_FALSE == eglChooseConfig(
1288- egl_display,
1289- attribs,
1290- &egl_config,
1291- 1,
1292- &n))
1293- {
1294- printf("egl error: Cannot choose configuration.\n");
1295- }
1296-
1297- EGLint context_attribs[] =
1298- {
1299- EGL_CONTEXT_CLIENT_VERSION, 2,
1300- EGL_NONE
1301- };
1302-
1303- egl_context = eglCreateContext(
1304- egl_display,
1305- egl_config,
1306- EGL_NO_CONTEXT,
1307- context_attribs);
1308-
1309- assert(EGL_NO_CONTEXT != egl_context);
1310-
1311- EGLNativeWindowType nativeWindow = ua_ui_window_get_native_type(surface);
1312- egl_surface = eglCreateWindowSurface(egl_display, egl_config, nativeWindow, NULL);
1313-
1314- eglMakeCurrent(
1315- egl_display,
1316- egl_surface,
1317- egl_surface,
1318- egl_context);
1319-
1320- vertex_data = triangle();
1321- color_data = color_triangle();
1322-
1323- gProgram = create_program(vertex_shader(), fragment_shader());
1324- if (!gProgram)
1325- {
1326- printf("error making program\n");
1327- return;
1328- }
1329-
1330- gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
1331- gvColorHandle = glGetAttribLocation(gProgram, "vColor");
1332-
1333- rotation_uniform = glGetUniformLocation(gProgram, "angle");
1334-
1335- return;
1336-}
1337-
1338-void View::render()
1339-{
1340- glUseProgram(gProgram);
1341-
1342- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
1343-
1344- glUniform1fv(rotation_uniform, 1, &rotation_angle);
1345-
1346- glVertexAttribPointer(
1347- gvColorHandle,
1348- num_vertex,
1349- GL_FLOAT,
1350- GL_FALSE,
1351- sizeof(GLfloat)*4, color_data);
1352- glVertexAttribPointer(
1353- gvPositionHandle,
1354- num_vertex,
1355- GL_FLOAT,
1356- GL_FALSE,
1357- 0,
1358- vertex_data);
1359- glEnableVertexAttribArray(gvPositionHandle);
1360- glEnableVertexAttribArray(gvColorHandle);
1361-
1362- glDrawArrays(GL_TRIANGLE_STRIP, 0, num_vertex);
1363- glDisableVertexAttribArray(gvPositionHandle);
1364- glDisableVertexAttribArray(gvColorHandle);
1365-
1366- eglSwapBuffers(egl_display, egl_surface);
1367-}
1368-
1369-void View::step()
1370-{
1371- rotation_angle += 0.01;
1372-}
1373
1374=== removed file 'src/hybris/tests/test_gps_api.cpp'
1375--- src/hybris/tests/test_gps_api.cpp 2013-06-13 08:07:21 +0000
1376+++ src/hybris/tests/test_gps_api.cpp 1970-01-01 00:00:00 +0000
1377@@ -1,252 +0,0 @@
1378-/*
1379- * Copyright © 2013 Canonical Ltd.
1380- *
1381- * This program is free software: you can redistribute it and/or modify
1382- * it under the terms of the GNU General Public License version 3 as
1383- * published by the Free Software Foundation.
1384- *
1385- * This program is distributed in the hope that it will be useful,
1386- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1387- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1388- * GNU General Public License for more details.
1389- *
1390- * You should have received a copy of the GNU General Public License
1391- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1392- *
1393- * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
1394- */
1395-#include <ubuntu/hardware/gps.h>
1396-
1397-#include <ctime>
1398-#include <signal.h>
1399-#include <stdio.h>
1400-#include <string.h>
1401-#include <unistd.h>
1402-
1403-namespace ubuntu
1404-{
1405-class GPSTest
1406-{
1407- public:
1408- GPSTest();
1409- ~GPSTest();
1410- bool init_and_start();
1411- bool stop();
1412- void inject_time();
1413-
1414- UHardwareGps u_hardware_gps;
1415-};
1416-
1417-void gps_location_cb(UHardwareGpsLocation* location, void* context)
1418-{
1419- printf("gps_location_cb() called.\n");
1420-}
1421-
1422-void gps_status_cb(uint16_t status, void* context)
1423-{
1424- switch(status)
1425- {
1426- case U_HARDWARE_GPS_STATUS_NONE:
1427- printf("status: None\n");
1428- break;
1429- case U_HARDWARE_GPS_STATUS_SESSION_BEGIN:
1430- printf("status: Session Begin\n");
1431- break;
1432- case U_HARDWARE_GPS_STATUS_SESSION_END:
1433- printf("status: Session End\n");
1434- break;
1435- case U_HARDWARE_GPS_STATUS_ENGINE_ON:
1436- printf("status: Engine On\n");
1437- break;
1438- case U_HARDWARE_GPS_STATUS_ENGINE_OFF:
1439- printf("status: Engine Off\n");
1440- default:
1441- break;
1442- };
1443-}
1444-
1445-void gps_sb_status_cb(UHardwareGpsSvStatus* sv_info, void* context)
1446-{
1447- printf("gps_sb_status_cb() called, listing %d space vehicles\n", sv_info->num_svs);
1448-}
1449-
1450-void gps_nmea_cb(int64_t timestamp, const char* nmea, int length, void* context)
1451-{
1452- char str[length+1];
1453- memcpy(str, nmea, length);
1454- str[length] = 0;
1455- printf("gps_nmea_cb() - %s\n", str);
1456-}
1457-
1458-void gps_set_cabapilities_cb(uint32_t capabilities, void* context)
1459-{
1460- printf("gps_set_cabapilities_cb() -");
1461-
1462- if (capabilities & U_HARDWARE_GPS_CAPABILITY_SCHEDULING)
1463- printf(" scheduling");
1464- if (capabilities & U_HARDWARE_GPS_CAPABILITY_MSB)
1465- printf(" MSB");
1466- if (capabilities & U_HARDWARE_GPS_CAPABILITY_MSA)
1467- printf(" MSA");
1468- if (capabilities & U_HARDWARE_GPS_CAPABILITY_SINGLE_SHOT)
1469- printf(" 'single shot'");
1470- if (capabilities & U_HARDWARE_GPS_CAPABILITY_ON_DEMAND_TIME)
1471- printf(" 'on demand time'");
1472-
1473- printf("\n");
1474-}
1475-
1476-void gps_request_utc_time_cb(void* context)
1477-{
1478- printf("gps_request_utc_time_cb() called.\n");
1479- ((GPSTest*)context)->inject_time();
1480-}
1481-
1482-void gps_xtra_download_request_cb(void* context)
1483-{
1484- printf("gps_xtra_download_request_cb() called.\n");
1485-}
1486-
1487-void agps_status_cb(UHardwareGpsAGpsStatus* status, void* context)
1488-{
1489- printf("agps status -");
1490-
1491- if (status->type == U_HARDWARE_GPS_AGPS_TYPE_SUPL)
1492- printf(" SUPL");
1493- else
1494- printf(" C2K");
1495-
1496- switch (status->status)
1497- {
1498- case U_HARDWARE_GPS_REQUEST_AGPS_DATA_CONN:
1499- printf(", request AGPS data connection");
1500- break;
1501- case U_HARDWARE_GPS_RELEASE_AGPS_DATA_CONN:
1502- printf(", release AGPS data connection");
1503- break;
1504- case U_HARDWARE_GPS_AGPS_DATA_CONNECTED:
1505- printf(", request AGPS data connected");
1506- break;
1507- case U_HARDWARE_GPS_AGPS_DATA_CONN_DONE:
1508- printf(", AGPS data connection done");
1509- break;
1510- default:
1511- case U_HARDWARE_GPS_AGPS_DATA_CONN_FAILED:
1512- printf(", AGPS data connection failed");
1513- break;
1514- }
1515-
1516- printf(" ipaddr=%u\n", status->ipaddr);
1517-}
1518-
1519-void gps_notify_cb(UHardwareGpsNiNotification *notification, void* context)
1520-{
1521- printf("gps_notify_cb() called.\n");
1522-}
1523-
1524-void agps_ril_request_set_id_cb(uint32_t flags, void* context)
1525-{
1526- printf("agps_ril_request_set_id_cb() called.\n");
1527-}
1528-
1529-void agps_ril_request_refloc_cb(uint32_t flags, void* context)
1530-{
1531- printf("agps_ril_request_refloc_cb() called.\n");
1532-}
1533-
1534-GPSTest::GPSTest()
1535- : u_hardware_gps(NULL)
1536-{
1537-}
1538-
1539-GPSTest::~GPSTest()
1540-{
1541- if (u_hardware_gps)
1542- u_hardware_gps_delete(u_hardware_gps);
1543-}
1544-
1545-void GPSTest::inject_time()
1546-{
1547- // A real implementation would inject time from some NTP server.
1548- time_t t = time(0);
1549- int64_t time_millis = (int64_t)t * (int64_t)1000;
1550- u_hardware_gps_inject_time(u_hardware_gps,
1551- time_millis /*NTP time would go here*/,
1552- time_millis /*internal time when that NTP time was taken*/,
1553- 10 /* possible deviation, in milliseconds*/);
1554-}
1555-
1556-bool GPSTest::init_and_start()
1557-{
1558- UHardwareGpsParams gps_params;
1559-
1560- gps_params.location_cb = gps_location_cb;
1561- gps_params.status_cb = gps_status_cb;
1562- gps_params.sv_status_cb = gps_sb_status_cb;
1563- gps_params.nmea_cb = gps_nmea_cb;
1564- gps_params.set_capabilities_cb = gps_set_cabapilities_cb;
1565- gps_params.request_utc_time_cb = gps_request_utc_time_cb;
1566- gps_params.xtra_download_request_cb = gps_xtra_download_request_cb;
1567- gps_params.agps_status_cb = agps_status_cb;
1568- gps_params.gps_ni_notify_cb = gps_notify_cb;
1569- gps_params.request_setid_cb = agps_ril_request_set_id_cb;
1570- gps_params.request_refloc_cb = agps_ril_request_refloc_cb;
1571- gps_params.context = this;
1572-
1573- UHardwareGps u_hardware_gps = u_hardware_gps_new(&gps_params);
1574- if (!u_hardware_gps)
1575- {
1576- printf("GPS creation failed!\n");
1577- return false;
1578- }
1579-
1580- bool ok = u_hardware_gps_start(u_hardware_gps);
1581- if (!ok)
1582- {
1583- printf("GPS start up failed!\n");
1584- return false;
1585- }
1586-
1587- return true;
1588-}
1589-
1590-bool GPSTest::stop()
1591-{
1592- bool ok = u_hardware_gps_stop(u_hardware_gps);
1593- if (!ok)
1594- printf("failed when stopping GPS!\n");
1595-
1596- return ok;
1597-}
1598-}
1599-
1600-void wait_for_sigint()
1601-{
1602- sigset_t signals;
1603- sigemptyset(&signals);
1604- sigaddset(&signals, SIGINT);
1605-
1606- int sig;
1607- int result = sigwait(&signals, &sig);
1608- if (result != 0)
1609- printf("sigwait failed!\n");
1610-}
1611-
1612-int main(int argc, char** argv)
1613-{
1614- int return_value = 0;
1615- ubuntu::GPSTest test;
1616-
1617- if (!test.init_and_start())
1618- return 1;
1619-
1620- printf("GPS initialized and started. Now waiting for callbacks or SIGINT (to quit).\n");
1621- wait_for_sigint();
1622- printf("Exiting...\n");
1623-
1624- if (!test.stop())
1625- return 1;
1626-
1627- printf("GPS stopped.\n");
1628- return 0;
1629-}
1630
1631=== removed file 'src/hybris/tests/test_multiple_surfaces_event_delivery.cpp'
1632--- src/hybris/tests/test_multiple_surfaces_event_delivery.cpp 2013-05-21 22:14:40 +0000
1633+++ src/hybris/tests/test_multiple_surfaces_event_delivery.cpp 1970-01-01 00:00:00 +0000
1634@@ -1,351 +0,0 @@
1635-/*
1636- * Copyright © 2012 Canonical Ltd.
1637- *
1638- * This program is free software: you can redistribute it and/or modify
1639- * it under the terms of the GNU General Public License version 3 as
1640- * published by the Free Software Foundation.
1641- *
1642- * This program is distributed in the hope that it will be useful,
1643- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1644- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1645- * GNU General Public License for more details.
1646- *
1647- * You should have received a copy of the GNU General Public License
1648- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1649- *
1650- * Authored by: Thomas Voß <thomas.voss@canonical.com>
1651- */
1652-
1653-#include <ubuntu/application/ui/window.h>
1654-#include <ubuntu/application/ui/options.h>
1655-#include <ubuntu/application/ui/display.h>
1656-#include <ubuntu/application/ui/session.h>
1657-
1658-#include <EGL/egl.h>
1659-#include <GLES2/gl2.h>
1660-#include <GLES2/gl2ext.h>
1661-
1662-#include <cassert>
1663-#include <cstdio>
1664-#include <cstdlib>
1665-#include <cstring>
1666-
1667-struct View
1668-{
1669- static const char* vertex_shader();
1670- static const char* fragment_shader();
1671-
1672- static GLuint load_shader(GLenum shaderType, const char* pSource);
1673- static GLuint create_program(const char* pVertexSource, const char* pFragmentSource);
1674-
1675- static const GLfloat* triangle()
1676- {
1677- static const GLfloat result[] =
1678- {
1679- -0.125f, -0.125f, 0.0f, 0.5f,
1680- 0.0f, 0.125f, 0.0f, 0.5f,
1681- 0.125f, -0.125f, 0.0f, 0.5f
1682- };
1683-
1684- return result;
1685- }
1686-
1687- static const GLfloat* color_triangle()
1688- {
1689- static const GLfloat result[] =
1690- {
1691- 0.0f, 0.0f, 1.0f, 1.0f,
1692- 0.0f, 1.0f, 0.0f, 1.0f,
1693- 1.0f, 0.0f, 0.0f, 0.0f
1694- };
1695-
1696- return result;
1697- }
1698-
1699- View(UAUiWindow* surface);
1700-
1701- void render();
1702- void step();
1703-
1704- UAUiWindow* surface;
1705- EGLDisplay egl_display;
1706- EGLSurface egl_surface;
1707- EGLConfig egl_config;
1708- EGLContext egl_context;
1709-
1710- GLfloat rotation_angle;
1711-
1712- GLuint gProgram;
1713- GLuint gvPositionHandle, gvColorHandle;
1714- GLuint rotation_uniform;
1715- GLint num_vertex;
1716- const GLfloat * vertex_data;
1717- const GLfloat * color_data;
1718-};
1719-
1720-void on_new_event(void* ctx, const Event* ev)
1721-{
1722- int* surface = (int*) ctx;
1723-
1724- printf("%s for surface: %d \n", __PRETTY_FUNCTION__, *surface);
1725-}
1726-
1727-int main(int argc, char** argv)
1728-{
1729- UApplicationOptions* options = u_application_options_new_from_cmd_line(argc, argv);
1730-
1731- UApplicationDescription* desc = u_application_description_new();
1732- UApplicationId* id = u_application_id_new_from_stringn("UbuntuApplicationCAPI", 21);
1733- u_application_description_set_application_id(desc, id);
1734- UApplicationInstance* instance = u_application_instance_new_from_description_with_options(desc, options);
1735-
1736- UAUiSessionProperties* props = ua_ui_session_properties_new();
1737- ua_ui_session_properties_set_type(props, U_USER_SESSION);
1738-
1739- UAUiSession* ua_ui_session_new_with_properties(props);
1740-
1741- UAUiDisplay* display = ua_ui_display_new_with_index(0);
1742-
1743- printf("Display resolution: (x,y) = (%d,%d)\n",
1744- ua_ui_display_query_horizontal_res(display),
1745- ua_ui_display_query_vertical_res(display));
1746-
1747- int i = 1, j = 2;
1748-
1749- UAUiWindowProperties* wprops1 = ua_ui_window_properties_new_for_normal_window();
1750- ua_ui_window_properties_set_titlen(wprops1, "Window 1", 8);
1751- ua_ui_window_properties_set_role(wprops1, U_MAIN_ROLE);
1752- ua_ui_window_properties_set_input_cb_and_ctx(wprops1, on_new_event, &i);
1753-
1754- UAUiWindow* surface1 = ua_ui_window_new_for_application_with_properties(instance, wprops1);
1755-
1756- UAUiWindowProperties* wprops2 = ua_ui_window_properties_new_for_normal_window();
1757- ua_ui_window_properties_set_titlen(wprops2, "Window 2", 8);
1758- ua_ui_window_properties_set_role(wprops2, U_MAIN_ROLE);
1759- ua_ui_window_properties_set_input_cb_and_ctx(wprops2, on_new_event, &j);
1760-
1761- UAUiWindow* surface2 = ua_ui_window_new_for_application_with_properties(instance, wprops2);
1762-
1763- View view1(surface1);
1764- View view2(surface2);
1765- while(true)
1766- {
1767- view1.render();
1768- view2.render();
1769-
1770- view1.step();
1771- view2.step();
1772- }
1773-}
1774-
1775-const char* View::vertex_shader()
1776-{
1777- static const char shader[] =
1778- "attribute vec4 vPosition;\n"
1779- "attribute vec4 vColor;\n"
1780- "uniform float angle;\n"
1781- "varying vec4 colorinfo;\n"
1782- "void main() {\n"
1783- " mat3 rot_z = mat3( vec3( cos(angle), sin(angle), 0.0),\n"
1784- " vec3(-sin(angle), cos(angle), 0.0),\n"
1785- " vec3( 0.0, 0.0, 1.0));\n"
1786- " gl_Position = vec4(rot_z * vPosition.xyz, 1.0);\n"
1787- " colorinfo = vColor;\n"
1788- "}\n";
1789-
1790- return shader;
1791-}
1792-
1793-const char* View::fragment_shader()
1794-{
1795- static const char shader[] =
1796- "precision mediump float;\n"
1797- "varying vec4 colorinfo;\n"
1798- "void main() {\n"
1799- " gl_FragColor = colorinfo;\n"
1800- "}\n";
1801-
1802- return shader;
1803-}
1804-
1805-GLuint View::load_shader(GLenum shaderType, const char* pSource) {
1806- GLuint shader = glCreateShader(shaderType);
1807- if (shader) {
1808- glShaderSource(shader, 1, &pSource, NULL);
1809- glCompileShader(shader);
1810- GLint compiled = 0;
1811- glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
1812- if (!compiled) {
1813- GLint infoLen = 0;
1814- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
1815- if (infoLen) {
1816- char* buf = (char*) malloc(infoLen);
1817- if (buf) {
1818- glGetShaderInfoLog(shader, infoLen, NULL, buf);
1819- fprintf(stderr, "Could not compile shader %d:\n%s\n",
1820- shaderType, buf);
1821- free(buf);
1822- }
1823- glDeleteShader(shader);
1824- shader = 0;
1825- }
1826- }
1827- } else
1828- {
1829- printf("Error, during shader creation: %i\n", glGetError());
1830- }
1831- return shader;
1832-}
1833-
1834-GLuint View::create_program(const char* pVertexSource, const char* pFragmentSource) {
1835- GLuint vertexShader = load_shader(GL_VERTEX_SHADER, pVertexSource);
1836- if (!vertexShader) {
1837- printf("vertex shader not compiled\n");
1838- return 0;
1839- }
1840-
1841- GLuint pixelShader = load_shader(GL_FRAGMENT_SHADER, pFragmentSource);
1842- if (!pixelShader) {
1843- printf("frag shader not compiled\n");
1844- return 0;
1845- }
1846-
1847- GLuint program = glCreateProgram();
1848- if (program) {
1849- glAttachShader(program, vertexShader);
1850- glAttachShader(program, pixelShader);
1851- glLinkProgram(program);
1852- GLint linkStatus = GL_FALSE;
1853- glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
1854- if (linkStatus != GL_TRUE) {
1855- GLint bufLength = 0;
1856- glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
1857- if (bufLength) {
1858- char* buf = (char*) malloc(bufLength);
1859- if (buf) {
1860- glGetProgramInfoLog(program, bufLength, NULL, buf);
1861- fprintf(stderr, "Could not link program:\n%s\n", buf);
1862- free(buf);
1863- }
1864- }
1865- glDeleteProgram(program);
1866- program = 0;
1867- }
1868- }
1869- return program;
1870-}
1871-
1872-View::View(UAUiWindow* surface)
1873- : surface(surface),
1874- rotation_angle(0.f),
1875- num_vertex(3)
1876-{
1877- // assert(eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE);
1878- egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
1879- assert(egl_display != EGL_NO_DISPLAY);
1880- EGLint major, minor;
1881- if (EGL_FALSE == eglInitialize(egl_display, &major, &minor))
1882- {
1883- printf("egl error: problem initializing.\n");
1884- exit(1);
1885- }
1886-
1887- EGLint attribs[] =
1888- {
1889- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
1890- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1891- EGL_NONE
1892- };
1893- EGLint n;
1894- if (EGL_FALSE == eglChooseConfig(
1895- egl_display,
1896- attribs,
1897- &egl_config,
1898- 1,
1899- &n))
1900- {
1901- printf("egl error: Cannot choose configuration.\n");
1902- }
1903-
1904- EGLint context_attribs[] =
1905- {
1906- EGL_CONTEXT_CLIENT_VERSION, 2,
1907- EGL_NONE
1908- };
1909-
1910- egl_context = eglCreateContext(
1911- egl_display,
1912- egl_config,
1913- EGL_NO_CONTEXT,
1914- context_attribs);
1915-
1916- assert(EGL_NO_CONTEXT != egl_context);
1917-
1918- EGLNativeWindowType nativeWindow = ua_ui_window_get_native_type(surface);
1919- egl_surface = eglCreateWindowSurface(egl_display, egl_config, nativeWindow, NULL);
1920-
1921- eglMakeCurrent(
1922- egl_display,
1923- egl_surface,
1924- egl_surface,
1925- egl_context);
1926-
1927- vertex_data = triangle();
1928- color_data = color_triangle();
1929-
1930- gProgram = create_program(vertex_shader(), fragment_shader());
1931- if (!gProgram)
1932- {
1933- printf("error making program\n");
1934- return;
1935- }
1936-
1937- gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
1938- gvColorHandle = glGetAttribLocation(gProgram, "vColor");
1939-
1940- rotation_uniform = glGetUniformLocation(gProgram, "angle");
1941-
1942- return;
1943-}
1944-
1945-void View::render()
1946-{
1947- eglMakeCurrent(
1948- egl_display,
1949- egl_surface,
1950- egl_surface,
1951- egl_context);
1952-
1953- glUseProgram(gProgram);
1954-
1955- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
1956-
1957- glUniform1fv(rotation_uniform, 1, &rotation_angle);
1958-
1959- glVertexAttribPointer(
1960- gvColorHandle,
1961- num_vertex,
1962- GL_FLOAT,
1963- GL_FALSE,
1964- sizeof(GLfloat)*4, color_data);
1965- glVertexAttribPointer(
1966- gvPositionHandle,
1967- num_vertex,
1968- GL_FLOAT,
1969- GL_FALSE,
1970- 0,
1971- vertex_data);
1972- glEnableVertexAttribArray(gvPositionHandle);
1973- glEnableVertexAttribArray(gvColorHandle);
1974-
1975- glDrawArrays(GL_TRIANGLE_STRIP, 0, num_vertex);
1976- glDisableVertexAttribArray(gvPositionHandle);
1977- glDisableVertexAttribArray(gvColorHandle);
1978-
1979- eglSwapBuffers(egl_display, egl_surface);
1980-}
1981-
1982-void View::step()
1983-{
1984- rotation_angle += 0.01;
1985-}
1986
1987=== removed file 'src/hybris/tests/test_sensors_api.cpp'
1988--- src/hybris/tests/test_sensors_api.cpp 2013-05-30 02:03:42 +0000
1989+++ src/hybris/tests/test_sensors_api.cpp 1970-01-01 00:00:00 +0000
1990@@ -1,88 +0,0 @@
1991-/*
1992- * Copyright © 2012 Canonical Ltd.
1993- *
1994- * This program is free software: you can redistribute it and/or modify
1995- * it under the terms of the GNU General Public License version 3 as
1996- * published by the Free Software Foundation.
1997- *
1998- * This program is distributed in the hope that it will be useful,
1999- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2000- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2001- * GNU General Public License for more details.
2002- *
2003- * You should have received a copy of the GNU General Public License
2004- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2005- *
2006- * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com>
2007- */
2008-
2009-#include <stdint.h>
2010-#include <stdio.h>
2011-#include <string.h>
2012-
2013-#include <ubuntu/application/sensors/accelerometer.h>
2014-#include <ubuntu/application/sensors/proximity.h>
2015-#include <ubuntu/application/sensors/light.h>
2016-
2017-void on_new_accelerometer_event(UASAccelerometerEvent* event, void* context)
2018-{
2019- printf("%s \n", __PRETTY_FUNCTION__);
2020- printf("\ttime: %llu\n", uas_accelerometer_event_get_timestamp(event));
2021- printf("\tx: %f\n", uas_accelerometer_event_get_acceleration_x(event));
2022- printf("\ty: %f\n", uas_accelerometer_event_get_acceleration_y(event));
2023- printf("\tz: %f\n", uas_accelerometer_event_get_acceleration_z(event));
2024-}
2025-
2026-void on_new_proximity_event(UASProximityEvent* event, void* context)
2027-{
2028- printf("%s \n", __PRETTY_FUNCTION__);
2029- printf("\ttime: %llu\n", uas_proximity_event_get_timestamp(event));
2030-
2031- switch (uas_proximity_event_get_distance(event))
2032- {
2033- case U_PROXIMITY_NEAR:
2034- {
2035- printf("\tdistance: NEAR\n");
2036- break;
2037- }
2038- case U_PROXIMITY_FAR:
2039- {
2040- printf("\tdistance: FAR\n");
2041- break;
2042- }
2043- }
2044-}
2045-
2046-void on_new_light_event(UASLightEvent* event, void* context)
2047-{
2048- printf("%s \n", __PRETTY_FUNCTION__);
2049- printf("\ttime: %llu\n", uas_light_event_get_timestamp(event));
2050- printf("\tlight: %f\n", uas_light_event_get_light(event));
2051-}
2052-
2053-int main(int argc, char** argv)
2054-{
2055- UASensorsAccelerometer* accelerometer = ua_sensors_accelerometer_new();
2056- UASensorsProximity* proximity = ua_sensors_proximity_new();
2057- UASensorsLight* ambientlight = ua_sensors_light_new();
2058-
2059- ua_sensors_accelerometer_set_reading_cb(accelerometer,
2060- on_new_accelerometer_event,
2061- NULL);
2062-
2063- ua_sensors_proximity_set_reading_cb(proximity,
2064- on_new_proximity_event,
2065- NULL);
2066-
2067- ua_sensors_light_set_reading_cb(ambientlight,
2068- on_new_light_event,
2069- NULL);
2070-
2071- ua_sensors_accelerometer_enable(accelerometer);
2072- ua_sensors_proximity_enable(proximity);
2073- ua_sensors_light_enable(ambientlight);
2074-
2075- while(true)
2076- {
2077- }
2078-}
2079
2080=== removed file 'src/hybris/tests/test_session_c_api.cpp'
2081--- src/hybris/tests/test_session_c_api.cpp 2013-02-13 23:09:01 +0000
2082+++ src/hybris/tests/test_session_c_api.cpp 1970-01-01 00:00:00 +0000
2083@@ -1,229 +0,0 @@
2084-/*
2085- * Copyright © 2012 Canonical Ltd.
2086- *
2087- * This program is free software: you can redistribute it and/or modify
2088- * it under the terms of the GNU General Public License version 3 as
2089- * published by the Free Software Foundation.
2090- *
2091- * This program is distributed in the hope that it will be useful,
2092- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2093- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2094- * GNU General Public License for more details.
2095- *
2096- * You should have received a copy of the GNU General Public License
2097- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2098- *
2099- * Authored by: Thomas Voß <thomas.voss@canonical.com>
2100- */
2101-
2102-#include <ubuntu/ui/ubuntu_ui_session_service.h>
2103-
2104-#include <getopt.h>
2105-
2106-#include <stdio.h>
2107-#include <stdint.h>
2108-#include <string.h>
2109-#include <time.h>
2110-
2111-typedef union
2112-{
2113- struct Components
2114- {
2115- uint8_t r;
2116- uint8_t g;
2117- uint8_t b;
2118- uint8_t a;
2119- } components;
2120- uint32_t value;
2121-} Pixel;
2122-
2123-struct Config
2124-{
2125- Config() : take_screencast_flag(0),
2126- take_screenshot_flag(0)
2127- {
2128- }
2129-
2130- int take_screencast_flag;
2131- int take_screenshot_flag;
2132-};
2133-
2134-void on_snapshot_completed(const void* pixel_data, unsigned int width, unsigned int height, unsigned int x, unsigned int y, unsigned int source_width, unsigned int source_height, unsigned int stride, void* context)
2135-{
2136- static unsigned int counter = 0;
2137-
2138- printf("%s: (%p, %d, %d, %d) \n",
2139- __PRETTY_FUNCTION__,
2140- pixel_data,
2141- width,
2142- height,
2143- stride);
2144-
2145- static const char snapshot_pattern[] = "./snapshot_%I_%M_%S.ppm";
2146- static const char frame_pattern[] = "./frame_%I_%M_%S.raw";
2147-
2148- char fn[256];
2149-
2150- int take_screenshot = 1;
2151- int take_screencast = 0;
2152-
2153- if (context != NULL)
2154- {
2155- Config* config = (Config*) context;
2156-
2157- take_screenshot = config->take_screenshot_flag;
2158- take_screencast = config->take_screencast_flag;
2159- }
2160-
2161- time_t curtime;
2162- struct tm *loctime;
2163-
2164- curtime = time (NULL);
2165- loctime = localtime (&curtime);
2166-
2167- static const char screenshot_file_mode[] = "w+";
2168- static const char screencast_file_mode[] = "wb+";
2169-
2170- FILE* f = NULL;
2171- if (take_screenshot)
2172- {
2173- strftime(fn, 256, snapshot_pattern, loctime);
2174- f = fopen(fn, screenshot_file_mode);
2175- } else if (take_screencast)
2176- {
2177- strftime(fn, 256, frame_pattern, loctime);
2178- f = fopen(fn, screencast_file_mode);
2179- }
2180-
2181- if (!f)
2182- {
2183- printf("Problem opening file: %s \n", fn);
2184- return;
2185- }
2186-
2187- if (take_screenshot)
2188- {
2189- const unsigned int* p = static_cast<const unsigned int*>(pixel_data);
2190-
2191- fprintf(f, "P3\n%d %d\n%d\n\n", width, height, 255);
2192- for(unsigned int i = 0; i < height; i++)
2193- {
2194- for(unsigned int j = 0; j < width; j++)
2195- {
2196- Pixel pixel; pixel.value = *p; ++p;
2197- fprintf(
2198- f, "%d %d %d\t",
2199- pixel.components.r,
2200- pixel.components.g,
2201- pixel.components.b);
2202- }
2203- }
2204- }
2205- else if (take_screencast)
2206- {
2207- fwrite(pixel_data, sizeof(unsigned int), width*height, f);
2208- ubuntu_ui_session_snapshot_running_session_with_id(
2209- -1,
2210- on_snapshot_completed,
2211- context);
2212- }
2213-}
2214-
2215-void on_session_born(ubuntu_ui_session_properties props, void*)
2216-{
2217- printf("%s:\n\t Id: %d \n\t Desktop file hint: %s \n",
2218- __PRETTY_FUNCTION__,
2219- ubuntu_ui_session_properties_get_application_instance_id(props),
2220- ubuntu_ui_session_properties_get_desktop_file_hint(props));
2221-
2222- ubuntu_ui_session_snapshot_running_session_with_id(
2223- ubuntu_ui_session_properties_get_application_instance_id(props),
2224- on_snapshot_completed,
2225- NULL);
2226-}
2227-
2228-void on_session_focused(ubuntu_ui_session_properties props, void*)
2229-{
2230- printf("%s:\n\t Id: %d \n\t Desktop file hint: %s \n",
2231- __PRETTY_FUNCTION__,
2232- ubuntu_ui_session_properties_get_application_instance_id(props),
2233- ubuntu_ui_session_properties_get_desktop_file_hint(props));
2234-}
2235-
2236-void on_session_died(ubuntu_ui_session_properties props, void*)
2237-{
2238- printf("%s:\n\t Id: %d \n\t Desktop file hint: %s \n",
2239- __PRETTY_FUNCTION__,
2240- ubuntu_ui_session_properties_get_application_instance_id(props),
2241- ubuntu_ui_session_properties_get_desktop_file_hint(props));
2242-}
2243-
2244-
2245-
2246-Config parse_cmd_line(int argc, char** argv)
2247-{
2248- Config config;
2249- static struct option long_options[] = {
2250- {"take-screencast", no_argument, &config.take_screencast_flag, 1},
2251- {"take-screenshot", no_argument, &config.take_screenshot_flag, 1}
2252- };
2253-
2254- while (true)
2255- {
2256- int option_index = 0;
2257-
2258- int c = getopt_long(
2259- argc,
2260- argv,
2261- "",
2262- long_options,
2263- &option_index);
2264-
2265- if (c == -1)
2266- break;
2267-
2268- switch (c)
2269- {
2270- case 0:
2271- // No need to do anything here: Flag is set automatically.
2272- break;
2273- default:
2274- break;
2275- }
2276- }
2277-
2278- return config;
2279-}
2280-
2281-int main(int argc, char** argv)
2282-{
2283- static const int complete_session_id = -1;
2284-
2285- Config config = parse_cmd_line(argc, argv);
2286-
2287- if (config.take_screenshot_flag || config.take_screencast_flag)
2288- {
2289- ubuntu_ui_session_snapshot_running_session_with_id(
2290- complete_session_id,
2291- on_snapshot_completed,
2292- &config);
2293-
2294- return 0;
2295- }
2296-
2297- ubuntu_ui_session_lifecycle_observer observer;
2298-
2299- memset(&observer, 0, sizeof(observer));
2300- observer.on_session_born = on_session_born;
2301- observer.on_session_focused = on_session_focused;
2302- observer.on_session_died = on_session_died;
2303-
2304- ubuntu_ui_session_install_session_lifecycle_observer(&observer);
2305-
2306- while(true)
2307- {
2308- }
2309-
2310- return 0;
2311-}
2312-
2313
2314=== removed file 'src/hybris/ubuntu_application_api_hybris.cpp'
2315--- src/hybris/ubuntu_application_api_hybris.cpp 2013-06-20 12:37:44 +0000
2316+++ src/hybris/ubuntu_application_api_hybris.cpp 1970-01-01 00:00:00 +0000
2317@@ -1,130 +0,0 @@
2318-/*
2319- * Copyright (C) 2012 Canonical Ltd
2320- *
2321- * This program is free software: you can redistribute it and/or modify
2322- * it under the terms of the GNU Lesser General Public License version 3 as
2323- * published by the Free Software Foundation.
2324- *
2325- * This program is distributed in the hope that it will be useful,
2326- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2327- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2328- * GNU Lesser General Public License for more details.
2329- *
2330- * You should have received a copy of the GNU Lesser General Public License
2331- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2332- *
2333- * Authored by: Thomas Voss <thomas.voss@canonical.com>
2334- * Ricardo Mendoza <ricardo.mendoza@canonical.com>
2335- */
2336-
2337-#include <private/application/ui/ubuntu_application_ui.h>
2338-
2339-#include <ubuntu/ui/ubuntu_ui_session_service.h>
2340-
2341-// C APIs
2342-#include <ubuntu/application/lifecycle_delegate.h>
2343-#include <ubuntu/application/ui/window.h>
2344-#include <ubuntu/application/ui/options.h>
2345-#include <ubuntu/application/ui/session.h>
2346-#include <ubuntu/application/ui/clipboard.h>
2347-#include <ubuntu/application/ui/display.h>
2348-
2349-#include "bridge.h"
2350-
2351-#ifdef __cplusplus
2352-extern "C" {
2353-#endif
2354-
2355-// Session helpers
2356-IMPLEMENT_FUNCTION0(UAUiSessionProperties*, ua_ui_session_properties_new);
2357-IMPLEMENT_VOID_FUNCTION2(ua_ui_session_properties_set_type, UAUiSessionProperties*, UAUiSessionType);
2358-IMPLEMENT_VOID_FUNCTION2(ua_ui_session_properties_set_remote_pid, UAUiSessionProperties*, uint32_t);
2359-IMPLEMENT_FUNCTION1(UAUiSession*, ua_ui_session_new_with_properties, UAUiSessionProperties*);
2360-
2361-// Lifecycle helpers
2362-IMPLEMENT_FUNCTION0(UApplicationLifecycleDelegate*, u_application_lifecycle_delegate_new);
2363-IMPLEMENT_VOID_FUNCTION2(u_application_lifecycle_delegate_set_context, UApplicationLifecycleDelegate*, void*);
2364-IMPLEMENT_VOID_FUNCTION1(u_application_lifecycle_delegate_ref, UApplicationLifecycleDelegate*);
2365-IMPLEMENT_VOID_FUNCTION1(u_application_lifecycle_delegate_unref, UApplicationLifecycleDelegate*);
2366-IMPLEMENT_VOID_FUNCTION2(u_application_lifecycle_delegate_set_application_resumed_cb, UApplicationLifecycleDelegate*, u_on_application_resumed);
2367-IMPLEMENT_VOID_FUNCTION2(u_application_lifecycle_delegate_set_application_about_to_stop_cb, UApplicationLifecycleDelegate*, u_on_application_about_to_stop);
2368-
2369-// Application Helpers
2370-
2371-// UApplicationId
2372-IMPLEMENT_FUNCTION2(UApplicationId*, u_application_id_new_from_stringn, const char*, size_t);
2373-IMPLEMENT_VOID_FUNCTION1(u_application_id_destroy, UApplicationId*);
2374-IMPLEMENT_FUNCTION2(int, u_application_id_compare, UApplicationId*, UApplicationId*);
2375-
2376-// UApplicationDescription
2377-IMPLEMENT_FUNCTION0(UApplicationDescription*, u_application_description_new);
2378-IMPLEMENT_VOID_FUNCTION1(u_application_description_destroy, UApplicationDescription*);
2379-IMPLEMENT_VOID_FUNCTION2(u_application_description_set_application_id, UApplicationDescription*, UApplicationId*);
2380-IMPLEMENT_VOID_FUNCTION2(u_application_description_set_application_lifecycle_delegate, UApplicationDescription*, UApplicationLifecycleDelegate*);
2381-
2382-// UApplicationOptions
2383-IMPLEMENT_FUNCTION2(UApplicationOptions*, u_application_options_new_from_cmd_line, int, char**);
2384-IMPLEMENT_VOID_FUNCTION1(u_application_options_destroy, UApplicationOptions*);
2385-IMPLEMENT_FUNCTION1(UAUiFormFactor, u_application_options_get_form_factor, UApplicationOptions*);
2386-IMPLEMENT_FUNCTION1(UAUiStage, u_application_options_get_stage, UApplicationOptions*);
2387-
2388-// UApplicationInstance
2389-IMPLEMENT_FUNCTION2(UApplicationInstance*, u_application_instance_new_from_description_with_options, UApplicationDescription*, UApplicationOptions*);
2390-
2391-// Application Ui Helpers
2392-
2393-// Clipboard
2394-IMPLEMENT_VOID_FUNCTION2(ua_ui_set_clipboard_content, void*, size_t);
2395-IMPLEMENT_VOID_FUNCTION2(ua_ui_get_clipboard_content, void**, size_t*);
2396-
2397-// UAUiDisplay
2398-IMPLEMENT_FUNCTION1(UAUiDisplay*, ua_ui_display_new_with_index, size_t);
2399-IMPLEMENT_VOID_FUNCTION1(ua_ui_display_destroy, UAUiDisplay*);
2400-IMPLEMENT_FUNCTION1(uint32_t, ua_ui_display_query_horizontal_res, UAUiDisplay*);
2401-IMPLEMENT_FUNCTION1(uint32_t, ua_ui_display_query_vertical_res, UAUiDisplay*);
2402-IMPLEMENT_FUNCTION1(EGLNativeDisplayType, ua_ui_display_get_native_type, UAUiDisplay*);
2403-
2404-
2405-// UAUiWindowProperties
2406-IMPLEMENT_FUNCTION0(UAUiWindowProperties*, ua_ui_window_properties_new_for_normal_window);
2407-IMPLEMENT_VOID_FUNCTION1(ua_ui_window_properties_destroy, UAUiWindowProperties*);
2408-IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_titlen, UAUiWindowProperties*, const char*, size_t);
2409-IMPLEMENT_FUNCTION1(const char*, ua_ui_window_properties_get_title, UAUiWindowProperties*);
2410-IMPLEMENT_VOID_FUNCTION2(ua_ui_window_properties_set_role, UAUiWindowProperties*, UAUiWindowRole);
2411-IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_input_cb_and_ctx, UAUiWindowProperties*, UAUiWindowInputEventCb, void*);
2412-
2413-// UAUiWindow
2414-IMPLEMENT_FUNCTION2(UAUiWindow*, ua_ui_window_new_for_application_with_properties, UApplicationInstance*, UAUiWindowProperties*);
2415-IMPLEMENT_VOID_FUNCTION1(ua_ui_window_destroy, UAUiWindow*);
2416-IMPLEMENT_FUNCTION3(UStatus, ua_ui_window_move, UAUiWindow*, uint32_t, uint32_t);
2417-IMPLEMENT_FUNCTION3(UStatus, ua_ui_window_resize, UAUiWindow*, uint32_t, uint32_t);
2418-IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_hide, UAUiWindow*);
2419-IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_show, UAUiWindow*);
2420-IMPLEMENT_VOID_FUNCTION1(ua_ui_window_request_fullscreen, UAUiWindow*);
2421-IMPLEMENT_FUNCTION1(EGLNativeWindowType, ua_ui_window_get_native_type, UAUiWindow*);
2422-
2423-/* -------------------------------------------------------------------------- *
2424- * * * * * * * * * * * * * * * Deprecated API * * * * * * * * * * * * * * * * *
2425- * -------------------------------------------------------------------------- *
2426- */
2427-
2428-// Session service
2429-IMPLEMENT_FUNCTION1(int, ubuntu_ui_session_properties_get_application_instance_id, ubuntu_ui_session_properties);
2430-IMPLEMENT_FUNCTION1(int, ubuntu_ui_session_properties_get_application_stage_hint, ubuntu_ui_session_properties);
2431-IMPLEMENT_FUNCTION1(const char*, ubuntu_ui_session_properties_get_desktop_file_hint, ubuntu_ui_session_properties);
2432-IMPLEMENT_VOID_FUNCTION1(ubuntu_ui_session_install_session_lifecycle_observer, ubuntu_ui_session_lifecycle_observer*);
2433-IMPLEMENT_VOID_FUNCTION0(ubuntu_ui_session_unfocus_running_sessions);
2434-IMPLEMENT_VOID_FUNCTION1(ubuntu_ui_session_focus_running_session_with_id, int);
2435-IMPLEMENT_VOID_FUNCTION3(ubuntu_ui_session_snapshot_running_session_with_id, int, ubuntu_ui_session_service_snapshot_cb, void*);
2436-IMPLEMENT_VOID_FUNCTION1(ubuntu_ui_session_trigger_switch_to_well_known_application, ubuntu_ui_well_known_application);
2437-IMPLEMENT_FUNCTION4(int32_t, ubuntu_ui_set_surface_trap, int, int, int, int);
2438-IMPLEMENT_VOID_FUNCTION1(ubuntu_ui_unset_surface_trap, int);
2439-IMPLEMENT_VOID_FUNCTION4(ubuntu_ui_report_osk_visible, int, int, int, int);
2440-IMPLEMENT_VOID_FUNCTION0(ubuntu_ui_report_osk_invisible);
2441-IMPLEMENT_VOID_FUNCTION0(ubuntu_ui_report_notification_visible);
2442-IMPLEMENT_VOID_FUNCTION0(ubuntu_ui_report_notification_invisible);
2443-IMPLEMENT_VOID_FUNCTION1(ubuntu_ui_install_task_controller, ubuntu_ui_task_controller*);
2444-
2445-#ifdef __cplusplus
2446-}
2447-#endif
2448
2449=== removed file 'src/hybris/ubuntu_application_sensors_hybris.cpp'
2450--- src/hybris/ubuntu_application_sensors_hybris.cpp 2013-06-20 12:37:44 +0000
2451+++ src/hybris/ubuntu_application_sensors_hybris.cpp 1970-01-01 00:00:00 +0000
2452@@ -1,70 +0,0 @@
2453-/*
2454- * Copyright (C) 2012 Canonical Ltd
2455- *
2456- * This program is free software: you can redistribute it and/or modify
2457- * it under the terms of the GNU Lesser General Public License version 3 as
2458- * published by the Free Software Foundation.
2459- *
2460- * This program is distributed in the hope that it will be useful,
2461- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2462- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2463- * GNU Lesser General Public License for more details.
2464- *
2465- * You should have received a copy of the GNU Lesser General Public License
2466- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2467- *
2468- * Authored by: Thomas Voss <thomas.voss@canonical.com>
2469- * Ricardo Mendoza <ricardo.mendoza@canonical.com>
2470- */
2471-
2472-#include <ubuntu/application/sensors/accelerometer.h>
2473-#include <ubuntu/application/sensors/proximity.h>
2474-#include <ubuntu/application/sensors/light.h>
2475-
2476-#include "bridge.h"
2477-
2478-// Ubuntu Application Sensors
2479-
2480-// Acceleration Sensor
2481-IMPLEMENT_FUNCTION0(UASensorsAccelerometer*, ua_sensors_accelerometer_new);
2482-IMPLEMENT_FUNCTION1(UStatus, ua_sensors_accelerometer_enable, UASensorsAccelerometer*);
2483-IMPLEMENT_FUNCTION1(UStatus, ua_sensors_accelerometer_disable, UASensorsAccelerometer*);
2484-IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_accelerometer_get_min_delay, UASensorsAccelerometer*);
2485-IMPLEMENT_SF_FUNCTION1(float, ua_sensors_accelerometer_get_min_value, UASensorsAccelerometer*);
2486-IMPLEMENT_SF_FUNCTION1(float, ua_sensors_accelerometer_get_max_value, UASensorsAccelerometer*);
2487-IMPLEMENT_SF_FUNCTION1(float, ua_sensors_accelerometer_get_resolution, UASensorsAccelerometer*);
2488-IMPLEMENT_VOID_FUNCTION3(ua_sensors_accelerometer_set_reading_cb, UASensorsAccelerometer*, on_accelerometer_event_cb, void*);
2489-
2490-// Acceleration Sensor Event
2491-IMPLEMENT_FUNCTION1(uint64_t, uas_accelerometer_event_get_timestamp, UASAccelerometerEvent*);
2492-IMPLEMENT_SF_FUNCTION1(float, uas_accelerometer_event_get_acceleration_x, UASAccelerometerEvent*);
2493-IMPLEMENT_SF_FUNCTION1(float, uas_accelerometer_event_get_acceleration_y, UASAccelerometerEvent*);
2494-IMPLEMENT_SF_FUNCTION1(float, uas_accelerometer_event_get_acceleration_z, UASAccelerometerEvent*);
2495-
2496-// Proximity Sensor
2497-IMPLEMENT_FUNCTION0(UASensorsProximity*, ua_sensors_proximity_new);
2498-IMPLEMENT_FUNCTION1(UStatus, ua_sensors_proximity_enable, UASensorsProximity*);
2499-IMPLEMENT_FUNCTION1(UStatus, ua_sensors_proximity_disable, UASensorsProximity*);
2500-IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_proximity_get_min_delay, UASensorsProximity*);
2501-IMPLEMENT_SF_FUNCTION1(float, ua_sensors_proximity_get_min_value, UASensorsProximity*);
2502-IMPLEMENT_SF_FUNCTION1(float, ua_sensors_proximity_get_max_value, UASensorsProximity*);
2503-IMPLEMENT_SF_FUNCTION1(float, ua_sensors_proximity_get_resolution, UASensorsProximity*);
2504-IMPLEMENT_VOID_FUNCTION3(ua_sensors_proximity_set_reading_cb, UASensorsProximity*, on_proximity_event_cb, void*);
2505-
2506-// Proximity Sensor Event
2507-IMPLEMENT_FUNCTION1(uint64_t, uas_proximity_event_get_timestamp, UASProximityEvent*);
2508-IMPLEMENT_FUNCTION1(UASProximityDistance, uas_proximity_event_get_distance, UASProximityEvent*);
2509-
2510-// Ambient Light Sensor
2511-IMPLEMENT_FUNCTION0(UASensorsLight*, ua_sensors_light_new);
2512-IMPLEMENT_FUNCTION1(UStatus, ua_sensors_light_enable, UASensorsLight*);
2513-IMPLEMENT_FUNCTION1(UStatus, ua_sensors_light_disable, UASensorsLight*);
2514-IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_light_get_min_delay, UASensorsLight*);
2515-IMPLEMENT_SF_FUNCTION1(float, ua_sensors_light_get_min_value, UASensorsLight*);
2516-IMPLEMENT_SF_FUNCTION1(float, ua_sensors_light_get_max_value, UASensorsLight*);
2517-IMPLEMENT_SF_FUNCTION1(float, ua_sensors_light_get_resolution, UASensorsLight*);
2518-IMPLEMENT_VOID_FUNCTION3(ua_sensors_light_set_reading_cb, UASensorsLight*, on_light_event_cb, void*);
2519-
2520-// Ambient Light Sensor Event
2521-IMPLEMENT_FUNCTION1(uint64_t, uas_light_event_get_timestamp, UASLightEvent*);
2522-IMPLEMENT_SF_FUNCTION1(float, uas_light_event_get_light, UASLightEvent*);
2523
2524=== removed file 'src/hybris/ubuntu_platform_hardware_api.cpp'
2525--- src/hybris/ubuntu_platform_hardware_api.cpp 2013-06-13 08:37:52 +0000
2526+++ src/hybris/ubuntu_platform_hardware_api.cpp 1970-01-01 00:00:00 +0000
2527@@ -1,78 +0,0 @@
2528-/*
2529- * Copyright (C) 2012 Canonical Ltd
2530- *
2531- * This program is free software: you can redistribute it and/or modify
2532- * it under the terms of the GNU Lesser General Public License version 3 as
2533- * published by the Free Software Foundation.
2534- *
2535- * This program is distributed in the hope that it will be useful,
2536- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2537- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2538- * GNU Lesser General Public License for more details.
2539- *
2540- * You should have received a copy of the GNU Lesser General Public License
2541- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2542- *
2543- * Authored by: Thomas Voss <thomas.voss@canonical.com>
2544- * Ricardo Mendoza <ricardo.mendoza@canonical.com>
2545- */
2546-
2547-// C APIs
2548-#include <ubuntu/hardware/gps.h>
2549-
2550-#include "bridge.h"
2551-
2552-// Hardware - GPS
2553-IMPLEMENT_FUNCTION1(
2554-UHardwareGps,
2555-u_hardware_gps_new,
2556-UHardwareGpsParams*);
2557-
2558-IMPLEMENT_VOID_FUNCTION1(
2559-u_hardware_gps_delete,
2560-UHardwareGps);
2561-
2562-IMPLEMENT_FUNCTION1(
2563-bool,
2564-u_hardware_gps_start,
2565-UHardwareGps);
2566-
2567-IMPLEMENT_FUNCTION1(
2568-bool,
2569-u_hardware_gps_stop,
2570-UHardwareGps);
2571-
2572-IMPLEMENT_VOID_FUNCTION4(
2573-u_hardware_gps_inject_time,
2574-UHardwareGps,
2575-int64_t,
2576-int64_t,
2577-int);
2578-
2579-IMPLEMENT_VOID_FUNCTION4(
2580-u_hardware_gps_inject_location,
2581-UHardwareGps,
2582-double,
2583-double,
2584-float);
2585-
2586-IMPLEMENT_VOID_FUNCTION2(
2587-u_hardware_gps_delete_aiding_data,
2588-UHardwareGps,
2589-uint16_t);
2590-
2591-IMPLEMENT_FUNCTION6(
2592-bool,
2593-u_hardware_gps_set_position_mode,
2594-UHardwareGps,
2595-uint32_t,
2596-uint32_t,
2597-uint32_t,
2598-uint32_t,
2599-uint32_t);
2600-
2601-IMPLEMENT_VOID_FUNCTION3(
2602-u_hardware_gps_inject_xtra_data,
2603-UHardwareGps,
2604-char*,
2605-int);
2606
2607=== removed directory 'src/mirclient'
2608=== removed file 'src/mirclient/CMakeLists.txt'
2609--- src/mirclient/CMakeLists.txt 2013-06-07 23:27:45 +0000
2610+++ src/mirclient/CMakeLists.txt 1970-01-01 00:00:00 +0000
2611@@ -1,34 +0,0 @@
2612-set(SOURCES
2613- ubuntu_application_api_mirclient.cpp
2614- application_instance_mirclient.cpp
2615- window_properties_mirclient.cpp
2616- window_mirclient.cpp
2617-)
2618-
2619-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC")
2620-
2621-add_library(
2622- ubuntu_application_api_mirclient SHARED
2623- ${SOURCES}
2624-)
2625-
2626-include_directories(
2627- ${CMAKE_BINARY_DIR}/include
2628- ${MIRCLIENT_INCLUDE_DIRS}
2629-)
2630-
2631-target_link_libraries(
2632- ubuntu_application_api_mirclient
2633- ${MIRCLIENT_LDFLAGS} ${MIRCLIENT_LIBRARIES}
2634- -Wl,--whole-archive ubuntu_application_api_mircommon
2635- -Wl,--no-whole-archive
2636-)
2637-
2638-set_target_properties(
2639- ubuntu_application_api_mirclient
2640- PROPERTIES
2641- VERSION 1.0
2642- SOVERSION 1
2643-)
2644-
2645-install(TARGETS ubuntu_application_api_mirclient ${INSTALL_TARGETS_DEFAULT_ARGS})
2646
2647=== removed file 'src/mirclient/application_instance_mirclient.cpp'
2648--- src/mirclient/application_instance_mirclient.cpp 2013-06-07 20:56:22 +0000
2649+++ src/mirclient/application_instance_mirclient.cpp 1970-01-01 00:00:00 +0000
2650@@ -1,68 +0,0 @@
2651-/*
2652- * Copyright (C) 2013 Canonical Ltd
2653- *
2654- * This program is free software: you can redistribute it and/or modify
2655- * it under the terms of the GNU Lesser General Public License version 3 as
2656- * published by the Free Software Foundation.
2657- *
2658- * This program is distributed in the hope that it will be useful,
2659- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2660- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2661- * GNU Lesser General Public License for more details.
2662- *
2663- * You should have received a copy of the GNU Lesser General Public License
2664- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2665- *
2666- * Authored by: Robert Carr <robert.carr@canonical.com>
2667- */
2668-
2669-#include "application_instance_mirclient_priv.h"
2670-
2671-namespace uamc = ubuntu::application::mir::client;
2672-
2673-uamc::Instance::Instance()
2674- : con(nullptr),
2675- ref_count(1)
2676-{
2677-
2678-}
2679-
2680-UApplicationInstance* uamc::Instance::as_u_application_instance()
2681-{
2682- return static_cast<UApplicationInstance*>(this);
2683-}
2684-
2685-uamc::Instance* uamc::Instance::from_u_application_instance(UApplicationInstance* u_instance)
2686-{
2687- return static_cast<uamc::Instance*>(u_instance);
2688-}
2689-
2690-void uamc::Instance::ref()
2691-{
2692- ref_count++;
2693-}
2694-
2695-void uamc::Instance::unref()
2696-{
2697- ref_count--;
2698- if (ref_count == 0)
2699- delete this;
2700-}
2701-
2702-MirConnection* uamc::Instance::connection() const
2703-{
2704- return con.get();
2705-}
2706-
2707-bool uamc::Instance::connect(std::string const& application_name)
2708-{
2709- auto mir_connection = mir_connect_sync(NULL, application_name.c_str());
2710- if (mir_connection == nullptr)
2711- return false;
2712- con = ConnectionPtr(mir_connection,
2713- [](MirConnection *c)
2714- {
2715- mir_connection_release(c);
2716- });
2717- return true;
2718-}
2719
2720=== removed file 'src/mirclient/application_instance_mirclient_priv.h'
2721--- src/mirclient/application_instance_mirclient_priv.h 2013-06-09 21:52:56 +0000
2722+++ src/mirclient/application_instance_mirclient_priv.h 1970-01-01 00:00:00 +0000
2723@@ -1,68 +0,0 @@
2724-/*
2725- * Copyright (C) 2013 Canonical Ltd
2726- *
2727- * This program is free software: you can redistribute it and/or modify
2728- * it under the terms of the GNU Lesser General Public License version 3 as
2729- * published by the Free Software Foundation.
2730- *
2731- * This program is distributed in the hope that it will be useful,
2732- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2733- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2734- * GNU Lesser General Public License for more details.
2735- *
2736- * You should have received a copy of the GNU Lesser General Public License
2737- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2738- *
2739- * Authored by: Robert Carr <robert.carr@canonical.com>
2740- */
2741-
2742-#ifndef UBUNTU_APPLICATION_INSTANCE_MIRCLIENT_PRIV_H_
2743-#define UBUNTU_APPLICATION_INSTANCE_MIRCLIENT_PRIV_H_
2744-
2745-#include <ubuntu/application/instance.h>
2746-
2747-#include <memory>
2748-#include <string>
2749-
2750-#include <mir_toolkit/mir_client_library.h>
2751-
2752-namespace ubuntu
2753-{
2754-namespace application
2755-{
2756-namespace mir
2757-{
2758-namespace client
2759-{
2760-
2761-class Instance
2762-{
2763-public:
2764- Instance();
2765- ~Instance() = default;
2766-
2767- UApplicationInstance* as_u_application_instance();
2768- static Instance* from_u_application_instance(UApplicationInstance* u_instance);
2769-
2770- void ref();
2771- void unref();
2772-
2773- MirConnection* connection() const;
2774- bool connect(std::string const& application_name);
2775-
2776-protected:
2777- Instance(Instance const&) = delete;
2778- Instance& operator=(Instance const&) = delete;
2779-
2780-private:
2781- typedef std::unique_ptr<MirConnection, std::function<void(MirConnection*)>> ConnectionPtr;
2782- ConnectionPtr con;
2783- int ref_count;
2784-};
2785-
2786-}
2787-}
2788-}
2789-} // namespace ubuntu
2790-
2791-#endif // UBUNTU_APPLICATION_INSTANCE_MIRCLIENT_PRIV_H_
2792
2793=== removed file 'src/mirclient/ubuntu_application_api_mirclient.cpp'
2794--- src/mirclient/ubuntu_application_api_mirclient.cpp 2013-06-12 21:20:38 +0000
2795+++ src/mirclient/ubuntu_application_api_mirclient.cpp 1970-01-01 00:00:00 +0000
2796@@ -1,279 +0,0 @@
2797-/*
2798- * Copyright (C) 2013 Canonical Ltd
2799- *
2800- * This program is free software: you can redistribute it and/or modify
2801- * it under the terms of the GNU Lesser General Public License version 3 as
2802- * published by the Free Software Foundation.
2803- *
2804- * This program is distributed in the hope that it will be useful,
2805- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2806- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2807- * GNU Lesser General Public License for more details.
2808- *
2809- * You should have received a copy of the GNU Lesser General Public License
2810- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2811- *
2812- * Authored by: Robert Carr <robert.carr@canonical.com>
2813- */
2814-
2815-#include "application_instance_mirclient_priv.h"
2816-#include "window_properties_mirclient_priv.h"
2817-#include "window_mirclient_priv.h"
2818-
2819-#include "mircommon/application_id_mir_priv.h"
2820-
2821-#include <ubuntu/application/lifecycle_delegate.h>
2822-#include <ubuntu/application/ui/window.h>
2823-#include <ubuntu/application/ui/options.h>
2824-#include <ubuntu/application/ui/session.h>
2825-#include <ubuntu/application/ui/clipboard.h>
2826-#include <ubuntu/application/ui/display.h>
2827-#include <ubuntu/application/sensors/accelerometer.h>
2828-#include <ubuntu/application/sensors/proximity.h>
2829-#include <ubuntu/application/sensors/light.h>
2830-
2831-#include <mir_toolkit/mir_client_library.h>
2832-
2833-#include <stdlib.h>
2834-#include <assert.h>
2835-#include <string.h>
2836-
2837-namespace uam = ubuntu::application::mir;
2838-namespace uamc = uam::client;
2839-
2840-namespace
2841-{
2842-
2843-// We use a global instance as some platform-api functions, i.e. display_new_with_index
2844-// do not supply dependencies, but a MirConnection is required for all queries.
2845-static uamc::Instance*
2846-global_mir_instance()
2847-{
2848- // Obviously ref counting is whacky here...
2849- static uamc::Instance instance;
2850- instance.ref(); // We leak a reference, this object can't be destroyed
2851- return &instance;
2852-}
2853-
2854-// Display info
2855-static MirDisplayInfo*
2856-u_display_mir_display(UAUiDisplay *display)
2857-{
2858- return static_cast<MirDisplayInfo*>(display);
2859-}
2860-
2861-static UAUiDisplay*
2862-mir_display_u_display(MirDisplayInfo *display)
2863-{
2864- return static_cast<UAUiDisplay*>(display);
2865-}
2866-
2867-};
2868-
2869-extern "C"
2870-{
2871-
2872-// TODO<papi>: Eliminate global instance by adding Instance to some functions (i.e. display queries)
2873-// TODO: We can't take ownership of description and options until we get rid of the global instance
2874-// so we leak them.
2875-UApplicationInstance* u_application_instance_new_from_description_with_options(UApplicationDescription* description, UApplicationOptions* options)
2876-{
2877- auto instance = global_mir_instance();
2878-
2879- auto id = uam::Id::from_u_application_id(u_application_description_get_application_id(description));
2880- auto connect_suceeded = instance->connect(id->name);
2881- assert(connect_suceeded);
2882-
2883- return instance->as_u_application_instance();
2884-}
2885-
2886-void
2887-u_application_instance_ref(UApplicationInstance *u_instance)
2888-{
2889- auto instance = uamc::Instance::from_u_application_instance(u_instance);
2890- instance->ref();
2891-}
2892-
2893-void
2894-u_application_instance_unref(UApplicationInstance *u_instance)
2895-{
2896- auto instance = uamc::Instance::from_u_application_instance(u_instance);
2897- instance->unref();
2898-}
2899-
2900-void
2901-u_application_instance_destroy(UApplicationInstance *u_instance)
2902-{
2903- // TODO<papi>: What are the proper semantics here.
2904- u_application_instance_unref(u_instance);
2905-}
2906-
2907-void
2908-u_application_instance_run(UApplicationInstance *instance)
2909-{
2910- // TODO<papi>: What is this supposed to do? Seems to be no-op on hybris.
2911- (void) instance;
2912-}
2913-
2914-void ua_ui_set_clipboard_content(void* content, size_t content_size)
2915-{
2916- // TODO<papi,mir>: Implement. We will need a MirConnection
2917- (void) content;
2918- (void) content_size;
2919-}
2920-
2921-void ua_ui_get_clipboard_content(void** out_content, size_t* out_content_size)
2922-{
2923- // TODO<papi,mir>: Implement, see get_clipboard_comment.
2924- *out_content = NULL;
2925- *out_content_size = 0;
2926-}
2927-
2928-//
2929-// TODO <papi>: We need to expose the EGLNativeDisplay somehow
2930-//
2931-
2932-// TODO <papi>: This function should take an application instance so we can eliminate the global mir instance.
2933-// TODO <mir>: Perhaps this should be noop for Mir as there is no need to construct
2934-// a display object, the connection already has everything we need, as it receives
2935-// the display info at connect time.
2936-UAUiDisplay* ua_ui_display_new_with_index(size_t index)
2937-{
2938- // TODO<papi,mir>: What are the semantics of index. How should we use it?
2939- (void) index;
2940- auto instance = global_mir_instance();
2941-
2942- auto display = new MirDisplayInfo;
2943- mir_connection_get_display_info(instance->connection(), display);
2944-
2945- return mir_display_u_display(display);
2946-}
2947-
2948-void ua_ui_display_destroy(UAUiDisplay* display)
2949-{
2950- auto mir_display = u_display_mir_display(display);
2951- delete mir_display;
2952-}
2953-
2954-uint32_t ua_ui_display_query_horizontal_res(UAUiDisplay* display)
2955-{
2956- auto mir_display = u_display_mir_display(display);
2957-
2958- // TODO<mir>: Line up return types from mirclient
2959- return static_cast<uint32_t>(mir_display->width);
2960-}
2961-
2962-uint32_t ua_ui_display_query_vertical_res(UAUiDisplay* display)
2963-{
2964- auto mir_display = u_display_mir_display(display);
2965-
2966- // TODO<mir>: Line up return types from mirclient
2967- return static_cast<uint32_t>(mir_display->height);
2968-}
2969-
2970-EGLNativeDisplayType ua_ui_display_get_native_type(UAUiDisplay* display)
2971-{
2972- auto instance = global_mir_instance();
2973-
2974- // TODO<mir>: Careful with this cast
2975- return reinterpret_cast<EGLNativeDisplayType>(mir_connection_get_egl_native_display(instance->connection()));
2976-}
2977-
2978-UAUiWindowProperties* ua_ui_window_properties_new_for_normal_window()
2979-{
2980- return (new uamc::WindowProperties)->as_u_window_properties();
2981-}
2982-
2983-void ua_ui_window_properties_destroy(UAUiWindowProperties* u_properties)
2984-{
2985- auto properties = uamc::WindowProperties::from_u_window_properties(u_properties);
2986- delete properties;
2987-}
2988-
2989-void ua_ui_window_properties_set_titlen(UAUiWindowProperties* u_properties, const char* title, size_t title_length)
2990-{
2991- auto properties = uamc::WindowProperties::from_u_window_properties(u_properties);
2992-
2993- properties->set_title(title, title_length);
2994-}
2995-
2996-const char* ua_ui_window_properties_get_title(UAUiWindowProperties* u_properties)
2997-{
2998- auto properties = uamc::WindowProperties::from_u_window_properties(u_properties);
2999- return properties->surface_parameters().name;
3000-}
3001-
3002-void ua_ui_window_properties_set_role(UAUiWindowProperties* properties, UAUiWindowRole role)
3003-{
3004- // TODO<papi>: Doesn't seem like this is meaningful for mirclient. Perhaps it should leave platform-api.
3005- (void) properties;
3006- (void) role;
3007-}
3008-
3009-void ua_ui_window_properties_set_input_cb_and_ctx(UAUiWindowProperties* u_properties, UAUiWindowInputEventCb cb, void* ctx)
3010-{
3011- auto properties = uamc::WindowProperties::from_u_window_properties(u_properties);
3012- properties->set_input_cb_and_ctx(cb, ctx);
3013-}
3014-
3015-UAUiWindow* ua_ui_window_new_for_application_with_properties(UApplicationInstance* u_instance, UAUiWindowProperties* u_properties)
3016-{
3017- auto instance = uamc::Instance::from_u_application_instance(u_instance);
3018- auto properties = uamc::WindowProperties::from_u_window_properties(u_properties);
3019-
3020- auto window = new uamc::Window(*instance, properties);
3021- return window->as_u_window();
3022-}
3023-
3024-void ua_ui_window_destroy(UAUiWindow* u_window)
3025-{
3026- auto window = uamc::Window::from_u_window(u_window);
3027- delete window;
3028-}
3029-
3030-UStatus ua_ui_window_move(UAUiWindow* u_window, uint32_t x, uint32_t y)
3031-{
3032- // TODO<papi,mir>: Implement. Assuming this should exist on mirclient?
3033- (void) u_window;
3034- (void) x;
3035- (void) y;
3036- return (UStatus) 0;
3037-}
3038-
3039-UStatus ua_ui_window_resize(UAUiWindow* u_window, uint32_t width, uint32_t height)
3040-{
3041- // TODO<mir>: Implement
3042- (void) u_window;
3043- (void) width;
3044- (void) height;
3045- return (UStatus) 0;
3046-}
3047-
3048-UStatus ua_ui_window_hide(UAUiWindow* u_window)
3049-{
3050- // TODO<mir>: Implement
3051- (void) u_window;
3052- return (UStatus) 0;
3053-}
3054-
3055-UStatus ua_ui_window_show(UAUiWindow* u_window)
3056-{
3057- // TODO<mir>: Implement
3058- (void) u_window;
3059- return (UStatus) 0;
3060-}
3061-
3062-void ua_ui_window_request_fullscreen(UAUiWindow* u_window)
3063-{
3064- // TODO<mir>: Implement
3065- (void) u_window;
3066-}
3067-
3068-EGLNativeWindowType ua_ui_window_get_native_type(UAUiWindow* u_window)
3069-{
3070- auto window = uamc::Window::from_u_window(u_window);
3071- return window->get_native_type();
3072-}
3073-
3074-// TODO: Sensors
3075-}
3076
3077=== removed file 'src/mirclient/window_mirclient.cpp'
3078--- src/mirclient/window_mirclient.cpp 2013-06-07 23:27:45 +0000
3079+++ src/mirclient/window_mirclient.cpp 1970-01-01 00:00:00 +0000
3080@@ -1,128 +0,0 @@
3081-/*
3082- * Copyright (C) 2013 Canonical Ltd
3083- *
3084- * This program is free software: you can redistribute it and/or modify
3085- * it under the terms of the GNU Lesser General Public License version 3 as
3086- * published by the Free Software Foundation.
3087- *
3088- * This program is distributed in the hope that it will be useful,
3089- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3090- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3091- * GNU Lesser General Public License for more details.
3092- *
3093- * You should have received a copy of the GNU Lesser General Public License
3094- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3095- *
3096- * Authored by: Robert Carr <robert.carr@canonical.com>
3097- */
3098-
3099-#include "window_mirclient_priv.h"
3100-#include "application_instance_mirclient_priv.h"
3101-#include "window_properties_mirclient_priv.h"
3102-#include "window_mirclient_priv.h"
3103-
3104-#include "mircommon/event_helpers_mir.h"
3105-
3106-namespace uamc = ubuntu::application::mir::client;
3107-namespace uaum = ubuntu::application::ui::mir;
3108-
3109-namespace ubuntu
3110-{
3111-namespace application
3112-{
3113-namespace mir
3114-{
3115-namespace client
3116-{
3117-
3118-struct InputContext
3119-{
3120- UAUiWindowInputEventCb cb;
3121- void *ctx;
3122-};
3123-
3124-static void
3125-ua_ui_window_mir_handle_event(MirSurface* surface, MirEvent const* mir_ev, void* ctx)
3126-{
3127- // TODO<mir>: Perhaps this indicates that mirclient library should not pass a surface argument here.
3128- (void) surface;
3129-
3130- Event ubuntu_ev;
3131- uaum::event_to_ubuntu_event(mir_ev, ubuntu_ev);
3132- auto mir_ctx = static_cast<uamc::InputContext*>(ctx);
3133- mir_ctx->cb(mir_ctx->ctx, &ubuntu_ev);
3134-}
3135-
3136-}
3137-}
3138-}
3139-}
3140-
3141-namespace
3142-{
3143-
3144-static MirPixelFormat
3145-mir_choose_default_pixel_format(MirConnection *connection)
3146-{
3147- MirDisplayInfo info;
3148- mir_connection_get_display_info(connection, &info);
3149- return info.supported_pixel_format[0];
3150-}
3151-
3152-static MirSurface*
3153-create_surface_with_parameters(MirConnection *connection,
3154- MirSurfaceParameters parameters)
3155-{
3156-}
3157-
3158-}
3159-
3160-uamc::Window::Window(uamc::Instance& instance,
3161- uamc::WindowProperties* properties)
3162- : instance(instance)
3163-{
3164- window_properties = WindowPropertiesPtr(properties,
3165- [](uamc::WindowProperties *p)
3166- {
3167- ua_ui_window_properties_destroy(p->as_u_window_properties());
3168- });
3169-
3170- MirSurfaceParameters parameters = properties->surface_parameters();
3171- auto connection = instance.connection();
3172- parameters.pixel_format = mir_choose_default_pixel_format(connection);
3173-
3174- auto mir_surface = mir_connection_create_surface_sync(connection, &parameters);
3175- // TODO: create_surface_sync is unsafe as there is a race between setting the event handler and receiving surfaces
3176- input_ctx = InputContextPtr(new uamc::InputContext{properties->input_cb(), properties->input_context()},
3177- [](InputContext *c)
3178- {
3179- delete c;
3180- });
3181-
3182- MirEventDelegate delegate =
3183- {
3184- uamc::ua_ui_window_mir_handle_event,
3185- input_ctx.get()
3186- };
3187- mir_surface_set_event_handler(mir_surface, &delegate);
3188- surface = SurfacePtr(mir_surface,
3189- [](MirSurface *s)
3190- {
3191- mir_surface_release_sync(s);
3192- });
3193-}
3194-
3195-UAUiWindow* uamc::Window::as_u_window()
3196-{
3197- return static_cast<UAUiWindow*>(this);
3198-}
3199-
3200-uamc::Window* uamc::Window::from_u_window(UAUiWindow *u_window)
3201-{
3202- return static_cast<uamc::Window*>(u_window);
3203-}
3204-
3205-EGLNativeWindowType uamc::Window::get_native_type()
3206-{
3207- return reinterpret_cast<EGLNativeWindowType>(mir_surface_get_egl_native_window(surface.get()));
3208-}
3209
3210=== removed file 'src/mirclient/window_mirclient_priv.h'
3211--- src/mirclient/window_mirclient_priv.h 2013-06-07 23:27:45 +0000
3212+++ src/mirclient/window_mirclient_priv.h 1970-01-01 00:00:00 +0000
3213@@ -1,76 +0,0 @@
3214-/*
3215- * Copyright (C) 2013 Canonical Ltd
3216- *
3217- * This program is free software: you can redistribute it and/or modify
3218- * it under the terms of the GNU Lesser General Public License version 3 as
3219- * published by the Free Software Foundation.
3220- *
3221- * This program is distributed in the hope that it will be useful,
3222- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3223- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3224- * GNU Lesser General Public License for more details.
3225- *
3226- * You should have received a copy of the GNU Lesser General Public License
3227- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3228- *
3229- * Authored by: Robert Carr <robert.carr@canonical.com>
3230- */
3231-
3232-#ifndef UBUNTU_APPLICATION_UI_WINDOW_MIRCLIENT_PRIV_H_
3233-#define UBUNTU_APPLICATION_UI_WINDOW_MIRCLIENT_PRIV_H_
3234-
3235-#include <ubuntu/application/ui/window.h>
3236-#include <mir_toolkit/mir_client_library.h>
3237-
3238-#include <EGL/egl.h>
3239-
3240-#include <stddef.h>
3241-
3242-#include <functional>
3243-#include <memory>
3244-#include <string>
3245-
3246-namespace ubuntu
3247-{
3248-namespace application
3249-{
3250-namespace mir
3251-{
3252-namespace client
3253-{
3254-class Instance;
3255-class WindowProperties;
3256-struct InputContext;
3257-
3258-class Window
3259-{
3260-public:
3261- Window(Instance& instance, WindowProperties* window);
3262- ~Window() = default;
3263-
3264- UAUiWindow* as_u_window();
3265- static Window* from_u_window(UAUiWindow* u_window);
3266-
3267- EGLNativeWindowType get_native_type();
3268-protected:
3269- Window(Window const&) = delete;
3270- Window& operator=(Window const&) = delete;
3271-
3272-private:
3273- Instance& instance;
3274-
3275- typedef std::unique_ptr<WindowProperties, std::function<void(WindowProperties*)>> WindowPropertiesPtr;
3276- typedef std::unique_ptr<MirSurface, std::function<void(MirSurface*)>> SurfacePtr;
3277- typedef std::unique_ptr<InputContext, std::function<void(InputContext*)>> InputContextPtr;
3278-
3279- WindowPropertiesPtr window_properties;
3280- SurfacePtr surface;
3281- InputContextPtr input_ctx;
3282-};
3283-
3284-}
3285-}
3286-}
3287-}
3288-
3289-#endif // UBUNTU_APPLICATION_UI_WINDOW_MIRCLIENT_PRIV_H_
3290
3291=== removed file 'src/mirclient/window_properties_mirclient.cpp'
3292--- src/mirclient/window_properties_mirclient.cpp 2013-06-07 21:58:44 +0000
3293+++ src/mirclient/window_properties_mirclient.cpp 1970-01-01 00:00:00 +0000
3294@@ -1,68 +0,0 @@
3295-/*
3296- * Copyright (C) 2013 Canonical Ltd
3297- *
3298- * This program is free software: you can redistribute it and/or modify
3299- * it under the terms of the GNU Lesser General Public License version 3 as
3300- * published by the Free Software Foundation.
3301- *
3302- * This program is distributed in the hope that it will be useful,
3303- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3304- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3305- * GNU Lesser General Public License for more details.
3306- *
3307- * You should have received a copy of the GNU Lesser General Public License
3308- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3309- *
3310- * Authored by: Robert Carr <robert.carr@canonical.com>
3311- */
3312-
3313-#include "window_properties_mirclient_priv.h"
3314-
3315-namespace uamc = ubuntu::application::mir::client;
3316-
3317-uamc::WindowProperties::WindowProperties()
3318- : cb(nullptr),
3319- input_ctx(nullptr)
3320-{
3321- parameters.name = nullptr;
3322- parameters.width = 0;
3323- parameters.height = 0;
3324- parameters.buffer_usage = mir_buffer_usage_hardware;
3325-}
3326-
3327-UAUiWindowProperties* uamc::WindowProperties::as_u_window_properties()
3328-{
3329- return static_cast<UAUiWindowProperties*>(this);
3330-}
3331-uamc::WindowProperties* uamc::WindowProperties::from_u_window_properties(UAUiWindowProperties* u_properties)
3332-{
3333- return static_cast<uamc::WindowProperties*>(u_properties);
3334-}
3335-
3336-void uamc::WindowProperties::set_title(char const* window_title, size_t length)
3337-{
3338- title = std::string(window_title, length);
3339- parameters.name = title.c_str();
3340-}
3341-
3342-void uamc::WindowProperties::set_input_cb_and_ctx(UAUiWindowInputEventCb callback, void* ctx)
3343-{
3344- cb = callback;
3345- input_ctx = ctx;
3346-}
3347-
3348-MirSurfaceParameters const& uamc::WindowProperties::surface_parameters() const
3349-{
3350- return parameters;
3351-}
3352-
3353-UAUiWindowInputEventCb uamc::WindowProperties::input_cb() const
3354-{
3355- return cb;
3356-}
3357-
3358-void* uamc::WindowProperties::input_context() const
3359-{
3360- return input_ctx;
3361-}
3362-
3363
3364=== removed file 'src/mirclient/window_properties_mirclient_priv.h'
3365--- src/mirclient/window_properties_mirclient_priv.h 2013-06-07 21:58:44 +0000
3366+++ src/mirclient/window_properties_mirclient_priv.h 1970-01-01 00:00:00 +0000
3367@@ -1,72 +0,0 @@
3368-/*
3369- * Copyright (C) 2013 Canonical Ltd
3370- *
3371- * This program is free software: you can redistribute it and/or modify
3372- * it under the terms of the GNU Lesser General Public License version 3 as
3373- * published by the Free Software Foundation.
3374- *
3375- * This program is distributed in the hope that it will be useful,
3376- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3377- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3378- * GNU Lesser General Public License for more details.
3379- *
3380- * You should have received a copy of the GNU Lesser General Public License
3381- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3382- *
3383- * Authored by: Robert Carr <robert.carr@canonical.com>
3384- */
3385-
3386-#ifndef UBUNTU_APPLICATION_UI_WINDOW_PROPERTIES_MIRCLIENT_PRIV_H_
3387-#define UBUNTU_APPLICATION_UI_WINDOW_PROPERTIES_MIRCLIENT_PRIV_H_
3388-
3389-#include <ubuntu/application/ui/window.h>
3390-#include <mir_toolkit/mir_client_library.h>
3391-
3392-#include <stddef.h>
3393-
3394-#include <string>
3395-
3396-namespace ubuntu
3397-{
3398-namespace application
3399-{
3400-namespace mir
3401-{
3402-namespace client
3403-{
3404-
3405-class WindowProperties
3406-{
3407-public:
3408- WindowProperties();
3409- ~WindowProperties() = default;
3410-
3411- UAUiWindowProperties* as_u_window_properties();
3412- static WindowProperties* from_u_window_properties(UAUiWindowProperties* u_properties);
3413-
3414- void set_title(char const* title, size_t length);
3415- void set_input_cb_and_ctx(UAUiWindowInputEventCb cb, void* ctx);
3416-
3417- MirSurfaceParameters const& surface_parameters() const;
3418- UAUiWindowInputEventCb input_cb() const;
3419- void* input_context() const;
3420-
3421-protected:
3422- WindowProperties(WindowProperties const&) = delete;
3423- WindowProperties& operator=(WindowProperties const&) = delete;
3424-
3425-private:
3426- MirSurfaceParameters parameters;
3427-
3428- std::string title;
3429-
3430- UAUiWindowInputEventCb cb;
3431- void *input_ctx;
3432-};
3433-
3434-}
3435-}
3436-}
3437-}
3438-
3439-#endif // UBUNTU_APPLICATION_UI_WINDOW_PROPERTIES_MIRCLIENT_PRIV_H_
3440
3441=== removed directory 'src/mircommon'
3442=== removed file 'src/mircommon/CMakeLists.txt'
3443--- src/mircommon/CMakeLists.txt 2013-07-10 13:57:20 +0000
3444+++ src/mircommon/CMakeLists.txt 1970-01-01 00:00:00 +0000
3445@@ -1,43 +0,0 @@
3446-set(SOURCES
3447- event_helpers_mir.cpp
3448- application_id_mir.cpp
3449- application_options_mir.cpp
3450- application_description_mir.cpp
3451- lifecycle_delegate_mir.cpp
3452- session_mir.cpp
3453-)
3454-
3455-set(LINK_LIBRARIES
3456- ${MIR_COMMON_LDFLAGS} ${MIR_COMMON_LIBRARIES}
3457-)
3458-
3459-if(ENABLE_HYBRIS_IMPLEMENTATION)
3460- list(APPEND SOURCES
3461- ../hybris/ubuntu_application_sensors_hybris.cpp
3462- )
3463- list(APPEND LINK_LIBRARIES
3464- hybris-common
3465- )
3466-else()
3467- list(APPEND SOURCES
3468- ubuntu_application_sensors_desktop.cpp
3469- )
3470-endif()
3471-
3472-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC --std=c++11")
3473-
3474-include_directories(
3475- ${MIRCOMMON_INCLUDE_DIRS}
3476-)
3477-
3478-add_library(
3479- ubuntu_application_api_mircommon STATIC
3480- ${SOURCES}
3481-)
3482-
3483-target_link_libraries(
3484- ubuntu_application_api_mircommon
3485- ${LINK_LIBRARIES}
3486-)
3487-
3488-
3489
3490=== removed file 'src/mircommon/application_description_mir.cpp'
3491--- src/mircommon/application_description_mir.cpp 2013-06-07 17:41:36 +0000
3492+++ src/mircommon/application_description_mir.cpp 1970-01-01 00:00:00 +0000
3493@@ -1,94 +0,0 @@
3494-/*
3495- * Copyright (C) 2013 Canonical Ltd
3496- *
3497- * This program is free software: you can redistribute it and/or modify
3498- * it under the terms of the GNU Lesser General Public License version 3 as
3499- * published by the Free Software Foundation.
3500- *
3501- * This program is distributed in the hope that it will be useful,
3502- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3503- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3504- * GNU Lesser General Public License for more details.
3505- *
3506- * You should have received a copy of the GNU Lesser General Public License
3507- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3508- *
3509- * Authored by: Robert Carr <robert.carr@canonical.com>
3510- */
3511-
3512-#include "application_description_mir_priv.h"
3513-
3514-namespace uam = ubuntu::application::mir;
3515-
3516-uam::Description::Description()
3517- : application_id(nullptr),
3518- lifecycle_delegate(nullptr)
3519-{
3520-}
3521-
3522-UApplicationDescription* uam::Description::as_u_application_description()
3523-{
3524- return static_cast<UApplicationDescription*>(this);
3525-}
3526-
3527-uam::Description* uam::Description::from_u_application_description(UApplicationDescription* description)
3528-{
3529- return static_cast<uam::Description*>(description);
3530-}
3531-
3532-UApplicationDescription*
3533-u_application_description_new()
3534-{
3535- auto description = new uam::Description();
3536- return description->as_u_application_description();
3537-}
3538-
3539-void
3540-u_application_description_destroy(UApplicationDescription *u_description)
3541-{
3542- auto description = uam::Description::from_u_application_description(u_description);
3543- delete description;
3544-}
3545-
3546-void
3547-u_application_description_set_application_id(UApplicationDescription *u_description,
3548- UApplicationId *id)
3549-{
3550- auto description = uam::Description::from_u_application_description(u_description);
3551-
3552- description->application_id = std::unique_ptr<UApplicationId, std::function<void(UApplicationId*)>>(id,
3553- [](UApplicationId *p)
3554- {
3555- u_application_id_destroy(p);
3556- });
3557-}
3558-
3559-UApplicationId*
3560-u_application_description_get_application_id(UApplicationDescription *u_description)
3561-{
3562- auto description = uam::Description::from_u_application_description(u_description);
3563- return description->application_id.get();
3564-}
3565-
3566-void
3567-u_application_description_set_application_lifecycle_delegate(UApplicationDescription *u_description,
3568- UApplicationLifecycleDelegate *lifecycle_delegate)
3569-{
3570- auto description = uam::Description::from_u_application_description(u_description);
3571-
3572- // TODO: We don't take a ref as it is created with a floating ref but this should be made more explicit...
3573- description->lifecycle_delegate =
3574- std::unique_ptr<UApplicationLifecycleDelegate, std::function<void(UApplicationLifecycleDelegate*)>>(lifecycle_delegate,
3575- [](UApplicationLifecycleDelegate *p)
3576- {
3577- u_application_lifecycle_delegate_unref(p);
3578- });
3579-
3580-}
3581-
3582-UApplicationLifecycleDelegate*
3583-u_application_description_get_application_lifecycle_delegate(UApplicationDescription *u_description)
3584-{
3585- auto description = uam::Description::from_u_application_description(u_description);
3586- return description->lifecycle_delegate.get();
3587-}
3588
3589=== removed file 'src/mircommon/application_description_mir_priv.h'
3590--- src/mircommon/application_description_mir_priv.h 2013-06-07 17:41:36 +0000
3591+++ src/mircommon/application_description_mir_priv.h 1970-01-01 00:00:00 +0000
3592@@ -1,56 +0,0 @@
3593-/*
3594- * Copyright (C) 2013 Canonical Ltd
3595- *
3596- * This program is free software: you can redistribute it and/or modify
3597- * it under the terms of the GNU Lesser General Public License version 3 as
3598- * published by the Free Software Foundation.
3599- *
3600- * This program is distributed in the hope that it will be useful,
3601- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3602- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3603- * GNU Lesser General Public License for more details.
3604- *
3605- * You should have received a copy of the GNU Lesser General Public License
3606- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3607- *
3608- * Authored by: Robert Carr <robert.carr@canonical.com>
3609- */
3610-
3611-#ifndef UBUNTU_APPLICATION_DESCRIPTION_MIR_PRIV_H_
3612-#define UBUNTU_APPLICATION_DESCRIPTION_MIR_PRIV_H_
3613-
3614-#include <ubuntu/application/description.h>
3615-
3616-#include <memory>
3617-#include <functional>
3618-
3619-namespace ubuntu
3620-{
3621-namespace application
3622-{
3623-namespace mir
3624-{
3625-
3626-class Description
3627-{
3628-public:
3629- Description();
3630- ~Description() = default;
3631-
3632- UApplicationDescription* as_u_application_description();
3633- static Description* from_u_application_description(UApplicationDescription* u_description);
3634-
3635- // TODO<papi> Do we really own these?
3636- std::unique_ptr<UApplicationId, std::function<void(UApplicationId*)>> application_id;
3637- std::unique_ptr<UApplicationLifecycleDelegate, std::function<void(UApplicationLifecycleDelegate*)>> lifecycle_delegate;
3638-
3639-protected:
3640- Description(Description const&) = delete;
3641- Description& operator=(Description const&) = delete;
3642-};
3643-
3644-}
3645-}
3646-} // namespace ubuntu
3647-
3648-#endif // UBUNTU_APPLICATION_DESCRIPTION_MIR_PRIV_H_
3649
3650=== removed file 'src/mircommon/application_id_mir.cpp'
3651--- src/mircommon/application_id_mir.cpp 2013-06-05 19:33:23 +0000
3652+++ src/mircommon/application_id_mir.cpp 1970-01-01 00:00:00 +0000
3653@@ -1,56 +0,0 @@
3654-/*
3655- * Copyright (C) 2013 Canonical Ltd
3656- *
3657- * This program is free software: you can redistribute it and/or modify
3658- * it under the terms of the GNU Lesser General Public License version 3 as
3659- * published by the Free Software Foundation.
3660- *
3661- * This program is distributed in the hope that it will be useful,
3662- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3663- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3664- * GNU Lesser General Public License for more details.
3665- *
3666- * You should have received a copy of the GNU Lesser General Public License
3667- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3668- *
3669- * Authored by: Robert Carr <robert.carr@canonical.com>
3670- */
3671-
3672-#include "application_id_mir_priv.h"
3673-
3674-namespace uam = ubuntu::application::mir;
3675-
3676-uam::Id::Id(const char *name, size_t size)
3677- : name(name, size)
3678-{
3679-}
3680-
3681-UApplicationId* uam::Id::as_u_application_id()
3682-{
3683- return static_cast<UApplicationId*>(this);
3684-}
3685-
3686-uam::Id* uam::Id::from_u_application_id(UApplicationId *id)
3687-{
3688- return static_cast<uam::Id*>(id);
3689-}
3690-
3691-UApplicationId*
3692-u_application_id_new_from_stringn(const char *string, size_t size)
3693-{
3694- auto id = new uam::Id(string, size);
3695- return id->as_u_application_id();
3696-}
3697-
3698-void u_application_id_destroy(UApplicationId *u_id)
3699-{
3700- auto id = uam::Id::from_u_application_id(u_id);
3701- delete id;
3702-}
3703-
3704-int u_application_id_compare(UApplicationId* u_lhs, UApplicationId* u_rhs)
3705-{
3706- auto lhs = uam::Id::from_u_application_id(u_lhs);
3707- auto rhs = uam::Id::from_u_application_id(u_rhs);
3708- return lhs->name.compare(rhs->name);
3709-}
3710
3711=== removed file 'src/mircommon/application_id_mir_priv.h'
3712--- src/mircommon/application_id_mir_priv.h 2013-06-05 19:44:09 +0000
3713+++ src/mircommon/application_id_mir_priv.h 1970-01-01 00:00:00 +0000
3714@@ -1,53 +0,0 @@
3715-/*
3716- * Copyright (C) 2013 Canonical Ltd
3717- *
3718- * This program is free software: you can redistribute it and/or modify
3719- * it under the terms of the GNU Lesser General Public License version 3 as
3720- * published by the Free Software Foundation.
3721- *
3722- * This program is distributed in the hope that it will be useful,
3723- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3724- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3725- * GNU Lesser General Public License for more details.
3726- *
3727- * You should have received a copy of the GNU Lesser General Public License
3728- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3729- *
3730- * Authored by: Robert Carr <robert.carr@canonical.com>
3731- */
3732-
3733-#ifndef UBUNTU_APPLICATION_ID_MIR_PRIV_H_
3734-#define UBUNTU_APPLICATION_ID_MIR_PRIV_H_
3735-
3736-#include <ubuntu/application/id.h>
3737-
3738-#include <string>
3739-
3740-namespace ubuntu
3741-{
3742-namespace application
3743-{
3744-namespace mir
3745-{
3746-
3747-class Id
3748-{
3749-public:
3750- Id(const char *name, size_t size);
3751- ~Id() = default;
3752-
3753- UApplicationId* as_u_application_id();
3754- static Id* from_u_application_id(UApplicationId* id);
3755-
3756- std::string const name;
3757-
3758-protected:
3759- Id(const Id&) = delete;
3760- Id& operator=(const Id&) = delete;
3761-};
3762-
3763-}
3764-}
3765-} // namespace ubuntu
3766-
3767-#endif // UBUNTU_APPLICATION_ID_MIR_PRIV_H_
3768
3769=== removed file 'src/mircommon/application_options_mir.cpp'
3770--- src/mircommon/application_options_mir.cpp 2013-06-06 23:35:14 +0000
3771+++ src/mircommon/application_options_mir.cpp 1970-01-01 00:00:00 +0000
3772@@ -1,170 +0,0 @@
3773-/*
3774- * Copyright (C) 2013 Canonical Ltd
3775- *
3776- * This program is free software: you can redistribute it and/or modify
3777- * it under the terms of the GNU Lesser General Public License version 3 as
3778- * published by the Free Software Foundation.
3779- *
3780- * This program is distributed in the hope that it will be useful,
3781- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3782- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3783- * GNU Lesser General Public License for more details.
3784- *
3785- * You should have received a copy of the GNU Lesser General Public License
3786- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3787- *
3788- * Authored by: Robert Carr <robert.carr@canonical.com>
3789- */
3790-
3791-#include "application_options_mir_priv.h"
3792-
3793-#include <string.h>
3794-#include <stdio.h>
3795-#include <stdlib.h>
3796-#include <getopt.h>
3797-
3798-#include <tuple>
3799-#include <string>
3800-
3801-namespace uam = ubuntu::application::mir;
3802-
3803-UApplicationOptions* uam::Options::as_u_application_options()
3804-{
3805- return static_cast<UApplicationOptions*>(this);
3806-}
3807-uam::Options* uam::Options::from_u_application_options(UApplicationOptions* options)
3808-{
3809- return static_cast<uam::Options*>(options);
3810-}
3811-
3812-namespace
3813-{
3814-
3815-UAUiStage
3816-string_to_stage(std::string const& s)
3817-{
3818- if (s == "main_stage")
3819- return U_MAIN_STAGE;
3820- else if (s == "side_stage")
3821- return U_SIDE_STAGE;
3822- else if (s == "share_stage")
3823- return U_SHARE_STAGE;
3824-}
3825-
3826-UAUiFormFactor
3827-string_to_form_factor(std::string const& s)
3828-{
3829- if (s == "desktop")
3830- return U_DESKTOP;
3831- else if (s == "phone")
3832- return U_PHONE;
3833- else if (s == "tablet")
3834- return U_TABLET;
3835-}
3836-
3837-void print_help_and_exit()
3838-{
3839- printf("Usage: executable "
3840- "[--form_factor_hint={desktop, phone, tablet}] "
3841- "[--stage_hint={main_stage, side_stage, share_stage}] "
3842- "[--desktop_file_hint=absolute_path_to_desktop_file]\n");
3843- exit(EXIT_SUCCESS);
3844-}
3845-
3846-}
3847-
3848-extern "C"
3849-{
3850-UApplicationOptions*
3851-u_application_options_new_from_cmd_line(int argc, char** argv)
3852-{
3853- static const int uninteresting_flag_value = 0;
3854- static struct option long_options[] =
3855- {
3856- {"form_factor_hint", required_argument, NULL, uninteresting_flag_value},
3857- {"stage_hint", required_argument, NULL, uninteresting_flag_value},
3858- {"desktop_file_hint", required_argument, NULL, uninteresting_flag_value},
3859- {"help", no_argument, NULL, uninteresting_flag_value},
3860- {0, 0, 0, 0}
3861- };
3862-
3863- static const int form_factor_hint_index = 0;
3864- static const int stage_hint_index = 1;
3865- static const int desktop_file_hint_index = 2;
3866- static const int help_index = 3;
3867-
3868- auto app_options = new uam::Options;
3869-
3870- while(true)
3871- {
3872- int option_index = 0;
3873-
3874- int c = getopt_long(argc,
3875- argv,
3876- "",
3877- long_options,
3878- &option_index);
3879-
3880- if (c == -1)
3881- break;
3882-
3883- switch (c)
3884- {
3885- case 0:
3886- // If this option set a flag, do nothing else now.
3887- if (long_options[option_index].flag != 0)
3888- break;
3889- if (option_index == help_index)
3890- print_help_and_exit();
3891- if (optarg)
3892- {
3893- switch(option_index)
3894- {
3895- case form_factor_hint_index:
3896- app_options->form_factor = string_to_form_factor(std::string(optarg));
3897- break;
3898- case stage_hint_index:
3899- app_options->stage = string_to_stage(std::string(optarg));
3900- break;
3901- case desktop_file_hint_index:
3902- app_options->desktop_file = std::string(optarg);
3903- break;
3904- }
3905- }
3906- break;
3907- case '?':
3908- break;
3909- }
3910- }
3911-
3912- return app_options->as_u_application_options();
3913-}
3914-
3915-void
3916-u_application_options_destroy(UApplicationOptions* u_options)
3917-{
3918- auto options = uam::Options::from_u_application_options(u_options);
3919- delete options;
3920-}
3921-
3922-UApplicationOperationMode
3923-u_application_options_get_operation_mode(UApplicationOptions *u_options)
3924-{
3925- auto options = uam::Options::from_u_application_options(u_options);
3926- return options->operation_mode;
3927-}
3928-
3929-UAUiFormFactor
3930-u_application_options_get_form_factor(UApplicationOptions* u_options)
3931-{
3932- auto options = uam::Options::from_u_application_options(u_options);
3933- return options->form_factor;
3934-}
3935-
3936-UAUiStage
3937-u_application_options_get_stage(UApplicationOptions* u_options)
3938-{
3939- auto options = uam::Options::from_u_application_options(u_options);
3940- return options->stage;
3941-}
3942-}
3943
3944=== removed file 'src/mircommon/application_options_mir_priv.h'
3945--- src/mircommon/application_options_mir_priv.h 2013-06-05 19:44:09 +0000
3946+++ src/mircommon/application_options_mir_priv.h 1970-01-01 00:00:00 +0000
3947@@ -1,58 +0,0 @@
3948-/*
3949- * Copyright (C) 2013 Canonical Ltd
3950- *
3951- * This program is free software: you can redistribute it and/or modify
3952- * it under the terms of the GNU Lesser General Public License version 3 as
3953- * published by the Free Software Foundation.
3954- *
3955- * This program is distributed in the hope that it will be useful,
3956- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3957- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3958- * GNU Lesser General Public License for more details.
3959- *
3960- * You should have received a copy of the GNU Lesser General Public License
3961- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3962- *
3963- * Authored by: Robert Carr <robert.carr@canonical.com>
3964- */
3965-
3966-#ifndef UBUNTU_APPLICATION_OPTIONS_MIR_PRIV_H_
3967-#define UBUNTU_APPLICATION_OPTIONS_MIR_PRIV_H_
3968-
3969-#include <ubuntu/application/options.h>
3970-#include <ubuntu/application/ui/options.h>
3971-
3972-#include <string>
3973-
3974-namespace ubuntu
3975-{
3976-namespace application
3977-{
3978-namespace mir
3979-{
3980-
3981-class Options
3982-{
3983-public:
3984- Options() = default;
3985- ~Options() = default;
3986-
3987- UApplicationOptions* as_u_application_options();
3988- static Options* from_u_application_options(UApplicationOptions* u_options);
3989-
3990- UApplicationOperationMode operation_mode = U_APPLICATION_FOREGROUND_APP;
3991- UAUiFormFactor form_factor = U_DESKTOP;
3992- UAUiStage stage = U_MAIN_STAGE;
3993-
3994- std::string desktop_file;
3995-
3996-protected:
3997- Options(Options const&) = delete;
3998- Options& operator=(Options const&) = delete;
3999-};
4000-
4001-}
4002-}
4003-} // namespace ubuntu
4004-
4005-#endif // UBUNTU_APPLICATION_OPTIONS_MIR_PRIV_H_
4006
4007=== removed file 'src/mircommon/event_helpers_mir.cpp'
4008--- src/mircommon/event_helpers_mir.cpp 2013-06-05 21:15:46 +0000
4009+++ src/mircommon/event_helpers_mir.cpp 1970-01-01 00:00:00 +0000
4010@@ -1,77 +0,0 @@
4011-/*
4012- * Copyright (C) 2013 Canonical Ltd
4013- *
4014- * This program is free software: you can redistribute it and/or modify
4015- * it under the terms of the GNU Lesser General Public License version 3 as
4016- * published by the Free Software Foundation.
4017- *
4018- * This program is distributed in the hope that it will be useful,
4019- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4020- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4021- * GNU Lesser General Public License for more details.
4022- *
4023- * You should have received a copy of the GNU Lesser General Public License
4024- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4025- *
4026- * Authored by: Robert Carr <robert.carr@canonical.com>
4027- */
4028-
4029-#include "event_helpers_mir.h"
4030-
4031-namespace uaum = ubuntu::application::ui::mir;
4032-
4033-// TODO<mir>: This begs the question: Why does MirEvent exist? It's difficult to ensure this function is kept in sync
4034-// at the unit test level.
4035-void
4036-uaum::event_to_ubuntu_event(MirEvent const* mir_event, Event& ubuntu_ev)
4037-{
4038- switch (mir_event->type)
4039- {
4040- case mir_event_type_key:
4041- ubuntu_ev.type = KEY_EVENT_TYPE;
4042- ubuntu_ev.device_id = mir_event->key.device_id;
4043- ubuntu_ev.source_id = mir_event->key.source_id;
4044- ubuntu_ev.action = mir_event->key.action;
4045- ubuntu_ev.flags = mir_event->key.flags;
4046- ubuntu_ev.meta_state = mir_event->key.modifiers;
4047- ubuntu_ev.details.key.key_code = mir_event->key.key_code;
4048- ubuntu_ev.details.key.scan_code = mir_event->key.scan_code;
4049- ubuntu_ev.details.key.repeat_count = mir_event->key.repeat_count;
4050- ubuntu_ev.details.key.down_time = mir_event->key.down_time;
4051- ubuntu_ev.details.key.event_time = mir_event->key.event_time;
4052- ubuntu_ev.details.key.is_system_key = mir_event->key.is_system_key;
4053- break;
4054- case mir_event_type_motion:
4055- ubuntu_ev.type = MOTION_EVENT_TYPE;
4056- ubuntu_ev.device_id = mir_event->motion.device_id;
4057- ubuntu_ev.source_id = mir_event->motion.source_id;
4058- ubuntu_ev.action = mir_event->motion.action;
4059- ubuntu_ev.flags = mir_event->motion.flags;
4060- ubuntu_ev.meta_state = mir_event->motion.modifiers;
4061- ubuntu_ev.details.motion.edge_flags = mir_event->motion.edge_flags;
4062- ubuntu_ev.details.motion.button_state = mir_event->motion.button_state;
4063- ubuntu_ev.details.motion.x_offset = mir_event->motion.x_offset;
4064- ubuntu_ev.details.motion.y_offset = mir_event->motion.y_offset;
4065- ubuntu_ev.details.motion.x_precision = mir_event->motion.x_precision;
4066- ubuntu_ev.details.motion.y_precision = mir_event->motion.y_precision;
4067- ubuntu_ev.details.motion.down_time = mir_event->motion.down_time;
4068- ubuntu_ev.details.motion.event_time = mir_event->motion.event_time;
4069- ubuntu_ev.details.motion.pointer_count = mir_event->motion.pointer_count;
4070- for (int i = 0; i < mir_event->motion.pointer_count; i++)
4071- {
4072- ubuntu_ev.details.motion.pointer_coordinates[i].id = mir_event->motion.pointer_coordinates[i].id;
4073- ubuntu_ev.details.motion.pointer_coordinates[i].x = mir_event->motion.pointer_coordinates[i].x;
4074- ubuntu_ev.details.motion.pointer_coordinates[i].raw_x = mir_event->motion.pointer_coordinates[i].raw_x;
4075- ubuntu_ev.details.motion.pointer_coordinates[i].y = mir_event->motion.pointer_coordinates[i].y;
4076- ubuntu_ev.details.motion.pointer_coordinates[i].raw_y = mir_event->motion.pointer_coordinates[i].raw_y;
4077- ubuntu_ev.details.motion.pointer_coordinates[i].touch_major = mir_event->motion.pointer_coordinates[i].touch_major;
4078- ubuntu_ev.details.motion.pointer_coordinates[i].touch_minor = mir_event->motion.pointer_coordinates[i].touch_minor;
4079- ubuntu_ev.details.motion.pointer_coordinates[i].size = mir_event->motion.pointer_coordinates[i].size;
4080- ubuntu_ev.details.motion.pointer_coordinates[i].pressure = mir_event->motion.pointer_coordinates[i].pressure;
4081- ubuntu_ev.details.motion.pointer_coordinates[i].orientation = mir_event->motion.pointer_coordinates[i].orientation;
4082- }
4083- break;
4084- default:
4085- break;
4086- }
4087-}
4088
4089=== removed file 'src/mircommon/event_helpers_mir.h'
4090--- src/mircommon/event_helpers_mir.h 2013-06-05 20:02:14 +0000
4091+++ src/mircommon/event_helpers_mir.h 1970-01-01 00:00:00 +0000
4092@@ -1,39 +0,0 @@
4093-/*
4094- * Copyright (C) 2013 Canonical Ltd
4095- *
4096- * This program is free software: you can redistribute it and/or modify
4097- * it under the terms of the GNU Lesser General Public License version 3 as
4098- * published by the Free Software Foundation.
4099- *
4100- * This program is distributed in the hope that it will be useful,
4101- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4102- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4103- * GNU Lesser General Public License for more details.
4104- *
4105- * You should have received a copy of the GNU Lesser General Public License
4106- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4107- *
4108- * Authored by: Robert Carr <robert.carr@canonical.com>
4109- */
4110-
4111-#ifndef UBUNTU_EVENT_HELPERS_MIR_COMMON_H_
4112-#define UBUNTU_EVENT_HELPERS_MIR_COMMON_H_
4113-
4114-#include <ubuntu/application/ui/input/event.h>
4115-#include <mir_toolkit/event.h>
4116-
4117-namespace ubuntu
4118-{
4119-namespace application
4120-{
4121-namespace ui
4122-{
4123-namespace mir
4124-{
4125-void event_to_ubuntu_event(MirEvent const* mir_event, Event& ubuntu_ev);
4126-}
4127-}
4128-}
4129-}
4130-
4131-#endif // UBUNTU_EVENT_HELPERS_MIR_COMMON_H_
4132
4133=== removed file 'src/mircommon/lifecycle_delegate_mir.cpp'
4134--- src/mircommon/lifecycle_delegate_mir.cpp 2013-06-07 17:23:48 +0000
4135+++ src/mircommon/lifecycle_delegate_mir.cpp 1970-01-01 00:00:00 +0000
4136@@ -1,136 +0,0 @@
4137-/*
4138- * Copyright (C) 2013 Canonical Ltd
4139- *
4140- * This program is free software: you can redistribute it and/or modify
4141- * it under the terms of the GNU Lesser General Public License version 3 as
4142- * published by the Free Software Foundation.
4143- *
4144- * This program is distributed in the hope that it will be useful,
4145- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4146- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4147- * GNU Lesser General Public License for more details.
4148- *
4149- * You should have received a copy of the GNU Lesser General Public License
4150- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4151- *
4152- * Authored by: Robert Carr <robert.carr@canonical.com>
4153- */
4154-
4155-#include "lifecycle_delegate_mir_priv.h"
4156-
4157-namespace uam = ubuntu::application::mir;
4158-
4159-// TODO<papi, mir>: This implementation as a stub as we
4160-// currently don't do anything with this in Mir. I am not sure
4161-// what exactly we should be doing either so we need some alignment
4162-// on this.
4163-
4164-uam::LifecycleDelegate::LifecycleDelegate()
4165- : resumed_cb(nullptr),
4166- stop_cb(nullptr),
4167- ctx(nullptr)
4168-{
4169-}
4170-
4171-UApplicationLifecycleDelegate* uam::LifecycleDelegate::as_u_lifecycle_delegate()
4172-{
4173- return static_cast<UApplicationLifecycleDelegate*>(this);
4174-}
4175-
4176-uam::LifecycleDelegate* uam::LifecycleDelegate::from_u_lifecycle_delegate(UApplicationLifecycleDelegate *u_delegate)
4177-{
4178- return static_cast<uam::LifecycleDelegate*>(u_delegate);
4179-}
4180-
4181-void uam::LifecycleDelegate::ref()
4182-{
4183- ref_count++;
4184-}
4185-
4186-void uam::LifecycleDelegate::unref()
4187-{
4188- ref_count--;
4189- if (ref_count == 0)
4190- delete this;
4191-}
4192-
4193-
4194-extern "C"
4195-{
4196-
4197-UApplicationLifecycleDelegate*
4198-u_application_lifecycle_delegate_new()
4199-{
4200- return (new uam::LifecycleDelegate)->as_u_lifecycle_delegate();
4201-}
4202-
4203-void
4204-u_application_lifecycle_delegate_destroy(UApplicationLifecycleDelegate *u_delegate)
4205-{
4206- auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate);
4207-
4208- // TODO: What are the intended semantics of this?
4209- delegate->unref();
4210-}
4211-
4212-void
4213-u_application_lifecycle_delegate_ref(UApplicationLifecycleDelegate *u_delegate)
4214-{
4215- auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate);
4216- delegate->ref();
4217-}
4218-
4219-void
4220-u_application_lifecycle_delegate_unref(UApplicationLifecycleDelegate *u_delegate)
4221-{
4222- auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate);
4223- delegate->unref();
4224-}
4225-
4226-void
4227-u_application_lifecycle_delegate_set_application_resumed_cb(UApplicationLifecycleDelegate *u_delegate,
4228- u_on_application_resumed cb)
4229-{
4230- auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate);
4231- delegate->resumed_cb = cb;
4232-}
4233-
4234-u_on_application_resumed
4235-u_application_lifecycle_delegate_get_application_resumed_cb(UApplicationLifecycleDelegate *u_delegate)
4236-{
4237- auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate);
4238- return delegate->resumed_cb;
4239-}
4240-
4241-void
4242-u_application_lifecycle_delegate_set_application_about_to_stop_cb(UApplicationLifecycleDelegate *u_delegate,
4243- u_on_application_about_to_stop cb)
4244-{
4245- auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate);
4246- delegate->stop_cb = cb;
4247-}
4248-
4249-u_on_application_about_to_stop
4250-u_application_lifecycle_delegate_get_application_about_to_stop_cb(UApplicationLifecycleDelegate *u_delegate)
4251-{
4252- auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate);
4253- return delegate->stop_cb;
4254-}
4255-
4256-void
4257-u_application_lifecycle_delegate_set_context(UApplicationLifecycleDelegate *u_delegate,
4258- void *context)
4259-{
4260- auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate);
4261- delegate->ctx = context;
4262-}
4263-
4264-void*
4265-u_application_lifecycle_delegate_get_context(UApplicationLifecycleDelegate *u_delegate,
4266- void *context)
4267-{
4268- auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate);
4269- return delegate->ctx;
4270-}
4271-
4272-}
4273
4274=== removed file 'src/mircommon/lifecycle_delegate_mir_priv.h'
4275--- src/mircommon/lifecycle_delegate_mir_priv.h 2013-06-07 17:23:48 +0000
4276+++ src/mircommon/lifecycle_delegate_mir_priv.h 1970-01-01 00:00:00 +0000
4277@@ -1,59 +0,0 @@
4278-/*
4279- * Copyright (C) 2013 Canonical Ltd
4280- *
4281- * This program is free software: you can redistribute it and/or modify
4282- * it under the terms of the GNU Lesser General Public License version 3 as
4283- * published by the Free Software Foundation.
4284- *
4285- * This program is distributed in the hope that it will be useful,
4286- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4287- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4288- * GNU Lesser General Public License for more details.
4289- *
4290- * You should have received a copy of the GNU Lesser General Public License
4291- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4292- *
4293- * Authored by: Robert Carr <robert.carr@canonical.com>
4294- */
4295-
4296-#ifndef UBUNTU_APPLICATION_LIECYCLE_DELEGATE_MIR_PRIV_H_
4297-#define UBUNTU_APPLICATION_LIECYCLE_DELEGATE_MIR_PRIV_H_
4298-
4299-#include <ubuntu/application/lifecycle_delegate.h>
4300-
4301-namespace ubuntu
4302-{
4303-namespace application
4304-{
4305-namespace mir
4306-{
4307-
4308-class LifecycleDelegate
4309-{
4310-public:
4311- LifecycleDelegate();
4312- ~LifecycleDelegate() = default;
4313-
4314- UApplicationLifecycleDelegate* as_u_lifecycle_delegate();
4315- static LifecycleDelegate* from_u_lifecycle_delegate(UApplicationLifecycleDelegate *u_delegate);
4316-
4317- void ref();
4318- void unref();
4319-
4320- u_on_application_resumed resumed_cb;
4321- u_on_application_about_to_stop stop_cb;
4322- void *ctx;
4323-
4324-protected:
4325- LifecycleDelegate(LifecycleDelegate const&) = delete;
4326- LifecycleDelegate& operator=(LifecycleDelegate const&) = delete;
4327-
4328-private:
4329- unsigned int ref_count;
4330-};
4331-
4332-}
4333-}
4334-}
4335-
4336-#endif // UBUNTU_APPLICATION_LIECYCLE_DELEGATE_MIR_PRIV_H_
4337
4338=== removed file 'src/mircommon/session_mir.cpp'
4339--- src/mircommon/session_mir.cpp 2013-06-21 17:03:18 +0000
4340+++ src/mircommon/session_mir.cpp 1970-01-01 00:00:00 +0000
4341@@ -1,51 +0,0 @@
4342-/*
4343- * Copyright (C) 2013 Canonical Ltd
4344- *
4345- * This program is free software: you can redistribute it and/or modify
4346- * it under the terms of the GNU Lesser General Public License version 3 as
4347- * published by the Free Software Foundation.
4348- *
4349- * This program is distributed in the hope that it will be useful,
4350- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4351- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4352- * GNU Lesser General Public License for more details.
4353- *
4354- * You should have received a copy of the GNU Lesser General Public License
4355- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4356- *
4357- * Authored by: Robert Carr <robert.carr@canonical.com>
4358- */
4359-
4360-#include <ubuntu/application/ui/session.h>
4361-
4362-// TODO<papi>: Not sure what this should do for mir. ApplicationInstance maps to the mir
4363-// concept of a session and this doesn't really seem to be used
4364-
4365-extern "C"
4366-{
4367-
4368-UAUiSession* ua_ui_session_new_with_properties(UAUiSessionProperties *properties)
4369-{
4370- return nullptr;
4371-}
4372-
4373-UAUiSessionProperties* ua_ui_session_properties_new()
4374-{
4375- return nullptr;
4376-}
4377-
4378-void ua_ui_session_properties_set_type(UAUiSessionProperties* properties,
4379- UAUiSessionType type)
4380-{
4381- (void) properties;
4382- (void) type;
4383-}
4384-
4385-void ua_ui_session_properties_set_remote_pid(UAUiSessionProperties* properties,
4386- uint32_t pid)
4387-{
4388- (void) properties;
4389- (void) pid;
4390-}
4391-
4392-}
4393
4394=== removed file 'src/mircommon/ubuntu_application_sensors_desktop.cpp'
4395--- src/mircommon/ubuntu_application_sensors_desktop.cpp 2013-06-05 23:47:51 +0000
4396+++ src/mircommon/ubuntu_application_sensors_desktop.cpp 1970-01-01 00:00:00 +0000
4397@@ -1,190 +0,0 @@
4398-/*
4399- * Copyright (C) 2012 Canonical Ltd
4400- *
4401- * This program is free software: you can redistribute it and/or modify
4402- * it under the terms of the GNU Lesser General Public License version 3 as
4403- * published by the Free Software Foundation.
4404- *
4405- * This program is distributed in the hope that it will be useful,
4406- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4407- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4408- * GNU Lesser General Public License for more details.
4409- *
4410- * You should have received a copy of the GNU Lesser General Public License
4411- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4412- *
4413- * Authored by: Thomas Voss <thomas.voss@canonical.com>
4414- * Ricardo Mendoza <ricardo.mendoza@canonical.com>
4415- */
4416-
4417-#include <ubuntu/application/sensors/accelerometer.h>
4418-#include <ubuntu/application/sensors/proximity.h>
4419-#include <ubuntu/application/sensors/light.h>
4420-
4421-#include <stddef.h>
4422-
4423-// Ubuntu Application Sensors. Null desktop implementation
4424-
4425-// Acceleration Sensor
4426-UASensorsAccelerometer* ua_sensors_accelerometer_new()
4427-{
4428- return NULL;
4429-}
4430-
4431-UStatus ua_sensors_accelerometer_enable(UASensorsAccelerometer*)
4432-{
4433- return (UStatus) 0;
4434-}
4435-
4436-UStatus ua_sensors_accelerometer_disable(UASensorsAccelerometer*)
4437-{
4438- return (UStatus) 0;
4439-}
4440-
4441-uint32_t ua_sensors_accelerometer_get_min_delay(UASensorsAccelerometer*)
4442-{
4443- return 0;
4444-}
4445-
4446-float ua_sensors_accelerometer_get_min_value(UASensorsAccelerometer*)
4447-{
4448- return 0.0;
4449-}
4450-
4451-float ua_sensors_accelerometer_get_max_value(UASensorsAccelerometer*)
4452-{
4453- return 0.0;
4454-}
4455-
4456-float ua_sensors_accelerometer_get_resolution(UASensorsAccelerometer*)
4457-{
4458- return 0.0;
4459-}
4460-
4461-void ua_sensors_accelerometer_set_reading_cb(UASensorsAccelerometer*, on_accelerometer_event_cb, void*)
4462-{
4463-}
4464-
4465-// Acceleration Sensor Event
4466-uint64_t uas_accelerometer_event_get_timestamp(UASAccelerometerEvent*)
4467-{
4468- return 0;
4469-}
4470-
4471-float uas_accelerometer_event_get_acceleration_x(UASAccelerometerEvent*)
4472-{
4473- return 0.0;
4474-}
4475-
4476-float uas_accelerometer_event_get_acceleration_y(UASAccelerometerEvent*)
4477-{
4478- return 0.0;
4479-}
4480-
4481-float uas_accelerometer_event_get_acceleration_z(UASAccelerometerEvent*)
4482-{
4483- return 0.0;
4484-}
4485-
4486-// Proximity Sensor
4487-UASensorsProximity* ua_sensors_proximity_new()
4488-{
4489- return NULL;
4490-}
4491-
4492-UStatus ua_sensors_proximity_enable(UASensorsProximity*)
4493-{
4494- return (UStatus) 0;
4495-}
4496-
4497-UStatus ua_sensors_proximity_disable(UASensorsProximity*)
4498-{
4499- return (UStatus) 0;
4500-}
4501-
4502-uint32_t ua_sensors_proximity_get_min_delay(UASensorsProximity*)
4503-{
4504- return 0;
4505-}
4506-
4507-float ua_sensors_proximity_get_min_value(UASensorsProximity*)
4508-{
4509- return 0.0;
4510-}
4511-
4512-float ua_sensors_proximity_get_max_value(UASensorsProximity*)
4513-{
4514- return 0.0;
4515-}
4516-
4517-float ua_sensors_proximity_get_resolution(UASensorsProximity*)
4518-{
4519- return 0.0;
4520-}
4521-
4522-void ua_sensors_proximity_set_reading_cb(UASensorsProximity*, on_proximity_event_cb, void*)
4523-{
4524-}
4525-
4526-// Proximity Sensor Event
4527-uint64_t uas_proximity_event_get_timestamp(UASProximityEvent*)
4528-{
4529- return 0;
4530-}
4531-
4532-UASProximityDistance uas_proximity_event_get_distance(UASProximityEvent*)
4533-{
4534- return (UASProximityDistance) 0;
4535-}
4536-
4537-
4538-// Ambient Light Sensor
4539-UASensorsLight* ua_sensors_light_new()
4540-{
4541- return NULL;
4542-}
4543-
4544-UStatus ua_sensors_light_enable(UASensorsLight*)
4545-{
4546- return (UStatus) 0;
4547-}
4548-
4549-UStatus ua_sensors_light_disable(UASensorsLight*)
4550-{
4551- return (UStatus) 0;
4552-}
4553-
4554-uint32_t ua_sensors_light_get_min_delay(UASensorsLight*)
4555-{
4556- return 0;
4557-}
4558-
4559-float ua_sensors_light_get_min_value(UASensorsLight*)
4560-{
4561- return 0.0;
4562-}
4563-
4564-float ua_sensors_light_get_max_value(UASensorsLight*)
4565-{
4566- return 0.0;
4567-}
4568-
4569-float ua_sensors_light_get_resolution(UASensorsLight*)
4570-{
4571- return 0.0;
4572-}
4573-
4574-void ua_sensors_light_set_reading_cb(UASensorsLight*, on_light_event_cb, void*)
4575-{
4576-}
4577-
4578-// Ambient Light Sensor Event
4579-uint64_t uas_light_event_get_timestamp(UASLightEvent*)
4580-{
4581- return 0;
4582-}
4583-
4584-float uas_light_event_get_light(UASLightEvent*)
4585-{
4586- return 0.0;
4587-}
4588
4589=== removed directory 'src/mirserver'
4590=== removed file 'src/mirserver/CMakeLists.txt'
4591--- src/mirserver/CMakeLists.txt 2013-07-18 09:08:17 +0000
4592+++ src/mirserver/CMakeLists.txt 1970-01-01 00:00:00 +0000
4593@@ -1,38 +0,0 @@
4594-set(SOURCES
4595- ubuntu_application_api_mirserver.cpp
4596- application_instance_mirserver.cpp
4597- window_properties_mirserver.cpp
4598- window_mirserver.cpp
4599-)
4600-
4601-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC")
4602-
4603-add_library(
4604- ubuntu_application_api_mirserver SHARED
4605- ${SOURCES}
4606-)
4607-
4608-include_directories(
4609- ${CMAKE_BINARY_DIR}/include
4610- ${MIRSERVER_INCLUDE_DIRS}
4611-)
4612-
4613-target_link_libraries(
4614- ubuntu_application_api_mirserver
4615- ${MIRSERVER_LDFLAGS} ${MIRSERVER_LIBRARIES}
4616- -Wl,--whole-archive ubuntu_application_api_mircommon
4617- -Wl,--no-whole-archive
4618-)
4619-
4620-
4621-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ubuntu_application_api_mirserver_priv.h DESTINATION include/ubuntu/priv/mirserver)
4622-
4623-set_target_properties(
4624- ubuntu_application_api_mirserver
4625- PROPERTIES
4626- VERSION 1.0
4627- SOVERSION 1
4628-)
4629-
4630-install(TARGETS ubuntu_application_api_mirserver ${INSTALL_TARGETS_DEFAULT_ARGS})
4631-install(FILES ubuntu_application_api_mirserver_priv.h DESTINATION include/ubuntu/application)
4632
4633=== removed file 'src/mirserver/application_instance_mirserver.cpp'
4634--- src/mirserver/application_instance_mirserver.cpp 2013-06-17 22:51:21 +0000
4635+++ src/mirserver/application_instance_mirserver.cpp 1970-01-01 00:00:00 +0000
4636@@ -1,83 +0,0 @@
4637-/*
4638- * Copyright (C) 2013 Canonical Ltd
4639- *
4640- * This program is free software: you can redistribute it and/or modify
4641- * it under the terms of the GNU Lesser General Public License version 3 as
4642- * published by the Free Software Foundation.
4643- *
4644- * This program is distributed in the hope that it will be useful,
4645- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4646- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4647- * GNU Lesser General Public License for more details.
4648- *
4649- * You should have received a copy of the GNU Lesser General Public License
4650- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4651- *
4652- * Authored by: Robert Carr <robert.carr@canonical.com>
4653- */
4654-
4655-#include "application_instance_mirserver_priv.h"
4656-
4657-#include "mircommon/application_description_mir_priv.h"
4658-#include "mircommon/application_options_mir_priv.h"
4659-#include "mircommon/application_id_mir_priv.h"
4660-
4661-#include <mir/shell/surface.h>
4662-#include <mir/shell/surface_factory.h>
4663-#include <mir/shell/surface_creation_parameters.h>
4664-
4665-namespace uam = ubuntu::application::mir;
4666-namespace uams = uam::server;
4667-
4668-namespace mf = mir::frontend;
4669-namespace me = mir::events;
4670-namespace msh = mir::shell;
4671-
4672-uams::Instance::Instance(std::shared_ptr<msh::SurfaceFactory> const &surface_factory,
4673- uam::Description* description_,
4674- uam::Options *options_)
4675- : surface_factory(surface_factory),
4676- ref_count(1)
4677-{
4678- description = DescriptionPtr(description_,
4679- [] (uam::Description* p)
4680- {
4681- delete p;
4682- });
4683- options = OptionsPtr(options_,
4684- [] (uam::Options* p)
4685- {
4686- delete p;
4687- });
4688-}
4689-
4690-UApplicationInstance* uams::Instance::as_u_application_instance()
4691-{
4692- return static_cast<UApplicationInstance*>(this);
4693-}
4694-
4695-uams::Instance* uams::Instance::from_u_application_instance(UApplicationInstance *u_instance)
4696-{
4697- return static_cast<uams::Instance*>(u_instance);
4698-}
4699-
4700-void uams::Instance::ref()
4701-{
4702- ref_count++;
4703-}
4704-
4705-void uams::Instance::unref()
4706-{
4707- ref_count--;
4708- if (ref_count == 0)
4709- delete this;
4710-}
4711-
4712-std::shared_ptr<msh::Surface> uams::Instance::create_surface(msh::SurfaceCreationParameters const& parameters)
4713-{
4714- static std::shared_ptr<me::EventSink> const null_event_sink{nullptr};
4715- static mf::SurfaceId const default_surface_id{0};
4716-
4717- return surface_factory->create_surface(parameters, default_surface_id,
4718- null_event_sink);
4719-}
4720
4721=== removed file 'src/mirserver/application_instance_mirserver_priv.h'
4722--- src/mirserver/application_instance_mirserver_priv.h 2013-06-17 22:51:21 +0000
4723+++ src/mirserver/application_instance_mirserver_priv.h 1970-01-01 00:00:00 +0000
4724@@ -1,85 +0,0 @@
4725-/*
4726- * Copyright (C) 2013 Canonical Ltd
4727- *
4728- * This program is free software: you can redistribute it and/or modify
4729- * it under the terms of the GNU Lesser General Public License version 3 as
4730- * published by the Free Software Foundation.
4731- *
4732- * This program is distributed in the hope that it will be useful,
4733- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4734- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4735- * GNU Lesser General Public License for more details.
4736- *
4737- * You should have received a copy of the GNU Lesser General Public License
4738- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4739- *
4740- * Authored by: Robert Carr <robert.carr@canonical.com>
4741- */
4742-
4743-#ifndef UBUNTU_APPLICATION_INSTANCE_MIRSERVER_PRIV_H_
4744-#define UBUNTU_APPLICATION_INSTANCE_MIRSERVER_PRIV_H_
4745-
4746-#include <ubuntu/application/instance.h>
4747-
4748-#include <memory>
4749-#include <functional>
4750-
4751-namespace mir
4752-{
4753-namespace shell
4754-{
4755-class SurfaceCreationParameters;
4756-class Surface;
4757-class SurfaceFactory;
4758-}
4759-}
4760-
4761-namespace ubuntu
4762-{
4763-namespace application
4764-{
4765-namespace mir
4766-{
4767-class Description;
4768-class Options;
4769-
4770-namespace server
4771-{
4772-
4773-class Instance
4774-{
4775-public:
4776- Instance(std::shared_ptr< ::mir::shell::SurfaceFactory> const& surface_factory,
4777- ubuntu::application::mir::Description* description,
4778- ubuntu::application::mir::Options *options);
4779- ~Instance() = default;
4780-
4781- UApplicationInstance* as_u_application_instance();
4782- static Instance* from_u_application_instance(UApplicationInstance* u_instance);
4783-
4784- void ref();
4785- void unref();
4786-
4787- std::shared_ptr< ::mir::shell::Surface> create_surface( ::mir::shell::SurfaceCreationParameters const& parameters);
4788-
4789-protected:
4790- Instance(Instance const&) = delete;
4791- Instance& operator=(Instance const&) = delete;
4792-
4793-private:
4794- typedef std::unique_ptr<Description, std::function<void(Description*)>> DescriptionPtr;
4795- typedef std::unique_ptr<Options, std::function<void(Options*)>> OptionsPtr;
4796-
4797- OptionsPtr options;
4798- DescriptionPtr description;
4799-
4800- std::shared_ptr< ::mir::shell::SurfaceFactory> const surface_factory;
4801- int ref_count;
4802-};
4803-
4804-}
4805-}
4806-}
4807-} // namespace ubuntu
4808-
4809-#endif // UBUNTU_APPLICATION_INSTANCE_MIRSERVER_PRIV_H_
4810
4811=== removed file 'src/mirserver/ubuntu_application_api_mirserver.cpp'
4812--- src/mirserver/ubuntu_application_api_mirserver.cpp 2013-06-17 22:51:21 +0000
4813+++ src/mirserver/ubuntu_application_api_mirserver.cpp 1970-01-01 00:00:00 +0000
4814@@ -1,320 +0,0 @@
4815-/*
4816- * Copyright (C) 2013 Canonical Ltd
4817- *
4818- * This program is free software: you can redistribute it and/or modify
4819- * it under the terms of the GNU Lesser General Public License version 3 as
4820- * published by the Free Software Foundation.
4821- *
4822- * This program is distributed in the hope that it will be useful,
4823- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4824- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4825- * GNU Lesser General Public License for more details.
4826- *
4827- * You should have received a copy of the GNU Lesser General Public License
4828- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4829- *
4830- * Authored by: Robert Carr <robert.carr@canonical.com>
4831- */
4832-
4833-#include "ubuntu_application_api_mirserver_priv.h"
4834-#include "application_instance_mirserver_priv.h"
4835-#include "window_properties_mirserver_priv.h"
4836-#include "window_mirserver_priv.h"
4837-
4838-#include "mircommon/application_id_mir_priv.h"
4839-#include "mircommon/application_description_mir_priv.h"
4840-#include "mircommon/application_options_mir_priv.h"
4841-
4842-// C APIs
4843-#include <ubuntu/application/lifecycle_delegate.h>
4844-#include <ubuntu/application/ui/window.h>
4845-#include <ubuntu/application/ui/options.h>
4846-#include <ubuntu/application/ui/session.h>
4847-#include <ubuntu/application/ui/clipboard.h>
4848-#include <ubuntu/application/ui/display.h>
4849-#include <ubuntu/application/sensors/accelerometer.h>
4850-#include <ubuntu/application/sensors/proximity.h>
4851-#include <ubuntu/application/sensors/light.h>
4852-
4853-#include <mir/default_server_configuration.h>
4854-
4855-#include <mir/graphics/display.h>
4856-#include <mir/graphics/platform.h>
4857-#include <mir/compositor/graphic_buffer_allocator.h>
4858-#include <mir/frontend/session.h>
4859-#include <mir/frontend/shell.h>
4860-#include <mir/shell/surface_creation_parameters.h>
4861-#include <mir/shell/surface.h>
4862-#include <mir/graphics/internal_client.h>
4863-#include <mir/input/input_platform.h>
4864-
4865-#include <assert.h>
4866-
4867-#include <memory>
4868-#include <functional>
4869-
4870-namespace uam = ubuntu::application::mir;
4871-namespace uams = ubuntu::application::mir::server;
4872-
4873-namespace
4874-{
4875-
4876-struct MirServerContext
4877-{
4878- std::shared_ptr<mir::graphics::Display> display;
4879- std::shared_ptr<mir::compositor::GraphicBufferAllocator> buffer_allocator;
4880- std::shared_ptr<mir::shell::SurfaceFactory> surface_factory;
4881- std::shared_ptr<mir::input::receiver::InputPlatform> input_platform;
4882- std::shared_ptr<mir::graphics::InternalClient> egl_client;
4883-};
4884-
4885-MirServerContext *
4886-global_mirserver_context()
4887-{
4888- static MirServerContext context;
4889- return &context;
4890-}
4891-
4892-extern "C"
4893-{
4894-void ua_ui_mirserver_init(mir::DefaultServerConfiguration& config)
4895-{
4896- auto context = global_mirserver_context();
4897-
4898- context->display = config.the_display();
4899- context->buffer_allocator = config.the_buffer_allocator();
4900- context->surface_factory = config.the_shell_surface_factory();
4901- context->input_platform = mir::input::receiver::InputPlatform::create();
4902- context->egl_client = config.the_graphics_platform()->create_internal_client();
4903-}
4904-
4905-void ua_ui_mirserver_finish()
4906-{
4907- auto context = global_mirserver_context();
4908-
4909- context->display.reset();
4910- context->surface_factory.reset();
4911- context->input_platform.reset();
4912- context->egl_client.reset();
4913-}
4914-}
4915-
4916-}
4917-
4918-
4919-extern "C"
4920-{
4921-
4922-UApplicationInstance* u_application_instance_new_from_description_with_options(UApplicationDescription* u_description, UApplicationOptions* u_options)
4923-{
4924- auto surface_factory = global_mirserver_context()->surface_factory;
4925- assert(surface_factory);
4926-
4927- auto description = uam::Description::from_u_application_description(u_description);
4928- auto options = uam::Options::from_u_application_options(u_options);
4929-
4930- auto instance = new uams::Instance(surface_factory, description, options);
4931-
4932- return instance->as_u_application_instance();
4933-}
4934-
4935-void
4936-u_application_instance_ref(UApplicationInstance *u_instance)
4937-{
4938- auto instance = uams::Instance::from_u_application_instance(u_instance);
4939- instance->ref();
4940-}
4941-
4942-void
4943-u_application_instance_unref(UApplicationInstance *u_instance)
4944-{
4945- auto instance = uams::Instance::from_u_application_instance(u_instance);
4946- instance->unref();
4947-}
4948-
4949-void
4950-u_application_instance_destroy(UApplicationInstance *instance)
4951-{
4952- // TODO<papi>: What are the proper semantics here.
4953- u_application_instance_unref(instance);
4954-}
4955-
4956-void
4957-u_application_instance_run(UApplicationInstance *instance)
4958-{
4959- // TODO<papi>: What is this supposed to do? Seems to be no-op on hybris.
4960- (void) instance;
4961-}
4962-
4963-void ua_ui_set_clipboard_content(void* content, size_t content_size)
4964-{
4965- // TODO<mir,papi>: Implement. Probably need more arguments?
4966- (void) content;
4967- (void) content_size;
4968-}
4969-
4970-void ua_ui_get_clipboard_content(void** out_content, size_t* out_content_size)
4971-{
4972- // TODO<mir,papi>: Implement
4973- *out_content = NULL;
4974- *out_content_size = 0;
4975-}
4976-
4977-UAUiDisplay* ua_ui_display_new_with_index(size_t index)
4978-{
4979- // TODO<mir>: Make use of index. This is kind of strangely done...
4980- return reinterpret_cast<UAUiDisplay*>(index);
4981-}
4982-
4983-void ua_ui_display_destroy(UAUiDisplay* display)
4984-{
4985- // TODO: Implement. Or is this a noop for mirserver?
4986- (void) display;
4987-}
4988-
4989-uint32_t ua_ui_display_query_horizontal_res(UAUiDisplay* display)
4990-{
4991- (void) display; // TODO<mir>: Multiple displays
4992-
4993- auto mir_display = global_mirserver_context()->display;
4994- assert(mir_display);
4995-
4996- return mir_display->view_area().size.width.as_uint32_t();
4997-}
4998-
4999-uint32_t ua_ui_display_query_vertical_res(UAUiDisplay* display)
5000-{
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches