Merge lp:~compiz-team/compiz-core/compiz-core.fix_720679 into lp:compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2885
Proposed branch: lp:~compiz-team/compiz-core/compiz-core.fix_720679
Merge into: lp:compiz-core/0.9.5
Diff against target: 146 lines (+78/-7)
3 files modified
plugins/opengl/src/paint.cpp (+1/-1)
plugins/opengl/src/privates.h (+3/-0)
plugins/opengl/src/screen.cpp (+74/-6)
To merge this branch: bzr merge lp:~compiz-team/compiz-core/compiz-core.fix_720679
Reviewer Review Type Date Requested Status
Robert Carr (community) Approve
Review via email: mp+79110@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Robert Carr (robertcarr) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/opengl/src/paint.cpp'
2--- plugins/opengl/src/paint.cpp 2011-09-29 03:29:41 +0000
3+++ plugins/opengl/src/paint.cpp 2011-10-12 12:12:25 +0000
4@@ -118,7 +118,7 @@
5 pBox++;
6 }
7
8- glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 2, data + 2);
9+ glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 2, data);
10
11 glColor4us (0, 0, 0, std::numeric_limits<unsigned short>::max ());
12 glDrawArrays (GL_QUADS, 0, nBox * 4);
13
14=== modified file 'plugins/opengl/src/privates.h'
15--- plugins/opengl/src/privates.h 2011-09-16 00:51:33 +0000
16+++ plugins/opengl/src/privates.h 2011-10-12 12:12:25 +0000
17@@ -122,6 +122,9 @@
18 bool hasCompositing;
19
20 GLIcon defaultIcon;
21+
22+ Pixmap rootPixmapCopy;
23+ CompSize rootPixmapSize;
24 };
25
26 class PrivateGLWindow :
27
28=== modified file 'plugins/opengl/src/screen.cpp'
29--- plugins/opengl/src/screen.cpp 2011-09-16 06:51:02 +0000
30+++ plugins/opengl/src/screen.cpp 2011-10-12 12:12:25 +0000
31@@ -564,13 +564,18 @@
32 outputRegion (),
33 pendingCommands (false),
34 bindPixmap (),
35- hasCompositing (false)
36+ hasCompositing (false),
37+ rootPixmapCopy (None),
38+ rootPixmapSize ()
39 {
40 ScreenInterface::setHandler (screen);
41 }
42
43 PrivateGLScreen::~PrivateGLScreen ()
44 {
45+ if (rootPixmapCopy)
46+ XFreePixmap (screen->dpy (), rootPixmapCopy);
47+
48 }
49
50 GLushort defaultColor[4] = { 0xffff, 0xffff, 0xffff, 0xffff };
51@@ -597,6 +602,10 @@
52 screen->handleEvent (event);
53
54 switch (event->type) {
55+ case ConfigureNotify:
56+ if (event->xconfigure.window == screen->root ())
57+ updateScreenBackground ();
58+ break;
59 case PropertyNotify:
60 if (event->xproperty.atom == Atoms::xBackground[0] ||
61 event->xproperty.atom == Atoms::xBackground[1])
62@@ -631,6 +640,14 @@
63 {
64 it->second->damaged = true;
65 }
66+
67+ /* XXX: It would be nice if we could also update
68+ * the background of the root window when the root
69+ * window pixmap changes, but unfortunately XDamage
70+ * reports damage events any time a child of the root
71+ * window gets a damage event, which means that we'd
72+ * be recopying the root window pixmap all the time
73+ * which is no good, so don't do that */
74 }
75 break;
76 }
77@@ -820,13 +837,64 @@
78 backgroundTextures.clear ();
79 }
80
81- if (backgroundTextures.empty () && backgroundImage)
82+ if (backgroundTextures.empty ())
83 {
84 CompSize size;
85- CompString fileName (backgroundImage);
86- CompString pname ("");
87-
88- backgroundTextures = GLTexture::readImageToTexture (fileName, pname, size);
89+ if (backgroundImage)
90+ {
91+ CompString fileName (backgroundImage);
92+ CompString pname ("");
93+
94+ backgroundTextures = GLTexture::readImageToTexture (fileName, pname, size);
95+ }
96+ else
97+ {
98+ /* Try to get the root window background */
99+ XGCValues gcv;
100+ GC gc;
101+
102+ gcv.graphics_exposures = false;
103+ gcv.subwindow_mode = IncludeInferiors;
104+ gc = XCreateGC (screen->dpy (), screen->root (),
105+ GCGraphicsExposures | GCSubwindowMode, &gcv);
106+
107+ if (rootPixmapSize.width () != screen->width () ||
108+ rootPixmapSize.height () != screen->height ())
109+ {
110+ if (rootPixmapCopy)
111+ XFreePixmap (screen->dpy (), rootPixmapCopy);
112+
113+ rootPixmapSize = CompSize (screen->width (), screen->height ());
114+
115+ rootPixmapCopy = XCreatePixmap (screen->dpy (), screen->root (),
116+ rootPixmapSize.width (), rootPixmapSize.height (),
117+ DefaultDepth (screen->dpy (), DefaultScreen (screen->dpy ())));
118+
119+ backgroundTextures =
120+ GLTexture::bindPixmapToTexture (rootPixmapCopy, rootPixmapSize.width (), rootPixmapSize.height (),
121+ DefaultDepth (screen->dpy (), DefaultScreen (screen->dpy ())));
122+
123+ if (backgroundTextures.empty ())
124+ {
125+ compLogMessage ("core", CompLogLevelWarn,
126+ "Couldn't bind background pixmap 0x%x to "
127+ "texture", (int) screen->width ());
128+ }
129+ }
130+
131+ if (rootPixmapCopy)
132+ {
133+ XCopyArea (screen->dpy (), screen->root (), rootPixmapCopy, gc,
134+ 0, 0, screen->width (), screen->height (), 0, 0);
135+ XSync (screen->dpy (), false);
136+ }
137+ else
138+ {
139+ backgroundTextures.clear ();
140+ }
141+
142+ XFreeGC(dpy, gc);
143+ }
144 }
145
146 if (!backgroundTextures.empty ())

Subscribers

People subscribed via source and target branches