[Xfce4-commits] [xfce/xfce4-panel] 62/73: Switch from GdkColor to GdkRGBA for panel bg color

noreply at xfce.org noreply at xfce.org
Sun Feb 26 16:34:43 CET 2017


This is an automated email from the git hooks/post-receive script.

andrzejr pushed a commit to branch master
in repository xfce/xfce4-panel.

commit 68d57a7791e5b9770e2af52881cc112edafd4346
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Thu Oct 27 00:10:45 2016 +0200

    Switch from GdkColor to GdkRGBA for panel bg color
---
 panel/panel-base-window.c     | 28 ++++++++++++----------------
 panel/panel-base-window.h     |  4 ++--
 panel/panel-plugin-external.c |  4 ++--
 panel/panel-plugin-external.h |  2 +-
 4 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c
index b99cd0d..9d4f9b6 100644
--- a/panel/panel-base-window.c
+++ b/panel/panel-base-window.c
@@ -235,9 +235,8 @@ panel_base_window_get_property (GObject    *object,
 {
   PanelBaseWindow        *window = PANEL_BASE_WINDOW (object);
   PanelBaseWindowPrivate *priv = window->priv;
-  GdkColor               *color;
-  GdkColor               bg_color;
-  GdkRGBA                bg_rgba;
+  GdkRGBA                *color;
+  GdkRGBA                bg_color;
   GtkStyleContext        *ctx;
 
   switch (prop_id)
@@ -264,10 +263,7 @@ panel_base_window_get_property (GObject    *object,
       else
         {
           ctx = gtk_widget_get_style_context (GTK_WIDGET (window));
-          gtk_style_context_get_background_color (ctx, GTK_STATE_NORMAL, &bg_rgba);
-          bg_color.red   = CLAMP(bg_rgba.red   * 65536, 65535, 0);
-          bg_color.green = CLAMP(bg_rgba.green * 65536, 65535, 0);
-          bg_color.blue  = CLAMP(bg_rgba.blue  * 65536, 65535, 0);
+          gtk_style_context_get_background_color (ctx, GTK_STATE_NORMAL, &bg_color);
           color = &bg_color;
         }
       g_value_set_boxed (value, color);
@@ -485,7 +481,7 @@ static gboolean
 panel_base_window_draw (GtkWidget *widget,
                         cairo_t   *cr)
 {
-  const GdkColor         *color;
+  const GdkRGBA          *color;
   GdkRGBA                 bg_rgba;
   GtkSymbolicColor       *literal;
   GtkSymbolicColor       *shade;
@@ -780,7 +776,7 @@ panel_base_window_set_plugin_background_color (GtkWidget *widget,
                                                gpointer   user_data)
 {
   PanelBaseWindow *window = PANEL_BASE_WINDOW (user_data);
-  GdkColor        *color;
+  GdkRGBA         *color;
 
   panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget));
   panel_return_if_fail (PANEL_IS_BASE_WINDOW (user_data));
@@ -863,18 +859,18 @@ panel_base_window_get_borders (PanelBaseWindow *window)
 
 void
 panel_util_set_source_rgba (cairo_t        *cr,
-                            const GdkColor *color,
+                            const GdkRGBA  *color,
                             gdouble         alpha)
 {
   panel_return_if_fail (alpha >= 0.00 && alpha <= 1.00);
   panel_return_if_fail (color != NULL);
 
   if (G_LIKELY (alpha == 1.00))
-    cairo_set_source_rgb (cr, color->red / 65535.00,
-                          color->green / 65535.00,
-                          color->blue / 65535.00);
+    cairo_set_source_rgb (cr, color->red,
+                          color->green,
+                          color->blue);
   else
-    cairo_set_source_rgba (cr, color->red / 65535.00,
-                           color->green / 65535.00,
-                           color->blue / 65535.00, alpha);
+    cairo_set_source_rgba (cr, color->red,
+                           color->green,
+                           color->blue, alpha);
 }
diff --git a/panel/panel-base-window.h b/panel/panel-base-window.h
index 836e2b9..95016ab 100644
--- a/panel/panel-base-window.h
+++ b/panel/panel-base-window.h
@@ -68,7 +68,7 @@ struct _PanelBaseWindow
 
   gdouble                 background_alpha;
   PanelBgStyle            background_style;
-  GdkColor               *background_color;
+  GdkRGBA                *background_color;
   gchar                  *background_image;
 };
 
@@ -85,7 +85,7 @@ void         panel_base_window_set_borders (PanelBaseWindow *window,
 PanelBorders panel_base_window_get_borders (PanelBaseWindow *window);
 
 void         panel_util_set_source_rgba    (cairo_t         *cr,
-                                            const GdkColor  *color,
+                                            const GdkRGBA   *color,
                                             gdouble          alpha);
 
 G_END_DECLS
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index 3debd5c..c263902 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -1136,7 +1136,7 @@ panel_plugin_external_set_background_alpha (PanelPluginExternal *external,
 
 void
 panel_plugin_external_set_background_color (PanelPluginExternal *external,
-                                            const GdkColor      *color)
+                                            const GdkRGBA       *color)
 {
   GValue value = { 0, };
 
@@ -1145,7 +1145,7 @@ panel_plugin_external_set_background_color (PanelPluginExternal *external,
   if (G_LIKELY (color != NULL))
     {
       g_value_init (&value, G_TYPE_STRING);
-      g_value_take_string (&value, gdk_color_to_string (color));
+      g_value_take_string (&value, gdk_rgba_to_string (color));
 
       panel_plugin_external_queue_add (external,
                                        PROVIDER_PROP_TYPE_SET_BACKGROUND_COLOR,
diff --git a/panel/panel-plugin-external.h b/panel/panel-plugin-external.h
index afa591d..83537be 100644
--- a/panel/panel-plugin-external.h
+++ b/panel/panel-plugin-external.h
@@ -90,7 +90,7 @@ void         panel_plugin_external_set_background_alpha (PanelPluginExternal  *e
                                                          gdouble               alpha);
 
 void         panel_plugin_external_set_background_color (PanelPluginExternal  *external,
-                                                         const GdkColor       *color);
+                                                         const GdkRGBA        *color);
 
 void         panel_plugin_external_set_background_image (PanelPluginExternal  *external,
                                                          const gchar          *image);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list