From 9c6dc3d52d87d1c0c53aa2dc99f7e3b8f9436a28 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Fri, 25 Jan 2002 13:22:00 +0000 Subject: [PATCH] assert that the passed in arrow is always _UP or _DOWN, this catches false Fri Jan 25 14:03:36 2002 Tim Janik * gtk/gtkspinbutton.c (gtk_spin_button_draw_arrow): assert that the passed in arrow is always _UP or _DOWN, this catches false invocations which lead to drawing artefacts. (start_spinning): likewise, i.e. sanity check the passed in arrow. (gtk_spin_button_button_release): fix arrow redrawing. (gtk_spin_button_button_press): must set click_child for button3 even if we don't take spinning action right away. * gtk/gtkspinbutton.h (struct _GtkSpinButton): document valid values for click_child. --- ChangeLog | 13 +++++++++++++ ChangeLog.pre-2-0 | 13 +++++++++++++ ChangeLog.pre-2-10 | 13 +++++++++++++ ChangeLog.pre-2-2 | 13 +++++++++++++ ChangeLog.pre-2-4 | 13 +++++++++++++ ChangeLog.pre-2-6 | 13 +++++++++++++ ChangeLog.pre-2-8 | 13 +++++++++++++ gtk/gtkspinbutton.c | 8 ++++++++ gtk/gtkspinbutton.h | 2 +- 9 files changed, 100 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b900d83a9..e141c48f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Fri Jan 25 14:03:36 2002 Tim Janik + + * gtk/gtkspinbutton.c (gtk_spin_button_draw_arrow): assert + that the passed in arrow is always _UP or _DOWN, this catches + false invocations which lead to drawing artefacts. + (start_spinning): likewise, i.e. sanity check the passed in arrow. + (gtk_spin_button_button_release): fix arrow redrawing. + (gtk_spin_button_button_press): must set click_child for + button3 even if we don't take spinning action right away. + + * gtk/gtkspinbutton.h (struct _GtkSpinButton): document + valid values for click_child. + Thu Jan 24 23:03:24 2002 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_get_path_at_pos): update docs, diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index b900d83a9..e141c48f1 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,16 @@ +Fri Jan 25 14:03:36 2002 Tim Janik + + * gtk/gtkspinbutton.c (gtk_spin_button_draw_arrow): assert + that the passed in arrow is always _UP or _DOWN, this catches + false invocations which lead to drawing artefacts. + (start_spinning): likewise, i.e. sanity check the passed in arrow. + (gtk_spin_button_button_release): fix arrow redrawing. + (gtk_spin_button_button_press): must set click_child for + button3 even if we don't take spinning action right away. + + * gtk/gtkspinbutton.h (struct _GtkSpinButton): document + valid values for click_child. + Thu Jan 24 23:03:24 2002 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_get_path_at_pos): update docs, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b900d83a9..e141c48f1 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +Fri Jan 25 14:03:36 2002 Tim Janik + + * gtk/gtkspinbutton.c (gtk_spin_button_draw_arrow): assert + that the passed in arrow is always _UP or _DOWN, this catches + false invocations which lead to drawing artefacts. + (start_spinning): likewise, i.e. sanity check the passed in arrow. + (gtk_spin_button_button_release): fix arrow redrawing. + (gtk_spin_button_button_press): must set click_child for + button3 even if we don't take spinning action right away. + + * gtk/gtkspinbutton.h (struct _GtkSpinButton): document + valid values for click_child. + Thu Jan 24 23:03:24 2002 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_get_path_at_pos): update docs, diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b900d83a9..e141c48f1 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,16 @@ +Fri Jan 25 14:03:36 2002 Tim Janik + + * gtk/gtkspinbutton.c (gtk_spin_button_draw_arrow): assert + that the passed in arrow is always _UP or _DOWN, this catches + false invocations which lead to drawing artefacts. + (start_spinning): likewise, i.e. sanity check the passed in arrow. + (gtk_spin_button_button_release): fix arrow redrawing. + (gtk_spin_button_button_press): must set click_child for + button3 even if we don't take spinning action right away. + + * gtk/gtkspinbutton.h (struct _GtkSpinButton): document + valid values for click_child. + Thu Jan 24 23:03:24 2002 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_get_path_at_pos): update docs, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b900d83a9..e141c48f1 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,16 @@ +Fri Jan 25 14:03:36 2002 Tim Janik + + * gtk/gtkspinbutton.c (gtk_spin_button_draw_arrow): assert + that the passed in arrow is always _UP or _DOWN, this catches + false invocations which lead to drawing artefacts. + (start_spinning): likewise, i.e. sanity check the passed in arrow. + (gtk_spin_button_button_release): fix arrow redrawing. + (gtk_spin_button_button_press): must set click_child for + button3 even if we don't take spinning action right away. + + * gtk/gtkspinbutton.h (struct _GtkSpinButton): document + valid values for click_child. + Thu Jan 24 23:03:24 2002 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_get_path_at_pos): update docs, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b900d83a9..e141c48f1 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,16 @@ +Fri Jan 25 14:03:36 2002 Tim Janik + + * gtk/gtkspinbutton.c (gtk_spin_button_draw_arrow): assert + that the passed in arrow is always _UP or _DOWN, this catches + false invocations which lead to drawing artefacts. + (start_spinning): likewise, i.e. sanity check the passed in arrow. + (gtk_spin_button_button_release): fix arrow redrawing. + (gtk_spin_button_button_press): must set click_child for + button3 even if we don't take spinning action right away. + + * gtk/gtkspinbutton.h (struct _GtkSpinButton): document + valid values for click_child. + Thu Jan 24 23:03:24 2002 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_get_path_at_pos): update docs, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b900d83a9..e141c48f1 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +Fri Jan 25 14:03:36 2002 Tim Janik + + * gtk/gtkspinbutton.c (gtk_spin_button_draw_arrow): assert + that the passed in arrow is always _UP or _DOWN, this catches + false invocations which lead to drawing artefacts. + (start_spinning): likewise, i.e. sanity check the passed in arrow. + (gtk_spin_button_button_release): fix arrow redrawing. + (gtk_spin_button_button_press): must set click_child for + button3 even if we don't take spinning action right away. + + * gtk/gtkspinbutton.h (struct _GtkSpinButton): document + valid values for click_child. + Thu Jan 24 23:03:24 2002 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_get_path_at_pos): update docs, diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 12b3ac22b..f1909a89a 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -757,6 +757,7 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button, gint arrow_size; g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button)); + g_return_if_fail (arrow == GTK_ARROW_UP || arrow == GTK_ARROW_DOWN); widget = GTK_WIDGET (spin_button); spin_shadow_type = spin_button_get_shadow_type (spin_button); @@ -974,6 +975,8 @@ start_spinning (GtkSpinButton *spin, GtkArrowType click_child, gfloat step) { + g_return_if_fail (click_child == GTK_ARROW_UP || click_child == GTK_ARROW_DOWN); + spin->click_child = click_child; gtk_spin_button_real_spin (spin, click_child == GTK_ARROW_UP ? step : -step); @@ -1016,6 +1019,8 @@ gtk_spin_button_button_press (GtkWidget *widget, start_spinning (spin, GTK_ARROW_UP, spin->adjustment->step_increment); else if (event->button == 2) start_spinning (spin, GTK_ARROW_UP, spin->adjustment->page_increment); + else + spin->click_child = GTK_ARROW_UP; } else { @@ -1023,6 +1028,8 @@ gtk_spin_button_button_press (GtkWidget *widget, start_spinning (spin, GTK_ARROW_DOWN, spin->adjustment->step_increment); else if (event->button == 2) start_spinning (spin, GTK_ARROW_DOWN, spin->adjustment->page_increment); + else + spin->click_child = GTK_ARROW_DOWN; } return TRUE; } @@ -1080,6 +1087,7 @@ gtk_spin_button_button_release (GtkWidget *widget, click_child = spin->click_child; spin->click_child = 2; gtk_spin_button_draw_arrow (spin, click_child); + return TRUE; } else diff --git a/gtk/gtkspinbutton.h b/gtk/gtkspinbutton.h index d22c9c3bb..04610cb45 100644 --- a/gtk/gtkspinbutton.h +++ b/gtk/gtkspinbutton.h @@ -89,7 +89,7 @@ struct _GtkSpinButton GtkSpinButtonUpdatePolicy update_policy; guint in_child : 2; - guint click_child : 2; + guint click_child : 2; /* valid: GTK_ARROW_UP=0, GTK_ARROW_DOWN=1 or 2=NONE/BOTH */ guint button : 2; guint need_timer : 1; guint timer_calls : 3; -- 2.43.2