Commit b50a9f76 authored by Elliot Lee's avatar Elliot Lee

Misc fixes for color changing stuff

parent ebdcd27f
......@@ -2488,9 +2488,13 @@ gdk_event_translate (GdkEvent *event,
event->client.data_format = xevent->xclient.format;
memcpy(&event->client.data, &xevent->xclient.data,
sizeof(event->client.data));
return_val = TRUE;
if(window)
return_val = TRUE;
else
return_val = FALSE;
}
return_val = return_val && !window_private->destroyed;
if(window_private)
return_val = return_val && !window_private->destroyed;
break;
case MappingNotify:
......@@ -3385,12 +3389,13 @@ getchildren (Display *dpy,
&after, &data);
if (type != 0)
inf = children[i];
XFree(data);
}
for (i = 0; !inf && (i < nchildren); i++)
inf = getchildren (dpy, children[i], WM_STATE);
if (children != 0)
if (children != None)
XFree ((char *) children);
return inf;
......
......@@ -2488,9 +2488,13 @@ gdk_event_translate (GdkEvent *event,
event->client.data_format = xevent->xclient.format;
memcpy(&event->client.data, &xevent->xclient.data,
sizeof(event->client.data));
return_val = TRUE;
if(window)
return_val = TRUE;
else
return_val = FALSE;
}
return_val = return_val && !window_private->destroyed;
if(window_private)
return_val = return_val && !window_private->destroyed;
break;
case MappingNotify:
......@@ -3385,12 +3389,13 @@ getchildren (Display *dpy,
&after, &data);
if (type != 0)
inf = children[i];
XFree(data);
}
for (i = 0; !inf && (i < nchildren); i++)
inf = getchildren (dpy, children[i], WM_STATE);
if (children != 0)
if (children != None)
XFree ((char *) children);
return inf;
......
......@@ -18,6 +18,7 @@
#include <math.h>
#include "gtkgc.h"
#include "gtkstyle.h"
#include "gtkwidget.h"
#define LIGHTNESS_MULT 1.3
......@@ -296,9 +297,8 @@ gtk_style_detach (GtkStyle *style)
style->depth = -1;
style->colormap = NULL;
gtk_style_remove (style);
}
gtk_style_remove (style);
}
GtkStyle*
......@@ -600,7 +600,6 @@ gtk_style_remove (GtkStyle *style)
{
if (initialize)
gtk_styles_init ();
g_cache_remove (style_cache, style);
}
......
......@@ -75,6 +75,7 @@ enum {
DROP_LEAVE_EVENT,
DROP_DATA_AVAILABLE_EVENT,
OTHER_EVENT,
CLIENT_EVENT,
LAST_SIGNAL
};
......@@ -577,7 +578,15 @@ gtk_widget_class_init (GtkWidgetClass *klass)
gtk_widget_marshal_signal_4,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[CLIENT_EVENT] =
gtk_signal_new ("client_event",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, client_event),
gtk_widget_marshal_signal_4,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
gtk_object_class_add_signals (object_class, widget_signals, LAST_SIGNAL);
object_class->destroy = gtk_real_widget_destroy;
......@@ -1499,6 +1508,9 @@ gtk_widget_event (GtkWidget *widget,
case GDK_OTHER_EVENT:
signal_num = OTHER_EVENT;
break;
case GDK_CLIENT_EVENT:
signal_num = CLIENT_EVENT;
break;
default:
g_warning ("could not determine signal number for event: %d", event->type);
return return_val;
......@@ -2482,14 +2494,15 @@ gtk_widget_propagate_default_style (void)
int i;
/* Set the property on the root window */
gdk_property_change (GDK_ROOT_PARENT(),
gdk_atom_intern("_GTK_DEFAULT_COLORS", FALSE),
GDK_NONE, 8*sizeof(gushort),
GDK_PROP_MODE_REPLACE,
(guchar *)gtk_widget_get_default_style(),
GTK_STYLE_NUM_STYLECOLORS() * sizeof(GdkColor));
for (i = 0; i < 5; i++)
gdk_property_change(GDK_ROOT_PARENT(),
gdk_atom_intern("_GTK_DEFAULT_COLORS", FALSE),
gdk_atom_intern("STRING", FALSE),
8*sizeof(gushort),
GDK_PROP_MODE_REPLACE,
(guchar *)gtk_widget_get_default_style(),
GTK_STYLE_NUM_STYLECOLORS() * sizeof(GdkColor));
for(i = 0; i < 5; i++)
sev.data.l[i] = 0;
sev.data_format = 32;
sev.message_type = gdk_atom_intern ("_GTK_STYLE_CHANGED", FALSE);
......@@ -2840,9 +2853,9 @@ gtk_real_widget_unrealize (GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED | GTK_MAPPED);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED | GTK_MAPPED | GTK_VISIBLE);
gtk_style_detach (widget->style);
if (!GTK_WIDGET_NO_WINDOW (widget))
{
......
......@@ -841,16 +841,20 @@ gtk_window_style_set_event (GtkWidget *widget,
if(gdk_property_get (GDK_ROOT_PARENT(),
atom_default_colors,
GDK_NONE,
gdk_atom_intern("STRING", FALSE),
0,
sizeof(GdkColor) * GTK_STYLE_NUM_STYLECOLORS(),
FALSE,
&realtype,
&retfmt,
&retlen,
(guchar **)&data) != TRUE
|| retfmt != sizeof(gushort)) {
g_warning("gdk_property_get() failed in _GTK_STYLE_CHANGED\n");
(guchar **)&data) != TRUE) {
g_warning("gdk_property_get() failed in _GTK_STYLE_CHANGED handler\n");
return;
}
if(retfmt != sizeof(gushort)*8) {
g_warning("retfmt (%d) != sizeof(gushort)*8 (%d)\n", retfmt,
sizeof(gushort)*8);
return;
}
/* We have the color data, now let's interpret it */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment