diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-01-21 12:47:30 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-01-21 12:47:30 +0100 |
| commit | de84928f3bd156bef27fdcb0944424d68aa4ca3f (patch) | |
| tree | e2cb3ad052d2ea7d3bf33b57ec980eb75cff2894 /unity-shared | |
| parent | 0746b91d7bdad5b0b2f7436ee168e4e450af506a (diff) | |
DecorationStyle: use GdkRGBA for glow-color
(bzr r3566.5.235)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/DecorationStyle.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/unity-shared/DecorationStyle.cpp b/unity-shared/DecorationStyle.cpp index 8cd0d106c..48cd74b7f 100644 --- a/unity-shared/DecorationStyle.cpp +++ b/unity-shared/DecorationStyle.cpp @@ -87,7 +87,7 @@ static void unity_decoration_class_init(UnityDecorationClass* klass) param = g_param_spec_uint("glow-size", "Selected Window Glow Size", "", 0, G_MAXUINT, DEFAULT_GLOW_SIZE, G_PARAM_READABLE); gtk_widget_class_install_style_property(GTK_WIDGET_CLASS(klass), param); - param = g_param_spec_boxed("glow-color", "Selected Window Glow Color", "", GDK_TYPE_COLOR, G_PARAM_READABLE); + param = g_param_spec_boxed("glow-color", "Selected Window Glow Color", "", GDK_TYPE_RGBA, G_PARAM_READABLE); gtk_widget_class_install_style_property(GTK_WIDGET_CLASS(klass), param); } @@ -99,17 +99,12 @@ Border BorderFromGtkBorder(GtkBorder* b, Border const& fallback = Border()) return Border(b->top, b->left, b->right, b->bottom); } -nux::Color ColorFromGdkColor(GdkColor* c, nux::Color const& fallback = nux::Color()) +nux::Color ColorFromGdkRGBA(GdkRGBA* c, nux::Color const& fallback = nux::Color()) { if (!c) return fallback; - return nux::Color(c->red/65535.0f, c->green/65535.0f, c->blue/65535.0f); -} - -void gdk_color_free0(GdkColor* c) -{ - if (c) gdk_color_free(c); + return nux::Color(c->red, c->green, c->blue, c->alpha); } } @@ -189,8 +184,8 @@ struct Style::Impl b.reset(GetProperty<GtkBorder*>("input-extents"), gtk_border_free); input_edges_ = BorderFromGtkBorder(b.get(), DEFAULT_INPUT_EDGES); - std::shared_ptr<GdkColor> c(GetProperty<GdkColor*>("glow-color"), gdk_color_free0); - glow_color_ = ColorFromGdkColor(c.get(), DEFAULT_GLOW_COLOR); + std::shared_ptr<GdkRGBA> rgba(GetProperty<GdkRGBA*>("glow-color"), gdk_rgba_free); + glow_color_ = ColorFromGdkRGBA(rgba.get(), DEFAULT_GLOW_COLOR); glow_size_ = std::max<unsigned>(0, GetProperty<guint>("glow-size")); radius_.top = GetBorderProperty<gint>(Side::TOP, WidgetState::NORMAL, "border-radius"); @@ -342,7 +337,7 @@ struct Style::Impl if (ws != WidgetState::BACKDROP) { std::shared_ptr<GdkRGBA> rgba(GetBorderProperty<GdkRGBA*>(Side::TOP, WidgetState::NORMAL, "color"), gdk_rgba_free); - color = nux::Color(rgba->red, rgba->green, rgba->blue, rgba->alpha); + color = ColorFromGdkRGBA(rgba.get()); } else { |
