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

Proposed by Florian Boucault
Status: Merged
Approved by: Ugo Riboni
Approved revision: 592
Merged at revision: 608
Proposed branch: lp:~fboucault/unity-2d/declarativeview_transparent_background_property
Merge into: lp:unity-2d/3.0
Diff against target: 117 lines (+27/-19)
5 files modified
launcher/app/launcherview.cpp (+1/-7)
libunity-2d-private/src/unity2ddeclarativeview.cpp (+17/-0)
libunity-2d-private/src/unity2ddeclarativeview.h (+8/-0)
places/app/dashdeclarativeview.cpp (+1/-8)
spread/app/spread.cpp (+0/-4)
To merge this branch: bzr merge lp:~fboucault/unity-2d/declarativeview_transparent_background_property
Reviewer Review Type Date Requested Status
Ugo Riboni (community) Approve
Review via email: mp+64351@code.launchpad.net

Description of the change

Added property Unity2DDeclarativeView::transparentBackground.
Removed spread specific optimisations that are now part of Unity2DDeclarativeView.

Note: setting attribute WA_TranslucentBackground internally sets the attribute WA_NoSystemBackground.

To post a comment you must log in.
Revision history for this message
Ugo Riboni (uriboni) wrote :

I didn't spot any regressions with and without a compositor running.
Code looks ok.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/app/launcherview.cpp'
--- launcher/app/launcherview.cpp 2011-06-07 13:46:38 +0000
+++ launcher/app/launcherview.cpp 2011-06-13 00:37:40 +0000
@@ -61,13 +61,7 @@
61 Unity2DDeclarativeView(parent),61 Unity2DDeclarativeView(parent),
62 m_superKeyPressed(false), m_superKeyHeld(false)62 m_superKeyPressed(false), m_superKeyHeld(false)
63{63{
64 if (QX11Info::isCompositingManagerRunning()) {64 setTransparentBackground(QX11Info::isCompositingManagerRunning());
65 setAttribute(Qt::WA_TranslucentBackground);
66 viewport()->setAttribute(Qt::WA_TranslucentBackground);
67 } else {
68 setAttribute(Qt::WA_OpaquePaintEvent);
69 setAttribute(Qt::WA_NoSystemBackground);
70 }
7165
72 m_superKeyHoldTimer.setSingleShot(true);66 m_superKeyHoldTimer.setSingleShot(true);
73 m_superKeyHoldTimer.setInterval(KEY_HOLD_THRESHOLD);67 m_superKeyHoldTimer.setInterval(KEY_HOLD_THRESHOLD);
7468
=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.cpp'
--- libunity-2d-private/src/unity2ddeclarativeview.cpp 2011-04-29 16:26:25 +0000
+++ libunity-2d-private/src/unity2ddeclarativeview.cpp 2011-06-13 00:37:40 +0000
@@ -4,6 +4,8 @@
4Unity2DDeclarativeView::Unity2DDeclarativeView(QWidget *parent) :4Unity2DDeclarativeView::Unity2DDeclarativeView(QWidget *parent) :
5 QDeclarativeView(parent), m_useOpenGL(false)5 QDeclarativeView(parent), m_useOpenGL(false)
6{6{
7 setAttribute(Qt::WA_NoSystemBackground);
8 setTransparentBackground(false);
7}9}
810
9bool Unity2DDeclarativeView::useOpenGL() const11bool Unity2DDeclarativeView::useOpenGL() const
@@ -34,4 +36,19 @@
34 Q_EMIT useOpenGLChanged(useOpenGL);36 Q_EMIT useOpenGLChanged(useOpenGL);
35}37}
3638
39bool Unity2DDeclarativeView::transparentBackground() const
40{
41 return m_transparentBackground;
42}
43
44void Unity2DDeclarativeView::setTransparentBackground(bool transparentBackground)
45{
46 setAttribute(Qt::WA_TranslucentBackground, transparentBackground);
47 viewport()->setAttribute(Qt::WA_TranslucentBackground, transparentBackground);
48 setAttribute(Qt::WA_OpaquePaintEvent, !transparentBackground);
49
50 m_transparentBackground = transparentBackground;
51 Q_EMIT transparentBackgroundChanged(transparentBackground);
52}
53
37#include <unity2ddeclarativeview.moc>54#include <unity2ddeclarativeview.moc>
3855
=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.h'
--- libunity-2d-private/src/unity2ddeclarativeview.h 2011-04-29 16:26:25 +0000
+++ libunity-2d-private/src/unity2ddeclarativeview.h 2011-06-13 00:37:40 +0000
@@ -8,18 +8,26 @@
8 Q_OBJECT8 Q_OBJECT
99
10 Q_PROPERTY(bool useOpenGL READ useOpenGL WRITE setUseOpenGL NOTIFY useOpenGLChanged)10 Q_PROPERTY(bool useOpenGL READ useOpenGL WRITE setUseOpenGL NOTIFY useOpenGLChanged)
11 Q_PROPERTY(bool transparentBackground READ transparentBackground WRITE setTransparentBackground NOTIFY transparentBackgroundChanged)
1112
12public:13public:
13 Unity2DDeclarativeView(QWidget *parent = 0);14 Unity2DDeclarativeView(QWidget *parent = 0);
1415
16 // getters
15 bool useOpenGL() const;17 bool useOpenGL() const;
18 bool transparentBackground() const;
19
20 // setters
16 void setUseOpenGL(bool);21 void setUseOpenGL(bool);
22 void setTransparentBackground(bool);
1723
18Q_SIGNALS:24Q_SIGNALS:
19 void useOpenGLChanged(bool);25 void useOpenGLChanged(bool);
26 void transparentBackgroundChanged(bool);
2027
21private:28private:
22 bool m_useOpenGL;29 bool m_useOpenGL;
30 bool m_transparentBackground;
23};31};
2432
25Q_DECLARE_METATYPE(Unity2DDeclarativeView*)33Q_DECLARE_METATYPE(Unity2DDeclarativeView*)
2634
=== modified file 'places/app/dashdeclarativeview.cpp'
--- places/app/dashdeclarativeview.cpp 2011-05-23 17:23:38 +0000
+++ places/app/dashdeclarativeview.cpp 2011-06-13 00:37:40 +0000
@@ -53,14 +53,7 @@
53, m_expanded(false)53, m_expanded(false)
54{54{
55 setWindowFlags(Qt::Window | Qt::FramelessWindowHint);55 setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
5656 setTransparentBackground(QX11Info::isCompositingManagerRunning());
57 if (QX11Info::isCompositingManagerRunning()) {
58 setAttribute(Qt::WA_TranslucentBackground);
59 viewport()->setAttribute(Qt::WA_TranslucentBackground);
60 } else {
61 setAttribute(Qt::WA_OpaquePaintEvent);
62 setAttribute(Qt::WA_NoSystemBackground);
63 }
6457
65 QDesktopWidget* desktop = QApplication::desktop();58 QDesktopWidget* desktop = QApplication::desktop();
66 connect(desktop, SIGNAL(resized(int)), SIGNAL(screenGeometryChanged()));59 connect(desktop, SIGNAL(resized(int)), SIGNAL(screenGeometryChanged()));
6760
=== modified file 'spread/app/spread.cpp'
--- spread/app/spread.cpp 2011-06-07 21:07:50 +0000
+++ spread/app/spread.cpp 2011-06-13 00:37:40 +0000
@@ -62,10 +62,6 @@
62 fullscreen */62 fullscreen */
63 view.setAttribute(Qt::WA_X11NetWmWindowTypeDock, true);63 view.setAttribute(Qt::WA_X11NetWmWindowTypeDock, true);
6464
65 /* Performance tricks */
66 view.setAttribute(Qt::WA_OpaquePaintEvent);
67 view.setAttribute(Qt::WA_NoSystemBackground);
68
69 view.engine()->addImportPath(unity2dImportPath());65 view.engine()->addImportPath(unity2dImportPath());
70 /* Note: baseUrl seems to be picky: if it does not end with a slash,66 /* Note: baseUrl seems to be picky: if it does not end with a slash,
71 setSource() will fail */67 setSource() will fail */

Subscribers

People subscribed via source and target branches