Patch to fix gtk_clist_swap_rows
- From: Brandon Long <blong fiction net>
- To: gtk-list redhat com
- Subject: Patch to fix gtk_clist_swap_rows
- Date: Tue, 17 Nov 1998 23:59:46 -0800
This patch fixes a couple bugs in gtk_clist_swap_rows() and should apply
against the latest CVS version.
Basically:
1) link1 is independent of the order of the arguments, link2 is, so the
swap would only work if you swapped x,y where x < y
2) if x (row1) is selected, then the selected one will be switched to
row2 and right back to row1
3) the screen would only be updated correctly if one of them was
selected if y < x
The fix for the draw code works for the application I'm working on, but
someone who understands the clist code should probably verify it. The
other two fixes I'm almost positive are correct.
Brandon
--
Brandon Long "The meek shall inherit the earth; now let's
MD6 Crash Test Dummy check out who gets heaven."
Intel Corporation -- J. Neil Shulman
I'm too low on the totem pole to speak for Intel.
http://www.fiction.net/blong/
Index: gtkclist.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkclist.c,v
retrieving revision 1.109
diff -u -r1.109 gtkclist.c
--- gtkclist.c 1998/11/11 20:46:47 1.109
+++ gtkclist.c 1998/11/18 07:52:56
@@ -2802,7 +2802,7 @@
last = MAX (row1, row2);
link1 = g_list_nth (clist->row_list, first);
- link2 = g_list_nth (link1, row2 - row1);
+ link2 = g_list_nth (link1, last - first);
swap = link1->data;
link1->data = link2->data;
@@ -2813,8 +2813,7 @@
{
if (GPOINTER_TO_INT (list->data) == row1)
list->data = GINT_TO_POINTER (row2);
-
- if (GPOINTER_TO_INT (list->data) == row2)
+ else if (GPOINTER_TO_INT (list->data) == row2)
list->data = GINT_TO_POINTER (row1);
list = list->next;
@@ -2822,13 +2821,13 @@
if (!GTK_CLIST_FROZEN (clist))
{
- if (gtk_clist_row_is_visible (clist, row1) != GTK_VISIBILITY_NONE)
+ if (gtk_clist_row_is_visible (clist, last) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row
- (clist, NULL, row1, GTK_CLIST_ROW (link2));
+ (clist, NULL, last, GTK_CLIST_ROW (link2));
- if (gtk_clist_row_is_visible (clist, row2) != GTK_VISIBILITY_NONE)
+ if (gtk_clist_row_is_visible (clist, first) != GTK_VISIBILITY_NONE)
GTK_CLIST_CLASS_FW (clist)->draw_row
- (clist, NULL, row2, GTK_CLIST_ROW (link1));
+ (clist, NULL, first, GTK_CLIST_ROW (link1));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]