From cbf275777ce3c9d4357f7a7ce6a8a89c51857df3 Mon Sep 17 00:00:00 2001 From: TingPing Date: Thu, 10 Oct 2013 21:02:24 -0400 Subject: xtext: store palette as GdkColors --- src/fe-gtk/xtext.c | 18 +++++------------- src/fe-gtk/xtext.h | 2 +- 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'src/fe-gtk') diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index 49001b02..efe372fb 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -349,19 +349,13 @@ backend_draw_text (GtkXText *xtext, int dofill, GdkGC *gc, int x, int y, static void xtext_set_fg (GtkXText *xtext, GdkGC *gc, int index) { - GdkColor col; - - col.pixel = xtext->palette[index]; - gdk_gc_set_foreground (gc, &col); + gdk_gc_set_foreground (gc, &xtext->palette[index]); } static void xtext_set_bg (GtkXText *xtext, GdkGC *gc, int index) { - GdkColor col; - - col.pixel = xtext->palette[index]; - gdk_gc_set_background (gc, &col); + gdk_gc_set_background (gc, &xtext->palette[index]); } static void @@ -685,8 +679,7 @@ gtk_xtext_realize (GtkWidget * widget) gdk_gc_set_foreground (xtext->thin_gc, &col); /* for the marker bar (marker) */ - col.pixel = xtext->palette[XTEXT_MARKER]; - gdk_gc_set_foreground (xtext->marker_gc, &col); + gdk_gc_set_foreground (xtext->marker_gc, &xtext->palette[XTEXT_MARKER]); xtext_set_fg (xtext, xtext->fgc, XTEXT_FG); xtext_set_bg (xtext, xtext->fgc, XTEXT_BG); @@ -3241,7 +3234,7 @@ gtk_xtext_set_palette (GtkXText * xtext, GdkColor palette[]) for (i = (XTEXT_COLS-1); i >= 0; i--) { - xtext->palette[i] = palette[i].pixel; + xtext->palette[i] = palette[i]; } if (GTK_WIDGET_REALIZED (xtext)) @@ -3250,8 +3243,7 @@ gtk_xtext_set_palette (GtkXText * xtext, GdkColor palette[]) xtext_set_bg (xtext, xtext->fgc, XTEXT_BG); xtext_set_fg (xtext, xtext->bgc, XTEXT_BG); - col.pixel = xtext->palette[XTEXT_MARKER]; - gdk_gc_set_foreground (xtext->marker_gc, &col); + gdk_gc_set_foreground (xtext->marker_gc, &xtext->palette[XTEXT_MARKER]); } xtext->col_fore = XTEXT_FG; xtext->col_back = XTEXT_BG; diff --git a/src/fe-gtk/xtext.h b/src/fe-gtk/xtext.h index 4f3e1ec7..c704638f 100644 --- a/src/fe-gtk/xtext.h +++ b/src/fe-gtk/xtext.h @@ -141,7 +141,7 @@ struct _GtkXText GdkGC *dark_gc; GdkGC *thin_gc; GdkGC *marker_gc; - gulong palette[XTEXT_COLS]; + GdkColor palette[XTEXT_COLS]; gint io_tag; /* for delayed refresh events */ gint add_io_tag; /* "" when adding new text */ -- cgit 1.4.1