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
1=== modified file 'launcher/app/launcherview.cpp'
2--- launcher/app/launcherview.cpp 2011-06-07 13:46:38 +0000
3+++ launcher/app/launcherview.cpp 2011-06-13 00:37:40 +0000
4@@ -61,13 +61,7 @@
5 Unity2DDeclarativeView(parent),
6 m_superKeyPressed(false), m_superKeyHeld(false)
7 {
8- if (QX11Info::isCompositingManagerRunning()) {
9- setAttribute(Qt::WA_TranslucentBackground);
10- viewport()->setAttribute(Qt::WA_TranslucentBackground);
11- } else {
12- setAttribute(Qt::WA_OpaquePaintEvent);
13- setAttribute(Qt::WA_NoSystemBackground);
14- }
15+ setTransparentBackground(QX11Info::isCompositingManagerRunning());
16
17 m_superKeyHoldTimer.setSingleShot(true);
18 m_superKeyHoldTimer.setInterval(KEY_HOLD_THRESHOLD);
19
20=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.cpp'
21--- libunity-2d-private/src/unity2ddeclarativeview.cpp 2011-04-29 16:26:25 +0000
22+++ libunity-2d-private/src/unity2ddeclarativeview.cpp 2011-06-13 00:37:40 +0000
23@@ -4,6 +4,8 @@
24 Unity2DDeclarativeView::Unity2DDeclarativeView(QWidget *parent) :
25 QDeclarativeView(parent), m_useOpenGL(false)
26 {
27+ setAttribute(Qt::WA_NoSystemBackground);
28+ setTransparentBackground(false);
29 }
30
31 bool Unity2DDeclarativeView::useOpenGL() const
32@@ -34,4 +36,19 @@
33 Q_EMIT useOpenGLChanged(useOpenGL);
34 }
35
36+bool Unity2DDeclarativeView::transparentBackground() const
37+{
38+ return m_transparentBackground;
39+}
40+
41+void Unity2DDeclarativeView::setTransparentBackground(bool transparentBackground)
42+{
43+ setAttribute(Qt::WA_TranslucentBackground, transparentBackground);
44+ viewport()->setAttribute(Qt::WA_TranslucentBackground, transparentBackground);
45+ setAttribute(Qt::WA_OpaquePaintEvent, !transparentBackground);
46+
47+ m_transparentBackground = transparentBackground;
48+ Q_EMIT transparentBackgroundChanged(transparentBackground);
49+}
50+
51 #include <unity2ddeclarativeview.moc>
52
53=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.h'
54--- libunity-2d-private/src/unity2ddeclarativeview.h 2011-04-29 16:26:25 +0000
55+++ libunity-2d-private/src/unity2ddeclarativeview.h 2011-06-13 00:37:40 +0000
56@@ -8,18 +8,26 @@
57 Q_OBJECT
58
59 Q_PROPERTY(bool useOpenGL READ useOpenGL WRITE setUseOpenGL NOTIFY useOpenGLChanged)
60+ Q_PROPERTY(bool transparentBackground READ transparentBackground WRITE setTransparentBackground NOTIFY transparentBackgroundChanged)
61
62 public:
63 Unity2DDeclarativeView(QWidget *parent = 0);
64
65+ // getters
66 bool useOpenGL() const;
67+ bool transparentBackground() const;
68+
69+ // setters
70 void setUseOpenGL(bool);
71+ void setTransparentBackground(bool);
72
73 Q_SIGNALS:
74 void useOpenGLChanged(bool);
75+ void transparentBackgroundChanged(bool);
76
77 private:
78 bool m_useOpenGL;
79+ bool m_transparentBackground;
80 };
81
82 Q_DECLARE_METATYPE(Unity2DDeclarativeView*)
83
84=== modified file 'places/app/dashdeclarativeview.cpp'
85--- places/app/dashdeclarativeview.cpp 2011-05-23 17:23:38 +0000
86+++ places/app/dashdeclarativeview.cpp 2011-06-13 00:37:40 +0000
87@@ -53,14 +53,7 @@
88 , m_expanded(false)
89 {
90 setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
91-
92- if (QX11Info::isCompositingManagerRunning()) {
93- setAttribute(Qt::WA_TranslucentBackground);
94- viewport()->setAttribute(Qt::WA_TranslucentBackground);
95- } else {
96- setAttribute(Qt::WA_OpaquePaintEvent);
97- setAttribute(Qt::WA_NoSystemBackground);
98- }
99+ setTransparentBackground(QX11Info::isCompositingManagerRunning());
100
101 QDesktopWidget* desktop = QApplication::desktop();
102 connect(desktop, SIGNAL(resized(int)), SIGNAL(screenGeometryChanged()));
103
104=== modified file 'spread/app/spread.cpp'
105--- spread/app/spread.cpp 2011-06-07 21:07:50 +0000
106+++ spread/app/spread.cpp 2011-06-13 00:37:40 +0000
107@@ -62,10 +62,6 @@
108 fullscreen */
109 view.setAttribute(Qt::WA_X11NetWmWindowTypeDock, true);
110
111- /* Performance tricks */
112- view.setAttribute(Qt::WA_OpaquePaintEvent);
113- view.setAttribute(Qt::WA_NoSystemBackground);
114-
115 view.engine()->addImportPath(unity2dImportPath());
116 /* Note: baseUrl seems to be picky: if it does not end with a slash,
117 setSource() will fail */

Subscribers

People subscribed via source and target branches