From 3991aaaa39e4f70c565c6bf3c9ec9b8c6a9bdabc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 9 Jun 2012 02:56:37 +0200 Subject: Use glib::SourceManager Add utility functions to add Idles and Timeouts (bzr r2364.10.3) --- plugins/unityshell/src/unityshell.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 8807779ff..29f2a6365 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1418,7 +1418,7 @@ void UnityScreen::handleEvent(XEvent* event) { /* We need an idle to postpone this action, after the current event * has been processed */ - sources_.Add(std::make_shared([&]() { + sources_.AddIdle([&] { if (!launcher_controller_->KeyNavIsActive()) { shortcut_controller_->SetEnabled(false); @@ -1426,7 +1426,7 @@ void UnityScreen::handleEvent(XEvent* event) EnableCancelAction(CancelActionTarget::SHORTCUT_HINT, false); } return false; - })); + }); } skip_other_plugins = launcher_controller_->HandleLauncherKeyEvent(screen->dpy(), key_sym, event->xkey.keycode, event->xkey.state, key_string); @@ -2723,17 +2723,14 @@ void UnityScreen::ScheduleRelayout(guint timeout) { if (!sources_.GetSource(local::RELAYOUT_TIMEOUT)) { - auto relayout_timeout(std::make_shared(timeout)); - sources_.Add(relayout_timeout, local::RELAYOUT_TIMEOUT); - - relayout_timeout->Run([&]() { + sources_.AddTimeout(timeout, [&] { NeedsRelayout(); Relayout(); cScreen->damageScreen(); return false; - }); + }, local::RELAYOUT_TIMEOUT); } } -- cgit v1.2.3 From c146dc74cc31bd274262e89882e696c192b4368a Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 12 Jun 2012 16:45:53 +0800 Subject: Initial prototype. Don't redraw Unity shell on every frame; just when we need to. This solves graphics application performance problems (LP: #988079). What's still broken: - Windows damaging the launcher/panel when the launcer/panel are idle. - Screen damage when unmaximizing the dash (changing from fullscreen dash back to normal). (bzr r2399.1.1) --- plugins/unityshell/src/unityshell.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 17b29de18..5b9714465 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1209,7 +1209,20 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, { bool ret; - doShellRepaint = true; + doShellRepaint = wt->GetDrawList().size() > 0 || + BackgroundEffectHelper::HasDirtyHelpers() || + switcher_controller_->Visible() || + launcher_controller_->IsOverlayOpen() || + (mask & (PAINT_SCREEN_TRANSFORMED_MASK | + PAINT_SCREEN_FULL_MASK | + PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK)); + + /* Warning: ^ checking for PAINT_SCREEN_FULL_MASK is necessary right now + * to avoid flickering. However it will cause a performance + * regression for people who have enabled "Force full screen + * redraws" in the Workarounds plugin. + */ + allowWindowPaint = true; _last_output = output; paint_panel_ = false; @@ -1225,7 +1238,8 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, * attempts to bind it will only increment * its bind reference so make sure that * you always unbind as much as you bind */ - _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ())); + if (doShellRepaint) + _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ())); #endif /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */ @@ -1236,6 +1250,8 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, paintDisplay(region, transform, mask); #endif + wt->ClearDrawList(); + return ret; } @@ -1340,8 +1356,6 @@ void UnityScreen::damageNuxRegions() lastTooltipArea.width, lastTooltipArea.height); cScreen->damageRegion(nux_damage); - wt->ClearDrawList(); - lastTooltipArea = geo; } @@ -2563,6 +2577,7 @@ gboolean UnityScreen::OnRedrawTimeout(gpointer data) void UnityScreen::onRedrawRequested() { +#if 0 // disable blur updates so we dont waste perf. This can stall the blur during animations // but ensures a smooth animation. if (_in_paint) @@ -2571,6 +2586,7 @@ void UnityScreen::onRedrawRequested() _redraw_handle = g_idle_add_full (G_PRIORITY_DEFAULT, &UnityScreen::OnRedrawTimeout, this, NULL); } else +#endif { damageNuxRegions(); } -- cgit v1.2.3 From c6d0a8ea87a929392334cb0ea926629c3ce3c695 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 12 Jun 2012 17:45:49 +0800 Subject: Fixed almost all damage problems. (bzr r2399.1.2) --- plugins/unityshell/src/unityshell.cpp | 35 ++++++++++++++++++++++++++++++++--- plugins/unityshell/src/unityshell.h | 3 ++- 2 files changed, 34 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 5b9714465..e878ff63a 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1209,6 +1209,9 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, { bool ret; + if (mask & PAINT_SCREEN_REGION_MASK) + compizDamageNux(region); + doShellRepaint = wt->GetDrawList().size() > 0 || BackgroundEffectHelper::HasDirtyHelpers() || switcher_controller_->Visible() || @@ -1303,7 +1306,7 @@ void UnityScreen::preparePaint(int ms) if (damaged) { damaged = false; - damageNuxRegions(); + nuxDamageCompiz(); } } @@ -1330,8 +1333,34 @@ void UnityScreen::donePaint() cScreen->donePaint (); } +void UnityScreen::compizDamageNux(const CompRegion &damage) +{ + auto launchers = launcher_controller_->launchers(); + + for (auto launcher : launchers) + { + if (!launcher->Hidden()) + { + nux::Geometry geo = launcher->GetAbsoluteGeometry(); + CompRegion launcher_region(geo.x, geo.y, geo.width, geo.height); + if (damage.intersects(launcher_region)) + launcher->QueueDraw(); + } + } + + for (nux::Geometry &geo : panel_controller_->GetGeometries()) + { + CompRegion panel_region(geo.x, geo.y, geo.width, geo.height); + if (damage.intersects(panel_region)) + { + panel_controller_->QueueRedraw(); + break; + } + } +} + /* Grab changed nux regions and add damage rects for them */ -void UnityScreen::damageNuxRegions() +void UnityScreen::nuxDamageCompiz() { CompRegion nux_damage; @@ -2588,7 +2617,7 @@ void UnityScreen::onRedrawRequested() else #endif { - damageNuxRegions(); + nuxDamageCompiz(); } } diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 46cad8290..02c3de7f6 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -211,7 +211,8 @@ private: static gboolean initPluginActions(gpointer data); void initLauncher(); - void damageNuxRegions(); + void compizDamageNux(const CompRegion ®ion); + void nuxDamageCompiz(); void onRedrawRequested(); void Relayout(); -- cgit v1.2.3 From defaaef9a04aa0d1afe8db16d201f532b07f2957 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 12 Jun 2012 17:57:06 +0800 Subject: Remove an old optimization which is now redundant and in fact harmful (it seems to make performance worse now). (bzr r2399.1.3) --- plugins/unityshell/src/unityshell.cpp | 24 +----------------------- plugins/unityshell/src/unityshell.h | 1 - 2 files changed, 1 insertion(+), 24 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index e878ff63a..11ec70a42 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -2594,31 +2594,9 @@ void UnityScreen::initUnity(nux::NThread* thread, void* InitData) LOG_INFO(logger) << "UnityScreen::initUnity: " << timer.ElapsedSeconds() << "s"; } -gboolean UnityScreen::OnRedrawTimeout(gpointer data) -{ - UnityScreen *self = reinterpret_cast(data); - - self->_redraw_handle = 0; - self->onRedrawRequested(); - - return FALSE; -} - void UnityScreen::onRedrawRequested() { -#if 0 - // disable blur updates so we dont waste perf. This can stall the blur during animations - // but ensures a smooth animation. - if (_in_paint) - { - if (!_redraw_handle) - _redraw_handle = g_idle_add_full (G_PRIORITY_DEFAULT, &UnityScreen::OnRedrawTimeout, this, NULL); - } - else -#endif - { - nuxDamageCompiz(); - } + nuxDamageCompiz(); } /* Handle option changes and plug that into nux windows */ diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 02c3de7f6..50acfc60d 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -220,7 +220,6 @@ private: static void initUnity(nux::NThread* thread, void* InitData); static void OnStartKeyNav(GVariant* data, void* value); static void OnExitKeyNav(GVariant* data, void* value); - static gboolean OnRedrawTimeout(gpointer data); void startLauncherKeyNav(); void restartLauncherKeyNav(); -- cgit v1.2.3 From 015711fbbeb5a6c1aa72bcb0fe58b0899bd47dac Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 12 Jun 2012 18:31:41 +0800 Subject: Add stub for redrawing tooltips damaged by other windows (compiz). Not finished yet. (bzr r2399.1.4) --- plugins/unityshell/src/unityshell.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 11ec70a42..82dfd3e40 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1348,7 +1348,8 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) } } - for (nux::Geometry &geo : panel_controller_->GetGeometries()) + std::vector geos = panel_controller_->GetGeometries(); + for (nux::Geometry &geo : geos) { CompRegion panel_region(geo.x, geo.y, geo.width, geo.height); if (damage.intersects(panel_region)) @@ -1357,6 +1358,19 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) break; } } + + nux::WindowCompositor &compositor = wt->GetWindowCompositor(); + if (compositor.IsTooltipActive()) + { + nux::Geometry geo = compositor.GetTooltipMainWindowGeometry(); + CompRegion tooltip_region(geo.x, geo.y, geo.width, geo.height); + if (damage.intersects(tooltip_region)) + { + // FIXME - nux::WindowCompositor has no public API for requesting + // redraw of a Tooltip. Until then, windows can redraw over + // the top of the active tooltip. + } + } } /* Grab changed nux regions and add damage rects for them */ -- cgit v1.2.3 From 894dca85a4bac9c51b3c699e5e56c70dd347f7c4 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 12 Jun 2012 19:09:01 +0800 Subject: Tidy up comments (bzr r2399.1.5) --- plugins/unityshell/src/unityshell.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 82dfd3e40..d05875557 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1212,6 +1212,11 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, if (mask & PAINT_SCREEN_REGION_MASK) compizDamageNux(region); + /* + * TODO: Figure out if we can ask compiz when: + * output->containsFullscreenWindows(); + * and if true, then force doShellRepaint=false here. + */ doShellRepaint = wt->GetDrawList().size() > 0 || BackgroundEffectHelper::HasDirtyHelpers() || switcher_controller_->Visible() || @@ -1221,8 +1226,8 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK)); /* Warning: ^ checking for PAINT_SCREEN_FULL_MASK is necessary right now - * to avoid flickering. However it will cause a performance - * regression for people who have enabled "Force full screen + * to avoid flickering. However it will nullify our performance + * optimizations for people who have enabled "Force full screen * redraws" in the Workarounds plugin. */ @@ -1336,7 +1341,6 @@ void UnityScreen::donePaint() void UnityScreen::compizDamageNux(const CompRegion &damage) { auto launchers = launcher_controller_->launchers(); - for (auto launcher : launchers) { if (!launcher->Hidden()) @@ -1366,9 +1370,11 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) CompRegion tooltip_region(geo.x, geo.y, geo.width, geo.height); if (damage.intersects(tooltip_region)) { - // FIXME - nux::WindowCompositor has no public API for requesting - // redraw of a Tooltip. Until then, windows can redraw over - // the top of the active tooltip. + /* + * FIXME - nux::WindowCompositor has no public API for requesting + * redraw of a Tooltip. Until then, windows can redraw over + * the top of the active tooltip. + */ } } } -- cgit v1.2.3 From 527c5cf37374a3121b8af9acd12175f19d26ebfa Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Wed, 13 Jun 2012 15:38:37 +0800 Subject: Simplified. We no longer need to force shell repainting on all full-screen redraws, so the performance optimization will now also work for people who have full screen redraws enabled. (bzr r2399.1.9) --- plugins/unityshell/src/unityshell.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 13cf8ed47..3eb70036c 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1204,8 +1204,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, { bool ret; - if (mask & PAINT_SCREEN_REGION_MASK) - compizDamageNux(region); + compizDamageNux(region); /* * TODO: Figure out if we can ask compiz when: @@ -1217,15 +1216,8 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, switcher_controller_->Visible() || launcher_controller_->IsOverlayOpen() || (mask & (PAINT_SCREEN_TRANSFORMED_MASK | - PAINT_SCREEN_FULL_MASK | PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK)); - /* Warning: ^ checking for PAINT_SCREEN_FULL_MASK is necessary right now - * to avoid flickering. However it will nullify our performance - * optimizations for people who have enabled "Force full screen - * redraws" in the Workarounds plugin. - */ - allowWindowPaint = true; _last_output = output; paint_panel_ = false; -- cgit v1.2.3 From 19378c66cd51a3fe69af7a31780241148c6a57e6 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 14 Jun 2012 13:45:39 +0800 Subject: Ensure Quicklists always draw on top of any compiz damage below them. (bzr r2399.1.10) --- plugins/unityshell/src/unityshell.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 3eb70036c..c5cd15bb4 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1350,18 +1350,16 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) } } - nux::WindowCompositor &compositor = wt->GetWindowCompositor(); - if (compositor.IsTooltipActive()) + QuicklistManager *qm = QuicklistManager::Default(); + if (qm) { - nux::Geometry geo = compositor.GetTooltipMainWindowGeometry(); - CompRegion tooltip_region(geo.x, geo.y, geo.width, geo.height); - if (damage.intersects(tooltip_region)) + QuicklistView *view = qm->Current(); + if (view) { - /* - * FIXME - nux::WindowCompositor has no public API for requesting - * redraw of a Tooltip. Until then, windows can redraw over - * the top of the active tooltip. - */ + nux::Geometry geo = view->GetAbsoluteGeometry(); + CompRegion quicklist_region(geo.x, geo.y, geo.width, geo.height); + if (damage.intersects(quicklist_region)) + view->QueueDraw(); } } } -- cgit v1.2.3 From 94ab30726e9fa8ab560fd54f19172e2c89653542 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 14 Jun 2012 16:34:01 +0800 Subject: Finally, tooltips draw on top of compiz damage. However, still some problems with not all of the tooltip being redrawn. Probably incomplete communication of tooltips queued for drawing --> compiz damage. (bzr r2399.1.11) --- plugins/unityshell/src/unityshell.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index c5cd15bb4..502a07971 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1336,6 +1336,14 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) CompRegion launcher_region(geo.x, geo.y, geo.width, geo.height); if (damage.intersects(launcher_region)) launcher->QueueDraw(); + nux::View *tooltip = launcher->GetActiveTooltip(); + if (tooltip) + { + nux::Geometry tip = tooltip->GetAbsoluteGeometry(); + CompRegion tip_region(tip.x, tip.y, tip.width, tip.height); + if (damage.intersects(tip_region)) + tooltip->QueueDraw(); + } } } -- cgit v1.2.3 From d2f800a89ed18c07da1801d7a7d827525d225684 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 14 Jun 2012 16:49:09 +0800 Subject: Merge in lp:~vanvugt/unity/fix-865006 because we will need the new function UnityScreen::damageRegion soon. (bzr r2399.1.13) --- plugins/unityshell/src/unityshell.cpp | 51 +++++++++++------------------------ plugins/unityshell/src/unityshell.h | 1 + 2 files changed, 17 insertions(+), 35 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 502a07971..6bcff1801 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1396,7 +1396,14 @@ void UnityScreen::nuxDamageCompiz() geo = lastTooltipArea; nux_damage += CompRegion(lastTooltipArea.x, lastTooltipArea.y, lastTooltipArea.width, lastTooltipArea.height); + + /* + * Avoid Nux damaging Nux as recommended by smspillaz. Though I don't + * believe it would be harmful or significantly expensive right now. + */ + cScreen->damageRegionSetEnabled(this, false); cScreen->damageRegion(nux_damage); + cScreen->damageRegionSetEnabled(this, true); lastTooltipArea = geo; } @@ -1554,44 +1561,18 @@ void UnityScreen::handleEvent(XEvent* event) { wt->ProcessForeignEvent(event, NULL); } +} - if (event->type == cScreen->damageEvent() + XDamageNotify) +void UnityScreen::damageRegion(const CompRegion ®ion) +{ + const CompRect::vector &rects(region.rects()); + for (const CompRect &r : rects) { - XDamageNotifyEvent *de = (XDamageNotifyEvent *) event; - CompWindow* w = screen->findWindow (de->drawable); - std::vector const& xwns = nux::XInputWindow::NativeHandleList(); - CompWindow* lastNWindow = screen->findWindow (xwns.back ()); - bool processDamage = true; - - if (w) - { - if (!w->overrideRedirect () && - w->isViewable () && - !w->invisible ()) - { - - for (; lastNWindow != NULL; lastNWindow = lastNWindow->next) - { - if (lastNWindow == w) - { - processDamage = false; - break; - } - } - - if (processDamage) - { - nux::Geometry damage (de->area.x, de->area.y, de->area.width, de->area.height); - - const CompWindow::Geometry &geom = w->geometry (); - damage.x += geom.x () + geom.border (); - damage.y += geom.y () + geom.border (); - - BackgroundEffectHelper::ProcessDamage(damage); - } - } - } + nux::Geometry geo(r.x(), r.y(), r.width(), r.height()); + BackgroundEffectHelper::ProcessDamage(geo); } + + cScreen->damageRegion(region); } void UnityScreen::handleCompizEvent(const char* plugin, diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 1805865bb..9e6c7989e 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -111,6 +111,7 @@ public: const char *eventName, CompOption::Vector &o); + void damageRegion(const CompRegion ®ion); /* paint on top of all windows if we could not find a window * to paint underneath */ -- cgit v1.2.3 From 2b09371474cbb068e3f5121eee62e79838e586b2 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 14 Jun 2012 17:15:06 +0800 Subject: Much improved rendering of tooltips on top of Nux damage. Still not perfect. (bzr r2399.1.14) --- plugins/unityshell/src/unityshell.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 6bcff1801..a8416eb9b 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1204,7 +1204,13 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, { bool ret; - compizDamageNux(region); + /* + * I believe hooking CompositeScreen::damageScreen is the preferred method + * but CompositeScreen::damageScreen is not wrapped (yet). + */ + if (mask & PAINT_SCREEN_FULL_MASK) + compizDamageNux(region); + // else compizDamageNux is called from UnityScreen::damageRegion. /* * TODO: Figure out if we can ask compiz when: @@ -1342,7 +1348,10 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) nux::Geometry tip = tooltip->GetAbsoluteGeometry(); CompRegion tip_region(tip.x, tip.y, tip.width, tip.height); if (damage.intersects(tip_region)) + { + launcher->QueueDraw(); tooltip->QueueDraw(); + } } } } @@ -1565,6 +1574,8 @@ void UnityScreen::handleEvent(XEvent* event) void UnityScreen::damageRegion(const CompRegion ®ion) { + compizDamageNux(region); + const CompRect::vector &rects(region.rects()); for (const CompRect &r : rects) { -- cgit v1.2.3 From 91fb6b7140b84b1183ba4cd3edee980cb65282bd Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 14 Jun 2012 17:27:06 +0800 Subject: More const, less copying. (bzr r2399.1.15) --- plugins/unityshell/src/unityshell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index a8416eb9b..ffa01e0c4 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1356,8 +1356,8 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) } } - std::vector geos = panel_controller_->GetGeometries(); - for (nux::Geometry &geo : geos) + const std::vector &geos(panel_controller_->GetGeometries()); + for (const nux::Geometry &geo : geos) { CompRegion panel_region(geo.x, geo.y, geo.width, geo.height); if (damage.intersects(panel_region)) -- cgit v1.2.3 From d5da1bff08ddfaca6f3a8eb07d649c14d05fdd4f Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 14 Jun 2012 17:48:15 +0800 Subject: Use safer reference-counted pointers (bzr r2399.1.16) --- plugins/unityshell/src/unityshell.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index ffa01e0c4..f7875ebd0 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1342,8 +1342,8 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) CompRegion launcher_region(geo.x, geo.y, geo.width, geo.height); if (damage.intersects(launcher_region)) launcher->QueueDraw(); - nux::View *tooltip = launcher->GetActiveTooltip(); - if (tooltip) + nux::ObjectPtr tooltip = launcher->GetActiveTooltip(); + if (!tooltip.IsNull()) { nux::Geometry tip = tooltip->GetAbsoluteGeometry(); CompRegion tip_region(tip.x, tip.y, tip.width, tip.height); @@ -1399,6 +1399,7 @@ void UnityScreen::nuxDamageCompiz() nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height); } + // FIXME: This appears non-functional. Nux doesn't handle tooltips. nux::Geometry geo = wt->GetWindowCompositor().GetTooltipMainWindowGeometry(); nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height); -- cgit v1.2.3 From 4e9c0eb03e2debe676c9edfa273533fe98cc386d Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 14 Jun 2012 18:19:45 +0800 Subject: Finally tooltips render completely. Seems to cause a regression in quicklists though. (bzr r2399.1.17) --- plugins/unityshell/src/unityshell.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index f7875ebd0..663914f52 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1399,11 +1399,25 @@ void UnityScreen::nuxDamageCompiz() nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height); } - // FIXME: This appears non-functional. Nux doesn't handle tooltips. - nux::Geometry geo = wt->GetWindowCompositor().GetTooltipMainWindowGeometry(); - nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height); + // launcher_controller_ will still be null on startup + if (launcher_controller_.get()) + { + auto launchers = launcher_controller_->launchers(); + for (auto launcher : launchers) + { + if (!launcher->Hidden()) + { + nux::ObjectPtr tooltip = launcher->GetActiveTooltip(); + if (!tooltip.IsNull()) + { + const nux::Geometry &g = tooltip->GetAbsoluteGeometry(); + nux_damage += CompRegion(g.x, g.y, g.width, g.height); + } + } + } + } - geo = lastTooltipArea; + nux::Geometry geo = lastTooltipArea; nux_damage += CompRegion(lastTooltipArea.x, lastTooltipArea.y, lastTooltipArea.width, lastTooltipArea.height); -- cgit v1.2.3 From 1bd33bf7d7e8f89975437ea563a6134242c05c65 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 14 Jun 2012 18:30:25 +0800 Subject: Finally fixed all tooltip and quicklist damage bugs ?! (bzr r2399.1.18) --- plugins/unityshell/src/unityshell.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 663914f52..42f1526c5 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1204,13 +1204,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, { bool ret; - /* - * I believe hooking CompositeScreen::damageScreen is the preferred method - * but CompositeScreen::damageScreen is not wrapped (yet). - */ - if (mask & PAINT_SCREEN_FULL_MASK) - compizDamageNux(region); - // else compizDamageNux is called from UnityScreen::damageRegion. + compizDamageNux(region); /* * TODO: Figure out if we can ask compiz when: @@ -1589,8 +1583,6 @@ void UnityScreen::handleEvent(XEvent* event) void UnityScreen::damageRegion(const CompRegion ®ion) { - compizDamageNux(region); - const CompRect::vector &rects(region.rects()); for (const CompRect &r : rects) { -- cgit v1.2.3 From 64fc7af14851ae488c619e647a129bfd8dd859b0 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 14 Jun 2012 18:35:15 +0800 Subject: Remove unnecessary launcher redraw (bzr r2399.1.19) --- plugins/unityshell/src/unityshell.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 42f1526c5..06387718c 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1342,10 +1342,7 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) nux::Geometry tip = tooltip->GetAbsoluteGeometry(); CompRegion tip_region(tip.x, tip.y, tip.width, tip.height); if (damage.intersects(tip_region)) - { - launcher->QueueDraw(); tooltip->QueueDraw(); - } } } } -- cgit v1.2.3 From 231fe7e6f7faf1cb1a7dbdebf74baa32967e9dff Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 15 Jun 2012 18:40:50 +0800 Subject: Detect when a fullscreen window is obscuring the shell and avoid wasting GPU and CPU cycles on redrawing the shell. Very important for games and benchmarks. (bzr r2399.1.22) --- plugins/unityshell/src/unityshell.cpp | 70 ++++++++++++++++++++++++++++------- plugins/unityshell/src/unityshell.h | 4 ++ 2 files changed, 61 insertions(+), 13 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 06387718c..02069e266 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1195,6 +1195,43 @@ void UnityWindow::handleEvent (XEvent *event) } } +bool UnityScreen::shellIsHidden(const CompOutput &output) +{ + bool hidden = false; + const std::vector &nuxwins(nux::XInputWindow::NativeHandleList()); + + // Loop through windows from back to front + for (CompWindow *w : screen->windows ()) + { + /* + * The shell is hidden if there exists any window that fully covers + * the output and is in front of all Nux windows on that output. + * We could also check CompositeWindow::opacity() but that would be slower + * and almost always pointless. + */ + if (w->isMapped() && + w->isViewable() && + !w->inShowDesktopMode() && // Why must this != isViewable? + w->geometry().contains(output)) + { + hidden = true; + } + else if (hidden) + { + for (Window n : nuxwins) + { + if (w->id() == n && output.intersects(w->geometry())) + { + hidden = false; + break; + } + } + } + } + + return hidden; +} + /* called whenever we need to repaint parts of the screen */ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, const GLMatrix& transform, @@ -1204,19 +1241,26 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, { bool ret; - compizDamageNux(region); - - /* - * TODO: Figure out if we can ask compiz when: - * output->containsFullscreenWindows(); - * and if true, then force doShellRepaint=false here. - */ - doShellRepaint = wt->GetDrawList().size() > 0 || - BackgroundEffectHelper::HasDirtyHelpers() || - switcher_controller_->Visible() || - launcher_controller_->IsOverlayOpen() || - (mask & (PAINT_SCREEN_TRANSFORMED_MASK | - PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK)); + // A few cases where we want to force the shell to be painted + if (forcePaintOnTop() || + PluginAdapter::Default()->IsExpoActive() || + (mask & (PAINT_SCREEN_TRANSFORMED_MASK | + PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK))) + { + compizDamageNux(region); + doShellRepaint = true; + } + else if (shellIsHidden(*output)) + { + // Don't ever waste GPU and CPU rendering the shell in games/benchmarks! + doShellRepaint = false; + } + else + { + compizDamageNux(region); + doShellRepaint = wt->GetDrawList().size() > 0 || + BackgroundEffectHelper::HasDirtyHelpers(); + } allowWindowPaint = true; _last_output = output; diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 9e6c7989e..1babbd1eb 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -212,8 +212,12 @@ private: bool initPluginActions(); void initLauncher(); + void compizDamageNux(const CompRegion ®ion); void nuxDamageCompiz(); + + bool shellIsHidden(const CompOutput &output); + void onRedrawRequested(); void Relayout(); -- cgit v1.2.3 From d62ce89e333fbb052bb45af07318fe3ace1e3458 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 14:47:40 +0800 Subject: Shrink the diff. (bzr r2399.1.24) --- plugins/unityshell/src/unityshell.cpp | 74 +++++++++++++++++------------------ 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 02069e266..13925da0f 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1195,43 +1195,6 @@ void UnityWindow::handleEvent (XEvent *event) } } -bool UnityScreen::shellIsHidden(const CompOutput &output) -{ - bool hidden = false; - const std::vector &nuxwins(nux::XInputWindow::NativeHandleList()); - - // Loop through windows from back to front - for (CompWindow *w : screen->windows ()) - { - /* - * The shell is hidden if there exists any window that fully covers - * the output and is in front of all Nux windows on that output. - * We could also check CompositeWindow::opacity() but that would be slower - * and almost always pointless. - */ - if (w->isMapped() && - w->isViewable() && - !w->inShowDesktopMode() && // Why must this != isViewable? - w->geometry().contains(output)) - { - hidden = true; - } - else if (hidden) - { - for (Window n : nuxwins) - { - if (w->id() == n && output.intersects(w->geometry())) - { - hidden = false; - break; - } - } - } - } - - return hidden; -} - /* called whenever we need to repaint parts of the screen */ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, const GLMatrix& transform, @@ -1369,6 +1332,43 @@ void UnityScreen::donePaint() cScreen->donePaint (); } +bool UnityScreen::shellIsHidden(const CompOutput &output) +{ + bool hidden = false; + const std::vector &nuxwins(nux::XInputWindow::NativeHandleList()); + + // Loop through windows from back to front + for (CompWindow *w : screen->windows ()) + { + /* + * The shell is hidden if there exists any window that fully covers + * the output and is in front of all Nux windows on that output. + * We could also check CompositeWindow::opacity() but that would be slower + * and almost always pointless. + */ + if (w->isMapped() && + w->isViewable() && + !w->inShowDesktopMode() && // Why must this != isViewable? + w->geometry().contains(output)) + { + hidden = true; + } + else if (hidden) + { + for (Window n : nuxwins) + { + if (w->id() == n && output.intersects(w->geometry())) + { + hidden = false; + break; + } + } + } + } + + return hidden; +} + void UnityScreen::compizDamageNux(const CompRegion &damage) { auto launchers = launcher_controller_->launchers(); -- cgit v1.2.3 From 5ee825f7acc74f6797b615d77c35f3ebf5d1d323 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 14:51:34 +0800 Subject: Simplify. (bzr r2399.1.25) --- plugins/unityshell/src/unityshell.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 13925da0f..84666e6f9 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1204,11 +1204,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, { bool ret; - // A few cases where we want to force the shell to be painted - if (forcePaintOnTop() || - PluginAdapter::Default()->IsExpoActive() || - (mask & (PAINT_SCREEN_TRANSFORMED_MASK | - PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK))) + if (forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive()) { compizDamageNux(region); doShellRepaint = true; -- cgit v1.2.3 From bc35e6d2d4c7f3046055eafacdf4d6ca78dccc8c Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 15:04:58 +0800 Subject: Move ClearDrawList() to donePaint() as per smspillaz' suggestion. Don't see any difference myself. (bzr r2399.1.26) --- plugins/unityshell/src/unityshell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 84666e6f9..0312ae474 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1248,8 +1248,6 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, paintDisplay(region, transform, mask); #endif - wt->ClearDrawList(); - return ret; } @@ -1308,6 +1306,8 @@ void UnityScreen::preparePaint(int ms) void UnityScreen::donePaint() { + wt->ClearDrawList(); + std::list remove_windows; for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) -- cgit v1.2.3 From 0a9bbeae20fb70546686c1e0d10f72d6b2149f2e Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 15:42:15 +0800 Subject: Fixed feedback loop causing constant CPU usage with multiple monitors. (bzr r2399.1.27) --- plugins/unityshell/src/unityshell.cpp | 20 +------------------- plugins/unityshell/src/unityshell.h | 2 -- 2 files changed, 1 insertion(+), 21 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 0312ae474..149fe9ef6 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -119,7 +119,6 @@ UnityScreen::UnityScreen(CompScreen* screen) , newFocusedWindow(nullptr) , doShellRepaint(false) , allowWindowPaint(false) - , damaged(false) , _key_nav_mode_requested(false) , _last_output(nullptr) #ifndef USE_MODERN_COMPIZ_GL @@ -237,8 +236,6 @@ UnityScreen::UnityScreen(CompScreen* screen) this)); #endif - wt->RedrawRequested.connect(sigc::mem_fun(this, &UnityScreen::onRedrawRequested)); - unity_a11y_init(wt.get()); /* i18n init */ @@ -902,7 +899,6 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo } doShellRepaint = false; - damaged = false; } bool UnityScreen::forcePaintOnTop () @@ -1296,12 +1292,7 @@ void UnityScreen::preparePaint(int ms) for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) wi->HandleAnimations (ms); - if (damaged) - { - damaged = false; - nuxDamageCompiz(); - } - + nuxDamageCompiz(); } void UnityScreen::donePaint() @@ -1417,11 +1408,7 @@ void UnityScreen::nuxDamageCompiz() { CompRegion nux_damage; - if (damaged) - return; - std::vector dirty = wt->GetDrawList(); - damaged = true; for (std::vector::iterator it = dirty.begin(), end = dirty.end(); it != end; ++it) @@ -2641,11 +2628,6 @@ void UnityScreen::initUnity(nux::NThread* thread, void* InitData) LOG_INFO(logger) << "UnityScreen::initUnity: " << timer.ElapsedSeconds() << "s"; } -void UnityScreen::onRedrawRequested() -{ - nuxDamageCompiz(); -} - /* Handle option changes and plug that into nux windows */ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num) { diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 1babbd1eb..a1c68fd4d 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -218,7 +218,6 @@ private: bool shellIsHidden(const CompOutput &output); - void onRedrawRequested(); void Relayout(); static void initUnity(nux::NThread* thread, void* InitData); @@ -278,7 +277,6 @@ private: /* handle paint order */ bool doShellRepaint; bool allowWindowPaint; - bool damaged; bool _key_nav_mode_requested; CompOutput* _last_output; CompWindowList _withRemovedNuxWindows; -- cgit v1.2.3 From c8e5513ffdd39d58ffc51babcb19c6ed92eac367 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 15:48:53 +0800 Subject: Revert previous commit. It causes redraw regressions. (bzr r2399.1.28) --- plugins/unityshell/src/unityshell.cpp | 20 +++++++++++++++++++- plugins/unityshell/src/unityshell.h | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 149fe9ef6..0312ae474 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -119,6 +119,7 @@ UnityScreen::UnityScreen(CompScreen* screen) , newFocusedWindow(nullptr) , doShellRepaint(false) , allowWindowPaint(false) + , damaged(false) , _key_nav_mode_requested(false) , _last_output(nullptr) #ifndef USE_MODERN_COMPIZ_GL @@ -236,6 +237,8 @@ UnityScreen::UnityScreen(CompScreen* screen) this)); #endif + wt->RedrawRequested.connect(sigc::mem_fun(this, &UnityScreen::onRedrawRequested)); + unity_a11y_init(wt.get()); /* i18n init */ @@ -899,6 +902,7 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo } doShellRepaint = false; + damaged = false; } bool UnityScreen::forcePaintOnTop () @@ -1292,7 +1296,12 @@ void UnityScreen::preparePaint(int ms) for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) wi->HandleAnimations (ms); - nuxDamageCompiz(); + if (damaged) + { + damaged = false; + nuxDamageCompiz(); + } + } void UnityScreen::donePaint() @@ -1408,7 +1417,11 @@ void UnityScreen::nuxDamageCompiz() { CompRegion nux_damage; + if (damaged) + return; + std::vector dirty = wt->GetDrawList(); + damaged = true; for (std::vector::iterator it = dirty.begin(), end = dirty.end(); it != end; ++it) @@ -2628,6 +2641,11 @@ void UnityScreen::initUnity(nux::NThread* thread, void* InitData) LOG_INFO(logger) << "UnityScreen::initUnity: " << timer.ElapsedSeconds() << "s"; } +void UnityScreen::onRedrawRequested() +{ + nuxDamageCompiz(); +} + /* Handle option changes and plug that into nux windows */ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num) { diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index a1c68fd4d..1babbd1eb 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -218,6 +218,7 @@ private: bool shellIsHidden(const CompOutput &output); + void onRedrawRequested(); void Relayout(); static void initUnity(nux::NThread* thread, void* InitData); @@ -277,6 +278,7 @@ private: /* handle paint order */ bool doShellRepaint; bool allowWindowPaint; + bool damaged; bool _key_nav_mode_requested; CompOutput* _last_output; CompWindowList _withRemovedNuxWindows; -- cgit v1.2.3 From 60a649fa9da7f0df3d73d0e25ebe78c6b024d097 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 16:21:02 +0800 Subject: Fixed damage feedback causing high CPU, observed with >1 monitors. (bzr r2399.1.29) --- plugins/unityshell/src/unityshell.cpp | 31 ++++++++++--------------------- plugins/unityshell/src/unityshell.h | 1 - 2 files changed, 10 insertions(+), 22 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 0312ae474..7aeaed126 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -119,7 +119,6 @@ UnityScreen::UnityScreen(CompScreen* screen) , newFocusedWindow(nullptr) , doShellRepaint(false) , allowWindowPaint(false) - , damaged(false) , _key_nav_mode_requested(false) , _last_output(nullptr) #ifndef USE_MODERN_COMPIZ_GL @@ -902,7 +901,6 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo } doShellRepaint = false; - damaged = false; } bool UnityScreen::forcePaintOnTop () @@ -1204,22 +1202,19 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, { bool ret; + /* + * Very important! + * Don't waste GPU and CPU rendering the shell on every frame if you don't + * need to. Doing so on every frame causes Nux to hog the GPU and slow down + * all other OpenGL apps (LP: #988079) + */ if (forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive()) - { - compizDamageNux(region); doShellRepaint = true; - } else if (shellIsHidden(*output)) - { - // Don't ever waste GPU and CPU rendering the shell in games/benchmarks! doShellRepaint = false; - } else - { - compizDamageNux(region); doShellRepaint = wt->GetDrawList().size() > 0 || BackgroundEffectHelper::HasDirtyHelpers(); - } allowWindowPaint = true; _last_output = output; @@ -1296,12 +1291,8 @@ void UnityScreen::preparePaint(int ms) for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) wi->HandleAnimations (ms); - if (damaged) - { - damaged = false; - nuxDamageCompiz(); - } - + nuxDamageCompiz(); + compizDamageNux(cScreen->currentDamage()); } void UnityScreen::donePaint() @@ -1417,11 +1408,7 @@ void UnityScreen::nuxDamageCompiz() { CompRegion nux_damage; - if (damaged) - return; - std::vector dirty = wt->GetDrawList(); - damaged = true; for (std::vector::iterator it = dirty.begin(), end = dirty.end(); it != end; ++it) @@ -1627,6 +1614,8 @@ void UnityScreen::damageRegion(const CompRegion ®ion) BackgroundEffectHelper::ProcessDamage(geo); } + compizDamageNux(region); + cScreen->damageRegion(region); } diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 1babbd1eb..726eea4bc 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -278,7 +278,6 @@ private: /* handle paint order */ bool doShellRepaint; bool allowWindowPaint; - bool damaged; bool _key_nav_mode_requested; CompOutput* _last_output; CompWindowList _withRemovedNuxWindows; -- cgit v1.2.3 From 175ae302acd49e9ea1d91aea34224d8ff83d2c71 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 16:56:53 +0800 Subject: Add debug code. Will need it again. It seems shellIsHidden() isn't working perfectly. There are two buggy cases: 1. Two monitors and fullscreen video on one monitor --> results in shell repaints far too often. Even though the shell on the monitor with the video isn't visible. 2. Again, a fullscreen window on one monitor. Now if you focus any window on the other monitor, the shell will overdraw the fullscreen window on the second. Not sure if this is a new bug though... ? (bzr r2399.1.30) --- plugins/unityshell/src/unityshell.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 7aeaed126..c047ccbbe 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1216,6 +1216,9 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, doShellRepaint = wt->GetDrawList().size() > 0 || BackgroundEffectHelper::HasDirtyHelpers(); +// g_print("vv: glPaintOutput %u: doShellRepaint=%s\n", +// output->id(), doShellRepaint?"Y":"N"); + allowWindowPaint = true; _last_output = output; paint_panel_ = false; -- cgit v1.2.3 From 484befdcd99663a8751a3e03fc41208bb65a75e0 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 17:47:57 +0800 Subject: Don't repaint the shell on outputs where the repaint region is empty. Maybe the opengl plugin needs fixing. Not sure. (bzr r2399.1.31) --- plugins/unityshell/src/unityshell.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index c047ccbbe..aace4039e 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1210,15 +1210,17 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, */ if (forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive()) doShellRepaint = true; - else if (shellIsHidden(*output)) + else if (region.isEmpty() || shellIsHidden(*output)) doShellRepaint = false; else doShellRepaint = wt->GetDrawList().size() > 0 || BackgroundEffectHelper::HasDirtyHelpers(); - -// g_print("vv: glPaintOutput %u: doShellRepaint=%s\n", -// output->id(), doShellRepaint?"Y":"N"); - +#if 0 + g_print("vv: glPaintOutput %u: doShellRepaint=%s emptyregion=%s\n", + output->id(), doShellRepaint?"Y":"N", + region.isEmpty() ? "Y":"N" + ); +#endif allowWindowPaint = true; _last_output = output; paint_panel_ = false; -- cgit v1.2.3 From 57e28dc9e11a9a9258e26835aa00cf60cce1dfea Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 17:53:20 +0800 Subject: Remove redundant damage call. (bzr r2399.1.32) --- plugins/unityshell/src/unityshell.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index aace4039e..f398e45b0 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1296,7 +1296,6 @@ void UnityScreen::preparePaint(int ms) for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) wi->HandleAnimations (ms); - nuxDamageCompiz(); compizDamageNux(cScreen->currentDamage()); } -- cgit v1.2.3 From f31b17b3b898c962492d148cb95744d6bedf14d2 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 18:14:13 +0800 Subject: Remove some dead damage code. (bzr r2399.1.33) --- plugins/unityshell/src/unityshell.cpp | 6 ------ plugins/unityshell/src/unityshell.h | 1 - 2 files changed, 7 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index f398e45b0..b35fda7fb 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1439,10 +1439,6 @@ void UnityScreen::nuxDamageCompiz() } } - nux::Geometry geo = lastTooltipArea; - nux_damage += CompRegion(lastTooltipArea.x, lastTooltipArea.y, - lastTooltipArea.width, lastTooltipArea.height); - /* * Avoid Nux damaging Nux as recommended by smspillaz. Though I don't * believe it would be harmful or significantly expensive right now. @@ -1450,8 +1446,6 @@ void UnityScreen::nuxDamageCompiz() cScreen->damageRegionSetEnabled(this, false); cScreen->damageRegion(nux_damage); cScreen->damageRegionSetEnabled(this, true); - - lastTooltipArea = geo; } /* handle X Events */ diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 726eea4bc..583b0e0bd 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -260,7 +260,6 @@ private: bool enable_shortcut_overlay_; GestureEngine gesture_engine_; - nux::Geometry lastTooltipArea; bool needsRelayout; bool _in_paint; bool super_keypressed_; -- cgit v1.2.3 From 7dbea2d5dcf5a6e5de9e3ea9127fa7f5dfff7196 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 18:21:11 +0800 Subject: Faster startup. I think. (bzr r2399.1.34) --- plugins/unityshell/src/unityshell.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index b35fda7fb..28a8cc90d 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1410,6 +1410,9 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) /* Grab changed nux regions and add damage rects for them */ void UnityScreen::nuxDamageCompiz() { + if (!launcher_controller_.get()) // Don't slow down during startup + return; + CompRegion nux_damage; std::vector dirty = wt->GetDrawList(); -- cgit v1.2.3 From 86f1aaca41b7f89557981fbf7bd038584363f5ea Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 19:25:43 +0800 Subject: Slight improvement in avoiding DrawList floods, which are causing UI pauses. (bzr r2399.1.35) --- plugins/unityshell/src/unityshell.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 28a8cc90d..08a7a46eb 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1215,6 +1215,8 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, else doShellRepaint = wt->GetDrawList().size() > 0 || BackgroundEffectHelper::HasDirtyHelpers(); + +// g_print("vv: Draw List %d\n", (int)wt->GetDrawList().size()); #if 0 g_print("vv: glPaintOutput %u: doShellRepaint=%s emptyregion=%s\n", output->id(), doShellRepaint?"Y":"N", @@ -1360,6 +1362,12 @@ bool UnityScreen::shellIsHidden(const CompOutput &output) return hidden; } +static void FastQueueDraw(nux::View *view) +{ + if (!view->IsRedrawNeeded()) + view->QueueDraw(); +} + void UnityScreen::compizDamageNux(const CompRegion &damage) { auto launchers = launcher_controller_->launchers(); @@ -1370,14 +1378,14 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) nux::Geometry geo = launcher->GetAbsoluteGeometry(); CompRegion launcher_region(geo.x, geo.y, geo.width, geo.height); if (damage.intersects(launcher_region)) - launcher->QueueDraw(); + FastQueueDraw(launcher.GetPointer()); nux::ObjectPtr tooltip = launcher->GetActiveTooltip(); if (!tooltip.IsNull()) { nux::Geometry tip = tooltip->GetAbsoluteGeometry(); CompRegion tip_region(tip.x, tip.y, tip.width, tip.height); if (damage.intersects(tip_region)) - tooltip->QueueDraw(); + FastQueueDraw(tooltip.GetPointer()); } } } @@ -1402,7 +1410,7 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) nux::Geometry geo = view->GetAbsoluteGeometry(); CompRegion quicklist_region(geo.x, geo.y, geo.width, geo.height); if (damage.intersects(quicklist_region)) - view->QueueDraw(); + FastQueueDraw(view); } } } -- cgit v1.2.3 From 607b771508378c73378b9b24dc8d9b8937347fbf Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 18 Jun 2012 20:18:45 +0800 Subject: Remove the almost pointless FastQueueDraw(). A correct fix for the pauses and poor performance has been proposed for Nux --> LP: #1014610 (bzr r2399.1.36) --- plugins/unityshell/src/unityshell.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 08a7a46eb..bdbafc847 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1362,12 +1362,6 @@ bool UnityScreen::shellIsHidden(const CompOutput &output) return hidden; } -static void FastQueueDraw(nux::View *view) -{ - if (!view->IsRedrawNeeded()) - view->QueueDraw(); -} - void UnityScreen::compizDamageNux(const CompRegion &damage) { auto launchers = launcher_controller_->launchers(); @@ -1378,14 +1372,14 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) nux::Geometry geo = launcher->GetAbsoluteGeometry(); CompRegion launcher_region(geo.x, geo.y, geo.width, geo.height); if (damage.intersects(launcher_region)) - FastQueueDraw(launcher.GetPointer()); + launcher->QueueDraw(); nux::ObjectPtr tooltip = launcher->GetActiveTooltip(); if (!tooltip.IsNull()) { nux::Geometry tip = tooltip->GetAbsoluteGeometry(); CompRegion tip_region(tip.x, tip.y, tip.width, tip.height); if (damage.intersects(tip_region)) - FastQueueDraw(tooltip.GetPointer()); + tooltip->QueueDraw(); } } } @@ -1410,7 +1404,7 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) nux::Geometry geo = view->GetAbsoluteGeometry(); CompRegion quicklist_region(geo.x, geo.y, geo.width, geo.height); if (damage.intersects(quicklist_region)) - FastQueueDraw(view); + view->QueueDraw(); } } } -- cgit v1.2.3 From 5d0e2df643418ed6603e485d7ee0100b337d59c3 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 19 Jun 2012 14:40:21 +0800 Subject: Reintroduce some old code, which it turns out was a workaround for Nux bug LP: #1014610. Now we're not dependent on the fix being released in Nux. (bzr r2399.1.38) --- plugins/unityshell/src/unityshell.cpp | 17 ++++++++++++++--- plugins/unityshell/src/unityshell.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index bdbafc847..3c58ede52 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -119,6 +119,7 @@ UnityScreen::UnityScreen(CompScreen* screen) , newFocusedWindow(nullptr) , doShellRepaint(false) , allowWindowPaint(false) + , damaged(false) , _key_nav_mode_requested(false) , _last_output(nullptr) #ifndef USE_MODERN_COMPIZ_GL @@ -901,6 +902,7 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo } doShellRepaint = false; + damaged = false; } bool UnityScreen::forcePaintOnTop () @@ -1298,6 +1300,13 @@ void UnityScreen::preparePaint(int ms) for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) wi->HandleAnimations (ms); + // Workaround Nux bug LP: #1014610: + if (damaged) + { + damaged = false; + nuxDamageCompiz(); + } + compizDamageNux(cScreen->currentDamage()); } @@ -1412,12 +1421,14 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) /* Grab changed nux regions and add damage rects for them */ void UnityScreen::nuxDamageCompiz() { - if (!launcher_controller_.get()) // Don't slow down during startup - return; - CompRegion nux_damage; + // Workaround Nux bug LP: #1014610 (unbounded DrawList growth) + if (damaged) + return; + std::vector dirty = wt->GetDrawList(); + damaged = true; for (std::vector::iterator it = dirty.begin(), end = dirty.end(); it != end; ++it) diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 583b0e0bd..063431c79 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -277,6 +277,7 @@ private: /* handle paint order */ bool doShellRepaint; bool allowWindowPaint; + bool damaged; bool _key_nav_mode_requested; CompOutput* _last_output; CompWindowList _withRemovedNuxWindows; -- cgit v1.2.3 From e4f7a256ff6690e512cf48580004b55e37195bd0 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 19 Jun 2012 16:52:39 +0800 Subject: Damage panels independently. This gives a significant performance boost with multiple monitors since damaging one panel no longer triggers redraws of all panels. (bzr r2399.1.40) --- plugins/unityshell/src/unityshell.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 3c58ede52..9fd6d0015 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1218,7 +1218,6 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, doShellRepaint = wt->GetDrawList().size() > 0 || BackgroundEffectHelper::HasDirtyHelpers(); -// g_print("vv: Draw List %d\n", (int)wt->GetDrawList().size()); #if 0 g_print("vv: glPaintOutput %u: doShellRepaint=%s emptyregion=%s\n", output->id(), doShellRepaint?"Y":"N", @@ -1393,15 +1392,13 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) } } - const std::vector &geos(panel_controller_->GetGeometries()); - for (const nux::Geometry &geo : geos) + const std::vector &panels(panel_controller_->GetPanelViews()); + for (nux::View *view : panels) { + nux::Geometry geo = view->GetAbsoluteGeometry(); CompRegion panel_region(geo.x, geo.y, geo.width, geo.height); if (damage.intersects(panel_region)) - { - panel_controller_->QueueRedraw(); - break; - } + view->QueueDraw(); } QuicklistManager *qm = QuicklistManager::Default(); -- cgit v1.2.3 From 5740f4a91735afce129066288eceb8a94768fb3a Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 19 Jun 2012 17:13:54 +0800 Subject: Remove debug code. (bzr r2399.1.41) --- plugins/unityshell/src/unityshell.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 9fd6d0015..96c2d29cf 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1218,12 +1218,6 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, doShellRepaint = wt->GetDrawList().size() > 0 || BackgroundEffectHelper::HasDirtyHelpers(); -#if 0 - g_print("vv: glPaintOutput %u: doShellRepaint=%s emptyregion=%s\n", - output->id(), doShellRepaint?"Y":"N", - region.isEmpty() ? "Y":"N" - ); -#endif allowWindowPaint = true; _last_output = output; paint_panel_ = false; -- cgit v1.2.3 From f55de4114619bda98fdb179e20284c2221cb0091 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Wed, 20 Jun 2012 17:30:08 +0800 Subject: Remove unused variable REDRAW_IDLE. (bzr r2399.1.43) --- plugins/unityshell/src/unityshell.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 96c2d29cf..aec2e33d1 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -100,7 +100,6 @@ const unsigned int SCROLL_DOWN_BUTTON = 6; const unsigned int SCROLL_UP_BUTTON = 7; const std::string RELAYOUT_TIMEOUT = "relayout-timeout"; -const std::string REDRAW_IDLE = "redraw-idle"; } // namespace local } // anon namespace -- cgit v1.2.3 From 185e0b7874d67e26d1d898657fe5a7381bbb15f7 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 21 Jun 2012 15:50:33 +0800 Subject: Style tweaks per Marco. (bzr r2399.1.45) --- plugins/unityshell/src/unityshell.cpp | 18 +++++++++--------- plugins/unityshell/src/unityshell.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index aec2e33d1..7424631c6 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1326,13 +1326,13 @@ void UnityScreen::donePaint() cScreen->donePaint (); } -bool UnityScreen::shellIsHidden(const CompOutput &output) +bool UnityScreen::shellIsHidden(CompOutput const& output) { bool hidden = false; - const std::vector &nuxwins(nux::XInputWindow::NativeHandleList()); + std::vector const& nuxwins(nux::XInputWindow::NativeHandleList()); // Loop through windows from back to front - for (CompWindow *w : screen->windows ()) + for (CompWindow* w : screen->windows ()) { /* * The shell is hidden if there exists any window that fully covers @@ -1363,7 +1363,7 @@ bool UnityScreen::shellIsHidden(const CompOutput &output) return hidden; } -void UnityScreen::compizDamageNux(const CompRegion &damage) +void UnityScreen::compizDamageNux(CompRegion const& damage) { auto launchers = launcher_controller_->launchers(); for (auto launcher : launchers) @@ -1385,8 +1385,8 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) } } - const std::vector &panels(panel_controller_->GetPanelViews()); - for (nux::View *view : panels) + std::vector const& panels(panel_controller_->GetPanelViews()); + for (nux::View* view : panels) { nux::Geometry geo = view->GetAbsoluteGeometry(); CompRegion panel_region(geo.x, geo.y, geo.width, geo.height); @@ -1394,10 +1394,10 @@ void UnityScreen::compizDamageNux(const CompRegion &damage) view->QueueDraw(); } - QuicklistManager *qm = QuicklistManager::Default(); + QuicklistManager* qm = QuicklistManager::Default(); if (qm) { - QuicklistView *view = qm->Current(); + QuicklistView* view = qm->Current(); if (view) { nux::Geometry geo = view->GetAbsoluteGeometry(); @@ -1438,7 +1438,7 @@ void UnityScreen::nuxDamageCompiz() nux::ObjectPtr tooltip = launcher->GetActiveTooltip(); if (!tooltip.IsNull()) { - const nux::Geometry &g = tooltip->GetAbsoluteGeometry(); + nux::Geometry const& g = tooltip->GetAbsoluteGeometry(); nux_damage += CompRegion(g.x, g.y, g.width, g.height); } } diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 063431c79..123e7a2ac 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -213,10 +213,10 @@ private: bool initPluginActions(); void initLauncher(); - void compizDamageNux(const CompRegion ®ion); + void compizDamageNux(CompRegion const& region); void nuxDamageCompiz(); - bool shellIsHidden(const CompOutput &output); + bool shellIsHidden(CompOutput const& output); void onRedrawRequested(); void Relayout(); -- cgit v1.2.3 From 7612cfcb245a772ceffa525b4e9ba4b6de575612 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 21 Jun 2012 16:46:24 +0800 Subject: Don't clear the draw list when doShellRepaint==false. Otherwise returning from fullscreen the shell views will still think they're already queued for drawing then they're not and will fail to redraw. The problem only happened when this branch was used with the fix for Nux bug LP: #1014610. (bzr r2399.1.46) --- plugins/unityshell/src/unityshell.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 7424631c6..0a4db4239 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -900,6 +900,14 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo } } + /* + * Only clear the draw list now that we've actually drawn everything. + * Since fixing Nux bug LP: #1014610, views will remain marked as queued + * for drawing until they're acutally drawn. Calling ClearDrawList does + * not unmark the views. + */ + wt->ClearDrawList(); + doShellRepaint = false; damaged = false; } @@ -1304,8 +1312,6 @@ void UnityScreen::preparePaint(int ms) void UnityScreen::donePaint() { - wt->ClearDrawList(); - std::list remove_windows; for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) -- cgit v1.2.3 From db1ab6f112fbd621ea2b5d40632b9f22c56c4324 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 21 Jun 2012 16:49:56 +0800 Subject: Fix typo. (bzr r2399.1.47) --- plugins/unityshell/src/unityshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 0a4db4239..f6fa9880c 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -903,7 +903,7 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo /* * Only clear the draw list now that we've actually drawn everything. * Since fixing Nux bug LP: #1014610, views will remain marked as queued - * for drawing until they're acutally drawn. Calling ClearDrawList does + * for drawing until they're actually drawn. Calling ClearDrawList does * not unmark the views. */ wt->ClearDrawList(); -- cgit v1.2.3 From 4c8bf61a32c4c99e2481baa7dd9c231aec0ce48f Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 21 Jun 2012 18:13:51 +0800 Subject: Fixed: Dash was not always redrawing in some cases (unless something was redrawing behind it). (bzr r2399.1.48) --- plugins/unityshell/src/unityshell.cpp | 39 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index f6fa9880c..1d74fc5ce 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1417,15 +1417,15 @@ void UnityScreen::compizDamageNux(CompRegion const& damage) /* Grab changed nux regions and add damage rects for them */ void UnityScreen::nuxDamageCompiz() { - CompRegion nux_damage; - // Workaround Nux bug LP: #1014610 (unbounded DrawList growth) - if (damaged) + // Also, ensure we don't dereference null *controller_ on startup. + if (damaged || !launcher_controller_ || !dash_controller_) return; - - std::vector dirty = wt->GetDrawList(); damaged = true; + CompRegion nux_damage; + + std::vector dirty = wt->GetDrawList(); for (std::vector::iterator it = dirty.begin(), end = dirty.end(); it != end; ++it) { @@ -1433,28 +1433,27 @@ void UnityScreen::nuxDamageCompiz() nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height); } - // launcher_controller_ will still be null on startup - if (launcher_controller_.get()) + if (launcher_controller_->IsOverlayOpen()) { - auto launchers = launcher_controller_->launchers(); - for (auto launcher : launchers) + nux::BaseWindow* dash_window = dash_controller_->window(); + nux::Geometry const& geo = dash_window->GetAbsoluteGeometry(); + nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height); + } + + auto launchers = launcher_controller_->launchers(); + for (auto launcher : launchers) + { + if (!launcher->Hidden()) { - if (!launcher->Hidden()) + nux::ObjectPtr tooltip = launcher->GetActiveTooltip(); + if (!tooltip.IsNull()) { - nux::ObjectPtr tooltip = launcher->GetActiveTooltip(); - if (!tooltip.IsNull()) - { - nux::Geometry const& g = tooltip->GetAbsoluteGeometry(); - nux_damage += CompRegion(g.x, g.y, g.width, g.height); - } + nux::Geometry const& g = tooltip->GetAbsoluteGeometry(); + nux_damage += CompRegion(g.x, g.y, g.width, g.height); } } } - /* - * Avoid Nux damaging Nux as recommended by smspillaz. Though I don't - * believe it would be harmful or significantly expensive right now. - */ cScreen->damageRegionSetEnabled(this, false); cScreen->damageRegion(nux_damage); cScreen->damageRegionSetEnabled(this, true); -- cgit v1.2.3 From b324a40a03bf73892815329d55dcac6fa0917321 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 21 Jun 2012 18:17:24 +0800 Subject: Simplify and optimize damage propagation from GetDrawList. (bzr r2399.1.49) --- plugins/unityshell/src/unityshell.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 1d74fc5ce..863034e91 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1425,13 +1425,9 @@ void UnityScreen::nuxDamageCompiz() CompRegion nux_damage; - std::vector dirty = wt->GetDrawList(); - for (std::vector::iterator it = dirty.begin(), end = dirty.end(); - it != end; ++it) - { - nux::Geometry const& geo = *it; + std::vector const &dirty = wt->GetDrawList(); + for (auto geo : dirty) nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height); - } if (launcher_controller_->IsOverlayOpen()) { -- cgit v1.2.3 From f614ec0214e2e46de56f9f9c9f6732607d0683ed Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 21 Jun 2012 18:36:32 +0800 Subject: A more logical location for damaging BackgroundEffectHelper. (bzr r2399.1.50) --- plugins/unityshell/src/unityshell.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 863034e91..8acd9e6cb 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1371,6 +1371,13 @@ bool UnityScreen::shellIsHidden(CompOutput const& output) void UnityScreen::compizDamageNux(CompRegion const& damage) { + CompRect::vector const& rects(damage.rects()); + for (const CompRect &r : rects) + { + nux::Geometry geo(r.x(), r.y(), r.width(), r.height()); + BackgroundEffectHelper::ProcessDamage(geo); + } + auto launchers = launcher_controller_->launchers(); for (auto launcher : launchers) { @@ -1612,15 +1619,7 @@ void UnityScreen::handleEvent(XEvent* event) void UnityScreen::damageRegion(const CompRegion ®ion) { - const CompRect::vector &rects(region.rects()); - for (const CompRect &r : rects) - { - nux::Geometry geo(r.x(), r.y(), r.width(), r.height()); - BackgroundEffectHelper::ProcessDamage(geo); - } - compizDamageNux(region); - cScreen->damageRegion(region); } -- cgit v1.2.3 From b91e774634338b6ac3642243a347a5fb26009d55 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 21 Jun 2012 18:39:06 +0800 Subject: Avoid potential crashes on startup. Just in case. (bzr r2399.1.51) --- plugins/unityshell/src/unityshell.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 8acd9e6cb..3c3e0a8bb 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1371,6 +1371,9 @@ bool UnityScreen::shellIsHidden(CompOutput const& output) void UnityScreen::compizDamageNux(CompRegion const& damage) { + if (!launcher_controller_) + return; + CompRect::vector const& rects(damage.rects()); for (const CompRect &r : rects) { -- cgit v1.2.3 From d7dd86025ada57b32a2e088f46cdc445b159bc58 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 22 Jun 2012 13:42:57 +0800 Subject: Revert r2445. It's causing multi-monitor redraw problems. (bzr r2399.1.53) --- plugins/unityshell/src/unityshell.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 3c3e0a8bb..c9e71ddfb 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -900,14 +900,6 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo } } - /* - * Only clear the draw list now that we've actually drawn everything. - * Since fixing Nux bug LP: #1014610, views will remain marked as queued - * for drawing until they're actually drawn. Calling ClearDrawList does - * not unmark the views. - */ - wt->ClearDrawList(); - doShellRepaint = false; damaged = false; } @@ -1312,6 +1304,8 @@ void UnityScreen::preparePaint(int ms) void UnityScreen::donePaint() { + wt->ClearDrawList(); + std::list remove_windows; for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) -- cgit v1.2.3 From 885d41f4bf5e8058e9becc20e79ecb4d687414b7 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 22 Jun 2012 14:14:37 +0800 Subject: Fix failure to redraw the shell on returning from full screen. This time without breaking multi-monitor support. (bzr r2399.1.54) --- plugins/unityshell/src/unityshell.cpp | 16 +++++++++++++++- plugins/unityshell/src/unityshell.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index c9e71ddfb..32c80785e 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -117,6 +117,7 @@ UnityScreen::UnityScreen(CompScreen* screen) , super_keypressed_(false) , newFocusedWindow(nullptr) , doShellRepaint(false) + , didShellRepaint(false) , allowWindowPaint(false) , damaged(false) , _key_nav_mode_requested(false) @@ -901,6 +902,7 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo } doShellRepaint = false; + didShellRepaint = true; damaged = false; } @@ -1300,11 +1302,23 @@ void UnityScreen::preparePaint(int ms) } compizDamageNux(cScreen->currentDamage()); + + didShellRepaint = false; } void UnityScreen::donePaint() { - wt->ClearDrawList(); + /* + * It's only safe to clear the draw list if drawing actually occurred + * (i.e. the shell was not obscured behind a fullscreen window). + * If you clear the draw list and drawing has not occured then you'd be + * left with all your views thinking they're queued for drawing still and + * would refuse to redraw when you return from fullscreen. + * I think this is a Nux bug. ClearDrawList should ideally also mark all + * the queued views as draw_cmd_queued_=false. + */ + if (didShellRepaint) + wt->ClearDrawList(); std::list remove_windows; diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 123e7a2ac..679ae8116 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -276,6 +276,7 @@ private: /* handle paint order */ bool doShellRepaint; + bool didShellRepaint; bool allowWindowPaint; bool damaged; bool _key_nav_mode_requested; -- cgit v1.2.3 From 82a0d7fe2e45d26cad8f6f5e7cb143109efad35d Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 22 Jun 2012 14:28:54 +0800 Subject: Fix style per Marco. (bzr r2399.1.55) --- plugins/unityshell/src/unityshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 32c80785e..255752fab 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1443,7 +1443,7 @@ void UnityScreen::nuxDamageCompiz() CompRegion nux_damage; - std::vector const &dirty = wt->GetDrawList(); + std::vector const& dirty = wt->GetDrawList(); for (auto geo : dirty) nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height); -- cgit v1.2.3 From 2a3bbbd34f8aaeeca46b0e95e0e9f5f5f2dc6386 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 25 Jun 2012 16:43:35 +0800 Subject: Use CompWindowStateHiddenMask as suggested by smspillaz. (bzr r2399.1.57) --- plugins/unityshell/src/unityshell.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 255752fab..1246ab0da 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1219,6 +1219,10 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, doShellRepaint = wt->GetDrawList().size() > 0 || BackgroundEffectHelper::HasDirtyHelpers(); + g_print("vv: glPaintOutput %u, %s\n", + output->id(), + doShellRepaint ? "REPAINT" : "idle"); + allowWindowPaint = true; _last_output = output; paint_panel_ = false; @@ -1355,8 +1359,7 @@ bool UnityScreen::shellIsHidden(CompOutput const& output) * and almost always pointless. */ if (w->isMapped() && - w->isViewable() && - !w->inShowDesktopMode() && // Why must this != isViewable? + !(w->state () & CompWindowStateHiddenMask) && w->geometry().contains(output)) { hidden = true; -- cgit v1.2.3 From 5fd9f868c44c1e1abdee629e54096db2a103cdec Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 25 Jun 2012 17:13:55 +0800 Subject: Simplify shellIsHidden() how smspillaz suggests. (bzr r2399.1.58) --- plugins/unityshell/src/unityshell.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 1246ab0da..4f49e802f 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1219,9 +1219,11 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, doShellRepaint = wt->GetDrawList().size() > 0 || BackgroundEffectHelper::HasDirtyHelpers(); - g_print("vv: glPaintOutput %u, %s\n", + g_print("vv: glPaintOutput %u, %s %s\n", output->id(), - doShellRepaint ? "REPAINT" : "idle"); + doShellRepaint ? "REPAINT" : "idle", + shellIsHidden(*output) ? "SHELLHIDDEN" : "shellnormal" + ); allowWindowPaint = true; _last_output = output; @@ -1346,12 +1348,17 @@ void UnityScreen::donePaint() bool UnityScreen::shellIsHidden(CompOutput const& output) { - bool hidden = false; std::vector const& nuxwins(nux::XInputWindow::NativeHandleList()); - // Loop through windows from back to front - for (CompWindow* w : screen->windows ()) + // Loop through windows from front to back + CompWindowList const& wins = screen->windows(); + for ( CompWindowList::const_reverse_iterator r = wins.rbegin() + ; r != wins.rend() + ; r++ + ) { + CompWindow* w = *r; + /* * The shell is hidden if there exists any window that fully covers * the output and is in front of all Nux windows on that output. @@ -1362,22 +1369,19 @@ bool UnityScreen::shellIsHidden(CompOutput const& output) !(w->state () & CompWindowStateHiddenMask) && w->geometry().contains(output)) { - hidden = true; + return true; } - else if (hidden) + else { for (Window n : nuxwins) { if (w->id() == n && output.intersects(w->geometry())) - { - hidden = false; - break; - } + return false; } } } - return hidden; + return false; } void UnityScreen::compizDamageNux(CompRegion const& damage) -- cgit v1.2.3 From 294c9d1eed692c6d1e36a720967f444751c5e179 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 25 Jun 2012 17:59:21 +0800 Subject: Remove debug output (bzr r2399.1.59) --- plugins/unityshell/src/unityshell.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 4f49e802f..ea9ea0c89 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1219,12 +1219,6 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, doShellRepaint = wt->GetDrawList().size() > 0 || BackgroundEffectHelper::HasDirtyHelpers(); - g_print("vv: glPaintOutput %u, %s %s\n", - output->id(), - doShellRepaint ? "REPAINT" : "idle", - shellIsHidden(*output) ? "SHELLHIDDEN" : "shellnormal" - ); - allowWindowPaint = true; _last_output = output; paint_panel_ = false; -- cgit v1.2.3 From dc0b0c0ceddc1ea51c4299b7d0953973e25d0b23 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 26 Jun 2012 11:07:10 +0800 Subject: Clean up comments (bzr r2399.1.61) --- plugins/unityshell/src/unityshell.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 2227c94ae..d006a55cb 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1215,7 +1215,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, * Very important! * Don't waste GPU and CPU rendering the shell on every frame if you don't * need to. Doing so on every frame causes Nux to hog the GPU and slow down - * all other OpenGL apps (LP: #988079) + * ALL rendering. (LP: #988079) */ if (forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive()) doShellRepaint = true; @@ -1362,8 +1362,6 @@ bool UnityScreen::shellIsHidden(CompOutput const& output) /* * The shell is hidden if there exists any window that fully covers * the output and is in front of all Nux windows on that output. - * We could also check CompositeWindow::opacity() but that would be slower - * and almost always pointless. */ if (w->isMapped() && !(w->state () & CompWindowStateHiddenMask) && -- cgit v1.2.3 From 9bea5ec25786c16856567bef7aacbe7e2a649377 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 26 Jun 2012 11:39:49 +0800 Subject: Don't check BackgroundEffectHelper::HasDirtyHelpers for doShellRepaint. It has nothing directly to do with shell rendering as smspillaz mentioned. (bzr r2399.1.62) --- plugins/unityshell/src/unityshell.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index d006a55cb..019017473 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1222,8 +1222,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, else if (region.isEmpty() || shellIsHidden(*output)) doShellRepaint = false; else - doShellRepaint = wt->GetDrawList().size() > 0 || - BackgroundEffectHelper::HasDirtyHelpers(); + doShellRepaint = wt->GetDrawList().size() > 0; allowWindowPaint = true; _last_output = output; -- cgit v1.2.3 From 14d9ff3f6efbbb2a57c9f4701540efbb6536e614 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 26 Jun 2012 17:13:03 +0800 Subject: Occlusion detection, compiz-style. Removed shellIsHidden. I think this is a bit bigger, uglier and slower than shellIsHidden. But more in line with the existing compiz occlusion code. (bzr r2399.1.63) --- plugins/unityshell/src/unityshell.cpp | 82 +++++++++++++++-------------------- plugins/unityshell/src/unityshell.h | 9 ++-- 2 files changed, 39 insertions(+), 52 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 019017473..1a82f49fd 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1219,7 +1219,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, */ if (forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive()) doShellRepaint = true; - else if (region.isEmpty() || shellIsHidden(*output)) + else if (region.isEmpty()) doShellRepaint = false; else doShellRepaint = wt->GetDrawList().size() > 0; @@ -1243,10 +1243,16 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ())); #endif + overShell = CompRegion(); + nuxRegion = CompRegion(); + /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */ ret = gScreen->glPaintOutput(attrib, transform, region, output, mask); #ifndef USE_MODERN_COMPIZ_GL + if (doShellRepaint && overShell.contains(*output)) + doShellRepaint = false; + if (doShellRepaint) paintDisplay(region, transform, mask); #endif @@ -1345,42 +1351,6 @@ void UnityScreen::donePaint() cScreen->donePaint (); } -bool UnityScreen::shellIsHidden(CompOutput const& output) -{ - std::vector const& nuxwins(nux::XInputWindow::NativeHandleList()); - - // Loop through windows from front to back - CompWindowList const& wins = screen->windows(); - for ( CompWindowList::const_reverse_iterator r = wins.rbegin() - ; r != wins.rend() - ; r++ - ) - { - CompWindow* w = *r; - - /* - * The shell is hidden if there exists any window that fully covers - * the output and is in front of all Nux windows on that output. - */ - if (w->isMapped() && - !(w->state () & CompWindowStateHiddenMask) && - w->geometry().contains(output)) - { - return true; - } - else - { - for (Window n : nuxwins) - { - if (w->id() == n && output.intersects(w->geometry())) - return false; - } - } - } - - return false; -} - void UnityScreen::compizDamageNux(CompRegion const& damage) { if (!launcher_controller_) @@ -2267,14 +2237,6 @@ bool isNuxWindow (CompWindow* value) return false; } -const CompWindowList& UnityScreen::getWindowPaintList() -{ - CompWindowList& pl = _withRemovedNuxWindows = cScreen->getWindowPaintList(); - pl.remove_if(isNuxWindow); - - return pl; -} - void UnityScreen::RaiseInputWindows() { std::vector const& xwns = nux::XInputWindow::NativeHandleList(); @@ -2299,6 +2261,24 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, const CompRegion& region, unsigned int mask) { + if (isNuxWindow(window)) + { + if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) + { + uScreen->nuxRegion += window->geometry(); + uScreen->nuxRegion -= uScreen->overShell; + } + return false; + } + else if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK && + !(mask & PAINT_WINDOW_TRANSLUCENT_MASK) && + window->state() & CompWindowStateFullscreenMask) + // && !window->alpha() <-- doesn't work. False positives. + { + uScreen->overShell += window->geometry(); + uScreen->overShell -= uScreen->nuxRegion; + } + GLWindowPaintAttrib wAttrib = attrib; if (mMinimizeHandler) @@ -2357,7 +2337,17 @@ bool UnityWindow::glDraw(const GLMatrix& matrix, } } - if (uScreen->doShellRepaint && !uScreen->forcePaintOnTop ()) + /* + * Paint the shell in *roughly* the compiz stacking order. This is only + * approximate because we're painting all the nux windows as soon as we find + * the bottom-most nux window (from bottom to top). + * But remember to avoid painting the shell if it's within the overShell + * region. + */ + if (uScreen->doShellRepaint && + !uScreen->forcePaintOnTop () && + !uScreen->overShell.contains(window->geometry()) + ) { std::vector const& xwns = nux::XInputWindow::NativeHandleList(); unsigned int size = xwns.size(); diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 80c9cd831..a2bff2d86 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -133,9 +133,6 @@ public: CompOutput*, unsigned int); - /* Pop our InputOutput windows from the paint list */ - const CompWindowList& getWindowPaintList(); - /* handle X11 events */ void handleEvent(XEvent*); @@ -216,8 +213,6 @@ private: void compizDamageNux(CompRegion const& region); void nuxDamageCompiz(); - bool shellIsHidden(CompOutput const& output); - void onRedrawRequested(); void Relayout(); @@ -286,7 +281,9 @@ private: bool damaged; bool _key_nav_mode_requested; CompOutput* _last_output; - CompWindowList _withRemovedNuxWindows; + + CompRegion nuxRegion; + CompRegion overShell; nux::Property primary_monitor_; -- cgit v1.2.3 From 4aa5a33993375fc04f85d8c642d32328e09cad00 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 26 Jun 2012 17:47:28 +0800 Subject: Honour force-paint-on-top. Even when the windows are not stacked correctly. Incorrect stacking of the shell over fullscreen windows however is not something to fix in this branch. I'm just making it look the same as it does with trunk already. (bzr r2399.1.64) --- plugins/unityshell/src/unityshell.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 1a82f49fd..bcfb53f8a 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1217,7 +1217,8 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, * need to. Doing so on every frame causes Nux to hog the GPU and slow down * ALL rendering. (LP: #988079) */ - if (forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive()) + bool force = forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive(); + if (force) doShellRepaint = true; else if (region.isEmpty()) doShellRepaint = false; @@ -1250,7 +1251,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, ret = gScreen->glPaintOutput(attrib, transform, region, output, mask); #ifndef USE_MODERN_COMPIZ_GL - if (doShellRepaint && overShell.contains(*output)) + if (doShellRepaint && !force && overShell.contains(*output)) doShellRepaint = false; if (doShellRepaint) -- cgit v1.2.3 From 96f1f1a3b1851287408ee002d58b6dc428db52fe Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Wed, 27 Jun 2012 13:30:58 +0800 Subject: Better variable naming. (bzr r2399.1.66) --- plugins/unityshell/src/unityshell.cpp | 14 +++++++------- plugins/unityshell/src/unityshell.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index fd008fa3e..00d88e194 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1245,14 +1245,14 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ())); #endif - overShell = CompRegion(); + aboveShell = CompRegion(); nuxRegion = CompRegion(); /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */ ret = gScreen->glPaintOutput(attrib, transform, region, output, mask); #ifndef USE_MODERN_COMPIZ_GL - if (doShellRepaint && !force && overShell.contains(*output)) + if (doShellRepaint && !force && aboveShell.contains(*output)) doShellRepaint = false; if (doShellRepaint) @@ -2291,7 +2291,7 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) { uScreen->nuxRegion += window->geometry(); - uScreen->nuxRegion -= uScreen->overShell; + uScreen->nuxRegion -= uScreen->aboveShell; } return false; } @@ -2300,8 +2300,8 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, window->state() & CompWindowStateFullscreenMask) // && !window->alpha() <-- doesn't work. False positives. { - uScreen->overShell += window->geometry(); - uScreen->overShell -= uScreen->nuxRegion; + uScreen->aboveShell += window->geometry(); + uScreen->aboveShell -= uScreen->nuxRegion; } GLWindowPaintAttrib wAttrib = attrib; @@ -2366,12 +2366,12 @@ bool UnityWindow::glDraw(const GLMatrix& matrix, * Paint the shell in *roughly* the compiz stacking order. This is only * approximate because we're painting all the nux windows as soon as we find * the bottom-most nux window (from bottom to top). - * But remember to avoid painting the shell if it's within the overShell + * But remember to avoid painting the shell if it's within the aboveShell * region. */ if (uScreen->doShellRepaint && !uScreen->forcePaintOnTop () && - !uScreen->overShell.contains(window->geometry()) + !uScreen->aboveShell.contains(window->geometry()) ) { std::vector const& xwns = nux::XInputWindow::NativeHandleList(); diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index c050638f1..7212d407b 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -283,7 +283,7 @@ private: CompOutput* _last_output; CompRegion nuxRegion; - CompRegion overShell; + CompRegion aboveShell; nux::Property primary_monitor_; -- cgit v1.2.3 From 4afb5c503b5da8af2950572e8e78bc9faadd8df0 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Wed, 27 Jun 2012 14:41:52 +0800 Subject: Generalized occlusion detection. Not just fullscreen windows can be over the shell. (bzr r2399.1.67) --- plugins/unityshell/src/unityshell.cpp | 37 ++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 00d88e194..65d83a083 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1226,6 +1226,10 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, else doShellRepaint = wt->GetDrawList().size() > 0; + g_print("vv: glPaintOutput %u %s", + output->id(), + doShellRepaint ? "REPAINT" : "idle"); + allowWindowPaint = true; _last_output = output; paint_panel_ = false; @@ -1253,7 +1257,11 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, #ifndef USE_MODERN_COMPIZ_GL if (doShellRepaint && !force && aboveShell.contains(*output)) + { + g_print("-cancelled"); doShellRepaint = false; + } + g_print("\n"); if (doShellRepaint) paintDisplay(region, transform, mask); @@ -2286,6 +2294,10 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, const CompRegion& region, unsigned int mask) { + /* + * The occlusion pass tests windows from TOP to BOTTOM. That's opposite to + * the actual painting loop. + */ if (isNuxWindow(window)) { if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) @@ -2293,15 +2305,22 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, uScreen->nuxRegion += window->geometry(); uScreen->nuxRegion -= uScreen->aboveShell; } - return false; - } - else if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK && - !(mask & PAINT_WINDOW_TRANSLUCENT_MASK) && - window->state() & CompWindowStateFullscreenMask) - // && !window->alpha() <-- doesn't work. False positives. - { - uScreen->aboveShell += window->geometry(); - uScreen->aboveShell -= uScreen->nuxRegion; + return false; // Ensure nux windows are never painted by compiz + } + else if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) + { + static const unsigned int nonOcclusionBits = + PAINT_WINDOW_TRANSLUCENT_MASK | + PAINT_WINDOW_TRANSFORMED_MASK | + PAINT_WINDOW_NO_CORE_INSTANCE_MASK; + if (!(mask & nonOcclusionBits)) + // And I've been advised to test other things, but they don't work: + // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw + // && !window->alpha() <-- Doesn't work; Opaque windows often have alpha + { + uScreen->aboveShell += window->geometry(); + uScreen->aboveShell -= uScreen->nuxRegion; + } } GLWindowPaintAttrib wAttrib = attrib; -- cgit v1.2.3 From f1188db07e337deafe4ddb3b3c24ff06e8ec8995 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Wed, 27 Jun 2012 14:51:14 +0800 Subject: Simplify and add comments. (bzr r2399.1.68) --- plugins/unityshell/src/unityshell.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 65d83a083..d4212bbb4 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1219,12 +1219,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, * ALL rendering. (LP: #988079) */ bool force = forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive(); - if (force) - doShellRepaint = true; - else if (region.isEmpty()) - doShellRepaint = false; - else - doShellRepaint = wt->GetDrawList().size() > 0; + doShellRepaint = force || (!region.isEmpty() && wt->GetDrawList().size()); g_print("vv: glPaintOutput %u %s", output->id(), @@ -1249,6 +1244,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ())); #endif + // CompRegion has no clear() method. So this is the fastest alternative. aboveShell = CompRegion(); nuxRegion = CompRegion(); -- cgit v1.2.3 From d0948384b7b098544b22ca0e35c0857bf87c3ad6 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Wed, 27 Jun 2012 15:05:17 +0800 Subject: Optimize boolean logic. (bzr r2399.1.69) --- plugins/unityshell/src/unityshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index d4212bbb4..eeaff96c6 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1219,7 +1219,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, * ALL rendering. (LP: #988079) */ bool force = forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive(); - doShellRepaint = force || (!region.isEmpty() && wt->GetDrawList().size()); + doShellRepaint = force || !(region.isEmpty() || wt->GetDrawList().empty()); g_print("vv: glPaintOutput %u %s", output->id(), -- cgit v1.2.3 From 4d7109c4245d154625038886878b500b158d928d Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Wed, 27 Jun 2012 15:09:40 +0800 Subject: Remove debug code. (bzr r2399.1.70) --- plugins/unityshell/src/unityshell.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index eeaff96c6..addc7d71e 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1221,10 +1221,6 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, bool force = forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive(); doShellRepaint = force || !(region.isEmpty() || wt->GetDrawList().empty()); - g_print("vv: glPaintOutput %u %s", - output->id(), - doShellRepaint ? "REPAINT" : "idle"); - allowWindowPaint = true; _last_output = output; paint_panel_ = false; @@ -1253,11 +1249,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, #ifndef USE_MODERN_COMPIZ_GL if (doShellRepaint && !force && aboveShell.contains(*output)) - { - g_print("-cancelled"); doShellRepaint = false; - } - g_print("\n"); if (doShellRepaint) paintDisplay(region, transform, mask); -- cgit v1.2.3 From 1d782647513181b3206a7fcb2f3d323046f57091 Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Fri, 29 Jun 2012 20:21:19 +0200 Subject: Close the shortcut overlay if a key modifier has been pressed. (bzr r2455.3.1) --- plugins/unityshell/src/unityshell.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 608a82b99..4bfdcd020 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1401,6 +1401,21 @@ void UnityScreen::handleEvent(XEvent* event) break; case KeyPress: { + if (super_keypressed_) + { + /* We need an idle to postpone this action, after the current event + * has been processed */ + sources_.Add(std::make_shared([&]() { + if (!launcher_controller_->KeyNavIsActive()) + { + shortcut_controller_->SetEnabled(false); + shortcut_controller_->Hide(); + EnableCancelAction(CancelActionTarget::SHORTCUT_HINT, false); + } + return false; + })); + } + KeySym key_sym; char key_string[2]; int result = XLookupString(&(event->xkey), key_string, 2, &key_sym, 0); @@ -1428,21 +1443,6 @@ void UnityScreen::handleEvent(XEvent* event) if (super_keypressed_) { - if (key_sym != XK_Escape || (key_sym == XK_Escape && !launcher_controller_->KeyNavIsActive())) - { - /* We need an idle to postpone this action, after the current event - * has been processed */ - sources_.Add(std::make_shared([&]() { - if (!launcher_controller_->KeyNavIsActive()) - { - shortcut_controller_->SetEnabled(false); - shortcut_controller_->Hide(); - EnableCancelAction(CancelActionTarget::SHORTCUT_HINT, false); - } - return false; - })); - } - skip_other_plugins = launcher_controller_->HandleLauncherKeyEvent(screen->dpy(), key_sym, event->xkey.keycode, event->xkey.state, key_string); if (!skip_other_plugins) skip_other_plugins = dash_controller_->CheckShortcutActivation(key_string); -- cgit v1.2.3 From 2857f98236562d6dd5976bbf386b0a58ac67916e Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Mon, 2 Jul 2012 17:35:56 +0200 Subject: Fix bug 934062. (bzr r2455.3.2) --- plugins/unityshell/src/unityshell.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 4bfdcd020..75b775030 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1406,12 +1406,10 @@ void UnityScreen::handleEvent(XEvent* event) /* We need an idle to postpone this action, after the current event * has been processed */ sources_.Add(std::make_shared([&]() { - if (!launcher_controller_->KeyNavIsActive()) - { - shortcut_controller_->SetEnabled(false); - shortcut_controller_->Hide(); - EnableCancelAction(CancelActionTarget::SHORTCUT_HINT, false); - } + shortcut_controller_->SetEnabled(false); + shortcut_controller_->Hide(); + EnableCancelAction(CancelActionTarget::SHORTCUT_HINT, false); + return false; })); } -- cgit v1.2.3 From b7508c8aaf31c17aa3054ff5926dfc46c1304ade Mon Sep 17 00:00:00 2001 From: Brandon Schaefer Date: Mon, 2 Jul 2012 12:21:45 -0700 Subject: * The hud will now open if a quicklist is open (bzr r2463.3.1) --- plugins/unityshell/src/unityshell.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index a449a293b..0717b8e54 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1998,6 +1998,9 @@ bool UnityScreen::ShowHud() if (launcher_controller_->IsOverlayOpen()) dash_controller_->HideDash(); + if (QuicklistManager::Default()->Current()) + QuicklistManager::Default()->Current()->Hide(); + hud_controller_->ShowHud(); } -- cgit v1.2.3 From 58c9866a758853e914a1ad918b38c15edbdbbcda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Tue, 3 Jul 2012 15:48:20 +0200 Subject: One more dependency that needed changing to 3.0. (bzr r2442.4.3) --- plugins/unity-mt-grab-handles/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unity-mt-grab-handles/CMakeLists.txt b/plugins/unity-mt-grab-handles/CMakeLists.txt index 9e5a65f4a..3020cf6a3 100644 --- a/plugins/unity-mt-grab-handles/CMakeLists.txt +++ b/plugins/unity-mt-grab-handles/CMakeLists.txt @@ -2,4 +2,4 @@ find_package (Compiz REQUIRED) include (CompizPlugin) -compiz_plugin (unitymtgrabhandles PKGDEPS nux-2.0>=2.0.0 PLUGINDEPS composite opengl CFLAGSADD -std=c++0x) +compiz_plugin (unitymtgrabhandles PKGDEPS nux-3.0>=3.0.0 PLUGINDEPS composite opengl CFLAGSADD -std=c++0x) -- cgit v1.2.3 From d56e8776cc0de9171ec41f374771b7b9cb3f3791 Mon Sep 17 00:00:00 2001 From: Tim Penhey Date: Thu, 5 Jul 2012 16:22:33 +1200 Subject: Bamf logging changes. (bzr r2470.8.1) --- plugins/unityshell/src/unityshell.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 169b5224f..118ffcf76 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -3239,6 +3239,8 @@ void capture_g_log_calls(const gchar* log_domain, const gchar* message, gpointer user_data) { + // If the environment variable is set, we capture the backtrace. + static bool glog_backtrace = ::getenv("UNITY_LOG_GLOG_BACKTRACE"); // If nothing else, all log messages from unity should be identified as such std::string module("unity"); if (log_domain) @@ -3249,14 +3251,16 @@ void capture_g_log_calls(const gchar* log_domain, nux::logging::Level level = glog_level_to_nux(log_level); if (level >= logger.GetEffectiveLogLevel()) { - nux::logging::LogStream(level, logger.module(), "", 0).stream() - << message; - if (level >= nux::logging::Error) + std::string backtrace; + if (glog_backtrace && level >= nux::logging::Warning) { - nux::logging::Backtrace(); + backtrace = "\n" + nux::logging::Backtrace(); } + nux::logging::LogStream(level, logger.module(), "", 0).stream() + << message << backtrace; } } } // anonymous namespace } // namespace unity + -- cgit v1.2.3 From 99d3a732dd8f2bc2e694e892d540755c4332f212 Mon Sep 17 00:00:00 2001 From: Brandon Schaefer Date: Thu, 5 Jul 2012 17:12:18 -0700 Subject: * Fixes Alt+F1 problem with the Hud (bzr r2470.4.1) --- plugins/unityshell/src/unityshell.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 169b5224f..f33e1ffbb 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1462,9 +1462,11 @@ void UnityScreen::handleEvent(XEvent* event) #endif if (_key_nav_mode_requested) { + // Close any overlay that is open. if (launcher_controller_->IsOverlayOpen()) { dash_controller_->HideDash(); + hud_controller_->HideHud(); } launcher_controller_->KeyNavGrab(); } @@ -1507,7 +1509,7 @@ void UnityScreen::handleEvent(XEvent* event) shortcut_controller_->Hide(); EnableCancelAction(CancelActionTarget::SHORTCUT_HINT, false); - return false; + return false; })); } -- cgit v1.2.3 From caaf947bf96694d4d49570c7853cda626ba78529 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 6 Jul 2012 12:34:22 +0800 Subject: First prototype fix for LP: #1021541 Ensure windows stacked above the shell actually get rendered above the shell. (bzr r2470.3.1) --- plugins/unityshell/src/unityshell.cpp | 57 +++++++++++++++-------------------- plugins/unityshell/src/unityshell.h | 3 +- 2 files changed, 27 insertions(+), 33 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 169b5224f..93386f547 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -749,6 +749,8 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo { CompOutput *output = _last_output; + g_print("vv: paintDisplay\n"); + #ifndef USE_MODERN_COMPIZ_GL bool was_bound = _fbo->bound (); @@ -916,7 +918,8 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo bool UnityScreen::forcePaintOnTop () { return !allowWindowPaint || - ((switcher_controller_->Visible() || launcher_controller_->IsOverlayOpen()) + ((switcher_controller_->Visible() || + PluginAdapter::Default()->IsExpoActive()) && !fullscreen_windows_.empty () && (!(screen->grabbed () && !screen->otherGrabExist (NULL)))); } @@ -1221,6 +1224,8 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, bool force = forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive(); doShellRepaint = force || !(region.isEmpty() || wt->GetDrawList().empty()); + g_print("vv: glPaintOutput %u\n", output->id()); + allowWindowPaint = true; _last_output = output; paint_panel_ = false; @@ -1241,14 +1246,14 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, #endif // CompRegion has no clear() method. So this is the fastest alternative. - aboveShell = CompRegion(); + fullscreenRegion = CompRegion(); nuxRegion = CompRegion(); /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */ ret = gScreen->glPaintOutput(attrib, transform, region, output, mask); #ifndef USE_MODERN_COMPIZ_GL - if (doShellRepaint && !force && aboveShell.contains(*output)) + if (doShellRepaint && !force && fullscreenRegion.contains(*output)) doShellRepaint = false; if (doShellRepaint) @@ -1313,6 +1318,7 @@ void UnityScreen::preparePaint(int ms) compizDamageNux(cScreen->currentDamage()); didShellRepaint = false; + firstWindowAboveShell = NULL; } void UnityScreen::donePaint() @@ -2286,13 +2292,17 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, /* * The occlusion pass tests windows from TOP to BOTTOM. That's opposite to * the actual painting loop. + * + * Detect uScreen->fullscreenRegion here. That represents the region which + * fully covers the shell on its output. It does not include regular windows + * stacked above the shell like DnD icons or Onboard etc. */ if (isNuxWindow(window)) { if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) { uScreen->nuxRegion += window->geometry(); - uScreen->nuxRegion -= uScreen->aboveShell; + uScreen->nuxRegion -= uScreen->fullscreenRegion; } return false; // Ensure nux windows are never painted by compiz } @@ -2302,14 +2312,17 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, PAINT_WINDOW_TRANSLUCENT_MASK | PAINT_WINDOW_TRANSFORMED_MASK | PAINT_WINDOW_NO_CORE_INSTANCE_MASK; - if (!(mask & nonOcclusionBits)) + if (!(mask & nonOcclusionBits) && + (window->state() & CompWindowStateFullscreenMask)) // And I've been advised to test other things, but they don't work: // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw // && !window->alpha() <-- Doesn't work; Opaque windows often have alpha { - uScreen->aboveShell += window->geometry(); - uScreen->aboveShell -= uScreen->nuxRegion; + uScreen->fullscreenRegion += window->geometry(); + uScreen->fullscreenRegion -= uScreen->nuxRegion; } + if (uScreen->nuxRegion.isEmpty()) + uScreen->firstWindowAboveShell = window; } GLWindowPaintAttrib wAttrib = attrib; @@ -2370,38 +2383,18 @@ bool UnityWindow::glDraw(const GLMatrix& matrix, } } - /* - * Paint the shell in *roughly* the compiz stacking order. This is only - * approximate because we're painting all the nux windows as soon as we find - * the bottom-most nux window (from bottom to top). - * But remember to avoid painting the shell if it's within the aboveShell - * region. - */ if (uScreen->doShellRepaint && !uScreen->forcePaintOnTop () && - !uScreen->aboveShell.contains(window->geometry()) + window == uScreen->firstWindowAboveShell && + !uScreen->fullscreenRegion.contains(window->geometry()) ) { - std::vector const& xwns = nux::XInputWindow::NativeHandleList(); - unsigned int size = xwns.size(); - - for (CompWindow* w = window; w && uScreen->doShellRepaint; w = w->prev) - { - auto id = w->id(); - - for (unsigned int i = 0; i < size; ++i) - { - if (xwns[i] == id) - { + g_print("vv: firstWindowAboveShell %x\n", (int)window->id()); #ifdef USE_MODERN_COMPIZ_GL - uScreen->paintDisplay(); + uScreen->paintDisplay(); #else - uScreen->paintDisplay(region, matrix, mask); + uScreen->paintDisplay(region, matrix, mask); #endif - break; - } - } - } } if (window->type() == CompWindowTypeDesktopMask) diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index eb0851515..5a539bf27 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -283,7 +283,8 @@ private: CompOutput* _last_output; CompRegion nuxRegion; - CompRegion aboveShell; + CompRegion fullscreenRegion; + CompWindow* firstWindowAboveShell; nux::Property primary_monitor_; -- cgit v1.2.3 From 09877dbd935026221fec5023ce425d91f7f6a7ac Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 6 Jul 2012 12:54:37 +0800 Subject: Remove debug output (bzr r2470.3.2) --- plugins/unityshell/src/unityshell.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 93386f547..865793f27 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -749,8 +749,6 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo { CompOutput *output = _last_output; - g_print("vv: paintDisplay\n"); - #ifndef USE_MODERN_COMPIZ_GL bool was_bound = _fbo->bound (); @@ -1224,8 +1222,6 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, bool force = forcePaintOnTop() || PluginAdapter::Default()->IsExpoActive(); doShellRepaint = force || !(region.isEmpty() || wt->GetDrawList().empty()); - g_print("vv: glPaintOutput %u\n", output->id()); - allowWindowPaint = true; _last_output = output; paint_panel_ = false; @@ -2389,7 +2385,6 @@ bool UnityWindow::glDraw(const GLMatrix& matrix, !uScreen->fullscreenRegion.contains(window->geometry()) ) { - g_print("vv: firstWindowAboveShell %x\n", (int)window->id()); #ifdef USE_MODERN_COMPIZ_GL uScreen->paintDisplay(); #else -- cgit v1.2.3 From 9cda0261035e6f2b024e0b0ee241bdc6179ce20b Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 6 Jul 2012 15:38:40 +0800 Subject: Ensure the launcher gets redrawn during keynav mode (LP: #1021549) (bzr r2470.2.1) --- plugins/unityshell/src/unityshell.cpp | 24 ++++++++++++++++-------- plugins/unityshell/src/unityshell.h | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 169b5224f..c066cd052 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -119,7 +119,7 @@ UnityScreen::UnityScreen(CompScreen* screen) , doShellRepaint(false) , didShellRepaint(false) , allowWindowPaint(false) - , damaged(false) + , damages(0) , _key_nav_mode_requested(false) , _last_output(nullptr) #ifndef USE_MODERN_COMPIZ_GL @@ -910,7 +910,7 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo doShellRepaint = false; didShellRepaint = true; - damaged = false; + damages = 0; } bool UnityScreen::forcePaintOnTop () @@ -1304,9 +1304,9 @@ void UnityScreen::preparePaint(int ms) wi->HandleAnimations (ms); // Workaround Nux bug LP: #1014610: - if (damaged) + if (damages) { - damaged = false; + damages = 0; nuxDamageCompiz(); } @@ -1407,11 +1407,19 @@ void UnityScreen::compizDamageNux(CompRegion const& damage) /* Grab changed nux regions and add damage rects for them */ void UnityScreen::nuxDamageCompiz() { - // Workaround Nux bug LP: #1014610 (unbounded DrawList growth) - // Also, ensure we don't dereference null *controller_ on startup. - if (damaged || !launcher_controller_ || !dash_controller_) + /* + * Workaround Nux bug LP: #1014610 (unbounded DrawList growth). + * Also, ensure we don't dereference null *controller_ on startup. + * + * The workaround is a bit ugly right now (damages > 500). This is necessary + * to also avoid regression LP: #1021549 which the workaround causes. + * But soon enough we will be able to remove the workaround and "damages" + * completely. Just as soon as we're sure all users of Unity 6.0 have + * upgraded to Nux 3.0 which has the fix for LP: #1014610. + */ + if ((damages > 500) || !launcher_controller_ || !dash_controller_) return; - damaged = true; + damages++; CompRegion nux_damage; diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index eb0851515..8cdf196cc 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -278,7 +278,7 @@ private: bool doShellRepaint; bool didShellRepaint; bool allowWindowPaint; - bool damaged; + int damages; bool _key_nav_mode_requested; CompOutput* _last_output; -- cgit v1.2.3 From 1ac92e7a5772530d604da9b2e80a6186df7ee70b Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 6 Jul 2012 15:50:13 +0800 Subject: Use a much nicer fix for LP: #1021549 which involves removing the workaround for Nux bug LP: #1014610. This assumes everyone has upgraded to Nux 3.0 (!) (bzr r2470.2.2) --- plugins/unityshell/src/unityshell.cpp | 25 ++++++------------------- plugins/unityshell/src/unityshell.h | 1 - 2 files changed, 6 insertions(+), 20 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index c066cd052..5fb5b7571 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -119,7 +119,6 @@ UnityScreen::UnityScreen(CompScreen* screen) , doShellRepaint(false) , didShellRepaint(false) , allowWindowPaint(false) - , damages(0) , _key_nav_mode_requested(false) , _last_output(nullptr) #ifndef USE_MODERN_COMPIZ_GL @@ -910,7 +909,6 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo doShellRepaint = false; didShellRepaint = true; - damages = 0; } bool UnityScreen::forcePaintOnTop () @@ -1303,13 +1301,6 @@ void UnityScreen::preparePaint(int ms) for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) wi->HandleAnimations (ms); - // Workaround Nux bug LP: #1014610: - if (damages) - { - damages = 0; - nuxDamageCompiz(); - } - compizDamageNux(cScreen->currentDamage()); didShellRepaint = false; @@ -1408,18 +1399,14 @@ void UnityScreen::compizDamageNux(CompRegion const& damage) void UnityScreen::nuxDamageCompiz() { /* - * Workaround Nux bug LP: #1014610 (unbounded DrawList growth). - * Also, ensure we don't dereference null *controller_ on startup. - * - * The workaround is a bit ugly right now (damages > 500). This is necessary - * to also avoid regression LP: #1021549 which the workaround causes. - * But soon enough we will be able to remove the workaround and "damages" - * completely. Just as soon as we're sure all users of Unity 6.0 have - * upgraded to Nux 3.0 which has the fix for LP: #1014610. + * WARNING: Nux bug LP: #1014610 (unbounded DrawList growth) will cause + * this code to be called far too often in some cases and + * Unity will appear to freeze for a while. Please ensure you + * have Nux 3.0+ with the fix for LP: #1014610. */ - if ((damages > 500) || !launcher_controller_ || !dash_controller_) + + if (!launcher_controller_ || !dash_controller_) return; - damages++; CompRegion nux_damage; diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 8cdf196cc..92933a033 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -278,7 +278,6 @@ private: bool doShellRepaint; bool didShellRepaint; bool allowWindowPaint; - int damages; bool _key_nav_mode_requested; CompOutput* _last_output; -- cgit v1.2.3 From ecb8cacd5fc8e58d6766d0e959005ec91ef71128 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 6 Jul 2012 17:43:50 +0800 Subject: Revert fix for LP: #833727 for now. It either needs test cases or to be replaced with a more generic fix that applies to all unityshell plugin options. And I'd rather wait for the latter before writing tests for it. (bzr r2470.1.1) --- plugins/unityshell/src/unityshell.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 169b5224f..acf545907 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -2957,7 +2957,6 @@ void UnityScreen::initLauncher() optionGetMenusDiscoveryDuration(), optionGetMenusDiscoveryFadein(), optionGetMenusDiscoveryFadeout()); - panel_controller_->SetOpacity(optionGetPanelOpacity()); LOG_INFO(logger) << "initLauncher-Panel " << timer.ElapsedSeconds() << "s"; /* Setup Places */ -- cgit v1.2.3 From 48a64d7573f6e0dddf33f8db5e5c6e0547863f8a Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Sun, 8 Jul 2012 16:42:25 +0800 Subject: Fix dash slowness/lag by prioritizing user interaction ahead of active blur updates. (LP: #1021665) (LP: #874230) Fixed bugs: - LP: #1021665 - LP: #874230 (bzr r2475.1.1) --- plugins/unityshell/src/unityshell.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 5f4e64ea3..97cd21174 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1347,11 +1347,23 @@ void UnityScreen::compizDamageNux(CompRegion const& damage) if (!launcher_controller_) return; - CompRect::vector const& rects(damage.rects()); - for (const CompRect &r : rects) + /* + * Prioritise user interaction over active blur updates. So the general + * slowness of the active blur doesn't affect the UI interaction performance. + * + * Also, BackgroundEffectHelper::ProcessDamage() is causing a feedback loop + * while the dash is open. Calling it results in the NEXT frame (and the + * current one?) to get some damage. This GetDrawList().empty() check avoids + * that feedback loop and allows us to idle correctly. + */ + if (wt->GetDrawList().empty()) { - nux::Geometry geo(r.x(), r.y(), r.width(), r.height()); - BackgroundEffectHelper::ProcessDamage(geo); + CompRect::vector const& rects(damage.rects()); + for (CompRect const& r : rects) + { + nux::Geometry geo(r.x(), r.y(), r.width(), r.height()); + BackgroundEffectHelper::ProcessDamage(geo); + } } auto launchers = launcher_controller_->launchers(); -- cgit v1.2.3