Merge lp:~albaguirre/qtubuntu/migrate-to-papi3 into lp:qtubuntu

Proposed by Alberto Aguirre
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: 266
Merged at revision: 268
Proposed branch: lp:~albaguirre/qtubuntu/migrate-to-papi3
Merge into: lp:qtubuntu
Diff against target: 197 lines (+47/-22)
6 files modified
debian/control (+2/-2)
src/ubuntumirclient/integration.cpp (+1/-1)
src/ubuntumirclient/integration.h (+0/-4)
src/ubuntumirclient/screen.cpp (+38/-12)
src/ubuntumirclient/screen.h (+3/-1)
src/ubuntumirclient/window.cpp (+3/-2)
To merge this branch: bzr merge lp:~albaguirre/qtubuntu/migrate-to-papi3
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) Approve
Andreas Pokorny (community) Approve
Kevin DuBois (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+262746@code.launchpad.net

Commit message

Migrate to platform-api 3

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

merge lp:qtubuntu

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
265. By Alberto Aguirre

Use mirclient api directly to obtain eglNativeDisplay and display mode resolution.

ua_ui_display_xxx apis no longer exist in platform-api 3

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
266. By Alberto Aguirre

Cleanup usage of non-existant platform-api headers and types.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

lgtm

review: Approve
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

looks reasonable

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

looks ok. works fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2015-06-17 13:46:39 +0000
+++ debian/control 2015-06-24 17:21:38 +0000
@@ -41,7 +41,7 @@
41 ${shlibs:Depends},41 ${shlibs:Depends},
42 libqt5sensors5,42 libqt5sensors5,
43 qtubuntu-sensors,43 qtubuntu-sensors,
44 ubuntu-application-api2-touch,44 ubuntu-application-api3-touch,
45Description: Qt plugins for Ubuntu Platform API (mobile)45Description: Qt plugins for Ubuntu Platform API (mobile)
46 QtUbuntu is a set of Qt5 components for the Ubuntu Platform API. It contains a46 QtUbuntu is a set of Qt5 components for the Ubuntu Platform API. It contains a
47 QPA (Qt Platform Abstraction) plugin based on the Ubuntu Platform API and a47 QPA (Qt Platform Abstraction) plugin based on the Ubuntu Platform API and a
@@ -64,7 +64,7 @@
64 ${shlibs:Depends},64 ${shlibs:Depends},
65 libqt5sensors5,65 libqt5sensors5,
66 qtubuntu-sensors,66 qtubuntu-sensors,
67 ubuntu-application-api2-desktop,67 ubuntu-application-api3-desktop,
68Description: Qt plugins for Ubuntu Platform API (desktop)68Description: Qt plugins for Ubuntu Platform API (desktop)
69 QtUbuntu is a set of Qt5 components for the Ubuntu Platform API. It contains a69 QtUbuntu is a set of Qt5 components for the Ubuntu Platform API. It contains a
70 QPA (Qt Platform Abstraction) plugin based on the Ubuntu Platform API and a70 QPA (Qt Platform Abstraction) plugin based on the Ubuntu Platform API and a
7171
=== modified file 'src/ubuntumirclient/integration.cpp'
--- src/ubuntumirclient/integration.cpp 2015-02-04 16:14:43 +0000
+++ src/ubuntumirclient/integration.cpp 2015-06-24 17:21:38 +0000
@@ -80,7 +80,7 @@
80 "rejected the incoming connection, so check its log file");80 "rejected the incoming connection, so check its log file");
8181
82 // Create default screen.82 // Create default screen.
83 mScreen = new UbuntuScreen;83 mScreen = new UbuntuScreen(u_application_instance_get_mir_connection(mInstance));
84 screenAdded(mScreen);84 screenAdded(mScreen);
8585
86 // Initialize input.86 // Initialize input.
8787
=== modified file 'src/ubuntumirclient/integration.h'
--- src/ubuntumirclient/integration.h 2014-09-22 17:29:40 +0000
+++ src/ubuntumirclient/integration.h 2015-06-24 17:21:38 +0000
@@ -25,8 +25,6 @@
25// platform-api25// platform-api
26#include <ubuntu/application/description.h>26#include <ubuntu/application/description.h>
27#include <ubuntu/application/instance.h>27#include <ubuntu/application/instance.h>
28#include <ubuntu/application/ui/options.h>
29#include <ubuntu/application/ui/session.h>
3028
31class UbuntuClipboard;29class UbuntuClipboard;
32class UbuntuInput;30class UbuntuInput;
@@ -75,8 +73,6 @@
75 UApplicationOptions* mOptions;73 UApplicationOptions* mOptions;
76 UApplicationDescription* mDesc;74 UApplicationDescription* mDesc;
77 UApplicationInstance* mInstance;75 UApplicationInstance* mInstance;
78 UAUiSessionProperties* mProps;
79 UAUiSession* mSession;
80};76};
8177
82#endif // UBUNTU_CLIENT_INTEGRATION_H78#endif // UBUNTU_CLIENT_INTEGRATION_H
8379
=== modified file 'src/ubuntumirclient/screen.cpp'
--- src/ubuntumirclient/screen.cpp 2015-03-19 16:22:05 +0000
+++ src/ubuntumirclient/screen.cpp 2015-06-24 17:21:38 +0000
@@ -14,6 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include <mir_toolkit/mir_client_library.h>
18
17// Qt19// Qt
18#include <QCoreApplication>20#include <QCoreApplication>
19#include <QtCore/qmath.h>21#include <QtCore/qmath.h>
@@ -27,9 +29,7 @@
27#include "logging.h"29#include "logging.h"
28#include "orientationchangeevent_p.h"30#include "orientationchangeevent_p.h"
2931
30// platform-api32#include "memory"
31#include <ubuntu/application/ui/display.h>
32#include <ubuntu/application/ui/options.h>
3333
34static const int kSwapInterval = 1;34static const int kSwapInterval = 1;
3535
@@ -104,8 +104,28 @@
104const QEvent::Type OrientationChangeEvent::mType =104const QEvent::Type OrientationChangeEvent::mType =
105 static_cast<QEvent::Type>(QEvent::registerEventType());105 static_cast<QEvent::Type>(QEvent::registerEventType());
106106
107107static const MirDisplayOutput *find_active_output(
108UbuntuScreen::UbuntuScreen()108 const MirDisplayConfiguration *conf)
109{
110 const MirDisplayOutput *output = NULL;
111 for (uint32_t d = 0; d < conf->num_outputs; d++)
112 {
113 const MirDisplayOutput *out = conf->outputs + d;
114
115 if (out->used &&
116 out->connected &&
117 out->num_modes &&
118 out->current_mode < out->num_modes)
119 {
120 output = out;
121 break;
122 }
123 }
124
125 return output;
126}
127
128UbuntuScreen::UbuntuScreen(MirConnection *connection)
109 : mFormat(QImage::Format_RGB32)129 : mFormat(QImage::Format_RGB32)
110 , mDepth(32)130 , mDepth(32)
111 , mSurfaceFormat()131 , mSurfaceFormat()
@@ -115,10 +135,8 @@
115 // Initialize EGL.135 // Initialize EGL.
116 ASSERT(eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE);136 ASSERT(eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE);
117137
118 UAUiDisplay* u_display = ua_ui_display_new_with_index(0);138 mEglNativeDisplay = mir_connection_get_egl_native_display(connection);
119 mEglNativeDisplay = ua_ui_display_get_native_type(u_display);
120 ASSERT((mEglDisplay = eglGetDisplay(mEglNativeDisplay)) != EGL_NO_DISPLAY);139 ASSERT((mEglDisplay = eglGetDisplay(mEglNativeDisplay)) != EGL_NO_DISPLAY);
121 ua_ui_display_destroy(u_display);
122 ASSERT(eglInitialize(mEglDisplay, nullptr, nullptr) == EGL_TRUE);140 ASSERT(eglInitialize(mEglDisplay, nullptr, nullptr) == EGL_TRUE);
123141
124 // Configure EGL buffers format.142 // Configure EGL buffers format.
@@ -156,12 +174,20 @@
156 eglSwapInterval(mEglDisplay, swapInterval);174 eglSwapInterval(mEglDisplay, swapInterval);
157175
158 // Get screen resolution.176 // Get screen resolution.
159 UAUiDisplay* display = ua_ui_display_new_with_index(0);177 auto configDeleter = [](MirDisplayConfiguration *config) { mir_display_config_destroy(config); };
160 const int kScreenWidth = ua_ui_display_query_horizontal_res(display);178 using configUp = std::unique_ptr<MirDisplayConfiguration, decltype(configDeleter)>;
161 const int kScreenHeight = ua_ui_display_query_vertical_res(display);179 configUp displayConfig(mir_connection_create_display_config(connection), configDeleter);
180 ASSERT(displayConfig != nullptr);
181
182 auto const displayOutput = find_active_output(displayConfig.get());
183 ASSERT(displayOutput != nullptr);
184
185 const MirDisplayMode *mode = &displayOutput->modes[displayOutput->current_mode];
186 const int kScreenWidth = mode->horizontal_resolution;
187 const int kScreenHeight = mode->vertical_resolution;
162 DASSERT(kScreenWidth > 0 && kScreenHeight > 0);188 DASSERT(kScreenWidth > 0 && kScreenHeight > 0);
189
163 DLOG("ubuntumirclient: screen resolution: %dx%d", kScreenWidth, kScreenHeight);190 DLOG("ubuntumirclient: screen resolution: %dx%d", kScreenWidth, kScreenHeight);
164 ua_ui_display_destroy(display);
165191
166 mGeometry = QRect(0, 0, kScreenWidth, kScreenHeight);192 mGeometry = QRect(0, 0, kScreenWidth, kScreenHeight);
167193
168194
=== modified file 'src/ubuntumirclient/screen.h'
--- src/ubuntumirclient/screen.h 2015-03-19 16:22:05 +0000
+++ src/ubuntumirclient/screen.h 2015-06-24 17:21:38 +0000
@@ -21,11 +21,13 @@
21#include <QSurfaceFormat>21#include <QSurfaceFormat>
22#include <EGL/egl.h>22#include <EGL/egl.h>
2323
24struct MirConnection;
25
24class UbuntuScreen : public QObject, public QPlatformScreen26class UbuntuScreen : public QObject, public QPlatformScreen
25{27{
26 Q_OBJECT28 Q_OBJECT
27public:29public:
28 UbuntuScreen();30 UbuntuScreen(MirConnection *connection);
29 virtual ~UbuntuScreen();31 virtual ~UbuntuScreen();
3032
31 // QPlatformScreen methods.33 // QPlatformScreen methods.
3234
=== modified file 'src/ubuntumirclient/window.cpp'
--- src/ubuntumirclient/window.cpp 2015-06-02 19:31:40 +0000
+++ src/ubuntumirclient/window.cpp 2015-06-24 17:21:38 +0000
@@ -31,7 +31,6 @@
3131
32// Platform API32// Platform API
33#include <ubuntu/application/instance.h>33#include <ubuntu/application/instance.h>
34#include <ubuntu/application/ui/window.h>
3534
36#include <EGL/egl.h>35#include <EGL/egl.h>
3736
@@ -212,6 +211,8 @@
212{211{
213 DLOG("UbuntuWindow::createWindow (this=%p)", this);212 DLOG("UbuntuWindow::createWindow (this=%p)", this);
214213
214 // FIXME: remove this remnant of an old platform-api enum - needs ubuntu-keyboard update
215 const int SCREEN_KEYBOARD_ROLE = 7;
215 // Get surface role and flags.216 // Get surface role and flags.
216 QVariant roleVariant = window()->property("role");217 QVariant roleVariant = window()->property("role");
217 int role = roleVariant.isValid() ? roleVariant.toUInt() : 1; // 1 is the default role for apps.218 int role = roleVariant.isValid() ? roleVariant.toUInt() : 1; // 1 is the default role for apps.
@@ -260,7 +261,7 @@
260 geometry.x(), geometry.y(), geometry.width(), geometry.height(), title.data());261 geometry.x(), geometry.y(), geometry.width(), geometry.height(), title.data());
261262
262 MirSurfaceSpec *spec;263 MirSurfaceSpec *spec;
263 if (role == U_ON_SCREEN_KEYBOARD_ROLE)264 if (role == SCREEN_KEYBOARD_ROLE)
264 {265 {
265 spec = mir_connection_create_spec_for_input_method(d->connection, geometry.width(),266 spec = mir_connection_create_spec_for_input_method(d->connection, geometry.width(),
266 geometry.height(), mir_choose_default_pixel_format(d->connection));267 geometry.height(), mir_choose_default_pixel_format(d->connection));

Subscribers

People subscribed via source and target branches