]> Pileus Git - ~andy/gtk/blobdiff - gdk/gdkgc.c
[ Merges from gtk-1-2 ]
[~andy/gtk] / gdk / gdkgc.c
index fb25e5dcdb1df7523a4cabdf243e241c88de3729..8b6e4fd0ed350dbd7b7f553a293b59a1a37235af 100644 (file)
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
 #include <string.h>
 #include <X11/Xlib.h>
 #include "gdk.h"
@@ -87,6 +96,42 @@ gdk_gc_new_with_values (GdkWindow    *window,
        case GDK_XOR:
          xvalues.function = GXxor;
          break;
+       case GDK_CLEAR:
+         xvalues.function = GXclear;
+         break;
+       case GDK_AND:
+         xvalues.function = GXand;
+         break;
+       case GDK_AND_REVERSE:
+         xvalues.function = GXandReverse;
+         break;
+       case GDK_AND_INVERT:
+         xvalues.function = GXandInverted;
+         break;
+       case GDK_NOOP:
+         xvalues.function = GXnoop;
+         break;
+       case GDK_OR:
+         xvalues.function = GXor;
+         break;
+       case GDK_EQUIV:
+         xvalues.function = GXequiv;
+         break;
+       case GDK_OR_REVERSE:
+         xvalues.function = GXorReverse;
+         break;
+       case GDK_COPY_INVERT:
+         xvalues.function = GXcopyInverted;
+         break;
+       case GDK_OR_INVERT:
+         xvalues.function = GXorInverted;
+         break;
+       case GDK_NAND:
+         xvalues.function = GXnand;
+         break;
+       case GDK_SET:
+         xvalues.function = GXset;
+         break;
        }
       xvalues_mask |= GCFunction;
     }
@@ -241,6 +286,7 @@ gdk_gc_unref (GdkGC *gc)
   GdkGCPrivate *private = (GdkGCPrivate*) gc;
   
   g_return_if_fail (gc != NULL);
+  g_return_if_fail (private->ref_count > 0);
   
   if (private->ref_count > 1)
     private->ref_count -= 1;
@@ -288,6 +334,42 @@ gdk_gc_get_values (GdkGC       *gc,
        case GXxor:
          values->function = GDK_XOR;
          break;
+       case GXclear:
+         values->function = GDK_CLEAR;
+         break;
+       case GXand:
+         values->function = GDK_AND;
+         break;
+       case GXandReverse:
+         values->function = GDK_AND_REVERSE;
+         break;
+       case GXandInverted:
+         values->function = GDK_AND_INVERT;
+         break;
+       case GXnoop:
+         values->function = GDK_NOOP;
+         break;
+       case GXor:
+         values->function = GDK_OR;
+         break;
+       case GXequiv:
+         values->function = GDK_EQUIV;
+         break;
+       case GXorReverse:
+         values->function = GDK_OR_REVERSE;
+         break;
+       case GXcopyInverted:
+         values->function =GDK_COPY_INVERT;
+         break;
+       case GXorInverted:
+         values->function = GDK_OR_INVERT;
+         break;
+       case GXnand:
+         values->function = GDK_NAND;
+         break;
+       case GXset:
+         values->function = GDK_SET;
+         break;
        }
 
       switch (xvalues.fill_style)
@@ -432,6 +514,42 @@ gdk_gc_set_function (GdkGC  *gc,
     case GDK_XOR:
       XSetFunction (private->xdisplay, private->xgc, GXxor);
       break;
+    case GDK_CLEAR:
+      XSetFunction (private->xdisplay, private->xgc, GXclear);
+      break;
+    case GDK_AND:
+      XSetFunction (private->xdisplay, private->xgc, GXand);
+      break;
+    case GDK_AND_REVERSE:
+      XSetFunction (private->xdisplay, private->xgc, GXandReverse);
+      break;
+    case GDK_AND_INVERT:
+      XSetFunction (private->xdisplay, private->xgc, GXandInverted);
+      break;
+    case GDK_NOOP:
+      XSetFunction (private->xdisplay, private->xgc, GXnoop);
+      break;
+    case GDK_OR:
+      XSetFunction (private->xdisplay, private->xgc, GXor);
+      break;
+    case GDK_EQUIV:
+      XSetFunction (private->xdisplay, private->xgc, GXequiv);
+      break;
+    case GDK_OR_REVERSE:
+      XSetFunction (private->xdisplay, private->xgc, GXorReverse);
+      break;
+    case GDK_COPY_INVERT:
+      XSetFunction (private->xdisplay, private->xgc, GXcopyInverted);
+      break;
+    case GDK_OR_INVERT:
+      XSetFunction (private->xdisplay, private->xgc, GXorInverted);
+      break;
+    case GDK_NAND:
+      XSetFunction (private->xdisplay, private->xgc, GXnand);
+      break;
+    case GDK_SET:
+      XSetFunction (private->xdisplay, private->xgc, GXset);
+      break;
     }
 }
 
@@ -567,7 +685,7 @@ gdk_gc_set_clip_rectangle (GdkGC    *gc,
 {
   GdkGCPrivate *private;
   XRectangle xrectangle;
-
+   
   g_return_if_fail (gc != NULL);
 
   private = (GdkGCPrivate*) gc;
@@ -701,6 +819,22 @@ gdk_gc_set_line_attributes (GdkGC  *gc,
                      xline_style, xcap_style, xjoin_style);
 }
 
+void
+gdk_gc_set_dashes (GdkGC *gc,
+                  gint   dash_offset,
+                  gchar  dash_list[],
+                  gint   n)
+{
+  GdkGCPrivate *private;
+
+  g_return_if_fail (gc != NULL);
+  g_return_if_fail (dash_list != NULL);
+
+  private = (GdkGCPrivate*) gc;
+
+  XSetDashes (private->xdisplay, private->xgc, dash_offset, dash_list, n);
+}
+
 void
 gdk_gc_copy (GdkGC *dst_gc, GdkGC *src_gc)
 {