[cairo-commit] gtkcairo/gtkcairo gtkcairo.c,1.3,1.4

OEyvind Kolaas commit at pdx.freedesktop.org
Mon Aug 15 11:12:59 PDT 2005


Committed by: pippin

Update of /cvs/cairo/gtkcairo/gtkcairo
In directory pdx:/tmp/cvs-serv15847/gtkcairo

Modified Files:
	gtkcairo.c 
Log Message:
fix expose bug, attach gtk_style, cosemtic changes

Index: gtkcairo.c
===================================================================
RCS file: /cvs/cairo/gtkcairo/gtkcairo/gtkcairo.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** gtkcairo.c	25 Nov 2003 04:34:20 -0000	1.3
--- gtkcairo.c	12 Feb 2004 17:55:22 -0000	1.4
***************
*** 35,42 ****
  #include <cairo.h>
  
- /* XXX  X11-specific: */
- #include <cairo-xlib.h>
- /* XXX  :X11-specific */
- 
  #include "gtkcairo.h"
  
--- 35,38 ----
***************
*** 113,120 ****
  	widget_class->size_allocate = gtk_cairo_size_allocate;
  
! 	signals[REDRAW] = g_signal_new("redraw",
  			GTK_TYPE_CAIRO,
  			G_SIGNAL_RUN_LAST,
! 			G_STRUCT_OFFSET(GtkCairoClass, redraw),
  			NULL, NULL,
  			g_cclosure_marshal_VOID__POINTER,
--- 109,116 ----
  	widget_class->size_allocate = gtk_cairo_size_allocate;
  
! 	signals[REDRAW] = g_signal_new ("redraw",
  			GTK_TYPE_CAIRO,
  			G_SIGNAL_RUN_LAST,
! 			G_STRUCT_OFFSET (GtkCairoClass, redraw),
  			NULL, NULL,
  			g_cclosure_marshal_VOID__POINTER,
***************
*** 125,129 ****
  gtk_cairo_init (GtkCairo *gtkcairo)
  {
! 	gtkcairo->cairo = cairo_create();
  }
  
--- 121,125 ----
  gtk_cairo_init (GtkCairo *gtkcairo)
  {
! 	gtkcairo->cairo = cairo_create ();
  }
  
***************
*** 133,139 ****
  	GtkWidget *gtkcairo;
  	
! 	gtkcairo = GTK_WIDGET(g_object_new(GTK_TYPE_CAIRO, NULL));
  
! 	gtk_widget_queue_draw(GTK_WIDGET(gtkcairo));
  
  	return gtkcairo;
--- 129,135 ----
  	GtkWidget *gtkcairo;
  	
! 	gtkcairo = GTK_WIDGET (g_object_new (GTK_TYPE_CAIRO, NULL));
  
! 	gtk_widget_queue_draw (GTK_WIDGET (gtkcairo));
  
  	return gtkcairo;
***************
*** 163,171 ****
  	gint attributes_mask;
  
! 	g_return_if_fail(widget != NULL);
! 	g_return_if_fail(GTK_IS_CAIRO (widget));
  
! 	GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
! 	gtkcairo = GTK_CAIRO(widget);
  
  	attributes.x = widget->allocation.x;
--- 159,167 ----
  	gint attributes_mask;
  
! 	g_return_if_fail (widget != NULL);
! 	g_return_if_fail (GTK_IS_CAIRO (widget));
  
! 	GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
! 	gtkcairo = GTK_CAIRO (widget);
  
  	attributes.x = widget->allocation.x;
***************
*** 180,189 ****
  	
  	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
! 	widget->window = gdk_window_new(widget->parent->window,
  			&attributes, attributes_mask);
  	
  	gdk_window_set_user_data (widget->window, widget);
! 
! 	//gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
  }
  
--- 176,186 ----
  	
  	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
! 	widget->window = gdk_window_new (widget->parent->window,
  			&attributes, attributes_mask);
  	
  	gdk_window_set_user_data (widget->window, widget);
! 	gtk_style_attach (widget->style, widget->window);
! 	
! 	gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
  }
  
***************
*** 213,241 ****
  	gint x_off, y_off;
  
! 	g_return_val_if_fail(widget != NULL, FALSE);
! 	g_return_val_if_fail(GTK_IS_CAIRO (widget), FALSE);
! 	g_return_val_if_fail(event != NULL, FALSE);
  
! 	gtkcairo = GTK_CAIRO(widget);
  
  	/* Ignore GTK+ and use Cairo for drawing. */
! 	gdk_window_get_internal_paint_info(widget->window,
  			&gdkdrawable, &x_off, &y_off);
  
  	/* XXX  X11-specific: */
! 	cairo_set_target_drawable(gtkcairo->cairo,
! 			gdk_x11_drawable_get_xdisplay(gdkdrawable),
! 			gdk_x11_drawable_get_xid(gdkdrawable));
  	/* XXX  :X11-specific */
  
! 	g_signal_emit_by_name(gtkcairo, "redraw", gtkcairo->cairo);
  
  	return FALSE;
  }
  
! cairo_t*
! gtk_cairo_get_cairo(GtkCairo *gtkcairo) {
! 	g_return_val_if_fail(gtkcairo != NULL, NULL);
! 	g_return_val_if_fail(GTK_IS_CAIRO(gtkcairo), NULL);
  	return gtkcairo->cairo;
  }
--- 210,248 ----
  	gint x_off, y_off;
  
! 	g_return_val_if_fail (widget != NULL, FALSE);
! 	g_return_val_if_fail (GTK_IS_CAIRO (widget), FALSE);
! 	g_return_val_if_fail (event != NULL, FALSE);
  
! 	gtkcairo = GTK_CAIRO (widget);
  
  	/* Ignore GTK+ and use Cairo for drawing. */
! 	gdk_window_get_internal_paint_info (widget->window,
  			&gdkdrawable, &x_off, &y_off);
  
  	/* XXX  X11-specific: */
! 	cairo_set_target_drawable (gtkcairo->cairo,
! 			gdk_x11_drawable_get_xdisplay (gdkdrawable),
! 			gdk_x11_drawable_get_xid (gdkdrawable));
  	/* XXX  :X11-specific */
  
! 	/* counter offset of expose */
! 	if (x_off || y_off) {
! 		cairo_save (gtkcairo->cairo);
! 		cairo_translate (gtkcairo->cairo, -x_off, -y_off);
! 	}
! 
! 	g_signal_emit_by_name (gtkcairo, "redraw", gtkcairo->cairo);
  
+ 	if (x_off || y_off) {
+ 		cairo_restore (gtkcairo->cairo);
+ 	}
+ 	
  	return FALSE;
  }
  
! cairo_t *
! gtk_cairo_get_cairo (GtkCairo *gtkcairo) {
! 	g_return_val_if_fail (gtkcairo != NULL, NULL);
! 	g_return_val_if_fail (GTK_IS_CAIRO (gtkcairo), NULL);
  	return gtkcairo->cairo;
  }





More information about the cairo-commit mailing list