Don't use the foreground color for selected cells, Don't use the

2004-11-16  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkcellrenderertext.c (get_layout): Don't use the foreground
	color for selected cells, Don't use the background color
	in unfocused selected cells. Also avoid creating two PangoLayouts
	per render call.  (#154615, #154611, Billy Biggs)
This commit is contained in:
Matthias Clasen 2004-11-16 05:19:21 +00:00 committed by Matthias Clasen
parent f0265b018e
commit e23cf6361d
5 changed files with 59 additions and 13 deletions

View File

@ -1,3 +1,10 @@
2004-11-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderertext.c (get_layout): Don't use the foreground
color for selected cells, Don't use the background color
in unfocused selected cells. Also avoid creating two PangoLayouts
per render call. (#154615, #154611, Billy Biggs)
Mon Nov 15 19:02:07 2004 Manish Singh <yosh@gimp.org>
* gdk/abicheck.sh

View File

@ -1,3 +1,10 @@
2004-11-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderertext.c (get_layout): Don't use the foreground
color for selected cells, Don't use the background color
in unfocused selected cells. Also avoid creating two PangoLayouts
per render call. (#154615, #154611, Billy Biggs)
Mon Nov 15 19:02:07 2004 Manish Singh <yosh@gimp.org>
* gdk/abicheck.sh

View File

@ -1,3 +1,10 @@
2004-11-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderertext.c (get_layout): Don't use the foreground
color for selected cells, Don't use the background color
in unfocused selected cells. Also avoid creating two PangoLayouts
per render call. (#154615, #154611, Billy Biggs)
Mon Nov 15 19:02:07 2004 Manish Singh <yosh@gimp.org>
* gdk/abicheck.sh

View File

@ -1,3 +1,10 @@
2004-11-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderertext.c (get_layout): Don't use the foreground
color for selected cells, Don't use the background color
in unfocused selected cells. Also avoid creating two PangoLayouts
per render call. (#154615, #154611, Billy Biggs)
Mon Nov 15 19:02:07 2004 Manish Singh <yosh@gimp.org>
* gdk/abicheck.sh

View File

@ -1258,7 +1258,8 @@ get_layout (GtkCellRendererText *celltext,
* background_area not the PangoLayout area
*/
if (celltext->foreground_set)
if (celltext->foreground_set
&& (flags & GTK_CELL_RENDERER_SELECTED) == 0)
{
PangoColor color;
@ -1324,17 +1325,17 @@ get_layout (GtkCellRendererText *celltext,
}
static void
gtk_cell_renderer_text_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
gint *width,
gint *height)
get_size (GtkCellRenderer *cell,
GtkWidget *widget,
GdkRectangle *cell_area,
PangoLayout *layout,
gint *x_offset,
gint *y_offset,
gint *width,
gint *height)
{
GtkCellRendererText *celltext = (GtkCellRendererText *) cell;
PangoRectangle rect;
PangoLayout *layout;
GtkCellRendererTextPrivate *priv;
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
@ -1378,7 +1379,10 @@ gtk_cell_renderer_text_get_size (GtkCellRenderer *cell,
return;
}
layout = get_layout (celltext, widget, FALSE, 0);
if (layout)
g_object_ref (layout);
else
layout = get_layout (celltext, widget, FALSE, 0);
pango_layout_get_pixel_extents (layout, NULL, &rect);
@ -1430,6 +1434,20 @@ gtk_cell_renderer_text_get_size (GtkCellRenderer *cell,
g_object_unref (layout);
}
static void
gtk_cell_renderer_text_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
gint *width,
gint *height)
{
get_size (cell, widget, cell_area, NULL,
x_offset, y_offset, width, height);
}
static void
gtk_cell_renderer_text_render (GtkCellRenderer *cell,
GdkDrawable *window,
@ -1450,8 +1468,7 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
layout = get_layout (celltext, widget, TRUE, flags);
gtk_cell_renderer_text_get_size (cell, widget, cell_area, &x_offset, &y_offset, NULL, NULL);
get_size (cell, widget, cell_area, layout, &x_offset, &y_offset, NULL, NULL);
if (!cell->sensitive)
{
@ -1477,7 +1494,8 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
state = GTK_STATE_NORMAL;
}
if (celltext->background_set && state != GTK_STATE_SELECTED)
if (celltext->background_set &&
(flags & GTK_CELL_RENDERER_SELECTED) == 0)
{
GdkColor color;
GdkGC *gc;