[PATCH] Make rubberbanding work with scrollwheel



Hi, see http://bugs.gnome.org/377124 .Patch attached.
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.406
diff -p -u -r1.406 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c	12 Dec 2005 16:59:10 -0000	1.406
+++ libnautilus-private/nautilus-icon-container.c	6 Aug 2006 17:21:16 -0000
@@ -60,6 +60,9 @@
 /* Interval for updating the rubberband selection, in milliseconds.  */
 #define RUBBERBAND_TIMEOUT_INTERVAL 10
 
+/* Interval for querying if scroll bar has changed, in milliseconds */
+#define RUBBERBAND_SCROLL_INTERVAL 350
+
 /* Initial unpositioned icon value */
 #define ICON_UNPOSITIONED_VALUE -1
 
@@ -1962,6 +1965,11 @@ rubberband_timeout_callback (gpointer da
 	double x1, y1, x2, y2;
 	double world_x, world_y;
 	int x_scroll, y_scroll;
+	static int last_adj_y;
+	static int acum;
+	int adj_y;
+	gboolean adj_changed;
+	
 	ArtDRect selection_rect;
 
 	widget = GTK_WIDGET (data);
@@ -1972,6 +1980,17 @@ 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;
+	acum++;
+	if (acum * RUBBERBAND_TIMEOUT_INTERVAL >= RUBBERBAND_SCROLL_INTERVAL) {
+		adj_y = gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container)));
+		if (adj_y != last_adj_y) {
+			last_adj_y = adj_y;
+			adj_changed = TRUE;
+		}
+		acum = 0;
+	}
+
 	gtk_widget_get_pointer (widget, &x, &y);
 
 	if (x < 0) {
@@ -1995,7 +2014,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;
 	}
 
@@ -2129,7 +2148,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);
 }
 


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