Commit be698675 authored by Alexander Larsson's avatar Alexander Larsson

Cleanup and reindent of GtkFB.

Added some serial mouse support.
Updates to latest Gtk+/pango
parent b664be5f
2000-11-13 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/*.[ch]:
Massive reindent to gtk+ standard. My hands hurt.
* gdk/linux-fb/gdkcolor-fb.c:
Move GdkColorPrivateFB from inherited to windowing_data
* gdk/linux-fb/gdkcursor-fb.c:
_gdk_cursor_new_from_pixmap made static
* gdk/linux-fb/gdkdnd-fb.c:
GdkDragContextPrivate moved to windowing_data
* gdk/linux-fb/gdkdrawable-fb2.c:
Removed endian.h, use glib endianness macros instead
Some cleanups in the usage of GDK_DRAWABLE_FBDATA
and GDK_DRAWABLE_IMPL_FBDATA
* gdk/linux-fb/gdkfont-fb.c:
Add empty gdk_font_load(). Needed for linking of Gtk+.
* gdk/linux-fb/gdkimage-fb.c:
Removed endian.h, use glib endianness macros instead
Moved GdkImagePrivateFB to windowing_data
gdk_image_new_bitmap didn't always allocate enough
memory.
* gdk/linux-fb/gdkinput-ps2.c:
Added semi-working support for MS serial mice.
* gdk/linux-fb/gdkprivate-fb.h:
s/GdkWindowPrivate/GdkWindowObject/
Removed GdkWindowPrivate typedef
s/GDK_DRAWABLE_P/GDK_DRAWABLE_FBDATA/
Removed GDK_DRAWABLE_P
Move GdkColorPrivateFB from inherited to windowing_data
Moved GdkImagePrivateFB to windowing_data
* gdk/linux-fb/gdkvisual-fb.c:
Removed some unused debug code.
* gdk/linux-fb/gdkwindow-fb.c:
Use stock cursors instead of including X headers.
s/GdkWindowPrivate/GdkWindowObject/
* gdk/linux-fb/mitypes.h:
Removed unused types.
* modules/linux-fb/basic.c:
Use the pango fribidi wrappers.
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/linux-fb/gdkcolor-fb.c, gdk/nanox/gdkmain-nanox.c,
......
2000-11-13 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/*.[ch]:
Massive reindent to gtk+ standard. My hands hurt.
* gdk/linux-fb/gdkcolor-fb.c:
Move GdkColorPrivateFB from inherited to windowing_data
* gdk/linux-fb/gdkcursor-fb.c:
_gdk_cursor_new_from_pixmap made static
* gdk/linux-fb/gdkdnd-fb.c:
GdkDragContextPrivate moved to windowing_data
* gdk/linux-fb/gdkdrawable-fb2.c:
Removed endian.h, use glib endianness macros instead
Some cleanups in the usage of GDK_DRAWABLE_FBDATA
and GDK_DRAWABLE_IMPL_FBDATA
* gdk/linux-fb/gdkfont-fb.c:
Add empty gdk_font_load(). Needed for linking of Gtk+.
* gdk/linux-fb/gdkimage-fb.c:
Removed endian.h, use glib endianness macros instead
Moved GdkImagePrivateFB to windowing_data
gdk_image_new_bitmap didn't always allocate enough
memory.
* gdk/linux-fb/gdkinput-ps2.c:
Added semi-working support for MS serial mice.
* gdk/linux-fb/gdkprivate-fb.h:
s/GdkWindowPrivate/GdkWindowObject/
Removed GdkWindowPrivate typedef
s/GDK_DRAWABLE_P/GDK_DRAWABLE_FBDATA/
Removed GDK_DRAWABLE_P
Move GdkColorPrivateFB from inherited to windowing_data
Moved GdkImagePrivateFB to windowing_data
* gdk/linux-fb/gdkvisual-fb.c:
Removed some unused debug code.
* gdk/linux-fb/gdkwindow-fb.c:
Use stock cursors instead of including X headers.
s/GdkWindowPrivate/GdkWindowObject/
* gdk/linux-fb/mitypes.h:
Removed unused types.
* modules/linux-fb/basic.c:
Use the pango fribidi wrappers.
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/linux-fb/gdkcolor-fb.c, gdk/nanox/gdkmain-nanox.c,
......
2000-11-13 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/*.[ch]:
Massive reindent to gtk+ standard. My hands hurt.
* gdk/linux-fb/gdkcolor-fb.c:
Move GdkColorPrivateFB from inherited to windowing_data
* gdk/linux-fb/gdkcursor-fb.c:
_gdk_cursor_new_from_pixmap made static
* gdk/linux-fb/gdkdnd-fb.c:
GdkDragContextPrivate moved to windowing_data
* gdk/linux-fb/gdkdrawable-fb2.c:
Removed endian.h, use glib endianness macros instead
Some cleanups in the usage of GDK_DRAWABLE_FBDATA
and GDK_DRAWABLE_IMPL_FBDATA
* gdk/linux-fb/gdkfont-fb.c:
Add empty gdk_font_load(). Needed for linking of Gtk+.
* gdk/linux-fb/gdkimage-fb.c:
Removed endian.h, use glib endianness macros instead
Moved GdkImagePrivateFB to windowing_data
gdk_image_new_bitmap didn't always allocate enough
memory.
* gdk/linux-fb/gdkinput-ps2.c:
Added semi-working support for MS serial mice.
* gdk/linux-fb/gdkprivate-fb.h:
s/GdkWindowPrivate/GdkWindowObject/
Removed GdkWindowPrivate typedef
s/GDK_DRAWABLE_P/GDK_DRAWABLE_FBDATA/
Removed GDK_DRAWABLE_P
Move GdkColorPrivateFB from inherited to windowing_data
Moved GdkImagePrivateFB to windowing_data
* gdk/linux-fb/gdkvisual-fb.c:
Removed some unused debug code.
* gdk/linux-fb/gdkwindow-fb.c:
Use stock cursors instead of including X headers.
s/GdkWindowPrivate/GdkWindowObject/
* gdk/linux-fb/mitypes.h:
Removed unused types.
* modules/linux-fb/basic.c:
Use the pango fribidi wrappers.
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/linux-fb/gdkcolor-fb.c, gdk/nanox/gdkmain-nanox.c,
......
2000-11-13 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/*.[ch]:
Massive reindent to gtk+ standard. My hands hurt.
* gdk/linux-fb/gdkcolor-fb.c:
Move GdkColorPrivateFB from inherited to windowing_data
* gdk/linux-fb/gdkcursor-fb.c:
_gdk_cursor_new_from_pixmap made static
* gdk/linux-fb/gdkdnd-fb.c:
GdkDragContextPrivate moved to windowing_data
* gdk/linux-fb/gdkdrawable-fb2.c:
Removed endian.h, use glib endianness macros instead
Some cleanups in the usage of GDK_DRAWABLE_FBDATA
and GDK_DRAWABLE_IMPL_FBDATA
* gdk/linux-fb/gdkfont-fb.c:
Add empty gdk_font_load(). Needed for linking of Gtk+.
* gdk/linux-fb/gdkimage-fb.c:
Removed endian.h, use glib endianness macros instead
Moved GdkImagePrivateFB to windowing_data
gdk_image_new_bitmap didn't always allocate enough
memory.
* gdk/linux-fb/gdkinput-ps2.c:
Added semi-working support for MS serial mice.
* gdk/linux-fb/gdkprivate-fb.h:
s/GdkWindowPrivate/GdkWindowObject/
Removed GdkWindowPrivate typedef
s/GDK_DRAWABLE_P/GDK_DRAWABLE_FBDATA/
Removed GDK_DRAWABLE_P
Move GdkColorPrivateFB from inherited to windowing_data
Moved GdkImagePrivateFB to windowing_data
* gdk/linux-fb/gdkvisual-fb.c:
Removed some unused debug code.
* gdk/linux-fb/gdkwindow-fb.c:
Use stock cursors instead of including X headers.
s/GdkWindowPrivate/GdkWindowObject/
* gdk/linux-fb/mitypes.h:
Removed unused types.
* modules/linux-fb/basic.c:
Use the pango fribidi wrappers.
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/linux-fb/gdkcolor-fb.c, gdk/nanox/gdkmain-nanox.c,
......
2000-11-13 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/*.[ch]:
Massive reindent to gtk+ standard. My hands hurt.
* gdk/linux-fb/gdkcolor-fb.c:
Move GdkColorPrivateFB from inherited to windowing_data
* gdk/linux-fb/gdkcursor-fb.c:
_gdk_cursor_new_from_pixmap made static
* gdk/linux-fb/gdkdnd-fb.c:
GdkDragContextPrivate moved to windowing_data
* gdk/linux-fb/gdkdrawable-fb2.c:
Removed endian.h, use glib endianness macros instead
Some cleanups in the usage of GDK_DRAWABLE_FBDATA
and GDK_DRAWABLE_IMPL_FBDATA
* gdk/linux-fb/gdkfont-fb.c:
Add empty gdk_font_load(). Needed for linking of Gtk+.
* gdk/linux-fb/gdkimage-fb.c:
Removed endian.h, use glib endianness macros instead
Moved GdkImagePrivateFB to windowing_data
gdk_image_new_bitmap didn't always allocate enough
memory.
* gdk/linux-fb/gdkinput-ps2.c:
Added semi-working support for MS serial mice.
* gdk/linux-fb/gdkprivate-fb.h:
s/GdkWindowPrivate/GdkWindowObject/
Removed GdkWindowPrivate typedef
s/GDK_DRAWABLE_P/GDK_DRAWABLE_FBDATA/
Removed GDK_DRAWABLE_P
Move GdkColorPrivateFB from inherited to windowing_data
Moved GdkImagePrivateFB to windowing_data
* gdk/linux-fb/gdkvisual-fb.c:
Removed some unused debug code.
* gdk/linux-fb/gdkwindow-fb.c:
Use stock cursors instead of including X headers.
s/GdkWindowPrivate/GdkWindowObject/
* gdk/linux-fb/mitypes.h:
Removed unused types.
* modules/linux-fb/basic.c:
Use the pango fribidi wrappers.
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/linux-fb/gdkcolor-fb.c, gdk/nanox/gdkmain-nanox.c,
......
2000-11-13 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/*.[ch]:
Massive reindent to gtk+ standard. My hands hurt.
* gdk/linux-fb/gdkcolor-fb.c:
Move GdkColorPrivateFB from inherited to windowing_data
* gdk/linux-fb/gdkcursor-fb.c:
_gdk_cursor_new_from_pixmap made static
* gdk/linux-fb/gdkdnd-fb.c:
GdkDragContextPrivate moved to windowing_data
* gdk/linux-fb/gdkdrawable-fb2.c:
Removed endian.h, use glib endianness macros instead
Some cleanups in the usage of GDK_DRAWABLE_FBDATA
and GDK_DRAWABLE_IMPL_FBDATA
* gdk/linux-fb/gdkfont-fb.c:
Add empty gdk_font_load(). Needed for linking of Gtk+.
* gdk/linux-fb/gdkimage-fb.c:
Removed endian.h, use glib endianness macros instead
Moved GdkImagePrivateFB to windowing_data
gdk_image_new_bitmap didn't always allocate enough
memory.
* gdk/linux-fb/gdkinput-ps2.c:
Added semi-working support for MS serial mice.
* gdk/linux-fb/gdkprivate-fb.h:
s/GdkWindowPrivate/GdkWindowObject/
Removed GdkWindowPrivate typedef
s/GDK_DRAWABLE_P/GDK_DRAWABLE_FBDATA/
Removed GDK_DRAWABLE_P
Move GdkColorPrivateFB from inherited to windowing_data
Moved GdkImagePrivateFB to windowing_data
* gdk/linux-fb/gdkvisual-fb.c:
Removed some unused debug code.
* gdk/linux-fb/gdkwindow-fb.c:
Use stock cursors instead of including X headers.
s/GdkWindowPrivate/GdkWindowObject/
* gdk/linux-fb/mitypes.h:
Removed unused types.
* modules/linux-fb/basic.c:
Use the pango fribidi wrappers.
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/linux-fb/gdkcolor-fb.c, gdk/nanox/gdkmain-nanox.c,
......
2000-11-13 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/*.[ch]:
Massive reindent to gtk+ standard. My hands hurt.
* gdk/linux-fb/gdkcolor-fb.c:
Move GdkColorPrivateFB from inherited to windowing_data
* gdk/linux-fb/gdkcursor-fb.c:
_gdk_cursor_new_from_pixmap made static
* gdk/linux-fb/gdkdnd-fb.c:
GdkDragContextPrivate moved to windowing_data
* gdk/linux-fb/gdkdrawable-fb2.c:
Removed endian.h, use glib endianness macros instead
Some cleanups in the usage of GDK_DRAWABLE_FBDATA
and GDK_DRAWABLE_IMPL_FBDATA
* gdk/linux-fb/gdkfont-fb.c:
Add empty gdk_font_load(). Needed for linking of Gtk+.
* gdk/linux-fb/gdkimage-fb.c:
Removed endian.h, use glib endianness macros instead
Moved GdkImagePrivateFB to windowing_data
gdk_image_new_bitmap didn't always allocate enough
memory.
* gdk/linux-fb/gdkinput-ps2.c:
Added semi-working support for MS serial mice.
* gdk/linux-fb/gdkprivate-fb.h:
s/GdkWindowPrivate/GdkWindowObject/
Removed GdkWindowPrivate typedef
s/GDK_DRAWABLE_P/GDK_DRAWABLE_FBDATA/
Removed GDK_DRAWABLE_P
Move GdkColorPrivateFB from inherited to windowing_data
Moved GdkImagePrivateFB to windowing_data
* gdk/linux-fb/gdkvisual-fb.c:
Removed some unused debug code.
* gdk/linux-fb/gdkwindow-fb.c:
Use stock cursors instead of including X headers.
s/GdkWindowPrivate/GdkWindowObject/
* gdk/linux-fb/mitypes.h:
Removed unused types.
* modules/linux-fb/basic.c:
Use the pango fribidi wrappers.
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/linux-fb/gdkcolor-fb.c, gdk/nanox/gdkmain-nanox.c,
......
......@@ -127,7 +127,7 @@ my_x_query_colors (GdkColormap *colormap,
for (i = 0; i < ncolors; i++)
{
pixel = colors[i].pixel;
switch(colormap->visual->depth)
switch (colormap->visual->depth)
{
case 8:
colors[i] = colormap->colors[pixel];
......@@ -143,7 +143,7 @@ my_x_query_colors (GdkColormap *colormap,
<< (16 - colormap->visual->blue_prec - colormap->visual->blue_shift);
break;
default:
g_assert_not_reached();
g_assert_not_reached ();
break;
}
}
......@@ -243,10 +243,10 @@ init_gray (GdkColorContext *cc)
{
GdkColor colr;
gdk_color_white(cc->colormap, &colr);
gdk_color_white (cc->colormap, &colr);
cc->white_pixel = colr.pixel;
gdk_color_black(cc->colormap, &colr);
gdk_color_black (cc->colormap, &colr);
cc->black_pixel = colr.pixel;
}
......@@ -277,9 +277,9 @@ init_color (GdkColorContext *cc)
ccp->blue_mult = 1;
ccp->base_pixel = 0;
gdk_color_white(cc->colormap, &colr);
gdk_color_white (cc->colormap, &colr);
cc->white_pixel = colr.pixel;
gdk_color_black(cc->colormap, &colr);
gdk_color_black (cc->colormap, &colr);
cc->black_pixel = colr.pixel;
cc->num_colors = cc->visual->colormap_size;
......@@ -1503,7 +1503,7 @@ gdk_color_context_add_palette (GdkColorContext *cc,
/* copy incoming palette */
cc->palette = g_new0(GdkColor, num_palette);
cc->palette = g_new0 (GdkColor, num_palette);
j = 0;
......
......@@ -32,6 +32,8 @@
#include "gdkcolor.h"
#include "gdkprivate-fb.h"
#define GDK_COLORMAP_PRIVATE_DATA(cmap) ((GdkColormapPrivateFB *) GDK_COLORMAP (cmap)->windowing_data)
static gint gdk_colormap_match_color (GdkColormap *cmap,
GdkColor *color,
const gchar *available);
......@@ -41,8 +43,8 @@ static gpointer parent_class;
static void
gdk_colormap_finalize (GObject *object)
{
GdkColormap *colormap = GDK_COLORMAP(object);
GdkColormapPrivateFB *private = (GdkColormapPrivateFB*) colormap;
GdkColormap *colormap = GDK_COLORMAP (object);
GdkColormapPrivateFB *private = GDK_COLORMAP_PRIVATE_DATA (colormap);
if (private->hash)
g_hash_table_destroy (private->hash);
......@@ -50,13 +52,17 @@ gdk_colormap_finalize (GObject *object)
g_free (private->info);
g_free (colormap->colors);
G_OBJECT_CLASS(parent_class)->finalize(object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gdk_colormap_init (GdkColormap *colormap)
{
colormap->windowing_data = NULL;
GdkColormapPrivateFB *private;
private = g_new (GdkColormapPrivateFB, 1);
colormap->windowing_data = private;
colormap->size = 0;
colormap->colors = NULL;
......@@ -81,13 +87,13 @@ gdk_colormap_get_type (void)
{
static const GTypeInfo object_info =
{
sizeof (GdkColormapFBClass),
sizeof (GdkColormapClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_colormap_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkColormapPrivateFB),
sizeof (GdkColormap),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_colormap_init,
};
......@@ -101,7 +107,7 @@ gdk_colormap_get_type (void)
return object_type;
}
GdkColormap*
GdkColormap *
gdk_colormap_new (GdkVisual *visual,
gint private_cmap)
{
......@@ -112,10 +118,10 @@ gdk_colormap_new (GdkVisual *visual,
g_return_val_if_fail (visual != NULL, NULL);
private = (GdkColormapPrivateFB *)g_object_new(gdk_colormap_get_type(), NULL);
colormap = (GdkColormap*) private;
colormap = g_object_new (gdk_colormap_get_type (), NULL);
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
private->base.visual = visual;
colormap->visual = visual;
fbd = gdk_display;
private->hash = NULL;
......@@ -144,7 +150,7 @@ gdk_colormap_new (GdkVisual *visual,
fbc.green = green;
fbc.blue = blue;
if(ioctl(fbd->fd, FBIOGETCMAP, &fbc))
if (ioctl (fbd->fd, FBIOGETCMAP, &fbc))
g_error("ioctl(FBIOGETCMAP) failed");
for (i = 0; i < colormap->size; i++)
......@@ -181,7 +187,7 @@ gdk_colormap_new (GdkVisual *visual,
break;
default:
g_assert_not_reached();
g_assert_not_reached ();
case GDK_VISUAL_TRUE_COLOR:
break;
......@@ -209,9 +215,9 @@ gdk_colormap_get_system (void)
guint16 red[256], green[256], blue[256];
struct fb_cmap fbc = {0, 256};
int i, r, g, b;
GdkVisual *visual = gdk_visual_get_system();
GdkVisual *visual = gdk_visual_get_system ();
if(visual->type == GDK_VISUAL_GRAYSCALE
if (visual->type == GDK_VISUAL_GRAYSCALE
|| visual->type == GDK_VISUAL_PSEUDO_COLOR)
{
fbc.red = red;
......@@ -236,7 +242,7 @@ gdk_colormap_get_system (void)
blue[i] = b * 65535 / 5;
i++;
}
g_assert(i == 216);
g_assert (i == 216);
/* Fill in remaining space with grays */
for(i = 216; i < 256; i++)
......@@ -251,10 +257,10 @@ gdk_colormap_get_system (void)
break;
}
ioctl(gdk_display->fd, FBIOPUTCMAP, &fbc);
ioctl (gdk_display->fd, FBIOPUTCMAP, &fbc);
}
colormap = gdk_colormap_new(visual, TRUE);
colormap = gdk_colormap_new (visual, TRUE);
}
return colormap;
......@@ -281,8 +287,8 @@ gdk_colormap_change (GdkColormap *colormap,
fbc.green = green;
fbc.blue = blue;
private = (GdkColormapPrivateFB*) colormap;
switch (private->base.visual->type)
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
switch (colormap->visual->type)
{
case GDK_VISUAL_GRAYSCALE:
for(i = 0; i < ncolors; i++)
......@@ -292,7 +298,7 @@ gdk_colormap_change (GdkColormap *colormap,
colormap->colors[i].green +
colormap->colors[i].blue)/3;
}
ioctl(gdk_display->fd, FBIOPUTCMAP, &fbc);
ioctl (gdk_display->fd, FBIOPUTCMAP, &fbc);
break;
case GDK_VISUAL_PSEUDO_COLOR:
......@@ -302,7 +308,7 @@ gdk_colormap_change (GdkColormap *colormap,
green[i] = colormap->colors[i].green;
blue[i] = colormap->colors[i].blue;
}
ioctl(gdk_display->fd, FBIOPUTCMAP, &fbc);
ioctl (gdk_display->fd, FBIOPUTCMAP, &fbc);
break;
default:
......@@ -320,34 +326,34 @@ gdk_color_parse (const gchar *spec,
g_return_val_if_fail(spec, FALSE);
g_return_val_if_fail(color, FALSE);
if(spec[0] == '#')
if (spec[0] == '#')
{
if(strlen(spec) == 7)
if (strlen(spec) == 7)
{
guint num;
sscanf(spec + 1, "%x", &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)
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");
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);
g_warning ("Couldn't parse color specifier `%s'", spec);
return FALSE;
}
......@@ -355,36 +361,36 @@ gdk_color_parse (const gchar *spec,
}
else
{
fh = fopen("/usr/lib/X11/rgb.txt", "r");
if(!fh)
fh = fopen ("/usr/lib/X11/rgb.txt", "r");
if (!fh)
return FALSE;
while(fgets(aline, sizeof(aline), fh))
while(fgets (aline, sizeof(aline), fh))
{
int red, green, blue;
char *ctmp;
g_strstrip(aline);
if(!aline[0] || aline[0] == '#' || aline[0] == '!')
g_strstrip (aline);
if (!aline[0] || aline[0] == '#' || aline[0] == '!')
continue;
ctmp = strtok(aline, " \t");
if(!ctmp)
ctmp = strtok (aline, " \t");
if (!ctmp)
continue;
red = atoi(ctmp);
red = atoi (ctmp);
ctmp = strtok(NULL, " \t");
if(!ctmp)
ctmp = strtok (NULL, " \t");
if (!ctmp)
continue;
green = atoi(ctmp);
green = atoi (ctmp);
ctmp = strtok(NULL, " \t");
if(!ctmp)
ctmp = strtok (NULL, " \t");
if (!ctmp)
continue;
blue = atoi(ctmp);
blue = atoi (ctmp);
ctmp = strtok(NULL, " \t");
if(!ctmp || strcmp(ctmp, spec))
ctmp = strtok (NULL, " \t");
if (!ctmp || strcmp (ctmp, spec))
continue;
color->red = red << 8;
......@@ -392,7 +398,7 @@ gdk_color_parse (const gchar *spec,
color->blue = blue << 8;
return TRUE;
}
fclose(fh);
fclose (fh);
}
return FALSE;
......@@ -409,10 +415,10 @@ gdk_colormap_free_colors (GdkColormap *colormap,
g_return_if_fail (colormap != NULL);
g_return_if_fail (colors != NULL);
private = (GdkColormapPrivateFB*) colormap;
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
if ((private->base.visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
(private->base.visual->type != GDK_VISUAL_GRAYSCALE))
if ((colormap->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
(colormap->visual->type != GDK_VISUAL_GRAYSCALE))
return;
for (i=0; i<ncolors; i++)
......@@ -448,40 +454,41 @@ gdk_colormap_alloc1 (GdkColormap *colormap,
GdkColormapPrivateFB *private;
int i;
private = (GdkColormapPrivateFB*) colormap;
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
if(private->base.visual->type != GDK_VISUAL_GRAYSCALE
&& private->base.visual->type != GDK_VISUAL_PSEUDO_COLOR)
if (colormap->visual->type != GDK_VISUAL_GRAYSCALE
&& colormap->visual->type != GDK_VISUAL_PSEUDO_COLOR)
return FALSE;
*ret = *color;
if(!color->red && !color->green && !color->blue) /* black */
if (!color->red && !color->green && !color->blue) /* black */
{
ret->pixel = 0;
private->info[ret->pixel].ref_count++;
return TRUE;
}
if(color->red == 65535 && color->green == 65535 && color->blue == 65535) /* white */
if (color->red == 65535 && color->green == 65535 && color->blue == 65535) /* white */
{
ret->pixel = 255;
private->info[ret->pixel].ref_count++;
return TRUE;
}
for(i = 1; i < (colormap->size - 1); i++)
for (i = 1; i < (colormap->size - 1); i++)
{
if(!private->info[i].ref_count