From f970ecf821a6d5c135be68ce529aa4f7ed009fa1 Mon Sep 17 00:00:00 2001 From: Lars Hamann Date: Fri, 24 Jul 1998 16:22:53 +0000 Subject: [PATCH] mini code cleanup * gtk/gtkclist.c (toggle_focus_row): mini code cleanup --- ChangeLog | 4 ++++ ChangeLog.pre-2-0 | 4 ++++ ChangeLog.pre-2-10 | 4 ++++ ChangeLog.pre-2-2 | 4 ++++ ChangeLog.pre-2-4 | 4 ++++ ChangeLog.pre-2-6 | 4 ++++ ChangeLog.pre-2-8 | 4 ++++ gtk/gtkclist.c | 26 ++++++++++---------------- 8 files changed, 38 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36ac5e0570..d58621d549 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Jul 24 18:15:49 1998 Lars Hamann + + * gtk/gtkclist.c (toggle_focus_row): mini code cleanup + Fri, 24 Jul 1998 10:56:22 +0200 Paolo Molaro * gtk/gtkfeatures.h.in: added GTK_HAVE_ENUM_VALUE_STRUCT. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 36ac5e0570..d58621d549 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,7 @@ +Fri Jul 24 18:15:49 1998 Lars Hamann + + * gtk/gtkclist.c (toggle_focus_row): mini code cleanup + Fri, 24 Jul 1998 10:56:22 +0200 Paolo Molaro * gtk/gtkfeatures.h.in: added GTK_HAVE_ENUM_VALUE_STRUCT. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 36ac5e0570..d58621d549 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,7 @@ +Fri Jul 24 18:15:49 1998 Lars Hamann + + * gtk/gtkclist.c (toggle_focus_row): mini code cleanup + Fri, 24 Jul 1998 10:56:22 +0200 Paolo Molaro * gtk/gtkfeatures.h.in: added GTK_HAVE_ENUM_VALUE_STRUCT. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 36ac5e0570..d58621d549 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,7 @@ +Fri Jul 24 18:15:49 1998 Lars Hamann + + * gtk/gtkclist.c (toggle_focus_row): mini code cleanup + Fri, 24 Jul 1998 10:56:22 +0200 Paolo Molaro * gtk/gtkfeatures.h.in: added GTK_HAVE_ENUM_VALUE_STRUCT. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 36ac5e0570..d58621d549 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,7 @@ +Fri Jul 24 18:15:49 1998 Lars Hamann + + * gtk/gtkclist.c (toggle_focus_row): mini code cleanup + Fri, 24 Jul 1998 10:56:22 +0200 Paolo Molaro * gtk/gtkfeatures.h.in: added GTK_HAVE_ENUM_VALUE_STRUCT. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 36ac5e0570..d58621d549 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,7 @@ +Fri Jul 24 18:15:49 1998 Lars Hamann + + * gtk/gtkclist.c (toggle_focus_row): mini code cleanup + Fri, 24 Jul 1998 10:56:22 +0200 Paolo Molaro * gtk/gtkfeatures.h.in: added GTK_HAVE_ENUM_VALUE_STRUCT. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 36ac5e0570..d58621d549 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,7 @@ +Fri Jul 24 18:15:49 1998 Lars Hamann + + * gtk/gtkclist.c (toggle_focus_row): mini code cleanup + Fri, 24 Jul 1998 10:56:22 +0200 Paolo Molaro * gtk/gtkfeatures.h.in: added GTK_HAVE_ENUM_VALUE_STRUCT. diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index ae07979e8b..59dba75be6 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -4966,7 +4966,8 @@ toggle_focus_row (GtkCList *clist) g_return_if_fail (clist != 0); g_return_if_fail (GTK_IS_CLIST (clist)); - if (gdk_pointer_is_grabbed ()) + if (gdk_pointer_is_grabbed () || + clist->focus_row < 0 || clist->focus_row >= clist->rows) return; switch (clist->selection_mode) @@ -4983,23 +4984,16 @@ toggle_focus_row (GtkCList *clist) clist->undo_selection = NULL; clist->undo_unselection = NULL; + clist->anchor = clist->focus_row; + clist->drag_pos = clist->focus_row; + clist->undo_anchor = clist->focus_row; + if (GTK_CLIST_ADD_MODE (clist)) - { - clist->anchor = clist->focus_row; - clist->drag_pos = clist->focus_row; - clist->undo_anchor = clist->focus_row; - fake_toggle_row (clist, clist->focus_row); - GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); - } + fake_toggle_row (clist, clist->focus_row); else - { - clist->anchor = clist->focus_row; - clist->drag_pos = clist->focus_row; - clist->undo_anchor = clist->focus_row; - GTK_CLIST_CLASS_FW (clist)->fake_unselect_all (clist, - clist->focus_row); - GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); - } + GTK_CLIST_CLASS_FW (clist)->fake_unselect_all (clist,clist->focus_row); + + GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); break; default: