]> Pileus Git - ~andy/gtk/blobdiff - gdk/linux-fb/gdkcolor-fb.c
Take thickness into account in the size allocation of the child widgets in
[~andy/gtk] / gdk / linux-fb / gdkcolor-fb.c
index 702c2d1e7cb771cf566acd1112d954000da22d56..c2bbb10b2ad7af43748ebc48bd8db2fa317fe62d 100644 (file)
@@ -24,6 +24,7 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include <config.h>
 #include <time.h>
 #include <sys/ioctl.h>
 #include <string.h>
@@ -52,6 +53,7 @@ gdk_colormap_finalize (GObject *object)
   
   g_free (private->info);
   g_free (colormap->colors);
+  g_free (private);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
@@ -171,7 +173,7 @@ gdk_colormap_new (GdkVisual *visual,
       break;
 
     case GDK_VISUAL_DIRECT_COLOR:
-      g_error("NYI");
+      g_warning ("gdk_colormap_new () on a direct color visual not implemented");
 #if 0
       colormap->colors = g_new (GdkColor, colormap->size);
 
@@ -201,17 +203,8 @@ gdk_colormap_new (GdkVisual *visual,
   return colormap;
 }
 
-#define MIN_SYNC_TIME 2
-
-static void
-gdk_colormap_sync (GdkColormap *colormap,
-                  gboolean     force)
-{
-  
-}                 
-
 GdkColormap*
-gdk_colormap_get_system (void)
+gdk_screen_get_system_colormap (GdkScreen *screen)
 {
   static GdkColormap *colormap = NULL;
 
@@ -289,7 +282,7 @@ gdk_colormap_get_system (void)
            }
          break;
        case GDK_VISUAL_DIRECT_COLOR:
-         g_error("NYI");
+         g_warning ("gdk_colormap_get_system() on a direct color visual is not implemented");
          break;
        default:
          g_assert_not_reached ();
@@ -369,94 +362,6 @@ gdk_colormap_change (GdkColormap *colormap,
     }
 }
 
-gboolean
-gdk_color_parse (const gchar *spec,
-                GdkColor *color)
-{
-  char aline[512];
-  FILE *fh;
-
-  g_return_val_if_fail(spec, FALSE);
-  g_return_val_if_fail(color, FALSE);
-
-  if (spec[0] == '#')
-    {
-      if (strlen(spec) == 7)
-       {
-         guint num;
-
-         sscanf (spec + 1, "%x", &num);
-         color->red = (num & 0xFF0000) >> 8;
-         color->green = (num & 0xFF00);
-         color->blue = (num & 0xFF) << 8;
-       }
-      else if (strlen(spec) == 13)
-       {
-         char s1[5], s2[5], s3[5];
-         g_snprintf (s1, sizeof(s1), spec + 1);
-         g_snprintf (s2, sizeof(s2), spec + 5);
-         g_snprintf (s3, sizeof(s3), spec + 9);
-
-         if (!sscanf(s1, "%hx", &color->red))
-           g_error ("sscanf failed");
-         if (!sscanf(s2, "%hx", &color->green))
-           g_error ("sscanf failed");
-         if (!sscanf (s3, "%hx", &color->blue))
-           g_error ("sscanf failed");
-       }
-      else
-       {
-         g_warning ("Couldn't parse color specifier `%s'", spec);
-         return FALSE;
-       }
-
-      return TRUE;
-    }
-  else
-    {
-      fh = fopen ("/usr/lib/X11/rgb.txt", "r");
-      if (!fh)
-       return FALSE;
-
-      while(fgets (aline, sizeof(aline), fh))
-       {
-         int red, green, blue;
-         char *ctmp;
-
-         g_strstrip (aline);
-         if (!aline[0] || aline[0] == '#' || aline[0] == '!')
-           continue;
-
-         ctmp = strtok (aline, " \t");
-         if (!ctmp)
-           continue;
-         red = atoi (ctmp);
-
-         ctmp = strtok (NULL, " \t");
-         if (!ctmp)
-           continue;
-         green = atoi (ctmp);
-
-         ctmp = strtok (NULL, " \t");
-         if (!ctmp)
-           continue;
-         blue = atoi (ctmp);
-
-         ctmp = strtok (NULL, " \t");
-         if (!ctmp || strcmp (ctmp, spec))
-           continue;
-
-         color->red = red << 8;
-         color->green = green << 8;
-         color->blue = blue << 8;
-         return TRUE;
-       }
-      fclose (fh);
-    }
-
-  return FALSE;
-}
-
 void
 gdk_colormap_free_colors (GdkColormap *colormap,
                          GdkColor    *colors,
@@ -536,7 +441,7 @@ gdk_colormap_alloc1 (GdkColormap *colormap,
 
   for (i = 0; i<colormap->size; i++)
     {
-      if (!(private->info[i].flags && GDK_COLOR_WRITEABLE) &&
+      if (!(private->info[i].flags & GDK_COLOR_WRITEABLE) &&
          (ret->red == colormap->colors[i].red) &&
          (ret->green == colormap->colors[i].green) &&
          (ret->blue == colormap->colors[i].blue))
@@ -614,7 +519,7 @@ gdk_colormap_alloc_colors_shared (GdkColormap *colormap,
 
       for (i = 0; i < colormap->size; i++)
        available[i] = ((private->info[i].ref_count == 0) ||
-                       !(private->info[i].flags && GDK_COLOR_WRITEABLE));
+                       !(private->info[i].flags & GDK_COLOR_WRITEABLE));
       
       while (nremaining > 0)
        {
@@ -849,7 +754,7 @@ gdk_colors_alloc (GdkColormap       *colormap,
   private = GDK_COLORMAP_PRIVATE_DATA (colormap);
   
   if (nplanes > 0)
-    return 0;
+    return FALSE;
 
   found = 0;
   for (i = 1; i < colormap->size; i++)
@@ -951,3 +856,11 @@ gdk_colormap_query_color (GdkColormap *colormap,
       break;
     }
 }
+
+GdkScreen*
+gdk_colormap_get_screen (GdkColormap *cmap)
+{
+  g_return_val_if_fail (cmap != NULL, NULL);
+
+  return gdk_screen_get_default ();
+}