* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
+#include <config.h>
#include <time.h>
#include <sys/ioctl.h>
#include <string.h>
g_free (private->info);
g_free (colormap->colors);
+ g_free (private);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
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);
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;
}
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 ();
}
}
-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,
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))
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)
{
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
if (nplanes > 0)
- return 0;
+ return FALSE;
found = 0;
for (i = 1; i < colormap->size; i++)
break;
}
}
+
+GdkScreen*
+gdk_colormap_get_screen (GdkColormap *cmap)
+{
+ g_return_val_if_fail (cmap != NULL, NULL);
+
+ return gdk_screen_get_default ();
+}