[cairo-commit] goocanvas/demo demo-scalability.c, 1.1, 1.2 demo.c, 1.1, 1.2

Damon Chaplin commit at pdx.freedesktop.org
Sun Apr 16 15:29:46 PDT 2006


Committed by: damon

Update of /cvs/cairo/goocanvas/demo
In directory kemper:/tmp/cvs-serv15745/demo

Modified Files:
	demo-scalability.c demo.c 
Log Message:
2006-04-16  Damon Chaplin  <damon at gnome.org>

	* src/goocanvasview.c (propagate_event, emit_pointer_event): ref views
	and check they are still valid.

	* src/*view.[hc]: made views hold reference on items, to ensure we
	never use invalid pointers.



Index: demo-scalability.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo-scalability.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- demo-scalability.c	12 Apr 2006 10:45:52 -0000	1.1
+++ demo-scalability.c	16 Apr 2006 22:29:44 -0000	1.2
@@ -23,7 +23,6 @@
 	GooCanvasModelSimple *canvas_model;
 	GooCanvasItem *root, *item;
 	int i, j, width, height;
-	GtkAdjustment *hadj, *vadj;
 
 	vbox = gtk_vbox_new (FALSE, 4);
 	gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
@@ -71,9 +70,7 @@
 	gtk_widget_show (canvas);
 
 
-	hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 1000, 10, 100, 100));
-	vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 1000, 10, 100, 100));
-	scrolled_win = gtk_scrolled_window_new (hadj, vadj);
+	scrolled_win = gtk_scrolled_window_new (NULL, NULL);
 	gtk_widget_show (scrolled_win);
 	gtk_container_add (GTK_CONTAINER (frame), scrolled_win);
 

Index: demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- demo.c	12 Apr 2006 10:45:52 -0000	1.1
+++ demo.c	16 Apr 2006 22:29:44 -0000	1.2
@@ -193,14 +193,12 @@
     {
       g_object_set (ellipse2,
 		    "center-x", 300.0,
-#if 1
 		    "center-y", 70.0,
 		    "radius-x", 45.0,
 		    "radius-y", 30.0,
 		    "fill-color", "red",
 		    "stroke-color", "midnightblue",
 		    "line-width", 4.0,
-#endif
 		    NULL);
       last_state = 1;
     }
@@ -208,14 +206,12 @@
     {
       g_object_set (ellipse2,
 		    "center-x", 390.0,
-#if 1
 		    "center-y", 150.0,
 		    "radius-x", 45.0,
 		    "radius-y", 40.0,
 		    "fill-color", "wheat",
 		    "stroke-color", "midnightblue",
 		    "line-width", 4.0,
-#endif
 		    NULL);
       last_state = 2;
     }
@@ -223,14 +219,12 @@
     {
       g_object_set (ellipse2,
 		    "center-x", 335.0,
-#if 1
 		    "center-y", 70.0,
 		    "radius-x", 45.0,
 		    "radius-y", 30.0,
 		    "fill-color", "wheat",
 		    "stroke-color", "midnightblue",
 		    "line-width", 4.0,
-#endif
 		    NULL);
       last_state = 0;
     }
@@ -256,10 +250,6 @@
       double new_y = event->y;
 
       goo_canvas_item_translate (item, new_x - drag_x, new_y - drag_y);
-#if 0
-      drag_x = new_x;
-      drag_y = new_y;
-#endif
     }
 
   return TRUE;
@@ -286,9 +276,12 @@
     case 1:
       if (event->state & GDK_SHIFT_MASK)
 	{
-#if 0
-	  gtk_object_destroy (GTK_OBJECT (item));
-#endif
+	  GooCanvasItem *parent;
+	  gint child_num;
+
+	  parent = goo_canvas_item_get_parent (item);
+	  child_num = goo_canvas_item_find_child (parent, item);
+	  goo_canvas_item_remove_child (parent, child_num);
 	}
       else
 	{
@@ -386,7 +379,7 @@
 	GtkWidget *hbox;
 	GtkWidget *w;
 	GtkWidget *scrolled_win, *canvas_view;
-	GtkAdjustment *hadj, *vadj, *adj;
+	GtkAdjustment *adj;
 	GSList *group = NULL;
 	GdkColor bg_color = { 0, 50000, 50000, 65535 };
 
@@ -589,9 +582,7 @@
 	
 	/* Layout the stuff */
 
-	hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 1000, 10, 100, 100));
-	vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 1000, 10, 100, 100));
-	scrolled_win = gtk_scrolled_window_new (hadj, vadj);
+	scrolled_win = gtk_scrolled_window_new (NULL, NULL);
 	gtk_widget_show (scrolled_win);
 	gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
 



More information about the cairo-commit mailing list