Re: Problem with dynamically changing gtkrc's
- From: Owen Taylor <otaylor gtk org>
- To: Michael Fulbright <msf redhat com>
- Cc: gtk-list redhat com
- Subject: Re: Problem with dynamically changing gtkrc's
- Date: 20 May 1998 13:40:23 -0400
Michael Fulbright <msf@redhat.com> writes:
> Seeing tigert's really cool gtkrc setup, elliot lee starting playing with
> a simple app to change the gtkrc file and send the XClientMessage to
> all gtk apps to reload their gtkrc file.
>
> This seems to work alright until you start setting background colors.
> The background color request overrides the bg settings for things like
> gmc'c desktop icons, making them completely solid colors :-/ Also,
> parts of the toolbars on GnomeApps dont seem to get the bg color applied.
> Here is the gtkrc that does it:
Handling dynamically changed styles is done pretty much on a
widget-by-widget basis in response to the "style_set" signal.
There is a default handler:
static void
gtk_widget_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
if (GTK_WIDGET_REALIZED (widget) &&
!GTK_WIDGET_NO_WINDOW (widget))
{
gtk_style_set_background (widget->style, widget->window, widget->state);
if (GTK_WIDGET_DRAWABLE (widget))
gdk_window_clear (widget->window);
}
}
This works for simple widgets. But more complicated widgets tend
to need a "style_set" handler.
I suspect the toolbar problems come about because the handlebox
doesn't have the style_set handler it needs. (It needs to set the
background for the two other windows of the handlebox.)
I haven't tested it yet. But here's a quick change to gtkhandlebox
that should fix that problem up. The icon problem probably
requires a similar change to GnomePixmap.
Regards,
Owen
Index: gtkhandlebox.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gtk/gtkhandlebox.c,v
retrieving revision 1.41
diff -u -r1.41 gtkhandlebox.c
--- gtkhandlebox.c 1998/04/13 02:00:15 1.41
+++ gtkhandlebox.c 1998/05/20 17:24:28
@@ -49,6 +49,8 @@
static void gtk_handle_box_unmap (GtkWidget *widget);
static void gtk_handle_box_realize (GtkWidget *widget);
static void gtk_handle_box_unrealize (GtkWidget *widget);
+static void gtk_handle_box_style_set (GtkWidget *widget,
+ GtkStyle *previous_style);
static void gtk_handle_box_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_handle_box_size_allocate (GtkWidget *widget,
@@ -151,6 +153,7 @@
widget_class->unmap = gtk_handle_box_unmap;
widget_class->realize = gtk_handle_box_realize;
widget_class->unrealize = gtk_handle_box_unrealize;
+ widget_class->style_set = gtk_handle_box_style_set;
widget_class->size_request = gtk_handle_box_size_request;
widget_class->size_allocate = gtk_handle_box_size_allocate;
widget_class->draw = gtk_handle_box_draw;
@@ -347,6 +350,29 @@
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
+}
+
+static void
+gtk_handle_box_style_set (GtkWidget *widget,
+ GtkStyle *previous_style)
+{
+ GtkHandleBox *hb;
+
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_HANDLE_BOX (widget));
+
+ hb = GTK_HANDLE_BOX (widget);
+
+ if (GTK_WIDGET_REALIZED (widget) &&
+ !GTK_WIDGET_NO_WINDOW (widget))
+ {
+ gtk_style_set_background (widget->style, widget->window,
+widget->state);
+ gtk_style_set_background (widget->style, hb->bin_window, widget->state);
+ gtk_style_set_background (widget->style, hb->float_window, widget->state);
+ if (GTK_WIDGET_DRAWABLE (widget))
+ gdk_window_clear (widget->window);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]