~sil2100/compiz/workaround_770283

« back to all changes in this revision

Viewing changes to debian/patches/workaround_770283.patch

  • Committer: Łukasz 'sil2100' Zemczak
  • Date: 2012-04-18 12:09:18 UTC
  • Revision ID: lukasz.zemczak@canonical.com-20120418120918-p6g3dm0irqtemd9n
Adding fix for LP: #770283 as a distro patch. Started 1:0.9.7.6-0ubuntu2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- compiz-0.9.7.6.orig/plugins/decor/src/decor.cpp
 
2
+++ compiz-0.9.7.6/plugins/decor/src/decor.cpp
 
3
@@ -317,44 +317,66 @@ DecorTexture::DecorTexture (Pixmap pixma
 
4
     pixmap (pixmap),
 
5
     damage (None)
 
6
 {
 
7
+    if (!bindTexture (pixmap))
 
8
+       return;
 
9
+
 
10
+    damage = XDamageCreate (screen->dpy (), pixmap,
 
11
+                            XDamageReportRawRectangles);
 
12
+}
 
13
+
 
14
+/*
 
15
+ * DecorTexture::~DecorTexture
 
16
+ *
 
17
+ * Remove damage handle on texture
 
18
+ *
 
19
+ */
 
20
+
 
21
+DecorTexture::~DecorTexture ()
 
22
+{
 
23
+    if (damage)
 
24
+       XDamageDestroy (screen->dpy (), damage);
 
25
+}
 
26
+
 
27
+/*
 
28
+ * DecorTexture::indTexture
 
29
+ *
 
30
+ * This function actually takes and binds/rebinds the given Pixmap
 
31
+ * to a texture (i.e. calls GLTexture::bindPixmapToTexture)
 
32
+ *
 
33
+ */
 
34
+
 
35
+bool
 
36
+DecorTexture::bindTexture (Pixmap src)
 
37
+{
 
38
     unsigned int width, height, depth, ui;
 
39
     Window      root;
 
40
     int                 i;
 
41
 
 
42
+    pixmap = src;
 
43
+
 
44
     if (!XGetGeometry (screen->dpy (), pixmap, &root,
 
45
                       &i, &i, &width, &height, &ui, &depth))
 
46
     {
 
47
-        status = false;
 
48
-       return;
 
49
+       status = false;
 
50
+       return false;
 
51
     }
 
52
 
 
53
+    // Explicitly clear the texture list before binding/rebinding
 
54
+    textures.clear ();
 
55
+
 
56
     bindFailed = false;
 
57
     textures = GLTexture::bindPixmapToTexture (pixmap, width, height, depth);
 
58
     if (textures.size () != 1)
 
59
     {
 
60
        bindFailed = true;
 
61
-        status = false;
 
62
-       return;
 
63
+       status = false;
 
64
+       return false;
 
65
     }
 
66
 
 
67
     if (!DecorScreen::get (screen)->optionGetMipmap ())
 
68
        textures[0]->setMipmap (false);
 
69
 
 
70
-    damage = XDamageCreate (screen->dpy (), pixmap,
 
71
-                            XDamageReportRawRectangles);
 
72
-}
 
73
-
 
74
-/*
 
75
- * DecorTexture::~DecorTexture
 
76
- *
 
77
- * Remove damage handle on texture
 
78
- *
 
79
- */
 
80
-
 
81
-DecorTexture::~DecorTexture ()
 
82
-{
 
83
-    if (damage)
 
84
-       XDamageDestroy (screen->dpy (), damage);
 
85
+    return true;
 
86
 }
 
87
 
 
88
 /*
 
89
@@ -2315,8 +2337,22 @@ DecorScreen::handleEvent (XEvent *event)
 
90
                            {
 
91
                                DECOR_WINDOW (w);
 
92
 
 
93
-                               if (dw->wd && dw->wd->decor->texture == t)
 
94
+                               if (dw->wd && dw->wd->decor->texture == t) {
 
95
+                                   /* XXX FIXME: dirty fglrx workaround here! 
 
96
+                                      (LP #770283) */
 
97
+                                   /* If the damage is done on decoration, in case
 
98
+                                      of fglrx we need to rebind the texture to see 
 
99
+                                      actual Pixmap changes */
 
100
+
 
101
+                                   XGrabServer (screen->dpy ());
 
102
+                                   XSync (screen->dpy (), false);
 
103
+
 
104
+                                   t->bindTexture (t->pixmap);
 
105
+
 
106
+                                   XUngrabServer (screen->dpy ());
 
107
+                                   XSync (screen->dpy (), false);
 
108
                                    dw->cWindow->damageOutputExtents ();
 
109
+                               }
 
110
                            }
 
111
                        }
 
112
                        return;
 
113
--- compiz-0.9.7.6.orig/plugins/decor/src/decor.h
 
114
+++ compiz-0.9.7.6/plugins/decor/src/decor.h
 
115
@@ -79,6 +79,8 @@ class DecorTexture {
 
116
        DecorTexture (Pixmap pixmap);
 
117
        ~DecorTexture ();
 
118
 
 
119
+       bool bindTexture (Pixmap src);
 
120
+
 
121
     public:
 
122
        bool            status;
 
123
        int             refCount;