summaryrefslogtreecommitdiff
path: root/plugins
diff options
authorJason Smith <jason.smith@canonical.com>2011-10-21 11:56:58 -0400
committerJason Smith <jason.smith@canonical.com>2011-10-21 11:56:58 -0400
commitb1e70a69d434fa991d17dba6d0abb6da1e69e1a4 (patch)
tree1f3f1fa7bd0ef2ee06625a4e9bb1caeebc704bf8 /plugins
parentbd6f07d29c07568ac39ebc815a39e1fec3534199 (diff)
make it possible to manually change the unity shading color for testing purposes
(bzr r1723)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/unityshell/src/BGHash.cpp13
-rw-r--r--plugins/unityshell/src/BGHash.h3
-rw-r--r--plugins/unityshell/src/unityshell.cpp14
-rw-r--r--plugins/unityshell/unityshell.xml.in10
4 files changed, 40 insertions, 0 deletions
diff --git a/plugins/unityshell/src/BGHash.cpp b/plugins/unityshell/src/BGHash.cpp
index 749e8c3f1..840f0c22b 100644
--- a/plugins/unityshell/src/BGHash.cpp
+++ b/plugins/unityshell/src/BGHash.cpp
@@ -50,6 +50,7 @@ namespace unity {
_hires_time_end(20),
_ubus_handle_request_colour(0)
{
+ _override_color.alpha= 0.0f;
background_monitor = gnome_bg_new ();
client = g_settings_new ("org.gnome.desktop.background");
@@ -94,6 +95,12 @@ namespace unity {
ubus_server_unregister_interest (ubus, _ubus_handle_request_colour);
}
+ void BGHash::OverrideColor (nux::Color color)
+ {
+ _override_color = color;
+ OnBackgroundChanged(background_monitor);
+ }
+
gboolean BGHash::ForceUpdate (BGHash *self)
{
self->OnBackgroundChanged(self->background_monitor);
@@ -107,6 +114,12 @@ namespace unity {
void BGHash::OnBackgroundChanged (GnomeBG *bg)
{
+ if (_override_color.alpha)
+ {
+ TransitionToNewColor (_override_color);
+ return;
+ }
+
const gchar *filename = gnome_bg_get_filename (bg);
if (filename == NULL)
{
diff --git a/plugins/unityshell/src/BGHash.h b/plugins/unityshell/src/BGHash.h
index d16d800b2..e18ead70c 100644
--- a/plugins/unityshell/src/BGHash.h
+++ b/plugins/unityshell/src/BGHash.h
@@ -48,6 +48,7 @@ namespace unity
nux::Color CurrentColor ();
void OnBackgroundChanged (GnomeBG *bg);
void OnGSettingsChanged (GSettings *settings, gchar *key);
+ void OverrideColor (nux::Color color);
private:
static gboolean OnSlideshowTransition (BGHash *self);
@@ -73,6 +74,8 @@ namespace unity
nux::Color _new_color; // in transitions, the next colour, otherwise the current colour
nux::Color _old_color; // the last colour chosen, used for transitions
+ nux::Color _override_color;
+
guint64 _hires_time_start;
guint64 _hires_time_end;
glib::SignalManager signal_manager_;
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 09d4c9edf..18a4f0c5d 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -233,6 +233,7 @@ UnityScreen::UnityScreen(CompScreen* screen)
uScreen->mFbos[&(screen->fullscreenOutput ())] = UnityFBO::Ptr (new UnityFBO(&(screen->fullscreenOutput ())));
}
+ optionSetBackgroundColorNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetLauncherHideModeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetBacklightModeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetLaunchAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
@@ -1995,6 +1996,19 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num)
{
switch (num)
{
+ case UnityshellOptions::BackgroundColor:
+ {
+ nux::Color override_color (optionGetBackgroundColorRed() / 65535.0f,
+ optionGetBackgroundColorGreen() / 65535.0f,
+ optionGetBackgroundColorBlue() / 65535.0f,
+ optionGetBackgroundColorAlpha() / 65535.0f);
+
+ 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;
+ _bghash.OverrideColor(override_color);
+ break;
+ }
case UnityshellOptions::LauncherHideMode:
launcher->SetHideMode((Launcher::LauncherHideMode) optionGetLauncherHideMode());
break;
diff --git a/plugins/unityshell/unityshell.xml.in b/plugins/unityshell/unityshell.xml.in
index 968a775bc..f3d5cf6af 100644
--- a/plugins/unityshell/unityshell.xml.in
+++ b/plugins/unityshell/unityshell.xml.in
@@ -166,6 +166,16 @@
</group>
<group>
<_short>Experimental</_short>
+ <option name="background_color" type="color">
+ <_short>Background Color</_short>
+ <_long>Background color override used for testing purposes</_long>
+ <default>
+ <red>0x00</red>
+ <green>0x00</green>
+ <blue>0x00</blue>
+ <alpha>0x00</alpha>
+ </default>
+ </option>
<option name="backlight_mode" type="int">
<_short>Backlight Mode</_short>
<_long>Change how the icons are backlit</_long>