goocanvas r25 - in trunk: . src



Author: damon
Date: Mon Nov  3 13:32:04 2008
New Revision: 25
URL: http://svn.gnome.org/viewvc/goocanvas?rev=25&view=rev

Log:

2008-11-03  Damon Chaplin  <damon gnome org>

	    * src/goocanvas.c (goo_canvas_scroll_to_item): just return if the
	    item is static, as we can't scroll to a static item.
	    (emit_pointer_event): convert the pointer position to static item space
	    for static items.

	    * src/goocanvasatk.c (goo_canvas_item_accessible_get_item_extents): 
	    handle static items - don't need to convert to pixels within the
	    window as they are already like that.



Modified:
   trunk/ChangeLog
   trunk/src/goocanvas.c
   trunk/src/goocanvasatk.c

Modified: trunk/src/goocanvas.c
==============================================================================
--- trunk/src/goocanvas.c	(original)
+++ trunk/src/goocanvas.c	Mon Nov  3 13:32:04 2008
@@ -2142,6 +2142,10 @@
   GooCanvasBounds bounds;
   gdouble hvalue, vvalue;
 
+  /* We can't scroll to static items. */
+  if (goo_canvas_item_get_is_static (item))
+    return;
+
   goo_canvas_item_get_bounds (item, &bounds);
 
   goo_canvas_convert_to_pixels (canvas, &bounds.x1, &bounds.y1);
@@ -2857,6 +2861,10 @@
   /* Convert to the canvas coordinate space. */
   goo_canvas_convert_from_pixels (canvas, x, y);
 
+  /* Convert to static item space, if necessary. */
+  if (goo_canvas_item_get_is_static (target_item))
+    goo_canvas_convert_to_static_item_space (canvas, x, y);
+
   /* Copy to the x_root & y_root fields. */
   *x_root = *x;
   *y_root = *y;
@@ -3472,8 +3480,8 @@
 }
 
 
-/* Converts from device space to the coordinate space the static items are in, i.e. in pixels
-   from the top-left of the viewport window. */
+/* Converts from the canvas coordinate space to the static item coordinate
+   space, i.e. in pixels from the top-left of the viewport window. */
 static void
 goo_canvas_convert_to_static_item_space (GooCanvas     *canvas,
 					 gdouble       *x,

Modified: trunk/src/goocanvasatk.c
==============================================================================
--- trunk/src/goocanvasatk.c	(original)
+++ trunk/src/goocanvasatk.c	Mon Nov  3 13:32:04 2008
@@ -50,15 +50,19 @@
   /* Get the bounds in device units. */
   goo_canvas_item_get_bounds (item, &bounds);
 
-  /* Convert to pixels within the entire canvas. */
-  goo_canvas_convert_to_pixels (canvas, &bounds.x1, &bounds.y1);
-  goo_canvas_convert_to_pixels (canvas, &bounds.x2, &bounds.y2);
-
-  /* Convert to pixels within the visible window. */
-  bounds.x1 -= canvas->hadjustment->value;
-  bounds.y1 -= canvas->vadjustment->value;
-  bounds.x2 -= canvas->hadjustment->value;
-  bounds.y2 -= canvas->vadjustment->value;
+  /* Static items are in pixels so don't need converting. */
+  if (!goo_canvas_item_get_is_static (item))
+    {
+      /* Convert to pixels within the entire canvas. */
+      goo_canvas_convert_to_pixels (canvas, &bounds.x1, &bounds.y1);
+      goo_canvas_convert_to_pixels (canvas, &bounds.x2, &bounds.y2);
+
+      /* Convert to pixels within the visible window. */
+      bounds.x1 -= canvas->hadjustment->value;
+      bounds.y1 -= canvas->vadjustment->value;
+      bounds.x2 -= canvas->hadjustment->value;
+      bounds.y2 -= canvas->vadjustment->value;
+    }
 
   /* Round up or down to integers. */
   rect->x = floor (bounds.x1);



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