Re: offset bug for background and emblems



Am Dienstag, den 26.07.2005, 10:27 +0200 schrieb Luca Ferretti:
> Il giorno dom, 24/07/2005 alle 12.10 +0200, Sven J. ha scritto:
> > Am Sonntag, den 24.07.2005, 00:36 +0200 schrieb David Christian Berg:
> > > There is a offset between the spot where the colour, pattern or emblem
> > > is displayed, and the area, where it actually is. When you try drag and
> > > drop or clicking on any of the items further down the list, you'll only
> > > fail in doing so until you supposedly select an item further up.
> > 
> > its bug #308996, http://bugzilla.gnome.org/show_bug.cgi?id=308996
> > 
> > i can confirm this here on nautilus 2.10.1
> 
> I can confirm on HEAD too. :-(

Proposed patch attached. Messing around with scroll offsets is no good
for widgets inside GtkViewports.

-- 
Christian Neumair <chris gnome-de org>
Index: eel/eel-wrap-table.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-wrap-table.c,v
retrieving revision 1.22
diff -u -p -r1.22 eel-wrap-table.c
--- eel/eel-wrap-table.c	13 Jul 2005 09:47:52 -0000	1.22
+++ eel/eel-wrap-table.c	26 Jul 2005 11:47:22 -0000
@@ -100,10 +100,6 @@ static EelDimensions wrap_table_art_irec
 static EelDimensions wrap_table_get_max_child_dimensions (const EelWrapTable  *wrap_table);
 static EelDimensions wrap_table_get_content_dimensions   (const EelWrapTable  *wrap_table);
 static ArtIRect      wrap_table_get_content_bounds       (const EelWrapTable  *wrap_table);
-static EelArtIPoint  wrap_table_get_scroll_offset        (const EelWrapTable  *wrap_table);
-static GtkWidget *   wrap_table_find_child_at_point      (const EelWrapTable  *wrap_table,
-							  int                  x,
-							  int                  y);
 static gboolean      wrap_table_child_focus_in           (GtkWidget           *widget,
 							  GdkEventFocus       *event,
 							  gpointer             data);
@@ -714,30 +710,6 @@ wrap_table_get_content_bounds (const Eel
 	return content_bounds;
 }
 
-static EelArtIPoint
-wrap_table_get_scroll_offset (const EelWrapTable *wrap_table)
-{
-	EelArtIPoint scroll_offset;
-	GtkWidget *parent;
-
-  	g_return_val_if_fail (EEL_IS_WRAP_TABLE (wrap_table), eel_art_ipoint_zero);
-
-	scroll_offset = eel_art_ipoint_zero;
-
-	parent = GTK_WIDGET (wrap_table)->parent;
-
-	/* FIXME: It lame we have to hardcode for a possible viewport 
-	 * parent here.  Theres probably a better way to do this
-	 */
-	if (GTK_IS_VIEWPORT (parent)) {
-		gdk_window_get_position (GTK_VIEWPORT (parent)->bin_window,
-					 &scroll_offset.x,
-					 &scroll_offset.y);
-	}
-
-	return scroll_offset;
-}
-
 static gboolean
 wrap_table_child_focus_in (GtkWidget *widget, 
 			   GdkEventFocus *event, 
@@ -752,34 +724,6 @@ wrap_table_child_focus_in (GtkWidget *wi
 	return FALSE;
 }
 
-static GtkWidget *
-wrap_table_find_child_at_point (const EelWrapTable *wrap_table,
-			       int x,
-			       int y)
-{
-	GList *iterator;
-	
-  	g_return_val_if_fail (EEL_IS_WRAP_TABLE (wrap_table), NULL);
-
-	for (iterator = wrap_table->details->children; iterator; iterator = iterator->next) {
-		GtkWidget *child;
-		
-		child = iterator->data;
-		
-		if (GTK_WIDGET_VISIBLE (child)) {
-			ArtIRect child_bounds;
-
-			child_bounds = eel_gtk_widget_get_bounds (child);
- 			
-			if (eel_art_irect_contains_point (child_bounds, x, y)) {
-				return child;
-			}
-		}
-	}
-
-	return NULL;
-}
-
 /**
  * eel_wrap_table_new:
  *
@@ -876,18 +821,30 @@ eel_wrap_table_get_y_spacing (const EelW
  */
 GtkWidget *
 eel_wrap_table_find_child_at_event_point (const EelWrapTable *wrap_table,
-					       int x,
-					       int y)
+					  int x,
+					  int y)
 {
-	EelArtIPoint scroll_offset;
+	GList *iterator;
+	
+  	g_return_val_if_fail (EEL_IS_WRAP_TABLE (wrap_table), NULL);
 
-	g_return_val_if_fail (EEL_IS_WRAP_TABLE (wrap_table), NULL);
+	for (iterator = wrap_table->details->children; iterator; iterator = iterator->next) {
+		GtkWidget *child;
+		
+		child = iterator->data;
+		
+		if (GTK_WIDGET_VISIBLE (child)) {
+			ArtIRect child_bounds;
 
-	scroll_offset = wrap_table_get_scroll_offset (wrap_table);
-	
-	return wrap_table_find_child_at_point (wrap_table,
-					      x + ABS (scroll_offset.x),
-					      y + ABS (scroll_offset.y));
+			child_bounds = eel_gtk_widget_get_bounds (child);
+ 			
+			if (eel_art_irect_contains_point (child_bounds, x, y)) {
+				return child;
+			}
+		}
+	}
+
+	return NULL;
 }
 
 /**

Attachment: signature.asc
Description: This is a digitally signed message part



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