Merge lp:~smspillaz/unity/unity.kindof_fix_977189 into lp:unity

Proposed by Sam Spilsbury on 2012-04-11
Status: Rejected
Rejected by: Sam Spilsbury on 2012-04-11
Proposed branch: lp:~smspillaz/unity/unity.kindof_fix_977189
Merge into: lp:unity
Diff against target: 77 lines (+13/-25)
1 file modified
plugins/unityshell/src/inputremover.cpp (+13/-25)
To merge this branch: bzr merge lp:~smspillaz/unity/unity.kindof_fix_977189
Reviewer Review Type Date Requested Status
Didier Roche 2012-04-11 Needs Fixing on 2012-04-11
Review via email: mp+101482@code.launchpad.net

Description of the change

== Problem ==

See bug 977189 - the nvidia driver seems to optimize away pixmaps backing windows that have no bounding shape set.

== Solution ==

Since we don't really need to remove the bounding shape unless a custom
bounding shape was set, we can fix this in 99% of cases by simply not
removing the bounding shape of the window when there is no custom bounding
shape set.

Note that this doesn't fix every case, namely chromium with client side decorations
is still broken.

The only thing I can think of for those cases is to snapshot windows with a custom
bounding shape and replace calls to glDrawTexture for those windows with the snapshotted
texture. This is a rather complicated operation though and will slow down minimization
for large windows.

== Tests ==

Covered by existing test progs.

build/tests/test-input-remover

To post a comment you must log in.
Didier Roche (didrocks) wrote :

There is no test at all upstream for that. Sam, can you please add at least a manual test for it?

Didier Roche (didrocks) wrote :

FYI, this didn't fix it for me, but we noted that if I maxiximize a window (so loosing its decoration), minimizing it and then spread it, the window content is around. So there is probably something that can be worked on. Putting it in work in progress.

review: Needs Fixing

Unmerged revisions

2265. By Sam Spilsbury on 2012-04-11

Kind of fix LP#977189

The nvidia driver seems to free the backing pixmap of the window whenever
its input shape is completely removed as an optimization. That causes windows
to go white.

Since we don't really need to remove the bounding shape unless a custom
bounding shape was set, we can fix this in 99% of cases by simply not
removing the bounding shape of the window when there is no custom bounding
shape set

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/inputremover.cpp'
2--- plugins/unityshell/src/inputremover.cpp 2012-03-24 02:57:48 +0000
3+++ plugins/unityshell/src/inputremover.cpp 2012-04-11 03:57:21 +0000
4@@ -109,20 +109,10 @@
5 XTranslateCoordinates (mDpy, mShapeWindow, parentReturn, 0, 0,
6 &xOffset, &yOffset, &childReturn);
7
8- xsev.kind = ShapeBounding;
9+ if (mNBoundingRects > 0)
10+ {
11+ xsev.kind = ShapeBounding;
12
13- /* Calculate extents of the bounding shape */
14- if (!mNBoundingRects)
15- {
16- /* No set input shape, we must use the client geometry */
17- xsev.x = x - xOffset;
18- xsev.y = y - yOffset;
19- xsev.width = width;
20- xsev.height = height;
21- xsev.shaped = false;
22- }
23- else
24- {
25 Region boundingRegion = XCreateRegion ();
26
27 for (int i = 0; i < mNBoundingRects; i++)
28@@ -135,12 +125,14 @@
29 xsev.shaped = true;
30
31 XDestroyRegion (boundingRegion);
32+
33+
34+ xsev.time = CurrentTime;
35+
36+ XSendEvent (mDpy, mShapeWindow, FALSE, NoEventMask, xev);
37+ XSendEvent (mDpy, parentReturn, FALSE, NoEventMask, xev);
38 }
39
40- xsev.time = CurrentTime;
41-
42- XSendEvent (mDpy, mShapeWindow, FALSE, NoEventMask, xev);
43- XSendEvent (mDpy, parentReturn, FALSE, NoEventMask, xev);
44 xsev.kind = ShapeInput;
45
46 /* Calculate extents of the bounding shape */
47@@ -281,8 +273,9 @@
48
49 XShapeCombineRectangles (mDpy, mShapeWindow, ShapeInput, 0, 0,
50 NULL, 0, ShapeSet, 0);
51- XShapeCombineRectangles (mDpy, mShapeWindow, ShapeBounding, 0, 0,
52- NULL, 0, ShapeSet, 0);
53+ if (mNBoundingRects > 0)
54+ XShapeCombineRectangles (mDpy, mShapeWindow, ShapeBounding, 0, 0,
55+ NULL, 0, ShapeSet, 0);
56
57 XShapeSelectInput (mDpy, mShapeWindow, mShapeMask);
58
59@@ -320,17 +313,12 @@
60 mNInputRects = 0;
61 }
62
63- if (mNBoundingRects)
64+ if (mNBoundingRects > 0)
65 {
66 XShapeCombineRectangles (mDpy, mShapeWindow, ShapeBounding, 0, 0,
67 mBoundingRects, mNBoundingRects,
68 ShapeSet, mBoundingRectOrdering);
69 }
70- else
71- {
72- XShapeCombineMask (mDpy, mShapeWindow, ShapeBounding,
73- 0, 0, None, ShapeSet);
74- }
75
76 if (mBoundingRects)
77 {