Re: GnomeCanvas fixage



le lun 03-12-2001 à 23:22, Anders Carlsson a écrit :
> Hello,
> 
> I'm going to apply the attached patch to CVS now. It reverts some
> unimplemented and broken features from gnome-canvas-item which messed up
> event handling badly.
> 
> This changes the size of the GnomeCanvasItem class so all programs and

Why have you choosen to put 4 spare vtable entries ? why not 2 ? zero ?

Mathieu

> libraries using custom canvas items will have to be recompiled.
> 
> //andersca
> andersca gnu org
> 
> 
> ----
> 

> ? libgnomecanvas-1.107.0.tar.gz
> Index: libgnomecanvas/ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/libgnomecanvas/libgnomecanvas/ChangeLog,v
> retrieving revision 1.97
> diff -u -r1.97 ChangeLog
> --- libgnomecanvas/ChangeLog	2001/12/02 22:54:29	1.97
> +++ libgnomecanvas/ChangeLog	2001/12/03 22:19:38
> @@ -1,5 +1,11 @@
>  2001-12-02  Anders Carlsson  <andersca gnu org>
>  
> +	* gnome-canvas.h: Remove unused signals from vtable and
> +	add some padding.
> +
> +	* gnome-canvas.c (gnome_canvas_item_class_init): Remove signals.
> +	(emit_event): Don't emit any other signals than "event".
> +
>  	* gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_draw): Use 
>  	GDK_PIXBUF_ALPHA_FULL when rendering the pixbuf.
>  
> Index: libgnomecanvas/gnome-canvas.c
> ===================================================================
> RCS file: /cvs/gnome/libgnomecanvas/libgnomecanvas/gnome-canvas.c,v
> retrieving revision 1.138
> diff -u -r1.138 gnome-canvas.c
> --- libgnomecanvas/gnome-canvas.c	2001/11/20 04:22:31	1.138
> +++ libgnomecanvas/gnome-canvas.c	2001/12/03 22:19:39
> @@ -204,68 +204,6 @@
>  				gnome_canvas_marshal_BOOLEAN__BOXED,
>  				GTK_TYPE_BOOL, 1,
>  				GDK_TYPE_EVENT);
> -        item_signals[ITEM_BUTTON_PRESS_EVENT] =
> -                gtk_signal_new ("button_press_event",
> -                                GTK_RUN_LAST,
> -                                GTK_CLASS_TYPE (object_class),
> -                                GTK_SIGNAL_OFFSET (GnomeCanvasItemClass, button_press_event),
> -                                gnome_canvas_marshal_BOOLEAN__BOXED,
> -                                GTK_TYPE_BOOL, 1,
> -                                GDK_TYPE_EVENT);
> -
> -        item_signals[ITEM_BUTTON_RELEASE_EVENT] =
> -                gtk_signal_new ("button_release_event",
> -                                GTK_RUN_LAST,
> -                                GTK_CLASS_TYPE (object_class),
> -                                GTK_SIGNAL_OFFSET (GnomeCanvasItemClass, button_release_event),
> -                                gnome_canvas_marshal_BOOLEAN__BOXED,
> -                                GTK_TYPE_BOOL, 1,
> -                                GDK_TYPE_EVENT);
> -
> -        item_signals[ITEM_MOTION_NOTIFY_EVENT] =
> -                gtk_signal_new ("motion_notify_event",
> -                                GTK_RUN_LAST,
> -                                GTK_CLASS_TYPE (object_class),
> -                                GTK_SIGNAL_OFFSET (GnomeCanvasItemClass, motion_notify_event),
> -                                gnome_canvas_marshal_BOOLEAN__BOXED,
> -                                GTK_TYPE_BOOL, 1,
> -                                GDK_TYPE_EVENT);
> -
> -        item_signals[ITEM_KEY_PRESS_EVENT] =
> -                gtk_signal_new ("key_press_event",
> -                                GTK_RUN_LAST,
> -                                GTK_CLASS_TYPE (object_class),
> -                                GTK_SIGNAL_OFFSET (GnomeCanvasItemClass, key_press_event),
> -                                gnome_canvas_marshal_BOOLEAN__BOXED,
> -                                GTK_TYPE_BOOL, 1,
> -                                GDK_TYPE_EVENT);
> -
> -        item_signals[ITEM_KEY_RELEASE_EVENT] =
> -                gtk_signal_new ("key_release_event",
> -                                GTK_RUN_LAST,
> -                                GTK_CLASS_TYPE (object_class),
> -                                GTK_SIGNAL_OFFSET (GnomeCanvasItemClass, key_release_event),
> -                                gnome_canvas_marshal_BOOLEAN__BOXED,
> -                                GTK_TYPE_BOOL, 1,
> -                                GDK_TYPE_EVENT);
> -
> -        item_signals[ITEM_ENTER_NOTIFY_EVENT] =
> -                gtk_signal_new ("enter_notify_event",
> -                                GTK_RUN_LAST,
> -                                GTK_CLASS_TYPE (object_class),
> -                                GTK_SIGNAL_OFFSET (GnomeCanvasItemClass, enter_notify_event),
> -                                gnome_canvas_marshal_BOOLEAN__BOXED,
> -                                GTK_TYPE_BOOL, 1,
> -                                GDK_TYPE_EVENT);
> -
> -        item_signals[ITEM_LEAVE_NOTIFY_EVENT] =
> -                gtk_signal_new ("leave_notify_event",
> -                                GTK_RUN_LAST,
> -                                GTK_CLASS_TYPE (object_class),
> -                                GTK_SIGNAL_OFFSET (GnomeCanvasItemClass, leave_notify_event),
> -                                gnome_canvas_marshal_BOOLEAN__BOXED,
> -                                GTK_TYPE_BOOL, 1,
> -                                GDK_TYPE_EVENT);
>  
>  	gobject_class->dispose = gnome_canvas_item_dispose;
>  
> @@ -2628,33 +2566,7 @@
>  		gtk_signal_emit (
>  			GTK_OBJECT (item), item_signals[ITEM_EVENT],
>  			&ev, &finished);
> -
> -                switch (event->type) {
> -                case GDK_MOTION_NOTIFY:
> -                        signal_num = ITEM_MOTION_NOTIFY_EVENT;
> -                        break;
> -
> -                case GDK_BUTTON_PRESS:
> -                case GDK_2BUTTON_PRESS:
> -                case GDK_3BUTTON_PRESS:
> -                        signal_num = ITEM_BUTTON_PRESS_EVENT;
> -                        break;
> -
> -                case GDK_BUTTON_RELEASE:
> -                        signal_num = ITEM_BUTTON_RELEASE_EVENT;
> -                        break;
> -
> -                default:
> -                        signal_num = -1;
> -                        break;
> -                }
> -
> -                if (signal_num != -1)
> -                        gtk_signal_emit (GTK_OBJECT (item),
> -                                         item_signals[signal_num],
> -                                         &ev,
> -                                         &finished);
> -
> +		
>  		parent = item->parent;
>  		gtk_object_unref (GTK_OBJECT (item));
>  
> @@ -2934,13 +2846,15 @@
>  gnome_canvas_key (GtkWidget *widget, GdkEventKey *event)
>  {
>  	GnomeCanvas *canvas;
> -
> +	
>  	g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE);
>  	g_return_val_if_fail (event != NULL, FALSE);
>  
>  	canvas = GNOME_CANVAS (widget);
> +	
>  	return emit_event (canvas, (GdkEvent *) event);
>  }
> +
>  
>  /* Crossing event handler for the canvas */
>  static gint
> Index: libgnomecanvas/gnome-canvas.h
> ===================================================================
> RCS file: /cvs/gnome/libgnomecanvas/libgnomecanvas/gnome-canvas.h,v
> retrieving revision 1.60
> diff -u -r1.60 gnome-canvas.h
> --- libgnomecanvas/gnome-canvas.h	2001/08/13 17:54:41	1.60
> +++ libgnomecanvas/gnome-canvas.h	2001/12/03 22:19:39
> @@ -222,13 +222,9 @@
>  	 * coordinates are in the canvas world coordinate system.
>  	 */
>  	gboolean (* event)                (GnomeCanvasItem *item, GdkEvent *event);
> -        gboolean (* button_press_event)   (GnomeCanvasItem *item, GdkEventButton *event);
> -        gboolean (* button_release_event) (GnomeCanvasItem *item, GdkEventButton *event);
> -        gboolean (* motion_notify_event)  (GnomeCanvasItem *item, GdkEventMotion *event);
> -        gboolean (* key_press_event)      (GnomeCanvasItem *item, GdkEventKey *event);
> -        gboolean (* key_release_event)    (GnomeCanvasItem *item, GdkEventKey *event);
> -        gboolean (* enter_notify_event)   (GnomeCanvasItem *item, GdkEventCrossing *event);
> -        gboolean (* leave_notify_event)   (GnomeCanvasItem *item, GdkEventCrossing *event);
> +
> +	/* Reserved for future expansion */
> +	gpointer spare_vmethods [4];
>  };
>  
>  
-- 
Mathieu Lacage <mathieu gnu org>

_______________________________________________
gnome-hackers mailing list
gnome-hackers gnome org
http://mail.gnome.org/mailman/listinfo/gnome-hackers



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