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

Proposed by Sam Spilsbury
Status: Rejected
Rejected by: Sam Spilsbury
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-Tolomelli Needs Fixing
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.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

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

Revision history for this message
Didier Roche-Tolomelli (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

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
=== modified file 'plugins/unityshell/src/inputremover.cpp'
--- plugins/unityshell/src/inputremover.cpp 2012-03-24 02:57:48 +0000
+++ plugins/unityshell/src/inputremover.cpp 2012-04-11 03:57:21 +0000
@@ -109,20 +109,10 @@
109 XTranslateCoordinates (mDpy, mShapeWindow, parentReturn, 0, 0,109 XTranslateCoordinates (mDpy, mShapeWindow, parentReturn, 0, 0,
110 &xOffset, &yOffset, &childReturn);110 &xOffset, &yOffset, &childReturn);
111111
112 xsev.kind = ShapeBounding;112 if (mNBoundingRects > 0)
113 {
114 xsev.kind = ShapeBounding;
113115
114 /* Calculate extents of the bounding shape */
115 if (!mNBoundingRects)
116 {
117 /* No set input shape, we must use the client geometry */
118 xsev.x = x - xOffset;
119 xsev.y = y - yOffset;
120 xsev.width = width;
121 xsev.height = height;
122 xsev.shaped = false;
123 }
124 else
125 {
126 Region boundingRegion = XCreateRegion ();116 Region boundingRegion = XCreateRegion ();
127117
128 for (int i = 0; i < mNBoundingRects; i++)118 for (int i = 0; i < mNBoundingRects; i++)
@@ -135,12 +125,14 @@
135 xsev.shaped = true;125 xsev.shaped = true;
136126
137 XDestroyRegion (boundingRegion);127 XDestroyRegion (boundingRegion);
128
129
130 xsev.time = CurrentTime;
131
132 XSendEvent (mDpy, mShapeWindow, FALSE, NoEventMask, xev);
133 XSendEvent (mDpy, parentReturn, FALSE, NoEventMask, xev);
138 }134 }
139135
140 xsev.time = CurrentTime;
141
142 XSendEvent (mDpy, mShapeWindow, FALSE, NoEventMask, xev);
143 XSendEvent (mDpy, parentReturn, FALSE, NoEventMask, xev);
144 xsev.kind = ShapeInput;136 xsev.kind = ShapeInput;
145137
146 /* Calculate extents of the bounding shape */138 /* Calculate extents of the bounding shape */
@@ -281,8 +273,9 @@
281273
282 XShapeCombineRectangles (mDpy, mShapeWindow, ShapeInput, 0, 0,274 XShapeCombineRectangles (mDpy, mShapeWindow, ShapeInput, 0, 0,
283 NULL, 0, ShapeSet, 0);275 NULL, 0, ShapeSet, 0);
284 XShapeCombineRectangles (mDpy, mShapeWindow, ShapeBounding, 0, 0,276 if (mNBoundingRects > 0)
285 NULL, 0, ShapeSet, 0);277 XShapeCombineRectangles (mDpy, mShapeWindow, ShapeBounding, 0, 0,
278 NULL, 0, ShapeSet, 0);
286279
287 XShapeSelectInput (mDpy, mShapeWindow, mShapeMask);280 XShapeSelectInput (mDpy, mShapeWindow, mShapeMask);
288281
@@ -320,17 +313,12 @@
320 mNInputRects = 0;313 mNInputRects = 0;
321 }314 }
322315
323 if (mNBoundingRects)316 if (mNBoundingRects > 0)
324 {317 {
325 XShapeCombineRectangles (mDpy, mShapeWindow, ShapeBounding, 0, 0,318 XShapeCombineRectangles (mDpy, mShapeWindow, ShapeBounding, 0, 0,
326 mBoundingRects, mNBoundingRects,319 mBoundingRects, mNBoundingRects,
327 ShapeSet, mBoundingRectOrdering);320 ShapeSet, mBoundingRectOrdering);
328 }321 }
329 else
330 {
331 XShapeCombineMask (mDpy, mShapeWindow, ShapeBounding,
332 0, 0, None, ShapeSet);
333 }
334322
335 if (mBoundingRects)323 if (mBoundingRects)
336 {324 {