Merge lp:~mardy/unity-2d/conf-opengl into lp:unity-2d

Proposed by Alberto Mardegan
Status: Merged
Approved by: Florian Boucault
Approved revision: 700
Merged at revision: 704
Proposed branch: lp:~mardy/unity-2d/conf-opengl
Merge into: lp:unity-2d
Diff against target: 124 lines (+65/-1)
3 files modified
data/com.canonical.Unity2d.gschema.xml (+10/-0)
libunity-2d-private/src/unity2ddeclarativeview.cpp (+35/-1)
libunity-2d-private/src/unity2ddeclarativeview.h (+20/-0)
To merge this branch: bzr merge lp:~mardy/unity-2d/conf-opengl
Reviewer Review Type Date Requested Status
Florian Boucault Pending
Review via email: mp+74407@code.launchpad.net

Description of the change

[launcher, dash, workspace switcher] Added a configuration key to enable QML's OpenGL backend

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/com.canonical.Unity2d.gschema.xml'
2--- data/com.canonical.Unity2d.gschema.xml 2011-08-22 09:17:03 +0000
3+++ data/com.canonical.Unity2d.gschema.xml 2011-09-07 12:15:24 +0000
4@@ -1,4 +1,14 @@
5 <schemalist>
6+ <schema path="/com/canonical/unity-2d/" id="com.canonical.Unity2d" gettext-domain="unity-2d">
7+ <key type="b" name="use-opengl">
8+ <default>false</default>
9+ <summary>Use OpenGL viewport.</summary>
10+ <description>
11+ Whether to render the graphics into an OpenGL viewport.
12+ When set to false, the raster engine is used.
13+ </description>
14+ </key>
15+ </schema>
16 <schema path="/com/canonical/unity-2d/launcher/" id="com.canonical.Unity2d.Launcher" gettext-domain="unity-2d">
17 <key type="b" name="super-key-enable">
18 <default>true</default>
19
20=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.cpp'
21--- libunity-2d-private/src/unity2ddeclarativeview.cpp 2011-08-09 13:33:24 +0000
22+++ libunity-2d-private/src/unity2ddeclarativeview.cpp 2011-09-07 12:15:24 +0000
23@@ -1,19 +1,53 @@
24+/*
25+ * Copyright (C) 2011 Canonical, Ltd.
26+ *
27+ * This program is free software; you can redistribute it and/or modify
28+ * it under the terms of the GNU General Public License as published by
29+ * the Free Software Foundation; version 3.
30+ *
31+ * This program is distributed in the hope that it will be useful,
32+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
33+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34+ * GNU General Public License for more details.
35+ *
36+ * You should have received a copy of the GNU General Public License
37+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
38+ */
39+
40 #include "unity2ddeclarativeview.h"
41+
42 #include <QDebug>
43 #include <QGLWidget>
44+#include <QVariant>
45 #include <QX11Info>
46
47 #include <X11/Xlib.h>
48 #include <X11/Xatom.h>
49
50+#include "qconf.h"
51+
52 #include <debug_p.h>
53
54+static const char* UNITY2D_DCONF_SCHEMA = "com.canonical.Unity2d";
55+
56 Unity2DDeclarativeView::Unity2DDeclarativeView(QWidget *parent) :
57- QDeclarativeView(parent), m_useOpenGL(false), m_transparentBackground(false), m_last_focused_window(None)
58+ QDeclarativeView(parent),
59+ m_useOpenGL(false),
60+ m_transparentBackground(false),
61+ m_last_focused_window(None),
62+ m_conf(new QConf(UNITY2D_DCONF_SCHEMA))
63 {
64+ m_useOpenGL = m_conf->property("useOpengl").toBool();
65+
66 setupViewport();
67 }
68
69+Unity2DDeclarativeView::~Unity2DDeclarativeView()
70+{
71+ delete m_conf;
72+ m_conf = 0;
73+}
74+
75 bool Unity2DDeclarativeView::useOpenGL() const
76 {
77 return m_useOpenGL;
78
79=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.h'
80--- libunity-2d-private/src/unity2ddeclarativeview.h 2011-08-09 13:33:24 +0000
81+++ libunity-2d-private/src/unity2ddeclarativeview.h 2011-09-07 12:15:24 +0000
82@@ -1,8 +1,26 @@
83+/*
84+ * Copyright (C) 2011 Canonical, Ltd.
85+ *
86+ * This program is free software; you can redistribute it and/or modify
87+ * it under the terms of the GNU General Public License as published by
88+ * the Free Software Foundation; version 3.
89+ *
90+ * This program is distributed in the hope that it will be useful,
91+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
92+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93+ * GNU General Public License for more details.
94+ *
95+ * You should have received a copy of the GNU General Public License
96+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
97+ */
98+
99 #ifndef UNITY2DDECLARATIVEVIEW_H
100 #define UNITY2DDECLARATIVEVIEW_H
101
102 #include <QDeclarativeView>
103
104+class QConf;
105+
106 class Unity2DDeclarativeView : public QDeclarativeView
107 {
108 Q_OBJECT
109@@ -13,6 +31,7 @@
110
111 public:
112 Unity2DDeclarativeView(QWidget *parent = 0);
113+ ~Unity2DDeclarativeView();
114
115 // getters
116 bool useOpenGL() const;
117@@ -43,6 +62,7 @@
118 bool m_useOpenGL;
119 bool m_transparentBackground;
120 WId m_last_focused_window;
121+ QConf* m_conf;
122 };
123
124 Q_DECLARE_METATYPE(Unity2DDeclarativeView*)

Subscribers

People subscribed via source and target branches