fix cell renderer state logic to not be always on

2007-07-28  Jens Granseuer  <jensgr@gmx.net>

	* wp-cellrenderer.c: (cell_renderer_wallpaper_render):
	* wp-cellrenderer.h: fix cell renderer state logic to not be always on

svn path=/trunk/; revision=7909
This commit is contained in:
Jens Granseuer 2007-07-28 11:38:06 +00:00 committed by Jens Granseuer
parent f437b8f99d
commit ef3bb7e92b
3 changed files with 62 additions and 12 deletions

View file

@ -1,3 +1,8 @@
2007-07-28 Jens Granseuer <jensgr@gmx.net>
* wp-cellrenderer.c: (cell_renderer_wallpaper_render):
* wp-cellrenderer.h: fix cell renderer state logic to not be always on
2007-07-28 Thomas Wood <thos@gnome.org>
* theme-util.c: Add missing include

View file

@ -1,8 +1,24 @@
/*
* Copyright (C) 2007 The GNOME Foundation
* Written by Denis Washington <denisw@svn.gnome.org>
* Jens Granseuer <jensgr@gmx.net>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "wp-cellrenderer.h"
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
static void cell_renderer_wallpaper_render (GtkCellRenderer *cell,
GdkWindow *window,
@ -47,13 +63,23 @@ cell_renderer_wallpaper_render (GtkCellRenderer *cell,
(* GTK_CELL_RENDERER_CLASS (cell_renderer_wallpaper_parent_class)->render)
(cell, window, widget, background_area, cell_area, expose_area, flags);
if (flags && GTK_CELL_RENDERER_FOCUSED)
if ((flags & (GTK_CELL_RENDERER_SELECTED|GTK_CELL_RENDERER_PRELIT)) != 0)
{
GtkStateType state;
GdkGC *gc;
gc = gdk_gc_new (GDK_DRAWABLE (window));
if ((flags & GTK_CELL_RENDERER_SELECTED) != 0)
{
if (GTK_WIDGET_HAS_FOCUS (widget))
state = GTK_STATE_SELECTED;
else
state = GTK_STATE_ACTIVE;
}
else
state = GTK_STATE_PRELIGHT;
gdk_gc_set_foreground (gc, &widget->style->bg[GTK_STATE_SELECTED]);
gc = gdk_gc_new (GDK_DRAWABLE (window));
gdk_gc_set_foreground (gc, &widget->style->bg[state]);
gdk_gc_set_line_attributes (gc, 3,
GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);

View file

@ -1,8 +1,27 @@
#include <gtk/gtk.h>
/*
* Copyright (C) 2007 The GNOME Foundation
* Written by Denis Washington <denisw@svn.gnome.org>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _WP_CELL_RENDERER_H
#define _WP_CELL_RENDERER_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
typedef struct _CellRendererWallpaper CellRendererWallpaper;