Fix some cases where style functions were not handling widget == NULL

2004-07-09  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkstyle.c: Fix some cases where style functions were
	not handling widget == NULL properly.  (#146282)
This commit is contained in:
Matthias Clasen 2004-07-09 14:40:36 +00:00 committed by Matthias Clasen
parent 0e0a2bc0e6
commit ee63b081c2
5 changed files with 43 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2004-07-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkstyle.c: Fix some cases where style functions were
not handling widget == NULL properly. (#146282)
Thu Jul 8 22:38:58 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtktreeview.c: Improve the EXPANDER_MAX warning.

View File

@ -1,3 +1,8 @@
2004-07-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkstyle.c: Fix some cases where style functions were
not handling widget == NULL properly. (#146282)
Thu Jul 8 22:38:58 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtktreeview.c: Improve the EXPANDER_MAX warning.

View File

@ -1,3 +1,8 @@
2004-07-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkstyle.c: Fix some cases where style functions were
not handling widget == NULL properly. (#146282)
Thu Jul 8 22:38:58 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtktreeview.c: Improve the EXPANDER_MAX warning.

View File

@ -1,3 +1,8 @@
2004-07-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkstyle.c: Fix some cases where style functions were
not handling widget == NULL properly. (#146282)
Thu Jul 8 22:38:58 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtktreeview.c: Improve the EXPANDER_MAX warning.

View File

@ -2562,6 +2562,20 @@ draw_menu_shadow (GtkStyle *style,
x + 1, y + 1, x + 1, y + height - 3);
}
static GtkTextDirection
get_direction (GtkWidget *widget)
{
GtkTextDirection dir;
if (widget)
dir = gtk_widget_get_direction (widget);
else
dir = GTK_TEXT_DIR_LTR;
return dir;
}
static void
gtk_default_draw_shadow (GtkStyle *style,
GdkWindow *window,
@ -2604,8 +2618,8 @@ gtk_default_draw_shadow (GtkStyle *style,
if (widget && GTK_IS_SPIN_BUTTON (widget) &&
detail && strcmp (detail, "spinbutton") == 0)
{
draw_spinbutton_shadow (style, window, state_type,
gtk_widget_get_direction (widget), area, x, y, width, height);
draw_spinbutton_shadow (style, window, state_type,
get_direction (widget), area, x, y, width, height);
return;
}
@ -2842,7 +2856,7 @@ gtk_default_draw_shadow (GtkStyle *style,
widget && GTK_IS_SPIN_BUTTON (widget) &&
detail && strcmp (detail, "entry") == 0)
{
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
if (get_direction (widget) == GTK_TEXT_DIR_LTR)
{
gdk_draw_line (window,
style->base_gc[state_type],
@ -3409,7 +3423,7 @@ gtk_default_draw_box (GtkStyle *style,
width -= 3;
height -= 2;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
if (get_direction (widget) == GTK_TEXT_DIR_RTL)
x += 2;
else
x += 1;
@ -3421,7 +3435,7 @@ gtk_default_draw_box (GtkStyle *style,
width -= 3;
height -= 2;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
if (get_direction (widget) == GTK_TEXT_DIR_RTL)
x += 2;
else
x += 1;
@ -3495,7 +3509,7 @@ gtk_default_draw_box (GtkStyle *style,
sanitize_size (window, &width, &height);
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
if (get_direction (widget) == GTK_TEXT_DIR_RTL)
vline_x = x + indicator_size.width + indicator_spacing.left + indicator_spacing.right;
else
vline_x = x + width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - style->xthickness;
@ -5009,13 +5023,13 @@ gtk_default_draw_expander (GtkStyle *style,
switch (expander_style)
{
case GTK_EXPANDER_COLLAPSED:
degrees = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? 180 : 0;
degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 180 : 0;
break;
case GTK_EXPANDER_SEMI_COLLAPSED:
degrees = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? 150 : 30;
degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 150 : 30;
break;
case GTK_EXPANDER_SEMI_EXPANDED:
degrees = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? 120 : 60;
degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 120 : 60;
break;
case GTK_EXPANDER_EXPANDED:
degrees = 90;