[cairo-commit] CairoJava/src/org/cairographics/cairo CairoGlitzSurface.java, 1.3, 1.4

Soorya Kuloor commit at pdx.freedesktop.org
Thu Jun 3 15:25:35 PDT 2004


Committed by: skuloor

Update of /cvs/cairo/CairoJava/src/org/cairographics/cairo
In directory pdx:/tmp/cvs-serv31032/src/org/cairographics/cairo

Modified Files:
	CairoGlitzSurface.java 
Log Message:
Add a method to turn off double buffering for gtk widgets when using with Glitz

Index: CairoGlitzSurface.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoGlitzSurface.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/CairoGlitzSurface.java	20 May 2004 19:36:38 -0000	1.3
--- b/CairoGlitzSurface.java	3 Jun 2004 22:25:32 -0000	1.4
***************
*** 27,30 ****
--- 27,31 ----
  package org.cairographics.cairo;
  
+ import org.eclipse.swt.internal.gtk.OS;
  import org.eclipse.swt.widgets.Widget;
  
***************
*** 57,64 ****
--- 58,88 ----
      }
      
+     /**
+      * Creates a glitz surface on the Widget <code>w</code>. The widget's double buffering must be set to 
+      * <code>false</code> before starting SWT's display loop.
+      * 
+      * @param w Widget to create a glitz surface on.
+      * 
+      * @see #widgetSetDoubleBuffered(Widget, boolean)
+      */
      public CairoGlitzSurface(Widget w) {
          this.handle = glitz_glx_surface_create_for_window(w.handle);
      }
  
+     /**
+      * Sets the double buffering of the widget to <code>true</code> or <code>false</code>.
+      * Currently this only works for gtk widgets.<p>
+      * When using a gtk widget with glitz surfaces, double buffering must be set to <code>false</code>
+      * before the <code>readAndDispatch</code> method of SWT's <code>Display</code> object is
+      * called.
+      * 
+      * @param widget Widget to set double buffering on. Must be a gtk widget.
+      * @param isDoubleBuffered A value of <code>false</code> turns double buffering off, 
+      * a value of <code>true</code> turns it on.
+      */
+     public static void widgetSetDoubleBuffered(Widget widget, boolean isDoubleBuffered) {
+         OS.gtk_widget_set_double_buffered(widget.handle, isDoubleBuffered);
+     }
+     
      /*
       * (non-Javadoc)
***************
*** 135,138 ****
--- 159,169 ----
      }
      
+     /* 
+      * @see org.cairographics.cairo.CairoSurface#dispose()
+      */
+     public void dispose() {
+         glitz_surface_destroy(this.handle);
+     }
+ 
      /**
       * Ensures that <code>buffer</code> is a valid buffer descriptor.
***************
*** 152,155 ****
--- 183,194 ----
      }
  
+     /**
+      *
+      */
+     public void update() {
+         glitz_surface_update_size(handle);
+                                                                                 
+     }
+                                                                                 
      native static void cairo_set_target_gl(long cr, long surface);
  
***************
*** 159,162 ****
--- 198,206 ----
       */
  
+     /**
+      * Creates a glitz surface for drawing on a X window.
+      * 
+      * @param window Pointer to a GtkWidget object
+      */
      native static long glitz_glx_surface_create_for_window(long window);
  
***************
*** 174,176 ****
--- 218,224 ----
                                                                     int width, int height,  int x_dst, int y_dst);
  
+     native static void glitz_surface_destroy(long handle);
+ 
+     native static void glitz_surface_update_size(long handle);
+     
  }





More information about the cairo-commit mailing list