[hackers] [surf] using simple strings for colors in config.h || Enno Boland (tox)

From: <hg_AT_suckless.org>
Date: Mon, 7 Sep 2009 13:05:06 +0000 (UTC)

changeset: 71:271054781dea
tag: tip
user: Enno Boland (tox) <tox_AT_s01.de>
date: Mon Sep 07 15:06:32 2009 +0200
files: config.def.h surf.c
description:
using simple strings for colors in config.h

diff -r 2f4be1786c29 -r 271054781dea config.def.h
--- a/config.def.h Mon Sep 07 14:28:43 2009 +0200
+++ b/config.def.h Mon Sep 07 15:06:32 2009 +0200
@@ -1,6 +1,6 @@
 /* modifier 0 means no modifier */
-static GdkColor progress = { 65535,65535,0,0 };
-static GdkColor progress_trust = { 65535,0,65535,0 };
+static gchar *progress = "#FF0000";
+static gchar *progress_trust = "#00FF00";
 #define MODKEY GDK_CONTROL_MASK
 static Key keys[] = {
     /* modifier keyval function arg Focus */
diff -r 2f4be1786c29 -r 271054781dea surf.c
--- a/surf.c Mon Sep 07 14:28:43 2009 +0200
+++ b/surf.c Mon Sep 07 15:06:32 2009 +0200
@@ -181,6 +181,7 @@
         gint width;
         GdkGC *gc;
         gchar *uri;
+ GdkColor fg;
 
 
         uri = geturi(c);
@@ -189,10 +190,9 @@
 
         gc = gdk_gc_new(w->window);
 
- if(strstr(uri, "https://") == uri)
- gdk_gc_set_rgb_fg_color(gc, &progress_trust);
- else
- gdk_gc_set_rgb_fg_color(gc, &progress);
+ gdk_color_parse(strstr(uri, "https://") == uri ?
+ progress_trust : progress, &fg);
+ gdk_gc_set_rgb_fg_color(gc, &fg);
         gdk_draw_rectangle(w->window,
                         w->style->bg_gc[GTK_WIDGET_STATE(w)],
                         TRUE,
Received on Mon Sep 07 2009 - 13:05:06 UTC

This archive was generated by hypermail 2.2.0 : Mon Sep 07 2009 - 13:12:15 UTC