Cleanup and reindent of GtkFB.

Added some serial mouse support.
Updates to latest Gtk+/pango
This commit is contained in:
Alexander Larsson 2000-11-13 17:40:23 +00:00
parent b664be5ffb
commit be698675c7
28 changed files with 2539 additions and 2344 deletions

View File

@ -1,3 +1,55 @@
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,

View File

@ -1,3 +1,55 @@
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,

View File

@ -1,3 +1,55 @@
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,

View File

@ -1,3 +1,55 @@
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,

View File

@ -1,3 +1,55 @@
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,

View File

@ -1,3 +1,55 @@
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,

View File

@ -1,3 +1,55 @@
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,

View File

@ -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;

View File

@ -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);
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");
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)
if (!private->info[i].ref_count)
{
guint16 red = color->red, green = color->green, blue = color->blue;
struct fb_cmap fbc;
fbc.len = 1;
fbc.start = i;
fbc.red = &red;
fbc.green = &green;
fbc.blue = &blue;
ioctl(gdk_display->fd, FBIOPUTCMAP, &fbc);
ioctl (gdk_display->fd, FBIOPUTCMAP, &fbc);
ret->pixel = i;
colormap->colors[ret->pixel] = *ret;
@ -509,7 +516,7 @@ gdk_colormap_alloc_colors_shared (GdkColormap *colormap,
gint nremaining = 0;
gint nfailed = 0;
private = (GdkColormapPrivateFB*) colormap;
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
index = -1;
for (i=0; i<ncolors; i++)
@ -601,7 +608,7 @@ gdk_colormap_alloc_colors_pseudocolor (GdkColormap *colormap,
gint i;
gint nremaining = 0;
private = (GdkColormapPrivateFB*) colormap;
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
/* Check for an exact match among previously allocated colors */
@ -646,12 +653,13 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
g_return_val_if_fail (colormap != NULL, FALSE);
g_return_val_if_fail (colors != NULL, FALSE);
private = (GdkColormapPrivateFB*) colormap;
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
for (i=0; i<ncolors; i++)
success[i] = FALSE;
switch (private->base.visual->type)
visual = colormap->visual;
switch (visual->type)
{
case GDK_VISUAL_PSEUDO_COLOR:
case GDK_VISUAL_GRAYSCALE:
@ -663,8 +671,6 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
case GDK_VISUAL_DIRECT_COLOR:
case GDK_VISUAL_TRUE_COLOR:
visual = private->base.visual;
for (i=0; i<ncolors; i++)
{
colors[i].pixel = (((colors[i].red >> (16 - visual->red_prec)) << visual->red_shift) +
@ -687,9 +693,9 @@ gdk_color_change (GdkColormap *colormap,
g_return_val_if_fail (colormap != NULL, FALSE);
g_return_val_if_fail (color != NULL, FALSE);
private = (GdkColormapPrivateFB*) colormap;
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
switch(private->base.visual->type)
switch(colormap->visual->type)
{
case GDK_VISUAL_GRAYSCALE:
color->red = color->green = color->blue = (color->red + color->green + color->blue)/3;
@ -699,7 +705,7 @@ gdk_color_change (GdkColormap *colormap,
fbc.red = &color->red;
fbc.green = &color->green;
fbc.blue = &color->blue;
ioctl(gdk_display->fd, FBIOPUTCMAP, &fbc);
ioctl (gdk_display->fd, FBIOPUTCMAP, &fbc);
break;
default:
@ -747,20 +753,21 @@ gdk_colormap_match_color (GdkColormap *cmap,
return index;
}
gint gdk_colors_alloc (GdkColormap *colormap,
gboolean contiguous,
gulong *planes,
gint nplanes,
gulong *pixels,
gint npixels)
gint
gdk_colors_alloc (GdkColormap *colormap,
gboolean contiguous,
gulong *planes,
gint nplanes,
gulong *pixels,
gint npixels)
{
return 0;
}
void
gdk_colors_free (GdkColormap *colormap,
gulong *pixels,
gint npixels,
gulong planes)
gdk_colors_free (GdkColormap *colormap,
gulong *pixels,
gint npixels,
gulong planes)
{
}

View File

@ -191,17 +191,15 @@ static struct {
{xterm_mask_bits, xterm_mask_width, xterm_mask_height, xterm_mask_x_hot, xterm_mask_y_hot}
};
GdkCursor*
static GdkCursor *
_gdk_cursor_new_from_pixmap (GdkPixmap *source,
GdkPixmap *mask,
GdkColor *fg,
GdkColor *bg,
gint x,
gint y,
gint mask_off_x,
gint mask_off_y)
gint mask_off_x,
gint mask_off_y)
{
GdkCursorPrivateFB *private;
GdkCursor *cursor;
@ -212,8 +210,8 @@ _gdk_cursor_new_from_pixmap (GdkPixmap *source,
cursor = (GdkCursor *) private;
cursor->type = GDK_CURSOR_IS_PIXMAP;
cursor->ref_count = 1;
private->cursor = gdk_pixmap_ref(source);
private->mask = gdk_pixmap_ref(mask);
private->cursor = gdk_pixmap_ref (source);
private->mask = gdk_pixmap_ref (mask);
private->hot_x = x;
private->hot_y = y;
private->mask_off_x = mask_off_x;
@ -227,33 +225,34 @@ gdk_cursor_new (GdkCursorType cursor_type)
{
GdkPixmap *pm, *mask;
if(cursor_type >= sizeof(stock_cursors)/sizeof(stock_cursors[0]))
if (cursor_type >= sizeof(stock_cursors)/sizeof(stock_cursors[0]))
return NULL;
pm = stock_cursors[cursor_type].pm;
if(!pm)
if (!pm)
{
pm = stock_cursors[cursor_type].pm = gdk_bitmap_create_from_data(gdk_parent_root,
stock_cursors[cursor_type].bits,
stock_cursors[cursor_type].width,
stock_cursors[cursor_type].height);
gdk_pixmap_ref(pm);
pm = stock_cursors[cursor_type].pm = gdk_bitmap_create_from_data (gdk_parent_root,
stock_cursors[cursor_type].bits,
stock_cursors[cursor_type].width,
stock_cursors[cursor_type].height);
gdk_pixmap_ref (pm);
}
mask = stock_cursors[cursor_type+1].pm;
if(!mask)
if (!mask)
{
mask = stock_cursors[cursor_type+1].pm = gdk_bitmap_create_from_data(gdk_parent_root,
stock_cursors[cursor_type+1].bits,
stock_cursors[cursor_type+1].width,
stock_cursors[cursor_type+1].height);
gdk_pixmap_ref(mask);
mask = stock_cursors[cursor_type+1].pm = gdk_bitmap_create_from_data (gdk_parent_root,
stock_cursors[cursor_type+1].bits,
stock_cursors[cursor_type+1].width,
stock_cursors[cursor_type+1].height);
gdk_pixmap_ref (mask);
}
return _gdk_cursor_new_from_pixmap(pm, mask, NULL, NULL,
stock_cursors[cursor_type].hotx,
stock_cursors[cursor_type].hoty,
(stock_cursors[cursor_type].hotx - stock_cursors[cursor_type+1].hotx) * 1,
(stock_cursors[cursor_type].hoty - stock_cursors[cursor_type+1].hoty) * 1);
return _gdk_cursor_new_from_pixmap (pm, mask, NULL, NULL,
stock_cursors[cursor_type].hotx,
stock_cursors[cursor_type].hoty,
(stock_cursors[cursor_type].hotx - stock_cursors[cursor_type+1].hotx) * 1,
(stock_cursors[cursor_type].hoty - stock_cursors[cursor_type+1].hoty) * 1);
}
GdkCursor*
@ -264,7 +263,7 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
gint x,
gint y)
{
return _gdk_cursor_new_from_pixmap(source, mask, fg, bg, x, y, 0, 0);
return _gdk_cursor_new_from_pixmap (source, mask, fg, bg, x, y, 0, 0);
}
void

View File

@ -45,8 +45,6 @@ typedef enum {
* this is used on both source and destination sides.
*/
struct _GdkDragContextPrivate {
GdkDragContext context;
guint ref_count;
};
@ -55,11 +53,12 @@ struct _GdkDragContextPrivate {
static GList *contexts;
static gpointer parent_class = NULL;
#define GDK_DRAG_CONTEXT_PRIVATE_DATA(ctx) ((GdkDragContextPrivate *) GDK_DRAG_CONTEXT (ctx)->windowing_data)
static void
gdk_drag_context_init (GdkDragContext *dragcontext)
{
dragcontext->windowing_data = NULL;
dragcontext->windowing_data = g_new (GdkDragContextPrivate, 1);
contexts = g_list_prepend (contexts, dragcontext);
}
@ -68,16 +67,22 @@ static void
gdk_drag_context_finalize (GObject *object)
{
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
GdkDragContextPrivate *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (object);
g_list_free (context->targets);
if (context->source_window)
{
gdk_window_unref (context->source_window);
}
gdk_window_unref (context->source_window);
if (context->dest_window)
gdk_window_unref (context->dest_window);
if (private)
{
g_free (private);
context->windowing_data = NULL;
}
contexts = g_list_remove (contexts, context);
@ -127,19 +132,19 @@ gdk_drag_context_get_type (void)
GdkDragContext *
gdk_drag_context_new (void)
{
return (GdkDragContext *)g_object_new(gdk_drag_context_get_type (), NULL);
return (GdkDragContext *)g_object_new (gdk_drag_context_get_type (), NULL);
}
void
gdk_drag_context_ref (GdkDragContext *context)
{
g_object_ref(G_OBJECT(context));
g_object_ref (G_OBJECT (context));
}
void
gdk_drag_context_unref (GdkDragContext *context)
{
g_object_unref(G_OBJECT(context));
g_object_unref (G_OBJECT (context));
}
/*************************************************************
@ -207,9 +212,9 @@ gdk_drag_find_window (GdkDragContext *context,
{
g_return_if_fail (context != NULL);
*dest_window = gdk_window_get_pointer(NULL, &x_root, &y_root, NULL);
if(*dest_window)
gdk_window_ref(*dest_window);
*dest_window = gdk_window_get_pointer (NULL, &x_root, &y_root, NULL);
if (*dest_window)
gdk_window_ref (*dest_window);
}
gboolean

File diff suppressed because it is too large Load Diff

View File

@ -90,16 +90,17 @@ static GSourceFuncs event_funcs = {
* Functions for maintaining the event queue *
*********************************************/
static gboolean fb_events_prepare(gpointer source_data,
GTimeVal *current_time,
gint *timeout,
gpointer user_data);
static gboolean fb_events_check(gpointer source_data,
GTimeVal *current_time,
gpointer user_data);
static gboolean fb_events_dispatch(gpointer source_data,
GTimeVal *dispatch_time,
gpointer user_data);
static gboolean fb_events_prepare (gpointer source_data,
GTimeVal *current_time,
gint *timeout,
gpointer user_data);
static gboolean fb_events_check (gpointer source_data,
GTimeVal *current_time,
gpointer user_data);
static gboolean fb_events_dispatch (gpointer source_data,
GTimeVal *dispatch_time,
gpointer user_data);
void
gdk_events_init (void)
{
@ -110,7 +111,7 @@ gdk_events_init (void)
NULL
};
g_source_add(GDK_PRIORITY_EVENTS, TRUE, &fb_events_funcs, NULL, NULL, NULL);
g_source_add (GDK_PRIORITY_EVENTS, TRUE, &fb_events_funcs, NULL, NULL, NULL);
}
/*
@ -132,7 +133,7 @@ gdk_events_init (void)
gboolean
gdk_events_pending (void)
{
return gdk_event_queue_find_first()?TRUE:FALSE;
return gdk_event_queue_find_first () ? TRUE : FALSE;
}
GdkEvent*
@ -141,20 +142,20 @@ gdk_event_get_graphics_expose (GdkWindow *window)
GList *ltmp;
g_return_val_if_fail (window != NULL, NULL);
for(ltmp = gdk_queued_events; ltmp; ltmp = ltmp->next)
for (ltmp = gdk_queued_events; ltmp; ltmp = ltmp->next)
{
GdkEvent *event = ltmp->data;
if(event->type == GDK_EXPOSE
&& event->expose.window == window)
if (event->type == GDK_EXPOSE &&
event->expose.window == window)
break;
}
if(ltmp)
if (ltmp)
{
GdkEvent *retval = ltmp->data;
gdk_event_queue_remove_link(ltmp);
g_list_free_1(ltmp);
gdk_event_queue_remove_link (ltmp);
g_list_free_1 (ltmp);
return retval;
}
@ -168,53 +169,58 @@ gdk_events_queue (void)
}
static gboolean
fb_events_prepare(gpointer source_data,
GTimeVal *current_time,
gint *timeout,
gpointer user_data)
fb_events_prepare (gpointer source_data,
GTimeVal *current_time,
gint *timeout,
gpointer user_data)
{
*timeout = -1;
return fb_events_check(source_data, current_time, user_data);
return fb_events_check (source_data, current_time, user_data);
}
static gboolean
fb_events_check(gpointer source_data,
GTimeVal *current_time,
gpointer user_data)
fb_events_check (gpointer source_data,
GTimeVal *current_time,
gpointer user_data)
{
gboolean retval;
GDK_THREADS_ENTER();
GDK_THREADS_ENTER ();
retval = (gdk_event_queue_find_first () != NULL);
GDK_THREADS_LEAVE();
GDK_THREADS_LEAVE ();
return retval;
}
static gboolean
fb_events_dispatch(gpointer source_data, GTimeVal *dispatch_time, gpointer user_data)
fb_events_dispatch (gpointer source_data,
GTimeVal *dispatch_time,
gpointer user_data)
{
GdkEvent *event;
GDK_THREADS_ENTER();
GDK_THREADS_ENTER ();
while((event = gdk_event_unqueue()))
while (event = gdk_event_unqueue ())
{
if(event->type == GDK_EXPOSE
&& event->expose.window == gdk_parent_root)
gdk_window_clear_area(event->expose.window, event->expose.area.x, event->expose.area.y, event->expose.area.width,
event->expose.area.height);
if (event->type == GDK_EXPOSE &&
event->expose.window == gdk_parent_root)
gdk_window_clear_area (event->expose.window,
event->expose.area.x,
event->expose.area.y,
event->expose.area.width,
event->expose.area.height);
else if(gdk_event_func)
(*gdk_event_func)(event, gdk_event_data);
else if (gdk_event_func)
(*gdk_event_func) (event, gdk_event_data);
gdk_event_free(event);
gdk_event_free (event);
}
GDK_THREADS_LEAVE();
GDK_THREADS_LEAVE ();
return TRUE;
}
@ -248,6 +254,7 @@ gdk_event_send_client_message (GdkEvent *event, guint32 xid)
return FALSE;
}
void gdk_event_send_clientmessage_toall (GdkEvent *sev)
void
gdk_event_send_clientmessage_toall (GdkEvent *sev)
{
}

View File

@ -44,9 +44,9 @@ gdk_font_from_description (PangoFontDescription *font_desc)
GdkFont *font;
GdkFontPrivateFB *private;
g_return_val_if_fail(font_desc, NULL);
g_return_val_if_fail (font_desc, NULL);
private = g_new0(GdkFontPrivateFB, 1);
private = g_new0 (GdkFontPrivateFB, 1);
font = (GdkFont *)private;
private->base.ref_count = 1;
@ -166,6 +166,12 @@ gdk_fontset_load (const gchar *fontset_name)
}
#endif
GdkFont *
gdk_font_load (const gchar *font_name)
{
return NULL;
}
void
_gdk_font_destroy (GdkFont *font)
{
@ -370,10 +376,17 @@ gdk_text_extents_wc (GdkFont *font,
char *realstr;
int i;
realstr = alloca(text_length + 1);
realstr = alloca (text_length + 1);
for(i = 0; i < text_length; i++)
realstr[i] = text[i];
realstr[i] = '\0';
return gdk_text_extents(font, realstr, text_length, lbearing, rbearing, width, ascent, descent);
return gdk_text_extents (font,
realstr,
text_length,
lbearing,
rbearing,
width,
ascent,
descent);
}

View File

@ -11,16 +11,16 @@ typedef enum {
GDK_GC_DIRTY_TS = 1 << 1
} GdkGCDirtyValues;
static void gdk_fb_gc_finalize (GObject *obj);
static void gdk_fb_gc_finalize (GObject *obj);
static void gdk_fb_gc_get_values (GdkGC *gc,
GdkGCValues *values);
GdkGCValues *values);
static void gdk_fb_gc_set_values (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask values_mask);
static void gdk_fb_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gint8 dash_list[],
gint n);
GdkGCValues *values,
GdkGCValuesMask values_mask);
static void gdk_fb_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gint8 dash_list[],
gint n);
static gpointer parent_class = NULL;
@ -39,7 +39,8 @@ gdk_gc_fb_class_init (GdkGCFBClass *klass)
gc_class->set_dashes = gdk_fb_gc_set_dashes;
}
GType gdk_gc_fb_get_type (void)
GType
gdk_gc_fb_get_type (void)
{
static GType object_type = 0;
@ -76,14 +77,14 @@ _gdk_fb_gc_new (GdkDrawable *drawable,
GdkGC *private;
GdkGCFBData *data;
gc = GDK_GC(g_object_new (gdk_gc_fb_get_type (), NULL));
gc = GDK_GC (g_object_new (gdk_gc_fb_get_type (), NULL));
private = (GdkGC *)gc;
data = (GdkGCFBData *)gc;
data->values.foreground.pixel = 255;
data->values.foreground.red = data->values.foreground.green = data->values.foreground.blue = 65535;
gdk_fb_gc_set_values(gc, values, values_mask);
gdk_fb_gc_set_values (gc, values, values_mask);
return gc;
}
@ -91,16 +92,19 @@ _gdk_fb_gc_new (GdkDrawable *drawable,
static void
gdk_fb_gc_finalize (GObject *obj)
{
GdkGC *gc = GDK_GC_P(obj);
GdkGC *gc = GDK_GC_P (obj);
GdkGCFBData *private;
if (GDK_GC_FBDATA (gc)->clip_region)
gdk_region_destroy (GDK_GC_FBDATA (gc)->clip_region);
if (GDK_GC_FBDATA (gc)->values.clip_mask)
gdk_pixmap_unref(GDK_GC_FBDATA (gc)->values.clip_mask);
if (GDK_GC_FBDATA (gc)->values.stipple)
gdk_pixmap_unref(GDK_GC_FBDATA (gc)->values.stipple);
if (GDK_GC_FBDATA (gc)->values.tile)
gdk_pixmap_unref(GDK_GC_FBDATA (gc)->values.tile);
private = GDK_GC_FBDATA (gc);
if (private->clip_region)
gdk_region_destroy (private->clip_region);
if (private->values.clip_mask)
gdk_pixmap_unref (private->values.clip_mask);
if (private->values.stipple)
gdk_pixmap_unref (private->values.stipple);
if (private->values.tile)
gdk_pixmap_unref (private->values.tile);
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
@ -109,7 +113,7 @@ static void
gdk_fb_gc_get_values (GdkGC *gc,
GdkGCValues *values)
{
*values = GDK_GC_FBDATA(gc)->values;
*values = GDK_GC_FBDATA (gc)->values;
}
@ -120,137 +124,140 @@ gdk_fb_gc_set_values (GdkGC *gc,
{
GdkPixmap *oldpm;
GdkFont *oldf;
GdkGCFBData *private;
if(values_mask & GDK_GC_FOREGROUND)
private = GDK_GC_FBDATA (gc);
if (values_mask & GDK_GC_FOREGROUND)
{
GDK_GC_FBDATA(gc)->values.foreground = values->foreground;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_FOREGROUND;
private->values.foreground = values->foreground;
private->values_mask |= GDK_GC_FOREGROUND;
}
if(values_mask & GDK_GC_BACKGROUND)
if (values_mask & GDK_GC_BACKGROUND)
{
GDK_GC_FBDATA(gc)->values.background = values->background;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_BACKGROUND;
private->values.background = values->background;
private->values_mask |= GDK_GC_BACKGROUND;
}
if(values_mask & GDK_GC_FONT)
if (values_mask & GDK_GC_FONT)
{
oldf = GDK_GC_FBDATA(gc)->values.font;
GDK_GC_FBDATA(gc)->values.font = gdk_font_ref(values->font);
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_FONT;
if(oldf)
oldf = private->values.font;
private->values.font = gdk_font_ref (values->font);
private->values_mask |= GDK_GC_FONT;
if (oldf)
gdk_font_unref(oldf);
}
if(values_mask & GDK_GC_FUNCTION)
if (values_mask & GDK_GC_FUNCTION)
{
GDK_GC_FBDATA(gc)->values.function = values->function;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_FUNCTION;
private->values.function = values->function;
private->values_mask |= GDK_GC_FUNCTION;
}
if(values_mask & GDK_GC_FILL)
if (values_mask & GDK_GC_FILL)
{
GDK_GC_FBDATA(gc)->values.fill = values->fill;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_FILL;
private->values.fill = values->fill;
private->values_mask |= GDK_GC_FILL;
}
if(values_mask & GDK_GC_TILE)
if (values_mask & GDK_GC_TILE)
{
oldpm = GDK_GC_FBDATA(gc)->values.tile;
if(values->tile)
g_assert(GDK_DRAWABLE_IMPL_FBDATA(values->tile)->depth >= 8);
oldpm = private->values.tile;
if (values->tile)
g_assert (GDK_DRAWABLE_IMPL_FBDATA (values->tile)->depth >= 8);
GDK_GC_FBDATA(gc)->values.tile = values->tile?gdk_pixmap_ref(values->tile):NULL;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_TILE;
if(oldpm)
gdk_pixmap_unref(oldpm);
private->values.tile = values->tile ? gdk_pixmap_ref (values->tile) : NULL;
private->values_mask |= GDK_GC_TILE;
if (oldpm)
gdk_pixmap_unref (oldpm);
}
if(values_mask & GDK_GC_STIPPLE)
if (values_mask & GDK_GC_STIPPLE)
{
oldpm = GDK_GC_FBDATA(gc)->values.stipple;
if(values->stipple)
g_assert(GDK_DRAWABLE_IMPL_FBDATA(values->stipple)->depth == 1);
GDK_GC_FBDATA(gc)->values.stipple = values->stipple?gdk_pixmap_ref(values->stipple):NULL;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_STIPPLE;
if(oldpm)
gdk_pixmap_unref(oldpm);
oldpm = private->values.stipple;
if (values->stipple)
g_assert (GDK_DRAWABLE_IMPL_FBDATA (values->stipple)->depth == 1);
private->values.stipple = values->stipple ? gdk_pixmap_ref (values->stipple) : NULL;
private->values_mask |= GDK_GC_STIPPLE;
if (oldpm)
gdk_pixmap_unref (oldpm);
}
if(values_mask & GDK_GC_CLIP_MASK)
if (values_mask & GDK_GC_CLIP_MASK)
{
oldpm = GDK_GC_FBDATA(gc)->values.clip_mask;
oldpm = private->values.clip_mask;
GDK_GC_FBDATA(gc)->values.clip_mask = values->clip_mask?gdk_pixmap_ref(values->clip_mask):NULL;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_CLIP_MASK;
if(oldpm)
gdk_pixmap_unref(oldpm);
private->values.clip_mask = values->clip_mask ? gdk_pixmap_ref (values->clip_mask) : NULL;
private->values_mask |= GDK_GC_CLIP_MASK;
if (oldpm)
gdk_pixmap_unref (oldpm);
if(GDK_GC_FBDATA(gc)->clip_region)
if (private->clip_region)
{
gdk_region_destroy(GDK_GC_FBDATA(gc)->clip_region);
GDK_GC_FBDATA(gc)->clip_region = NULL;
gdk_region_destroy (private->clip_region);
private->clip_region = NULL;
}
}
if(values_mask & GDK_GC_SUBWINDOW)
if (values_mask & GDK_GC_SUBWINDOW)
{
GDK_GC_FBDATA(gc)->values.subwindow_mode = values->subwindow_mode;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_SUBWINDOW;
private->values.subwindow_mode = values->subwindow_mode;
private->values_mask |= GDK_GC_SUBWINDOW;
}
if(values_mask & GDK_GC_TS_X_ORIGIN)
if (values_mask & GDK_GC_TS_X_ORIGIN)
{
GDK_GC_FBDATA(gc)->values.ts_x_origin = values->ts_x_origin;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_TS_X_ORIGIN;
private->values.ts_x_origin = values->ts_x_origin;
private->values_mask |= GDK_GC_TS_X_ORIGIN;
}
if(values_mask & GDK_GC_TS_Y_ORIGIN)
if (values_mask & GDK_GC_TS_Y_ORIGIN)
{
GDK_GC_FBDATA(gc)->values.ts_y_origin = values->ts_y_origin;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_TS_Y_ORIGIN;
private->values.ts_y_origin = values->ts_y_origin;
private->values_mask |= GDK_GC_TS_Y_ORIGIN;
}
if(values_mask & GDK_GC_CLIP_X_ORIGIN)
if (values_mask & GDK_GC_CLIP_X_ORIGIN)
{
GDK_GC_FBDATA(gc)->values.clip_x_origin = GDK_GC_P(gc)->clip_x_origin = values->clip_x_origin;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_CLIP_X_ORIGIN;
private->values.clip_x_origin = GDK_GC_P (gc)->clip_x_origin = values->clip_x_origin;
private->values_mask |= GDK_GC_CLIP_X_ORIGIN;
}
if(values_mask & GDK_GC_CLIP_Y_ORIGIN)
if (values_mask & GDK_GC_CLIP_Y_ORIGIN)
{
GDK_GC_FBDATA(gc)->values.clip_y_origin = GDK_GC_P(gc)->clip_y_origin = values->clip_y_origin;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_CLIP_Y_ORIGIN;
private->values.clip_y_origin = GDK_GC_P(gc)->clip_y_origin = values->clip_y_origin;
private->values_mask |= GDK_GC_CLIP_Y_ORIGIN;
}
if(values_mask & GDK_GC_EXPOSURES)
if (values_mask & GDK_GC_EXPOSURES)
{
GDK_GC_FBDATA(gc)->values.graphics_exposures = values->graphics_exposures;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_EXPOSURES;
private->values.graphics_exposures = values->graphics_exposures;
private->values_mask |= GDK_GC_EXPOSURES;
}
if(values_mask & GDK_GC_LINE_WIDTH)
if (values_mask & GDK_GC_LINE_WIDTH)
{
GDK_GC_FBDATA(gc)->values.line_width = values->line_width;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_LINE_WIDTH;
private->values.line_width = values->line_width;
private->values_mask |= GDK_GC_LINE_WIDTH;
}
if(values_mask & GDK_GC_LINE_STYLE)
if (values_mask & GDK_GC_LINE_STYLE)
{
GDK_GC_FBDATA(gc)->values.line_style = values->line_style;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_LINE_STYLE;
private->values.line_style = values->line_style;
private->values_mask |= GDK_GC_LINE_STYLE;
}
if(values_mask & GDK_GC_CAP_STYLE)
if (values_mask & GDK_GC_CAP_STYLE)
{
GDK_GC_FBDATA(gc)->values.cap_style = values->cap_style;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_CAP_STYLE;
private->values.cap_style = values->cap_style;
private->values_mask |= GDK_GC_CAP_STYLE;
}
if(values_mask & GDK_GC_JOIN_STYLE)
if (values_mask & GDK_GC_JOIN_STYLE)
{
GDK_GC_FBDATA(gc)->values.join_style = values->join_style;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_JOIN_STYLE;
private->values.join_style = values->join_style;
private->values_mask |= GDK_GC_JOIN_STYLE;
}
}
@ -260,17 +267,22 @@ gdk_fb_gc_set_dashes (GdkGC *gc,
gint8 dash_list[],
gint n)
{
GDK_GC_FBDATA(gc)->dash_offset = dash_offset;
GDK_GC_FBDATA(gc)->dash_list_len = n;
if(n)
GdkGCFBData *private;
private = GDK_GC_FBDATA (gc);
private->dash_offset = dash_offset;
private->dash_list_len = n;
if (n)
{
GDK_GC_FBDATA(gc)->dash_list = g_realloc(GDK_GC_FBDATA(gc)->dash_list, n);
memcpy(GDK_GC_FBDATA(gc)->dash_list, dash_list, n);
private->dash_list = g_realloc (private->dash_list, n);
memcpy (private->dash_list, dash_list, n);
}
else
{
g_free(GDK_GC_FBDATA(gc)->dash_list);
GDK_GC_FBDATA(gc)->dash_list = NULL;
g_free (private->dash_list);
private->dash_list = NULL;
}
}
@ -279,13 +291,15 @@ gc_unset_cmask(GdkGC *gc)
{
GdkGCFBData *data;
data = GDK_GC_FBDATA (gc);
if(data->values.clip_mask)
if (data->values.clip_mask)
{
gdk_pixmap_unref(data->values.clip_mask);
gdk_pixmap_unref (data->values.clip_mask);
data->values.clip_mask = NULL;
data->values_mask &= ~ GDK_GC_CLIP_MASK;
}
}
void
gdk_gc_set_clip_rectangle (GdkGC *gc,
GdkRectangle *rectangle)
@ -311,7 +325,7 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
data->values.clip_x_origin = 0;
data->values.clip_y_origin = 0;
gc_unset_cmask(gc);
gc_unset_cmask (gc);
}
void
@ -325,7 +339,7 @@ gdk_gc_set_clip_region (GdkGC *gc,
data = GDK_GC_FBDATA (gc);
if(region == data->clip_region)
if (region == data->clip_region)
return;
if (data->clip_region)
@ -342,37 +356,41 @@ gdk_gc_set_clip_region (GdkGC *gc,
data->values.clip_x_origin = 0;
data->values.clip_y_origin = 0;
gc_unset_cmask(gc);
gc_unset_cmask (gc);
}
void
gdk_gc_copy (GdkGC *dst_gc, GdkGC *src_gc)
{
GdkGCFBData *dst_private;
dst_private = GDK_GC_FBDATA (dst_gc);
g_return_if_fail (dst_gc != NULL);
g_return_if_fail (src_gc != NULL);
if(GDK_GC_FBDATA(dst_gc)->clip_region)
gdk_region_destroy(GDK_GC_FBDATA(dst_gc)->clip_region);
if (dst_private->clip_region)
gdk_region_destroy(dst_private->clip_region);
if(GDK_GC_FBDATA(dst_gc)->values_mask & GDK_GC_FONT)
gdk_font_unref(GDK_GC_FBDATA(dst_gc)->values.font);
if(GDK_GC_FBDATA(dst_gc)->values_mask & GDK_GC_TILE)
gdk_pixmap_unref(GDK_GC_FBDATA(dst_gc)->values.tile);
if(GDK_GC_FBDATA(dst_gc)->values_mask & GDK_GC_STIPPLE)
gdk_pixmap_unref(GDK_GC_FBDATA(dst_gc)->values.stipple);
if(GDK_GC_FBDATA(dst_gc)->values_mask & GDK_GC_CLIP_MASK)
gdk_pixmap_unref(GDK_GC_FBDATA(dst_gc)->values.clip_mask);
if (dst_private->values_mask & GDK_GC_FONT)
gdk_font_unref(dst_private->values.font);
if (dst_private->values_mask & GDK_GC_TILE)
gdk_pixmap_unref(dst_private->values.tile);
if (dst_private->values_mask & GDK_GC_STIPPLE)
gdk_pixmap_unref(dst_private->values.stipple);
if (dst_private->values_mask & GDK_GC_CLIP_MASK)
gdk_pixmap_unref(dst_private->values.clip_mask);
*dst_gc = *src_gc;
if(GDK_GC_FBDATA(dst_gc)->values_mask & GDK_GC_FONT)
gdk_font_ref(GDK_GC_FBDATA(dst_gc)->values.font);
if(GDK_GC_FBDATA(dst_gc)->values_mask & GDK_GC_TILE)
gdk_pixmap_ref(GDK_GC_FBDATA(dst_gc)->values.tile);
if(GDK_GC_FBDATA(dst_gc)->values_mask & GDK_GC_STIPPLE)
gdk_pixmap_ref(GDK_GC_FBDATA(dst_gc)->values.stipple);
if(GDK_GC_FBDATA(dst_gc)->values_mask & GDK_GC_CLIP_MASK)
gdk_pixmap_ref(GDK_GC_FBDATA(dst_gc)->values.clip_mask);
if(GDK_GC_FBDATA(dst_gc)->clip_region)
GDK_GC_FBDATA(dst_gc)->clip_region = gdk_region_copy(GDK_GC_FBDATA(dst_gc)->clip_region);
if (dst_private->values_mask & GDK_GC_FONT)
gdk_font_ref(dst_private->values.font);
if (dst_private->values_mask & GDK_GC_TILE)
gdk_pixmap_ref(dst_private->values.tile);
if (dst_private->values_mask & GDK_GC_STIPPLE)
gdk_pixmap_ref(dst_private->values.stipple);
if (dst_private->values_mask & GDK_GC_CLIP_MASK)
gdk_pixmap_ref(dst_private->values.clip_mask);
if (dst_private->clip_region)
dst_private->clip_region = gdk_region_copy(dst_private->clip_region);
}

View File

@ -5,7 +5,7 @@ gdk_window_scroll (GdkWindow *window,
gint dx,
gint dy)
{
GdkWindowObject *private = GDK_WINDOW_P(window);
GdkWindowObject *private = GDK_WINDOW_P (window);
GdkRegion *invalidate_region;
GdkRectangle dest_rect;
GdkRectangle clip_rect;
@ -15,13 +15,13 @@ gdk_window_scroll (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
clip_rect.x = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x;
clip_rect.y = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y;
clip_rect.width = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_x - GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x;
clip_rect.height = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_y - GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y;
handle_cursor = gdk_fb_cursor_need_hide(&clip_rect);
clip_rect.x -= GDK_DRAWABLE_IMPL_FBDATA(window)->abs_x;
clip_rect.y -= GDK_DRAWABLE_IMPL_FBDATA(window)->abs_y;
clip_rect.x = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
clip_rect.y = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
clip_rect.width = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_x - GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
clip_rect.height = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_y - GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
handle_cursor = gdk_fb_cursor_need_hide (&clip_rect);
clip_rect.x -= GDK_DRAWABLE_IMPL_FBDATA (window)->abs_x;
clip_rect.y -= GDK_DRAWABLE_IMPL_FBDATA (window)->abs_y;
invalidate_region = gdk_region_rectangle (&clip_rect);
dest_rect = clip_rect;
@ -29,8 +29,8 @@ gdk_window_scroll (GdkWindow *window,
dest_rect.y += dy;
gdk_rectangle_intersect (&dest_rect, &clip_rect, &dest_rect);
if(handle_cursor)
gdk_fb_cursor_hide();
if (handle_cursor)
gdk_fb_cursor_hide ();
if (dest_rect.width > 0 && dest_rect.height > 0)
{
@ -40,20 +40,27 @@ gdk_window_scroll (GdkWindow *window,
gdk_region_subtract (invalidate_region, tmp_region);
gdk_region_destroy (tmp_region);
gdk_fb_draw_drawable_2(GDK_DRAWABLE_IMPL(window), NULL, GDK_DRAWABLE_IMPL(window), dest_rect.x - dx, dest_rect.y - dy, dest_rect.x, dest_rect.y,
dest_rect.width, dest_rect.height,
FALSE, FALSE);
gdk_fb_draw_drawable_2 (GDK_DRAWABLE_IMPL(window),
NULL,
GDK_DRAWABLE_IMPL(window),
dest_rect.x - dx,
dest_rect.y - dy,
dest_rect.x, dest_rect.y,
dest_rect.width, dest_rect.height,
FALSE, FALSE);
}
gdk_window_invalidate_region (window, invalidate_region, TRUE);
gdk_region_destroy (invalidate_region);
for(tmp_list = private->children; tmp_list; tmp_list = tmp_list->next)
for (tmp_list = private->children; tmp_list; tmp_list = tmp_list->next)
gdk_fb_window_move_resize (tmp_list->data,
GDK_WINDOW_OBJECT(tmp_list->data)->x + dx, GDK_WINDOW_OBJECT(tmp_list->data)->y + dy,
GDK_WINDOW_OBJECT(tmp_list->data)->x + dx,
GDK_WINDOW_OBJECT(tmp_list->data)->y + dy,
GDK_DRAWABLE_IMPL_FBDATA(tmp_list->data)->width,
GDK_DRAWABLE_IMPL_FBDATA(tmp_list->data)->height,
FALSE);
if(handle_cursor)
gdk_fb_cursor_unhide();
if (handle_cursor)
gdk_fb_cursor_unhide ();
}

View File

@ -26,11 +26,6 @@
#include <config.h>
#include <endian.h>
#ifndef __BYTE_ORDER
#error "endian.h needs to #define __BYTE_ORDER"
#endif
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
@ -42,13 +37,17 @@
static gpointer parent_class = NULL;
void _gdk_windowing_image_init(void)
#define GDK_IMAGE_PRIVATE_DATA(image) ((GdkImagePrivateFB *) GDK_IMAGE (image)->windowing_data)
void
_gdk_windowing_image_init (void)
{
}
static void
gdk_image_init (GdkImage *image)
{
image->windowing_data = g_new0 (GdkImagePrivateFB, 1);
}
static void
@ -56,11 +55,11 @@ gdk_image_finalize (GObject *object)
{
GdkImage *image = GDK_IMAGE (object);
GdkImagePrivateFB *private;
private = (GdkImagePrivateFB*) image;
g_free(image->mem); image->mem = NULL;
g_free (image->windowing_data);
image->windowing_data = NULL;
g_free (image->mem);
image->mem = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -105,12 +104,17 @@ gdk_image_get_type (void)
}
GdkImage *
gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h)
gdk_image_new_bitmap(GdkVisual *visual,
gpointer data,
gint w,
gint h)
{
GdkImage *image;
GdkImagePrivateFB *private;
image = (GdkImage *)private = (GdkImagePrivateFB *)g_object_new (gdk_image_get_type (), NULL);
image = g_object_new (gdk_image_get_type (), NULL);
private = GDK_IMAGE_PRIVATE_DATA (image);
image->type = GDK_IMAGE_NORMAL;
image->visual = visual;
image->width = w;
@ -118,9 +122,9 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h)
image->depth = 1;
image->byte_order = 1 /* MSBFirst */;
image->mem = g_malloc(w * h / 8);
image->bpp = 1;
image->bpl = (w+7)/8;
image->mem = g_malloc (image->bpl * h / 8);
return image;
}
@ -134,7 +138,8 @@ gdk_image_new (GdkImageType type,
GdkImage *image;
GdkImagePrivateFB *private;
image = (GdkImage *)private = (GdkImagePrivateFB *)g_object_new (gdk_image_get_type(), NULL);
image = g_object_new (gdk_image_get_type (), NULL);
private = GDK_IMAGE_PRIVATE_DATA (image);
image->type = 0;
image->visual = visual;
@ -143,9 +148,9 @@ gdk_image_new (GdkImageType type,
image->depth = visual->depth;
image->byte_order = 0;
image->mem = g_malloc(width * height * (image->depth >> 3));
image->bpp = image->depth/8;
image->bpl = (width * image->depth + 7)/8;
image->bpl = (width * image->depth + 7) / 8;
image->mem = g_malloc (image->bpl * height);
return image;
}
@ -159,12 +164,13 @@ _gdk_fb_get_image (GdkDrawable *drawable,
{
GdkImage *image;
GdkImagePrivateFB *private;
gint bits_per_pixel = GDK_DRAWABLE_IMPL_FBDATA(gdk_parent_root)->depth;
gint bits_per_pixel = GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->depth;
GdkPixmapFBData fbd;
g_return_val_if_fail (drawable != NULL, NULL);
image = (GdkImage *)private = (GdkImagePrivateFB *)g_object_new (gdk_image_get_type(), NULL);
image = g_object_new (gdk_image_get_type (), NULL);
private = GDK_IMAGE_PRIVATE_DATA (image);
image->type = GDK_IMAGE_NORMAL;
image->visual = gdk_drawable_get_visual (drawable);
@ -181,11 +187,12 @@ _gdk_fb_get_image (GdkDrawable *drawable,
else
image->bpp = 4;
image->byte_order = 1;
image->bpl = (image->width * image->depth + 7)/8;
image->mem = g_malloc(image->bpl * image->height);
image->bpl = (image->width * image->depth + 7) / 8; /* Packed pixels */
image->mem = g_malloc (image->bpl * image->height);
/* Fake its existence as a pixmap */
memset(&fbd, 0, sizeof(fbd));
memset (&fbd, 0, sizeof(fbd));
fbd.drawable_data.mem = image->mem;
fbd.drawable_data.rowstride = image->bpl;
fbd.drawable_data.width = fbd.drawable_data.lim_x = image->width;
@ -193,7 +200,13 @@ _gdk_fb_get_image (GdkDrawable *drawable,
fbd.drawable_data.depth = image->depth;
fbd.drawable_data.window_type = GDK_DRAWABLE_PIXMAP;
gdk_fb_draw_drawable_2((GdkPixmap *)&fbd, NULL, drawable, x, y, 0, 0, width, height, TRUE, TRUE);
gdk_fb_draw_drawable_2 ((GdkPixmap *)&fbd,
NULL,
drawable,
x, y,
0, 0,
width, height,
TRUE, TRUE);
return image;
}
@ -207,9 +220,9 @@ gdk_image_get_pixel (GdkImage *image,
g_return_val_if_fail (image != NULL, 0);
private = (GdkImagePrivateFB *) image;
private = GDK_IMAGE_PRIVATE_DATA (image);
switch(image->depth)
switch (image->depth)
{
case 8:
return ((guchar *)image->mem)[x + y * image->bpl];
@ -239,7 +252,7 @@ gdk_image_put_pixel (GdkImage *image,
g_return_if_fail (image != NULL);
switch(image->depth)
switch (image->depth)
{
case 8:
ptr[x + y * image->bpl] = pixel;
@ -265,7 +278,7 @@ gdk_image_put_pixel (GdkImage *image,
}
break;
default:
g_assert_not_reached();
g_assert_not_reached ();
break;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -66,7 +66,8 @@ gdk_devices_list (void)
}
void
gdk_device_set_source (GdkDevice *device, GdkInputSource source)
gdk_device_set_source (GdkDevice *device,
GdkInputSource source)
{
device->source = source;
}
@ -122,7 +123,7 @@ gdk_device_get_state (GdkDevice *device,
{
gint x_int, y_int;
g_assert(device == gdk_core_pointer);
g_assert (device == gdk_core_pointer);
gdk_window_get_pointer (window, &x_int, &y_int, mask);
@ -205,14 +206,14 @@ void
gdk_input_set_extension_events (GdkWindow *window, gint mask,
GdkExtensionMode mode)
{
GdkWindowPrivate *window_private;
GdkWindowObject *window_private;
GList *tmp_list;
GdkInputWindow *iw;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
window_private = (GdkWindowPrivate*) window;
window_private = (GdkWindowObject*) window;
if (mode == GDK_EXTENSION_EVENTS_NONE)
mask = 0;
@ -228,7 +229,7 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
iw->num_obscuring = 0;
iw->grabbed = FALSE;
gdk_input_windows = g_list_append(gdk_input_windows,iw);
gdk_input_windows = g_list_append (gdk_input_windows,iw);
window_private->extension_events = mask;
/* Add enter window events to the event mask */
@ -242,8 +243,8 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
iw = gdk_input_window_find (window);
if (iw)
{
gdk_input_windows = g_list_remove(gdk_input_windows,iw);
g_free(iw);
gdk_input_windows = g_list_remove (gdk_input_windows,iw);
g_free (iw);
}
window_private->extension_events = 0;
@ -257,9 +258,9 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
{
if (mask != 0 && gdkdev->info.mode != GDK_MODE_DISABLED
&& (gdkdev->info.has_cursor || mode == GDK_EXTENSION_EVENTS_ALL))
gdk_input_enable_window(window,gdkdev);
gdk_input_enable_window (window,gdkdev);
else
gdk_input_disable_window(window,gdkdev);
gdk_input_disable_window (window,gdkdev);
}
}
}
@ -273,7 +274,7 @@ gdk_input_window_destroy (GdkWindow *window)
g_return_if_fail (input_window != NULL);
gdk_input_windows = g_list_remove (gdk_input_windows,input_window);
g_free(input_window);
g_free (input_window);
}
void
@ -287,22 +288,22 @@ gdk_input_exit (void)
gdkdev = (GdkDevicePrivate *)(tmp_list->data);
if (gdkdev != (GdkDevicePrivate *)gdk_core_pointer)
{
gdk_device_set_mode((GdkDevice *)gdkdev, GDK_MODE_DISABLED);
gdk_device_set_mode ((GdkDevice *)gdkdev, GDK_MODE_DISABLED);
g_free(gdkdev->info.name);
g_free(gdkdev->info.axes);
g_free(gdkdev->info.keys);
g_free(gdkdev);
g_free (gdkdev->info.name);
g_free (gdkdev->info.axes);
g_free (gdkdev->info.keys);
g_free (gdkdev);
}
}
g_list_free(gdk_input_devices);
g_list_free (gdk_input_devices);
for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
{
g_free(tmp_list->data);
g_free (tmp_list->data);
}
g_list_free(gdk_input_windows);
g_list_free (gdk_input_windows);
}
/**

View File

@ -143,35 +143,35 @@ fb_modes_parse_mode (GScanner *scanner,
int found_geometry = 0;
int found_timings = 0;
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_SYMBOL)
return -1;
keyword = GPOINTER_TO_INT(scanner->value.v_symbol);
keyword = GPOINTER_TO_INT (scanner->value.v_symbol);
if (keyword != FB_MODE)
return -1;
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_STRING)
return -1;
modename = g_strdup(scanner->value.v_string);
modename = g_strdup (scanner->value.v_string);
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_SYMBOL)
{
g_free (modename);
return -1; /* Not a valid keyword */
}
keyword = GPOINTER_TO_INT(scanner->value.v_symbol);
keyword = GPOINTER_TO_INT (scanner->value.v_symbol);
while ( keyword != FB_ENDMODE )
{
switch (GPOINTER_TO_INT(scanner->value.v_symbol))
switch (GPOINTER_TO_INT (scanner->value.v_symbol))
{
case FB_GEOMETRY:
for (i=0;i<5;i++) {
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_INT)
{
g_free (modename);
@ -183,7 +183,7 @@ fb_modes_parse_mode (GScanner *scanner,
break;
case FB_TIMINGS:
for (i=0;i<7;i++) {
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_INT)
{
g_free (modename);
@ -194,15 +194,15 @@ fb_modes_parse_mode (GScanner *scanner,
found_timings = TRUE;
break;
case FB_LACED:
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_IDENTIFIER)
{
g_free (modename);
return -1;
}
if (g_strcasecmp(scanner->value.v_identifier, "true")==0)
if (g_strcasecmp (scanner->value.v_identifier, "true")==0)
laced = 1;
else if (g_strcasecmp(scanner->value.v_identifier, "false")==0)
else if (g_strcasecmp (scanner->value.v_identifier, "false")==0)
laced = 0;
else
{
@ -211,15 +211,15 @@ fb_modes_parse_mode (GScanner *scanner,
}
break;
case FB_EXTSYNC:
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_IDENTIFIER)
{
g_free (modename);
return -1;
}
if (g_strcasecmp(scanner->value.v_identifier, "true")==0)
if (g_strcasecmp (scanner->value.v_identifier, "true")==0)
extsync = 1;
else if (g_strcasecmp(scanner->value.v_identifier, "false")==0)
else if (g_strcasecmp (scanner->value.v_identifier, "false")==0)
extsync = 0;
else
{
@ -228,15 +228,15 @@ fb_modes_parse_mode (GScanner *scanner,
}
break;
case FB_DOUBLE:
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_IDENTIFIER)
{
g_free (modename);
return -1;
}
if (g_strcasecmp(scanner->value.v_identifier, "true")==0)
if (g_strcasecmp (scanner->value.v_identifier, "true")==0)
doublescan = 1;
else if (g_strcasecmp(scanner->value.v_identifier, "false")==0)
else if (g_strcasecmp (scanner->value.v_identifier, "false")==0)
doublescan = 0;
else
{
@ -245,15 +245,15 @@ fb_modes_parse_mode (GScanner *scanner,
}
break;
case FB_VSYNC:
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_IDENTIFIER)
{
g_free (modename);
return -1;
}
if (g_strcasecmp(scanner->value.v_identifier, "high")==0)
if (g_strcasecmp (scanner->value.v_identifier, "high")==0)
vsync = 1;
else if (g_strcasecmp(scanner->value.v_identifier, "low")==0)
else if (g_strcasecmp (scanner->value.v_identifier, "low")==0)
vsync = 0;
else
{
@ -262,15 +262,15 @@ fb_modes_parse_mode (GScanner *scanner,
}
break;
case FB_HSYNC:
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_IDENTIFIER)
{
g_free (modename);
return -1;
}
if (g_strcasecmp(scanner->value.v_identifier, "high")==0)
if (g_strcasecmp (scanner->value.v_identifier, "high")==0)
hsync = 1;
else if (g_strcasecmp(scanner->value.v_identifier, "low")==0)
else if (g_strcasecmp (scanner->value.v_identifier, "low")==0)
hsync = 0;
else
{
@ -279,15 +279,15 @@ fb_modes_parse_mode (GScanner *scanner,
}
break;
case FB_CSYNC:
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_IDENTIFIER)
{
g_free (modename);
return -1;
}
if (g_strcasecmp(scanner->value.v_identifier, "high")==0)
if (g_strcasecmp (scanner->value.v_identifier, "high")==0)
csync = 1;
else if (g_strcasecmp(scanner->value.v_identifier, "low")==0)
else if (g_strcasecmp (scanner->value.v_identifier, "low")==0)
csync = 0;
else
{
@ -297,18 +297,18 @@ fb_modes_parse_mode (GScanner *scanner,
break;
}
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_SYMBOL)
{
g_free (modename);
return -1; /* Not a valid keyword */
}
keyword = GPOINTER_TO_INT(scanner->value.v_symbol);
keyword = GPOINTER_TO_INT (scanner->value.v_symbol);
}
if (strcmp(modename, specified_modename)== 0) {
if (strcmp (modename, specified_modename)== 0) {
if (!found_geometry)
g_warning("Geometry not specified\n");
g_warning ("Geometry not specified\n");
if (found_geometry)
{
@ -320,7 +320,7 @@ fb_modes_parse_mode (GScanner *scanner,
}
if (!found_timings)
g_warning("Timing not specified\n");
g_warning ("Timing not specified\n");
if (found_timings)
{
@ -345,17 +345,18 @@ fb_modes_parse_mode (GScanner *scanner,
modeinfo->sync |= FB_SYNC_VERT_HIGH_ACT;
}
g_free(modename);
g_free (modename);
return 1;
}
g_free(modename);
g_free (modename);
return 0;
}
static int
gdk_fb_setup_mode_from_name(struct fb_var_screeninfo *modeinfo, char *modename)
gdk_fb_setup_mode_from_name (struct fb_var_screeninfo *modeinfo,
char *modename)
{
GScanner *scanner;
char *filename;
@ -378,18 +379,18 @@ gdk_fb_setup_mode_from_name(struct fb_var_screeninfo *modeinfo, char *modename)
scanner->input_name = filename;
for (i=0;i<sizeof(fb_modes_keywords)/sizeof(fb_modes_keywords[0]);i++)
g_scanner_add_symbol(scanner, fb_modes_keywords[i], GINT_TO_POINTER(i));
g_scanner_add_symbol (scanner, fb_modes_keywords[i], GINT_TO_POINTER (i));
g_scanner_input_file (scanner, fd);
while (1) {
if (g_scanner_peek_next_token(scanner) == G_TOKEN_EOF) {
if (g_scanner_peek_next_token (scanner) == G_TOKEN_EOF) {
break;
}
result = fb_modes_parse_mode(scanner, modeinfo, modename);
result = fb_modes_parse_mode (scanner, modeinfo, modename);
if (result < 0) {
g_warning("parse error in %s at line %d\n", filename, scanner->line);
g_warning ("parse error in %s at line %d\n", filename, scanner->line);
break;
}
if (result > 0)
@ -401,14 +402,14 @@ gdk_fb_setup_mode_from_name(struct fb_var_screeninfo *modeinfo, char *modename)
g_scanner_destroy (scanner);
close(fd);
close (fd);
return retval;
}
static int
gdk_fb_set_mode(GdkFBDisplay *display)
gdk_fb_set_mode (GdkFBDisplay *display)
{
char *env, *end;
int depth, height, width;
@ -416,25 +417,25 @@ gdk_fb_set_mode(GdkFBDisplay *display)
if (ioctl (display->fd, FBIOGET_VSCREENINFO, &display->modeinfo) < 0)
return -1;
env = getenv("GDK_DISPLAY_MODE");
env = getenv ("GDK_DISPLAY_MODE");
if (env)
{
if (!gdk_fb_setup_mode_from_name(&display->modeinfo, env))
g_warning("Couldn't find mode named '%s'\n", env);
if (!gdk_fb_setup_mode_from_name (&display->modeinfo, env))
g_warning ("Couldn't find mode named '%s'\n", env);
}
env = getenv("GDK_DISPLAY_DEPTH");
env = getenv ("GDK_DISPLAY_DEPTH");
if (env)
{
depth = strtol(env, &end, 10);
depth = strtol (env, &end, 10);
if (env != end)
display->modeinfo.bits_per_pixel = depth;
}
env = getenv("GDK_DISPLAY_WIDTH");
env = getenv ("GDK_DISPLAY_WIDTH");
if (env)
{
width = strtol(env, &end, 10);
width = strtol (env, &end, 10);
if (env != end)
{
display->modeinfo.xres = width;
@ -442,10 +443,10 @@ gdk_fb_set_mode(GdkFBDisplay *display)
}
}
env = getenv("GDK_DISPLAY_HEIGHT");
env = getenv ("GDK_DISPLAY_HEIGHT");
if (env)
{
height = strtol(env, &end, 10);
height = strtol (env, &end, 10);
if (env != end)
{
display->modeinfo.yres = height;
@ -455,46 +456,50 @@ gdk_fb_set_mode(GdkFBDisplay *display)
if (ioctl (display->fd, FBIOPUT_VSCREENINFO, &display->modeinfo) < 0)
{
g_warning("Couldn't set specified mode\n");
g_warning ("Couldn't set specified mode\n");
return -1;
}
if (ioctl (display->fd, FBIOGET_FSCREENINFO, &display->sinfo) < 0)
{
g_warning("Error getting fixed screen info\n");
g_warning ("Error getting fixed screen info\n");
return -1;
}
return 0;
}
static GdkFBDisplay *
gdk_fb_display_new(const char *filename)
gdk_fb_display_new (const char *filename)
{
int fd, n;
GdkFBDisplay *retval;
fd = open(filename, O_RDWR);
if(fd < 0)
fd = open (filename, O_RDWR);
if (fd < 0)
return NULL;
retval = g_new0(GdkFBDisplay, 1);
retval = g_new0 (GdkFBDisplay, 1);
retval->fd = fd;
if (gdk_fb_set_mode(retval) < 0)
if (gdk_fb_set_mode (retval) < 0)
{
g_free (retval);
return NULL;
}
ioctl(retval->fd, FBIOBLANK, 0);
ioctl (retval->fd, FBIOBLANK, 0);
/* We used to use sinfo.smem_len, but that seemed to be broken in many cases */
retval->fbmem = mmap(NULL, retval->modeinfo.yres * retval->sinfo.line_length,
PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
g_assert(retval->fbmem != MAP_FAILED);
retval->fbmem = mmap (NULL,
retval->modeinfo.yres * retval->sinfo.line_length,
PROT_READ|PROT_WRITE,
MAP_SHARED,
fd,
0);
g_assert (retval->fbmem != MAP_FAILED);
if(retval->sinfo.visual == FB_VISUAL_PSEUDOCOLOR)
if (retval->sinfo.visual == FB_VISUAL_PSEUDOCOLOR)
{
guint16 red[256], green[256], blue[256];
struct fb_cmap cmap;
@ -503,10 +508,10 @@ gdk_fb_display_new(const char *filename)
for(n = 16; n < 256; n++)
red[n] = green[n] = blue[n] = n << 8;
cmap.red = red; cmap.green = green; cmap.blue = blue; cmap.len = 256; cmap.start = 0;
ioctl(fd, FBIOPUTCMAP, &cmap);
ioctl (fd, FBIOPUTCMAP, &cmap);
}
if(retval->sinfo.visual == FB_VISUAL_TRUECOLOR)
if (retval->sinfo.visual == FB_VISUAL_TRUECOLOR)
{
retval->red_byte = retval->modeinfo.red.offset >> 3;
retval->green_byte = retval->modeinfo.green.offset >> 3;
@ -517,11 +522,11 @@ gdk_fb_display_new(const char *filename)
}
static void
gdk_fb_display_destroy(GdkFBDisplay *fbd)
gdk_fb_display_destroy (GdkFBDisplay *fbd)
{
munmap(fbd->fbmem, fbd->modeinfo.yres * fbd->sinfo.line_length);
close(fbd->fd);
g_free(fbd);
munmap (fbd->fbmem, fbd->modeinfo.yres * fbd->sinfo.line_length);
close (fbd->fd);
g_free (fbd);
}
extern void keyboard_init(void);
@ -529,16 +534,16 @@ extern void keyboard_init(void);
gboolean
_gdk_windowing_init_check (int argc, char **argv)
{
if(gdk_initialized)
if (gdk_initialized)
return TRUE;
keyboard_init();
gdk_display = gdk_fb_display_new("/dev/fb");
keyboard_init ();
gdk_display = gdk_fb_display_new ("/dev/fb");
if(!gdk_display)
if (!gdk_display)
return FALSE;
gdk_fb_font_init();
gdk_fb_font_init ();
gdk_initialized = TRUE;
@ -592,34 +597,34 @@ gdk_fb_pointer_grab (GdkWindow * window,
GdkEventMask event_mask,
GdkWindow * confine_to,
GdkCursor * cursor,
guint32 time,
gboolean implicit_grab)
guint32 time,
gboolean implicit_grab)
{
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
g_return_val_if_fail (confine_to == NULL || GDK_IS_WINDOW (confine_to), 0);
if(_gdk_fb_pointer_grab_window)
if (_gdk_fb_pointer_grab_window)
{
if(implicit_grab && !_gdk_fb_pointer_implicit_grab)
if (implicit_grab && !_gdk_fb_pointer_implicit_grab)
return GDK_GRAB_ALREADY_GRABBED;
gdk_pointer_ungrab(time);
gdk_pointer_ungrab (time);
}
_gdk_fb_pointer_implicit_grab = implicit_grab;
_gdk_fb_pointer_grab_window = gdk_window_ref(window);
_gdk_fb_pointer_grab_window_events = owner_events?NULL:_gdk_fb_pointer_grab_window;
_gdk_fb_pointer_grab_window = gdk_window_ref (window);
_gdk_fb_pointer_grab_window_events = owner_events ? NULL : _gdk_fb_pointer_grab_window;
_gdk_fb_pointer_grab_confine = confine_to?gdk_window_ref(confine_to):NULL;
_gdk_fb_pointer_grab_confine = confine_to ? gdk_window_ref (confine_to) : NULL;
_gdk_fb_pointer_grab_events = event_mask;
_gdk_fb_pointer_grab_cursor = cursor?gdk_cursor_ref(cursor):NULL;
_gdk_fb_pointer_grab_cursor = cursor ? gdk_cursor_ref (cursor) : NULL;
if(cursor)
gdk_fb_cursor_reset();
if (cursor)
gdk_fb_cursor_reset ();
gdk_fb_window_visibility_crossing(window, TRUE, TRUE);
gdk_fb_window_visibility_crossing (window, TRUE, TRUE);
return GDK_GRAB_SUCCESS;
}
@ -642,7 +647,7 @@ gdk_fb_pointer_grab (GdkWindow * window,
void
gdk_pointer_ungrab (guint32 time)
{
gdk_fb_pointer_ungrab(time, FALSE);
gdk_fb_pointer_ungrab (time, FALSE);
}
void
@ -650,27 +655,27 @@ gdk_fb_pointer_ungrab (guint32 time, gboolean implicit_grab)
{
gboolean have_grab_cursor = _gdk_fb_pointer_grab_cursor && 1;
if(!_gdk_fb_pointer_grab_window)
if (!_gdk_fb_pointer_grab_window)
return;
if(implicit_grab && !_gdk_fb_pointer_implicit_grab)
if (implicit_grab && !_gdk_fb_pointer_implicit_grab)
return;
if(_gdk_fb_pointer_grab_confine)
gdk_window_unref(_gdk_fb_pointer_grab_confine);
if (_gdk_fb_pointer_grab_confine)
gdk_window_unref (_gdk_fb_pointer_grab_confine);
_gdk_fb_pointer_grab_confine = NULL;
if(_gdk_fb_pointer_grab_cursor)
gdk_cursor_unref(_gdk_fb_pointer_grab_cursor);
if (_gdk_fb_pointer_grab_cursor)
gdk_cursor_unref (_gdk_fb_pointer_grab_cursor);
_gdk_fb_pointer_grab_cursor = NULL;
if(have_grab_cursor)
gdk_fb_cursor_reset();
if (have_grab_cursor)
gdk_fb_cursor_reset ();
gdk_fb_window_visibility_crossing(_gdk_fb_pointer_grab_window, FALSE, TRUE);
gdk_fb_window_visibility_crossing (_gdk_fb_pointer_grab_window, FALSE, TRUE);
if(_gdk_fb_pointer_grab_window)
gdk_window_unref(_gdk_fb_pointer_grab_window);
if (_gdk_fb_pointer_grab_window)
gdk_window_unref (_gdk_fb_pointer_grab_window);
_gdk_fb_pointer_grab_window = NULL;
_gdk_fb_pointer_grab_window_events = NULL;
@ -726,11 +731,11 @@ gdk_keyboard_grab (GdkWindow * window,
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
if(_gdk_fb_pointer_grab_window)
gdk_keyboard_ungrab(time);
if (_gdk_fb_pointer_grab_window)
gdk_keyboard_ungrab (time);
if(!owner_events)
_gdk_fb_keyboard_grab_window = gdk_window_ref(window);
if (!owner_events)
_gdk_fb_keyboard_grab_window = gdk_window_ref (window);
return GDK_GRAB_SUCCESS;
}
@ -753,8 +758,8 @@ gdk_keyboard_grab (GdkWindow * window,
void
gdk_keyboard_ungrab (guint32 time)
{
if(_gdk_fb_keyboard_grab_window)
gdk_window_unref(_gdk_fb_keyboard_grab_window);
if (_gdk_fb_keyboard_grab_window)
gdk_window_unref (_gdk_fb_keyboard_grab_window);
_gdk_fb_keyboard_grab_window = NULL;
}
@ -885,11 +890,12 @@ extern void keyboard_shutdown(void);
void
gdk_windowing_exit (void)
{
gdk_fb_display_destroy(gdk_display); gdk_display = NULL;
gdk_fb_display_destroy (gdk_display);
gdk_display = NULL;
gdk_fb_font_fini();
gdk_fb_font_fini ();
keyboard_shutdown();
keyboard_shutdown ();
}
gchar*
@ -907,12 +913,14 @@ gdk_keyval_from_name (const gchar *keyval_name)
gchar *
gdk_get_display(void)
{
return g_strdup("/dev/fb0");
return g_strdup ("/dev/fb0");
}
/* utils */
GdkEvent *
gdk_event_make(GdkWindow *window, GdkEventType type, gboolean append_to_queue)
gdk_event_make (GdkWindow *window,
GdkEventType type,
gboolean append_to_queue)
{
static const guint type_masks[] = {
GDK_SUBSTRUCTURE_MASK, /* GDK_DELETE = 0, */
@ -953,46 +961,46 @@ gdk_event_make(GdkWindow *window, GdkEventType type, gboolean append_to_queue)
evmask = GDK_WINDOW_IMPL_FBDATA(window)->event_mask;
/* Bad hack to make sure that things work semi-properly with owner_events */
if(_gdk_fb_pointer_grab_window)
if (_gdk_fb_pointer_grab_window)
evmask |= _gdk_fb_pointer_grab_events;
if(_gdk_fb_keyboard_grab_window)
if (_gdk_fb_keyboard_grab_window)
evmask |= _gdk_fb_keyboard_grab_events;
if(evmask & GDK_BUTTON_MOTION_MASK)
if (evmask & GDK_BUTTON_MOTION_MASK)
{
evmask |= GDK_BUTTON1_MOTION_MASK|GDK_BUTTON2_MOTION_MASK|GDK_BUTTON3_MOTION_MASK;
}
if(evmask & (GDK_BUTTON1_MOTION_MASK|GDK_BUTTON2_MOTION_MASK|GDK_BUTTON3_MOTION_MASK))
if (evmask & (GDK_BUTTON1_MOTION_MASK|GDK_BUTTON2_MOTION_MASK|GDK_BUTTON3_MOTION_MASK))
{
gint x, y;
GdkModifierType mask;
gdk_input_get_mouseinfo(&x, &y, &mask);
gdk_input_get_mouseinfo (&x, &y, &mask);
if(((mask & GDK_BUTTON1_MASK) && (evmask & GDK_BUTTON1_MOTION_MASK))
|| ((mask & GDK_BUTTON2_MASK) && (evmask & GDK_BUTTON2_MOTION_MASK))
|| ((mask & GDK_BUTTON3_MASK) && (evmask & GDK_BUTTON3_MOTION_MASK)))
if (((mask & GDK_BUTTON1_MASK) && (evmask & GDK_BUTTON1_MOTION_MASK)) ||
((mask & GDK_BUTTON2_MASK) && (evmask & GDK_BUTTON2_MOTION_MASK)) ||
((mask & GDK_BUTTON3_MASK) && (evmask & GDK_BUTTON3_MOTION_MASK)))
evmask |= GDK_POINTER_MOTION_MASK;
}
if(evmask & type_masks[type])
if (evmask & type_masks[type])
{
GdkEvent *event = gdk_event_new();
GdkEvent *event = gdk_event_new ();
#if 0
guint32 the_time = g_latest_time.tv_sec * 1000 + g_latest_time.tv_usec / 1000;
#else
guint32 the_time;
GTimeVal gcurtime;
g_get_current_time(&gcurtime);
g_get_current_time (&gcurtime);
the_time = gcurtime.tv_sec * 1000 + gcurtime.tv_usec / 1000;
#endif
event->any.type = type;
event->any.window = gdk_window_ref(window);
event->any.window = gdk_window_ref (window);
event->any.send_event = FALSE;
switch(type)
switch (type)
{
case GDK_MOTION_NOTIFY:
event->motion.time = the_time;
@ -1051,8 +1059,8 @@ gdk_event_make(GdkWindow *window, GdkEventType type, gboolean append_to_queue)
break;
}
if(append_to_queue)
gdk_event_queue_append(event);
if (append_to_queue)
gdk_event_queue_append (event);
return event;
}
@ -1060,7 +1068,8 @@ gdk_event_make(GdkWindow *window, GdkEventType type, gboolean append_to_queue)
return NULL;
}
void CM(void)
/* Debug hack. Call to find malloc area overwrites: */
void CM (void)
{
static gpointer mymem = NULL;
gpointer arry[256];
@ -1068,14 +1077,14 @@ void CM(void)
return;
free(mymem);
free (mymem);
for(i = 0; i < sizeof(arry)/sizeof(arry[0]); i++)
arry[i] = malloc(i+1);
arry[i] = malloc (i+1);
for(i = 0; i < sizeof(arry)/sizeof(arry[0]); i++)
free(arry[i]);
free (arry[i]);
mymem = malloc(256);
mymem = malloc (256);
}
/* XXX badhack */
@ -1089,12 +1098,12 @@ struct _GdkWindowPaint
gint y_offset;
};
void RP(GdkDrawable *d)
void RP (GdkDrawable *d)
{
#if 0
if(GDK_DRAWABLE_TYPE(d) == GDK_DRAWABLE_PIXMAP)
if (GDK_DRAWABLE_TYPE(d) == GDK_DRAWABLE_PIXMAP)
{
if(!GDK_PIXMAP_FBDATA(d)->no_free_mem)
if (!GDK_PIXMAP_FBDATA(d)->no_free_mem)
{
guchar *oldmem = GDK_DRAWABLE_FBDATA(d)->mem;
guint len = ((GDK_DRAWABLE_IMPL_FBDATA(d)->width * GDK_DRAWABLE_IMPL_FBDATA(d)->depth + 7) / 8) * GDK_DRAWABLE_IMPL_FBDATA(d)->height;

View File

@ -42,35 +42,35 @@ FT_Library gdk_fb_ft_lib = NULL;
#define USE_FTGRAYS
void
gdk_fb_font_init(void)
gdk_fb_font_init (void)
{
FT_Init_FreeType(&gdk_fb_ft_lib);
FT_Init_FreeType (&gdk_fb_ft_lib);
#ifdef USE_FTGRAYS
FT_Set_Raster(gdk_fb_ft_lib, &ft_grays_raster); /* If this is removed, also turn off USE_FTGRAYS define in gdkdrawable-fb2.c */
FT_Set_Raster (gdk_fb_ft_lib, &ft_grays_raster); /* If this is removed, also turn off USE_FTGRAYS define in gdkdrawable-fb2.c */
#endif
}
void
gdk_fb_font_fini(void)
gdk_fb_font_fini (void)
{
FT_Done_FreeType(gdk_fb_ft_lib);
FT_Done_FreeType (gdk_fb_ft_lib);
}
void pango_fb_font_set_size(PangoFont *font);
void pango_fb_font_set_size (PangoFont *font);
static void pango_fb_font_map_init (PangoFBFontMap *fontmap);
static PangoFont *pango_fb_font_map_load_font (PangoFontMap *fontmap,
const PangoFontDescription *desc);
static void pango_fb_font_map_list_fonts (PangoFontMap *fontmap,
const gchar *family,
PangoFontDescription ***descs,
int *n_descs);
static void pango_fb_font_map_list_families (PangoFontMap *fontmap,
gchar ***families,
int *n_families);
static void pango_fb_font_map_init(PangoFBFontMap *fontmap);
static PangoFont *pango_fb_font_map_load_font(PangoFontMap *fontmap,
const PangoFontDescription *desc);
static void pango_fb_font_map_list_fonts(PangoFontMap *fontmap,
const gchar *family,
PangoFontDescription ***descs,
int *n_descs);
static void pango_fb_font_map_list_families(PangoFontMap *fontmap,
gchar ***families,
int *n_families);
static void
pango_fb_font_map_class_init(PangoFBFontMapClass *class)
pango_fb_font_map_class_init (PangoFBFontMapClass *class)
{
class->parent_class.load_font = pango_fb_font_map_load_font;
class->parent_class.list_fonts = pango_fb_font_map_list_fonts;
@ -78,7 +78,7 @@ pango_fb_font_map_class_init(PangoFBFontMapClass *class)
}
GType
pango_fb_font_map_get_type(void)
pango_fb_font_map_get_type (void)
{
static GType object_type = 0;
@ -107,8 +107,8 @@ pango_fb_font_map_get_type(void)
}
static PangoFont *
pango_fb_font_map_load_font(PangoFontMap *fontmap,
const PangoFontDescription *desc)
pango_fb_font_map_load_font (PangoFontMap *fontmap,
const PangoFontDescription *desc)
{
PangoFBFontMap *fbfm = (PangoFBFontMap *)fontmap;
PangoFBFont *retval;
@ -117,68 +117,70 @@ pango_fb_font_map_load_font(PangoFontMap *fontmap,
PangoFontDescription d2;
/* XXX fixme badhack */
if(!strcasecmp(desc->family_name, "sans"))
if (!strcasecmp (desc->family_name, "sans"))
{
d2 = *desc;
d2.family_name = "Arial";
desc = &d2;
}
/* XXX fixme badhack */
if(!strcasecmp(desc->family_name, "serif"))
if (!strcasecmp (desc->family_name, "serif"))
{
d2 = *desc;
d2.family_name = "Times New Roman";
desc = &d2;
}
retval = g_hash_table_lookup(fbfm->all_fonts, desc);
retval = g_hash_table_lookup (fbfm->all_fonts, desc);
if(retval)
if (retval)
{
g_object_ref(G_OBJECT(retval));
g_object_ref (G_OBJECT(retval));
goto out;
}
for(i = 0; i < fbfm->all_descs->len; i++)
for (i = 0; i < fbfm->all_descs->len; i++)
{
fl = g_ptr_array_index(fbfm->all_descs, i);
fl = g_ptr_array_index (fbfm->all_descs, i);
/* Can't use pango_font_description_equal() because it checks ->size as well */
if(!g_strcasecmp(desc->family_name, fl->desc.family_name)
&& desc->style == fl->desc.style
&& desc->weight == fl->desc.weight
&& desc->stretch == fl->desc.stretch)
if (!g_strcasecmp (desc->family_name, fl->desc.family_name) &&
desc->style == fl->desc.style &&
desc->weight == fl->desc.weight &&
desc->stretch == fl->desc.stretch)
break;
}
if(i >= fbfm->all_descs->len)
if (i >= fbfm->all_descs->len)
return NULL;
retval = (PangoFBFont *)g_object_new (PANGO_TYPE_FB_FONT, NULL);
retval->desc = *desc;
retval->desc.family_name = g_strdup(desc->family_name);
retval->desc.family_name = g_strdup (desc->family_name);
retval->ftf = fl->ftf;
g_hash_table_insert(fbfm->all_fonts, &retval->desc, retval);
g_object_ref(G_OBJECT(retval)); /* XXX FIXME: We have to keep the font in the cache forever because I'm too clueless to see
signals in gobject */
g_hash_table_insert (fbfm->all_fonts, &retval->desc, retval);
g_object_ref (G_OBJECT (retval)); /* XXX FIXME: We have to keep the font in the cache forever because I'm too clueless to see
signals in gobject */
out:
return (PangoFont *)retval;
}
static void
list_fonts(PangoFBFontMap *fm, const char *family,
GPtrArray *descs, const char *dir)
list_fonts (PangoFBFontMap *fm,
const char *family,
GPtrArray *descs,
const char *dir)
{
DIR *dirh;
struct dirent *dent;
dirh = opendir(dir);
if(!dirh)
dirh = opendir (dir);
if (!dirh)
return;
while((dent = readdir(dirh)))
while ((dent = readdir (dirh)))
{
PangoFBFontListing *pfd;
char *ctmp;
@ -187,85 +189,85 @@ list_fonts(PangoFBFontMap *fm, const char *family,
FT_Error ec;
int i = 0, n = 1;
ctmp = strrchr(dent->d_name, '.');
if(!ctmp
|| (strcasecmp(ctmp, ".ttf")
&& strcasecmp(ctmp, ".pfa")
&& strcasecmp(ctmp, ".pfb")))
ctmp = strrchr (dent->d_name, '.');
if (!ctmp ||
(strcasecmp (ctmp, ".ttf") &&
strcasecmp (ctmp, ".pfa") &&
strcasecmp (ctmp, ".pfb")))
continue;
g_snprintf(buf, sizeof(buf), "%s/%s", dir, dent->d_name);
g_snprintf (buf, sizeof(buf), "%s/%s", dir, dent->d_name);
while(i < n)
while (i < n)
{
ec = FT_New_Face(gdk_fb_ft_lib, buf, i, &ftf);
if(ec)
ec = FT_New_Face (gdk_fb_ft_lib, buf, i, &ftf);
if (ec)
break; /* error opening */
FT_Select_Charmap(ftf, ft_encoding_unicode);
FT_Select_Charmap (ftf, ft_encoding_unicode);
n = ftf->num_faces;
if(!ftf->family_name || !ftf->style_name)
if (!ftf->family_name || !ftf->style_name)
{
g_warning("No family/style on %s", buf);
FT_Done_Face(ftf);
g_warning ("No family/style on %s", buf);
FT_Done_Face (ftf);
break;
}
pfd = g_new0(PangoFBFontListing, 1);
pfd = g_new0 (PangoFBFontListing, 1);
/* Now add the item */
if(ftf->family_name[0] == '/')
pfd->desc.family_name = g_strdup(ftf->family_name+1);
if (ftf->family_name[0] == '/')
pfd->desc.family_name = g_strdup (ftf->family_name+1);
else
pfd->desc.family_name = g_strdup(ftf->family_name);
pfd->desc.family_name = g_strdup (ftf->family_name);
pfd->desc.style = PANGO_STYLE_NORMAL;
pfd->desc.variant = PANGO_VARIANT_NORMAL;
pfd->desc.weight = PANGO_WEIGHT_NORMAL;
pfd->desc.stretch = PANGO_STRETCH_NORMAL;
if(ftf->style_name)
if (ftf->style_name)
{
char lcstr[512];
strcpy(lcstr, ftf->style_name);
g_strdown(lcstr);
strcpy (lcstr, ftf->style_name);
g_strdown (lcstr);
if(strstr(lcstr, "italic"))
if (strstr (lcstr, "italic"))
pfd->desc.style = PANGO_STYLE_ITALIC;
else if(strstr(lcstr, "oblique"))
else if (strstr (lcstr, "oblique"))
pfd->desc.style = PANGO_STYLE_OBLIQUE;
if(strstr(lcstr, "bold"))
if (strstr (lcstr, "bold"))
pfd->desc.weight = PANGO_WEIGHT_BOLD;
if(strstr(lcstr, "condensed"))
if (strstr (lcstr, "condensed"))
pfd->desc.stretch = PANGO_STRETCH_CONDENSED;
else if(strstr(lcstr, "expanded"))
else if (strstr (lcstr, "expanded"))
pfd->desc.stretch = PANGO_STRETCH_EXPANDED;
}
pfd->ftf = ftf;
g_ptr_array_add(descs, pfd);
g_ptr_array_add (descs, pfd);
i++;
}
}
closedir(dirh);
closedir (dirh);
}
static guint
pango_font_description_hash(gconstpointer a)
pango_font_description_hash (gconstpointer a)
{
const PangoFontDescription *fa = a;
return g_str_hash(fa->family_name) ^ (fa->style + fa->weight + fa->stretch + fa->variant + fa->size);
return g_str_hash (fa->family_name) ^ (fa->style + fa->weight + fa->stretch + fa->variant + fa->size);
}
static void
pango_fb_font_map_init(PangoFBFontMap *fontmap)
pango_fb_font_map_init (PangoFBFontMap *fontmap)
{
static const char *font_dirs[] = {
"/usr/share/fonts/default/TrueType",
@ -276,35 +278,35 @@ pango_fb_font_map_init(PangoFBFontMap *fontmap)
};
int i;
fontmap->all_fonts = g_hash_table_new(pango_font_description_hash, (GEqualFunc)pango_font_description_equal);
fontmap->all_descs = g_ptr_array_new();
for(i = 0; font_dirs[i]; i++)
list_fonts(fontmap, NULL, fontmap->all_descs, font_dirs[i]);
fontmap->all_fonts = g_hash_table_new (pango_font_description_hash, (GEqualFunc)pango_font_description_equal);
fontmap->all_descs = g_ptr_array_new ();
for (i = 0; font_dirs[i]; i++)
list_fonts (fontmap, NULL, fontmap->all_descs, font_dirs[i]);
}
static void
pango_fb_font_map_list_fonts(PangoFontMap *fontmap,
const gchar *family,
PangoFontDescription ***descs,
int *n_descs)
pango_fb_font_map_list_fonts (PangoFontMap *fontmap,
const gchar *family,
PangoFontDescription ***descs,
int *n_descs)
{
PangoFBFontMap *fbfm = (PangoFBFontMap *)fontmap;
int i, n;
*descs = g_new(PangoFontDescription *, fbfm->all_descs->len);
*descs = g_new (PangoFontDescription *, fbfm->all_descs->len);
*n_descs = fbfm->all_descs->len;
for(i = n = 0; i < fbfm->all_descs->len; i++)
for (i = n = 0; i < fbfm->all_descs->len; i++)
{
PangoFontDescription *pfd = g_ptr_array_index(fbfm->all_descs, i);
PangoFontDescription *pfd = g_ptr_array_index (fbfm->all_descs, i);
if(strcasecmp(family, pfd->family_name))
if (strcasecmp (family, pfd->family_name))
continue;
(*descs)[n++] = pango_font_description_copy(pfd);
(*descs)[n++] = pango_font_description_copy (pfd);
}
*n_descs = n;
*descs = g_realloc(*descs, n * sizeof(PangoFontDescription *));
*descs = g_realloc (*descs, n * sizeof(PangoFontDescription *));
}
struct famlist {
@ -313,40 +315,40 @@ struct famlist {
};
static void
add_entry(gpointer key, gpointer value, gpointer data)
add_entry (gpointer key, gpointer value, gpointer data)
{
struct famlist *fl = data;
fl->families[fl->last_added++] = g_strdup(key);
fl->families[fl->last_added++] = g_strdup (key);
}
static void
pango_fb_font_map_list_families(PangoFontMap *fontmap,
gchar ***families,
int *n_families)
pango_fb_font_map_list_families (PangoFontMap *fontmap,
gchar ***families,
int *n_families)
{
PangoFBFontMap *fbfm = (PangoFBFontMap *)fontmap;
int i;
GHashTable *thash = g_hash_table_new(g_str_hash, g_str_equal);
GHashTable *thash = g_hash_table_new (g_str_hash, g_str_equal);
struct famlist stickittome;
for(i = 0; i < fbfm->all_descs->len; i++)
{
PangoFBFontListing *fl = g_ptr_array_index(fbfm->all_descs, i);
g_hash_table_insert(thash, fl->desc.family_name, fl);
PangoFBFontListing *fl = g_ptr_array_index (fbfm->all_descs, i);
g_hash_table_insert (thash, fl->desc.family_name, fl);
}
*n_families = g_hash_table_size(thash);
*families = g_new(gchar *, *n_families);
*n_families = g_hash_table_size (thash);
*families = g_new (gchar *, *n_families);
stickittome.families = *families;
stickittome.last_added = 0;
g_hash_table_foreach(thash, add_entry, &stickittome);
g_hash_table_destroy(thash);
g_hash_table_foreach (thash, add_entry, &stickittome);
g_hash_table_destroy (thash);
}
static PangoFontMap *
pango_fb_font_map(void)
pango_fb_font_map (void)
{
return g_object_new(pango_fb_font_map_get_type(), NULL);
return g_object_new (pango_fb_font_map_get_type (), NULL);
}
PangoMap *
@ -357,8 +359,8 @@ pango_fb_get_shaper_map (const char *lang)
if (engine_type_id == 0)
{
engine_type_id = g_quark_try_string(PANGO_ENGINE_TYPE_SHAPE);
render_type_id = g_quark_try_string(PANGO_RENDER_TYPE_FB);
engine_type_id = g_quark_try_string (PANGO_ENGINE_TYPE_SHAPE);
render_type_id = g_quark_try_string (PANGO_RENDER_TYPE_FB);
}
if (engine_type_id == 0)
@ -396,23 +398,23 @@ struct _PangoFBFontClass
PangoFontClass parent_class;
};
static void pango_fb_font_class_init (PangoFBFontClass *class);
static void pango_fb_font_init (PangoFBFont *font);
static void pango_fb_font_finalize (GObject *object);
static void pango_fb_font_class_init (PangoFBFontClass *class);
static void pango_fb_font_init (PangoFBFont *font);
static void pango_fb_font_finalize (GObject *object);
static PangoFontDescription *pango_fb_font_describe (PangoFont *font);
static PangoCoverage * pango_fb_font_get_coverage (PangoFont *font,
const char *lang);
const char *lang);
static PangoEngineShape * pango_fb_font_find_shaper (PangoFont *font,
const char *lang,
guint32 ch);
const char *lang,
guint32 ch);
static void pango_fb_font_get_glyph_extents (PangoFont *font,
PangoGlyph glyph,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect);
PangoGlyph glyph,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect);
static void pango_fb_font_get_metrics (PangoFont *font,
const gchar *lang,
PangoFontMetrics *metrics);
const gchar *lang,
PangoFontMetrics *metrics);
GType
pango_fb_font_get_type (void)
@ -447,29 +449,29 @@ static void
pango_fb_font_init (PangoFBFont *font)
{
font->desc.size = -1;
font->glyph_info = g_hash_table_new(NULL, NULL);
font->glyph_info = g_hash_table_new (NULL, NULL);
}
static gboolean
g_free_2(gpointer key, gpointer value, gpointer data)
{
PangoFBGlyphInfo *pgi = value;
g_free(pgi->fbd.drawable_data.mem);
g_free(value);
g_free (pgi->fbd.drawable_data.mem);
g_free (value);
return TRUE;
}
static void
pango_fb_font_clear_extent_cache(PangoFBFont *fbf)
{
g_hash_table_foreach_remove(fbf->glyph_info, g_free_2, NULL);
g_hash_table_foreach_remove (fbf->glyph_info, g_free_2, NULL);
}
PangoFBGlyphInfo *
pango_fb_font_get_glyph_info(PangoFont *font, PangoGlyph glyph)
pango_fb_font_get_glyph_info (PangoFont *font, PangoGlyph glyph)
{
PangoFBGlyphInfo *pgi;
PangoFBFont *fbf = PANGO_FB_FONT(font);
PangoFBFont *fbf = PANGO_FB_FONT (font);
FT_Bitmap *renderme;
FT_GlyphSlot g;
PangoRectangle *my_logical_rect, *my_ink_rect;
@ -478,19 +480,19 @@ pango_fb_font_get_glyph_info(PangoFont *font, PangoGlyph glyph)
ftf = fbf->ftf;
pango_fb_font_set_size(font);
pango_fb_font_set_size (font);
pgi = g_hash_table_lookup(fbf->glyph_info, GUINT_TO_POINTER(glyph));
if(pgi)
pgi = g_hash_table_lookup (fbf->glyph_info, GUINT_TO_POINTER (glyph));
if (pgi)
return pgi;
pgi = g_new0(PangoFBGlyphInfo, 1);
pgi = g_new0 (PangoFBGlyphInfo, 1);
FT_Load_Glyph(ftf, glyph, FT_LOAD_DEFAULT);
FT_Load_Glyph (ftf, glyph, FT_LOAD_DEFAULT);
g = ftf->glyph;
if(g->format != ft_glyph_format_bitmap)
if (g->format != ft_glyph_format_bitmap)
{
FT_BitmapGlyph bgy;
int bdepth;
@ -505,8 +507,8 @@ pango_fb_font_get_glyph_info(PangoFont *font, PangoGlyph glyph)
bdepth = 0;
#endif
if(FT_Get_Glyph_Bitmap(ftf, glyph, 0, bdepth, NULL, &bgy))
g_error("Glyph render failed");
if (FT_Get_Glyph_Bitmap(ftf, glyph, 0, bdepth, NULL, &bgy))
g_error ("Glyph render failed");
renderme = &bgy->bitmap;
free_buffer = TRUE;
@ -514,12 +516,12 @@ pango_fb_font_get_glyph_info(PangoFont *font, PangoGlyph glyph)
else
renderme = &g->bitmap;
pgi->fbd.drawable_data.mem = g_memdup(renderme->buffer, renderme->pitch * renderme->rows);
pgi->fbd.drawable_data.mem = g_memdup (renderme->buffer, renderme->pitch * renderme->rows);
pgi->fbd.drawable_data.rowstride = renderme->pitch;
pgi->fbd.drawable_data.width = pgi->fbd.drawable_data.lim_x = renderme->width;
pgi->fbd.drawable_data.height = pgi->fbd.drawable_data.lim_y = renderme->rows;
switch(renderme->pixel_mode)
switch (renderme->pixel_mode)
{
case ft_pixel_mode_mono:
pgi->fbd.drawable_data.depth = 1;
@ -532,7 +534,7 @@ pango_fb_font_get_glyph_info(PangoFont *font, PangoGlyph glyph)
#endif
break;
default:
g_assert_not_reached();
g_assert_not_reached ();
break;
}
@ -555,20 +557,20 @@ pango_fb_font_get_glyph_info(PangoFont *font, PangoGlyph glyph)
pgi->hbearing = ((-g->metrics.horiBearingY) >> 6);
g_hash_table_insert(fbf->glyph_info, GUINT_TO_POINTER(glyph), pgi);
g_hash_table_insert (fbf->glyph_info, GUINT_TO_POINTER(glyph), pgi);
return pgi;
}
static void pango_fb_font_finalize (GObject *object)
static void pango_fb_font_finalize (GObject *object)
{
PangoFBFont *fbf = PANGO_FB_FONT(object);
PangoFBFont *fbf = PANGO_FB_FONT (object);
/* XXX FIXME g_hash_table_remove(ourfontmap, &fbf->desc); */
pango_coverage_unref(fbf->coverage);
g_free(fbf->desc.family_name);
pango_fb_font_clear_extent_cache(fbf);
g_hash_table_destroy(fbf->glyph_info);
pango_coverage_unref (fbf->coverage);
g_free (fbf->desc.family_name);
pango_fb_font_clear_extent_cache (fbf);
g_hash_table_destroy (fbf->glyph_info);
}
static void
@ -586,9 +588,9 @@ pango_fb_font_class_init (PangoFBFontClass *class)
}
static PangoFontDescription *
pango_fb_font_describe(PangoFont *font)
pango_fb_font_describe (PangoFont *font)
{
return pango_font_description_copy(&PANGO_FB_FONT(font)->desc);
return pango_font_description_copy (&PANGO_FB_FONT(font)->desc);
}
static void
@ -600,23 +602,23 @@ free_coverages_foreach (gpointer key,
}
static PangoCoverage *
pango_fb_font_get_coverage (PangoFont *font,
const char *lang)
pango_fb_font_get_coverage (PangoFont *font,
const char *lang)
{
int i, n;
PangoCoverage *retval;
PangoMap *shape_map;
GHashTable *coverage_hash;
if(PANGO_FB_FONT(font)->coverage)
return pango_coverage_ref(PANGO_FB_FONT(font)->coverage);
if (PANGO_FB_FONT (font)->coverage)
return pango_coverage_ref (PANGO_FB_FONT (font)->coverage);
shape_map = pango_fb_get_shaper_map(lang);
shape_map = pango_fb_get_shaper_map (lang);
coverage_hash = g_hash_table_new (g_str_hash, g_str_equal);
retval = pango_coverage_new();
n = MIN(65536,PANGO_FB_FONT(font)->ftf->num_glyphs);
retval = pango_coverage_new ();
n = MIN( 65536, PANGO_FB_FONT (font)->ftf->num_glyphs);
for(i = 0; i < n; i++)
{
PangoCoverageLevel font_level;
@ -648,15 +650,15 @@ pango_fb_font_get_coverage (PangoFont *font,
g_hash_table_foreach (coverage_hash, free_coverages_foreach, NULL);
g_hash_table_destroy (coverage_hash);
PANGO_FB_FONT(font)->coverage = pango_coverage_ref(retval);
PANGO_FB_FONT (font)->coverage = pango_coverage_ref (retval);
return retval;
}
static PangoEngineShape *
pango_fb_font_find_shaper (PangoFont *font,
const char *lang,
guint32 ch)
pango_fb_font_find_shaper (PangoFont *font,
const char *lang,
guint32 ch)
{
PangoMap *shape_map = NULL;
@ -671,14 +673,14 @@ EXPORT_FUNC(FT_Error) FT_New_GlyphSlot( FT_Face face,
#endif
void
pango_fb_font_set_size(PangoFont *font)
pango_fb_font_set_size (PangoFont *font)
{
PangoFBFont *fbf = (PangoFBFont *)font;
if(PANGO_FB_FONT(font)->desc.size != GPOINTER_TO_UINT(fbf->ftf->generic.data))
if (PANGO_FB_FONT (font)->desc.size != GPOINTER_TO_UINT (fbf->ftf->generic.data))
{
fbf->ftf->generic.data = GUINT_TO_POINTER(PANGO_FB_FONT(font)->desc.size);
FT_Set_Char_Size(fbf->ftf, 0, (PANGO_FB_FONT(font)->desc.size << 6)/PANGO_SCALE, 72, 72);
fbf->ftf->generic.data = GUINT_TO_POINTER (PANGO_FB_FONT (font)->desc.size);
FT_Set_Char_Size (fbf->ftf, 0, (PANGO_FB_FONT (font)->desc.size << 6)/PANGO_SCALE, 72, 72);
}
}
@ -692,30 +694,30 @@ pango_fb_font_get_glyph_extents (PangoFont *font,
PangoRectangle *my_extents;
PangoFBGlyphInfo *gi;
fbf = PANGO_FB_FONT(font);
fbf = PANGO_FB_FONT (font);
pango_fb_font_set_size(font);
pango_fb_font_set_size (font);
gi = pango_fb_font_get_glyph_info(font, glyph);
gi = pango_fb_font_get_glyph_info (font, glyph);
my_extents = gi->extents;
if(ink_rect)
if (ink_rect)
*ink_rect = my_extents[0];
if(logical_rect)
if (logical_rect)
*logical_rect = my_extents[1];
}
static void
pango_fb_font_get_metrics (PangoFont *font,
const gchar *lang,
PangoFontMetrics *metrics)
pango_fb_font_get_metrics (PangoFont *font,
const gchar *lang,
PangoFontMetrics *metrics)
{
FT_Face ftf;
ftf = PANGO_FB_FONT(font)->ftf;
ftf = PANGO_FB_FONT (font)->ftf;
if(metrics)
if (metrics)
{
metrics->ascent = ftf->ascender * PANGO_SCALE >> 6;
metrics->descent = ftf->descender * PANGO_SCALE >> 6;
@ -763,10 +765,10 @@ gdk_pango_context_get (void)
PangoContext *retval;
static PangoFontMap *font_map = NULL;
if(!font_map)
if (!font_map)
font_map = pango_fb_font_map ();
retval = pango_context_new();
retval = pango_context_new ();
pango_context_add_font_map (retval, font_map);

View File

@ -57,7 +57,7 @@ gdk_pixmap_impl_fb_init (GdkPixmapFBData *impl)
GdkDrawableFBData *private = (GdkDrawableFBData *)impl;
private->window_type = GDK_DRAWABLE_PIXMAP;
private->colormap = gdk_colormap_ref(gdk_colormap_get_system());
private->colormap = gdk_colormap_ref (gdk_colormap_get_system());
private->mem = NULL;
private->width = 1;
private->height = 1;
@ -75,7 +75,7 @@ static void
gdk_pixmap_impl_fb_class_init (GdkPixmapFBClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
// GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
/* GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); */
parent_class = g_type_class_peek_parent (klass);
@ -130,13 +130,12 @@ gdk_pixmap_new (GdkWindow *window,
if (depth == -1)
depth = gdk_drawable_get_visual (window)->depth;
pixmap = (GdkPixmap *)g_object_new (gdk_pixmap_get_type(), NULL);
private = GDK_DRAWABLE_IMPL_FBDATA(pixmap);
GDK_DRAWABLE_IMPL_FBDATA(pixmap)->mem = g_malloc(((width * depth + 7) / 8) * height);
GDK_DRAWABLE_IMPL_FBDATA(pixmap)->rowstride = (width * depth + 7) / 8; /* Round up to nearest whole byte */
GDK_DRAWABLE_IMPL_FBDATA(pixmap)->lim_x = width;
GDK_DRAWABLE_IMPL_FBDATA(pixmap)->lim_y = height;
pixmap = (GdkPixmap *)g_object_new (gdk_pixmap_get_type (), NULL);
private = GDK_DRAWABLE_IMPL_FBDATA (pixmap);
private->rowstride = (width * depth + 7) / 8; /* Round up to nearest whole byte */
private->mem = g_malloc (private->rowstride * height);
private->lim_x = width;
private->lim_y = height;
private->width = width;
private->height = height;
private->depth = ((GdkPixmapObject *)pixmap)->depth = depth;
@ -159,9 +158,9 @@ gdk_bitmap_create_from_data (GdkWindow *window,
if (!window)
window = gdk_parent_root;
pixmap = gdk_pixmap_new(window, width, height, 1);
pixmap = gdk_pixmap_new (window, width, height, 1);
memcpy(GDK_DRAWABLE_IMPL_FBDATA(pixmap)->mem, data, ((width + 7) / 8) * height);
memcpy (GDK_DRAWABLE_IMPL_FBDATA (pixmap)->mem, data, ((width + 7) / 8) * height);
return pixmap;
}
@ -190,9 +189,9 @@ gdk_pixmap_create_from_data (GdkWindow *window,
if (depth == -1)
depth = gdk_drawable_get_visual (window)->depth;
pixmap = gdk_pixmap_new(window, width, height, depth);
pixmap = gdk_pixmap_new (window, width, height, depth);
memcpy(GDK_DRAWABLE_IMPL_FBDATA(pixmap)->mem, data, height * GDK_DRAWABLE_IMPL_FBDATA(pixmap)->rowstride);
memcpy (GDK_DRAWABLE_IMPL_FBDATA (pixmap)->mem, data, height * GDK_DRAWABLE_IMPL_FBDATA (pixmap)->rowstride);
return pixmap;
}

View File

@ -39,10 +39,10 @@
#include <stdio.h>
#include <freetype/freetype.h>
#define GDK_DRAWABLE_IMPL_FBDATA(win) ((GdkDrawableFBData *)((GdkWindowPrivate *)(win))->impl)
#define GDK_DRAWABLE_IMPL(win) ((GdkDrawable *)((GdkWindowPrivate *)(win))->impl)
#define GDK_WINDOW_IMPL_FBDATA(win) ((GdkWindowFBData *)((GdkWindowPrivate *)(win))->impl)
#define GDK_PIXMAP_IMPL_FBDATA(win) ((GdkPixmapFBData *)((GdkWindowPrivate *)(win))->impl)
#define GDK_DRAWABLE_IMPL_FBDATA(win) ((GdkDrawableFBData *)((GdkWindowObject *)(win))->impl)
#define GDK_DRAWABLE_IMPL(win) ((GdkDrawable *)((GdkWindowObject *)(win))->impl)
#define GDK_WINDOW_IMPL_FBDATA(win) ((GdkWindowFBData *)((GdkWindowObject *)(win))->impl)
#define GDK_PIXMAP_IMPL_FBDATA(win) ((GdkPixmapFBData *)((GdkWindowObject *)(win))->impl)
#define GDK_DRAWABLE_FBDATA(win) ((GdkDrawableFBData *)(win))
#define GDK_PIXMAP_FBDATA(win) ((GdkPixmapFBData *)(win))
#define GDK_WINDOW_FBDATA(win) ((GdkWindowFBData *)(win))
@ -57,7 +57,6 @@
typedef struct _GdkDrawableFBData GdkDrawableFBData;
typedef struct _GdkWindowFBData GdkWindowFBData;
typedef struct _GdkPixmapFBData GdkPixmapFBData;
typedef GdkWindowObject GdkWindowPrivate;
#define GDK_DRAWABLE_PIXMAP (GDK_WINDOW_FOREIGN+1)
struct _GdkDrawableFBData
@ -83,8 +82,6 @@ typedef struct {
GdkDrawableClass base_class;
} GdkDrawableFBClass;
#define GDK_DRAWABLE_P(x) ((GdkDrawableFBData *)(x))
struct _GdkPixmapFBData
{
GdkDrawableFBData drawable_data;
@ -135,17 +132,11 @@ typedef struct {
} GdkVisualPrivateFB;
typedef struct {
GdkColormap base;
GHashTable *hash;
GdkColorInfo *info;
guint sync_tag;
} GdkColormapPrivateFB;
typedef struct {
GdkColormapClass base_class;
} GdkColormapFBClass;
typedef struct {
GdkCursor base;
GdkPixmap *cursor, *mask;
@ -164,7 +155,7 @@ void gdk_fb_font_init(void);
void gdk_fb_font_fini(void);
typedef struct {
GdkImage base;
/* Empty */
} GdkImagePrivateFB;
#define GDK_GC_FBDATA(x) ((GdkGCFBData *)(x))

View File

@ -38,13 +38,13 @@ gdk_atom_intern (const gchar *atom_name,
{
g_return_val_if_fail (atom_name != NULL, GDK_NONE);
return g_quark_from_string(atom_name);
return g_quark_from_string (atom_name);
}
gchar*
gdk_atom_name (GdkAtom atom)
{
return g_quark_to_string(atom);
return g_quark_to_string (atom);
}
static void
@ -55,11 +55,11 @@ gdk_property_delete_2 (GdkWindow *window,
GdkWindowFBData *fbd = GDK_WINDOW_IMPL_FBDATA(window);
GdkEvent *event;
g_hash_table_remove(fbd->properties, GUINT_TO_POINTER(property));
g_free(prop);
g_hash_table_remove (fbd->properties, GUINT_TO_POINTER (property));
g_free (prop);
event = gdk_event_make(window, GDK_PROPERTY_NOTIFY, TRUE);
if(event)
event = gdk_event_make (window, GDK_PROPERTY_NOTIFY, TRUE);
if (event)
{
event->property.atom = property;
event->property.state = GDK_PROPERTY_DELETE;
@ -70,20 +70,20 @@ void
gdk_property_delete (GdkWindow *window,
GdkAtom property)
{
GdkWindowFBData *fbd = GDK_WINDOW_FBDATA(window);
GdkWindowFBData *fbd = GDK_WINDOW_FBDATA (window);
GdkWindowProperty *prop;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if(!fbd->properties)
if (!fbd->properties)
return;
prop = g_hash_table_lookup(fbd->properties, GUINT_TO_POINTER(property));
if(!prop)
prop = g_hash_table_lookup (fbd->properties, GUINT_TO_POINTER(property));
if (!prop)
return;
gdk_property_delete_2(window, property, prop);
gdk_property_delete_2 (window, property, prop);
}
gint
@ -98,7 +98,7 @@ gdk_property_get (GdkWindow *window,
gint *actual_length,
guchar **data)
{
GdkWindowFBData *fbd = GDK_WINDOW_FBDATA(window);
GdkWindowFBData *fbd = GDK_WINDOW_FBDATA (window);
GdkWindowProperty *prop;
int nbytes;
@ -107,19 +107,19 @@ gdk_property_get (GdkWindow *window,
g_return_val_if_fail (actual_length != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
if(!fbd->properties)
if (!fbd->properties)
return FALSE;
prop = g_hash_table_lookup(fbd->properties, GUINT_TO_POINTER(property));
if(!prop)
prop = g_hash_table_lookup (fbd->properties, GUINT_TO_POINTER (property));
if (!prop)
return FALSE;
nbytes = (offset + length * (prop->format >> 3)) - prop->length;
nbytes = MAX(nbytes, 0);
if(nbytes > 0)
nbytes = MAX (nbytes, 0);
if (nbytes > 0)
{
*data = g_malloc(nbytes+1);
memcpy(data, prop->data + offset, nbytes);
*data = g_malloc (nbytes+1);
memcpy (data, prop->data + offset, nbytes);
(*data)[nbytes] = 0;
}
else
@ -128,8 +128,8 @@ gdk_property_get (GdkWindow *window,
*actual_property_type = prop->type;
*actual_format_type = prop->format;
if(pdelete)
gdk_property_delete_2(window, property, prop);
if (pdelete)
gdk_property_delete_2 (window, property, prop);
return TRUE;
}
@ -143,7 +143,7 @@ gdk_property_change (GdkWindow *window,
const guchar *data,
gint nelements)
{
GdkWindowFBData *fbd = GDK_WINDOW_FBDATA(window);
GdkWindowFBData *fbd = GDK_WINDOW_FBDATA (window);
GdkWindowProperty *prop, *new_prop;
int new_size = 0;
GdkEvent *event;
@ -151,10 +151,10 @@ gdk_property_change (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if(!fbd->properties)
fbd->properties = g_hash_table_new(NULL, NULL);
if (!fbd->properties)
fbd->properties = g_hash_table_new (NULL, NULL);
prop = g_hash_table_lookup(fbd->properties, GUINT_TO_POINTER(property));
prop = g_hash_table_lookup (fbd->properties, GUINT_TO_POINTER (property));
switch(mode)
{
@ -164,39 +164,39 @@ gdk_property_change (GdkWindow *window,
case GDK_PROP_MODE_PREPEND:
case GDK_PROP_MODE_APPEND:
new_size = nelements * (format >> 3);
if(prop)
if (prop)
new_size += prop->length;
default:
break;
}
new_prop = g_malloc(G_STRUCT_OFFSET(GdkWindowProperty, data) + new_size);
new_prop = g_malloc (G_STRUCT_OFFSET (GdkWindowProperty, data) + new_size);
new_prop->length = new_size;
new_prop->type = type;
new_prop->format = format;
switch(mode)
switch (mode)
{
case GDK_PROP_MODE_REPLACE:
memcpy(new_prop->data, data, new_size);
memcpy (new_prop->data, data, new_size);
break;
case GDK_PROP_MODE_APPEND:
if(prop)
memcpy(new_prop->data, prop->data, prop->length);
memcpy(new_prop->data + prop->length, data, (nelements * (format >> 3)));
if (prop)
memcpy (new_prop->data, prop->data, prop->length);
memcpy (new_prop->data + prop->length, data, (nelements * (format >> 3)));
break;
case GDK_PROP_MODE_PREPEND:
memcpy(new_prop->data, data, (nelements * (format >> 3)));
if(prop)
memcpy(new_prop->data + (nelements * (format >> 3)), prop->data, prop->length);
memcpy (new_prop->data, data, (nelements * (format >> 3)));
if (prop)
memcpy (new_prop->data + (nelements * (format >> 3)), prop->data, prop->length);
break;
}
g_hash_table_insert(fbd->properties, GUINT_TO_POINTER(property), new_prop);
g_free(prop);
g_hash_table_insert (fbd->properties, GUINT_TO_POINTER (property), new_prop);
g_free (prop);
event = gdk_event_make(window, GDK_PROPERTY_NOTIFY, TRUE);
if(event)
event = gdk_event_make (window, GDK_PROPERTY_NOTIFY, TRUE);
if (event)
{
event->property.atom = property;
event->property.state = GDK_PROPERTY_NEW_VALUE;

View File

@ -27,36 +27,19 @@
#include "gdkvisual.h"
#include "gdkprivate-fb.h"
#include "gdkinternals.h"
#include <endian.h>
static GdkVisual *system_visual = NULL;
#ifdef G_ENABLE_DEBUG
#if 0
static const gchar* visual_names[] =
{
"static gray",
"grayscale",
"static color",
"pseudo color",
"true color",
"direct color",
};
#endif
#endif /* G_ENABLE_DEBUG */
void
gdk_visual_init (void)
{
system_visual = g_new0(GdkVisual, 1);
system_visual = g_new0 (GdkVisual, 1);
system_visual->depth = system_visual->bits_per_rgb = gdk_display->modeinfo.bits_per_pixel;
system_visual->byte_order = GDK_LSB_FIRST;
system_visual->colormap_size = 0;
switch(gdk_display->sinfo.visual)
switch (gdk_display->sinfo.visual)
{
case FB_VISUAL_PSEUDOCOLOR:
system_visual->colormap_size = 1 << gdk_display->modeinfo.bits_per_pixel;
@ -65,8 +48,9 @@ gdk_visual_init (void)
case FB_VISUAL_DIRECTCOLOR:
system_visual->colormap_size = 1 << gdk_display->modeinfo.bits_per_pixel;
system_visual->type = GDK_VISUAL_DIRECT_COLOR;
/* Fall through */
case FB_VISUAL_TRUECOLOR:
if(gdk_display->sinfo.visual == FB_VISUAL_TRUECOLOR)
if (gdk_display->sinfo.visual == FB_VISUAL_TRUECOLOR)
system_visual->type = GDK_VISUAL_TRUE_COLOR;
system_visual->red_prec = gdk_display->modeinfo.red.length;
@ -86,7 +70,7 @@ gdk_visual_init (void)
system_visual->colormap_size = 1 << gdk_display->modeinfo.bits_per_pixel;
break;
default:
g_assert_not_reached();
g_assert_not_reached ();
break;
}
}
@ -129,7 +113,7 @@ gdk_visual_get_best (void)
GdkVisual*
gdk_visual_get_best_with_depth (gint depth)
{
if(system_visual->depth != depth)
if (system_visual->depth != depth)
return NULL;
return system_visual;
@ -138,7 +122,7 @@ gdk_visual_get_best_with_depth (gint depth)
GdkVisual*
gdk_visual_get_best_with_type (GdkVisualType visual_type)
{
if(system_visual->type != visual_type)
if (system_visual->type != visual_type)
return NULL;
return system_visual;
@ -148,10 +132,10 @@ GdkVisual*
gdk_visual_get_best_with_both (gint depth,
GdkVisualType visual_type)
{
if(system_visual->depth != depth)
if (system_visual->depth != depth)
return NULL;
if(system_visual->type != visual_type)
if (system_visual->type != visual_type)
return NULL;
return system_visual;
@ -176,5 +160,5 @@ gdk_query_visual_types (GdkVisualType **visual_types,
GList*
gdk_list_visuals (void)
{
return g_list_append(NULL, gdk_visual_get_system());
return g_list_append (NULL, gdk_visual_get_system ());
}

File diff suppressed because it is too large Load Diff

View File

@ -23,45 +23,6 @@ typedef struct _miDash *miDashPtr;
#define CT_YXSORTED 14
#define CT_YXBANDED 18
struct _GdkGCFuncs {
void (* ValidateGC)(
GdkGC* /*pGC*/,
unsigned long /*stateChanges*/,
GdkDrawable* /*pDrawable*/
);
void (* ChangeGC)(
GdkGC* /*pGC*/,
unsigned long /*mask*/
);
void (* CopyGC)(
GdkGC* /*pGCSrc*/,
unsigned long /*mask*/,
GdkGC* /*pGCDst*/
);
void (* DestroyGC)(
GdkGC* /*pGC*/
);
void (* ChangeClip)(
GdkGC* /*pGC*/,
int /*type*/,
gpointer /*pvalue*/,
int /*nrects*/
);
void (* DestroyClip)(
GdkGC* /*pGC*/
);
void (* CopyClip)(
GdkGC* /*pgcDst*/,
GdkGC* /*pgcSrc*/
);
};
typedef union {
guint32 val;
gpointer ptr;
@ -70,223 +31,6 @@ typedef union {
#define PixmapBytePad(w, d) (w)
#define BitmapBytePad(w) (w)
#if 0
typedef struct _PaddingInfo {
int padRoundUp; /* pixels per pad unit - 1 */
int padPixelsLog2; /* log 2 (pixels per pad unit) */
int padBytesLog2; /* log 2 (bytes per pad unit) */
int notPower2; /* bitsPerPixel not a power of 2 */
int bytesPerPixel; /* only set when notPower2 is TRUE */
} PaddingInfo;
extern PaddingInfo PixmapWidthPaddingInfo[];
#define PixmapWidthInPadUnits(w, d) \
(PixmapWidthPaddingInfo[d].notPower2 ? \
(((int)(w) * PixmapWidthPaddingInfo[d].bytesPerPixel + \
PixmapWidthPaddingInfo[d].bytesPerPixel) >> \
PixmapWidthPaddingInfo[d].padBytesLog2) : \
((int)((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
PixmapWidthPaddingInfo[d].padPixelsLog2))
#define PixmapBytePad(w, d) \
(PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2)
#define BitmapBytePad(w) \
(((int)((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD)
typedef struct _GdkDrawable GdkPixmap, *GdkPixmap*;
typedef struct _GdkDrawable GdkDrawable, *GdkDrawable*;
typedef struct _GdkGCOps GdkGCOps;
typedef struct _Region Region, *GdkRegion*;
#define EVEN_DASH 0
#define ODD_DASH ~0
typedef struct _GdkPoint {
gint16 x, y;
} GdkPoint, *GdkPoint*;
typedef struct _GdkGC {
unsigned char depth;
unsigned char alu;
unsigned short line_width;
unsigned short dashOffset;
unsigned short numInDashList;
unsigned char *dash;
unsigned int lineStyle : 2;
unsigned int capStyle : 2;
unsigned int joinStyle : 2;
unsigned int fillStyle : 2;
unsigned int fillRule : 1;
unsigned int arcMode : 1;
unsigned int subWindowMode : 1;
unsigned int graphicsExposures : 1;
unsigned int clientClipType : 2; /* CT_<kind> */
unsigned int miTranslate:1; /* should mi things translate? */
unsigned int tileIsPixel:1; /* tile is solid pixel */
unsigned int fExpose:1; /* Call exposure handling */
unsigned int freeCompClip:1; /* Free composite clip */
unsigned int unused:14; /* see comment above */
unsigned long planemask;
unsigned long fgPixel;
unsigned long bgPixel;
/*
* alas -- both tile and stipple must be here as they
* are independently specifiable
*/
/* PixUnion tile;
GdkPixmap* stipple;*/
GdkPoint patOrg; /* origin for (tile, stipple) */
struct _Font *font;
GdkPoint clipOrg;
GdkPoint lastWinOrg; /* position of window last validated */
gpointer clientClip;
unsigned long stateChanges; /* masked with GC_<kind> */
unsigned long serialNumber;
/* GCFuncs *funcs; */
GdkGCOps *ops;
} GdkGC, *GdkGC*;
struct _GdkDrawable {
unsigned char type; /* DRAWABLE_<type> */
unsigned char depth;
unsigned char bitsPerPixel;
short x; /* window: screen absolute, pixmap: 0 */
short y; /* window: screen absolute, pixmap: 0 */
unsigned short width;
unsigned short height;
unsigned long serialNumber;
guchar *buffer;
int rowStride;
};
typedef struct _GdkSegment {
gint16 x1, y1, x2, y2;
} GdkSegment;
typedef struct _GdkRectangle {
gint16 x, y;
guint16 width, height;
} GdkRectangle, *GdkRectangle*;
typedef struct _Box {
short x1, y1, x2, y2;
} BoxRec, *BoxPtr;
/*
* graphics operations invoked through a GC
*/
/* graphics functions, as in GC.alu */
#define GDK_CLEAR 0x0 /* 0 */
#define GDK_AND 0x1 /* src AND dst */
#define GDK_AND_REVERSE 0x2 /* src AND NOT dst */
#define GDK_COPY 0x3 /* src */
#define GDK_AND_INVERT 0x4 /* NOT src AND dst */
#define GDK_NOOP 0x5 /* dst */
#define GDK_XOR 0x6 /* src XOR dst */
#define GDK_OR 0x7 /* src OR dst */
#define GDK_NOR 0x8 /* NOT src AND NOT dst */
#define GDK_EQUIV 0x9 /* NOT src XOR dst */
#define GDK_INVERT 0xa /* NOT dst */
#define GDK_OR_REVERSE 0xb /* src OR NOT dst */
#define GDK_COPY_INVERT 0xc /* NOT src */
#define GDK_OR_INVERT 0xd /* NOT src OR dst */
#define GDK_NAND 0xe /* NOT src OR NOT dst */
#define GDK_SET 0xf /* 1 */
/* CoordinateMode for drawing routines */
#define CoordModeOrigin 0 /* relative to the origin */
#define CoordModePrevious 1 /* relative to previous point */
/* Polygon shapes */
#define Complex 0 /* paths may intersect */
#define Nonconvex 1 /* no paths intersect, but not convex */
#define Convex 2 /* wholly convex */
/* LineStyle */
#define GDK_LINE_SOLID 0
#define GDK_LINE_ON_OFF_DASH 1
#define GDK_LINE_DOUBLE_DASH 2
/* capStyle */
#define GDK_CAP_NOT_LAST 0
#define GDK_CAP_BUTT 1
#define GDK_CAP_ROUND 2
#define GDK_CAP_PROJECTING 3
/* joinStyle */
#define GDK_JOIN_MITER 0
#define GDK_JOIN_ROUND 1
#define GDK_JOIN_BEVEL 2
/* Arc modes for PolyFillArc */
#define ArcChord 0 /* join endpoints of arc */
#define ArcPieSlice 1 /* join endpoints to center of arc */
/* fillRule */
#define EvenOddRule 0
#define WindingRule 1
/* fillStyle */
#define GDK_SOLID 0
#define GDK_TILED 1
#define GDK_STIPPLED 2
#define GDK_OPAQUE_STIPPLED 3
typedef enum { Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit } FontEncoding;
#define MININT G_MININT
#define MAXINT G_MAXINT
#define MINSHORT G_MINSHORT
#define MAXSHORT G_MAXSHORT
/* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into
GC.stateChanges */
#define GDK_GC_FUNCTION (1L<<0)
#define GCPlaneMask (1L<<1)
#define GDK_GC_FOREGROUND (1L<<2)
#define GDK_GC_BACKGROUND (1L<<3)
#define GDK_GC_LINE_WIDTH (1L<<4)
#define GCLineStyle (1L<<5)
#define GDK_GC_CAP_STYLE (1L<<6)
#define GDK_GC_JOIN_STYLE (1L<<7)
#define GDK_GC_FILL_STYLE (1L<<8)
#define GCFillRule (1L<<9)
#define GCTile (1L<<10)
#define GDK_GC_STIPPLE (1L<<11)
#define GDK_GC_TS_X_ORIGIN (1L<<12)
#define GDK_GC_TS_Y_ORIGIN (1L<<13)
#define GCFont (1L<<14)
#define GCSubwindowMode (1L<<15)
#define GCGraphicsExposures (1L<<16)
#define GCClipXOrigin (1L<<17)
#define GCClipYOrigin (1L<<18)
#define GCClipMask (1L<<19)
#define GCDashOffset (1L<<20)
#define GCDashList (1L<<21)
#define GCArcMode (1L<<22)
/* types for Drawable */
#define GDK_WINDOW_CHILD 0
#define GDK_DRAWABLE_PIXMAP 1
#define GDK_WINDOW_FOREIGN 2
#define GDK_WINDOW_TEMP 3
#endif
typedef GdkSegment BoxRec, *BoxPtr;
typedef struct _miArc {
@ -295,192 +39,6 @@ typedef struct _miArc {
gint16 angle1, angle2;
} miArc;
struct _GdkGCOps {
void (* FillSpans)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*nInit*/,
GdkPoint* /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
);
void (* SetSpans)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
char * /*psrc*/,
GdkPoint* /*ppt*/,
int * /*pwidth*/,
int /*nspans*/,
int /*fSorted*/
);
void (* PutImage)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*depth*/,
int /*x*/,
int /*y*/,
int /*w*/,
int /*h*/,
int /*leftPad*/,
int /*format*/,
char * /*pBits*/
);
GdkRegion* (* CopyArea)(
GdkDrawable* /*pSrc*/,
GdkDrawable* /*pDst*/,
GdkGC* /*pGC*/,
int /*srcx*/,
int /*srcy*/,
int /*w*/,
int /*h*/,
int /*dstx*/,
int /*dsty*/
);
GdkRegion* (* CopyPlane)(
GdkDrawable* /*pSrcDrawable*/,
GdkDrawable* /*pDstDrawable*/,
GdkGC* /*pGC*/,
int /*srcx*/,
int /*srcy*/,
int /*width*/,
int /*height*/,
int /*dstx*/,
int /*dsty*/,
unsigned long /*bitPlane*/
);
void (* PolyPoint)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*mode*/,
int /*npt*/,
GdkPoint* /*pptInit*/
);
void (* Polylines)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*mode*/,
int /*npt*/,
GdkPoint* /*pptInit*/
);
void (* PolySegment)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*nseg*/,
GdkSegment * /*pSegs*/
);
void (* PolyRectangle)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*nrects*/,
GdkRectangle * /*pRects*/
);
void (* PolyArc)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*narcs*/,
miArc * /*parcs*/
);
void (* FillPolygon)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*shape*/,
int /*mode*/,
int /*count*/,
GdkPoint* /*pPts*/
);
void (* PolyFillRect)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*nrectFill*/,
GdkRectangle * /*prectInit*/
);
void (* PolyFillArc)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*narcs*/,
miArc * /*parcs*/
);
#if 0
int (* PolyText8)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
char * /*chars*/
);
int (* PolyText16)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
unsigned short * /*chars*/
);
void (* ImageText8)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
char * /*chars*/
);
void (* ImageText16)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
unsigned short * /*chars*/
);
void (* ImageGlyphBlt)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*x*/,
int /*y*/,
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
);
void (* PolyGlyphBlt)(
GdkDrawable* /*pDrawable*/,
GdkGC* /*pGC*/,
int /*x*/,
int /*y*/,
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
);
#endif
void (* PushPixels)(
GdkGC* /*pGC*/,
GdkPixmap* /*pBitMap*/,
GdkDrawable* /*pDst*/,
int /*w*/,
int /*h*/,
int /*x*/,
int /*y*/
);
};
#define SCRRIGHT(x, n) ((x)>>(n))
#endif /* MITYPES_H */

View File

@ -23,8 +23,8 @@
#include <glib.h>
#include <pango/pango.h>
#include <pango/pango-utils.h>
#include "gdkprivate-fb.h"
#include <fribidi/fribidi.h>
PangoGlyph
pango_fb_get_unknown_glyph(PangoFont *font)
@ -325,7 +325,7 @@ basic_engine_shape (PangoFont *font,
for (i=0; i < n_chars; i++)
{
gunichar wc;
FriBidiChar mirrored_ch;
gunichar mirrored_ch;
PangoGlyph index;
char buf[6];
const char *input;
@ -334,7 +334,7 @@ basic_engine_shape (PangoFont *font,
input = p;
if (analysis->level % 2)
if (fribidi_get_mirror_char (wc, &mirrored_ch))
if (pango_get_mirror_char (wc, &mirrored_ch))
{
wc = mirrored_ch;