[cairo-commit] gtkcairo/gtkcairo gdkcairo.c, 1.5, 1.6 gdkcairo.h, 1.7, 1.8

OEyvind Kolaas commit at pdx.freedesktop.org
Thu Nov 11 00:48:12 PST 2004


Committed by: pippin

Update of /cvs/cairo/gtkcairo/gtkcairo
In directory gabe:/tmp/cvs-serv13711/gtkcairo

Modified Files:
	gdkcairo.c gdkcairo.h 
Log Message:
disable default compiling of glitz support

Index: gdkcairo.c
===================================================================
RCS file: /cvs/cairo/gtkcairo/gtkcairo/gdkcairo.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gdkcairo.c	21 Sep 2004 16:53:44 -0000	1.5
+++ gdkcairo.c	11 Nov 2004 08:48:10 -0000	1.6
@@ -74,7 +74,7 @@
         #endif
         #ifdef USE_GL
         case GDKCAIRO_BACKEND_GL:
-            self->glitz_surface = NULL;
+            self->glitz_drawable = NULL;
             break;
         #endif
         default:
@@ -94,31 +94,31 @@
 void
 gdkcairo_destroy (gdkcairo_t *self)
 {
-	if (self->cr) {
-		cairo_destroy (self->cr);
+        if (self->cr) {
+                cairo_destroy (self->cr);
         self->cr = NULL;
-	}
+        }
 }
 
 void
 gdkcairo_realize (gdkcairo_t *self)
 {
-	GtkWidget *widget=self->widget;
-	GdkWindowAttr attributes;
-	gint attributes_mask;
+        GtkWidget *widget=self->widget;
+        GdkWindowAttr attributes;
+        gint attributes_mask;
 
-	g_return_if_fail (widget != NULL);
+        g_return_if_fail (widget != NULL);
 
-	GTK_WIDGET_SET_FLAGS (self->widget, GTK_REALIZED);
+        GTK_WIDGET_SET_FLAGS (self->widget, GTK_REALIZED);
 
-	attributes.x = widget->allocation.x;
-	attributes.y = widget->allocation.y;
-	attributes.width = widget->allocation.width;
-	attributes.height = widget->allocation.height;
-	attributes.wclass = GDK_INPUT_OUTPUT;
-	attributes.window_type = GDK_WINDOW_CHILD;
-	attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
-	attributes.visual = gtk_widget_get_visual (widget);
+        attributes.x = widget->allocation.x;
+        attributes.y = widget->allocation.y;
+        attributes.width = widget->allocation.width;
+        attributes.height = widget->allocation.height;
+        attributes.wclass = GDK_INPUT_OUTPUT;
+        attributes.window_type = GDK_WINDOW_CHILD;
+        attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
+        attributes.visual = gtk_widget_get_visual (widget);
 
 retry:
     switch (self->backend) {
@@ -126,61 +126,62 @@
             break;
         #ifdef CAIRO_HAS_XLIB_SURFACE
         case GDKCAIRO_BACKEND_XLIB:
-	      attributes.colormap = gtk_widget_get_colormap (widget);
+              attributes.colormap = gtk_widget_get_colormap (widget);
 
-	      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);
+              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);
 
             break;
         #endif
         #ifdef USE_GL
         case GDKCAIRO_BACKEND_GL: {
-	        Display *dpy = gdk_x11_get_default_xdisplay ();
-	        int screen = gdk_x11_get_default_screen ();
+                Display *dpy = gdk_x11_get_default_xdisplay ();
+                int screen = gdk_x11_get_default_screen ();
             XVisualInfo *vinfo;
-	        glitz_format_t *onscreen_format;
-		glitz_format_t templ;
-		unsigned long mask;
+                glitz_drawable_format_t *onscreen_format;
+                glitz_drawable_format_t templ;
+                unsigned long mask;
 
-		templ.doublebuffer = 1;
-		mask = GLITZ_FORMAT_DOUBLEBUFFER_MASK;
+                templ.doublebuffer = 1;
+                mask = GLITZ_FORMAT_DOUBLEBUFFER_MASK;
 
-		templ.draw.onscreen = 1;
-		mask |= GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
+                //templ.draw.onscreen = 1;
+                //mask |= GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
 
-		templ.multisample.samples = 4;
-		mask |= GLITZ_FORMAT_MULTISAMPLE_SAMPLES_MASK;
+                templ.samples = 4;
+                mask |= GLITZ_FORMAT_SAMPLES_MASK;
 
-	        onscreen_format =
-		    glitz_glx_find_format (dpy, screen, mask, &templ, 0);
-	        if (!onscreen_format) {
-		    mask &= ~GLITZ_FORMAT_MULTISAMPLE_SAMPLES_MASK;
-		
-		    onscreen_format =
-			glitz_glx_find_format (dpy, screen, mask, &templ, 0);
-		}
-		
-	        /*  XSetWindowAttributes xswa;*/
+                onscreen_format =
+                    glitz_glx_find_drawable_format (dpy, screen, mask, &templ, 0);
 
-	        if (onscreen_format) {
+                if (!onscreen_format) {
+                    mask &= ~GLITZ_FORMAT_SAMPLES_MASK;
+                
+                    onscreen_format =
+                        glitz_glx_find_drawable_format (dpy, screen, mask, &templ, 0);
+                }
+                
+                /*  XSetWindowAttributes xswa;*/
+
+          if (onscreen_format) {
               vinfo = glitz_glx_get_visual_info_from_format (dpy, screen, onscreen_format);
               gtk_widget_set_double_buffered (widget, FALSE);
               attributes.visual = gdkx_visual_get (vinfo->visualid);
               attributes.colormap = gdk_colormap_new (attributes.visual, TRUE);
 
-		      attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+                      attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-		      widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
-			                                   &attributes, attributes_mask);
-                self->glitz_surface =
-                glitz_glx_surface_create_for_window (dpy, screen,
-						     onscreen_format,
-						     gdk_x11_drawable_get_xid (widget->window),
-						     attributes.width,
-						     attributes.height);
+                      widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+                                                           &attributes, attributes_mask);
+                self->glitz_drawable =
+                glitz_glx_create_drawable_for_window (dpy, screen,
+                                                      onscreen_format,
+                                                      gdk_x11_drawable_get_xid (widget->window),
+                                                      attributes.width,
+                                                      attributes.height);
 
-              cairo_set_target_glitz (self->cr, self->glitz_surface);
+              cairo_set_target_glitz (self->cr, self->glitz_drawable);
             } else {
             g_error ("could not find a usable GL visual\n");
             self->backend = GDKCAIRO_BACKEND_XLIB;
@@ -194,8 +195,8 @@
     }
 
     gtk_style_attach (widget->style, widget->window);
-	gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-	gdk_window_set_user_data (widget->window, widget);
+        gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+        gdk_window_set_user_data (widget->window, widget);
 }
 
 void
@@ -205,7 +206,7 @@
                         int width,
                         int height)
 {
-	if (GTK_WIDGET_REALIZED (self->widget)) {
+        if (GTK_WIDGET_REALIZED (self->widget)) {
        gdk_window_move_resize (self->widget->window, x, y, width, height);
 
        switch (self->backend) {
@@ -216,22 +217,22 @@
          #ifdef USE_GL
            case GDKCAIRO_BACKEND_GL:
             if (self->glitz_surface) {
-		glitz_format_t *format;
+                glitz_format_t *format;
 
-		format = glitz_surface_get_format (self->glitz_surface);
-		
-		glitz_surface_destroy (self->glitz_surface);
-		
-		self->glitz_surface =
-		    glitz_glx_surface_create_for_window (gdk_x11_get_default_xdisplay (),
-							 gdk_x11_get_default_screen (),
-							 format,
-							 gdk_x11_drawable_get_xid (self->widget->window),
-							 width,
-							 height);
-		cairo_set_target_glitz (self->cr, self->glitz_surface);
+                format = glitz_surface_get_format (self->glitz_surface);
+                
+                glitz_surface_destroy (self->glitz_surface);
+                
+                self->glitz_surface =
+                    glitz_glx_surface_create_for_window (gdk_x11_get_default_xdisplay (),
+                                                         gdk_x11_get_default_screen (),
+                                                         format,
+                                                         gdk_x11_drawable_get_xid (self->widget->window),
+                                                         width,
+                                                         height);
+                cairo_set_target_glitz (self->cr, self->glitz_surface);
             }
-	    
+            
             break;
          #endif
            default:
@@ -247,8 +248,8 @@
 {
     GtkWidget *widget = self->widget;
 
-	g_return_val_if_fail (widget != NULL, FALSE);
-	g_return_val_if_fail (event != NULL, FALSE);
+        g_return_val_if_fail (widget != NULL, FALSE);
+        g_return_val_if_fail (event != NULL, FALSE);
 
     switch (self->backend) {
         #ifdef USE_GL
@@ -260,7 +261,7 @@
               &(self->widget->style->bg[GTK_STATE_NORMAL]) );
             cairo_fill      (self->cr);
 
-	        g_signal_emit_by_name (self->widget, "paint", self->cr);
+                g_signal_emit_by_name (self->widget, "paint", self->cr);
             glitz_surface_swap_buffers (self->glitz_surface);
             XSync (gdk_x11_get_default_xdisplay (), 0);
         }break;
@@ -270,30 +271,30 @@
             GdkDrawable *gdkdrawable;
             gint x_off, y_off;
 
-	        gdk_window_get_internal_paint_info (widget->window,
-			                                &gdkdrawable, &x_off, &y_off);
+                gdk_window_get_internal_paint_info (widget->window,
+                                                        &gdkdrawable, &x_off, &y_off);
 
-	        cairo_set_target_drawable (self->cr,
-			                       gdk_x11_drawable_get_xdisplay (gdkdrawable),
-			                       gdk_x11_drawable_get_xid (gdkdrawable));
+                cairo_set_target_drawable (self->cr,
+                                               gdk_x11_drawable_get_xdisplay (gdkdrawable),
+                                               gdk_x11_drawable_get_xid (gdkdrawable));
 
-	        /* counter offset of expose */
-	        if (x_off || y_off) {
-		        cairo_save (self->cr);
-		        cairo_translate (self->cr, -x_off, -y_off);
-	        }
+                /* counter offset of expose */
+                if (x_off || y_off) {
+                        cairo_save (self->cr);
+                        cairo_translate (self->cr, -x_off, -y_off);
+                }
 
-	        g_signal_emit_by_name (self->widget, "paint", self->cr);
+                g_signal_emit_by_name (self->widget, "paint", self->cr);
 
-	        if (x_off || y_off) {
-		        cairo_restore (self->cr);
+                if (x_off || y_off) {
+                        cairo_restore (self->cr);
             }
-	    }break;
+            }break;
         #endif
         default:
             g_assert(0);
     }
-	return FALSE;
+        return FALSE;
 }
 
 /* vim: set ts=4 sw=4 et : */

Index: gdkcairo.h
===================================================================
RCS file: /cvs/cairo/gtkcairo/gtkcairo/gdkcairo.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- gdkcairo.h	21 Sep 2004 16:53:44 -0000	1.7
+++ gdkcairo.h	11 Nov 2004 08:48:10 -0000	1.8
@@ -48,7 +48,7 @@
     gdkcairo_backend backend;
 
     #ifdef USE_GL
-	glitz_surface_t *glitz_surface;
+	glitz_drawable_t *glitz_drawable;
     #endif
 } gdkcairo_t;
 




More information about the cairo-commit mailing list