Merge lp:~fboucault/unity-2d/opengl_switch into lp:unity-2d/3.0

Proposed by Florian Boucault
Status: Merged
Approved by: Ricardo Salveti
Approved revision: 553
Merged at revision: 553
Proposed branch: lp:~fboucault/unity-2d/opengl_switch
Merge into: lp:unity-2d/3.0
Diff against target: 245 lines (+85/-6)
13 files modified
CMakeLists.txt (+1/-0)
launcher/app/launcher.cpp (+2/-0)
launcher/app/launcherview.cpp (+1/-1)
launcher/app/launcherview.h (+3/-1)
libunity-2d-private/src/CMakeLists.txt (+2/-0)
libunity-2d-private/src/unity2ddeclarativeview.cpp (+37/-0)
libunity-2d-private/src/unity2ddeclarativeview.h (+27/-0)
places/app/dashdeclarativeview.cpp (+1/-1)
places/app/dashdeclarativeview.h (+2/-1)
places/app/places.cpp (+3/-0)
spread/app/spread.cpp (+2/-0)
spread/app/spreadview.cpp (+1/-1)
spread/app/spreadview.h (+3/-1)
To merge this branch: bzr merge lp:~fboucault/unity-2d/opengl_switch
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
Olivier Tilloy Pending
Review via email: mp+59530@code.launchpad.net

Description of the change

[dash, launcher, spread] Added a new command line switch (-opengl) that triggers the use of a QGLWidget for the QML viewport.

To post a comment you must log in.
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Code seems fine, and was able to test and confirm the opengl usage when using with -opengl.

The initial broken window for places is also gone, as we're also using the raster engine.

Just remember that an additional change is needed at the package side, to add libqt4-opengl-dev as build-depends.

review: Approve
Revision history for this message
Olivier Tilloy (osomon) wrote :

@Ricardo: the status of a MR should not be set to Approved until all the necessary changes/fixes have been applied. This is because the buildbot is automatically merging approved MRs. The latest nightly build on ARM failed precisely because of the missing build dependency you were mentioning in your comment (see https://launchpadlibrarian.net/70884789/buildlog_ubuntu-natty-armel.unity-2d_3.8.4.1-0ubuntu2~bzr553_FAILEDTOBUILD.txt.gz).

Revision history for this message
Olivier Tilloy (osomon) wrote :

@Florian: the code looks good to me, I still need to test it.

One comment/question on your way of retrieving the command line arguments for the application:

+ QSet<QString> arguments = QSet<QString>::fromList(QCoreApplication::arguments());

Why do you need a QSet? Can’t you just use the QStringList returned by QCoreApplication::arguments() ?
QLists also have a 'contains' method, so it should be fine.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2011-02-18 17:05:47 +0000
+++ CMakeLists.txt 2011-04-29 16:29:42 +0000
@@ -24,6 +24,7 @@
24 ${QT_QTDECLARATIVE_INCLUDE_DIR}24 ${QT_QTDECLARATIVE_INCLUDE_DIR}
25 ${QT_QTXML_INCLUDE_DIR}25 ${QT_QTXML_INCLUDE_DIR}
26 ${QT_QTGUI_INCLUDE_DIR}26 ${QT_QTGUI_INCLUDE_DIR}
27 ${QT_QTOPENGL_INCLUDE_DIR}
27 ${X11_INCLUDE_DIR}28 ${X11_INCLUDE_DIR}
28 )29 )
2930
3031
=== modified file 'launcher/app/launcher.cpp'
--- launcher/app/launcher.cpp 2011-04-28 13:09:25 +0000
+++ launcher/app/launcher.cpp 2011-04-29 16:29:42 +0000
@@ -90,6 +90,7 @@
90 */90 */
91 QApplication::setGraphicsSystem("raster");91 QApplication::setGraphicsSystem("raster");
92 Unity2dApplication application(argc, argv);92 Unity2dApplication application(argc, argv);
93 QSet<QString> arguments = QSet<QString>::fromList(QCoreApplication::arguments());
9394
94 GnomeSessionClient client(INSTALL_PREFIX "/share/applications/unity-2d-launcher.desktop");95 GnomeSessionClient client(INSTALL_PREFIX "/share/applications/unity-2d-launcher.desktop");
95 client.connectToSessionManager();96 client.connectToSessionManager();
@@ -110,6 +111,7 @@
110111
111 /* QML declarative view */112 /* QML declarative view */
112 LauncherView *launcherView = new LauncherView(&panel);113 LauncherView *launcherView = new LauncherView(&panel);
114 launcherView->setUseOpenGL(arguments.contains("-opengl"));
113115
114 /* FIXME: possible optimisations */116 /* FIXME: possible optimisations */
115// launcherView->setAttribute(Qt::WA_OpaquePaintEvent);117// launcherView->setAttribute(Qt::WA_OpaquePaintEvent);
116118
=== modified file 'launcher/app/launcherview.cpp'
--- launcher/app/launcherview.cpp 2011-04-28 13:09:25 +0000
+++ launcher/app/launcherview.cpp 2011-04-29 16:29:42 +0000
@@ -58,7 +58,7 @@
58static const char* COMMANDS_PLACE_ENTRY = "Runner";58static const char* COMMANDS_PLACE_ENTRY = "Runner";
5959
60LauncherView::LauncherView(QWidget* parent) :60LauncherView::LauncherView(QWidget* parent) :
61 QDeclarativeView(parent),61 Unity2DDeclarativeView(parent),
62 m_superKeyPressed(false), m_superKeyHeld(false)62 m_superKeyPressed(false), m_superKeyHeld(false)
63{63{
64 m_superKeyHoldTimer.setSingleShot(true);64 m_superKeyHoldTimer.setSingleShot(true);
6565
=== modified file 'launcher/app/launcherview.h'
--- launcher/app/launcherview.h 2011-04-01 09:23:58 +0000
+++ launcher/app/launcherview.h 2011-04-29 16:29:42 +0000
@@ -27,10 +27,12 @@
2727
28#include "gconfitem-qml-wrapper.h"28#include "gconfitem-qml-wrapper.h"
2929
30#include <unity2ddeclarativeview.h>
31
30class DeclarativeDragDropEvent;32class DeclarativeDragDropEvent;
31class LauncherDBus;33class LauncherDBus;
3234
33class LauncherView : public QDeclarativeView35class LauncherView : public Unity2DDeclarativeView
34{36{
35 Q_OBJECT37 Q_OBJECT
36 Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged)38 Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged)
3739
=== modified file 'libunity-2d-private/src/CMakeLists.txt'
--- libunity-2d-private/src/CMakeLists.txt 2011-03-21 13:46:48 +0000
+++ libunity-2d-private/src/CMakeLists.txt 2011-04-29 16:29:42 +0000
@@ -13,6 +13,7 @@
13 unity2ddebug.cpp13 unity2ddebug.cpp
14 unity2dpanel.cpp14 unity2dpanel.cpp
15 unity2dtr.cpp15 unity2dtr.cpp
16 unity2ddeclarativeview.cpp
16 mimedata.cpp17 mimedata.cpp
17 dragdropevent.cpp18 dragdropevent.cpp
18 propertybinder.cpp19 propertybinder.cpp
@@ -38,6 +39,7 @@
38 ${QT_QTCORE_LIBRARIES}39 ${QT_QTCORE_LIBRARIES}
39 ${QT_QTDBUS_LIBRARIES}40 ${QT_QTDBUS_LIBRARIES}
40 ${QT_QTDECLARATIVE_LIBRARIES}41 ${QT_QTDECLARATIVE_LIBRARIES}
42 ${QT_QTOPENGL_LIBRARIES}
41 ${X11_LIBRARIES}43 ${X11_LIBRARIES}
42 ${GLIB_LDFLAGS}44 ${GLIB_LDFLAGS}
43 )45 )
4446
=== added file 'libunity-2d-private/src/unity2ddeclarativeview.cpp'
--- libunity-2d-private/src/unity2ddeclarativeview.cpp 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/unity2ddeclarativeview.cpp 2011-04-29 16:29:42 +0000
@@ -0,0 +1,37 @@
1#include "unity2ddeclarativeview.h"
2#include <QGLWidget>
3
4Unity2DDeclarativeView::Unity2DDeclarativeView(QWidget *parent) :
5 QDeclarativeView(parent), m_useOpenGL(false)
6{
7}
8
9bool Unity2DDeclarativeView::useOpenGL() const
10{
11 return m_useOpenGL;
12}
13
14void Unity2DDeclarativeView::setUseOpenGL(bool useOpenGL)
15{
16 if (useOpenGL == m_useOpenGL) {
17 return;
18 }
19
20 if (useOpenGL) {
21 QGLFormat format = QGLFormat::defaultFormat();
22 format.setSampleBuffers(false);
23
24 QGLWidget *glWidget = new QGLWidget(format);
25 /* TODO: possibly faster, to be tested */
26 //glWidget->setAutoFillBackground(false);
27
28 setViewport(glWidget);
29 } else {
30 setViewport(0);
31 }
32
33 m_useOpenGL = useOpenGL;
34 Q_EMIT useOpenGLChanged(useOpenGL);
35}
36
37#include <unity2ddeclarativeview.moc>
038
=== added file 'libunity-2d-private/src/unity2ddeclarativeview.h'
--- libunity-2d-private/src/unity2ddeclarativeview.h 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/unity2ddeclarativeview.h 2011-04-29 16:29:42 +0000
@@ -0,0 +1,27 @@
1#ifndef UNITY2DDECLARATIVEVIEW_H
2#define UNITY2DDECLARATIVEVIEW_H
3
4#include <QDeclarativeView>
5
6class Unity2DDeclarativeView : public QDeclarativeView
7{
8 Q_OBJECT
9
10 Q_PROPERTY(bool useOpenGL READ useOpenGL WRITE setUseOpenGL NOTIFY useOpenGLChanged)
11
12public:
13 Unity2DDeclarativeView(QWidget *parent = 0);
14
15 bool useOpenGL() const;
16 void setUseOpenGL(bool);
17
18Q_SIGNALS:
19 void useOpenGLChanged(bool);
20
21private:
22 bool m_useOpenGL;
23};
24
25Q_DECLARE_METATYPE(Unity2DDeclarativeView*)
26
27#endif // UNITY2DDECLARATIVEVIEW_H
028
=== modified file 'places/app/dashdeclarativeview.cpp'
--- places/app/dashdeclarativeview.cpp 2011-04-12 17:28:33 +0000
+++ places/app/dashdeclarativeview.cpp 2011-04-29 16:29:42 +0000
@@ -47,7 +47,7 @@
47static const char* DASH_DBUS_OBJECT_PATH = "/Dash";47static const char* DASH_DBUS_OBJECT_PATH = "/Dash";
4848
49DashDeclarativeView::DashDeclarativeView()49DashDeclarativeView::DashDeclarativeView()
50: QDeclarativeView()50: Unity2DDeclarativeView()
51, m_launcherClient(new LauncherClient(this))51, m_launcherClient(new LauncherClient(this))
52, m_mode(HiddenMode)52, m_mode(HiddenMode)
53, m_expanded(false)53, m_expanded(false)
5454
=== modified file 'places/app/dashdeclarativeview.h'
--- places/app/dashdeclarativeview.h 2011-04-12 15:40:46 +0000
+++ places/app/dashdeclarativeview.h 2011-04-29 16:29:42 +0000
@@ -18,10 +18,11 @@
18#define DashDeclarativeView_H18#define DashDeclarativeView_H
1919
20#include <QDeclarativeView>20#include <QDeclarativeView>
21#include <unity2ddeclarativeview.h>
2122
22class LauncherClient;23class LauncherClient;
2324
24class DashDeclarativeView : public QDeclarativeView25class DashDeclarativeView : public Unity2DDeclarativeView
25{26{
26 Q_OBJECT27 Q_OBJECT
27 Q_ENUMS(DashMode)28 Q_ENUMS(DashMode)
2829
=== modified file 'places/app/places.cpp'
--- places/app/places.cpp 2011-04-13 13:44:28 +0000
+++ places/app/places.cpp 2011-04-29 16:29:42 +0000
@@ -57,9 +57,12 @@
57 */57 */
58 QApplication::setGraphicsSystem("raster");58 QApplication::setGraphicsSystem("raster");
59 QApplication application(argc, argv);59 QApplication application(argc, argv);
60 QSet<QString> arguments = QSet<QString>::fromList(QCoreApplication::arguments());
6061
61 qmlRegisterType<DashDeclarativeView>("Places", 1, 0, "DashDeclarativeView");62 qmlRegisterType<DashDeclarativeView>("Places", 1, 0, "DashDeclarativeView");
62 DashDeclarativeView view;63 DashDeclarativeView view;
64 view.setUseOpenGL(arguments.contains("-opengl"));
65
63 if (!view.connectToBus()) {66 if (!view.connectToBus()) {
64 qCritical() << "Another instance of the Dash already exists. Quitting.";67 qCritical() << "Another instance of the Dash already exists. Quitting.";
65 return -1;68 return -1;
6669
=== modified file 'spread/app/spread.cpp'
--- spread/app/spread.cpp 2011-04-19 14:11:36 +0000
+++ spread/app/spread.cpp 2011-04-29 16:29:42 +0000
@@ -50,8 +50,10 @@
50 */50 */
51 QApplication::setGraphicsSystem("raster");51 QApplication::setGraphicsSystem("raster");
52 QApplication application(argc, argv);52 QApplication application(argc, argv);
53 QSet<QString> arguments = QSet<QString>::fromList(QCoreApplication::arguments());
5354
54 SpreadView view;55 SpreadView view;
56 view.setUseOpenGL(arguments.contains("-opengl"));
5557
56 /* The spread window is borderless and not moveable by the user, yet not58 /* The spread window is borderless and not moveable by the user, yet not
57 fullscreen */59 fullscreen */
5860
=== modified file 'spread/app/spreadview.cpp'
--- spread/app/spreadview.cpp 2011-03-17 16:05:29 +0000
+++ spread/app/spreadview.cpp 2011-04-29 16:29:42 +0000
@@ -29,7 +29,7 @@
2929
30#include "launcherclient.h"30#include "launcherclient.h"
3131
32SpreadView::SpreadView() : QDeclarativeView()32SpreadView::SpreadView() : Unity2DDeclarativeView()
33{33{
34}34}
3535
3636
=== modified file 'spread/app/spreadview.h'
--- spread/app/spreadview.h 2011-02-03 02:39:53 +0000
+++ spread/app/spreadview.h 2011-04-29 16:29:42 +0000
@@ -23,7 +23,9 @@
23#include <QDeclarativeView>23#include <QDeclarativeView>
24#include <QEvent>24#include <QEvent>
2525
26class SpreadView : public QDeclarativeView26#include <unity2ddeclarativeview.h>
27
28class SpreadView : public Unity2DDeclarativeView
27{29{
28 Q_OBJECT30 Q_OBJECT
2931

Subscribers

People subscribed via source and target branches