Re: [Usability] GnomeIconList selection color



On Sun, Feb 10, 2002 at 07:42:00PM -0500, Havoc Pennington wrote:
> 
> Hi,
> 
> BTW you should probably send library patches to gnome-libs-devel and
> desktop patches to desktop-devel-list (rather than or in addition to
> usability).

Ok. Will do in the future.

> 
> Jorn Baayen <jorn nl linux org> writes: 
> >
> > Also attached a little patch that changes the color used to draw the
> > background to the same color used for selections in other widgets.
> > It's not perfect though, other widgets have a slightly lighter color
> > when the widget is in focus. My gnomecanvas skills were not
> > sufficient to make the patch so that it addressed that issue as
> > well, though.
> > 
> 
> When you don't have focus, you just use GTK_STATE_ACTIVE instead of
> GTK_STATE_SELECTED. It's sort of a bizarre hack, but that's how it
> works.
> 
> To see if the icon list is focused, just GTK_WIDGET_HAS_FOCUS (iconlist).

Hey, that worked! :) Thanks!

Attached a new patch. Are there any objections to this sudden change
of color or is the patch OK-enough to commit?

Cheers
Jorn
? stamp-h1
? libgnomeui/diff
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnomeui/ChangeLog,v
retrieving revision 1.100
diff -u -r1.100 ChangeLog
--- ChangeLog	2002/02/09 22:32:52	1.100
+++ ChangeLog	2002/02/11 01:05:38
@@ -1,3 +1,8 @@
+2002-02-11  Jorn Baayen  <jorn nl linux org>
+
+	* libgnomeui/gnome-icon-item.c: use base_gc rather than bg_gc to
+	draw the background color of the selected item.
+	
 2002-02-10  Pauli Virtanen  <ptvirtan cc hut fi>
 
 	* configure.in (ALL_LINGUAS): Added "fi" (Finnish).
Index: libgnomeui/gnome-icon-item.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-icon-item.c,v
retrieving revision 1.52
diff -u -r1.52 gnome-icon-item.c
--- libgnomeui/gnome-icon-item.c	2002/02/01 23:32:56	1.52
+++ libgnomeui/gnome-icon-item.c	2002/02/11 01:05:39
@@ -562,11 +562,24 @@
 	text_yofs = yofs + MARGIN_Y;
 
 	if (iti->selected && !iti->editing)
-		gdk_draw_rectangle (drawable,
-				    style->bg_gc[GTK_STATE_SELECTED],
-				    TRUE,
-				    xofs + 1, yofs + 1,
-				    w - 2, h - 2);
+	{
+		if (GTK_WIDGET_HAS_FOCUS (GNOME_CANVAS_ITEM (iti)->canvas))
+		{
+			gdk_draw_rectangle (drawable,
+					    style->base_gc[GTK_STATE_SELECTED],
+					    TRUE,
+					    xofs + 1, yofs + 1,
+					    w - 2, h - 2);
+		}
+		else
+		{
+			gdk_draw_rectangle (drawable,
+					    style->base_gc[GTK_STATE_ACTIVE],
+					    TRUE,
+					    xofs + 1, yofs + 1,
+					    w - 2, h - 2);
+		}
+	}
 	if (iti->focused && ! iti->editing)
 		gtk_draw_focus (style,
 				drawable,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]