Re: [PATCH] Make rubberbanding work with scrollwheel



Alexander Larsson escribió:
> On Sun, 2006-11-19 at 22:46 +0000, Nelson Benítez wrote:
>> Hi, see http://bugs.gnome.org/377124 .Patch attached.
> 
> Why do you need the RUBBERBAND_SCROLL_INTERVAL timeout?

Well, I tried without it and it works even better!, so I don't remember
why I added it, maybe it was slow in previous versions of nautilus (I
originally made the patch for 2.12)

> Also, you shouldn't put things into static variables like that. Put them
> in NautilusIconRubberbandInfo like all the other rubberbanding data.

Ok, done. I'm attaching a new patch with these things fixed.
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.423
diff -p -u -r1.423 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c	23 Nov 2006 13:56:53 -0000	1.423
+++ libnautilus-private/nautilus-icon-container.c	25 Nov 2006 13:15:20 -0000
@@ -1963,6 +1964,9 @@ rubberband_timeout_callback (gpointer da
 	double x1, y1, x2, y2;
 	double world_x, world_y;
 	int x_scroll, y_scroll;
+	int adj_y;
+	gboolean adj_changed;
+	
 	ArtDRect selection_rect;
 
 	widget = GTK_WIDGET (data);
@@ -1973,6 +1977,13 @@ rubberband_timeout_callback (gpointer da
 	g_assert (EEL_IS_CANVAS_RECT (band_info->selection_rectangle) ||
 		  EEL_IS_CANVAS_RECT (band_info->selection_rectangle));
 
+	adj_changed = FALSE;
+	adj_y = gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container)));
+	if (adj_y != band_info->last_adj_y) {
+		band_info->last_adj_y = adj_y;
+		adj_changed = TRUE;
+	}
+
 	gtk_widget_get_pointer (widget, &x, &y);
 
 	if (x < 0) {
@@ -1996,7 +2007,7 @@ rubberband_timeout_callback (gpointer da
 	}
 
 	if (y_scroll == 0 && x_scroll == 0
-	    && (int) band_info->prev_x == x && (int) band_info->prev_y == y) {
+	    && (int) band_info->prev_x == x && (int) band_info->prev_y == y && !adj_changed) {
 		return TRUE;
 	}
 
@@ -2130,7 +2141,8 @@ start_rubberbanding (NautilusIconContain
 
 	eel_canvas_item_grab (band_info->selection_rectangle,
 				(GDK_POINTER_MOTION_MASK
-				 | GDK_BUTTON_RELEASE_MASK),
+				 | GDK_BUTTON_RELEASE_MASK 
+				 | GDK_SCROLL_MASK),
 				NULL, event->time);
 }
 
Index: libnautilus-private/nautilus-icon-private.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-private.h,v
retrieving revision 1.84
diff -p -u -r1.84 nautilus-icon-private.h
--- libnautilus-private/nautilus-icon-private.h	6 Nov 2006 19:09:59 -0000	1.84
+++ libnautilus-private/nautilus-icon-private.h	25 Nov 2006 13:15:22 -0000
@@ -76,6 +76,7 @@ typedef struct {
 
 	guint prev_x, prev_y;
 	ArtDRect prev_rect;
+	int last_adj_y;
 } NautilusIconRubberbandInfo;
 
 typedef enum {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]