Merge lp:~vanvugt/unity/regionalDamage into lp:unity

Proposed by Daniel van Vugt
Status: Superseded
Proposed branch: lp:~vanvugt/unity/regionalDamage
Merge into: lp:unity
Diff against target: 413 lines (+166/-35)
8 files modified
launcher/AbstractLauncherIcon.h (+1/-0)
launcher/Launcher.cpp (+11/-0)
launcher/Launcher.h (+4/-0)
launcher/LauncherIcon.cpp (+3/-0)
panel/PanelController.cpp (+15/-0)
panel/PanelController.h (+1/-0)
plugins/unityshell/src/unityshell.cpp (+125/-33)
plugins/unityshell/src/unityshell.h (+6/-2)
To merge this branch: bzr merge lp:~vanvugt/unity/regionalDamage
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+109809@code.launchpad.net

Description of the change

*PROTOTYPE*

Stop Unity from redrawing on every frame (ie. when it doesn't need to). It has a severe performance impact on graphics performance (LP: #988079)

For me, this branch eliminates the 25-30% slowdown experienced when unity is running with a single monitor. With 2 monitors, this branch eliminates the 75%(!) slowdown experienced when unity is running. Extrapolate and hypothesize as you like.

This also fixes bug 967112 and bug 992516. Probably more...

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Approve the concept, been wanting to do this for some time ;-)

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

FYI, this is going to have pretty giant conflict with:

https://code.launchpad.net/~smspillaz/unity/unity.less-paint-insanity/+merge/110267

Since the "should we repaint" logic was moved into a separate file.

You should be able to get away with:

12 + /*
13 + * TODO: Figure out if we can ask compiz when:
14 + * output->containsFullscreenWindows();
15 + * and if true, then force doShellRepaint=false here.
16 + */
           bool doShellRepaint = wt->GetDrawList().size() > 0 ||
18 + BackgroundEffectHelper::HasDirtyHelpers() ||
19 + switcher_controller_->Visible() ||
20 + launcher_controller_->IsOverlayOpen() ||
21 + (mask & (PAINT_SCREEN_TRANSFORMED_MASK |
22 + PAINT_SCREEN_FULL_MASK |
23 + PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK));
24 +

if (doShellRepaint)
  ShellRepaintRequired ();

25 + /* Warning: ^ checking for PAINT_SCREEN_FULL_MASK is necessary right now
26 + * to avoid flickering. However it will nullify our performance
27 + * optimizations for people who have enabled "Force full screen
28 + * redraws" in the Workarounds plugin.
29 + */

A small note - it would certainly be nice if we had a method to get a collection of all the nux base windows.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Rev 2405 is way out of date. Ignore it. Still in progress.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I will fix conflicts as they arise :)

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Of course, just a heads up :)

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Tip on detecting if the shell is hidden (I did this once myself).

It might make more sense to use core's built in occlusion detection to figure this out. I think in that case when you get a redraw on a nux window, region will be empty in glPaint. That's worth double checking. (Also worth noting is that this only works if you disable removing the nux windows from the paint list, which should hopefully be done in the future)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Well, the current method of detecting if the shell is occluded is working perfectly. It's also simple and fast. But there's still more testing to go and I'm open to any reasonable changes.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Fix bug 992516 for me too.
Regression: when I try to expand/collapse a dash category Unity freezes (not a crash).

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Sure, just using cores occlusion detection will be faster and less breakable. this will only work wehnwe arent removing nux windows from the paint list.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Fix bug 992516 for me too.
> Regression: when I try to expand/collapse a dash category Unity freezes (not a
> crash).

Nvm. The freeze no longer happens.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :
Download full text (5.3 KiB)

I've noticed that on multiple monitors there is definitely a feedback effect, where compizDamageNux causes something on the second screen to redraw, and then that redraw region is fed right back to us in glPaintOutput which causes that thing to be queued for redraw again.

I'll let you come to your own ideas on this, but one "solution" I've found (and I say "solution" because it has known problems which I think are fixable, more on that on a bit) is to use damageRegion to compute the dirty regions that need redrawing so that we can use the wrap handlers to avoid feedback. For example:

=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2012-06-17 14:17:45 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-06-17 14:18:38 +0000
@@ -1306,34 +1306,35 @@
 {
   bool ret;
+
+ bool requiring_repaint = false;
+
   // A few cases where we want to force the shell to be painted
- if (forcePaintOnTop() ||
- PluginAdapter::Default()->IsExpoActive() ||
+ if ((GetProhibitedPaintMasks () & ShellPaintRequestorInterface::WindowPaintRequestor) ||
+ PluginAdapter::Default ()->IsExpoActive() ||
       (mask & (PAINT_SCREEN_TRANSFORMED_MASK |
                PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK)))
   {
- compizDamageNux(region);
- doShellRepaint = true;
+ requiring_repaint = true;
   }
   else if (shellIsHidden(*output))
   {
     // Don't ever waste GPU and CPU rendering the shell in games/benchmarks!
- doShellRepaint = false;
+ requiring_repaint = false;
   }
   else
   {
- compizDamageNux(region);
- doShellRepaint = wt->GetDrawList().size() > 0 ||
- BackgroundEffectHelper::HasDirtyHelpers();
+ bool isDamaged = RegionIsNuxDamaged (CompRegion (*output));
+ requiring_repaint = isDamaged &&
+ (wt->GetDrawList().size() > 0 ||
+ BackgroundEffectHelper::HasDirtyHelpers());
   }

   /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */
@@ -1419,6 +1416,19 @@

 }

+bool UnityScreen::RegionIsNuxDamaged (const CompRegion &r)
+{
+ static CompRegion tmp = emptyRegion;
+
+ tmp &= emptyRegion;
+ tmp |= r;
+ tmp &= nux_damage_;
+
+ nux_damage_ -= tmp;
+
+ return !tmp.isEmpty ();
+}
+

^ Checks if a particular output region has damaged nux regions intersecting the output region that came from damageRegion

 void UnityScreen::donePaint()
 {
   std::list <ShowdesktopHandlerWindowInterface *> remove_windows;
@@ -1491,8 +1501,6 @@
 /* Grab changed nux regions and add damage rects for them */
 void UnityScreen::nuxDamageCompiz()
 {
- CompRegion nux_damage;
-
   if (damaged)
     return;

@@ -1503,7 +1511,7 @@
        it != end; ++it)
   {
     nux::Geometry const& geo = *it;
- nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height);
+ nux_damage_ += CompRegion(geo.x, geo.y, geo.width, geo.height);
   }

   // launcher_controller_ will still be null on startup
@@ -1518,22 +1526,22 @@
         if (!tooltip.IsNull())
         {
           const nux::Geometry &g = tooltip->GetAbsoluteGeometry();
- nux_damage += CompRegion(g.x, g.y, g.width, g.height)...

Read more...

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

(These feedback problems make it good to think about testing too...)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I haven't even begun multi-monitor testing. Will do this week. Please wait...

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Mon, 18 Jun 2012, Daniel van Vugt wrote:

> I haven't even begun multi-monitor testing. Will do this week. Please wait...

No problem, I've just been playing around with the branch because I want
faster rendering :P

> --
> https://code.launchpad.net/~vanvugt/unity/regionalDamage/+merge/109809
> Your team DX Unity Bugs is subscribed to branch lp:unity.
>

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

(Small update, moving wt->ClearDrawList () to donePaint instead of glPaintOutput fixes most of the annoyances to do with flicking. No nux patching needed)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Looks like this fix now depends on bug 1014610 being resolved for Nux :(

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/AbstractLauncherIcon.h'
--- launcher/AbstractLauncherIcon.h 2012-06-06 15:40:19 +0000
+++ launcher/AbstractLauncherIcon.h 2012-06-19 09:18:19 +0000
@@ -218,6 +218,7 @@
218218
219 sigc::signal<void, AbstractLauncherIcon::Ptr> needs_redraw;219 sigc::signal<void, AbstractLauncherIcon::Ptr> needs_redraw;
220 sigc::signal<void, AbstractLauncherIcon::Ptr> remove;220 sigc::signal<void, AbstractLauncherIcon::Ptr> remove;
221 sigc::signal<void, nux::ObjectPtr<nux::View>> tooltip_visible;
221 sigc::signal<void> visibility_changed;222 sigc::signal<void> visibility_changed;
222223
223 sigc::connection needs_redraw_connection;224 sigc::connection needs_redraw_connection;
224225
=== modified file 'launcher/Launcher.cpp'
--- launcher/Launcher.cpp 2012-06-15 02:03:31 +0000
+++ launcher/Launcher.cpp 2012-06-19 09:18:19 +0000
@@ -1520,6 +1520,11 @@
1520 }1520 }
1521}1521}
15221522
1523nux::ObjectPtr<nux::View> Launcher::GetActiveTooltip() const
1524{
1525 return _active_tooltip;
1526}
1527
1523void Launcher::SetActionState(LauncherActionState actionstate)1528void Launcher::SetActionState(LauncherActionState actionstate)
1524{1529{
1525 if (_launcher_action_state == actionstate)1530 if (_launcher_action_state == actionstate)
@@ -1681,6 +1686,7 @@
1681 EnsureAnimation();1686 EnsureAnimation();
16821687
1683 icon->needs_redraw.connect(sigc::mem_fun(this, &Launcher::OnIconNeedsRedraw));1688 icon->needs_redraw.connect(sigc::mem_fun(this, &Launcher::OnIconNeedsRedraw));
1689 icon->tooltip_visible.connect(sigc::mem_fun(this, &Launcher::OnTooltipVisible));
1684}1690}
16851691
1686void Launcher::OnIconRemoved(AbstractLauncherIcon::Ptr icon)1692void Launcher::OnIconRemoved(AbstractLauncherIcon::Ptr icon)
@@ -1757,6 +1763,11 @@
1757 EnsureAnimation();1763 EnsureAnimation();
1758}1764}
17591765
1766void Launcher::OnTooltipVisible(nux::ObjectPtr<nux::View> view)
1767{
1768 _active_tooltip = view;
1769}
1770
1760void Launcher::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)1771void Launcher::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
1761{1772{
17621773
17631774
=== modified file 'launcher/Launcher.h'
--- launcher/Launcher.h 2012-06-15 02:03:31 +0000
+++ launcher/Launcher.h 2012-06-19 09:18:19 +0000
@@ -96,6 +96,8 @@
96 return _parent;96 return _parent;
97 };97 };
9898
99 nux::ObjectPtr<nux::View> GetActiveTooltip() const; // nullptr = no tooltip
100
99 virtual void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);101 virtual void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
100 virtual void RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);102 virtual void RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);
101 virtual void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);103 virtual void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
@@ -269,6 +271,7 @@
269 void OnOrderChanged();271 void OnOrderChanged();
270272
271 void OnIconNeedsRedraw(AbstractLauncherIcon::Ptr icon);273 void OnIconNeedsRedraw(AbstractLauncherIcon::Ptr icon);
274 void OnTooltipVisible(nux::ObjectPtr<nux::View> view);
272275
273 void OnOverlayHidden(GVariant* data);276 void OnOverlayHidden(GVariant* data);
274 void OnOverlayShown(GVariant* data);277 void OnOverlayShown(GVariant* data);
@@ -311,6 +314,7 @@
311314
312 LauncherModel::Ptr _model;315 LauncherModel::Ptr _model;
313 nux::BaseWindow* _parent;316 nux::BaseWindow* _parent;
317 nux::ObjectPtr<nux::View> _active_tooltip;
314 QuicklistView* _active_quicklist;318 QuicklistView* _active_quicklist;
315319
316 nux::HLayout* m_Layout;320 nux::HLayout* m_Layout;
317321
=== modified file 'launcher/LauncherIcon.cpp'
--- launcher/LauncherIcon.cpp 2012-06-19 01:00:36 +0000
+++ launcher/LauncherIcon.cpp 2012-06-19 09:18:19 +0000
@@ -513,6 +513,7 @@
513 LoadTooltip();513 LoadTooltip();
514 _tooltip->ShowTooltipWithTipAt(tip_x, tip_y);514 _tooltip->ShowTooltipWithTipAt(tip_x, tip_y);
515 _tooltip->ShowWindow(!tooltip_text().empty());515 _tooltip->ShowWindow(!tooltip_text().empty());
516 tooltip_visible.emit(_tooltip);
516}517}
517518
518void519void
@@ -534,6 +535,7 @@
534535
535 if (_tooltip)536 if (_tooltip)
536 _tooltip->ShowWindow(false);537 _tooltip->ShowWindow(false);
538 tooltip_visible.emit(nux::ObjectPtr<nux::View>(nullptr));
537}539}
538540
539bool LauncherIcon::OpenQuicklist(bool select_first_item, int monitor)541bool LauncherIcon::OpenQuicklist(bool select_first_item, int monitor)
@@ -653,6 +655,7 @@
653{655{
654 if (_tooltip)656 if (_tooltip)
655 _tooltip->ShowWindow(false);657 _tooltip->ShowWindow(false);
658 tooltip_visible.emit(nux::ObjectPtr<nux::View>(nullptr));
656}659}
657660
658bool661bool
659662
=== modified file 'panel/PanelController.cpp'
--- panel/PanelController.cpp 2012-06-15 02:03:31 +0000
+++ panel/PanelController.cpp 2012-06-19 09:18:19 +0000
@@ -49,6 +49,7 @@
49 void QueueRedraw();49 void QueueRedraw();
5050
51 std::vector<Window> GetTrayXids() const;51 std::vector<Window> GetTrayXids() const;
52 std::vector<nux::View*> GetPanelViews() const;
52 std::vector<nux::Geometry> GetGeometries() const;53 std::vector<nux::Geometry> GetGeometries() const;
5354
54 // NOTE: nux::Property maybe?55 // NOTE: nux::Property maybe?
@@ -106,6 +107,15 @@
106 return xids;107 return xids;
107}108}
108109
110std::vector<nux::View*> Controller::Impl::GetPanelViews() const
111{
112 std::vector<nux::View*> views;
113 views.reserve(windows_.size());
114 for (auto window: windows_)
115 views.push_back(ViewForWindow(window));
116 return views;
117}
118
109std::vector<nux::Geometry> Controller::Impl::GetGeometries() const119std::vector<nux::Geometry> Controller::Impl::GetGeometries() const
110{120{
111 std::vector<nux::Geometry> geometries;121 std::vector<nux::Geometry> geometries;
@@ -325,6 +335,11 @@
325 return pimpl->GetTrayXids();335 return pimpl->GetTrayXids();
326}336}
327337
338std::vector<nux::View*> Controller::GetPanelViews() const
339{
340 return pimpl->GetPanelViews();
341}
342
328std::vector<nux::Geometry> Controller::GetGeometries() const343std::vector<nux::Geometry> Controller::GetGeometries() const
329{344{
330 return pimpl->GetGeometries();345 return pimpl->GetGeometries();
331346
=== modified file 'panel/PanelController.h'
--- panel/PanelController.h 2012-05-06 23:48:38 +0000
+++ panel/PanelController.h 2012-06-19 09:18:19 +0000
@@ -41,6 +41,7 @@
41 void QueueRedraw();41 void QueueRedraw();
4242
43 std::vector<Window> GetTrayXids() const;43 std::vector<Window> GetTrayXids() const;
44 std::vector<nux::View*> GetPanelViews() const;
44 std::vector<nux::Geometry> GetGeometries() const;45 std::vector<nux::Geometry> GetGeometries() const;
4546
46 // NOTE: nux::Property maybe?47 // NOTE: nux::Property maybe?
4748
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2012-06-15 02:03:31 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-06-19 09:18:19 +0000
@@ -1204,7 +1204,20 @@
1204{1204{
1205 bool ret;1205 bool ret;
12061206
1207 doShellRepaint = true;1207 /*
1208 * Very important!
1209 * Don't waste GPU and CPU rendering the shell on every frame if you don't
1210 * need to. Doing so on every frame causes Nux to hog the GPU and slow down
1211 * all other OpenGL apps (LP: #988079)
1212 */
1213 if (forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive())
1214 doShellRepaint = true;
1215 else if (region.isEmpty() || shellIsHidden(*output))
1216 doShellRepaint = false;
1217 else
1218 doShellRepaint = wt->GetDrawList().size() > 0 ||
1219 BackgroundEffectHelper::HasDirtyHelpers();
1220
1208 allowWindowPaint = true;1221 allowWindowPaint = true;
1209 _last_output = output;1222 _last_output = output;
1210 paint_panel_ = false;1223 paint_panel_ = false;
@@ -1220,7 +1233,8 @@
1220 * attempts to bind it will only increment1233 * attempts to bind it will only increment
1221 * its bind reference so make sure that1234 * its bind reference so make sure that
1222 * you always unbind as much as you bind */1235 * you always unbind as much as you bind */
1223 _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ()));1236 if (doShellRepaint)
1237 _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ()));
1224#endif1238#endif
12251239
1226 /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */1240 /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */
@@ -1279,16 +1293,20 @@
1279 for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows)1293 for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows)
1280 wi->HandleAnimations (ms);1294 wi->HandleAnimations (ms);
12811295
1296 // Workaround Nux bug LP: #1014610:
1282 if (damaged)1297 if (damaged)
1283 {1298 {
1284 damaged = false;1299 damaged = false;
1285 damageNuxRegions();1300 nuxDamageCompiz();
1286 }1301 }
12871302
1303 compizDamageNux(cScreen->currentDamage());
1288}1304}
12891305
1290void UnityScreen::donePaint()1306void UnityScreen::donePaint()
1291{1307{
1308 wt->ClearDrawList();
1309
1292 std::list <ShowdesktopHandlerWindowInterface *> remove_windows;1310 std::list <ShowdesktopHandlerWindowInterface *> remove_windows;
12931311
1294 for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows)1312 for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows)
@@ -1309,11 +1327,94 @@
1309 cScreen->donePaint ();1327 cScreen->donePaint ();
1310}1328}
13111329
1330bool UnityScreen::shellIsHidden(const CompOutput &output)
1331{
1332 bool hidden = false;
1333 const std::vector<Window> &nuxwins(nux::XInputWindow::NativeHandleList());
1334
1335 // Loop through windows from back to front
1336 for (CompWindow *w : screen->windows ())
1337 {
1338 /*
1339 * The shell is hidden if there exists any window that fully covers
1340 * the output and is in front of all Nux windows on that output.
1341 * We could also check CompositeWindow::opacity() but that would be slower
1342 * and almost always pointless.
1343 */
1344 if (w->isMapped() &&
1345 w->isViewable() &&
1346 !w->inShowDesktopMode() && // Why must this != isViewable?
1347 w->geometry().contains(output))
1348 {
1349 hidden = true;
1350 }
1351 else if (hidden)
1352 {
1353 for (Window n : nuxwins)
1354 {
1355 if (w->id() == n && output.intersects(w->geometry()))
1356 {
1357 hidden = false;
1358 break;
1359 }
1360 }
1361 }
1362 }
1363
1364 return hidden;
1365}
1366
1367void UnityScreen::compizDamageNux(const CompRegion &damage)
1368{
1369 auto launchers = launcher_controller_->launchers();
1370 for (auto launcher : launchers)
1371 {
1372 if (!launcher->Hidden())
1373 {
1374 nux::Geometry geo = launcher->GetAbsoluteGeometry();
1375 CompRegion launcher_region(geo.x, geo.y, geo.width, geo.height);
1376 if (damage.intersects(launcher_region))
1377 launcher->QueueDraw();
1378 nux::ObjectPtr<nux::View> tooltip = launcher->GetActiveTooltip();
1379 if (!tooltip.IsNull())
1380 {
1381 nux::Geometry tip = tooltip->GetAbsoluteGeometry();
1382 CompRegion tip_region(tip.x, tip.y, tip.width, tip.height);
1383 if (damage.intersects(tip_region))
1384 tooltip->QueueDraw();
1385 }
1386 }
1387 }
1388
1389 const std::vector<nux::View*> &panels(panel_controller_->GetPanelViews());
1390 for (nux::View *view : panels)
1391 {
1392 nux::Geometry geo = view->GetAbsoluteGeometry();
1393 CompRegion panel_region(geo.x, geo.y, geo.width, geo.height);
1394 if (damage.intersects(panel_region))
1395 view->QueueDraw();
1396 }
1397
1398 QuicklistManager *qm = QuicklistManager::Default();
1399 if (qm)
1400 {
1401 QuicklistView *view = qm->Current();
1402 if (view)
1403 {
1404 nux::Geometry geo = view->GetAbsoluteGeometry();
1405 CompRegion quicklist_region(geo.x, geo.y, geo.width, geo.height);
1406 if (damage.intersects(quicklist_region))
1407 view->QueueDraw();
1408 }
1409 }
1410}
1411
1312/* Grab changed nux regions and add damage rects for them */1412/* Grab changed nux regions and add damage rects for them */
1313void UnityScreen::damageNuxRegions()1413void UnityScreen::nuxDamageCompiz()
1314{1414{
1315 CompRegion nux_damage;1415 CompRegion nux_damage;
13161416
1417 // Workaround Nux bug LP: #1014610 (unbounded DrawList growth)
1317 if (damaged)1418 if (damaged)
1318 return;1419 return;
13191420
@@ -1327,12 +1428,23 @@
1327 nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height);1428 nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height);
1328 }1429 }
13291430
1330 nux::Geometry geo = wt->GetWindowCompositor().GetTooltipMainWindowGeometry();1431 // launcher_controller_ will still be null on startup
1331 nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height);1432 if (launcher_controller_.get())
13321433 {
1333 geo = lastTooltipArea;1434 auto launchers = launcher_controller_->launchers();
1334 nux_damage += CompRegion(lastTooltipArea.x, lastTooltipArea.y,1435 for (auto launcher : launchers)
1335 lastTooltipArea.width, lastTooltipArea.height);1436 {
1437 if (!launcher->Hidden())
1438 {
1439 nux::ObjectPtr<nux::View> tooltip = launcher->GetActiveTooltip();
1440 if (!tooltip.IsNull())
1441 {
1442 const nux::Geometry &g = tooltip->GetAbsoluteGeometry();
1443 nux_damage += CompRegion(g.x, g.y, g.width, g.height);
1444 }
1445 }
1446 }
1447 }
13361448
1337 /*1449 /*
1338 * Avoid Nux damaging Nux as recommended by smspillaz. Though I don't1450 * Avoid Nux damaging Nux as recommended by smspillaz. Though I don't
@@ -1341,10 +1453,6 @@
1341 cScreen->damageRegionSetEnabled(this, false);1453 cScreen->damageRegionSetEnabled(this, false);
1342 cScreen->damageRegion(nux_damage);1454 cScreen->damageRegion(nux_damage);
1343 cScreen->damageRegionSetEnabled(this, true);1455 cScreen->damageRegionSetEnabled(this, true);
1344
1345 wt->ClearDrawList();
1346
1347 lastTooltipArea = geo;
1348}1456}
13491457
1350/* handle X Events */1458/* handle X Events */
@@ -1511,6 +1619,8 @@
1511 BackgroundEffectHelper::ProcessDamage(geo);1619 BackgroundEffectHelper::ProcessDamage(geo);
1512 }1620 }
15131621
1622 compizDamageNux(region);
1623
1514 cScreen->damageRegion(region);1624 cScreen->damageRegion(region);
1515}1625}
15161626
@@ -2527,25 +2637,7 @@
25272637
2528void UnityScreen::onRedrawRequested()2638void UnityScreen::onRedrawRequested()
2529{2639{
2530 // disable blur updates so we dont waste perf. This can stall the blur during animations2640 nuxDamageCompiz();
2531 // but ensures a smooth animation.
2532 if (_in_paint)
2533 {
2534 if (!sources_.GetSource(local::REDRAW_IDLE))
2535 {
2536 auto redraw_idle(std::make_shared<glib::Idle>(glib::Source::Priority::DEFAULT));
2537 sources_.Add(redraw_idle, local::REDRAW_IDLE);
2538
2539 redraw_idle->Run([&]() {
2540 onRedrawRequested();
2541 return false;
2542 });
2543 }
2544 }
2545 else
2546 {
2547 damageNuxRegions();
2548 }
2549}2641}
25502642
2551/* Handle option changes and plug that into nux windows */2643/* Handle option changes and plug that into nux windows */
25522644
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2012-06-15 02:03:31 +0000
+++ plugins/unityshell/src/unityshell.h 2012-06-19 09:18:19 +0000
@@ -212,7 +212,12 @@
212212
213 bool initPluginActions();213 bool initPluginActions();
214 void initLauncher();214 void initLauncher();
215 void damageNuxRegions();215
216 void compizDamageNux(const CompRegion &region);
217 void nuxDamageCompiz();
218
219 bool shellIsHidden(const CompOutput &output);
220
216 void onRedrawRequested();221 void onRedrawRequested();
217 void Relayout();222 void Relayout();
218223
@@ -255,7 +260,6 @@
255 bool enable_shortcut_overlay_;260 bool enable_shortcut_overlay_;
256261
257 GestureEngine gesture_engine_;262 GestureEngine gesture_engine_;
258 nux::Geometry lastTooltipArea;
259 bool needsRelayout;263 bool needsRelayout;
260 bool _in_paint;264 bool _in_paint;
261 bool super_keypressed_;265 bool super_keypressed_;