summaryrefslogtreecommitdiff
path: root/plugins/unityshell
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2013-09-24 22:18:42 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2013-09-24 22:18:42 +0200
commitbc7056c056ffe1d8a5ca2d5ad35506dbfa9f2925 (patch)
tree9bf133ef9862f577837f9e7492990bf65739851d /plugins/unityshell
parente7c8f39ed851678c09cdcf4bdd1274d7ebb269e8 (diff)
Unity: Use WindowManager average_color property for getting the desktop color
Having to deal with UBus here was a mess and caused us to re-store the same value too many times. Using a nux property gives us all the features we need easily while WindowManager is already enough shared to be used for this task. (bzr r3530.1.3)
Diffstat (limited to 'plugins/unityshell')
-rw-r--r--plugins/unityshell/src/unityshell.cpp29
-rw-r--r--plugins/unityshell/src/unityshell.h5
2 files changed, 12 insertions, 22 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 7389119d6..28b98e9a5 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -270,11 +270,6 @@ UnityScreen::UnityScreen(CompScreen* screen)
wt->RedrawRequested.connect(sigc::mem_fun(this, &UnityScreen::onRedrawRequested));
- // _bghash is a pointer. We don't want it to be created before Nux system has had a chance
- // to start. BGHash relies on animations. Nux animation system starts after the WindowThread
- // has been created.
- _bghash.reset(new BGHash());
-
unity_a11y_init(wt.get());
/* i18n init */
@@ -1659,11 +1654,10 @@ void UnityScreen::handleEvent(XEvent* event)
ShowdesktopHandler::InhibitLeaveShowdesktopMode (event->xmaprequest.window);
break;
case PropertyNotify:
- if (event->xproperty.window == GDK_ROOT_WINDOW() &&
- event->xproperty.atom == gdk_x11_get_xatom_by_name("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS"))
+ if (bghash_ && event->xproperty.window == GDK_ROOT_WINDOW() &&
+ event->xproperty.atom == bghash_->ColorAtomId())
{
- if (_bghash)
- _bghash->RefreshColor();
+ bghash_->RefreshColor();
}
break;
default:
@@ -3058,8 +3052,7 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num)
override_color.red = override_color.red / override_color.alpha;
override_color.green = override_color.green / override_color.alpha;
override_color.blue = override_color.blue / override_color.alpha;
- if (_bghash)
- _bghash->OverrideColor(override_color);
+ bghash_->OverrideColor(override_color);
break;
}
case UnityshellOptions::LauncherHideMode:
@@ -3211,16 +3204,14 @@ void UnityScreen::Relayout()
UScreen *uscreen = UScreen::GetDefault();
int primary_monitor = uscreen->GetPrimaryMonitor();
- auto geo = uscreen->GetMonitorGeometry(primary_monitor);
-
- primary_monitor_ = nux::Geometry(geo.x, geo.y, geo.width, geo.height);
+ auto const& geo = uscreen->GetMonitorGeometry(primary_monitor);
wt->SetWindowSize(geo.width, geo.height);
LOG_DEBUG(logger) << "Setting to primary screen rect:"
- << " x=" << primary_monitor_().x
- << " y=" << primary_monitor_().y
- << " w=" << primary_monitor_().width
- << " h=" << primary_monitor_().height;
+ << " x=" << geo.x
+ << " y=" << geo.y
+ << " w=" << geo.width
+ << " h=" << geo.height;
needsRelayout = false;
}
@@ -3276,6 +3267,8 @@ void UnityScreen::initLauncher()
{
Timer timer;
+ bghash_.reset(new BGHash());
+
auto xdnd_collection_window = std::make_shared<XdndCollectionWindowImp>();
auto xdnd_start_stop_notifier = std::make_shared<XdndStartStopNotifierImp>();
auto xdnd_manager = std::make_shared<XdndManagerImp>(xdnd_start_stop_notifier, xdnd_collection_window);
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index 01e1a2089..5cdba628d 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -278,6 +278,7 @@ private:
shortcut::Controller::Ptr shortcut_controller_;
session::Controller::Ptr session_controller_;
debug::DebugDBusInterface debugger_;
+ std::unique_ptr<BGHash> bghash_;
/* Subscription for gestures that manipulate Unity launcher */
std::unique_ptr<nux::GesturesSubscription> gestures_sub_launcher_;
@@ -314,10 +315,6 @@ private:
CompRegion fullscreenRegion;
CompWindow* firstWindowAboveShell;
- nux::Property<nux::Geometry> primary_monitor_;
-
- std::unique_ptr<BGHash> _bghash;
-
::GLFramebufferObject *oldFbo;
bool queryForShader ();