summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Natterer <mitch@imendio.com>2008-03-11 17:14:00 +0000
committerMichael Natterer <mitch@src.gnome.org>2008-03-11 17:14:00 +0000
commite8c3fbf4d8b464503afad3493a3fbfd6fe4d8f6f (patch)
treeb235fc769548e939abf19e3cdbea0870c615d43f
parent1e1f49e09a8fb141c31875c415e8bd9172dcb0e2 (diff)
downloadgdk-pixbuf-e8c3fbf4d8b464503afad3493a3fbfd6fe4d8f6f.tar.gz
removed linux-fb backend files.
2008-03-11 Michael Natterer <mitch@imendio.com> * gdk/linux-fb/*: removed linux-fb backend files. * acconfig.h * config.h.win32.in * docs/README.linux-fb * gtk/Makefile.am: remove remaining traces of linux-fb. * gtk/gtkwindow-decorate.c: same here. There is some code that calls into linux-fb to set window move/resize callbacks. I put it in #if 0 as a reminder because we did use decorated windows with the DirectFB backend and it did work, so I don't really know why this code is needed or how it could work with DirectFB back then. The file does actually compile now if DECORATE_WINDOWS is defined, but I didn't test with DirectFB to check if it does anything. svn path=/trunk/; revision=19749
-rw-r--r--ChangeLog17
-rw-r--r--acconfig.h6
-rw-r--r--config.h.win32.in6
-rw-r--r--docs/README.linux-fb157
-rw-r--r--gdk/linux-fb/Makefile.am84
-rw-r--r--gdk/linux-fb/gdkcolor-fb.c866
-rw-r--r--gdk/linux-fb/gdkcursor-fb.c538
-rw-r--r--gdk/linux-fb/gdkdisplay-fb.c78
-rw-r--r--gdk/linux-fb/gdkdnd-fb.c727
-rw-r--r--gdk/linux-fb/gdkdrawable-fb2.c1575
-rw-r--r--gdk/linux-fb/gdkevents-fb.c233
-rw-r--r--gdk/linux-fb/gdkfb.h43
-rw-r--r--gdk/linux-fb/gdkfbmanager.c407
-rw-r--r--gdk/linux-fb/gdkfbmanager.h37
-rw-r--r--gdk/linux-fb/gdkfbswitch.c106
-rw-r--r--gdk/linux-fb/gdkfont-fb.c584
-rw-r--r--gdk/linux-fb/gdkgc-fb.c380
-rw-r--r--gdk/linux-fb/gdkgeometry-fb.c70
-rw-r--r--gdk/linux-fb/gdkglobals-fb.c48
-rw-r--r--gdk/linux-fb/gdkim-fb.c105
-rw-r--r--gdk/linux-fb/gdkimage-fb.c355
-rw-r--r--gdk/linux-fb/gdkinput-none.c81
-rw-r--r--gdk/linux-fb/gdkinput.c387
-rw-r--r--gdk/linux-fb/gdkinputprivate.h153
-rw-r--r--gdk/linux-fb/gdkkeyboard-fb.c1603
-rw-r--r--gdk/linux-fb/gdkmain-fb.c1652
-rw-r--r--gdk/linux-fb/gdkmouse-fb.c864
-rw-r--r--gdk/linux-fb/gdkpango-fb.c38
-rw-r--r--gdk/linux-fb/gdkpixmap-fb.c214
-rw-r--r--gdk/linux-fb/gdkprivate-fb.h471
-rw-r--r--gdk/linux-fb/gdkproperty-fb.c265
-rw-r--r--gdk/linux-fb/gdkrender-fb.c1549
-rw-r--r--gdk/linux-fb/gdkscreen-fb.c120
-rw-r--r--gdk/linux-fb/gdkselection-fb.c431
-rw-r--r--gdk/linux-fb/gdkspawn-fb.c104
-rw-r--r--gdk/linux-fb/gdkvisual-fb.c229
-rw-r--r--gdk/linux-fb/gdkwindow-fb.c2380
-rw-r--r--gdk/linux-fb/mi.h21
-rw-r--r--gdk/linux-fb/miarc.c3470
-rw-r--r--gdk/linux-fb/midash.c310
-rw-r--r--gdk/linux-fb/mifillarc.c707
-rw-r--r--gdk/linux-fb/mifillarc.h191
-rw-r--r--gdk/linux-fb/mifpoly.h109
-rw-r--r--gdk/linux-fb/mifpolycon.c257
-rw-r--r--gdk/linux-fb/miline.h175
-rw-r--r--gdk/linux-fb/mipoly.c68
-rw-r--r--gdk/linux-fb/mipoly.h199
-rw-r--r--gdk/linux-fb/mipolygen.c209
-rw-r--r--gdk/linux-fb/mipolyutil.c381
-rw-r--r--gdk/linux-fb/miscanfill.h139
-rw-r--r--gdk/linux-fb/mispans.c483
-rw-r--r--gdk/linux-fb/mispans.h87
-rw-r--r--gdk/linux-fb/mistruct.h58
-rw-r--r--gdk/linux-fb/mitypes.h37
-rw-r--r--gdk/linux-fb/miwideline.c2028
-rw-r--r--gdk/linux-fb/miwideline.h205
-rw-r--r--gdk/linux-fb/mizerclip.c617
-rw-r--r--gdk/linux-fb/mizerline.c324
-rw-r--r--gdk/linux-fb/x-cursors.xbm924
-rw-r--r--gtk/Makefile.am5
-rw-r--r--gtk/gtkwindow-decorate.c13
61 files changed, 25 insertions, 27955 deletions
diff --git a/ChangeLog b/ChangeLog
index 701c508fe..3b58d34e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2008-03-11 Michael Natterer <mitch@imendio.com>
+
+ * gdk/linux-fb/*: removed linux-fb backend files.
+
+ * acconfig.h
+ * config.h.win32.in
+ * docs/README.linux-fb
+ * gtk/Makefile.am: remove remaining traces of linux-fb.
+
+ * gtk/gtkwindow-decorate.c: same here. There is some code that
+ calls into linux-fb to set window move/resize callbacks. I put it
+ in #if 0 as a reminder because we did use decorated windows with
+ the DirectFB backend and it did work, so I don't really know why
+ this code is needed or how it could work with DirectFB back then.
+ The file does actually compile now if DECORATE_WINDOWS is defined,
+ but I didn't test with DirectFB to check if it does anything.
+
2008-03-11 Alberto Ruiz <aruiz@gnome.org>
* gtk/gtkcombobox.c (gtk_combo_box_size_allocate):
diff --git a/acconfig.h b/acconfig.h
index 6dda772af..6aa859995 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -52,12 +52,6 @@
/* Define to use XKB extension */
#undef HAVE_XKB
-/* Define to use shadowfb in the linux-fb port */
-#undef ENABLE_SHADOW_FB
-
-/* Define to use a fb manager in the linux-fb port */
-#undef ENABLE_FB_MANAGER
-
#undef XINPUT_NONE
#undef XINPUT_GXI
#undef XINPUT_XFREE
diff --git a/config.h.win32.in b/config.h.win32.in
index 99c00b734..0e39db058 100644
--- a/config.h.win32.in
+++ b/config.h.win32.in
@@ -57,12 +57,6 @@
/* Define to use XKB extension */
/* #undef HAVE_XKB */
-/* Define to use shadowfb in the linux-fb port */
-/* #undef ENABLE_SHADOW_FB */
-
-/* Define to use a fb manager in the linux-fb port */
-/* #undef ENABLE_FB_MANAGER */
-
/* #undef XINPUT_NONE */
/* #undef XINPUT_GXI */
/* #undef XINPUT_XFREE */
diff --git a/docs/README.linux-fb b/docs/README.linux-fb
deleted file mode 100644
index ef113785a..000000000
--- a/docs/README.linux-fb
+++ /dev/null
@@ -1,157 +0,0 @@
-
-
-
-
-THIS FILE IS OBSOLETE - use docs/reference/gtk/framebuffer.sgml
-
-
-
-
-
-
-
-About GtkFB:
-------------
-The linux-fb port of Gtk+, also known as GtkFB is an implementation of
-gdk (and therefor gtk) that runs on the linux framebuffer. It runs in
-a single process that doesn't need X. It should run most Gtk+ programs
-without any changes to the source.
-
-Build requirements:
--------------------
-To run GtkFB programs you will need glib, pango and gtk from cvs
-HEAD. Make sure you update these at the same time, since changes to
-glib and pango often forces changes in gtk+. Pango optionally depends
-on libfribidi, but for normal GtkFB usage that can be ignored.
-
-You also need freetype 2, I recommend that you use freetype 2.0.1 or
-later, as there was some problems with freetype-config in 2.0.
-Make sure that you install freetype before pango, since pango also
-needs it.
-Freetype can be found at ftp://ftp.freetype.org
-
-Hardware requirements:
-----------------------
-You need a graphics card with an available framebuffer driver that can
-run in 8, 16, 24 or 32 bpp. I use the matroxfb driver, but i.e. vesafb
-should work too. You also need a supported mouse. Currently supported
-is ps2 mouse, ms serial mouse and fidmour touchscreen.
-
-Building and installing:
-------------------------
-First build and install glib and pango as usual, in that order.
-
-Then configure Gtk by running configure (or autogen.sh if running from
-cvs) with --with-gdktarget=linux-fb.
-
-Then compile as usual: make; make install
-
-Fonts:
-------
-Since GtkFB uses freetype 2 to render fonts it can render truetype and
-postscript type 1 antialiased fonts.
-
-At startup it scans some directories looking for fonts. By default
-it looks in $prefix/lib/ft2fonts, and if you want to change this you
-must add something like:
-
-[PangoFT2]
-FontPath = /usr/share/fonts/default/Type1:/usr/share/fonts/default/TrueType
-
-To your $prefix/etc/pango/pangorc or ~/.pangorc.
-
-You must also set up font aliases for the fonts Sans, Serif and Monotype.
-This is done by creating a $prefix/etc/pango/pangoft2.aliases or
-~/.pangoft2_aliases file. You can also set the name of this file using the
-key AliasFiles in the PangoFT2 section in pangorc.
-
-An example of a font alias file for the urw fontset is:
-sans normal normal normal normal "urw gothic l"
-serif normal normal normal normal "urw palladio l"
-monospace normal normal normal normal "nimbus mono l"
-
-And one using the Windows truetype fonts is:
-sans normal normal normal normal "arial"
-serif normal normal normal normal "times new roman"
-monospace normal normal normal normal "courier new"
-
-A more detailed example can be found in examples/pangoft2.aliases in the
-pango distribution.
-
-Running:
---------
-To run a program you should only need to start it, but there are some
-things that can cause problems, and some things that can be controlled
-by environment variables. Try testgtk distributed with gtk+ to test
-if things work.
-
-If you use a ps2 mouse, make sure that /dev/psaux is readable and
-writable.
-
-Make sure gpm is not running.
-
-If you don't specify anything GtkFB will start up in the current
-virtual console in the current resolution and bit-depth. This can be
-changed by specifying environment variables:
-
-GDK_VT:
- unset means open on the current VT.
- 0-9: open on the specified VT. Make sure you have read/write rights
- there.
- new: Allocate a new VT after the last currently used one.
-
-GDK_DISPLAY_MODE:
- Specifies the name of a mode in /etc/fb.modes that you want to use.
-
-GDK_DISPLAY_DEPTH:
- Specify the desired bit depth of the framebuffer.
-
-GDK_DISPLAY_WIDTH:
- Specify the desired width of the framebuffer.
-
-GDK_DISPLAY_HEIGHT:
- Specify the desired height of the framebuffer.
-
-GDK_DISPLAY:
- Specify the framebuffer device to use. Default is /dev/fb0
-
-GDK_MOUSE_TYPE:
- Specify mouse type. Currently supported is:
- ps2 - PS/2 mouse
- imps2 - PS/2 intellimouse (wheelmouse)
- ms - Microsoft serial mouse
- fidmour - touch screen
- Default is ps2.
-
-GDK_KEYBOARD_TYPE:
- Specify keyboard type. Currently supported is
- xlate - normal tty mode keyboard.
- Quite limited, cannot detect key up/key down events. Doesn't
- handle ctrl/alt/shift for all keys. This is the default driver,
- but should not be used in "production" use.
- raw - read from the tty in RAW mode.
- Sets the keyboard in RAW mode and handles all the keycodes. This
- gives correct handling of modifiers and key up/down events. You
- must be root to use this. If you use this for development or
- debugging it is recommended to enable magic sysrq handling in the
- kernel. Then you can use ALT-SysRQ-r to turn the keyboard back to
- normal mode.
- Default is xlate.
-
-HACKING:
---------
-
-Pressing Ctrl-Alt-Return repaints the whole screen.
-Unfortunately this cannot be pressed when using the xlate keyboard
-driver, so instead you can use shift-F1 instead when using this
-driver.
-
-Pressing Ctrl-Alt-BackSpace kills the GtkFB program. (Can't be pressed
-in the xlate driver.
-
-More to be written.
-
- - Alexander Larsson <alexl@redhat.com>
- 2000/12/06
-
-
diff --git a/gdk/linux-fb/Makefile.am b/gdk/linux-fb/Makefile.am
deleted file mode 100644
index 3a019a9a1..000000000
--- a/gdk/linux-fb/Makefile.am
+++ /dev/null
@@ -1,84 +0,0 @@
-## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
-
-bin_PROGRAMS =
-
-if ENABLE_FB_MANAGER
-bin_PROGRAMS += gdkfbmanager gdkfbswitch
-endif
-
-libgdkincludedir = $(includedir)/gtk-2.0/gdk
-libgdkfbincludedir = $(includedir)/gtk-2.0/gdk/linux-fb
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"Gdk\" \
- -DGDK_DATA_PREFIX=\"$(prefix)\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/gdk \
- -I$(top_builddir)/gdk \
- -DGDK_PIXBUF_DISABLE_DEPRECATED \
- $(GDK_DEP_CFLAGS) \
- $(GTK_DEBUG_FLAGS)
-
-noinst_LTLIBRARIES = libgdk-linux-fb.la
-
-libgdkinclude_HEADERS= \
- gdkfb.h
-
-libgdk_linux_fb_la_SOURCES = \
- gdkcolor-fb.c \
- gdkcursor-fb.c \
- gdkdisplay-fb.c \
- gdkdnd-fb.c \
- gdkdrawable-fb2.c \
- gdkevents-fb.c \
- gdkfbmanager.h \
- gdkfont-fb.c \
- gdkgc-fb.c \
- gdkgeometry-fb.c \
- gdkglobals-fb.c \
- gdkim-fb.c \
- gdkimage-fb.c \
- gdkinput.c \
- gdkinputprivate.h \
- gdkkeyboard-fb.c \
- gdkmain-fb.c \
- gdkmouse-fb.c \
- gdkpango-fb.c \
- gdkpixmap-fb.c \
- gdkprivate-fb.h \
- gdkproperty-fb.c \
- gdkrender-fb.c \
- gdkscreen-fb.c \
- gdkselection-fb.c \
- gdkspawn-fb.c \
- gdkvisual-fb.c \
- gdkwindow-fb.c \
- mi.h \
- miarc.c \
- midash.c \
- mifillarc.c \
- mifillarc.h \
- mifpoly.h \
- mifpolycon.c \
- miline.h \
- mipoly.c \
- mipoly.h \
- mipolygen.c \
- mipolyutil.c \
- miscanfill.h \
- mispans.c \
- mispans.h \
- mistruct.h \
- mitypes.h \
- miwideline.c \
- miwideline.h \
- mizerclip.c \
- mizerline.c
-
-gdkfbmanager_sources = gdkfbmanager.c
-gdkfbmanager_LDFLAGS = $(GLIB_LIBS)
-gdkfbswitch_sources = gdkfbswitch.c
-gdkfbswitch_LDFLAGS = $(GLIB_LIBS)
-
-EXTRA_DIST += x-cursors.xbm
diff --git a/gdk/linux-fb/gdkcolor-fb.c b/gdk/linux-fb/gdkcolor-fb.c
deleted file mode 100644
index c2bbb10b2..000000000
--- a/gdk/linux-fb/gdkcolor-fb.c
+++ /dev/null
@@ -1,866 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <time.h>
-#include <sys/ioctl.h>
-#include <string.h>
-#include <stdlib.h>
-
-#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);
-static void gdk_fb_color_round_to_hw (GdkColor *color);
-
-static gpointer parent_class;
-
-static void
-gdk_colormap_finalize (GObject *object)
-{
- GdkColormap *colormap = GDK_COLORMAP (object);
- GdkColormapPrivateFB *private = GDK_COLORMAP_PRIVATE_DATA (colormap);
-
- if (private->hash)
- g_hash_table_destroy (private->hash);
-
- g_free (private->info);
- g_free (colormap->colors);
- g_free (private);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gdk_colormap_init (GdkColormap *colormap)
-{
- GdkColormapPrivateFB *private;
-
- private = g_new (GdkColormapPrivateFB, 1);
-
- colormap->windowing_data = private;
-
- colormap->size = 0;
- colormap->colors = NULL;
-}
-
-static void
-gdk_colormap_class_init (GdkColormapClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_colormap_finalize;
-}
-
-GType
-gdk_colormap_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (GdkColormapClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_colormap_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkColormap),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gdk_colormap_init,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "GdkColormap",
- &object_info,
- 0);
- }
-
- return object_type;
-}
-
-GdkColormap *
-gdk_colormap_new (GdkVisual *visual,
- gint private_cmap)
-{
- GdkColormap *colormap;
- GdkColormap *system;
- GdkColormapPrivateFB *private;
- GdkFBDisplay *fbd;
- int i;
-
- g_return_val_if_fail (visual != NULL, NULL);
-
- colormap = g_object_new (gdk_colormap_get_type (), NULL);
- private = GDK_COLORMAP_PRIVATE_DATA (colormap);
-
- colormap->visual = visual;
- fbd = gdk_display;
-
- private->hash = NULL;
-
- colormap->size = visual->colormap_size;
- colormap->colors = NULL;
-
- switch (visual->type)
- {
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_STATIC_COLOR:
- case GDK_VISUAL_GRAYSCALE:
- case GDK_VISUAL_PSEUDO_COLOR:
- private->info = g_new0 (GdkColorInfo, colormap->size);
- colormap->colors = g_new (GdkColor, colormap->size);
-
- private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
- (GEqualFunc) gdk_color_equal);
-
- system = gdk_colormap_get_system ();
- memcpy (colormap->colors, system->colors, colormap->size * sizeof (GdkColor));
-
- if (private_cmap)
- {
- guint16 red[256], green[256], blue[256];
- struct fb_cmap fbc = {0, 256};
-
- fbc.red = red;
- fbc.green = green;
- fbc.blue = blue;
-
- if (ioctl (fbd->fb_fd, FBIOGETCMAP, &fbc))
- g_error("ioctl(FBIOGETCMAP) failed");
-
- for (i = 0; i < colormap->size; i++)
- {
- colormap->colors[i].pixel = i;
- colormap->colors[i].red = red[i];
- colormap->colors[i].green = green[i];
- colormap->colors[i].blue = blue[i];
- }
-
- gdk_colormap_change (colormap, colormap->size);
- }
- break;
-
- case GDK_VISUAL_DIRECT_COLOR:
- g_warning ("gdk_colormap_new () on a direct color visual not implemented");
-#if 0
- colormap->colors = g_new (GdkColor, colormap->size);
-
- size = 1 << visual->red_prec;
- for (i = 0; i < size; i++)
- colormap->colors[i].red = i * 65535 / (size - 1);
-
- size = 1 << visual->green_prec;
- for (i = 0; i < size; i++)
- colormap->colors[i].green = i * 65535 / (size - 1);
-
- size = 1 << visual->blue_prec;
- for (i = 0; i < size; i++)
- colormap->colors[i].blue = i * 65535 / (size - 1);
-
- gdk_colormap_change (colormap, colormap->size);
-#endif
- break;
-
- default:
- g_assert_not_reached ();
-
- case GDK_VISUAL_TRUE_COLOR:
- break;
- }
-
- return colormap;
-}
-
-GdkColormap*
-gdk_screen_get_system_colormap (GdkScreen *screen)
-{
- static GdkColormap *colormap = NULL;
-
- if (!colormap)
- {
- GdkColormapPrivateFB *private;
- GdkVisual *visual = gdk_visual_get_system ();
- int i, r, g, b;
-
- colormap = g_object_new (gdk_colormap_get_type (), NULL);
- private = GDK_COLORMAP_PRIVATE_DATA (colormap);
-
- colormap->visual = visual;
- private->hash = NULL;
-
- colormap->size = visual->colormap_size;
- colormap->colors = NULL;
-
- switch (visual->type)
- {
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_STATIC_COLOR:
- case GDK_VISUAL_GRAYSCALE:
- case GDK_VISUAL_PSEUDO_COLOR:
- private->info = g_new0 (GdkColorInfo, colormap->size);
- colormap->colors = g_new (GdkColor, colormap->size);
-
- private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
- (GEqualFunc) gdk_color_equal);
- switch(visual->type)
- {
- case GDK_VISUAL_GRAYSCALE:
- for(i = 0; i < 256; i++) {
- colormap->colors[i].red =
- colormap->colors[i].green =
- colormap->colors[i].blue = i << 8;
- gdk_fb_color_round_to_hw (&colormap->colors[i]);
- }
- i--;
- colormap->colors[i].red =
- colormap->colors[i].green =
- colormap->colors[i].blue = 65535; /* Make it a true white */
- gdk_fb_color_round_to_hw (&colormap->colors[i]);
- break;
- case GDK_VISUAL_PSEUDO_COLOR:
- /* Color cube stolen from gdkrgb upon advice from Owen */
- for(i = r = 0; r < 6; r++)
- for(g = 0; g < 6; g++)
- for(b = 0; b < 6; b++)
- {
- colormap->colors[i].red = r * 65535 / 5;
- colormap->colors[i].green = g * 65535 / 5;
- colormap->colors[i].blue = b * 65535 / 5;
- gdk_fb_color_round_to_hw (&colormap->colors[i]);
- i++;
- }
- g_assert (i == 216);
- /* Fill in remaining space with grays */
- for(i = 216; i < 256; i++)
- {
- colormap->colors[i].red =
- colormap->colors[i].green =
- colormap->colors[i].blue = (i - 216) * 40;
- gdk_fb_color_round_to_hw (&colormap->colors[i]);
- }
- /* Real white */
- colormap->colors[255].red =
- colormap->colors[255].green =
- colormap->colors[255].blue = 65535;
- gdk_fb_color_round_to_hw (&colormap->colors[255]);
-
- break;
- default:
- break;
- }
- break;
- case GDK_VISUAL_DIRECT_COLOR:
- g_warning ("gdk_colormap_get_system() on a direct color visual is not implemented");
- break;
- default:
- g_assert_not_reached ();
- case GDK_VISUAL_TRUE_COLOR:
- break;
- }
-
- /* Lock all colors for the system colormap
- * on pseudocolor visuals. The AA text rendering
- * takes to many colors otherwise.
- */
- if ((visual->type == GDK_VISUAL_GRAYSCALE) ||
- (visual->type == GDK_VISUAL_PSEUDO_COLOR))
- {
- for(i = 0; i < 256; i++)
- {
- colormap->colors[i].pixel = i;
- private->info[i].ref_count = 1;
- g_hash_table_insert (private->hash,
- &colormap->colors[i],
- &colormap->colors[i]);
- }
- }
- gdk_colormap_change (colormap, colormap->size);
- }
-
- return colormap;
-}
-
-gint
-gdk_colormap_get_system_size (void)
-{
- return 1 << (gdk_display->modeinfo.bits_per_pixel);
-}
-
-void
-gdk_colormap_change (GdkColormap *colormap,
- gint ncolors)
-{
- guint16 red[256], green[256], blue[256];
- struct fb_cmap fbc = {0,256};
- GdkColormapPrivateFB *private;
- int i;
-
- g_return_if_fail (colormap != NULL);
-
- fbc.red = red;
- fbc.green = green;
- fbc.blue = blue;
-
- private = GDK_COLORMAP_PRIVATE_DATA (colormap);
- switch (colormap->visual->type)
- {
- case GDK_VISUAL_GRAYSCALE:
- for(i = 0; i < ncolors; i++)
- {
- red[i] = green[i] = blue[i] =
- (colormap->colors[i].red +
- colormap->colors[i].green +
- colormap->colors[i].blue)/3;
- }
- ioctl (gdk_display->fb_fd, FBIOPUTCMAP, &fbc);
- break;
-
- case GDK_VISUAL_PSEUDO_COLOR:
- for (i = 0; i < ncolors; i++)
- {
- red[i] = colormap->colors[i].red;
- green[i] = colormap->colors[i].green;
- blue[i] = colormap->colors[i].blue;
- }
- ioctl (gdk_display->fb_fd, FBIOPUTCMAP, &fbc);
- break;
-
- default:
- break;
- }
-}
-
-void
-gdk_colormap_free_colors (GdkColormap *colormap,
- GdkColor *colors,
- gint ncolors)
-{
- GdkColormapPrivateFB *private;
- gint i;
-
- g_return_if_fail (colormap != NULL);
- g_return_if_fail (colors != NULL);
-
- private = GDK_COLORMAP_PRIVATE_DATA (colormap);
-
- if ((colormap->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
- (colormap->visual->type != GDK_VISUAL_GRAYSCALE))
- return;
-
- for (i = 0; i < ncolors; i++)
- {
- gulong pixel = colors[i].pixel;
-
- if (private->info[pixel].ref_count)
- {
- private->info[pixel].ref_count--;
-
- if (private->info[pixel].ref_count == 0)
- {
- if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
- g_hash_table_remove (private->hash, &colormap->colors[pixel]);
- private->info[pixel].flags = 0;
- }
- }
- }
-}
-
-/********************
- * Color allocation *
- ********************/
-
-static void
-gdk_fb_color_round_to_hw (GdkColor *color)
-{
- guint rmask, gmask, bmask, len;
-
- len = gdk_display->modeinfo.red.length;
- rmask = ((1 << len) - 1) << (16-len);
- len = gdk_display->modeinfo.green.length;
- gmask = ((1 << len) - 1) << (16-len);
- len = gdk_display->modeinfo.blue.length;
- bmask = ((1 << len) - 1) << (16-len);
-
- color->red &=rmask;
- color->green &=gmask;
- color->blue &=bmask;
-}
-
-/* Try to allocate a single color using XAllocColor. If it succeeds,
- * cache the result in our colormap, and store in ret.
- */
-static gboolean
-gdk_colormap_alloc1 (GdkColormap *colormap,
- GdkColor *color,
- GdkColor *ret)
-{
- GdkColormapPrivateFB *private;
- int i;
-
- private = GDK_COLORMAP_PRIVATE_DATA (colormap);
-
- if (colormap->visual->type != GDK_VISUAL_GRAYSCALE
- && colormap->visual->type != GDK_VISUAL_PSEUDO_COLOR)
- return FALSE;
-
- *ret = *color;
-
- gdk_fb_color_round_to_hw (ret);
-
- for (i = 0; i<colormap->size; i++)
- {
- if (!(private->info[i].flags & GDK_COLOR_WRITEABLE) &&
- (ret->red == colormap->colors[i].red) &&
- (ret->green == colormap->colors[i].green) &&
- (ret->blue == colormap->colors[i].blue))
- {
- ret->pixel = i;
- colormap->colors[i].pixel = i;
- if (private->info[i].ref_count == 0)
- g_hash_table_insert (private->hash,
- &colormap->colors[ret->pixel],
- &colormap->colors[ret->pixel]);
- private->info[i].ref_count++;
- return TRUE;
- }
- }
-
- for (i = 0; i<colormap->size; i++)
- {
- if (private->info[i].ref_count==0)
- {
- 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->fb_fd, FBIOPUTCMAP, &fbc);
-
- ret->pixel = i;
- colormap->colors[ret->pixel] = *ret;
- private->info[ret->pixel].ref_count = 1;
- g_hash_table_insert (private->hash,
- &colormap->colors[ret->pixel],
- &colormap->colors[ret->pixel]);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static gint
-gdk_colormap_alloc_colors_shared (GdkColormap *colormap,
- GdkColor *colors,
- gint ncolors,
- gboolean writeable,
- gboolean best_match,
- gboolean *success)
-{
- GdkColormapPrivateFB *private;
- gint i, index;
- gint nremaining = 0;
- gint nfailed = 0;
-
- private = GDK_COLORMAP_PRIVATE_DATA (colormap);
- index = -1;
-
- for (i = 0; i < ncolors; i++)
- {
- if (!success[i])
- {
- if (gdk_colormap_alloc1 (colormap, &colors[i], &colors[i]))
- success[i] = TRUE;
- else
- nremaining++;
- }
- }
-
-
- if (nremaining > 0 && best_match)
- {
- gchar *available = g_new (gchar, colormap->size);
-
- for (i = 0; i < colormap->size; i++)
- available[i] = ((private->info[i].ref_count == 0) ||
- !(private->info[i].flags & GDK_COLOR_WRITEABLE));
-
- while (nremaining > 0)
- {
- for (i = 0; i < ncolors; i++)
- {
- if (!success[i])
- {
- index = gdk_colormap_match_color (colormap, &colors[i], available);
- if (index != -1)
- {
- if (private->info[index].ref_count)
- {
- private->info[index].ref_count++;
- colors[i] = colormap->colors[index];
- success[i] = TRUE;
- nremaining--;
- }
- else
- {
- if (gdk_colormap_alloc1 (colormap,
- &colormap->colors[index],
- &colors[i]))
- {
- success[i] = TRUE;
- nremaining--;
- break;
- }
- else
- {
- available[index] = FALSE;
- }
- }
- }
- else
- {
- nfailed++;
- nremaining--;
- success[i] = 2; /* flag as permanent failure */
- }
- }
- }
- }
- g_free (available);
- }
-
- /* Change back the values we flagged as permanent failures */
- if (nfailed > 0)
- {
- for (i = 0; i < ncolors; i++)
- if (success[i] == 2)
- success[i] = FALSE;
- nremaining = nfailed;
- }
-
- return (ncolors - nremaining);
-}
-
-static gint
-gdk_colormap_alloc_colors_pseudocolor (GdkColormap *colormap,
- GdkColor *colors,
- gint ncolors,
- gboolean writeable,
- gboolean best_match,
- gboolean *success)
-{
- GdkColormapPrivateFB *private;
- GdkColor *lookup_color;
- gint i;
- gint nremaining = 0;
-
- private = GDK_COLORMAP_PRIVATE_DATA (colormap);
-
- /* Check for an exact match among previously allocated colors */
-
- for (i = 0; i < ncolors; i++)
- {
- if (!success[i])
- {
- lookup_color = g_hash_table_lookup (private->hash, &colors[i]);
- if (lookup_color)
- {
- private->info[lookup_color->pixel].ref_count++;
- colors[i].pixel = lookup_color->pixel;
- success[i] = TRUE;
- }
- else
- nremaining++;
- }
- }
-
- /* If that failed, we try to allocate a new color, or approxmiate
- * with what we can get if best_match is TRUE.
- */
- if (nremaining > 0)
- return gdk_colormap_alloc_colors_shared (colormap, colors, ncolors, writeable, best_match, success);
- else
- return 0;
-}
-
-gint
-gdk_colormap_alloc_colors (GdkColormap *colormap,
- GdkColor *colors,
- gint ncolors,
- gboolean writeable,
- gboolean best_match,
- gboolean *success)
-{
- GdkColormapPrivateFB *private;
- GdkVisual *visual;
- gint i;
- gint nremaining = 0;
-
- g_return_val_if_fail (colormap != NULL, FALSE);
- g_return_val_if_fail (colors != NULL, FALSE);
-
- private = GDK_COLORMAP_PRIVATE_DATA (colormap);
-
- for (i = 0; i < ncolors; i++)
- success[i] = FALSE;
-
- visual = colormap->visual;
- switch (visual->type)
- {
- case GDK_VISUAL_PSEUDO_COLOR:
- case GDK_VISUAL_GRAYSCALE:
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_STATIC_COLOR:
- return gdk_colormap_alloc_colors_pseudocolor (colormap, colors, ncolors,
- writeable, best_match, success);
- break;
-
- case GDK_VISUAL_DIRECT_COLOR:
- case GDK_VISUAL_TRUE_COLOR:
- for (i = 0; i < ncolors; i++)
- {
- colors[i].pixel = (((colors[i].red >> (16 - visual->red_prec)) << visual->red_shift) +
- ((colors[i].green >> (16 - visual->green_prec)) << visual->green_shift) +
- ((colors[i].blue >> (16 - visual->blue_prec)) << visual->blue_shift));
- success[i] = TRUE;
- }
- break;
- }
- return nremaining;
-}
-
-gboolean
-gdk_color_change (GdkColormap *colormap,
- GdkColor *color)
-{
- GdkColormapPrivateFB *private;
- struct fb_cmap fbc = {0, 1};
-
- g_return_val_if_fail (colormap != NULL, FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- private = GDK_COLORMAP_PRIVATE_DATA (colormap);
-
- switch(colormap->visual->type)
- {
- case GDK_VISUAL_GRAYSCALE:
- color->red = color->green = color->blue = (color->red + color->green + color->blue)/3;
-
- /* Fall through */
- case GDK_VISUAL_PSEUDO_COLOR:
- colormap->colors[color->pixel] = *color;
-
- fbc.start = color->pixel;
- fbc.red = &color->red;
- fbc.green = &color->green;
- fbc.blue = &color->blue;
- ioctl (gdk_display->fb_fd, FBIOPUTCMAP, &fbc);
- break;
-
- default:
- break;
- }
-
- return TRUE;
-}
-
-static gint
-gdk_colormap_match_color (GdkColormap *cmap,
- GdkColor *color,
- const gchar *available)
-{
- GdkColor *colors;
- guint sum, max;
- gint rdiff, gdiff, bdiff;
- gint i, index;
-
- g_return_val_if_fail (cmap != NULL, 0);
- g_return_val_if_fail (color != NULL, 0);
-
- colors = cmap->colors;
- max = 3 * (65536);
- index = -1;
-
- for (i = 0; i < cmap->size; i++)
- {
- if ((!available) || (available && available[i]))
- {
- rdiff = (color->red - colors[i].red);
- gdiff = (color->green - colors[i].green);
- bdiff = (color->blue - colors[i].blue);
-
- sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
-
- if (sum < max)
- {
- index = i;
- max = sum;
- }
- }
- }
-
- return index;
-}
-
-gboolean
-gdk_colors_alloc (GdkColormap *colormap,
- gboolean contiguous,
- gulong *planes,
- gint nplanes,
- gulong *pixels,
- gint npixels)
-{
- GdkColormapPrivateFB *private;
- gint found, i, col;
-
- g_return_val_if_fail (colormap != NULL, FALSE);
-
- private = GDK_COLORMAP_PRIVATE_DATA (colormap);
-
- if (nplanes > 0)
- return FALSE;
-
- found = 0;
- for (i = 1; i < colormap->size; i++)
- {
- if (private->info[i].ref_count == 0)
- {
- found++;
- if (found >= npixels)
- break;
- }
- }
-
- if (found < npixels)
- return FALSE;
-
- col = 0;
- for (i = 1; i < colormap->size; i++)
- {
- if (private->info[i].ref_count == 0)
- {
- pixels[col++] = i;
- private->info[i].ref_count++;
- private->info[i].flags |= GDK_COLOR_WRITEABLE;
- if (col == npixels)
- return TRUE;
- }
- }
-
- g_assert_not_reached ();
- return FALSE;
-}
-
-void
-gdk_colors_free (GdkColormap *colormap,
- gulong *pixels,
- gint npixels,
- gulong planes)
-{
- GdkColormapPrivateFB *private;
- gint i, pixel;
-
- g_return_if_fail (colormap != NULL);
-
- if ((colormap->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
- (colormap->visual->type != GDK_VISUAL_GRAYSCALE))
- return;
-
- private = GDK_COLORMAP_PRIVATE_DATA (colormap);
-
- for (i = 0; i < npixels; i++)
- {
- pixel = pixels[i];
-
- if (private->info[pixel].ref_count)
- {
- private->info[pixel].ref_count--;
-
- if (private->info[pixel].ref_count == 0)
- {
- if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
- g_hash_table_remove (private->hash, &colormap->colors[pixel]);
- private->info[pixel].flags = 0;
- }
- }
- }
-}
-
-
-void
-gdk_colormap_query_color (GdkColormap *colormap,
- gulong pixel,
- GdkColor *result)
-{
- GdkVisual *visual;
-
- g_return_if_fail (GDK_IS_COLORMAP (colormap));
-
- visual = gdk_colormap_get_visual (colormap);
-
- switch (visual->type)
- {
- case GDK_VISUAL_DIRECT_COLOR:
- case GDK_VISUAL_TRUE_COLOR:
- result->red = 65535. * (gdouble) ((pixel & visual->red_mask) >> visual->red_shift) / ((1 << visual->red_prec) - 1);
- result->green = 65535. * (gdouble) ((pixel & visual->green_mask) >> visual->green_shift) / ((1 << visual->green_prec) - 1);
- result->blue = 65535. * (gdouble) ((pixel & visual->blue_mask) >> visual->blue_shift) / ((1 << visual->blue_prec) - 1);
- break;
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_GRAYSCALE:
- result->red = result->green = result->blue = 65535. * (double)pixel/((1<<visual->depth) - 1);
- break;
- case GDK_VISUAL_PSEUDO_COLOR:
- result->red = colormap->colors[pixel].red;
- result->green = colormap->colors[pixel].green;
- result->blue = colormap->colors[pixel].blue;
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-GdkScreen*
-gdk_colormap_get_screen (GdkColormap *cmap)
-{
- g_return_val_if_fail (cmap != NULL, NULL);
-
- return gdk_screen_get_default ();
-}
diff --git a/gdk/linux-fb/gdkcursor-fb.c b/gdk/linux-fb/gdkcursor-fb.c
deleted file mode 100644
index 737abafe8..000000000
--- a/gdk/linux-fb/gdkcursor-fb.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include "gdkfb.h"
-#include "gdkprivate-fb.h"
-#include "gdkcursor.h"
-
-#include "x-cursors.xbm"
-
-static struct {
- const guchar *bits;
- int width, height, hotx, hoty;
- GdkCursor *cursor;
-} stock_cursors[] = {
-{X_cursor_bits, X_cursor_width, X_cursor_height, X_cursor_x_hot, X_cursor_y_hot},
-{X_cursor_mask_bits, X_cursor_mask_width, X_cursor_mask_height, X_cursor_mask_x_hot, X_cursor_mask_y_hot},
-{arrow_bits, arrow_width, arrow_height, arrow_x_hot, arrow_y_hot},
-{arrow_mask_bits, arrow_mask_width, arrow_mask_height, arrow_mask_x_hot, arrow_mask_y_hot},
-{based_arrow_down_bits, based_arrow_down_width, based_arrow_down_height, based_arrow_down_x_hot, based_arrow_down_y_hot},
-{based_arrow_down_mask_bits, based_arrow_down_mask_width, based_arrow_down_mask_height, based_arrow_down_mask_x_hot, based_arrow_down_mask_y_hot},
-{based_arrow_up_bits, based_arrow_up_width, based_arrow_up_height, based_arrow_up_x_hot, based_arrow_up_y_hot},
-{based_arrow_up_mask_bits, based_arrow_up_mask_width, based_arrow_up_mask_height, based_arrow_up_mask_x_hot, based_arrow_up_mask_y_hot},
-{boat_bits, boat_width, boat_height, boat_x_hot, boat_y_hot},
-{boat_mask_bits, boat_mask_width, boat_mask_height, boat_mask_x_hot, boat_mask_y_hot},
-{bogosity_bits, bogosity_width, bogosity_height, bogosity_x_hot, bogosity_y_hot},
-{bogosity_mask_bits, bogosity_mask_width, bogosity_mask_height, bogosity_mask_x_hot, bogosity_mask_y_hot},
-{bottom_left_corner_bits, bottom_left_corner_width, bottom_left_corner_height, bottom_left_corner_x_hot, bottom_left_corner_y_hot},
-{bottom_left_corner_mask_bits, bottom_left_corner_mask_width, bottom_left_corner_mask_height, bottom_left_corner_mask_x_hot, bottom_left_corner_mask_y_hot},
-{bottom_right_corner_bits, bottom_right_corner_width, bottom_right_corner_height, bottom_right_corner_x_hot, bottom_right_corner_y_hot},
-{bottom_right_corner_mask_bits, bottom_right_corner_mask_width, bottom_right_corner_mask_height, bottom_right_corner_mask_x_hot, bottom_right_corner_mask_y_hot},
-{bottom_side_bits, bottom_side_width, bottom_side_height, bottom_side_x_hot, bottom_side_y_hot},
-{bottom_side_mask_bits, bottom_side_mask_width, bottom_side_mask_height, bottom_side_mask_x_hot, bottom_side_mask_y_hot},
-{bottom_tee_bits, bottom_tee_width, bottom_tee_height, bottom_tee_x_hot, bottom_tee_y_hot},
-{bottom_tee_mask_bits, bottom_tee_mask_width, bottom_tee_mask_height, bottom_tee_mask_x_hot, bottom_tee_mask_y_hot},
-{box_spiral_bits, box_spiral_width, box_spiral_height, box_spiral_x_hot, box_spiral_y_hot},
-{box_spiral_mask_bits, box_spiral_mask_width, box_spiral_mask_height, box_spiral_mask_x_hot, box_spiral_mask_y_hot},
-{center_ptr_bits, center_ptr_width, center_ptr_height, center_ptr_x_hot, center_ptr_y_hot},
-{center_ptr_mask_bits, center_ptr_mask_width, center_ptr_mask_height, center_ptr_mask_x_hot, center_ptr_mask_y_hot},
-{circle_bits, circle_width, circle_height, circle_x_hot, circle_y_hot},
-{circle_mask_bits, circle_mask_width, circle_mask_height, circle_mask_x_hot, circle_mask_y_hot},
-{clock_bits, clock_width, clock_height, clock_x_hot, clock_y_hot},
-{clock_mask_bits, clock_mask_width, clock_mask_height, clock_mask_x_hot, clock_mask_y_hot},
-{coffee_mug_bits, coffee_mug_width, coffee_mug_height, coffee_mug_x_hot, coffee_mug_y_hot},
-{coffee_mug_mask_bits, coffee_mug_mask_width, coffee_mug_mask_height, coffee_mug_mask_x_hot, coffee_mug_mask_y_hot},
-{cross_bits, cross_width, cross_height, cross_x_hot, cross_y_hot},
-{cross_mask_bits, cross_mask_width, cross_mask_height, cross_mask_x_hot, cross_mask_y_hot},
-{cross_reverse_bits, cross_reverse_width, cross_reverse_height, cross_reverse_x_hot, cross_reverse_y_hot},
-{cross_reverse_mask_bits, cross_reverse_mask_width, cross_reverse_mask_height, cross_reverse_mask_x_hot, cross_reverse_mask_y_hot},
-{crosshair_bits, crosshair_width, crosshair_height, crosshair_x_hot, crosshair_y_hot},
-{crosshair_mask_bits, crosshair_mask_width, crosshair_mask_height, crosshair_mask_x_hot, crosshair_mask_y_hot},
-{diamond_cross_bits, diamond_cross_width, diamond_cross_height, diamond_cross_x_hot, diamond_cross_y_hot},
-{diamond_cross_mask_bits, diamond_cross_mask_width, diamond_cross_mask_height, diamond_cross_mask_x_hot, diamond_cross_mask_y_hot},
-{dot_bits, dot_width, dot_height, dot_x_hot, dot_y_hot},
-{dot_mask_bits, dot_mask_width, dot_mask_height, dot_mask_x_hot, dot_mask_y_hot},
-{dotbox_bits, dotbox_width, dotbox_height, dotbox_x_hot, dotbox_y_hot},
-{dotbox_mask_bits, dotbox_mask_width, dotbox_mask_height, dotbox_mask_x_hot, dotbox_mask_y_hot},
-{double_arrow_bits, double_arrow_width, double_arrow_height, double_arrow_x_hot, double_arrow_y_hot},
-{double_arrow_mask_bits, double_arrow_mask_width, double_arrow_mask_height, double_arrow_mask_x_hot, double_arrow_mask_y_hot},
-{draft_large_bits, draft_large_width, draft_large_height, draft_large_x_hot, draft_large_y_hot},
-{draft_large_mask_bits, draft_large_mask_width, draft_large_mask_height, draft_large_mask_x_hot, draft_large_mask_y_hot},
-{draft_small_bits, draft_small_width, draft_small_height, draft_small_x_hot, draft_small_y_hot},
-{draft_small_mask_bits, draft_small_mask_width, draft_small_mask_height, draft_small_mask_x_hot, draft_small_mask_y_hot},
-{draped_box_bits, draped_box_width, draped_box_height, draped_box_x_hot, draped_box_y_hot},
-{draped_box_mask_bits, draped_box_mask_width, draped_box_mask_height, draped_box_mask_x_hot, draped_box_mask_y_hot},
-{exchange_bits, exchange_width, exchange_height, exchange_x_hot, exchange_y_hot},
-{exchange_mask_bits, exchange_mask_width, exchange_mask_height, exchange_mask_x_hot, exchange_mask_y_hot},
-{fleur_bits, fleur_width, fleur_height, fleur_x_hot, fleur_y_hot},
-{fleur_mask_bits, fleur_mask_width, fleur_mask_height, fleur_mask_x_hot, fleur_mask_y_hot},
-{gobbler_bits, gobbler_width, gobbler_height, gobbler_x_hot, gobbler_y_hot},
-{gobbler_mask_bits, gobbler_mask_width, gobbler_mask_height, gobbler_mask_x_hot, gobbler_mask_y_hot},
-{gumby_bits, gumby_width, gumby_height, gumby_x_hot, gumby_y_hot},
-{gumby_mask_bits, gumby_mask_width, gumby_mask_height, gumby_mask_x_hot, gumby_mask_y_hot},
-{hand1_bits, hand1_width, hand1_height, hand1_x_hot, hand1_y_hot},
-{hand1_mask_bits, hand1_mask_width, hand1_mask_height, hand1_mask_x_hot, hand1_mask_y_hot},
-{hand2_bits, hand2_width, hand2_height, hand2_x_hot, hand2_y_hot},
-{hand2_mask_bits, hand2_mask_width, hand2_mask_height, hand2_mask_x_hot, hand2_mask_y_hot},
-{heart_bits, heart_width, heart_height, heart_x_hot, heart_y_hot},
-{heart_mask_bits, heart_mask_width, heart_mask_height, heart_mask_x_hot, heart_mask_y_hot},
-{icon_bits, icon_width, icon_height, icon_x_hot, icon_y_hot},
-{icon_mask_bits, icon_mask_width, icon_mask_height, icon_mask_x_hot, icon_mask_y_hot},
-{iron_cross_bits, iron_cross_width, iron_cross_height, iron_cross_x_hot, iron_cross_y_hot},
-{iron_cross_mask_bits, iron_cross_mask_width, iron_cross_mask_height, iron_cross_mask_x_hot, iron_cross_mask_y_hot},
-{left_ptr_bits, left_ptr_width, left_ptr_height, left_ptr_x_hot, left_ptr_y_hot},
-{left_ptr_mask_bits, left_ptr_mask_width, left_ptr_mask_height, left_ptr_mask_x_hot, left_ptr_mask_y_hot},
-{left_side_bits, left_side_width, left_side_height, left_side_x_hot, left_side_y_hot},
-{left_side_mask_bits, left_side_mask_width, left_side_mask_height, left_side_mask_x_hot, left_side_mask_y_hot},
-{left_tee_bits, left_tee_width, left_tee_height, left_tee_x_hot, left_tee_y_hot},
-{left_tee_mask_bits, left_tee_mask_width, left_tee_mask_height, left_tee_mask_x_hot, left_tee_mask_y_hot},
-{leftbutton_bits, leftbutton_width, leftbutton_height, leftbutton_x_hot, leftbutton_y_hot},
-{leftbutton_mask_bits, leftbutton_mask_width, leftbutton_mask_height, leftbutton_mask_x_hot, leftbutton_mask_y_hot},
-{ll_angle_bits, ll_angle_width, ll_angle_height, ll_angle_x_hot, ll_angle_y_hot},
-{ll_angle_mask_bits, ll_angle_mask_width, ll_angle_mask_height, ll_angle_mask_x_hot, ll_angle_mask_y_hot},
-{lr_angle_bits, lr_angle_width, lr_angle_height, lr_angle_x_hot, lr_angle_y_hot},
-{lr_angle_mask_bits, lr_angle_mask_width, lr_angle_mask_height, lr_angle_mask_x_hot, lr_angle_mask_y_hot},
-{man_bits, man_width, man_height, man_x_hot, man_y_hot},
-{man_mask_bits, man_mask_width, man_mask_height, man_mask_x_hot, man_mask_y_hot},
-{middlebutton_bits, middlebutton_width, middlebutton_height, middlebutton_x_hot, middlebutton_y_hot},
-{middlebutton_mask_bits, middlebutton_mask_width, middlebutton_mask_height, middlebutton_mask_x_hot, middlebutton_mask_y_hot},
-{mouse_bits, mouse_width, mouse_height, mouse_x_hot, mouse_y_hot},
-{mouse_mask_bits, mouse_mask_width, mouse_mask_height, mouse_mask_x_hot, mouse_mask_y_hot},
-{pencil_bits, pencil_width, pencil_height, pencil_x_hot, pencil_y_hot},
-{pencil_mask_bits, pencil_mask_width, pencil_mask_height, pencil_mask_x_hot, pencil_mask_y_hot},
-{pirate_bits, pirate_width, pirate_height, pirate_x_hot, pirate_y_hot},
-{pirate_mask_bits, pirate_mask_width, pirate_mask_height, pirate_mask_x_hot, pirate_mask_y_hot},
-{plus_bits, plus_width, plus_height, plus_x_hot, plus_y_hot},
-{plus_mask_bits, plus_mask_width, plus_mask_height, plus_mask_x_hot, plus_mask_y_hot},
-{question_arrow_bits, question_arrow_width, question_arrow_height, question_arrow_x_hot, question_arrow_y_hot},
-{question_arrow_mask_bits, question_arrow_mask_width, question_arrow_mask_height, question_arrow_mask_x_hot, question_arrow_mask_y_hot},
-{right_ptr_bits, right_ptr_width, right_ptr_height, right_ptr_x_hot, right_ptr_y_hot},
-{right_ptr_mask_bits, right_ptr_mask_width, right_ptr_mask_height, right_ptr_mask_x_hot, right_ptr_mask_y_hot},
-{right_side_bits, right_side_width, right_side_height, right_side_x_hot, right_side_y_hot},
-{right_side_mask_bits, right_side_mask_width, right_side_mask_height, right_side_mask_x_hot, right_side_mask_y_hot},
-{right_tee_bits, right_tee_width, right_tee_height, right_tee_x_hot, right_tee_y_hot},
-{right_tee_mask_bits, right_tee_mask_width, right_tee_mask_height, right_tee_mask_x_hot, right_tee_mask_y_hot},
-{rightbutton_bits, rightbutton_width, rightbutton_height, rightbutton_x_hot, rightbutton_y_hot},
-{rightbutton_mask_bits, rightbutton_mask_width, rightbutton_mask_height, rightbutton_mask_x_hot, rightbutton_mask_y_hot},
-{rtl_logo_bits, rtl_logo_width, rtl_logo_height, rtl_logo_x_hot, rtl_logo_y_hot},
-{rtl_logo_mask_bits, rtl_logo_mask_width, rtl_logo_mask_height, rtl_logo_mask_x_hot, rtl_logo_mask_y_hot},
-{sailboat_bits, sailboat_width, sailboat_height, sailboat_x_hot, sailboat_y_hot},
-{sailboat_mask_bits, sailboat_mask_width, sailboat_mask_height, sailboat_mask_x_hot, sailboat_mask_y_hot},
-{sb_down_arrow_bits, sb_down_arrow_width, sb_down_arrow_height, sb_down_arrow_x_hot, sb_down_arrow_y_hot},
-{sb_down_arrow_mask_bits, sb_down_arrow_mask_width, sb_down_arrow_mask_height, sb_down_arrow_mask_x_hot, sb_down_arrow_mask_y_hot},
-{sb_h_double_arrow_bits, sb_h_double_arrow_width, sb_h_double_arrow_height, sb_h_double_arrow_x_hot, sb_h_double_arrow_y_hot},
-{sb_h_double_arrow_mask_bits, sb_h_double_arrow_mask_width, sb_h_double_arrow_mask_height, sb_h_double_arrow_mask_x_hot, sb_h_double_arrow_mask_y_hot},
-{sb_left_arrow_bits, sb_left_arrow_width, sb_left_arrow_height, sb_left_arrow_x_hot, sb_left_arrow_y_hot},
-{sb_left_arrow_mask_bits, sb_left_arrow_mask_width, sb_left_arrow_mask_height, sb_left_arrow_mask_x_hot, sb_left_arrow_mask_y_hot},
-{sb_right_arrow_bits, sb_right_arrow_width, sb_right_arrow_height, sb_right_arrow_x_hot, sb_right_arrow_y_hot},
-{sb_right_arrow_mask_bits, sb_right_arrow_mask_width, sb_right_arrow_mask_height, sb_right_arrow_mask_x_hot, sb_right_arrow_mask_y_hot},
-{sb_up_arrow_bits, sb_up_arrow_width, sb_up_arrow_height, sb_up_arrow_x_hot, sb_up_arrow_y_hot},
-{sb_up_arrow_mask_bits, sb_up_arrow_mask_width, sb_up_arrow_mask_height, sb_up_arrow_mask_x_hot, sb_up_arrow_mask_y_hot},
-{sb_v_double_arrow_bits, sb_v_double_arrow_width, sb_v_double_arrow_height, sb_v_double_arrow_x_hot, sb_v_double_arrow_y_hot},
-{sb_v_double_arrow_mask_bits, sb_v_double_arrow_mask_width, sb_v_double_arrow_mask_height, sb_v_double_arrow_mask_x_hot, sb_v_double_arrow_mask_y_hot},
-{shuttle_bits, shuttle_width, shuttle_height, shuttle_x_hot, shuttle_y_hot},
-{shuttle_mask_bits, shuttle_mask_width, shuttle_mask_height, shuttle_mask_x_hot, shuttle_mask_y_hot},
-{sizing_bits, sizing_width, sizing_height, sizing_x_hot, sizing_y_hot},
-{sizing_mask_bits, sizing_mask_width, sizing_mask_height, sizing_mask_x_hot, sizing_mask_y_hot},
-{spider_bits, spider_width, spider_height, spider_x_hot, spider_y_hot},
-{spider_mask_bits, spider_mask_width, spider_mask_height, spider_mask_x_hot, spider_mask_y_hot},
-{spraycan_bits, spraycan_width, spraycan_height, spraycan_x_hot, spraycan_y_hot},
-{spraycan_mask_bits, spraycan_mask_width, spraycan_mask_height, spraycan_mask_x_hot, spraycan_mask_y_hot},
-{star_bits, star_width, star_height, star_x_hot, star_y_hot},
-{star_mask_bits, star_mask_width, star_mask_height, star_mask_x_hot, star_mask_y_hot},
-{target_bits, target_width, target_height, target_x_hot, target_y_hot},
-{target_mask_bits, target_mask_width, target_mask_height, target_mask_x_hot, target_mask_y_hot},
-{tcross_bits, tcross_width, tcross_height, tcross_x_hot, tcross_y_hot},
-{tcross_mask_bits, tcross_mask_width, tcross_mask_height, tcross_mask_x_hot, tcross_mask_y_hot},
-{top_left_arrow_bits, top_left_arrow_width, top_left_arrow_height, top_left_arrow_x_hot, top_left_arrow_y_hot},
-{top_left_arrow_mask_bits, top_left_arrow_mask_width, top_left_arrow_mask_height, top_left_arrow_mask_x_hot, top_left_arrow_mask_y_hot},
-{top_left_corner_bits, top_left_corner_width, top_left_corner_height, top_left_corner_x_hot, top_left_corner_y_hot},
-{top_left_corner_mask_bits, top_left_corner_mask_width, top_left_corner_mask_height, top_left_corner_mask_x_hot, top_left_corner_mask_y_hot},
-{top_right_corner_bits, top_right_corner_width, top_right_corner_height, top_right_corner_x_hot, top_right_corner_y_hot},
-{top_right_corner_mask_bits, top_right_corner_mask_width, top_right_corner_mask_height, top_right_corner_mask_x_hot, top_right_corner_mask_y_hot},
-{top_side_bits, top_side_width, top_side_height, top_side_x_hot, top_side_y_hot},
-{top_side_mask_bits, top_side_mask_width, top_side_mask_height, top_side_mask_x_hot, top_side_mask_y_hot},
-{top_tee_bits, top_tee_width, top_tee_height, top_tee_x_hot, top_tee_y_hot},
-{top_tee_mask_bits, top_tee_mask_width, top_tee_mask_height, top_tee_mask_x_hot, top_tee_mask_y_hot},
-{trek_bits, trek_width, trek_height, trek_x_hot, trek_y_hot},
-{trek_mask_bits, trek_mask_width, trek_mask_height, trek_mask_x_hot, trek_mask_y_hot},
-{ul_angle_bits, ul_angle_width, ul_angle_height, ul_angle_x_hot, ul_angle_y_hot},
-{ul_angle_mask_bits, ul_angle_mask_width, ul_angle_mask_height, ul_angle_mask_x_hot, ul_angle_mask_y_hot},
-{umbrella_bits, umbrella_width, umbrella_height, umbrella_x_hot, umbrella_y_hot},
-{umbrella_mask_bits, umbrella_mask_width, umbrella_mask_height, umbrella_mask_x_hot, umbrella_mask_y_hot},
-{ur_angle_bits, ur_angle_width, ur_angle_height, ur_angle_x_hot, ur_angle_y_hot},
-{ur_angle_mask_bits, ur_angle_mask_width, ur_angle_mask_height, ur_angle_mask_x_hot, ur_angle_mask_y_hot},
-{watch_bits, watch_width, watch_height, watch_x_hot, watch_y_hot},
-{watch_mask_bits, watch_mask_width, watch_mask_height, watch_mask_x_hot, watch_mask_y_hot},
-{xterm_bits, xterm_width, xterm_height, xterm_x_hot, xterm_y_hot},
-{xterm_mask_bits, xterm_mask_width, xterm_mask_height, xterm_mask_x_hot, xterm_mask_y_hot}
-};
-
-GdkCursor*
-gdk_cursor_new_for_display (GdkDisplay *display,
- GdkCursorType cursor_type)
-{
- GdkCursor *cursor;
-
- if (cursor_type >= sizeof(stock_cursors)/sizeof(stock_cursors[0]))
- return NULL;
-
- cursor = stock_cursors[cursor_type].cursor;
- if (!cursor)
- {
- GdkPixmap *tmp_pm, *pm, *mask;
- GdkGC *copy_gc;
- char *data;
-
- tmp_pm = gdk_bitmap_create_from_data (_gdk_parent_root,
- stock_cursors[cursor_type].bits,
- stock_cursors[cursor_type].width,
- stock_cursors[cursor_type].height);
-
- /* Create an empty bitmap the size of the mask */
- data = g_malloc0 (((stock_cursors[cursor_type+1].width+7)/8) * stock_cursors[cursor_type+1].height);
- pm = gdk_bitmap_create_from_data (_gdk_parent_root,
- data,
- stock_cursors[cursor_type+1].width,
- stock_cursors[cursor_type+1].height);
- copy_gc = gdk_gc_new (pm);
- gdk_draw_drawable(pm,
- copy_gc,
- tmp_pm,
- 0, 0,
- stock_cursors[cursor_type+1].hotx - stock_cursors[cursor_type].hotx,
- stock_cursors[cursor_type+1].hoty - stock_cursors[cursor_type].hoty,
- stock_cursors[cursor_type].width,
- stock_cursors[cursor_type].height);
- gdk_pixmap_unref (tmp_pm);
- g_free (data);
- gdk_gc_unref (copy_gc);
-
- mask = 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);
-
- cursor = gdk_cursor_new_from_pixmap (pm, mask, NULL, NULL,
- stock_cursors[cursor_type+1].hotx,
- stock_cursors[cursor_type+1].hoty);
-
- stock_cursors[cursor_type].cursor = cursor;
- }
- return gdk_cursor_ref (cursor);
-}
-
-GdkCursor*
-gdk_cursor_new_from_pixmap (GdkPixmap *source,
- GdkPixmap *mask,
- const GdkColor *fg,
- const GdkColor *bg,
- gint x,
- gint y)
-{
- GdkCursorPrivateFB *private;
- GdkCursor *cursor;
-
- g_return_val_if_fail (source != NULL, NULL);
-
- private = g_new (GdkCursorPrivateFB, 1);
- 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->hot_x = x;
- private->hot_y = y;
-
- return cursor;
-}
-
-void
-_gdk_cursor_destroy (GdkCursor *cursor)
-{
- GdkCursorPrivateFB *private;
-
- g_return_if_fail (cursor != NULL);
- g_return_if_fail (cursor->ref_count == 0);
-
- private = (GdkCursorPrivateFB *) cursor;
-
- if (private->mask)
- gdk_pixmap_unref (private->mask);
- gdk_pixmap_unref (private->cursor);
-
- g_free (private);
-}
-
-/* Global data to keep track of cursor */
-static GdkPixmap *last_contents = NULL;
-static GdkPoint last_location, last_contents_size;
-static GdkCursor *last_cursor = NULL;
-static GdkFBDrawingContext *gdk_fb_cursor_dc = NULL;
-static GdkFBDrawingContext cursor_dc_dat;
-static GdkGC *cursor_gc;
-static gint cursor_visibility_count = 1;
-
-static GdkFBDrawingContext *
-gdk_fb_cursor_dc_reset (void)
-{
- if (gdk_fb_cursor_dc)
- gdk_fb_drawing_context_finalize (gdk_fb_cursor_dc);
-
- gdk_fb_cursor_dc = &cursor_dc_dat;
- gdk_fb_drawing_context_init (gdk_fb_cursor_dc,
- GDK_DRAWABLE_IMPL(_gdk_parent_root),
- cursor_gc,
- TRUE,
- FALSE);
-
- return gdk_fb_cursor_dc;
-}
-
-void
-gdk_fb_cursor_hide (void)
-{
- GdkFBDrawingContext *mydc = gdk_fb_cursor_dc;
-
- cursor_visibility_count--;
- g_assert (cursor_visibility_count <= 0);
-
- if (cursor_visibility_count < 0)
- return;
-
- if (!mydc)
- mydc = gdk_fb_cursor_dc_reset ();
-
- if (last_contents)
- {
- gdk_gc_set_clip_mask (cursor_gc, NULL);
- /* Restore old picture */
- gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL(_gdk_parent_root),
- cursor_gc,
- GDK_DRAWABLE_IMPL(last_contents),
- mydc,
- 0, 0,
- last_location.x,
- last_location.y,
- last_contents_size.x,
- last_contents_size.y);
- gdk_shadow_fb_update (last_location.x, last_location.y,
- last_location.x + last_contents_size.x,
- last_location.y + last_contents_size.y);
- }
-}
-
-void
-gdk_fb_cursor_invalidate (void)
-{
- if (last_contents)
- {
- gdk_pixmap_unref (last_contents);
- last_contents = NULL;
- }
-}
-
-void
-gdk_fb_cursor_unhide (void)
-{
- GdkFBDrawingContext *mydc = gdk_fb_cursor_dc;
- GdkCursorPrivateFB *last_private;
- GdkDrawableFBData *pixmap_last;
-
- last_private = GDK_CURSOR_FB (last_cursor);
- cursor_visibility_count++;
- g_assert (cursor_visibility_count <= 1);
- if (cursor_visibility_count < 1)
- return;
-
- if (!mydc)
- mydc = gdk_fb_cursor_dc_reset ();
-
- if (last_cursor)
- {
- pixmap_last = GDK_DRAWABLE_IMPL_FBDATA (last_private->cursor);
-
- if (!last_contents ||
- pixmap_last->width > GDK_DRAWABLE_IMPL_FBDATA (last_contents)->width ||
- pixmap_last->height > GDK_DRAWABLE_IMPL_FBDATA (last_contents)->height)
- {
- if (last_contents)
- gdk_pixmap_unref (last_contents);
-
- last_contents = gdk_pixmap_new (_gdk_parent_root,
- pixmap_last->width,
- pixmap_last->height,
- GDK_DRAWABLE_IMPL_FBDATA (_gdk_parent_root)->depth);
- }
-
- gdk_gc_set_clip_mask (cursor_gc, NULL);
- gdk_fb_draw_drawable_2 (GDK_DRAWABLE_IMPL (last_contents),
- cursor_gc,
- GDK_DRAWABLE_IMPL (_gdk_parent_root),
- last_location.x,
- last_location.y,
- 0, 0,
- pixmap_last->width,
- pixmap_last->height,
- TRUE, FALSE);
- last_contents_size.x = pixmap_last->width;
- last_contents_size.y = pixmap_last->height;
-
- gdk_gc_set_clip_mask (cursor_gc, last_private->mask);
- gdk_gc_set_clip_origin (cursor_gc,
- last_location.x,
- last_location.y);
-
- gdk_fb_cursor_dc_reset ();
- gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL (_gdk_parent_root),
- cursor_gc,
- GDK_DRAWABLE_IMPL (last_private->cursor),
- mydc,
- 0, 0,
- last_location.x, last_location.y,
- pixmap_last->width,
- pixmap_last->height);
- gdk_shadow_fb_update (last_location.x, last_location.y,
- last_location.x + pixmap_last->width,
- last_location.y + pixmap_last->height);
- }
- else
- gdk_fb_cursor_invalidate ();
-}
-
-gboolean
-gdk_fb_cursor_region_need_hide (GdkRegion *region)
-{
- GdkRectangle testme;
-
- if (!last_cursor)
- return FALSE;
-
- testme.x = last_location.x;
- testme.y = last_location.y;
- testme.width = GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->width;
- testme.height = GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->height;
-
- return (gdk_region_rect_in (region, &testme) != GDK_OVERLAP_RECTANGLE_OUT);
-}
-
-gboolean
-gdk_fb_cursor_need_hide (GdkRectangle *rect)
-{
- GdkRectangle testme;
-
- if (!last_cursor)
- return FALSE;
-
- testme.x = last_location.x;
- testme.y = last_location.y;
- testme.width = GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->width;
- testme.height = GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->height;
-
- return gdk_rectangle_intersect (rect, &testme, &testme);
-}
-
-void
-gdk_fb_get_cursor_rect (GdkRectangle *rect)
-{
- if (last_cursor)
- {
- rect->x = last_location.x;
- rect->y = last_location.y;
- rect->width = GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->width;
- rect->height = GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->height;
- }
- else
- {
- rect->x = rect->y = -1;
- rect->width = rect->height = 0;
- }
-}
-
-void
-gdk_fb_cursor_move (gint x, gint y, GdkWindow *in_window)
-{
- GdkCursor *the_cursor;
-
- if (!cursor_gc)
- {
- GdkColor white, black;
- cursor_gc = gdk_gc_new (_gdk_parent_root);
- gdk_color_black (gdk_colormap_get_system (), &black);
- gdk_color_white (gdk_colormap_get_system (), &white);
- gdk_gc_set_foreground (cursor_gc, &black);
- gdk_gc_set_background (cursor_gc, &white);
- }
-
- gdk_fb_cursor_hide ();
-
- if (_gdk_fb_pointer_grab_window)
- {
- if (_gdk_fb_pointer_grab_cursor)
- the_cursor = _gdk_fb_pointer_grab_cursor;
- else
- {
- GdkWindow *win = _gdk_fb_pointer_grab_window;
- while (!GDK_WINDOW_IMPL_FBDATA (win)->cursor && GDK_WINDOW_OBJECT (win)->parent)
- win = (GdkWindow *)GDK_WINDOW_OBJECT (win)->parent;
- the_cursor = GDK_WINDOW_IMPL_FBDATA (win)->cursor;
- }
- }
- else
- {
- while (!GDK_WINDOW_IMPL_FBDATA (in_window)->cursor && GDK_WINDOW_P (in_window)->parent)
- in_window = (GdkWindow *)GDK_WINDOW_P (in_window)->parent;
- the_cursor = GDK_WINDOW_IMPL_FBDATA (in_window)->cursor;
- }
-
- last_location.x = x - GDK_CURSOR_FB (the_cursor)->hot_x;
- last_location.y = y - GDK_CURSOR_FB (the_cursor)->hot_y;
-
- if (the_cursor)
- gdk_cursor_ref (the_cursor);
- if (last_cursor)
- gdk_cursor_unref (last_cursor);
- last_cursor = the_cursor;
-
- gdk_fb_cursor_unhide ();
-}
-
-void
-gdk_fb_cursor_reset(void)
-{
- GdkWindow *win = gdk_window_at_pointer (NULL, NULL);
- gint x, y;
-
- gdk_fb_mouse_get_info (&x, &y, NULL);
- gdk_fb_cursor_move (x, y, win);
-}
-
-GdkDisplay *
-gdk_cursor_get_display (GdkCursor *cursor)
-{
- return gdk_display_get_default ();
-}
diff --git a/gdk/linux-fb/gdkdisplay-fb.c b/gdk/linux-fb/gdkdisplay-fb.c
deleted file mode 100644
index d9d798e19..000000000
--- a/gdk/linux-fb/gdkdisplay-fb.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include "gdk.h"
-#include "gdkprivate-fb.h"
-
-GdkDisplay *
-gdk_display_open (const gchar *display_name)
-{
- if (gdk_display == NULL || _gdk_display != NULL)
- return NULL; /* single display only */
-
- _gdk_display = g_object_new (GDK_TYPE_DISPLAY, NULL);
- _gdk_screen = g_object_new (GDK_TYPE_SCREEN, NULL);
-
- _gdk_visual_init ();
- gdk_screen_set_default_colormap (_gdk_screen,
- gdk_screen_get_system_colormap (_gdk_screen));
- _gdk_windowing_window_init ();
- _gdk_windowing_image_init ();
- _gdk_events_init ();
- _gdk_input_init ();
- _gdk_dnd_init ();
-
- g_signal_emit_by_name (gdk_display_manager_get (),
- "display_opened", _gdk_display);
-
- return _gdk_display;
-}
-
-G_CONST_RETURN gchar *
-gdk_display_get_name (GdkDisplay *display)
-{
- return gdk_get_display_arg_name ();
-}
-
-int
-gdk_display_get_n_screens (GdkDisplay *display)
-{
- return 1;
-}
-
-GdkScreen *
-gdk_display_get_screen (GdkDisplay *display,
- gint screen_num)
-{
- return _gdk_screen;
-}
-
-GdkScreen *
-gdk_display_get_default_screen (GdkDisplay *display)
-{
- return _gdk_screen;
-}
diff --git a/gdk/linux-fb/gdkdnd-fb.c b/gdk/linux-fb/gdkdnd-fb.c
deleted file mode 100644
index cc84f2e10..000000000
--- a/gdk/linux-fb/gdkdnd-fb.c
+++ /dev/null
@@ -1,727 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1999 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include "gdk.h" /* For gdk_flush() */
-#include "gdkdnd.h"
-#include "gdkproperty.h"
-#include "gdkinternals.h"
-#include "gdkprivate-fb.h"
-
-typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
-
-typedef enum {
- GDK_DRAG_STATUS_DRAG,
- GDK_DRAG_STATUS_MOTION_WAIT,
- GDK_DRAG_STATUS_ACTION_WAIT,
- GDK_DRAG_STATUS_DROP
-} GtkDragStatus;
-
-/* Structure that holds information about a drag in progress.
- * this is used on both source and destination sides.
- */
-struct _GdkDragContextPrivate {
- GdkAtom local_selection;
-
- guint16 last_x; /* Coordinates from last event */
- guint16 last_y;
-
- guint drag_status : 4; /* current status of drag */
-};
-
-/* Drag Contexts */
-
-static GList *contexts;
-static gpointer parent_class = NULL;
-
-#define GDK_DRAG_CONTEXT_PRIVATE_DATA(ctx) ((GdkDragContextPrivate *) GDK_DRAG_CONTEXT (ctx)->windowing_data)
-
-GdkDragContext *current_dest_drag = NULL;
-
-static void
-gdk_drag_context_init (GdkDragContext *dragcontext)
-{
- dragcontext->windowing_data = g_new0 (GdkDragContextPrivate, 1);
-
- contexts = g_list_prepend (contexts, dragcontext);
-}
-
-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);
-
- 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);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gdk_drag_context_class_init (GdkDragContextClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_drag_context_finalize;
-}
-
-
-GType
-gdk_drag_context_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (GdkDragContextClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_drag_context_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkDragContext),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gdk_drag_context_init,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "GdkDragContext",
- &object_info,
- 0);
- }
-
- return object_type;
-}
-
-GdkDragContext *
-gdk_drag_context_new (void)
-{
- return (GdkDragContext *)g_object_new (gdk_drag_context_get_type (), NULL);
-}
-
-void
-gdk_drag_context_ref (GdkDragContext *context)
-{
- g_object_ref (context);
-}
-
-void
-gdk_drag_context_unref (GdkDragContext *context)
-{
- g_object_unref (context);
-}
-
-static GdkDragContext *
-gdk_drag_context_find (gboolean is_source,
- GdkWindow *source,
- GdkWindow *dest)
-{
- GList *tmp_list = contexts;
-
- GdkDragContext *context;
- GdkDragContextPrivate *private;
-
- while (tmp_list)
- {
- context = (GdkDragContext *)tmp_list->data;
- private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
-
- if ((!context->is_source == !is_source) &&
- ((source == NULL) || (context->source_window && (context->source_window == source))) &&
- ((dest == NULL) || (context->dest_window && (context->dest_window == dest))))
- return context;
-
- tmp_list = tmp_list->next;
- }
-
- return NULL;
-}
-
-
-/*************************************************************
- ************************** Public API ***********************
- *************************************************************/
-
-void
-_gdk_dnd_init (void)
-{
-}
-
-/* Source side */
-
-static void
-local_send_leave (GdkDragContext *context,
- guint32 time)
-{
- GdkEvent tmp_event;
-
- if ((current_dest_drag != NULL) &&
- (current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
- (current_dest_drag->source_window == context->source_window))
- {
- tmp_event.dnd.type = GDK_DRAG_LEAVE;
- tmp_event.dnd.window = context->dest_window;
- /* Pass ownership of context to the event */
- tmp_event.dnd.context = current_dest_drag;
- tmp_event.dnd.send_event = FALSE;
- tmp_event.dnd.time = GDK_CURRENT_TIME; /* FIXME? */
-
- current_dest_drag = NULL;
-
- gdk_event_put (&tmp_event);
- }
-
-}
-
-static void
-local_send_enter (GdkDragContext *context,
- guint32 time)
-{
- GdkEvent tmp_event;
- GdkDragContextPrivate *private;
- GdkDragContext *new_context;
-
- private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
-
- if (!private->local_selection)
- private->local_selection = gdk_atom_intern ("LocalDndSelection", FALSE);
-
- if (current_dest_drag != NULL)
- {
- gdk_drag_context_unref (current_dest_drag);
- current_dest_drag = NULL;
- }
-
- new_context = gdk_drag_context_new ();
- new_context->protocol = GDK_DRAG_PROTO_LOCAL;
- new_context->is_source = FALSE;
-
- new_context->source_window = context->source_window;
- gdk_window_ref (new_context->source_window);
- new_context->dest_window = context->dest_window;
- gdk_window_ref (new_context->dest_window);
-
- new_context->targets = g_list_copy (context->targets);
-
- gdk_window_set_events (new_context->source_window,
- gdk_window_get_events (new_context->source_window) |
- GDK_PROPERTY_CHANGE_MASK);
- new_context->actions = context->actions;
-
- tmp_event.dnd.type = GDK_DRAG_ENTER;
- tmp_event.dnd.window = context->dest_window;
- tmp_event.dnd.send_event = FALSE;
- tmp_event.dnd.context = new_context;
- gdk_drag_context_ref (new_context);
-
- tmp_event.dnd.time = GDK_CURRENT_TIME; /* FIXME? */
-
- current_dest_drag = new_context;
-
- (GDK_DRAG_CONTEXT_PRIVATE_DATA (new_context))->local_selection =
- private->local_selection;
-
- gdk_event_put (&tmp_event);
-}
-
-static void
-local_send_motion (GdkDragContext *context,
- gint x_root,
- gint y_root,
- GdkDragAction action,
- guint32 time)
-{
- GdkEvent tmp_event;
-
- if ((current_dest_drag != NULL) &&
- (current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
- (current_dest_drag->source_window == context->source_window))
- {
- tmp_event.dnd.type = GDK_DRAG_MOTION;
- tmp_event.dnd.window = current_dest_drag->dest_window;
- tmp_event.dnd.send_event = FALSE;
- tmp_event.dnd.context = current_dest_drag;
- gdk_drag_context_ref (current_dest_drag);
-
- tmp_event.dnd.time = time;
-
- current_dest_drag->suggested_action = action;
- current_dest_drag->actions = current_dest_drag->suggested_action;
-
- tmp_event.dnd.x_root = x_root;
- tmp_event.dnd.y_root = y_root;
-
- (GDK_DRAG_CONTEXT_PRIVATE_DATA (current_dest_drag))->last_x = x_root;
- (GDK_DRAG_CONTEXT_PRIVATE_DATA (current_dest_drag))->last_y = y_root;
-
- GDK_DRAG_CONTEXT_PRIVATE_DATA (context)->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
-
- gdk_event_put (&tmp_event);
- }
-}
-
-static void
-local_send_drop (GdkDragContext *context, guint32 time)
-{
- GdkEvent tmp_event;
-
- if ((current_dest_drag != NULL) &&
- (current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
- (current_dest_drag->source_window == context->source_window))
- {
- GdkDragContextPrivate *private;
- private = GDK_DRAG_CONTEXT_PRIVATE_DATA (current_dest_drag);
-
- tmp_event.dnd.type = GDK_DROP_START;
- tmp_event.dnd.window = current_dest_drag->dest_window;
- tmp_event.dnd.send_event = FALSE;
-
- tmp_event.dnd.context = current_dest_drag;
- gdk_drag_context_ref (current_dest_drag);
-
- tmp_event.dnd.time = GDK_CURRENT_TIME;
-
- tmp_event.dnd.x_root = private->last_x;
- tmp_event.dnd.y_root = private->last_y;
-
- gdk_event_put (&tmp_event);
- }
-
-}
-
-static void
-gdk_drag_do_leave (GdkDragContext *context, guint32 time)
-{
- if (context->dest_window)
- {
- switch (context->protocol)
- {
- case GDK_DRAG_PROTO_LOCAL:
- local_send_leave (context, time);
- break;
- default:
- break;
- }
-
- gdk_window_unref (context->dest_window);
- context->dest_window = NULL;
- }
-}
-
-GdkDragContext *
-gdk_drag_begin (GdkWindow *window,
- GList *targets)
-{
- GList *tmp_list;
- GdkDragContext *new_context;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- new_context = gdk_drag_context_new ();
- new_context->is_source = TRUE;
- new_context->source_window = window;
- gdk_window_ref (window);
-
- tmp_list = g_list_last (targets);
- new_context->targets = NULL;
- while (tmp_list)
- {
- new_context->targets = g_list_prepend (new_context->targets,
- tmp_list->data);
- tmp_list = tmp_list->prev;
- }
-
- new_context->actions = 0;
-
- return new_context;
-}
-
-guint32
-gdk_drag_get_protocol_for_display (GdkDisplay *display,
- guint32 xid,
- GdkDragProtocol *protocol)
-{
- GdkWindow *window;
-
- window = gdk_window_lookup ((GdkNativeWindow) xid);
-
- if (GPOINTER_TO_INT (gdk_drawable_get_data (window, "gdk-dnd-registered")))
- {
- *protocol = GDK_DRAG_PROTO_LOCAL;
- return xid;
- }
-
- *protocol = GDK_DRAG_PROTO_NONE;
- return 0;
-}
-
-static GdkWindow *
-get_toplevel_window_at (GdkWindow *ignore,
- gint x_root,
- gint y_root)
-{
-
- GdkWindowObject *private;
- GdkWindowObject *sub;
- GdkWindowObject *child;
- GList *ltmp, *ltmp2;
-
- private = (GdkWindowObject *)_gdk_parent_root;
-
- for (ltmp = private->children; ltmp; ltmp = ltmp->next)
- {
- sub = ltmp->data;
-
- if ((GDK_WINDOW (sub) != ignore) &&
- (GDK_WINDOW_IS_MAPPED (sub)) &&
- (x_root >= sub->x) &&
- (x_root < sub->x + GDK_DRAWABLE_IMPL_FBDATA (sub)->width) &&
- (y_root >= sub->y) &&
- (y_root < sub->y + GDK_DRAWABLE_IMPL_FBDATA (sub)->height))
- {
- if (g_object_get_data (G_OBJECT (sub), "gdk-window-child-handler"))
- {
- /* Managed window, check children */
- for (ltmp2 = sub->children; ltmp2; ltmp2 = ltmp2->next)
- {
- child = ltmp2->data;
-
- if ((GDK_WINDOW (child) != ignore) &&
- (GDK_WINDOW_IS_MAPPED (child)) &&
- (x_root >= sub->x + child->x) &&
- (x_root < sub->x + child->x + GDK_DRAWABLE_IMPL_FBDATA (child)->width) &&
- (y_root >= sub->y + child->y) &&
- (y_root < sub->y + child->y + GDK_DRAWABLE_IMPL_FBDATA (child)->height))
- return GDK_WINDOW (child);
- }
- }
- else
- return GDK_WINDOW (sub);
- }
- }
- return NULL;
-}
-
-
-void
-gdk_drag_find_window_for_screen (GdkDragContext *context,
- GdkWindow *drag_window,
- GdkScreen *screen,
- gint x_root,
- gint y_root,
- GdkWindow **dest_window,
- GdkDragProtocol *protocol)
-{
- GdkWindow *dest;
-
- g_return_if_fail (context != NULL);
-
- dest = get_toplevel_window_at (drag_window, x_root, y_root);
- if (dest == NULL)
- dest = _gdk_parent_root;
-
- if (context->dest_window != dest)
- {
- guint32 recipient;
-
- /* Check if new destination accepts drags, and which protocol */
- if ((recipient = gdk_drag_get_protocol ((guint32)dest, protocol)))
- {
- *dest_window = gdk_window_lookup ((GdkNativeWindow) recipient);
- gdk_window_ref (*dest_window);
- }
- else
- *dest_window = NULL;
- }
- else
- {
- *dest_window = context->dest_window;
- if (*dest_window)
- gdk_window_ref (*dest_window);
- *protocol = context->protocol;
- }
-
-}
-
-gboolean
-gdk_drag_motion (GdkDragContext *context,
- GdkWindow *dest_window,
- GdkDragProtocol protocol,
- gint x_root,
- gint y_root,
- GdkDragAction suggested_action,
- GdkDragAction possible_actions,
- guint32 time)
-{
- GdkDragContextPrivate *private;
-
- g_return_val_if_fail (context != NULL, FALSE);
-
- private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
-
- if (context->dest_window != dest_window)
- {
- GdkEvent temp_event;
-
- /* Send a leave to the last destination */
- gdk_drag_do_leave (context, time);
- private->drag_status = GDK_DRAG_STATUS_DRAG;
-
- /* Check if new destination accepts drags, and which protocol */
- if (dest_window)
- {
- context->dest_window = dest_window;
- gdk_window_ref (context->dest_window);
- context->protocol = protocol;
-
- switch (protocol)
- {
- case GDK_DRAG_PROTO_LOCAL:
- local_send_enter (context, time);
- break;
-
- default:
- break;
- }
- context->suggested_action = suggested_action;
- }
- else
- {
- context->dest_window = NULL;
- context->action = 0;
- }
-
- /* Push a status event, to let the client know that
- * the drag changed
- */
-
- temp_event.dnd.type = GDK_DRAG_STATUS;
- temp_event.dnd.window = context->source_window;
- /* We use this to signal a synthetic status. Perhaps
- * we should use an extra field...
- */
- temp_event.dnd.send_event = TRUE;
-
- temp_event.dnd.context = context;
- temp_event.dnd.time = time;
-
- gdk_event_put (&temp_event);
- }
- else
- {
- context->suggested_action = suggested_action;
- }
-
- /* Send a drag-motion event */
-
- private->last_x = x_root;
- private->last_y = y_root;
-
- if (context->dest_window)
- {
- if (private->drag_status == GDK_DRAG_STATUS_DRAG)
- {
- switch (context->protocol)
- {
- case GDK_DRAG_PROTO_LOCAL:
- local_send_motion (context, x_root, y_root, suggested_action, time);
- break;
-
- case GDK_DRAG_PROTO_NONE:
- g_warning ("GDK_DRAG_PROTO_NONE is not valid in gdk_drag_motion()");
- break;
- default:
- break;
- }
- }
- else
- return TRUE;
- }
-
- return FALSE;
-}
-
-void
-gdk_drag_drop (GdkDragContext *context,
- guint32 time)
-{
- g_return_if_fail (context != NULL);
-
- if (context->dest_window)
- {
- switch (context->protocol)
- {
- case GDK_DRAG_PROTO_LOCAL:
- local_send_drop (context, time);
- break;
-
- case GDK_DRAG_PROTO_NONE:
- g_warning ("GDK_DRAG_PROTO_NONE is not valid in gdk_drag_drop()");
- break;
- default:
- break;
- }
- }
-}
-
-void
-gdk_drag_abort (GdkDragContext *context,
- guint32 time)
-{
- g_return_if_fail (context != NULL);
-
- gdk_drag_do_leave (context, time);
-}
-
-/* Destination side */
-
-void
-gdk_drag_status (GdkDragContext *context,
- GdkDragAction action,
- guint32 time)
-{
- GdkDragContextPrivate *private;
- GdkDragContext *src_context;
- GdkEvent tmp_event;
-
- g_return_if_fail (context != NULL);
-
- private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
-
- src_context = gdk_drag_context_find (TRUE,
- context->source_window,
- context->dest_window);
-
- if (src_context)
- {
- GdkDragContextPrivate *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (src_context);
-
- if (private->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
- private->drag_status = GDK_DRAG_STATUS_DRAG;
-
- tmp_event.dnd.type = GDK_DRAG_STATUS;
- tmp_event.dnd.window = context->source_window;
- tmp_event.dnd.send_event = FALSE;
- tmp_event.dnd.context = src_context;
- gdk_drag_context_ref (src_context);
-
- tmp_event.dnd.time = GDK_CURRENT_TIME; /* FIXME? */
-
- if (action == GDK_ACTION_DEFAULT)
- action = 0;
-
- src_context->action = action;
-
- gdk_event_put (&tmp_event);
- }
-}
-
-void
-gdk_drop_reply (GdkDragContext *context,
- gboolean ok,
- guint32 time)
-{
- g_return_if_fail (context != NULL);
-}
-
-void
-gdk_drop_finish (GdkDragContext *context,
- gboolean success,
- guint32 time)
-{
- GdkDragContextPrivate *private;
- GdkDragContext *src_context;
- GdkEvent tmp_event;
-
- g_return_if_fail (context != NULL);
-
- private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
-
- src_context = gdk_drag_context_find (TRUE,
- context->source_window,
- context->dest_window);
- if (src_context)
- {
- tmp_event.dnd.type = GDK_DROP_FINISHED;
- tmp_event.dnd.window = src_context->source_window;
- tmp_event.dnd.send_event = FALSE;
- tmp_event.dnd.context = src_context;
- gdk_drag_context_ref (src_context);
-
- gdk_event_put (&tmp_event);
- }
-}
-
-
-void
-gdk_window_register_dnd (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
-
- if (GPOINTER_TO_INT (gdk_drawable_get_data (window, "gdk-dnd-registered")))
- return;
- else
- gdk_drawable_set_data (window, "gdk-dnd-registered", GINT_TO_POINTER(TRUE), NULL);
-}
-
-/*************************************************************
- * gdk_drag_get_selection:
- * Returns the selection atom for the current source window
- * arguments:
- *
- * results:
- *************************************************************/
-
-GdkAtom
-gdk_drag_get_selection (GdkDragContext *context)
-{
- g_return_val_if_fail (context != NULL, GDK_NONE);
-
- if (context->protocol == GDK_DRAG_PROTO_LOCAL)
- return (GDK_DRAG_CONTEXT_PRIVATE_DATA (context))->local_selection;
- else
- return GDK_NONE;
-}
-
diff --git a/gdk/linux-fb/gdkdrawable-fb2.c b/gdk/linux-fb/gdkdrawable-fb2.c
deleted file mode 100644
index a868a6ec8..000000000
--- a/gdk/linux-fb/gdkdrawable-fb2.c
+++ /dev/null
@@ -1,1575 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2000 Elliot Lee
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include "gdkprivate-fb.h"
-#include "mi.h"
-#include <string.h>
-#include <gdkregion-generic.h>
-
-#include <pango/pangoft2.h>
-#include <freetype/ftglyph.h>
-
-#ifndef g_alloca
-#define g_alloca alloca
-#endif
-
-void gdk_fb_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gdk_fb_draw_arc (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height,
- gint angle1,
- gint angle2);
-static void gdk_fb_draw_polygon (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- GdkPoint *points,
- gint npoints);
-static void gdk_fb_draw_text (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length);
-static void gdk_fb_draw_text_wc (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const GdkWChar *text,
- gint text_length);
-static void gdk_fb_draw_glyphs (GdkDrawable *drawable,
- GdkGC *gc,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs);
-void gdk_fb_draw_drawable (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-static void gdk_fb_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-static void gdk_fb_draw_points (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
-static void gdk_fb_draw_segments (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSegment *segs,
- gint nsegs);
-static void gdk_fb_draw_lines (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
-static GdkColormap* gdk_fb_get_colormap (GdkDrawable *drawable);
-static void gdk_fb_set_colormap (GdkDrawable *drawable,
- GdkColormap *colormap);
-static gint gdk_fb_get_depth (GdkDrawable *drawable);
-static GdkScreen* gdk_fb_get_screen (GdkDrawable *drawable);
-static GdkVisual* gdk_fb_get_visual (GdkDrawable *drawable);
-static void gdk_fb_drawable_finalize (GObject *object);
-
-#ifdef ENABLE_SHADOW_FB
-static void gdk_shadow_fb_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gdk_shadow_fb_draw_arc (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height,
- gint angle1,
- gint angle2);
-static void gdk_shadow_fb_draw_polygon (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- GdkPoint *points,
- gint npoints);
-static void gdk_shadow_fb_draw_text (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length);
-static void gdk_shadow_fb_draw_text_wc (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const GdkWChar *text,
- gint text_length);
-static void gdk_shadow_fb_draw_drawable (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-static void gdk_shadow_fb_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-static void gdk_shadow_fb_draw_points (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
-static void gdk_shadow_fb_draw_segments (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSegment *segs,
- gint nsegs);
-static void gdk_shadow_fb_draw_lines (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
-#endif
-
-
-static gpointer parent_class = NULL;
-
-static void
-gdk_fb_get_size (GdkDrawable *d, gint *width, gint *height)
-{
- if (width)
- *width = GDK_DRAWABLE_FBDATA (d)->width;
- if (height)
- *height = GDK_DRAWABLE_FBDATA (d)->height;
-}
-
-static void
-gdk_drawable_impl_fb_class_init (GdkDrawableFBClass *klass)
-{
- GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_fb_drawable_finalize;
-
- drawable_class->create_gc = _gdk_fb_gc_new;
-
-#ifdef ENABLE_SHADOW_FB
- drawable_class->draw_rectangle = gdk_shadow_fb_draw_rectangle;
- drawable_class->draw_arc = gdk_shadow_fb_draw_arc;
- drawable_class->draw_polygon = gdk_shadow_fb_draw_polygon;
- drawable_class->draw_text = gdk_shadow_fb_draw_text;
- drawable_class->draw_text_wc = gdk_shadow_fb_draw_text_wc;
- drawable_class->draw_drawable = gdk_shadow_fb_draw_drawable;
- drawable_class->draw_points = gdk_shadow_fb_draw_points;
- drawable_class->draw_segments = gdk_shadow_fb_draw_segments;
- drawable_class->draw_lines = gdk_shadow_fb_draw_lines;
- drawable_class->draw_image = gdk_shadow_fb_draw_image;
-#else
- drawable_class->draw_rectangle = gdk_fb_draw_rectangle;
- drawable_class->draw_arc = gdk_fb_draw_arc;
- drawable_class->draw_polygon = gdk_fb_draw_polygon;
- drawable_class->draw_text = gdk_fb_draw_text;
- drawable_class->draw_text_wc = gdk_fb_draw_text_wc;
- drawable_class->draw_drawable = gdk_fb_draw_drawable;
- drawable_class->draw_points = gdk_fb_draw_points;
- drawable_class->draw_segments = gdk_fb_draw_segments;
- drawable_class->draw_lines = gdk_fb_draw_lines;
- drawable_class->draw_image = gdk_fb_draw_image;
-#endif
-
- drawable_class->set_colormap = gdk_fb_set_colormap;
- drawable_class->get_colormap = gdk_fb_get_colormap;
-
- drawable_class->get_size = gdk_fb_get_size;
-
- drawable_class->get_depth = gdk_fb_get_depth;
- drawable_class->get_screen = gdk_fb_get_screen;
- drawable_class->get_visual = gdk_fb_get_visual;
-
- drawable_class->_copy_to_image = _gdk_fb_copy_to_image;
-}
-
-static void
-gdk_fb_drawable_finalize (GObject *object)
-{
- gdk_drawable_set_colormap (GDK_DRAWABLE (object), NULL);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-GType
-gdk_drawable_impl_fb_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (GdkDrawableFBClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_drawable_impl_fb_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkDrawableFBData),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
- "GdkDrawableFB",
- &object_info,
- 0);
- }
-
- return object_type;
-}
-
-/*****************************************************
- * FB specific implementations of generic functions *
- *****************************************************/
-
-static GdkColormap*
-gdk_fb_get_colormap (GdkDrawable *drawable)
-{
- GdkColormap *retval = GDK_DRAWABLE_FBDATA (drawable)->colormap;
-
- if (!retval)
- retval = gdk_colormap_get_system ();
-
- return retval;
-}
-
-static void
-gdk_fb_set_colormap (GdkDrawable *drawable,
- GdkColormap *colormap)
-{
- GdkDrawableFBData *private;
-
- private = GDK_DRAWABLE_FBDATA (drawable);
-
- if (private->colormap == colormap)
- return;
-
- if (private->colormap)
- gdk_colormap_unref (private->colormap);
- private->colormap = colormap;
- if (private->colormap)
- gdk_colormap_ref (private->colormap);
-}
-
-/* Calculates the real clipping region for a drawable, taking into account
- * other windows, gc clip region and gc clip mask.
- */
-GdkRegion *
-gdk_fb_clip_region (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean do_clipping,
- gboolean do_children,
- gboolean full_shapes)
-{
- GdkRectangle draw_rect;
- GdkRegion *real_clip_region, *tmpreg, *shape;
- gboolean skipit = FALSE;
- GdkDrawableFBData *private;
- GdkWindowObject *parent;
-
- GDK_CHECK_IMPL (drawable);
-
- private = GDK_DRAWABLE_FBDATA (drawable);
-
- g_assert(!GDK_IS_WINDOW (private->wrapper) ||
- !GDK_WINDOW_P (private->wrapper)->input_only);
-
- draw_rect.x = private->llim_x;
- draw_rect.y = private->llim_y;
- if (!GDK_IS_WINDOW (private) ||
- GDK_WINDOW_IS_MAPPED (private->wrapper))
- {
- draw_rect.width = private->lim_x - draw_rect.x;
- draw_rect.height = private->lim_y - draw_rect.y;
- }
- else
- {
- draw_rect.width = draw_rect.height = 0;
- skipit = TRUE;
- }
- real_clip_region = gdk_region_rectangle (&draw_rect);
- if (skipit)
- return real_clip_region;
-
- if (GDK_IS_WINDOW (private->wrapper))
- {
- parent = GDK_WINDOW_P (private->wrapper);
- while (parent != (GdkWindowObject *)_gdk_parent_root)
- {
- if (full_shapes)
- {
- shape = gdk_fb_window_get_abs_shape (GDK_DRAWABLE (parent));
- if (shape)
- {
- gdk_region_intersect (real_clip_region, shape);
- gdk_region_destroy (shape);
- }
- }
- else
- {
- gint dx, dy;
- shape = gdk_fb_window_peek_shape (GDK_DRAWABLE (parent), &dx, &dy);
- if (shape)
- {
- GdkRectangle rect;
- GdkRegion *reg;
-
- gdk_region_get_clipbox (shape, &rect);
-
- rect.x += GDK_DRAWABLE_IMPL_FBDATA (parent)->abs_x + dx;
- rect.y += GDK_DRAWABLE_IMPL_FBDATA (parent)->abs_y + dy;
-
- reg = gdk_region_rectangle(&rect);
- gdk_region_intersect (real_clip_region, reg);
- gdk_region_destroy (reg);
- }
-
- }
- parent = parent->parent;
- }
- }
-
- if (gc && GDK_GC_FBDATA(gc)->values.subwindow_mode == GDK_INCLUDE_INFERIORS)
- do_children = FALSE;
-
- if (do_clipping &&
- GDK_IS_WINDOW (private->wrapper) &&
- GDK_WINDOW_IS_MAPPED (private->wrapper) &&
- !GDK_WINDOW_P (private->wrapper)->input_only)
- {
- GdkWindow *parentwin, *lastwin;
- GdkDrawableFBData *impl_private;
-
- lastwin = private->wrapper;
- if (do_children)
- parentwin = lastwin;
- else
- parentwin = (GdkWindow *)GDK_WINDOW_P (lastwin)->parent;
-
- /* Remove the areas of all overlapping windows above parentwin in the hiearachy */
- for (; parentwin; lastwin = parentwin, parentwin = (GdkWindow *)GDK_WINDOW_P (parentwin)->parent)
- {
- GList *cur;
-
- for (cur = GDK_WINDOW_P (parentwin)->children; cur && cur->data != lastwin; cur = cur->next)
- {
- if (!GDK_WINDOW_IS_MAPPED (cur->data) || GDK_WINDOW_P (cur->data)->input_only)
- continue;
-
- impl_private = GDK_DRAWABLE_IMPL_FBDATA(cur->data);
-
- /* This shortcut is really necessary for performance when there are a lot of windows */
- if (impl_private->llim_x >= real_clip_region->extents.x2 ||
- impl_private->lim_x <= real_clip_region->extents.x1 ||
- impl_private->llim_y >= real_clip_region->extents.y2 ||
- impl_private->lim_y <= real_clip_region->extents.y1)
- continue;
-
- draw_rect.x = impl_private->llim_x;
- draw_rect.y = impl_private->llim_y;
- draw_rect.width = impl_private->lim_x - draw_rect.x;
- draw_rect.height = impl_private->lim_y - draw_rect.y;
-
- tmpreg = gdk_region_rectangle (&draw_rect);
-
- shape = gdk_fb_window_get_abs_shape (impl_private->wrapper);
- if (shape)
- {
- gdk_region_intersect (tmpreg, shape);
- gdk_region_destroy (shape);
- }
-
- gdk_region_subtract (real_clip_region, tmpreg);
- gdk_region_destroy (tmpreg);
- }
- }
- }
-
- if (gc)
- {
- GdkRegion *gc = _gdk_gc_get_clip_region (gc);
-
- if (clip_region)
- {
- tmpreg = gdk_region_copy (clip_region);
- gdk_region_offset (tmpreg, private->abs_x + GDK_GC_P (gc)->clip_x_origin,
- private->abs_y + GDK_GC_P (gc)->clip_y_origin);
- gdk_region_intersect (real_clip_region, tmpreg);
- gdk_region_destroy (tmpreg);
- }
-
- if (GDK_GC_FBDATA (gc)->values.clip_mask)
- {
- GdkDrawable *cmask = GDK_GC_FBDATA (gc)->values.clip_mask;
- GdkDrawableFBData *cmask_private;
-
- cmask_private = GDK_DRAWABLE_IMPL_FBDATA (cmask);
-
- g_assert (cmask_private->depth == 1);
- g_assert (cmask_private->abs_x == 0 &&
- cmask_private->abs_y == 0);
-
- draw_rect.x = private->abs_x +
- cmask_private->llim_x +
- GDK_GC_FBDATA (gc)->values.clip_x_origin;
-
- draw_rect.y = private->abs_y +
- cmask_private->llim_y +
- GDK_GC_FBDATA (gc)->values.clip_y_origin;
-
- draw_rect.width = cmask_private->width;
- draw_rect.height = cmask_private->height;
-
- tmpreg = gdk_region_rectangle (&draw_rect);
- gdk_region_intersect (real_clip_region, tmpreg);
- gdk_region_destroy (tmpreg);
- /*
- if (!real_clip_region->numRects)
- g_warning ("Empty clip region");
- */
- }
- }
-
- return real_clip_region;
-}
-
-
-struct GdkSpanHelper
-{
- GdkDrawable *drawable;
- GdkGC *gc;
- GdkColor color;
-};
-
-static void
-gdk_fb_fill_span_helper(GdkSpan *span,
- gpointer data)
-{
- struct GdkSpanHelper *info = (struct GdkSpanHelper *)data;
- GdkGC * gc = info->gc;
-
- (GDK_GC_FBDATA (gc)->fill_span) (info->drawable, gc, span, &info->color);
-}
-
-void
-gdk_fb_fill_spans (GdkDrawable *real_drawable,
- GdkGC *gc,
- GdkSpan *spans,
- int nspans,
- gboolean sorted)
-{
- int i;
- struct GdkSpanHelper info;
- GdkRegion *real_clip_region;
- gboolean handle_cursor = FALSE;
- GdkDrawable *drawable;
- GdkDrawableFBData *private;
-
- drawable = real_drawable;
- private = GDK_DRAWABLE_FBDATA (drawable);
-
- g_assert (gc);
-
- if (GDK_IS_WINDOW (private->wrapper) && !GDK_WINDOW_IS_MAPPED (private->wrapper))
- return;
- if (GDK_IS_WINDOW (private->wrapper) && GDK_WINDOW_P (private->wrapper)->input_only)
- g_error ("Drawing on the evil input-only!");
-
- info.drawable = drawable;
- info.gc = gc;
-
- if (GDK_GC_FBDATA (gc)->values_mask & GDK_GC_FOREGROUND)
- info.color = GDK_GC_FBDATA (gc)->values.foreground;
- else if (GDK_IS_WINDOW (private->wrapper))
- info.color = GDK_WINDOW_P (private->wrapper)->bg_color;
- else
- gdk_color_black (private->colormap, &info.color);
-
- real_clip_region = gdk_fb_clip_region (drawable, gc, TRUE, GDK_GC_FBDATA (gc)->values.function != GDK_INVERT, TRUE);
-
- if (private->mem == GDK_DRAWABLE_IMPL_FBDATA (_gdk_parent_root)->mem &&
- gdk_fb_cursor_region_need_hide (real_clip_region))
- {
- handle_cursor = TRUE;
- gdk_fb_cursor_hide ();
- }
-
- for (i = 0; i < nspans; i++)
- {
- GdkSpan *cur;
-
- cur = &spans[i];
-
- cur->x += private->abs_x;
- cur->y += private->abs_y;
-
- if ( (cur->y < private->llim_y) || (cur->y >= private->lim_y))
- cur->width = 0;
-
- if (cur->x < private->llim_x)
- {
- cur->width -= private->llim_x - cur->x;
- cur->x = private->llim_x;
- }
-
- if (cur->x + cur->width > private->lim_x)
- {
- cur->width = private->lim_x - cur->x;
- }
-
- if (cur->width <= 0)
- cur->width = 0;
- }
-
- gdk_region_spans_intersect_foreach (real_clip_region,
- spans,
- nspans,
- sorted,
- gdk_fb_fill_span_helper,
- &info);
-
- gdk_region_destroy (real_clip_region);
- if (handle_cursor)
- gdk_fb_cursor_unhide ();
-}
-
-void
-gdk_fb_drawing_context_init (GdkFBDrawingContext *dc,
- GdkDrawable *drawable,
- GdkGC *gc,
- gboolean draw_bg,
- gboolean do_clipping)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- dc->mem = private->mem;
- dc->rowstride = private->rowstride;
- dc->handle_cursor = FALSE;
- dc->bgpm = NULL;
- dc->bg_relto = private->wrapper;
- dc->draw_bg = draw_bg;
-
- GDK_CHECK_IMPL (drawable);
-
- if (GDK_IS_WINDOW (private->wrapper))
- {
- dc->bgpm = GDK_WINDOW_P (private->wrapper)->bg_pixmap;
- if (dc->bgpm == GDK_PARENT_RELATIVE_BG)
- {
- for (; dc->bgpm == GDK_PARENT_RELATIVE_BG && dc->bg_relto; dc->bg_relto = (GdkWindow *)GDK_WINDOW_P (dc->bg_relto)->parent)
- dc->bgpm = GDK_WINDOW_P (dc->bg_relto)->bg_pixmap;
- }
-
- if (dc->bgpm == GDK_NO_BG)
- dc->bgpm = NULL;
- }
- dc->clipxoff = - private->abs_x;
- dc->clipyoff = - private->abs_y;
-
- dc->real_clip_region = gdk_fb_clip_region (drawable, gc, do_clipping, TRUE, TRUE);
-
- if (gc)
- {
- dc->clipxoff -= GDK_GC_FBDATA (gc)->values.clip_x_origin;
- dc->clipyoff -= GDK_GC_FBDATA (gc)->values.clip_y_origin;
-
- if (GDK_GC_FBDATA (gc)->values.clip_mask)
- {
- dc->clipmem = GDK_DRAWABLE_IMPL_FBDATA (GDK_GC_FBDATA (gc)->values.clip_mask)->mem;
- dc->clip_rowstride = GDK_DRAWABLE_IMPL_FBDATA (GDK_GC_FBDATA (gc)->values.clip_mask)->rowstride;
- }
- }
-
- if (do_clipping &&
- private->mem == GDK_DRAWABLE_IMPL_FBDATA (_gdk_parent_root)->mem &&
- gdk_fb_cursor_region_need_hide (dc->real_clip_region))
- {
- dc->handle_cursor = TRUE;
- gdk_fb_cursor_hide ();
- }
-}
-
-void
-gdk_fb_drawing_context_finalize (GdkFBDrawingContext *dc)
-{
- gdk_region_destroy (dc->real_clip_region);
-
- if (dc->handle_cursor)
- gdk_fb_cursor_unhide ();
-}
-
-void
-gdk_fb_draw_drawable_2 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height,
- gboolean draw_bg,
- gboolean do_clipping)
-{
- GdkFBDrawingContext *dc, dc_data;
- dc = &dc_data;
-
- GDK_CHECK_IMPL (src);
- GDK_CHECK_IMPL (drawable);
-
- gdk_fb_drawing_context_init (dc, drawable, gc, draw_bg, do_clipping);
- gdk_fb_draw_drawable_3 (drawable, gc, src, dc, xsrc, ysrc, xdest, ydest, width, height);
- gdk_fb_drawing_context_finalize (dc);
-}
-
-void
-gdk_fb_draw_drawable_3 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- GdkFBDrawingContext *dc,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- GdkDrawableFBData *src_private = GDK_DRAWABLE_FBDATA (src);
- GdkRectangle rect;
- int src_x_off, src_y_off;
- GdkRegion *tmpreg, *real_clip_region;
- int i;
- int draw_direction = 1;
- gdk_fb_draw_drawable_func *draw_func = NULL;
- GdkGCFBData *gc_private;
-
- g_assert (gc);
-
- GDK_CHECK_IMPL (src);
- GDK_CHECK_IMPL (drawable);
-
- if (GDK_IS_WINDOW (private->wrapper))
- {
- if (!GDK_WINDOW_IS_MAPPED (private->wrapper))
- return;
- if (GDK_WINDOW_P (private->wrapper)->input_only)
- g_error ("Drawing on the evil input-only!");
- }
-
- gc_private = GDK_GC_FBDATA (gc);
-
- if (drawable == src)
- {
- GdkRegionBox srcb, destb;
- srcb.x1 = xsrc;
- srcb.y1 = ysrc;
- srcb.x2 = xsrc + width;
- srcb.y2 = ysrc + height;
- destb.x1 = xdest;
- destb.y1 = ydest;
- destb.x2 = xdest + width;
- destb.y2 = ydest + height;
-
- if (EXTENTCHECK (&srcb, &destb) && ((ydest > ysrc) || ((ydest == ysrc) && (xdest > xsrc))))
- draw_direction = -1;
- }
-
- switch (src_private->depth)
- {
- case 1:
- draw_func = gc_private->draw_drawable[GDK_FB_SRC_BPP_1];
- break;
- case 8:
- draw_func = gc_private->draw_drawable[GDK_FB_SRC_BPP_8];
- break;
- case 16:
- draw_func = gc_private->draw_drawable[GDK_FB_SRC_BPP_16];
- break;
- case 24:
- draw_func = gc_private->draw_drawable[GDK_FB_SRC_BPP_24];
- break;
- case 32:
- draw_func = gc_private->draw_drawable[GDK_FB_SRC_BPP_32];
- break;
- case 77:
- draw_func = gc_private->draw_drawable[GDK_FB_SRC_BPP_7_AA_GRAYVAL];
- break;
- case 78:
- draw_func = gc_private->draw_drawable[GDK_FB_SRC_BPP_8_AA_GRAYVAL];
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- /* Do some magic to avoid creating extra regions unnecessarily */
- tmpreg = dc->real_clip_region;
-
- rect.x = xdest + private->abs_x;
- rect.y = ydest + private->abs_y;
- rect.width = width;
- rect.height = height;
- real_clip_region = gdk_region_rectangle (&rect);
- gdk_region_intersect (real_clip_region, tmpreg);
-
- rect.x = xdest + private->abs_x;
- rect.y = ydest + private->abs_y;
- rect.width = MAX (src_private->width - xsrc, 0);
- rect.height = MAX (src_private->height - ysrc, 0);
- if (!rect.width || !rect.height)
- goto out;
- tmpreg = gdk_region_rectangle (&rect);
- gdk_region_intersect (real_clip_region, tmpreg);
- gdk_region_destroy (tmpreg);
-
- src_x_off = (src_private->abs_x + xsrc) - (private->abs_x + xdest);
- src_y_off = (src_private->abs_y + ysrc) - (private->abs_y + ydest);
-
- for (i = (draw_direction>0)?0:real_clip_region->numRects-1; i >= 0 && i < real_clip_region->numRects; i+=draw_direction)
- {
- GdkRegionBox *cur = &real_clip_region->rects[i];
-
- (*draw_func) (drawable,
- gc,
- src,
- dc,
- cur->y1,
- cur->y2,
- cur->x1,
- cur->x2,
- src_x_off,
- src_y_off,
- draw_direction);
- }
-
- out:
- gdk_region_destroy (real_clip_region);
-}
-
-
-void
-gdk_fb_draw_drawable (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkPixmap *src_impl;
-
- if (GDK_IS_DRAWABLE_IMPL_FBDATA (src))
- src_impl = src;
- else
- src_impl = GDK_DRAWABLE_IMPL (src);
-
- GDK_CHECK_IMPL (drawable);
-
- gdk_fb_draw_drawable_2 (drawable, gc, src_impl , xsrc, ysrc, xdest, ydest, width, height, TRUE, TRUE);
-}
-
-#ifdef EMULATE_GDKFONT
-static void
-gdk_fb_draw_text(GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length)
-{
- GdkFontPrivateFB *private;
- GdkDrawableFBData *drawable_private;
- guchar *utf8, *utf8_end;
- PangoGlyphString *glyphs = pango_glyph_string_new ();
- PangoEngineShape *shaper, *last_shaper;
- PangoAnalysis analysis;
- guchar *p, *start;
- gint x_offset;
- int i;
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
-
- private = (GdkFontPrivateFB*) font;
- drawable_private = GDK_DRAWABLE_FBDATA (drawable);
-
- utf8 = alloca (text_length*2);
-
- /* Convert latin-1 to utf8 */
- p = utf8;
- for (i = 0; i < text_length; i++)
- {
- if (text[i]==0)
- *p++ = 1; /* Hack to handle embedded nulls */
- else
- {
- if(((guchar)text[i])<128)
- *p++ = text[i];
- else
- {
- *p++ = ((((guchar)text[i])>>6) & 0x3f) | 0xC0;
- *p++ = (((guchar)text[i]) & 0x3f) | 0x80;
- }
- }
- }
- utf8_end = p;
-
- last_shaper = NULL;
- shaper = NULL;
-
- x_offset = 0;
- p = start = utf8;
- while (p < utf8_end)
- {
- gunichar wc = g_utf8_get_char (p);
- p = g_utf8_next_char (p);
- shaper = pango_font_find_shaper (private->pango_font, pango_language_from_string ("fr"), wc);
- if (shaper != last_shaper)
- {
- analysis.shape_engine = shaper;
- analysis.lang_engine = NULL;
- analysis.font = private->pango_font;
- analysis.level = 0;
-
- pango_shape (start, p - start, &analysis, glyphs);
-
- gdk_draw_glyphs (drawable_private->wrapper,
- gc, private->pango_font,
- x + PANGO_PIXELS (x_offset), y,
- glyphs);
-
- for (i = 0; i < glyphs->num_glyphs; i++)
- x_offset += glyphs->glyphs[i].geometry.width;
-
- start = p;
- }
-
- last_shaper = shaper;
- }
-
- if (p > start)
- {
- analysis.shape_engine = shaper;
- analysis.lang_engine = NULL;
- analysis.font = private->pango_font;
- analysis.level = 0;
-
- pango_shape (start, p - start, &analysis, glyphs);
-
- gdk_draw_glyphs (drawable_private->wrapper,
- gc, private->pango_font,
- x + PANGO_PIXELS (x_offset), y,
- glyphs);
- }
-
- pango_glyph_string_free (glyphs);
-
- return;
-}
-
-#else
-static void
-gdk_fb_draw_text(GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length)
-{
- g_warning ("gdk_fb_draw_text NYI");
-}
-#endif
-
-static void
-gdk_fb_draw_text_wc (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const GdkWChar *text,
- gint text_length)
-{
- g_warning ("gdk_fb_draw_text_wc NYI");
-}
-
-void
-gdk_fb_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkDrawableFBData *private;
-
- private = GDK_DRAWABLE_FBDATA (drawable);
-
- if (filled)
- {
- gboolean handle_cursor = FALSE;
- GdkRectangle tmprect;
- GdkRegion *tmpreg;
- GdkRegion *real_clip_region;
- GdkColor color;
- int i;
-
- if (GDK_GC_FBDATA (gc)->values_mask & GDK_GC_FOREGROUND)
- color = GDK_GC_FBDATA (gc)->values.foreground;
- else if (GDK_IS_WINDOW (private->wrapper))
- color = GDK_WINDOW_P (private->wrapper)->bg_color;
- else
- gdk_color_black (private->colormap, &color);
-
- real_clip_region = gdk_fb_clip_region (drawable, gc, TRUE, GDK_GC_FBDATA (gc)->values.function != GDK_INVERT, TRUE);
-
- if (private->mem == GDK_DRAWABLE_IMPL_FBDATA (_gdk_parent_root)->mem &&
- gdk_fb_cursor_region_need_hide (real_clip_region))
- {
- handle_cursor = TRUE;
- gdk_fb_cursor_hide ();
- }
-
- x += private->abs_x;
- y += private->abs_y;
-
- if (x < private->llim_x)
- {
- width -= private->llim_x - x;
- x = private->llim_x;
- }
- if (x + width > private->lim_x)
- width = private->lim_x - x;
-
- if (y < private->llim_y)
- {
- height -= private->llim_y - y;
- y = private->llim_y;
- }
- if (y + height > private->lim_y)
- height = private->lim_y - y;
-
- tmprect.x = x;
- tmprect.y = y;
- tmprect.width = width;
- tmprect.height = height;
- tmpreg = gdk_region_rectangle (&tmprect);
-
- gdk_region_intersect (tmpreg, real_clip_region);
-
- for (i = 0; i < tmpreg->numRects; i++)
- {
- GdkRectangle r;
- r.x = tmpreg->rects[i].x1;
- r.y = tmpreg->rects[i].y1;
- r.width = tmpreg->rects[i].x2 - tmpreg->rects[i].x1;
- r.height = tmpreg->rects[i].y2 - tmpreg->rects[i].y1;
-
- if ((r.width > 0) && (r.height > 0))
- (GDK_GC_FBDATA (gc)->fill_rectangle) (drawable, gc, &r, &color);
- }
-
- gdk_region_destroy (tmpreg);
-
- gdk_region_destroy (real_clip_region);
- if (handle_cursor)
- gdk_fb_cursor_unhide ();
- }
- else
- {
- GdkPoint pts[5];
-
- pts[0].x = pts[4].x = x;
- pts[0].y = pts[4].y = y;
- pts[1].x = x + width;
- pts[1].y = y;
- pts[2].x = x + width;
- pts[2].y = y + height;
- pts[3].x = x;
- pts[3].y = y + height;
- gdk_fb_draw_lines (drawable, gc, pts, 5);
- }
-
-}
-
-static void
-gdk_fb_draw_points (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints)
-{
- GdkSpan *spans = g_alloca (npoints * sizeof(GdkSpan));
- int i;
-
- for (i = 0; i < npoints; i++)
- {
- spans[i].x = points[i].x;
- spans[i].y = points[i].y;
- spans[i].width = 1;
- }
-
- gdk_fb_fill_spans (drawable, gc, spans, npoints, FALSE);
-}
-
-static void
-gdk_fb_draw_arc (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height,
- gint angle1,
- gint angle2)
-{
- miArc arc;
-
- arc.x = x;
- arc.y = y;
- arc.width = width;
- arc.height = height;
- arc.angle1 = angle1;
- arc.angle2 = angle2;
-
- if (filled)
- miPolyFillArc (drawable, gc, 1, &arc);
- else
- miPolyArc (drawable, gc, 1, &arc);
-}
-
-static void
-gdk_fb_draw_polygon (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- GdkPoint *points,
- gint npoints)
-{
- if (filled)
- miFillPolygon (drawable, gc, 0, 0, npoints, points);
- else
- {
- gint tmp_npoints;
- gboolean free_points = FALSE;
- GdkPoint *tmp_points;
-
- if (points[0].x != points[npoints-1].x || points[0].y != points[npoints-1].y)
- {
- tmp_npoints = npoints + 1;
- tmp_points = g_new (GdkPoint, tmp_npoints);
- free_points = TRUE;
- memcpy (tmp_points, points, sizeof(GdkPoint) * npoints);
- tmp_points[npoints].x = points[0].x;
- tmp_points[npoints].y = points[0].y;
- }
- else
- {
- tmp_npoints = npoints;
- tmp_points = points;
- }
-
- gdk_fb_draw_lines (drawable, gc, tmp_points, tmp_npoints);
-
- if (free_points)
- g_free (tmp_points);
- }
-}
-
-static void
-gdk_fb_draw_lines (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints)
-{
- GdkGCFBData *private;
-
- private = GDK_GC_FBDATA (gc);
- if (private->values.line_width > 0)
- {
- if ((private->values.line_style != GDK_LINE_SOLID) && private->dash_list)
- miWideDash (drawable, gc, 0, npoints, points);
- else
- miWideLine (drawable, gc, 0, npoints, points);
- }
- else
- {
- if ((private->values.line_style != GDK_LINE_SOLID) && private->dash_list)
- miZeroDashLine (drawable, gc, 0, npoints, points);
- else
- miZeroLine (drawable, gc, 0, npoints, points);
- }
-}
-
-static void
-gdk_fb_draw_segments (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSegment *segs,
- gint nsegs)
-{
- GdkPoint pts[2];
- int i;
-
- for(i = 0; i < nsegs; i++)
- {
- pts[0].x = segs[i].x1;
- pts[0].y = segs[i].y1;
- pts[1].x = segs[i].x2;
- pts[1].y = segs[i].y2;
-
- gdk_fb_draw_lines (drawable, gc, pts, 2);
- }
-}
-
-void
-gdk_fb_drawable_clear (GdkDrawable *d)
-{
- extern void
- _gdk_windowing_window_clear_area (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
-
- _gdk_windowing_window_clear_area (d, 0, 0, GDK_DRAWABLE_IMPL_FBDATA (d)->width, GDK_DRAWABLE_IMPL_FBDATA (d)->height);
-}
-
-static void
-gdk_fb_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkImagePrivateFB *image_private;
- GdkPixmapFBData fbd;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (image != NULL);
- g_return_if_fail (gc != NULL);
-
- image_private = (GdkImagePrivateFB*) image;
-
- g_return_if_fail (image->type == GDK_IMAGE_NORMAL);
-
- /* Fake its existence as a pixmap */
- memset (&fbd, 0, sizeof(fbd));
-
- ((GTypeInstance *)&fbd)->g_class = g_type_class_peek (_gdk_pixmap_impl_get_type ());
-
- fbd.drawable_data.mem = image->mem;
- fbd.drawable_data.rowstride = image->bpl;
- fbd.drawable_data.width = fbd.drawable_data.lim_x = image->width;
- fbd.drawable_data.height = fbd.drawable_data.lim_y = image->height;
- fbd.drawable_data.depth = image->depth;
- fbd.drawable_data.window_type = GDK_DRAWABLE_PIXMAP;
- fbd.drawable_data.colormap = gdk_colormap_get_system ();
-
- gdk_fb_draw_drawable_2 (drawable, gc, (GdkPixmap *)&fbd, xsrc, ysrc, xdest, ydest, width, height, TRUE, TRUE);
-}
-
-static gint
-gdk_fb_get_depth (GdkDrawable *drawable)
-{
- return GDK_DRAWABLE_FBDATA (drawable)->depth;
-}
-
-static GdkScreen*
-gdk_fb_get_screen (GdkDrawable *drawable)
-{
- return gdk_screen_get_default();
-}
-
-static GdkVisual*
-gdk_fb_get_visual (GdkDrawable *drawable)
-{
- return gdk_visual_get_system();
-}
-
-#ifdef ENABLE_SHADOW_FB
-static void
-gdk_shadow_fb_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkDrawableFBData *private;
-
- gdk_fb_draw_rectangle (drawable, gc, filled, x, y, width, height);
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- if (GDK_IS_WINDOW (private->wrapper))
- {
- gint minx, miny, maxx, maxy;
- gint extra_width;
-
- minx = x + private->abs_x;
- miny = y + private->abs_y;
- maxx = x + width + private->abs_x;
- maxy = y + height + private->abs_y;
-
- if (!filled)
- {
- extra_width = (GDK_GC_FBDATA (gc)->values.line_width + 1) / 2;
-
- minx -= extra_width;
- miny -= extra_width;
- maxx += extra_width;
- maxy += extra_width;
- }
- gdk_shadow_fb_update (minx, miny, maxx, maxy);
- }
-}
-
-static void
-gdk_shadow_fb_draw_arc (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height,
- gint angle1,
- gint angle2)
-{
- GdkDrawableFBData *private;
-
- gdk_fb_draw_arc (drawable, gc, filled, x, y, width, height, angle1, angle2);
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- if (GDK_IS_WINDOW (private->wrapper))
- {
- gint minx, miny, maxx, maxy;
- gint extra_width;
-
- minx = x + private->abs_x;
- miny = y + private->abs_y;
- maxx = x + width + private->abs_x;
- maxy = y + height + private->abs_y;
-
- if (!filled)
- {
- extra_width = (GDK_GC_FBDATA (gc)->values.line_width + 1) / 2;
-
- minx -= extra_width;
- miny -= extra_width;
- maxx += extra_width;
- maxy += extra_width;
- }
- gdk_shadow_fb_update (minx, miny, maxx, maxy);
- }
-}
-
-static void
-gdk_shadow_fb_draw_polygon (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- GdkPoint *points,
- gint npoints)
-{
- GdkDrawableFBData *private;
-
- gdk_fb_draw_polygon (drawable, gc, filled, points, npoints);
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- if (GDK_IS_WINDOW (private->wrapper))
- {
- gint minx, miny, maxx, maxy;
- gint extra_width;
- int i;
-
- minx = maxx = points[0].x;
- miny = maxy = points[0].y;
-
- for (i = 1; i < npoints; i++)
- {
- minx = MIN(minx, points[i].x);
- maxx = MAX(maxx, points[i].x);
- miny = MIN(miny, points[i].y);
- maxy = MAX(maxy, points[i].y);
- }
-
- if (!filled)
- {
- extra_width = (GDK_GC_FBDATA (gc)->values.line_width + 1) / 2;
-
- minx -= extra_width;
- miny -= extra_width;
- maxx += extra_width;
- maxy += extra_width;
- }
- gdk_shadow_fb_update (minx + private->abs_x, miny + private->abs_y,
- maxx + private->abs_x, maxy + private->abs_y);
- }
-}
-
-static void
-gdk_shadow_fb_draw_text (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length)
-{
- gdk_fb_draw_text (drawable, font, gc, x, y, text, text_length);
-}
-
-static void
-gdk_shadow_fb_draw_text_wc (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const GdkWChar *text,
- gint text_length)
-{
- gdk_fb_draw_text_wc (drawable, font, gc, x, y, text, text_length);
-}
-
-static void
-gdk_shadow_fb_draw_drawable (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkDrawableFBData *private;
-
- gdk_fb_draw_drawable (drawable, gc, src, xsrc, ysrc, xdest, ydest, width, height);
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- if (GDK_IS_WINDOW (private->wrapper))
- gdk_shadow_fb_update (xdest + private->abs_x, ydest + private->abs_y,
- xdest + private->abs_x + width, ydest + private->abs_y + height);
-}
-
-static void
-gdk_shadow_fb_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkDrawableFBData *private;
-
- gdk_fb_draw_image (drawable, gc, image, xsrc, ysrc, xdest, ydest, width, height);
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- if (GDK_IS_WINDOW (private->wrapper))
- gdk_shadow_fb_update (xdest + private->abs_x, ydest + private->abs_y,
- xdest + private->abs_x + width, ydest + private->abs_y + height);
-}
-
-static void
-gdk_shadow_fb_draw_points (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints)
-{
- GdkDrawableFBData *private;
-
- gdk_fb_draw_points (drawable, gc, points, npoints);
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- if (GDK_IS_WINDOW (private->wrapper))
- {
- gint minx, miny, maxx, maxy;
- int i;
-
- minx = maxx = points[0].x;
- miny = maxy = points[0].y;
-
- for (i = 1; i < npoints; i++)
- {
- minx = MIN(minx, points[i].x);
- maxx = MAX(maxx, points[i].x);
- miny = MIN(miny, points[i].y);
- maxy = MAX(maxy, points[i].y);
- }
-
- gdk_shadow_fb_update (minx + private->abs_x, miny + private->abs_y,
- maxx + private->abs_x, maxy + private->abs_y);
- }
-}
-
-static void
-gdk_shadow_fb_draw_segments (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSegment *segs,
- gint nsegs)
-{
- GdkDrawableFBData *private;
-
- gdk_fb_draw_segments (drawable, gc, segs, nsegs);
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- if (GDK_IS_WINDOW (private->wrapper))
- {
- gint minx, miny, maxx, maxy;
- gint extra_width;
- int i;
-
- minx = maxx = segs[0].x1;
- miny = maxy = segs[0].y1;
-
- for (i = 0; i < nsegs; i++)
- {
- minx = MIN(minx, segs[i].x1);
- maxx = MAX(maxx, segs[i].x1);
- minx = MIN(minx, segs[i].x2);
- maxx = MAX(maxx, segs[i].x2);
-
- miny = MIN(miny, segs[i].y1);
- maxy = MAX(maxy, segs[i].y1);
- miny = MIN(miny, segs[i].y2);
- maxy = MAX(maxy, segs[i].y2);
-
- }
-
- extra_width = (GDK_GC_FBDATA (gc)->values.line_width + 1) / 2;
-
- minx -= extra_width;
- miny -= extra_width;
- maxx += extra_width;
- maxy += extra_width;
-
- gdk_shadow_fb_update (minx + private->abs_x, miny + private->abs_y,
- maxx + private->abs_x, maxy + private->abs_y);
- }
-}
-
-static void
-gdk_shadow_fb_draw_lines (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints)
-{
- GdkDrawableFBData *private;
-
- gdk_fb_draw_lines (drawable, gc, points, npoints);
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- if (GDK_IS_WINDOW (private->wrapper))
- {
- gint minx, miny, maxx, maxy;
- gint extra_width;
- int i;
-
- minx = maxx = points[0].x;
- miny = maxy = points[0].y;
-
- for (i = 1; i < npoints; i++)
- {
- minx = MIN(minx, points[i].x);
- maxx = MAX(maxx, points[i].x);
- miny = MIN(miny, points[i].y);
- maxy = MAX(maxy, points[i].y);
- }
-
- extra_width = (GDK_GC_FBDATA (gc)->values.line_width + 1) / 2;
-
- minx -= extra_width;
- miny -= extra_width;
- maxx += extra_width;
- maxy += extra_width;
-
- gdk_shadow_fb_update (minx + private->abs_x, miny + private->abs_y,
- maxx + private->abs_x, maxy + private->abs_y);
- }
-}
-
-#endif
-
-gboolean
-gdk_draw_rectangle_alpha_libgtk_only (GdkDrawable *drawable,
- gint x,
- gint y,
- gint width,
- gint height,
- GdkColor *color,
- guint16 alpha)
-{
- return FALSE;
-}
diff --git a/gdk/linux-fb/gdkevents-fb.c b/gdk/linux-fb/gdkevents-fb.c
deleted file mode 100644
index 64cf1e9a4..000000000
--- a/gdk/linux-fb/gdkevents-fb.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include "gdk.h"
-#include "gdkprivate-fb.h"
-#include "gdkinternals.h"
-#include "gdkfb.h"
-
-/*********************************************
- * Functions for maintaining the event queue *
- *********************************************/
-
-static gboolean fb_events_prepare (GSource *source,
- gint *timeout);
-static gboolean fb_events_check (GSource *source);
-static gboolean fb_events_dispatch (GSource *source,
- GSourceFunc callback,
- gpointer user_data);
-
-static GSourceFuncs fb_events_funcs = {
- fb_events_prepare,
- fb_events_check,
- fb_events_dispatch,
- NULL
-};
-
-guint32
-gdk_fb_get_time(void)
-{
- GTimeVal tv;
-
- g_get_current_time (&tv);
- return (guint32) tv.tv_sec * 1000 + tv.tv_usec / 1000;
-}
-
-void
-_gdk_events_init (void)
-{
- GSource *source;
-
- source = g_source_new (&fb_events_funcs, sizeof (GSource));
- g_source_set_priority (source, GDK_PRIORITY_EVENTS);
-
- g_source_set_can_recurse (source, TRUE);
- g_source_attach (source, NULL);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_events_pending
- *
- * Returns if events are pending on the queue.
- *
- * Arguments:
- *
- * Results:
- * Returns TRUE if events are pending
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gboolean
-gdk_events_pending (void)
-{
- return fb_events_check (NULL);
-}
-
-GdkEvent*
-gdk_event_get_graphics_expose (GdkWindow *window)
-{
- GdkDisplay *display = gdk_display_get_default ();
- GList *ltmp;
- g_return_val_if_fail (window != NULL, NULL);
-
- for (ltmp = display->queued_events; ltmp; ltmp = ltmp->next)
- {
- GdkEvent *event = ltmp->data;
- if (event->type == GDK_EXPOSE &&
- event->expose.window == window)
- break;
- }
-
- if (ltmp)
- {
- GdkEvent *retval = ltmp->data;
-
- _gdk_event_queue_remove_link (display, ltmp);
- g_list_free_1 (ltmp);
-
- return retval;
- }
-
- return NULL;
-}
-
-void
-_gdk_events_queue (GdkDisplay *display)
-{
-}
-
-static gboolean
-fb_events_prepare (GSource *source,
- gint *timeout)
-{
- *timeout = -1;
-
- return fb_events_check (source);
-}
-
-static gboolean
-fb_events_check (GSource *source)
-{
- gboolean retval;
-
- GDK_THREADS_ENTER ();
-
- retval = (_gdk_event_queue_find_first (gdk_display_get_default ()) != NULL);
-
- GDK_THREADS_LEAVE ();
-
- return retval;
-}
-
-static gboolean
-fb_events_dispatch (GSource *source,
- GSourceFunc callback,
- gpointer user_data)
-{
- GdkEvent *event;
-
- GDK_THREADS_ENTER ();
-
- while ((event = _gdk_event_unqueue (gdk_display_get_default ())))
- {
- 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);
-
- gdk_event_free (event);
- }
-
- GDK_THREADS_LEAVE ();
-
- return TRUE;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_flush
- *
- * Flushes the Xlib output buffer and then waits
- * until all requests have been received and processed
- * by the X server. The only real use for this function
- * is in dealing with XShm.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_flush (void)
-{
-}
-
-gboolean
-gdk_event_send_client_message_for_display (GdkDisplay *display,
- GdkEvent *event,
- GdkNativeWindow winid)
-{
- return FALSE;
-}
-
-void
-gdk_screen_broadcast_client_message (GdkScreen *screen,
- GdkEvent *sev)
-{
-}
-
-gboolean
-gdk_screen_get_setting (GdkScreen *screen,
- const gchar *name,
- GValue *value)
-{
- return FALSE;
-}
-
-void
-gdk_display_sync (GdkDisplay *display)
-{
-}
-
-void
-gdk_display_flush (GdkDisplay * display)
-{
-}
diff --git a/gdk/linux-fb/gdkfb.h b/gdk/linux-fb/gdkfb.h
deleted file mode 100644
index fb433b84e..000000000
--- a/gdk/linux-fb/gdkfb.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef GDKFB_H
-#define GDKFB_H 1
-
-#include "gdk/gdkprivate.h"
-
-typedef struct _GdkFBDisplay GdkFBDisplay;
-typedef struct _GdkFBWindow GdkFBWindow;
-
-extern GdkFBWindow *gdk_root_window;
-extern GdkFBDisplay *gdk_display;
-
-#define GDK_ROOT_WINDOW() gdk_root_window
-#define GDK_DISPLAY() gdk_display
-
-#define gdk_font_lookup(xid) ((GdkFont*) (xid))
-
-typedef enum {
- GDK_FB_0_DEGREES,
- GDK_FB_90_DEGREES,
- GDK_FB_180_DEGREES,
- GDK_FB_270_DEGREES
-} GdkFBAngle;
-
-#define GDK_FB_USE_CHILD_SHAPE ((void *)1)
-
-/* FB specific functions: */
-
-typedef gboolean (*GdkWindowChildChanged) (GdkWindow *window,
- gint x, gint y,
- gint width, gint height,
- gpointer user_data);
-typedef void (*GdkWindowChildGetPos) (GdkWindow *window,
- gint *x, gint *y,
- gpointer user_data);
-
-void gdk_fb_window_set_child_handler (GdkWindow *window,
- GdkWindowChildChanged changed,
- GdkWindowChildGetPos get_pos,
- gpointer user_data);
-
-void gdk_fb_set_rotation (GdkFBAngle angle);
-
-#endif /* GDKFB_H */
diff --git a/gdk/linux-fb/gdkfbmanager.c b/gdk/linux-fb/gdkfbmanager.c
deleted file mode 100644
index 845a5b507..000000000
--- a/gdk/linux-fb/gdkfbmanager.c
+++ /dev/null
@@ -1,407 +0,0 @@
-#include <config.h>
-#include <glib.h>
-#include <glib/gprintf.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include "gdkfbmanager.h"
-
-typedef struct {
- int socket;
- int pid; /* -1 if not initialized */
-} Client;
-
-GHashTable *clients = NULL;
-GHashTable *new_clients = NULL;
-Client *current_owner = NULL;
-
-int master_socket;
-
-int create_master_socket (void)
-{
- int fd;
- struct sockaddr_un addr;
-
- fd = socket (PF_UNIX, SOCK_STREAM, 0);
-
- if (fd < 0)
- {
- g_fprintf (stderr, "Error creating socket: %s\n", strerror(errno));
- return -1;
- }
-
- unlink ("/tmp/.fb.manager");
-
- addr.sun_family = AF_UNIX;
- strcpy (addr.sun_path, "/tmp/.fb.manager");
-
- if (bind(fd, (struct sockaddr *)&addr, sizeof (addr)) < 0)
- {
- g_fprintf (stderr, "Unable to bind socket: %s\n", strerror (errno));
- close (fd);
- return -1;
- }
-
-
- if (listen (fd, 10) < 0)
- {
- g_fprintf (stderr, "Unable to listen on socket: %s\n", strerror (errno));
- close (fd);
- return -1;
- }
-
- master_socket = fd;
- return 0;
-}
-
-void
-handle_new_client (void)
-{
- int fd;
- Client *client;
- int true_val;
-
- fd = accept (master_socket, NULL, NULL);
-
- client = g_new (Client, 1);
- client->socket = fd;
- client->pid = -1;
-
- true_val = 1;
- setsockopt (fd, SOL_SOCKET, SO_PASSCRED,
- &true_val, sizeof (true_val));
-
- g_print ("Handling new client %p conntecting, fd = %d\n", client, fd);
-
- g_hash_table_insert (new_clients, client, client);
-}
-
-struct fd_data
-{
- fd_set *read_fds;
- fd_set *exception_fds;
- int max_fd;
-};
-
-void
-send_message (Client *client, enum FBManagerMessageType type, int data)
-{
- struct FBManagerMessage msg;
-
- msg.msg_type = type;
- msg.data = data;
-
- send (client->socket, &msg, sizeof (msg), 0);
-}
-
-gboolean
-wait_for_ack (Client *client, int timeout_secs)
-{
- struct FBManagerMessage msg;
- int res;
- fd_set rfds;
- struct timeval tv;
-
- while (1)
- {
- FD_ZERO(&rfds);
- FD_SET(client->socket, &rfds);
-
- tv.tv_sec = timeout_secs;
- tv.tv_usec = 0;
-
- res = select (client->socket+1, &rfds, NULL, NULL, &tv);
-
- if (res == 0)
- return FALSE;
-
- res = recv (client->socket, &msg, sizeof (msg), 0);
- if (res != sizeof (msg))
- return FALSE;
-
- if (msg.msg_type == FB_MANAGER_ACK)
- return TRUE;
- }
-}
-
-void
-find_another_client (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- Client **res;
- Client *client;
-
- res = user_data;
-
- if (*res)
- return;
-
- client = value;
- if (client != current_owner)
- *res = client;
-}
-
-void
-switch_to_client (Client *client)
-{
- g_print ("Switch_to_client, client=%p, current_owner=%p\n", client, current_owner);
-
- if ((current_owner == client) && (client != NULL))
- return;
-
- if (current_owner)
- {
- g_print ("switching from client fd=%d\n", current_owner->socket);
- send_message (current_owner, FB_MANAGER_SWITCH_FROM, 0);
- wait_for_ack (current_owner, 3);
- }
-
- current_owner = client;
-
- if (current_owner)
- {
- g_print ("switching to client fd=%d\n", current_owner->socket);
- send_message (current_owner, FB_MANAGER_SWITCH_TO, 0);
- }
-}
-
-void
-close_client (Client *client)
-{
- Client *other_client;
- g_print ("Closing client %p (fd=%d)\n",
- client, client->socket);
-
- if (current_owner == client)
- {
- other_client = NULL;
- g_hash_table_foreach (clients,
- find_another_client,
- &other_client);
- current_owner = NULL;
- /* FIXME: This is a hack around the fact that the serial
- mouse driver had problems with opening and closing
- the device almost at the same time.
- */
- sleep (1);
- switch_to_client (other_client);
- }
-
- close (client->socket);
- g_free (client);
-}
-
-
-/* Returns TRUE if the client was closed */
-gboolean
-read_client_data (Client *client)
-{
- struct FBManagerMessage fb_message;
- struct msghdr msg;
- struct iovec iov;
- char control_buffer[256];
- struct cmsghdr *cmsg;
- int res;
- struct ucred *creds;
- Client *new_client;
-
- iov.iov_base = &fb_message;
- iov.iov_len = sizeof (fb_message);
-
- cmsg = (struct cmsghdr *)control_buffer;
- msg.msg_name = NULL;
- msg.msg_namelen = 0;
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
- msg.msg_control = cmsg;
- msg.msg_controllen = 256;
- msg.msg_flags = 0;
-
- g_print ("Reading client data:");
- res = recvmsg (client->socket, &msg, 0);
- g_print ("%d bytes, (error: %s)\n", res,
- strerror (errno));
-
- if (res < 0)
- return FALSE;
-
- if (res == 0)
- {
- close_client (client);
- return TRUE;
- }
-
- if (res != sizeof (fb_message))
- {
- g_warning ("Packet with wrong size %d received", res);
- return FALSE;
- }
-
- switch (fb_message.msg_type) {
- case FB_MANAGER_NEW_CLIENT:
- if (client->pid != -1)
- {
- g_warning ("Got a NEW_CLIENT message from an old client");
- return FALSE;
- }
- creds = NULL;
- for (cmsg = CMSG_FIRSTHDR(&msg);
- cmsg != NULL;
- cmsg = CMSG_NXTHDR(&msg,cmsg))
- {
- if (cmsg->cmsg_level == SOL_SOCKET &&
- cmsg->cmsg_type == SCM_CREDENTIALS)
- {
- creds = (struct ucred *) CMSG_DATA(cmsg);
- break;
- }
- }
- if (creds == NULL)
- {
- g_warning ("Got no credentials in NEW_CLIENT message");
- close_client (client);
- return TRUE;
- }
- client->pid = creds->pid;
-
- g_hash_table_insert (clients, GINT_TO_POINTER (client->pid), client);
-
- g_print ("New client connected. Pid=%d\n", (int)creds->pid);
- return TRUE;
- break;
- case FB_MANAGER_REQUEST_SWITCH_TO_PID:
- if (client->pid == -1)
- {
- g_warning ("Got a message from an uninitialized client");
- return FALSE;
- }
-
- new_client = g_hash_table_lookup (clients, GINT_TO_POINTER (fb_message.data));
- if (new_client)
- switch_to_client (new_client);
- else
- g_warning ("Switchto unknown PID");
- break;
- case FB_MANAGER_ACK:
- if (client->pid == -1)
- {
- g_warning ("Got a message from an uninitialized client");
- return FALSE;
- }
- g_warning ("Got an unexpected ACK");
- break;
- default:
- g_warning ("Got unknown package type %d", fb_message.msg_type);
- break;
- }
- return FALSE;
-}
-
-/* Returns TRUE if the client was closed */
-gboolean
-handle_client_data (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- Client *client;
- struct fd_data *data;
-
- client = value;
- data = user_data;
-
- if (FD_ISSET (client->socket, data->exception_fds))
- {
- close_client (client);
- return TRUE;
- }
- else if (FD_ISSET (client->socket, data->read_fds))
- {
- return read_client_data (client);
- }
-
- return FALSE;
-}
-
-void
-set_fds (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- struct fd_data *data;
- Client *client;
-
- client = value;
- data = user_data;
-
- FD_SET (client->socket, data->read_fds);
- FD_SET (client->socket, data->exception_fds);
- data->max_fd = MAX (data->max_fd,
- client->socket);
-}
-
-void
-main_loop (void)
-{
- fd_set read_fds;
- fd_set exception_fds;
- struct fd_data data;
- int res;
-
- while (1)
- {
- FD_ZERO (&read_fds);
- FD_ZERO (&exception_fds);
- FD_SET (master_socket, &read_fds);
-
- data.read_fds = &read_fds;
- data.exception_fds = &exception_fds;
- data.max_fd = master_socket;
-
- g_hash_table_foreach (clients,
- set_fds,
- &data);
- g_hash_table_foreach (new_clients,
- set_fds,
- &data);
-
-
- res = select (data.max_fd+1,
- &read_fds, NULL, &exception_fds,
- NULL);
-
- if (FD_ISSET (master_socket, &read_fds))
- handle_new_client ();
-
- g_hash_table_foreach_remove (clients,
- handle_client_data,
- &data);
- g_hash_table_foreach_remove (new_clients,
- handle_client_data,
- &data);
- }
-}
-
-
-int
-main (int argc, char *argv[])
-{
- clients = g_hash_table_new (g_direct_hash,
- g_direct_equal);
- new_clients = g_hash_table_new (g_direct_hash,
- g_direct_equal);
-
- create_master_socket ();
-
- main_loop ();
-
- return 0;
-}
diff --git a/gdk/linux-fb/gdkfbmanager.h b/gdk/linux-fb/gdkfbmanager.h
deleted file mode 100644
index 653a1c69c..000000000
--- a/gdk/linux-fb/gdkfbmanager.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __GDK_FB_MANAGER_H__
-#define __GDK_FB_MANAGER_H__
-
-enum FBManagerMessageType {
- /* manager -> client */
- FB_MANAGER_SWITCH_TO,
- FB_MANAGER_SWITCH_FROM, /* requires ack */
-
- /* client -> manager */
- FB_MANAGER_NEW_CLIENT,
- FB_MANAGER_REQUEST_SWITCH_TO_PID,
- FB_MANAGER_ACK,
-};
-
-struct FBManagerMessage {
- enum FBManagerMessageType msg_type;
- int data;
-};
-#endif /* __GDK_FB_MANAGER_H__ */
diff --git a/gdk/linux-fb/gdkfbswitch.c b/gdk/linux-fb/gdkfbswitch.c
deleted file mode 100644
index 31179f422..000000000
--- a/gdk/linux-fb/gdkfbswitch.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2001 Alexander Larsson
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <glib.h>
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-
-#include "gdkfbmanager.h"
-
-int
-main (int argc, char *argv[])
-{
- int fd;
- struct sockaddr_un addr;
- struct msghdr msg = {0};
- struct cmsghdr *cmsg;
- struct ucred credentials;
- struct FBManagerMessage init_msg;
- struct iovec iov;
- char buf[CMSG_SPACE (sizeof (credentials))]; /* ancillary data buffer */
- int *fdptr;
- int res;
-
- if (argc != 2)
- {
- g_print ("usage: fbswitch <pid>\n");
- return 1;
- }
-
- fd = socket (PF_UNIX, SOCK_STREAM, 0);
-
- if (fd < 0)
- return 1;
-
- addr.sun_family = AF_UNIX;
- strcpy (addr.sun_path, "/tmp/.fb.manager");
-
- if (connect(fd, (struct sockaddr *)&addr, sizeof (addr)) < 0)
- {
- g_print ("connect failed\n");
- close (fd);
- return 1;
- }
-
- credentials.pid = getpid ();
- credentials.uid = geteuid ();
- credentials.gid = getegid ();
-
- init_msg.msg_type = FB_MANAGER_NEW_CLIENT;
- iov.iov_base = &init_msg;
- iov.iov_len = sizeof (init_msg);
-
- msg.msg_name = NULL;
- msg.msg_namelen = 0;
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
- msg.msg_control = buf;
- msg.msg_controllen = sizeof buf;
- cmsg = CMSG_FIRSTHDR(&msg);
- cmsg->cmsg_level = SOL_SOCKET;
- cmsg->cmsg_type = SCM_CREDENTIALS;
- cmsg->cmsg_len = CMSG_LEN (sizeof (credentials));
- /* Initialize the payload: */
- fdptr = (int *)CMSG_DATA (cmsg);
- memcpy (fdptr, &credentials, sizeof (credentials));
- /* Sum of the length of all control messages in the buffer: */
- msg.msg_controllen = cmsg->cmsg_len;
-
- res = sendmsg (fd, &msg, 0);
-
- init_msg.msg_type = FB_MANAGER_REQUEST_SWITCH_TO_PID;
- init_msg.data = atoi (argv[1]);
- /* Request a switch-to */
- send (fd, &init_msg, sizeof (init_msg), 0);
- g_print ("requested a switch to pid %d\n", init_msg.data);
-
- return 0;
-}
diff --git a/gdk/linux-fb/gdkfont-fb.c b/gdk/linux-fb/gdkfont-fb.c
deleted file mode 100644
index b0bed69ee..000000000
--- a/gdk/linux-fb/gdkfont-fb.c
+++ /dev/null
@@ -1,584 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include "gdkfont.h"
-#include "gdkprivate-fb.h"
-#include "gdkpango.h"
-
-#include <pango/pango.h>
-
-#include <freetype/freetype.h>
-#if !defined(FREETYPE_MAJOR) || FREETYPE_MAJOR != 2
-#error "We need Freetype 2.0"
-#endif
-
-#ifdef EMULATE_GDKFONT
-static GHashTable *font_name_hash = NULL;
-static GHashTable *fontset_name_hash = NULL;
-
-static void
-gdk_font_hash_insert (GdkFontType type, GdkFont *font)
-{
- GdkFontPrivateFB *private = (GdkFontPrivateFB *)font;
-
- GHashTable **hashp = (type == GDK_FONT_FONT) ?
- &font_name_hash : &fontset_name_hash;
-
- if (!*hashp)
- *hashp = g_hash_table_new (g_str_hash, g_str_equal);
-
- g_hash_table_insert (*hashp, private->name, font);
-}
-
-static void
-gdk_font_hash_remove (GdkFontType type, GdkFont *font)
-{
- GdkFontPrivateFB *private = (GdkFontPrivateFB *)font;
-
- GHashTable *hash = (type == GDK_FONT_FONT) ?
- font_name_hash : fontset_name_hash;
-
- g_hash_table_remove (hash, private->name);
-}
-
-static GdkFont *
-gdk_font_hash_lookup (GdkFontType type, const gchar *font_name)
-{
- GdkFont *result;
- GHashTable *hash = (type == GDK_FONT_FONT) ?
- font_name_hash : fontset_name_hash;
-
- if (!hash)
- return NULL;
- else
- {
- result = g_hash_table_lookup (hash, font_name);
- if (result)
- gdk_font_ref (result);
-
- return result;
- }
-}
-
-GdkFont*
-gdk_font_from_description_for_display (GdkDisplay *display,
- PangoFontDescription *desc)
-{
- GdkFont *font;
- GdkFontPrivateFB *private;
- PangoFont *pango_font;
- PangoContext *context;
- PangoFontMetrics *metrics;
- PangoLanguage *lang;
-
- g_return_val_if_fail (desc, NULL);
-
- private = g_new0 (GdkFontPrivateFB, 1);
- private->base.ref_count = 1;
- private->name = NULL;
-
- font = (GdkFont*) private;
- font->type = GDK_FONT_FONT;
-
- context = gdk_pango_context_get ();
- pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
- pango_context_set_language (context, pango_language_from_string ("UNKNOWN"));
-
- pango_font = pango_context_load_font (context, desc);
- if (!pango_font)
- {
- desc = pango_font_description_copy (desc);
- pango_font_description_set_family (desc, "sans");
- pango_font = pango_context_load_font (context, desc);
- if (!pango_font)
- {
- pango_font_description_set_style (desc, PANGO_STYLE_NORMAL);
- pango_font_description_set_weight (desc, PANGO_WEIGHT_NORMAL);
- pango_font_description_set_variant (desc, PANGO_VARIANT_NORMAL);
- pango_font_description_set_stretch (desc, PANGO_STRETCH_NORMAL);
- pango_font = pango_context_load_font (context, desc);
- }
- pango_font_description_free (desc);
- }
-
- g_assert (pango_font != NULL);
-
- if (pango_font == NULL)
- {
- g_free (private);
- return NULL;
- }
-
- lang = pango_context_get_language (context);
- metrics = pango_font_get_metrics (pango_font, lang);
-
- private->pango_font = pango_font;
-
- g_free (lang);
- g_object_unref (context);
-
- font->ascent = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics));
- font->descent = PANGO_PIXELS (pango_font_metrics_get_descent (metrics));
-
- g_assert ((font->ascent > 0) || (font->descent > 0));
-
- pango_font_metrics_unref (metrics);
-
- return font;
-}
-
-
-GdkFont*
-gdk_font_load_for_display (GdkDisplay *display,
- const gchar *font_name)
-{
- GdkFont *font;
- GdkFontPrivateFB *private;
- PangoFontDescription *desc;
- gchar **pieces;
-
- g_return_val_if_fail (font_name != NULL, NULL);
-
- font = gdk_font_hash_lookup (GDK_FONT_FONT, font_name);
- if (font)
- return font;
-
- desc = pango_font_description_new ();
-
- pieces = g_strsplit (font_name, "-", 8);
-
- do {
- if (!pieces[0])
- break;
-
- if (!pieces[1])
- break;
-
- if (!pieces[2])
- break;
-
- if (strcmp (pieces[2], "*")!=0)
- pango_font_description_set_family (desc, pieces[2]);
-
- if (!pieces[3])
- break;
-
- if (strcmp (pieces[3], "light")==0)
- pango_font_description_set_weight (desc, PANGO_WEIGHT_LIGHT);
- if (strcmp (pieces[3], "medium")==0)
- pango_font_description_set_weight (desc, PANGO_WEIGHT_NORMAL);
- if (strcmp (pieces[3], "bold")==0)
- pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
-
- if (!pieces[4])
- break;
-
- if (strcmp (pieces[4], "r")==0)
- pango_font_description_set_style (desc, PANGO_STYLE_NORMAL);
- if (strcmp (pieces[4], "i")==0)
- pango_font_description_set_style (desc, PANGO_STYLE_ITALIC);
- if (strcmp (pieces[4], "o")==0)
- pango_font_description_set_style (desc, PANGO_STYLE_OBLIQUE);
-
- if (!pieces[5])
- break;
- if (!pieces[6])
- break;
- if (!pieces[7])
- break;
-
- if (strcmp (pieces[7], "*")!=0)
- pango_font_description_set_size (desc, atoi (pieces[7]) * PANGO_SCALE);
- if (pango_font_description_get_size (desc) == 0)
- pango_font_description_set_size (desc, 12 * PANGO_SCALE);
-
- } while (0);
-
- font = gdk_font_from_description (desc);
- private = (GdkFontPrivateFB*) font;
- private->name = g_strdup (font_name);
-
- gdk_font_hash_insert (GDK_FONT_FONT, font);
-
- g_strfreev (pieces);
-
- pango_font_description_free (desc);
-
- return font;
-}
-
-GdkFont*
-gdk_fontset_load (const gchar *fontset_name)
-{
- return gdk_font_load(fontset_name);
-}
-
-void
-_gdk_font_destroy (GdkFont *font)
-{
- GdkFontPrivateFB *private = (GdkFontPrivateFB *)font;
- gdk_font_hash_remove (font->type, font);
-
- g_object_unref (private->pango_font);
- g_free (private->name);
- g_free (font);
-}
-
-gint
-_gdk_font_strlen (GdkFont *font,
- const gchar *str)
-{
- GdkFontPrivateFB *font_private;
-
- g_return_val_if_fail (font != NULL, -1);
- g_return_val_if_fail (str != NULL, -1);
-
- font_private = (GdkFontPrivateFB*) font;
-
- return strlen (str);
-}
-
-gint
-gdk_text_width (GdkFont *font,
- const gchar *text,
- gint text_length)
-{
- gint width = -1;
- gdk_text_extents (font, text, text_length, NULL, NULL, &width, NULL, NULL);
- return width;
-}
-
-/* Assumes text is in Latin-1 for performance reasons.
- If you need another encoding, use pangofont */
-void
-gdk_text_extents (GdkFont *font,
- const gchar *text,
- gint text_length,
- gint *lbearing,
- gint *rbearing,
- gint *width,
- gint *ascent,
- gint *descent)
-{
- GdkFontPrivateFB *private;
- guchar *utf8, *utf8_end;
- PangoGlyphString *glyphs = pango_glyph_string_new ();
- PangoEngineShape *shaper, *last_shaper;
- PangoAnalysis analysis;
- guchar *p, *start;
- int i;
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
-
- private = (GdkFontPrivateFB*) font;
-
- if(ascent)
- *ascent = 0;
- if(descent)
- *descent = 0;
- if(width)
- *width = 0;
- if(lbearing)
- *lbearing = 0;
- if(rbearing)
- *rbearing = 0;
-
- utf8 = alloca (text_length*2);
-
- /* Convert latin-1 to utf8 */
- p = utf8;
- for (i = 0; i < text_length; i++)
- {
- if (text[i]==0)
- *p++ = 1; /* Hack to handle embedded nulls */
- else
- {
- if(((guchar)text[i])<128)
- *p++ = text[i];
- else
- {
- *p++ = ((((guchar)text[i])>>6) & 0x3f) | 0xC0;
- *p++ = (((guchar)text[i]) & 0x3f) | 0x80;
- }
- }
- }
- utf8_end = p;
-
- last_shaper = NULL;
- shaper = NULL;
-
- p = start = utf8;
- while (p < utf8_end)
- {
- gunichar wc = g_utf8_get_char (p);
- p = g_utf8_next_char (p);
- shaper = pango_font_find_shaper (private->pango_font, pango_language_from_string ("fr"), wc);
- if (shaper != last_shaper)
- {
- analysis.shape_engine = shaper;
- analysis.lang_engine = NULL;
- analysis.font = private->pango_font;
- analysis.level = 0;
-
- pango_shape (start, p - start, &analysis, glyphs);
-
- for (i = 0; i < glyphs->num_glyphs; i++)
- {
- PangoRectangle ink_rect;
- PangoGlyphGeometry *geometry = &glyphs->glyphs[i].geometry;
-
- pango_font_get_glyph_extents (private->pango_font, glyphs->glyphs[i].glyph,
- &ink_rect, NULL);
-
- if(ascent)
- *ascent = MAX (*ascent, ink_rect.y);
- if(descent)
- *descent = MAX (*descent, ink_rect.height - ink_rect.y);
- if(width)
- *width += geometry->width;
- if(lbearing)
- *lbearing = 0;
- if(rbearing)
- *rbearing = 0;
-
- }
-
- start = p;
- }
-
- last_shaper = shaper;
- }
-
- if (p > start)
- {
- analysis.shape_engine = shaper;
- analysis.lang_engine = NULL;
- analysis.font = private->pango_font;
- analysis.level = 0;
-
- pango_shape (start, p - start, &analysis, glyphs);
-
- for (i = 0; i < glyphs->num_glyphs; i++)
- {
- PangoRectangle ink_rect;
- PangoGlyphGeometry *geometry = &glyphs->glyphs[i].geometry;
-
- pango_font_get_glyph_extents (private->pango_font, glyphs->glyphs[i].glyph,
- &ink_rect, NULL);
-
- if(ascent)
- *ascent = MAX (*ascent, ink_rect.y);
- if(descent)
- *descent = MAX (*descent, ink_rect.height - ink_rect.y);
- if(width)
- *width += geometry->width;
- if(lbearing)
- *lbearing = 0;
- if(rbearing)
- *rbearing = 0;
- }
- }
-
-
-
- pango_glyph_string_free (glyphs);
-
- if(ascent)
- *ascent = PANGO_PIXELS (*ascent);
- if(descent)
- *descent = PANGO_PIXELS(*descent);
- if(width)
- *width = PANGO_PIXELS (*width);
- if(lbearing)
- *lbearing = PANGO_PIXELS (*lbearing);
- if(rbearing)
- *rbearing = PANGO_PIXELS (*rbearing);
-}
-
-#else
-
-/* Don't emulate GdkFont */
-static GdkFont *
-gdk_fb_bogus_font (gint height)
-{
- GdkFont *font;
- GdkFontPrivateFB *private;
-
- private = g_new0 (GdkFontPrivateFB, 1);
- font = (GdkFont *)private;
-
- font->type = GDK_FONT_FONT;
- font->ascent = height*3/4;
- font->descent = height/4;
- private->size = height;
- private->base.ref_count = 1;
- return font;
-}
-
-GdkFont*
-gdk_font_from_description (PangoFontDescription *font_desc)
-{
- g_return_val_if_fail (font_desc, NULL);
-
- return gdk_fb_bogus_font (PANGO_PIXELS (pango_font_description_get_size (font_desc)));
-}
-
-GdkFont*
-gdk_fontset_load (const gchar *fontset_name)
-{
- return gdk_fb_bogus_font (10);
-}
-
-GdkFont *
-gdk_font_load (const gchar *font_name)
-{
- return gdk_fb_bogus_font (10);
-}
-
-void
-_gdk_font_destroy (GdkFont *font)
-{
- g_free (font);
-}
-
-gint
-_gdk_font_strlen (GdkFont *font,
- const gchar *str)
-{
- GdkFontPrivateFB *font_private;
- gint length = 0;
-
- g_return_val_if_fail (font != NULL, -1);
- g_return_val_if_fail (str != NULL, -1);
-
- font_private = (GdkFontPrivateFB*) font;
-
- return strlen (str);
-}
-
-gint
-gdk_text_width (GdkFont *font,
- const gchar *text,
- gint text_length)
-{
- GdkFontPrivateFB *private;
-
- private = (GdkFontPrivateFB*) font;
-
- return (text_length * private->size) / 2;
-}
-
-void
-gdk_text_extents (GdkFont *font,
- const gchar *text,
- gint text_length,
- gint *lbearing,
- gint *rbearing,
- gint *width,
- gint *ascent,
- gint *descent)
-{
- if(ascent)
- *ascent = font->ascent;
- if(descent)
- *descent = font->descent;
- if(width)
- *width = gdk_text_width(font, text, text_length);
- if(lbearing)
- *lbearing = 0;
- if(rbearing)
- *rbearing = 0;
-}
-
-
-#endif
-
-gint
-gdk_font_id (const GdkFont *font)
-{
- const GdkFontPrivateFB *font_private;
-
- g_return_val_if_fail (font != NULL, 0);
-
- font_private = (const GdkFontPrivateFB*) font;
-
- if (font->type == GDK_FONT_FONT)
- {
- return -1;
- }
- else
- {
- return 0;
- }
-}
-
-gint
-gdk_font_equal (const GdkFont *fonta,
- const GdkFont *fontb)
-{
- const GdkFontPrivateFB *privatea;
- const GdkFontPrivateFB *privateb;
-
- g_return_val_if_fail (fonta != NULL, FALSE);
- g_return_val_if_fail (fontb != NULL, FALSE);
-
- privatea = (const GdkFontPrivateFB*) fonta;
- privateb = (const GdkFontPrivateFB*) fontb;
-
- if(fonta == fontb)
- return TRUE;
-
- return FALSE;
-}
-
-
-gint
-gdk_text_width_wc (GdkFont *font,
- const GdkWChar *text,
- gint text_length)
-{
- return 0;
-}
-
-
-void
-gdk_text_extents_wc (GdkFont *font,
- const GdkWChar *text,
- gint text_length,
- gint *lbearing,
- gint *rbearing,
- gint *width,
- gint *ascent,
- gint *descent)
-{
- g_warning ("gdk_text_extents_wc() is not implemented\n");
- return;
-}
diff --git a/gdk/linux-fb/gdkgc-fb.c b/gdk/linux-fb/gdkgc-fb.c
deleted file mode 100644
index 526be8726..000000000
--- a/gdk/linux-fb/gdkgc-fb.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2000 Elliot Lee
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "gdkprivate-fb.h"
-#include "gdkgc.h"
-#include "gdkfb.h"
-#include "gdkregion-generic.h"
-
-typedef enum {
- GDK_GC_DIRTY_CLIP = 1 << 0,
- GDK_GC_DIRTY_TS = 1 << 1
-} GdkGCDirtyValues;
-
-static void gdk_fb_gc_finalize (GObject *obj);
-static void gdk_fb_gc_get_values (GdkGC *gc,
- 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);
-
-static gpointer parent_class = NULL;
-
-static void
-gdk_gc_fb_class_init (GdkGCFBClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkGCClass *gc_class = GDK_GC_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_fb_gc_finalize;
-
- gc_class->get_values = gdk_fb_gc_get_values;
- gc_class->set_values = gdk_fb_gc_set_values;
- gc_class->set_dashes = gdk_fb_gc_set_dashes;
-}
-
-GType
-gdk_gc_fb_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (GdkGCFBClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_gc_fb_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkGCFBData),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (GDK_TYPE_GC,
- "GdkGCFB",
- &object_info,
- 0);
- }
-
- return object_type;
-}
-
-GdkGC *
-_gdk_fb_gc_new (GdkDrawable *drawable,
- GdkGCValues *values,
- GdkGCValuesMask values_mask)
-{
- GdkGC *gc;
- GdkGCFBData *private;
-
- gc = g_object_new (gdk_gc_fb_get_type (), NULL);
-
- _gdk_gc_init (gc, drawable, values, values_mask);
-
- private = (GdkGCFBData *)gc;
-
- private->depth = GDK_DRAWABLE_FBDATA (drawable)->depth;
- private->values.foreground.pixel = 255;
- private->values.foreground.red =
- private->values.foreground.green =
- private->values.foreground.blue = 65535;
-
- private->values.cap_style = GDK_CAP_BUTT;
-
- _gdk_fb_gc_calc_state (gc, _GDK_FB_GC_DEPTH);
-
- gdk_fb_gc_set_values (gc, values, values_mask);
- return gc;
-}
-
-static void
-gdk_fb_gc_finalize (GObject *obj)
-{
- GdkGC *gc = GDK_GC_P (obj);
- GdkGCFBData *private;
-
- private = GDK_GC_FBDATA (gc);
-
- if (private->values.clip_mask)
- gdk_pixmap_unref (private->values.clip_mask);
-
- g_free (private->dash_list);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gdk_fb_gc_get_values (GdkGC *gc,
- GdkGCValues *values)
-{
- *values = GDK_GC_FBDATA (gc)->values;
-}
-
-
-static void
-gdk_fb_gc_set_values (GdkGC *gc,
- GdkGCValues *values,
- GdkGCValuesMask values_mask)
-{
- GdkPixmap *oldpm;
- GdkFont *oldf;
- GdkGCFBData *private;
-
- private = GDK_GC_FBDATA (gc);
-
- if (values_mask & GDK_GC_FOREGROUND)
- {
- private->values.foreground = values->foreground;
- private->values_mask |= GDK_GC_FOREGROUND;
- }
-
- if (values_mask & GDK_GC_BACKGROUND)
- {
- private->values.background = values->background;
- private->values_mask |= GDK_GC_BACKGROUND;
- }
-
- if (values_mask & GDK_GC_FONT)
- {
- 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)
- {
- private->values.function = values->function;
- private->values_mask |= GDK_GC_FUNCTION;
- }
-
- if (values_mask & GDK_GC_FILL)
- {
- private->values.fill = values->fill;
- private->values_mask |= GDK_GC_FILL;
- }
-
- if (values_mask & GDK_GC_TILE)
- {
- oldpm = private->values.tile;
- if (values->tile)
- g_assert (GDK_DRAWABLE_IMPL_FBDATA (values->tile)->depth >= 8);
-
- private->values.tile = values->tile;
- private->values_mask |= GDK_GC_TILE;
- if (oldpm)
- gdk_pixmap_unref (oldpm);
- }
-
- if (values_mask & GDK_GC_STIPPLE)
- {
- oldpm = private->values.stipple;
- if (values->stipple)
- g_assert (GDK_DRAWABLE_IMPL_FBDATA (values->stipple)->depth == 1);
- private->values.stipple = values->stipple;
- private->values_mask |= GDK_GC_STIPPLE;
- if (oldpm)
- gdk_pixmap_unref (oldpm);
- }
-
- if (values_mask & GDK_GC_CLIP_MASK)
- {
- oldpm = private->values.clip_mask;
-
- 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 (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)
- {
- 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)
- {
- 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)
- {
- 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)
- {
- 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)
- {
- private->values.graphics_exposures = values->graphics_exposures;
- private->values_mask |= GDK_GC_EXPOSURES;
- }
-
- if (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)
- {
- private->values.line_style = values->line_style;
- private->values_mask |= GDK_GC_LINE_STYLE;
- }
-
- if (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)
- {
- private->values.join_style = values->join_style;
- private->values_mask |= GDK_GC_JOIN_STYLE;
- }
-
- _gdk_fb_gc_calc_state (gc, values_mask);
-}
-
-static void
-gdk_fb_gc_set_dashes (GdkGC *gc,
- gint dash_offset,
- gint8 dash_list[],
- gint n)
-{
- GdkGCFBData *private;
-
- private = GDK_GC_FBDATA (gc);
-
- private->dash_offset = dash_offset;
- private->dash_list_len = n;
-
- if (n)
- {
- private->dash_list = g_realloc (private->dash_list, n);
- memcpy (private->dash_list, dash_list, n);
- }
- else
- {
- g_free (private->dash_list);
- private->dash_list = NULL;
- }
-}
-
-static void
-gc_unset_cmask(GdkGC *gc)
-{
- GdkGCFBData *data;
- data = GDK_GC_FBDATA (gc);
-
- if (data->values.clip_mask)
- {
- gdk_pixmap_unref (data->values.clip_mask);
- data->values.clip_mask = NULL;
- data->values_mask &= ~ GDK_GC_CLIP_MASK;
- }
-
- _gdk_fb_gc_calc_state (gc, GDK_GC_CLIP_MASK);
-}
-
-void
-_gdk_windowing_gc_set_clip_region (GdkGC *gc,
- GdkRegion *region)
-{
- GdkGCFBData *data = GDK_GC_FBDATA (gc);
-
- gc->clip_x_origin = 0;
- gc->clip_y_origin = 0;
- data->values.clip_x_origin = 0;
- data->values.clip_y_origin = 0;
-
- gc_unset_cmask (gc);
-
- _gdk_fb_gc_calc_state (gc, GDK_GC_CLIP_X_ORIGIN|GDK_GC_CLIP_Y_ORIGIN);
-}
-
-
-void
-_gdk_windowing_gc_copy (GdkGC *dst_gc,
- GdkGC *src_gc)
-{
- GdkGCFBData *dst_private = GDK_GC_FBDATA (dst_gc);
- GdkGCFBData *src_private = GDK_GC_FBDATA (src_gc);
- GdkGCValuesMask old_mask = dst_private->values_mask;
-
- if (dst_private->values_mask & GDK_GC_FONT)
- gdk_font_unref (dst_private->values.font);
- if (dst_private->values_mask & GDK_GC_CLIP_MASK)
- g_object_unref (dst_private->values.clip_mask);
-
- g_free (dst_private->dash_list);
-
- if (src_private->dash_list)
- dst_private->dash_list = g_memdup (src_private->dash_list,
- src_private->dash_list_len);
-
- dst_private->values_mask = src_private->values_mask;
- dst_private->values = src_private->values;
- if (dst_private->values_mask & GDK_GC_FONT)
- gdk_font_ref (dst_private->values.font);
- if (dst_private->values_mask & GDK_GC_CLIP_MASK)
- g_object_ref (dst_private->values.clip_mask);
-
- dst_private->dash_offset = src_private->dash_offset;
- dst_private->alu = src_private->alu;
-
- dst_private->set_pixel = src_private->set_pixel;
-
- _gdk_fb_gc_calc_state (gc, old_mask | dst_private->values_mask);
-}
diff --git a/gdk/linux-fb/gdkgeometry-fb.c b/gdk/linux-fb/gdkgeometry-fb.c
deleted file mode 100644
index 53fcd7c73..000000000
--- a/gdk/linux-fb/gdkgeometry-fb.c
+++ /dev/null
@@ -1,70 +0,0 @@
-#include <config.h>
-#include "gdkprivate-fb.h"
-
-void
-gdk_window_scroll (GdkWindow *window,
- gint dx,
- gint dy)
-{
- GdkWindowObject *private = GDK_WINDOW_P (window);
- GdkRegion *invalidate_region;
- GdkRectangle dest_rect;
- GdkRectangle clip_rect;
- GList *tmp_list;
- gboolean handle_cursor;
-
- 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;
- invalidate_region = gdk_region_rectangle (&clip_rect);
-
- dest_rect = clip_rect;
- dest_rect.x += dx;
- dest_rect.y += dy;
- gdk_rectangle_intersect (&dest_rect, &clip_rect, &dest_rect);
-
- if (handle_cursor)
- gdk_fb_cursor_hide ();
-
- if (dest_rect.width > 0 && dest_rect.height > 0)
- {
- GdkRegion *tmp_region;
-
- tmp_region = gdk_region_rectangle (&dest_rect);
- gdk_region_subtract (invalidate_region, tmp_region);
- gdk_region_destroy (tmp_region);
-
- gdk_fb_draw_drawable_2 (GDK_DRAWABLE_IMPL(window),
- _gdk_fb_screen_gc,
- 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_shadow_fb_update (dest_rect.x - dx, dest_rect.y - dy,
- dest_rect.x - dx + dest_rect.width,
- dest_rect.y - dy + dest_rect.height);
- }
-
- 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)
- 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_DRAWABLE_IMPL_FBDATA(tmp_list->data)->width,
- GDK_DRAWABLE_IMPL_FBDATA(tmp_list->data)->height,
- FALSE);
-
- if (handle_cursor)
- gdk_fb_cursor_unhide ();
-}
diff --git a/gdk/linux-fb/gdkglobals-fb.c b/gdk/linux-fb/gdkglobals-fb.c
deleted file mode 100644
index 89672e3f5..000000000
--- a/gdk/linux-fb/gdkglobals-fb.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <stdio.h>
-
-#include "gdktypes.h"
-#include "gdkprivate-fb.h"
-
-GdkWindow *_gdk_fb_pointer_grab_window, *_gdk_fb_keyboard_grab_window, *_gdk_fb_pointer_grab_confine = NULL;
-gboolean _gdk_fb_pointer_grab_owner_events;
-gboolean _gdk_fb_keyboard_grab_owner_events;
-GdkEventMask _gdk_fb_pointer_grab_events, _gdk_fb_keyboard_grab_events;
-
-GdkDisplay *_gdk_display = NULL;
-GdkScreen *_gdk_screen = NULL;
-GdkWindow *_gdk_parent_root = NULL;
-
-GdkFBWindow *gdk_root_window = NULL;
-GdkFBDisplay *gdk_display = NULL;
-GdkCursor *_gdk_fb_pointer_grab_cursor;
-GdkGC *_gdk_fb_screen_gc = NULL;
-GdkAtom _gdk_selection_property;
-GdkFBAngle _gdk_fb_screen_angle = GDK_FB_0_DEGREES;
-volatile gboolean _gdk_fb_is_active_vt = FALSE;
diff --git a/gdk/linux-fb/gdkim-fb.c b/gdk/linux-fb/gdkim-fb.c
deleted file mode 100644
index d6e65373b..000000000
--- a/gdk/linux-fb/gdkim-fb.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "gdki18n.h"
-#include "gdkinternals.h"
-#include "gdkprivate-fb.h"
-
-#if HAVE_CONFIG_H
-# include <config.h>
-# if STDC_HEADERS
-# include <string.h>
-# endif
-#endif
-
-#include <locale.h>
-
-/*
- *--------------------------------------------------------------
- * gdk_set_locale
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gchar*
-gdk_set_locale (void)
-{
- if (!setlocale (LC_ALL,""))
- g_warning ("locale not supported by C library");
-
- return setlocale (LC_ALL, NULL);
-}
-
-/*
- * gdk_wcstombs
- *
- * Returns a multi-byte string converted from the specified array
- * of wide characters. The string is newly allocated. The array of
- * wide characters must be null-terminated. If the conversion is
- * failed, it returns NULL.
- */
-gchar *
-gdk_wcstombs (const GdkWChar *src)
-{
- gchar *mbstr;
-
- gint length = 0;
- gint i;
-
- while (src[length] != 0)
- length++;
-
- mbstr = g_new (gchar, length + 1);
-
- for (i = 0; i < length + 1; i++)
- mbstr[i] = src[i];
-
- return mbstr;
-}
-
-/*
- * gdk_mbstowcs
- *
- * Converts the specified string into wide characters, and, returns the
- * number of wide characters written. The string 'src' must be
- * null-terminated. If the conversion is failed, it returns -1.
- */
-gint
-gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
-{
- gint i;
-
- for (i = 0; i < dest_max && src[i]; i++)
- dest[i] = src[i];
-
- return i;
-}
diff --git a/gdk/linux-fb/gdkimage-fb.c b/gdk/linux-fb/gdkimage-fb.c
deleted file mode 100644
index 265be6231..000000000
--- a/gdk/linux-fb/gdkimage-fb.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <string.h>
-
-#include "gdk.h"
-#include "gdkimage.h"
-#include "gdkprivate.h"
-#include "gdkprivate-fb.h"
-
-static gpointer parent_class = NULL;
-
-#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
-gdk_image_finalize (GObject *object)
-{
- GdkImage *image = GDK_IMAGE (object);
-
- g_free (image->windowing_data);
- image->windowing_data = NULL;
-
- g_free (image->mem);
- image->mem = NULL;
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gdk_image_class_init (GdkImageClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_image_finalize;
-}
-
-GType
-gdk_image_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (GdkImageClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_image_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkImage),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gdk_image_init,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "GdkImage",
- &object_info,
- 0);
- }
-
- return object_type;
-}
-
-
-GdkImage*
-_gdk_image_new_for_depth (GdkScreen *screen,
- GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height,
- gint depth)
-{
- GdkImage *image;
- GdkImagePrivateFB *private;
-
- g_return_val_if_fail (!visual || GDK_IS_VISUAL (visual), NULL);
- g_return_val_if_fail (visual || depth != -1, NULL);
-
- if (visual)
- depth = visual->depth;
-
- image = g_object_new (gdk_image_get_type (), NULL);
- private = GDK_IMAGE_PRIVATE_DATA (image);
-
- image->type = 0;
- image->visual = visual;
- image->width = width;
- image->height = height;
- image->depth = depth;
-
- image->byte_order = 0;
- image->bits_per_pixel = image->depth;
- image->bpp = image->depth/8;
- image->bpl = (width * image->depth + 7) / 8;
- image->mem = g_malloc (image->bpl * height);
-
- return image;
-}
-
-GdkImage *
-gdk_image_new_bitmap(GdkVisual *visual,
- gpointer data,
- gint w,
- gint h)
-{
- GdkImage *image;
- GdkImagePrivateFB *private;
-
- 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;
- image->height = h;
- image->depth = 1;
-
- image->byte_order = 1 /* MSBFirst */;
- image->bits_per_pixel = 1;
- image->bpp = 1;
- image->bpl = (w+7)/8;
- image->mem = g_malloc (image->bpl * h / 8);
- memcpy (image->mem, data, image->bpl * h / 8);
-
- /* This must be freed using free, not g_free, since in the X version
- this is freed by xlib. */
- free (data);
-
- return image;
-}
-
-GdkImage*
-_gdk_fb_copy_to_image (GdkDrawable *drawable,
- GdkImage *image,
- gint src_x,
- gint src_y,
- gint dest_x,
- gint dest_y,
- gint width,
- gint height)
-{
- GdkImagePrivateFB *private;
- GdkPixmapFBData fbd;
- GdkRegion *region = NULL;
- gboolean handle_cursor = FALSE;
-
- g_return_val_if_fail (drawable != NULL, NULL);
-
- if (image == NULL)
- {
- image = g_object_new (gdk_image_get_type (), NULL);
-
- image->type = GDK_IMAGE_NORMAL;
- image->visual = gdk_drawable_get_visual (drawable);
- image->width = width;
- image->height = height;
- image->bits_per_pixel = GDK_DRAWABLE_FBDATA (drawable)->depth;
- image->depth = image->bits_per_pixel;
-
- if (image->bits_per_pixel <= 8)
- image->bpp = 1;
- else if (image->bits_per_pixel <= 16)
- image->bpp = 2;
- else if (image->bits_per_pixel <= 24)
- image->bpp = 3;
- else
- image->bpp = 4;
- image->byte_order = 1;
-
- image->bpl = (image->width * image->depth + 7) / 8; /* Packed pixels */
- image->mem = g_malloc (image->bpl * image->height);
-
- dest_x = 0;
- dest_y = 0;
- }
-
- private = GDK_IMAGE_PRIVATE_DATA (image);
-
- /* Fake its existence as a pixmap */
- memset (&fbd, 0, sizeof(fbd));
- ((GTypeInstance *)&fbd)->g_class = g_type_class_peek (_gdk_pixmap_impl_get_type ());
- fbd.drawable_data.mem = image->mem;
- fbd.drawable_data.rowstride = image->bpl;
- fbd.drawable_data.width = fbd.drawable_data.lim_x = image->width;
- fbd.drawable_data.height = fbd.drawable_data.lim_y = image->height;
- fbd.drawable_data.depth = image->depth;
- fbd.drawable_data.window_type = GDK_DRAWABLE_PIXMAP;
-
- if (GDK_DRAWABLE_FBDATA (drawable)->mem == GDK_DRAWABLE_IMPL_FBDATA (_gdk_parent_root)->mem)
- {
- region = gdk_fb_clip_region (drawable, _gdk_fb_screen_gc, TRUE, FALSE, FALSE);
-
- if (gdk_fb_cursor_region_need_hide (region))
- {
- handle_cursor = TRUE;
- gdk_fb_cursor_hide ();
- }
- }
-
- gdk_fb_draw_drawable_2 ((GdkPixmap *)&fbd,
- _gdk_fb_screen_gc,
- drawable,
- src_x, src_y,
- dest_x, dest_y,
- width, height,
- TRUE, TRUE);
-
- if (region)
- gdk_region_destroy (region);
-
- if (handle_cursor)
- gdk_fb_cursor_unhide ();
-
- return image;
-}
-
-guint32
-gdk_image_get_pixel (GdkImage *image,
- gint x,
- gint y)
-{
- GdkImagePrivateFB *private;
-
- g_return_val_if_fail (image != NULL, 0);
- g_return_val_if_fail (x >= 0 && x < image->width, 0);
- g_return_val_if_fail (y >= 0 && y < image->height, 0);
-
- private = GDK_IMAGE_PRIVATE_DATA (image);
-
- switch (image->depth)
- {
- case 8:
- return ((guchar *)image->mem)[x + y * image->bpl];
- break;
- case 16:
- return *((guint16 *)&((guchar *)image->mem)[x*2 + y*image->bpl]);
- break;
- case 24:
- case 32:
- {
- guchar *smem = &(((guchar *)image->mem)[x*image->bpp + y*image->bpl]);
- return smem[0]|(smem[1]<<8)|(smem[2]<<16);
- }
- break;
- }
-
- return 0;
-}
-
-void
-gdk_image_put_pixel (GdkImage *image,
- gint x,
- gint y,
- guint32 pixel)
-{
- guchar *ptr = image->mem;
-
- g_return_if_fail (image != NULL);
- g_return_if_fail (x >= 0 && x < image->width);
- g_return_if_fail (y >= 0 && y < image->height);
-
- switch (image->depth)
- {
- case 8:
- ptr[x + y * image->bpl] = pixel;
- break;
- case 16:
- {
- guint16 *p16 = (guint16 *)&ptr[x*2 + y*image->bpl];
- *p16 = pixel;
- }
- break;
- case 24:
- {
- guchar *smem = &ptr[x*3 + y*image->bpl];
- smem[0] = (pixel & 0xFF);
- smem[1] = (pixel & 0xFF00) >> 8;
- smem[2] = (pixel & 0xFF0000) >> 16;
- }
- break;
- case 32:
- {
- guint32 *smem = (guint32 *)&ptr[x*4 + y*image->bpl];
- *smem = pixel;
- }
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-void
-_gdk_image_exit(void)
-{
-}
-
-/* copy/pasted from gdkimage-win32.c */
-gint
-_gdk_windowing_get_bits_for_depth (GdkDisplay *display,
- gint depth)
-{
- if ((1 == depth) || (8 == depth) || (16 == depth) ||
- (24 == depth) || (32 == depth))
- return depth;
- else if (15 == depth)
- return 16;
- else
- g_assert_not_reached ();
-
- return 0;
-}
-
diff --git a/gdk/linux-fb/gdkinput-none.c b/gdk/linux-fb/gdkinput-none.c
deleted file mode 100644
index 0512fd708..000000000
--- a/gdk/linux-fb/gdkinput-none.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include "gdkinputprivate.h"
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-static void gdk_input_none_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
-
-void
-_gdk_input_init (void)
-{
- _gdk_init_input_core ();
- gdk_input_vtable.set_mode = NULL;
- gdk_input_vtable.set_axes = NULL;
- gdk_input_vtable.set_key = NULL;
- gdk_input_vtable.motion_events = NULL;
- gdk_input_vtable.get_pointer = gdk_input_none_get_pointer;
- gdk_input_vtable.grab_pointer = NULL;
- gdk_input_vtable.ungrab_pointer = NULL;
- gdk_input_vtable.configure_event = NULL;
- gdk_input_vtable.enter_event = NULL;
- gdk_input_vtable.other_event = NULL;
- gdk_input_vtable.window_none_event = NULL;
- gdk_input_vtable.enable_window = NULL;
- gdk_input_vtable.disable_window = NULL;
-
- _gdk_input_devices = g_list_append (NULL, (GdkDeviceInfo *) &gdk_input_core_info);
-
- _gdk_input_ignore_core = FALSE;
-}
-
-static void
-gdk_input_none_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- gint x_int, y_int;
-
- gdk_window_get_pointer (window, &x_int, &y_int, mask);
-
- if (x) *x = x_int;
- if (y) *y = y_int;
- if (pressure) *pressure = 0.5;
- if (xtilt) *xtilt = 0;
- if (ytilt) *ytilt = 0;
-}
diff --git a/gdk/linux-fb/gdkinput.c b/gdk/linux-fb/gdkinput.c
deleted file mode 100644
index 280630943..000000000
--- a/gdk/linux-fb/gdkinput.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <stdlib.h>
-
-#include "gdkprivate-fb.h"
-#include "gdkinput.h"
-#include "gdkprivate.h"
-#include "gdkinputprivate.h"
-
-static GdkDeviceAxis gdk_input_core_axes[] = {
- { GDK_AXIS_X, 0, 0 },
- { GDK_AXIS_Y, 0, 0 }
-};
-
-GdkDevice *_gdk_core_pointer = NULL;
-
-/* Global variables */
-
-gchar *_gdk_input_gxid_host;
-gint _gdk_input_gxid_port;
-gint _gdk_input_ignore_core;
-GList *_gdk_input_windows;
-GList *_gdk_input_devices;
-
-void
-_gdk_init_input_core (void)
-{
- _gdk_core_pointer = g_object_new (GDK_TYPE_DEVICE, NULL);
-
- _gdk_core_pointer->name = "Core Pointer";
- _gdk_core_pointer->source = GDK_SOURCE_MOUSE;
- _gdk_core_pointer->mode = GDK_MODE_SCREEN;
- _gdk_core_pointer->has_cursor = TRUE;
- _gdk_core_pointer->num_axes = 2;
- _gdk_core_pointer->axes = gdk_input_core_axes;
- _gdk_core_pointer->num_keys = 0;
- _gdk_core_pointer->keys = NULL;
-
- _gdk_display->core_pointer = _gdk_core_pointer;
-}
-
-static void
-gdk_device_finalize (GObject *object)
-{
- g_error ("A GdkDevice object was finalized. This should not happen");
-}
-
-static void
-gdk_device_class_init (GObjectClass *class)
-{
- class->finalize = gdk_device_finalize;
-}
-
-GType
-gdk_device_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (GdkDeviceClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_device_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkDevicePrivate),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "GdkDevice",
- &object_info, 0);
- }
-
- return object_type;
-}
-
-GList *
-gdk_devices_list (void)
-{
- return _gdk_input_devices;
-}
-
-GList *
-gdk_display_list_devices (GdkDisplay *dpy)
-{
- return _gdk_input_devices;
-}
-
-void
-gdk_device_set_source (GdkDevice *device,
- GdkInputSource source)
-{
- device->source = source;
-}
-
-
-void
-gdk_device_set_key (GdkDevice *device,
- guint index,
- guint keyval,
- GdkModifierType modifiers)
-{
- g_return_if_fail (device != NULL);
- g_return_if_fail (index < device->num_keys);
-
- device->keys[index].keyval = keyval;
- device->keys[index].modifiers = modifiers;
-}
-
-void
-gdk_device_set_axis_use (GdkDevice *device,
- guint index,
- GdkAxisUse use)
-{
- g_return_if_fail (device != NULL);
- g_return_if_fail (index < device->num_axes);
-
- device->axes[index].use = use;
-
- switch (use)
- {
- case GDK_AXIS_X:
- case GDK_AXIS_Y:
- device->axes[index].min = 0.;
- device->axes[index].max = 0.;
- break;
- case GDK_AXIS_XTILT:
- case GDK_AXIS_YTILT:
- device->axes[index].min = -1.;
- device->axes[index].max = 1;
- break;
- default:
- device->axes[index].min = 0.;
- device->axes[index].max = 1;
- break;
- }
-}
-
-void
-gdk_device_get_state (GdkDevice *device,
- GdkWindow *window,
- gdouble *axes,
- GdkModifierType *mask)
-{
- gint x_int, y_int;
-
- g_assert (device == _gdk_core_pointer);
-
- gdk_window_get_pointer (window, &x_int, &y_int, mask);
-
- if (axes)
- {
- axes[0] = x_int;
- axes[1] = y_int;
- }
-}
-
-void
-gdk_device_free_history (GdkTimeCoord **events,
- gint n_events)
-{
- gint i;
-
- for (i = 0; i < n_events; i++)
- g_free (events[i]);
-
- g_free (events);
-}
-
-gboolean
-gdk_device_get_history (GdkDevice *device,
- GdkWindow *window,
- guint32 start,
- guint32 stop,
- GdkTimeCoord ***events,
- gint *n_events)
-{
- g_return_val_if_fail (window != NULL, FALSE);
- g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
- g_return_val_if_fail (events != NULL, FALSE);
- g_return_val_if_fail (n_events != NULL, FALSE);
-
- *n_events = 0;
- *events = NULL;
- return FALSE;
-}
-
-gboolean
-gdk_device_set_mode (GdkDevice *device,
- GdkInputMode mode)
-{
- return FALSE;
-}
-
-gint
-_gdk_input_enable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- return TRUE;
-}
-
-gint
-_gdk_input_disable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- return TRUE;
-}
-
-
-GdkInputWindow *
-_gdk_input_window_find(GdkWindow *window)
-{
- GList *tmp_list;
-
- for (tmp_list=_gdk_input_windows; tmp_list; tmp_list=tmp_list->next)
- if (((GdkInputWindow *)(tmp_list->data))->window == window)
- return (GdkInputWindow *)(tmp_list->data);
-
- return NULL; /* Not found */
-}
-
-/* FIXME: this routine currently needs to be called between creation
- and the corresponding configure event (because it doesn't get the
- root_relative_geometry). This should work with
- gtk_window_set_extension_events, but will likely fail in other
- cases */
-
-void
-gdk_input_set_extension_events (GdkWindow *window, gint mask,
- GdkExtensionMode mode)
-{
- GdkWindowObject *window_private;
- GList *tmp_list;
- GdkInputWindow *iw;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- window_private = (GdkWindowObject*) window;
-
- if (mode == GDK_EXTENSION_EVENTS_NONE)
- mask = 0;
-
- if (mask != 0)
- {
- iw = g_new(GdkInputWindow,1);
-
- iw->window = window;
- iw->mode = mode;
-
- iw->obscuring = NULL;
- iw->num_obscuring = 0;
- iw->grabbed = FALSE;
-
- _gdk_input_windows = g_list_append (_gdk_input_windows,iw);
- window_private->extension_events = mask;
-
- /* Add enter window events to the event mask */
- /* FIXME, this is not needed for XINPUT_NONE */
- gdk_window_set_events (window,
- gdk_window_get_events (window) |
- GDK_ENTER_NOTIFY_MASK);
- }
- else
- {
- iw = _gdk_input_window_find (window);
- if (iw)
- {
- _gdk_input_windows = g_list_remove (_gdk_input_windows,iw);
- g_free (iw);
- }
-
- window_private->extension_events = 0;
- }
-
- for (tmp_list = _gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)(tmp_list->data);
-
- if (gdkdev != (GdkDevicePrivate *)_gdk_core_pointer)
- {
- if (mask != 0 && gdkdev->info.mode != GDK_MODE_DISABLED
- && (gdkdev->info.has_cursor || mode == GDK_EXTENSION_EVENTS_ALL))
- _gdk_input_enable_window (window,gdkdev);
- else
- _gdk_input_disable_window (window,gdkdev);
- }
- }
-}
-
-void
-_gdk_input_window_destroy (GdkWindow *window)
-{
- GdkInputWindow *input_window;
-
- input_window = _gdk_input_window_find (window);
- g_return_if_fail (input_window != NULL);
-
- _gdk_input_windows = g_list_remove (_gdk_input_windows,input_window);
- g_free (input_window);
-}
-
-void
-_gdk_input_init (void)
-{
- _gdk_init_input_core ();
- _gdk_input_devices = g_list_append (NULL, _gdk_core_pointer);
- _gdk_input_ignore_core = FALSE;
-}
-
-void
-_gdk_input_exit (void)
-{
- GList *tmp_list;
- GdkDevicePrivate *gdkdev;
-
- for (tmp_list = _gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- gdkdev = (GdkDevicePrivate *)(tmp_list->data);
- if (gdkdev != (GdkDevicePrivate *)_gdk_core_pointer)
- {
- 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_list_free (_gdk_input_devices);
-
- for (tmp_list = _gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- g_free (tmp_list->data);
- }
- g_list_free (_gdk_input_windows);
-}
-
-gboolean
-gdk_device_get_axis (GdkDevice *device, gdouble *axes, GdkAxisUse use, gdouble *value)
-{
- gint i;
-
- g_return_val_if_fail (device != NULL, FALSE);
-
- if (axes == NULL)
- return FALSE;
-
- for (i = 0; i < device->num_axes; i++)
- if (device->axes[i].use == use)
- {
- if (value)
- *value = axes[i];
- return TRUE;
- }
-
- return FALSE;
-}
diff --git a/gdk/linux-fb/gdkinputprivate.h b/gdk/linux-fb/gdkinputprivate.h
deleted file mode 100644
index fab65da1f..000000000
--- a/gdk/linux-fb/gdkinputprivate.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GDK_INPUTPRIVATE_H__
-#define __GDK_INPUTPRIVATE_H__
-
-#include "config.h"
-#include "gdkinput.h"
-#include "gdkevents.h"
-#include "gdkfb.h"
-
-typedef struct _GdkAxisInfo GdkAxisInfo;
-typedef struct _GdkInputVTable GdkInputVTable;
-typedef struct _GdkDevicePrivate GdkDevicePrivate;
-typedef struct _GdkInputWindow GdkInputWindow;
-
-struct _GdkInputVTable {
- gint (*set_mode) (guint32 deviceid, GdkInputMode mode);
- void (*set_axes) (guint32 deviceid, GdkAxisUse *axes);
- void (*set_key) (guint32 deviceid,
- guint index,
- guint keyval,
- GdkModifierType modifiers);
-
- GdkTimeCoord* (*motion_events) (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return);
- void (*get_pointer) (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
- gint (*grab_pointer) (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time);
- void (*ungrab_pointer) (guint32 time);
-
- void (*configure_event) (GdkEventConfigure *event, GdkWindow *window);
- void (*enter_event) (GdkEventCrossing *event, GdkWindow *window);
- gint (*other_event) (GdkEvent *event, GdkWindow *window);
- /* Handle an unidentified event. Returns TRUE if handled, FALSE
- otherwise */
- gint (*window_none_event) (GdkEvent *event);
- gint (*enable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev);
- gint (*disable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev);
-};
-
-/* information about a device axis */
-struct _GdkAxisInfo
-{
- /* reported x resolution */
- gint xresolution;
-
- /* reported x minimum/maximum values */
- gint xmin_value, xmax_value;
-
- /* calibrated resolution (for aspect ration) - only relative values
- between axes used */
- gint resolution;
-
- /* calibrated minimum/maximum values */
- gint min_value, max_value;
-};
-
-#define GDK_INPUT_NUM_EVENTC 6
-
-struct _GdkDevicePrivate {
- GdkDevice info;
-};
-
-struct _GdkDeviceClass
-{
- GObjectClass parent_class;
-};
-
-struct _GdkInputWindow
-{
- /* gdk window */
- GdkWindow *window;
-
- /* Extension mode (GDK_EXTENSION_EVENTS_ALL/CURSOR) */
- GdkExtensionMode mode;
-
- /* position relative to root window */
- gint root_x;
- gint root_y;
-
- /* rectangles relative to window of windows obscuring this one */
- GdkRectangle *obscuring;
- gint num_obscuring;
-
- /* Is there a pointer grab for this window ? */
- gint grabbed;
-};
-
-/* Global data */
-
-extern const GdkDevice gdk_input_core_info;
-extern GdkDevice *_gdk_core_pointer;
-extern GList *_gdk_input_devices;
-extern GList *_gdk_input_windows;
-
-extern GdkInputVTable gdk_input_vtable;
-/* information about network port and host for gxid daemon */
-extern gchar *_gdk_input_gxid_host;
-extern gint _gdk_input_gxid_port;
-extern gint _gdk_input_ignore_core;
-
-/* Function declarations */
-
-GdkInputWindow * _gdk_input_window_find (GdkWindow *window);
-void _gdk_input_window_destroy (GdkWindow *window);
-void _gdk_input_init (void);
-void _gdk_input_exit (void);
-gint _gdk_input_enable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-gint _gdk_input_disable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-void _gdk_init_input_core (void);
-
-void _gdk_input_exit (void);
-
-#endif /* __GDK_INPUTPRIVATE_H__ */
diff --git a/gdk/linux-fb/gdkkeyboard-fb.c b/gdk/linux-fb/gdkkeyboard-fb.c
deleted file mode 100644
index f06794064..000000000
--- a/gdk/linux-fb/gdkkeyboard-fb.c
+++ /dev/null
@@ -1,1603 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkinternals.h>
-#include "gdkkeysyms.h"
-#include "gdkprivate-fb.h"
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <sys/kd.h>
-#include <sys/vt.h>
-
-typedef struct _GdkFBKeyboard GdkFBKeyboard;
-typedef struct _GdkFBKeyboardDevice GdkFBKeyboardDevice;
-
-struct _GdkFBKeyboard {
- gint fd;
- GIOChannel *io;
- gint io_tag;
-
- guint modifier_state;
- guint caps_lock : 1;
-
- gint group;
- gint level;
-
- GdkFBKeyboardDevice *dev;
-};
-
-struct _GdkFBKeyboardDevice {
- char *name;
- gboolean (*open)(GdkFBKeyboard *kb);
- void (*close)(GdkFBKeyboard *kb);
-
- guint (*lookup_key) (GdkFBKeyboard *kb,
- const GdkKeymapKey *key);
- gboolean (*translate_keyboard_state) (GdkFBKeyboard *kb,
- guint hardware_keycode,
- GdkModifierType state,
- gint group,
- guint *keyval,
- gint *effective_group,
- gint *level,
- GdkModifierType *consumed_modifiers);
- gboolean (*get_entries_for_keyval) (GdkFBKeyboard *kb,
- guint keyval,
- GdkKeymapKey **keys,
- gint *n_keys);
- gboolean (*get_entries_for_keycode) (GdkFBKeyboard *kb,
- guint hardware_keycode,
- GdkKeymapKey **keys,
- guint **keyvals,
- gint *n_entries);
-
- gpointer driver_data;
-};
-
-static GdkFBKeyboard *gdk_fb_keyboard = NULL;
-static GdkKeymap *default_keymap = NULL;
-
-static gboolean xlate_open (GdkFBKeyboard *kb);
-static void xlate_close (GdkFBKeyboard *kb);
-static guint xlate_lookup (GdkFBKeyboard *kb,
- const GdkKeymapKey *key);
-static gboolean xlate_translate (GdkFBKeyboard *kb,
- guint hardware_keycode,
- GdkModifierType state,
- gint group,
- guint *keyval,
- gint *effective_group,
- gint *level,
- GdkModifierType *consumed_modifiers);
-static gboolean xlate_get_for_keyval (GdkFBKeyboard *kb,
- guint keyval,
- GdkKeymapKey **keys,
- gint *n_keys);
-static gboolean xlate_get_for_keycode (GdkFBKeyboard *kb,
- guint hardware_keycode,
- GdkKeymapKey **keys,
- guint **keyvals,
- gint *n_entries);
-
-static gboolean raw_open (GdkFBKeyboard *kb);
-static void raw_close (GdkFBKeyboard *kb);
-static guint raw_lookup (GdkFBKeyboard *kb,
- const GdkKeymapKey *key);
-static gboolean raw_translate (GdkFBKeyboard *kb,
- guint hardware_keycode,
- GdkModifierType state,
- gint group,
- guint *keyval,
- gint *effective_group,
- gint *level,
- GdkModifierType *consumed_modifiers);
-static gboolean raw_get_for_keyval (GdkFBKeyboard *kb,
- guint keyval,
- GdkKeymapKey **keys,
- gint *n_keys);
-static gboolean raw_get_for_keycode (GdkFBKeyboard *kb,
- guint hardware_keycode,
- GdkKeymapKey **keys,
- guint **keyvals,
- gint *n_entries);
-
-
-static GdkFBKeyboardDevice keyb_devs[] =
-{
- {
- "xlate",
- xlate_open,
- xlate_close,
- xlate_lookup,
- xlate_translate,
- xlate_get_for_keyval,
- xlate_get_for_keycode
- },
- {
- "raw",
- raw_open,
- raw_close,
- raw_lookup,
- raw_translate,
- raw_get_for_keyval,
- raw_get_for_keycode
- },
-};
-
-GdkKeymap*
-gdk_keymap_get_default_for_display (GdkDisplay *display)
-{
- if (default_keymap == NULL)
- default_keymap = g_object_new (gdk_keymap_get_type (), NULL);
-
- return default_keymap;
-}
-
-GdkKeymap*
-gdk_keymap_get_for_display (GdkDisplay *display)
-{
- return gdk_keymap_get_default_for_display (display);
-}
-
-PangoDirection
-gdk_keymap_get_direction (GdkKeymap *keymap)
-{
- /* FIXME: Only supports LTR keymaps at the moment */
- return PANGO_DIRECTION_LTR;
-}
-
-guint
-gdk_fb_keyboard_modifiers (void)
-{
- return gdk_fb_keyboard->modifier_state;
-}
-
-gboolean
-gdk_fb_keyboard_init (gboolean open_dev)
-{
- GdkFBKeyboard *keyb;
- char *keyb_type;
- int i;
-
- gdk_fb_keyboard = g_new0 (GdkFBKeyboard, 1);
- keyb = gdk_fb_keyboard;
- keyb->fd = -1;
-
- keyb_type = getenv ("GDK_KEYBOARD_TYPE");
-
- if (!keyb_type)
- keyb_type = "xlate";
-
- for (i = 0; i < G_N_ELEMENTS(keyb_devs); i++)
- {
- if (g_ascii_strcasecmp(keyb_type, keyb_devs[i].name)==0)
- break;
- }
-
- if (i == G_N_ELEMENTS(keyb_devs))
- {
- g_warning ("No keyboard driver of type %s found", keyb_type);
- return FALSE;
- }
-
- keyb->dev = &keyb_devs[i];
-
- if (open_dev)
- return gdk_fb_keyboard_open ();
- else
- return TRUE;
-}
-
-gboolean
-gdk_fb_keyboard_open (void)
-{
- GdkFBKeyboard *keyb;
- GdkFBKeyboardDevice *device;
-
- keyb = gdk_fb_keyboard;
- device = keyb->dev;
-
- if (!device->open(keyb))
- {
- g_warning ("Keyboard driver open failed");
- return FALSE;
- }
-
- return TRUE;
-}
-
-void
-gdk_fb_keyboard_close (void)
-{
- gdk_fb_keyboard->dev->close(gdk_fb_keyboard);
-}
-
-
-gboolean
-gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
- guint keyval,
- GdkKeymapKey **keys,
- gint *n_keys)
-{
- g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
- g_return_val_if_fail (keys != NULL, FALSE);
- g_return_val_if_fail (n_keys != NULL, FALSE);
- g_return_val_if_fail (keyval != 0, FALSE);
-
- return gdk_fb_keyboard->dev->get_entries_for_keyval (gdk_fb_keyboard,
- keyval,
- keys,
- n_keys);
-}
-
-gboolean
-gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
- guint hardware_keycode,
- GdkKeymapKey **keys,
- guint **keyvals,
- gint *n_entries)
-{
- g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
- g_return_val_if_fail (n_entries != NULL, FALSE);
-
- return gdk_fb_keyboard->dev->get_entries_for_keycode (gdk_fb_keyboard,
- hardware_keycode,
- keys,
- keyvals,
- n_entries);
-}
-
-
-guint
-gdk_keymap_lookup_key (GdkKeymap *keymap,
- const GdkKeymapKey *key)
-{
- g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), 0);
- g_return_val_if_fail (key != NULL, 0);
- g_return_val_if_fail (key->group < 4, 0);
-
- return gdk_fb_keyboard->dev->lookup_key (gdk_fb_keyboard, key);
-}
-
-
-gboolean
-gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
- guint hardware_keycode,
- GdkModifierType state,
- gint group,
- guint *keyval,
- gint *effective_group,
- gint *level,
- GdkModifierType *consumed_modifiers)
-{
- g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
- g_return_val_if_fail (group < 4, FALSE);
-
- return gdk_fb_keyboard->dev->translate_keyboard_state (gdk_fb_keyboard,
- hardware_keycode,
- state,
- group,
- keyval,
- effective_group,
- level,
- consumed_modifiers);
-}
-
-static void
-gdk_fb_handle_key (guint hw_keycode,
- guint keyval,
- guint modifier_state,
- guint8 group,
- gchar *string,
- gint string_length,
- gboolean key_up)
-{
- GdkWindow *win;
- GdkEvent *event;
-
- /* handle some magic keys */
- if (key_up &&
- (modifier_state & GDK_CONTROL_MASK) &&
- (modifier_state & GDK_MOD1_MASK))
- {
- if (keyval == GDK_BackSpace)
- {
- ioctl (gdk_display->tty_fd, KDSKBMODE, K_XLATE);
- exit (1);
- }
-
- if (keyval == GDK_Return)
- gdk_fb_redraw_all ();
- }
-
- win = gdk_fb_keyboard_event_window (gdk_fb_window_find_focus (),
- key_up ? GDK_KEY_RELEASE : GDK_KEY_PRESS);
- if (win)
- {
- event = gdk_event_make (win,
- key_up ? GDK_KEY_RELEASE : GDK_KEY_PRESS,
- TRUE);
-
- event->key.state = modifier_state;
- event->key.keyval = keyval;
- event->key.string = string;
- event->key.length = string_length;
- event->key.hardware_keycode = hw_keycode;
- event->key.group = group;
- }
- else
- g_free (string);
-}
-
-/******************************************************
- ********* Device specific keyboard code **************
- ******************************************************/
-
-
-/* XLATE keyboard driver */
-
-struct {
- char *str;
- guint code;
- guint modifier;
-} xlate_codes[] =
-{
- {"\x5b\x41", GDK_F1},
- {"\x5b\x42", GDK_F2},
- {"\x5b\x43", GDK_F3},
- {"\x5b\x44", GDK_F4},
- {"\x5b\x45", GDK_F5},
- {"\x31\x37\x7e", GDK_F6},
- {"\x31\x38\x7e", GDK_F7},
- {"\x31\x39\x7e", GDK_F8},
- {"\x32\x30\x7e", GDK_F9},
- {"\x32\x31\x7e", GDK_F10},
- {"\x32\x33\x7e", GDK_F11},
- {"\x32\x34\x7e", GDK_F12},
-
- {"\x32\x35\x7e", GDK_F1, GDK_SHIFT_MASK},
- {"\x32\x36\x7e", GDK_F2, GDK_SHIFT_MASK},
- {"\x32\x38\x7e", GDK_F3, GDK_SHIFT_MASK},
- {"\x32\x39\x7e", GDK_F4, GDK_SHIFT_MASK},
- {"\x33\x31\x7e", GDK_F5, GDK_SHIFT_MASK},
- {"\x33\x32\x7e", GDK_F6, GDK_SHIFT_MASK},
- {"\x33\x33\x7e", GDK_F7, GDK_SHIFT_MASK},
- {"\x33\x34\x7e", GDK_F8, GDK_SHIFT_MASK},
-
- {"\x31\x7e", GDK_Home},
- {"\x35\x7e", GDK_Page_Up},
- {"\x34\x7e", GDK_End},
- {"\x36\x7e", GDK_Page_Down},
- {"\x32\x7e", GDK_Insert},
- {"\x33\x7e", GDK_Delete},
-
- {"\x41", GDK_Up},
- {"\x44", GDK_Left},
- {"\x42", GDK_Down},
- {"\x43", GDK_Right},
- {"\x50", GDK_Break},
-};
-
-struct {
- guint code;
- guint modifier;
-} xlate_chars[] =
-{
- /* 0x00 */
- {'@', GDK_CONTROL_MASK},
- {'a', GDK_CONTROL_MASK},
- {'b', GDK_CONTROL_MASK},
- {'c', GDK_CONTROL_MASK},
- {'d', GDK_CONTROL_MASK},
- {'e', GDK_CONTROL_MASK},
- {'f', GDK_CONTROL_MASK},
- {'g', GDK_CONTROL_MASK},
- {'h', GDK_CONTROL_MASK},
- {GDK_Tab, 0},
- {'j', GDK_CONTROL_MASK},
- {'k', GDK_CONTROL_MASK},
- {'l', GDK_CONTROL_MASK},
- {GDK_Return, 0},
- {'n', GDK_CONTROL_MASK},
- {'o', GDK_CONTROL_MASK},
- /* 0x10 */
- {'p', GDK_CONTROL_MASK},
- {'q', GDK_CONTROL_MASK},
- {'r', GDK_CONTROL_MASK},
- {'s', GDK_CONTROL_MASK},
- {'t', GDK_CONTROL_MASK},
- {'u', GDK_CONTROL_MASK},
- {'v', GDK_CONTROL_MASK},
- {'w', GDK_CONTROL_MASK},
- {'x', GDK_CONTROL_MASK},
- {'y', GDK_CONTROL_MASK},
- {'z', GDK_CONTROL_MASK},
- {GDK_Escape, 0},
- {'\\', GDK_CONTROL_MASK},
- {']', GDK_CONTROL_MASK},
- {'^', GDK_CONTROL_MASK},
- {'_', GDK_CONTROL_MASK},
- /* 0x20 */
- {GDK_space, 0},
- {'!', 0},
- {'"', 0},
- {'#', 0},
- {'$', 0},
- {'%', 0},
- {'&', 0},
- {'\'', 0},
- {'(', 0},
- {')', 0},
- {'*', 0},
- {'+', 0},
- {',', 0},
- {'-', 0},
- {'.', 0},
- {'/', 0},
- /* 0x30 */
- {'0', 0},
- {'1', 0},
- {'2', 0},
- {'3', 0},
- {'4', 0},
- {'5', 0},
- {'6', 0},
- {'7', 0},
- {'8', 0},
- {'9', 0},
- {':', 0},
- {';', 0},
- {'<', 0},
- {'=', 0},
- {'>', 0},
- {'?', 0},
- /* 0x40 */
- {'@', 0},
- {'A', 0},
- {'B', 0},
- {'C', 0},
- {'D', 0},
- {'E', 0},
- {'F', 0},
- {'G', 0},
- {'H', 0},
- {'I', 0},
- {'J', 0},
- {'K', 0},
- {'L', 0},
- {'M', 0},
- {'N', 0},
- {'O', 0},
- /* 0x50 */
- {'P', 0},
- {'Q', 0},
- {'R', 0},
- {'S', 0},
- {'T', 0},
- {'U', 0},
- {'V', 0},
- {'W', 0},
- {'X', 0},
- {'Y', 0},
- {'Z', 0},
- {'[', 0},
- {'\\', 0},
- {']', 0},
- {'^', 0},
- {'_', 0},
- /* 0x60 */
- {'`', 0},
- {'a', 0},
- {'b', 0},
- {'c', 0},
- {'d', 0},
- {'e', 0},
- {'f', 0},
- {'g', 0},
- {'h', 0},
- {'i', 0},
- {'j', 0},
- {'k', 0},
- {'l', 0},
- {'m', 0},
- {'n', 0},
- {'o', 0},
- /* 0x70 */
- {'p', 0},
- {'q', 0},
- {'r', 0},
- {'s', 0},
- {'t', 0},
- {'u', 0},
- {'v', 0},
- {'w', 0},
- {'x', 0},
- {'y', 0},
- {'z', 0},
- {'{', 0},
- {'|', 0},
- {'}', 0},
- {'~', 0},
- {GDK_BackSpace, 0},
- /* 0x80 */
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- /* 0x90 */
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- /* 0xA0 */
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- /* 0xB0 */
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- /* 0xC0 */
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- /* 0xD0 */
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- /* 0xE0 */
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- /* 0xF0 */
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
- {0, 0},
-};
-
-static gboolean
-iscode (char *code, char *str, int str_max)
-{
- int i;
-
- for (i = 0; code[i] && (i < str_max); i++)
- {
- if (code[i] != str[i])
- return FALSE;
- }
- return (code[i] == 0);
-}
-
-static gboolean
-xlate_io (GIOChannel *gioc,
- GIOCondition cond,
- gpointer data)
-{
- GdkFBKeyboard *keyb = (GdkFBKeyboard *)data;
- guchar buf[128];
- guint keycode;
- guint modifier;
- gboolean handled;
- int i, n, j;
- int left;
-
- n = read (keyb->fd, buf, sizeof(buf));
- if (n <= 0)
- g_error ("Nothing from keyboard!");
-
- for (i = 0; i < n; )
- {
- handled = FALSE;
- modifier = 0;
- if ((buf[i] == 27) && (i+1 != n)) /* Escape */
- {
- /* Esc is not the last char in buffer, interpret as code sequence */
- if (buf[i+1] == '[')
- {
- i += 2;
- left = n-i;
- if (left <= 0)
- return TRUE;
-
- for (j=0;j<G_N_ELEMENTS (xlate_codes);j++)
- {
- if (iscode (xlate_codes[j].str, &buf[i], left))
- {
- /* Ctrl-Alt Return can't be pressed in the XLATE driver,
- * use Shift F1 instead */
- if ((xlate_codes[j].code == GDK_F1) &&
- (xlate_codes[j].modifier & GDK_SHIFT_MASK))
- gdk_fb_redraw_all ();
-
- if ((xlate_codes[j].code == GDK_F2) &&
- (xlate_codes[j].modifier & GDK_SHIFT_MASK))
- {
- static gint deg = 0;
- deg = (deg + 1) % 4;
-
- gdk_fb_set_rotation (deg);
- }
-
- if ((xlate_codes[j].code == GDK_F8) &&
- (xlate_codes[j].modifier & GDK_SHIFT_MASK))
- exit (1);
-
-
- gdk_fb_handle_key (xlate_codes[j].code,
- xlate_codes[j].code,
- xlate_codes[j].modifier,
- 0,
- NULL,
- 0,
- FALSE);
- gdk_fb_handle_key (xlate_codes[j].code,
- xlate_codes[j].code,
- xlate_codes[j].modifier,
- 0,
- NULL,
- 0,
- TRUE);
- i += strlen (xlate_codes[j].str);
- handled = TRUE;
- break;
- }
- }
- }
- else
- {
- /* Alt-key */
- modifier |= GDK_MOD1_MASK;
- i++;
- }
- }
- if (!handled)
- {
- char dummy[2];
- gint len;
-
- keycode = xlate_chars[buf[i]].code;
- if (keycode == 0)
- keycode = buf[i];
- modifier |= xlate_chars[buf[i]].modifier;
-
- dummy[0] = keycode;
- dummy[1] = 0;
-
- len = ((keycode < 255) && isprint (keycode)) ? 1 : 0;
- gdk_fb_handle_key (keycode,
- keycode,
- modifier,
- 0,
- (len)?g_strdup(dummy) : NULL,
- len,
- FALSE);
- gdk_fb_handle_key (keycode,
- keycode,
- modifier,
- 0,
- (len)?g_strdup(dummy) : NULL,
- len,
- TRUE);
- i++;
- }
- }
- return TRUE;
-}
-
-static gboolean
-write_string (gint fd,
- const gchar *str)
-{
- gsize to_write = strlen (str);
-
- while (to_write > 0)
- {
- gssize count = write (fd, str, to_write);
- if (count < 0)
- {
- if (errno != EINTR)
- return FALSE;
- }
- else
- {
- to_write -= count;
- str += count;
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-xlate_open (GdkFBKeyboard *kb)
-{
- const char cursoroff_str[] = "\033[?1;0;0c";
- struct termios ts;
-
- tcgetattr (gdk_display->tty_fd, &ts);
- ts.c_cc[VTIME] = 0;
- ts.c_cc[VMIN] = 1;
- ts.c_lflag &= ~(ICANON|ECHO|ISIG);
- ts.c_iflag = 0;
- tcsetattr (gdk_display->tty_fd, TCSAFLUSH, &ts);
-
- tcsetpgrp (gdk_display->tty_fd, getpgrp());
-
- write_string (gdk_display->tty_fd, cursoroff_str);
-
- ioctl (gdk_display->tty_fd, KDSKBMODE, K_XLATE);
-
- kb->fd = gdk_display->tty_fd;
- kb->io = g_io_channel_unix_new (kb->fd);
- kb->io_tag = g_io_add_watch (kb->io,
- G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
- xlate_io,
- kb);
-
- return TRUE;
-}
-
-static void
-xlate_close (GdkFBKeyboard *kb)
-{
- struct termios ts;
- const char cursoron_str[] = "\033c\033[3g\033]R";
-
- write_string (gdk_display->tty_fd, cursoron_str);
-
- tcgetattr (gdk_display->tty_fd, &ts);
- ts.c_lflag |= (ICANON|ECHO|ISIG);
- tcsetattr (gdk_display->tty_fd, TCSAFLUSH, &ts);
-
- g_source_remove (kb->io_tag);
- g_io_channel_unref (kb->io);
- kb->fd = -1;
- /* don't close kb->fd, it is the tty from gdk_display */
-}
-
-static guint
-xlate_lookup (GdkFBKeyboard *kb,
- const GdkKeymapKey *key)
-{
- if (key->group != 0)
- return 0;
- if (key->level != 0)
- return 0;
- return key->keycode;
-}
-
-static gboolean
-xlate_translate (GdkFBKeyboard *kb,
- guint hardware_keycode,
- GdkModifierType state,
- gint group,
- guint *keyval,
- gint *effective_group,
- gint *level,
- GdkModifierType *consumed_modifiers)
-{
- if (keyval)
- *keyval = hardware_keycode;
- if (effective_group)
- *effective_group = 0;
- if (level)
- *level = 0;
- if (consumed_modifiers)
- *consumed_modifiers = 0;
- return TRUE;
-}
-
-static gboolean
-xlate_get_for_keyval (GdkFBKeyboard *kb,
- guint keyval,
- GdkKeymapKey **keys,
- gint *n_keys)
-{
- *n_keys = 1;
- *keys = g_new (GdkKeymapKey, 1);
- (*keys)->keycode = keyval;
- (*keys)->group = 0;
- (*keys)->level = 0;
- return TRUE;
-}
-
-static gboolean
-xlate_get_for_keycode (GdkFBKeyboard *kb,
- guint hardware_keycode,
- GdkKeymapKey **keys,
- guint **keyvals,
- gint *n_entries)
-{
- if (keys)
- {
- *keys = g_new (GdkKeymapKey, 1);
- (*keys)->keycode = hardware_keycode;
- (*keys)->level = 0;
- (*keys)->group = 0;
- }
- if (keyvals)
- {
- *keyvals = g_new (guint, 1);
- **keyvals = hardware_keycode;
- }
- if (n_entries)
- *n_entries = 1;
-
- return TRUE;
-}
-
-/* Raw keyboard support */
-
-static const guint trans_table[256][3] = {
- /* 0x00 */
- {0, 0, 0},
- {GDK_Escape, 0, 0},
- {'1', '!', 0},
- {'2', '@', 0},
- {'3', '#', 0},
- {'4', '$', 0},
- {'5', '%', 0},
- {'6', '^', 0},
- {'7', '&', 0},
- {'8', '*', 0},
- {'9', '(', 0},
- {'0', ')', 0},
- {'-', '_', 0},
- {'=', '+', 0},
- {GDK_BackSpace, 0, 0},
- {GDK_Tab, 0, 0},
-
- /* 0x10 */
- {'q', 'Q', 0},
- {'w', 'W', 0},
- {'e', 'E', 0},
- {'r', 'R', 0},
- {'t', 'T', 0},
- {'y', 'Y', 0},
- {'u', 'U', 0},
- {'i', 'I', 0},
- {'o', 'O', 0},
- {'p', 'P', 0},
- {'[', '{', 0},
- {']', '}', 0},
- {GDK_Return, 0, 0},
- {GDK_Control_L, 0, 0}, /* mod */
- {'a', 'A', 0},
- {'s', 'S', 0},
-
- /* 0x20 */
- {'d', 'D', 0},
- {'f', 'F', 0},
- {'g', 'G', 0},
- {'h', 'H', 0},
- {'j', 'J', 0},
- {'k', 'K', 0},
- {'l', 'L', 0},
- {';', ':', 0},
- {'\'', '"', 0},
- {'`', '~', 0},
- {GDK_Shift_L, 0, 0}, /* mod */
- {'\\', 0, 0},
- {'z', 0, 0},
- {'x', 0, 0},
- {'c', 0, 0},
-
- {'v', 'V', 0},
-
- /* 0x30 */
- {'b', 'B', 0},
- {'n', 'N', 0},
- {'m', 'M', 0},
- {',', 0, 0},
- {'.', 0, 0},
- {'/', 0, 0},
- {GDK_Shift_R, 0, 0}, /* mod */
- {GDK_KP_Multiply, 0, 0},
- {0, 0, 0},
- {GDK_space, 0, 0},
- {0, 0, 0},
- {GDK_F1, 0, 0},
- {GDK_F2, 0, 0},
- {GDK_F3, 0, 0},
- {GDK_F4, 0, 0},
- {GDK_F5, 0, 0},
-
- /* 0x40 */
- {GDK_F6, 0, 0},
- {GDK_F7, 0, 0},
- {GDK_F8, 0, 0},
- {GDK_F9, 0, 0},
- {GDK_F10, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {'7', 0, 0},
- {'8', 0, 0},
- {'9', 0, 0},
- {'-', 0, 0},
- {'4', 0, 0},
- {'5', 0, 0},
- {'6', 0, 0},
- {'+', 0, 0},
- {'1', 0, 0},
-
- /* 0x50 */
- {'2', 0, 0},
- {'3', 0, 0},
- {'0', 0, 0},
- {'.', 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {GDK_F11, 0, 0},
- {GDK_F12, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
-
- /* 0x60 */
- {GDK_Return, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {GDK_Home, 0, 0},
- {GDK_Up, 0, 0},
- {GDK_Page_Up, 0, 0},
- {GDK_Left, 0, 0},
- {GDK_Right, 0, 0},
- {GDK_End, 0, 0},
- {GDK_Down, 0, 0},
- {GDK_Page_Down, 0, 0},
- {GDK_Insert, 0, 0},
- {GDK_Delete, 0, 0},
-
- /* 0x70 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
-
- /* 0x80 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
-
- /* 0x90 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
-
- /* 0xA0 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
-
- /* 0xB0 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
-
- /* 0xC0 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {GDK_Up, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {GDK_Left, 0, 0},
- {0, 0, 0},
- {GDK_Right, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
-
- /* 0xD0 */
- {GDK_Down, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
-
- /* 0xE0 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
-
- /* 0xF0 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
-};
-
-static gboolean
-raw_io (GIOChannel *gioc,
- GIOCondition cond,
- gpointer data)
-{
- GdkFBKeyboard *k = data;
- guchar buf[128];
- int i, n;
-
- n = read (k->fd, buf, sizeof(buf));
- if (n <= 0)
- g_error("Nothing from keyboard!");
-
- for (i = 0; i < n; i++)
- {
- guchar keycode;
- gboolean key_up;
- char dummy[2];
- int len;
- int mod;
- guint keyval;
-
- keycode = buf[i] & 0x7F;
- key_up = buf[i] & 0x80;
-
- if (keycode > G_N_ELEMENTS (trans_table))
- {
- g_warning ("Unknown keycode");
- continue;
- }
-
- if ( (keycode == 0x1D) /* left Ctrl */
- || (keycode == 0x9D) /* right Ctrl */
- || (keycode == 0x38) /* left Alt */
- || (keycode == 0xB8) /* right Alt */
- || (keycode == 0x2A) /* left Shift */
- || (keycode == 0x36) /* right Shift */)
- {
- switch (keycode)
- {
- case 0x1D: /* Left Ctrl */
- case 0x9D: /* Right Ctrl */
- if (key_up)
- k->modifier_state &= ~GDK_CONTROL_MASK;
- else
- k->modifier_state |= GDK_CONTROL_MASK;
- break;
- case 0x38: /* Left Alt */
- case 0xB8: /* Right Alt */
- if (key_up)
- k->modifier_state &= ~GDK_MOD1_MASK;
- else
- k->modifier_state |= GDK_MOD1_MASK;
- break;
- case 0x2A: /* Left Shift */
- case 0x36: /* Right Shift */
- if (key_up)
- k->modifier_state &= ~GDK_SHIFT_MASK;
- else
- k->modifier_state |= GDK_SHIFT_MASK;
- break;
- }
- continue; /* Don't generate events for modifiers */
- }
-
- if (keycode == 0x3A /* Caps lock */)
- {
- if (!key_up)
- k->caps_lock = !k->caps_lock;
-
- ioctl (k->fd, KDSETLED, k->caps_lock ? LED_CAP : 0);
- continue;
- }
-
- if (trans_table[keycode][0] >= GDK_F1 &&
- trans_table[keycode][0] <= GDK_F35 &&
- (k->modifier_state & GDK_MOD1_MASK))
- {
- if (key_up) /* Only switch on release */
- {
- gint vtnum = trans_table[keycode][0] - GDK_F1 + 1;
-
- /* Do the whole funky VT switch thing */
- ioctl (gdk_display->console_fd, VT_ACTIVATE, vtnum);
- }
-
- continue;
- }
-
- keyval = 0;
- mod = 0;
- if (k->modifier_state & GDK_CONTROL_MASK)
- mod = 2;
- else if (k->modifier_state & GDK_SHIFT_MASK)
- mod = 1;
- do {
- keyval = trans_table[keycode][mod--];
- } while (!keyval && (mod >= 0));
-
- if (k->caps_lock && (keyval >= 'a') && (keyval <= 'z'))
- keyval = toupper (keyval);
-
- if (!keyval)
- continue;
-
- len = isprint (keyval) ? 1 : 0;
- dummy[0] = keyval;
- dummy[1] = 0;
-
- gdk_fb_handle_key (keycode,
- keyval,
- k->modifier_state,
- 0,
- (len)?g_strdup(dummy):NULL,
- len,
- key_up);
- }
-
- return TRUE;
-}
-
-static gboolean
-raw_open (GdkFBKeyboard *kb)
-{
- const char cursoroff_str[] = "\033[?1;0;0c";
- struct termios ts;
-
- tcgetattr (gdk_display->tty_fd, &ts);
- ts.c_cc[VTIME] = 0;
- ts.c_cc[VMIN] = 1;
- ts.c_lflag &= ~(ICANON|ECHO|ISIG);
- ts.c_iflag = 0;
- tcsetattr (gdk_display->tty_fd, TCSAFLUSH, &ts);
-
- tcsetpgrp (gdk_display->tty_fd, getpgrp());
-
- write_string (gdk_display->tty_fd, cursoroff_str);
-
- if (ioctl (gdk_display->tty_fd, KDSKBMODE, K_MEDIUMRAW) < 0)
- {
- g_warning ("setting tty to K_MEDIUMRAW failed (are you root?)");
- return FALSE;
- }
-
- kb->fd = gdk_display->tty_fd;
- kb->io = g_io_channel_unix_new (kb->fd);
- kb->io_tag = g_io_add_watch (kb->io,
- G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
- raw_io,
- kb);
-
- return TRUE;
-}
-
-static void
-raw_close (GdkFBKeyboard *kb)
-{
- struct termios ts;
- const char cursoron_str[] = "\033c";
-
- write_string (gdk_display->tty_fd, cursoron_str);
-
- tcgetattr (gdk_display->tty_fd, &ts);
- ts.c_lflag |= (ICANON|ECHO|ISIG);
- tcsetattr (gdk_display->tty_fd, TCSAFLUSH, &ts);
-
- ioctl (gdk_display->tty_fd, KDSKBMODE, K_XLATE);
-
- g_source_remove (kb->io_tag);
- g_io_channel_unref (kb->io);
- /* don't close kb->fd, it is the tty from gdk_display */
-}
-
-static guint
-raw_lookup (GdkFBKeyboard *kb,
- const GdkKeymapKey *key)
-{
- if (key->group != 0)
- return 0;
- if ((key->keycode < 0) || (key->keycode >= 256))
- return 0;
- if ((key->level < 0) || (key->level >= 3))
- return 0;
- return trans_table[key->keycode][key->level];
-}
-
-static gboolean
-raw_translate (GdkFBKeyboard *kb,
- guint hardware_keycode,
- GdkModifierType state,
- gint group,
- guint *keyval,
- gint *effective_group,
- gint *level,
- GdkModifierType *consumed_modifiers)
-{
- guint tmp_keyval;
- gint tmp_level;
-
- if (keyval)
- *keyval = 0;
- if (effective_group)
- *effective_group = 0;
- if (level)
- *level = 0;
- if (consumed_modifiers)
- *consumed_modifiers = 0;
-
- if ((hardware_keycode < 0) || (hardware_keycode >= 256))
- return FALSE;
-
- if (group != 0)
- return FALSE;
-
- if (state & GDK_CONTROL_MASK)
- tmp_level = 2;
- else if (state & GDK_SHIFT_MASK)
- tmp_level = 1;
- else
- tmp_level = 0;
-
- do {
- tmp_keyval = trans_table[hardware_keycode][tmp_level --];
- } while (!tmp_keyval && (tmp_level >= 0));
-
- if (keyval)
- *keyval = tmp_keyval;
- if (level)
- *level = tmp_level;
-
- return TRUE;
-}
-
-static gboolean
-raw_get_for_keyval (GdkFBKeyboard *kb,
- guint keyval,
- GdkKeymapKey **keys,
- gint *n_keys)
-{
- GArray *retval;
- int i, j;
-
- retval = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
-
- for (i = 0; i < 256; i++)
- for (j = 0; j < 3; j++)
- if (trans_table[i][j] == keyval)
- {
- GdkKeymapKey key;
-
- key.keycode = i;
- key.group = 0;
- key.level = j;
-
- g_array_append_val (retval, key);
- }
-
- if (retval->len > 0)
- {
- *keys = (GdkKeymapKey*) retval->data;
- *n_keys = retval->len;
- }
- else
- {
- *keys = NULL;
- *n_keys = 0;
- }
-
- g_array_free (retval, retval->len > 0 ? FALSE : TRUE);
-
- return *n_keys > 0;
-}
-
-static gboolean
-raw_get_for_keycode (GdkFBKeyboard *kb,
- guint hardware_keycode,
- GdkKeymapKey **keys,
- guint **keyvals,
- gint *n_entries)
-{
- GArray *key_array;
- GArray *keyval_array;
- int i;
-
- if (hardware_keycode <= 0 ||
- hardware_keycode >= 256)
- {
- if (keys)
- *keys = NULL;
- if (keyvals)
- *keyvals = NULL;
-
- *n_entries = 0;
- return FALSE;
- }
-
- if (keys)
- key_array = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
- else
- key_array = NULL;
-
- if (keyvals)
- keyval_array = g_array_new (FALSE, FALSE, sizeof (guint));
- else
- keyval_array = NULL;
-
- for (i = 0; i < 3; i++)
- {
- if (key_array)
- {
- GdkKeymapKey key;
-
- key.keycode = hardware_keycode;
- key.group = 0;
- key.level = i;
-
- g_array_append_val (key_array, key);
- }
-
- if (keyval_array)
- {
- g_array_append_val (keyval_array, trans_table[hardware_keycode][i]);
- }
- }
-
- if ((key_array && key_array->len > 0) ||
- (keyval_array && keyval_array->len > 0))
- {
- if (keys)
- *keys = (GdkKeymapKey*) key_array->data;
-
- if (keyvals)
- *keyvals = (guint*) keyval_array->data;
-
- if (key_array)
- *n_entries = key_array->len;
- else
- *n_entries = keyval_array->len;
- }
- else
- {
- if (keys)
- *keys = NULL;
-
- if (keyvals)
- *keyvals = NULL;
-
- *n_entries = 0;
- }
-
- if (key_array)
- g_array_free (key_array, key_array->len > 0 ? FALSE : TRUE);
- if (keyval_array)
- g_array_free (keyval_array, keyval_array->len > 0 ? FALSE : TRUE);
-
- return *n_entries > 0;
-}
diff --git a/gdk/linux-fb/gdkmain-fb.c b/gdk/linux-fb/gdkmain-fb.c
deleted file mode 100644
index 0242d80b0..000000000
--- a/gdk/linux-fb/gdkmain-fb.c
+++ /dev/null
@@ -1,1652 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <time.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/vt.h>
-#include <sys/kd.h>
-#include <errno.h>
-#include <signal.h>
-
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#include "gdk.h"
-
-#include "gdkprivate-fb.h"
-#include "gdkinternals.h"
-#include "gdkfbmanager.h"
-
-/* Private variable declarations
- */
-static int gdk_initialized = 0; /* 1 if the library is initialized,
- * 0 otherwise.
- */
-
-#ifdef G_ENABLE_DEBUG
-static const GDebugKey gdk_debug_keys[] = {
- {"misc", GDK_DEBUG_MISC},
- {"events", GDK_DEBUG_EVENTS},
-};
-
-static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey);
-
-#endif /* G_ENABLE_DEBUG */
-
-GOptionEntry _gdk_windowing_args[] = {
- { NULL }
-};
-
-static const GScannerConfig fb_modes_scanner_config =
-{
- (
- " \t\n"
- ) /* cset_skip_characters */,
- (
- G_CSET_a_2_z
- G_CSET_A_2_Z
- ) /* cset_identifier_first */,
- (
- G_CSET_a_2_z
- "_-0123456789"
- G_CSET_A_2_Z
- ) /* cset_identifier_nth */,
- ( "#\n" ) /* cpair_comment_single */,
-
- FALSE /* case_sensitive */,
-
- FALSE /* skip_comment_multi */,
- TRUE /* skip_comment_single */,
- FALSE /* scan_comment_multi */,
- TRUE /* scan_identifier */,
- TRUE /* scan_identifier_1char */,
- FALSE /* scan_identifier_NULL */,
- TRUE /* scan_symbols */,
- FALSE /* scan_binary */,
- FALSE /* scan_octal */,
- FALSE /* scan_float */,
- FALSE /* scan_hex */,
- FALSE /* scan_hex_dollar */,
- FALSE /* scan_string_sq */,
- TRUE /* scan_string_dq */,
- TRUE /* numbers_2_int */,
- FALSE /* int_2_float */,
- FALSE /* identifier_2_string */,
- TRUE /* char_2_token */,
- FALSE /* symbol_2_token */,
- FALSE /* scope_0_fallback */,
-};
-
-enum {
- FB_MODE,
- FB_ENDMODE,
- FB_GEOMETRY,
- FB_TIMINGS,
- FB_LACED,
- FB_HSYNC,
- FB_VSYNC,
- FB_CSYNC,
- FB_EXTSYNC,
- FB_DOUBLE,
- FB_ACCEL
-};
-
-char *fb_modes_keywords[] =
-{
- "mode",
- "endmode",
- "geometry",
- "timings",
- "laced",
- "hsync",
- "vsync",
- "csync",
- "extsync",
- "double",
- "accel"
-};
-
-static int
-fb_modes_parse_mode (GScanner *scanner,
- struct fb_var_screeninfo *modeinfo,
- char *specified_modename)
-{
- guint token;
- int keyword;
- int i;
- char *modename;
- int geometry[5];
- int timings[7];
- int vsync=0, hsync=0, csync=0, extsync=0, doublescan=0, laced=0, accel=1;
- int found_geometry = 0;
- int found_timings = 0;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_SYMBOL)
- return -1;
-
- keyword = GPOINTER_TO_INT (scanner->value.v_symbol);
- if (keyword != FB_MODE)
- return -1;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_STRING)
- return -1;
-
- modename = g_strdup (scanner->value.v_string);
-
- 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);
- while ( keyword != FB_ENDMODE )
- {
-
- switch (GPOINTER_TO_INT (scanner->value.v_symbol))
- {
- case FB_GEOMETRY:
- for (i = 0; i < 5;i++) {
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_INT)
- {
- g_free (modename);
- return -1; /* need a integer */
- }
- geometry[i] = scanner->value.v_int;
- }
- found_geometry = TRUE;
- break;
- case FB_TIMINGS:
- for (i = 0; i < 7; i++) {
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_INT)
- {
- g_free (modename);
- return -1; /* need a integer */
- }
- timings[i] = scanner->value.v_int;
- }
- found_timings = TRUE;
- break;
- case FB_LACED:
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_IDENTIFIER)
- {
- g_free (modename);
- return -1;
- }
- if (g_ascii_strcasecmp (scanner->value.v_identifier, "true")==0)
- laced = 1;
- else if (g_ascii_strcasecmp (scanner->value.v_identifier, "false")==0)
- laced = 0;
- else
- {
- g_free (modename);
- return -1;
- }
- break;
- case FB_EXTSYNC:
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_IDENTIFIER)
- {
- g_free (modename);
- return -1;
- }
- if (g_ascii_strcasecmp (scanner->value.v_identifier, "true")==0)
- extsync = 1;
- else if (g_ascii_strcasecmp (scanner->value.v_identifier, "false")==0)
- extsync = 0;
- else
- {
- g_free (modename);
- return -1;
- }
- break;
- case FB_DOUBLE:
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_IDENTIFIER)
- {
- g_free (modename);
- return -1;
- }
- if (g_ascii_strcasecmp (scanner->value.v_identifier, "true")==0)
- doublescan = 1;
- else if (g_ascii_strcasecmp (scanner->value.v_identifier, "false")==0)
- doublescan = 0;
- else
- {
- g_free (modename);
- return -1;
- }
- break;
- case FB_VSYNC:
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_IDENTIFIER)
- {
- g_free (modename);
- return -1;
- }
- if (g_ascii_strcasecmp (scanner->value.v_identifier, "high")==0)
- vsync = 1;
- else if (g_ascii_strcasecmp (scanner->value.v_identifier, "low")==0)
- vsync = 0;
- else
- {
- g_free (modename);
- return -1;
- }
- break;
- case FB_HSYNC:
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_IDENTIFIER)
- {
- g_free (modename);
- return -1;
- }
- if (g_ascii_strcasecmp (scanner->value.v_identifier, "high")==0)
- hsync = 1;
- else if (g_ascii_strcasecmp (scanner->value.v_identifier, "low")==0)
- hsync = 0;
- else
- {
- g_free (modename);
- return -1;
- }
- break;
- case FB_CSYNC:
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_IDENTIFIER)
- {
- g_free (modename);
- return -1;
- }
- if (g_ascii_strcasecmp (scanner->value.v_identifier, "high")==0)
- csync = 1;
- else if (g_ascii_strcasecmp (scanner->value.v_identifier, "low")==0)
- csync = 0;
- else
- {
- g_free (modename);
- return -1;
- }
- break;
- case FB_ACCEL:
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_IDENTIFIER)
- {
- g_free (modename);
- return -1;
- }
- if (g_ascii_strcasecmp (scanner->value.v_identifier, "false")==0)
- accel = 0;
- else if (g_ascii_strcasecmp (scanner->value.v_identifier, "true")==0)
- accel = 1;
- else
- {
- g_free (modename);
- return -1;
- }
- break;
- }
-
- 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);
- }
-
- if (strcmp (modename, specified_modename)== 0) {
- /* we really should be parsing for rgba. regardless, if rgba isn't found,
- * we can't assume that the original colors are valid for the new mode */
- memset (&modeinfo->red, 0, sizeof (modeinfo->red));
- memset (&modeinfo->green, 0, sizeof (modeinfo->green));
- memset (&modeinfo->blue, 0, sizeof (modeinfo->blue));
- memset (&modeinfo->transp, 0, sizeof (modeinfo->transp));
-
- if (!found_geometry)
- g_warning ("Geometry not specified");
-
- if (found_geometry)
- {
- modeinfo->xres = geometry[0];
- modeinfo->yres = geometry[1];
- modeinfo->xres_virtual = geometry[2];
- modeinfo->yres_virtual = geometry[3];
- modeinfo->bits_per_pixel = geometry[4];
- }
-
- if (!found_timings)
- g_warning ("Timing not specified");
-
- if (found_timings)
- {
- modeinfo->pixclock = timings[0];
- modeinfo->left_margin = timings[1];
- modeinfo->right_margin = timings[2];
- modeinfo->upper_margin = timings[3];
- modeinfo->lower_margin = timings[4];
- modeinfo->hsync_len = timings[5];
- modeinfo->vsync_len = timings[6];
-
- modeinfo->vmode = 0;
- if (laced)
- modeinfo->vmode |= FB_VMODE_INTERLACED;
- if (doublescan)
- modeinfo->vmode |= FB_VMODE_DOUBLE;
-
- modeinfo->sync = 0;
- if (hsync)
- modeinfo->sync |= FB_SYNC_HOR_HIGH_ACT;
- if (vsync)
- modeinfo->sync |= FB_SYNC_VERT_HIGH_ACT;
- if (accel)
- modeinfo->accel_flags = FB_ACCELF_TEXT;
- else
- modeinfo->accel_flags = 0;
- }
-
- g_free (modename);
- return 1;
- }
-
- g_free (modename);
-
- return 0;
-}
-
-static int
-gdk_fb_setup_mode_from_name (struct fb_var_screeninfo *modeinfo,
- char *modename)
-{
- GScanner *scanner;
- char *filename;
- gint result;
- int fd, i;
- int retval;
-
- retval = 0;
-
- filename = "/etc/fb.modes";
-
- fd = open (filename, O_RDONLY);
- if (fd < 0)
- {
- g_warning ("Cannot read %s", filename);
- return retval;
- }
-
- scanner = g_scanner_new ((GScannerConfig *) &fb_modes_scanner_config);
- scanner->input_name = filename;
-
- for (i = 0; i < sizeof(fb_modes_keywords)/sizeof(fb_modes_keywords[0]); i++)
- g_scanner_scope_add_symbol (scanner, 0, 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) {
- break;
- }
- result = fb_modes_parse_mode (scanner, modeinfo, modename);
-
- if (result < 0) {
- g_warning ("parse error in %s at line %d", filename, scanner->line);
- break;
- }
- if (result > 0)
- {
- retval = 1;
- break;
- }
- }
-
- g_scanner_destroy (scanner);
-
- close (fd);
-
- return retval;
-}
-
-
-static int
-gdk_fb_set_mode (GdkFBDisplay *display)
-{
- char *env, *end;
- int depth, height, width;
- gboolean changed;
-
- if (ioctl (display->fb_fd, FBIOGET_VSCREENINFO, &display->modeinfo) < 0)
- return -1;
-
- display->orig_modeinfo = display->modeinfo;
-
- changed = FALSE;
-
- env = getenv ("GDK_DISPLAY_MODE");
- if (env)
- {
- if (gdk_fb_setup_mode_from_name (&display->modeinfo, env))
- changed = TRUE;
- else
- g_warning ("Couldn't find mode named '%s'", env);
- }
-
- env = getenv ("GDK_DISPLAY_DEPTH");
- if (env)
- {
- depth = strtol (env, &end, 10);
- if (env != end)
- {
- changed = TRUE;
- display->modeinfo.bits_per_pixel = depth;
- }
- }
-
- env = getenv ("GDK_DISPLAY_WIDTH");
- if (env)
- {
- width = strtol (env, &end, 10);
- if (env != end)
- {
- changed = TRUE;
- display->modeinfo.xres = width;
- display->modeinfo.xres_virtual = width;
- }
- }
-
- env = getenv ("GDK_DISPLAY_HEIGHT");
- if (env)
- {
- height = strtol (env, &end, 10);
- if (env != end)
- {
- changed = TRUE;
- display->modeinfo.yres = height;
- display->modeinfo.yres_virtual = height;
- }
- }
-
- if (changed &&
- (ioctl (display->fb_fd, FBIOPUT_VSCREENINFO, &display->modeinfo) < 0))
- {
- g_warning ("Couldn't set specified mode");
- return -1;
- }
-
- /* ask for info back to make sure of what we got */
- if (ioctl (display->fb_fd, FBIOGET_VSCREENINFO, &display->modeinfo) < 0)
- {
- g_warning ("Error getting var screen info");
- return -1;
- }
-
- if (ioctl (display->fb_fd, FBIOGET_FSCREENINFO, &display->sinfo) < 0)
- {
- g_warning ("Error getting fixed screen info");
- return -1;
- }
- return 0;
-}
-
-#ifdef ENABLE_FB_MANAGER
-static void
-gdk_fb_switch_from (void)
-{
- g_print ("Switch from\n");
- gdk_shadow_fb_stop_updates ();
- gdk_fb_mouse_close ();
- gdk_fb_keyboard_close ();
-}
-
-static void
-gdk_fb_switch_to (void)
-{
- g_print ("switch_to\n");
- gdk_shadow_fb_update (0, 0,
- gdk_display->fb_width,
- gdk_display->fb_height);
-
- if (!gdk_fb_keyboard_open ())
- g_warning ("Failed to re-initialize keyboard");
-
- if (!gdk_fb_mouse_open ())
- g_warning ("Failed to re-initialize mouse");
-
-}
-
-
-static gboolean
-gdk_fb_manager_callback (GIOChannel *gioc,
- GIOCondition cond,
- gpointer data)
-{
- struct FBManagerMessage msg;
- GdkFBDisplay *display;
- int res;
-
- display = data;
-
- res = recv (display->manager_fd, &msg, sizeof (msg), 0);
-
- if (res==0)
- {
- g_source_remove (gdk_display->manager_tag);
- /*g_io_channel_unref (kb->io);*/
- close (gdk_display->manager_fd);
-
- }
-
- if (res != sizeof (msg))
- {
- g_warning ("Got wrong size message");
- return TRUE;
- }
-
- switch (msg.msg_type)
- {
- case FB_MANAGER_SWITCH_FROM:
- g_print ("Got switch from message\n");
- display->manager_blocked = TRUE;
- gdk_fb_switch_from ();
- msg.msg_type = FB_MANAGER_ACK;
- send (display->manager_fd, &msg, sizeof (msg), 0);
- break;
- case FB_MANAGER_SWITCH_TO:
- g_print ("Got switch to message\n");
- display->manager_blocked = FALSE;
- gdk_fb_switch_to ();
- break;
- default:
- g_warning ("Got unknown message");
- }
- return TRUE;
-}
-
-#endif /* ENABLE_FB_MANAGER */
-
-static void
-gdk_fb_manager_connect (GdkFBDisplay *display)
-{
-#ifdef ENABLE_FB_MANAGER
- int fd;
- struct sockaddr_un addr;
- struct msghdr msg = {0};
- struct cmsghdr *cmsg;
- struct ucred credentials;
- struct FBManagerMessage init_msg;
- struct iovec iov;
- char buf[CMSG_SPACE (sizeof (credentials))]; /* ancillary data buffer */
- int *fdptr;
- int res;
-
- display->manager_blocked = FALSE;
- display->manager_fd = -1;
-
- fd = socket (PF_UNIX, SOCK_STREAM, 0);
-
- g_print ("socket: %d\n", fd);
-
- if (fd < 0)
- return;
-
- addr.sun_family = AF_UNIX;
- strcpy (addr.sun_path, "/tmp/.fb.manager");
-
- if (connect(fd, (struct sockaddr *)&addr, sizeof (addr)) < 0)
- {
- g_print ("connect failed\n");
- close (fd);
- return;
- }
-
- credentials.pid = getpid ();
- credentials.uid = geteuid ();
- credentials.gid = getegid ();
-
- init_msg.msg_type = FB_MANAGER_NEW_CLIENT;
- iov.iov_base = &init_msg;
- iov.iov_len = sizeof (init_msg);
-
- msg.msg_name = NULL;
- msg.msg_namelen = 0;
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
- msg.msg_control = buf;
- msg.msg_controllen = sizeof buf;
- cmsg = CMSG_FIRSTHDR(&msg);
- cmsg->cmsg_level = SOL_SOCKET;
- cmsg->cmsg_type = SCM_CREDENTIALS;
- cmsg->cmsg_len = CMSG_LEN (sizeof (credentials));
- /* Initialize the payload: */
- fdptr = (int *)CMSG_DATA (cmsg);
- memcpy (fdptr, &credentials, sizeof (credentials));
- /* Sum of the length of all control messages in the buffer: */
- msg.msg_controllen = cmsg->cmsg_len;
-
- res = sendmsg (fd, &msg, 0);
-
- display->manager_fd = fd;
- display->manager_blocked = TRUE;
-
- display->manager_tag = g_io_add_watch (g_io_channel_unix_new (fd),
- G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
- gdk_fb_manager_callback,
- display);
-
- init_msg.msg_type = FB_MANAGER_REQUEST_SWITCH_TO_PID;
- init_msg.data = getpid ();
-
- /* Request a switch-to */
- send (fd, &init_msg, sizeof (init_msg), 0);
-#endif
-}
-
-static void
-gdk_fb_switch (int sig)
-{
- if (sig == SIGUSR1)
- {
- ioctl (gdk_display->tty_fd, VT_RELDISP, 1);
- _gdk_fb_is_active_vt = FALSE;
- gdk_shadow_fb_stop_updates ();
- gdk_fb_mouse_close ();
- gdk_fb_keyboard_close ();
- }
- else
- {
- GdkColormap *cmap;
- ioctl (gdk_display->tty_fd, VT_RELDISP, VT_ACKACQ);
- _gdk_fb_is_active_vt = TRUE;
-
- /* XXX: is it dangerous to put all this stuff in a signal handler? */
- cmap = gdk_screen_get_default_colormap (_gdk_screen);
- gdk_colormap_change (cmap, cmap->size);
-
- gdk_shadow_fb_update (0, 0,
- gdk_display->fb_width,
- gdk_display->fb_height);
-
- if (!gdk_fb_keyboard_open ())
- g_warning ("Failed to re-initialize keyboard");
-
- if (!gdk_fb_mouse_open ())
- g_warning ("Failed to re-initialize mouse");
-
- gdk_fb_redraw_all ();
- }
-}
-
-static GdkFBDisplay *
-gdk_fb_display_new (void)
-{
- GdkFBDisplay *display;
- gchar *fb_filename;
- struct vt_stat vs;
- struct vt_mode vtm;
- int vt, n;
- gchar *s, *send;
- char buf[32];
-
- display = g_new0 (GdkFBDisplay, 1);
-
- display->console_fd = open ("/dev/console", O_RDWR);
- if (display->console_fd < 0)
- {
- g_warning ("Can't open /dev/console: %s", strerror (errno));
- g_free (display);
- return NULL;
- }
-
- ioctl (display->console_fd, VT_GETSTATE, &vs);
- display->start_vt = vs.v_active;
-
- vt = display->start_vt;
- s = getenv("GDK_VT");
- if (s)
- {
- if (g_ascii_strcasecmp ("new", s)==0)
- {
- n = ioctl (display->console_fd, VT_OPENQRY, &vt);
- if (n < 0 || vt == -1)
- g_error("Cannot allocate new VT");
- }
- else
- {
- vt = strtol (s, &send, 10);
- if (s==send)
- {
- g_warning ("Cannot parse GDK_VT");
- vt = display->start_vt;
- }
- }
-
- }
-
- display->vt = vt;
-
- /* Switch to the new VT */
- if (vt != display->start_vt)
- {
- ioctl (display->console_fd, VT_ACTIVATE, vt);
- ioctl (display->console_fd, VT_WAITACTIVE, vt);
- }
-
- /* Open the tty */
- g_snprintf (buf, sizeof(buf), "/dev/tty%d", vt);
- display->tty_fd = open (buf, O_RDWR|O_NONBLOCK);
- if (display->tty_fd < 0)
- {
- g_warning ("Can't open %s: %s", buf, strerror (errno));
- close (display->console_fd);
- g_free (display);
- return NULL;
- }
-
- /* set up switch signals */
- if (ioctl (display->tty_fd, VT_GETMODE, &vtm) >= 0)
- {
- signal (SIGUSR1, gdk_fb_switch);
- signal (SIGUSR2, gdk_fb_switch);
- vtm.mode = VT_PROCESS;
- vtm.waitv = 0;
- vtm.relsig = SIGUSR1;
- vtm.acqsig = SIGUSR2;
- ioctl (display->tty_fd, VT_SETMODE, &vtm);
- }
- _gdk_fb_is_active_vt = TRUE;
-
- fb_filename = gdk_get_display ();
- display->fb_fd = open (fb_filename, O_RDWR);
- if (display->fb_fd < 0)
- {
- g_warning ("Can't open %s: %s", fb_filename, strerror (errno));
- g_free (fb_filename);
- close (display->tty_fd);
- close (display->console_fd);
- g_free (display);
- return NULL;
- }
- g_free (fb_filename);
-
- if (gdk_fb_set_mode (display) < 0)
- {
- close (display->fb_fd);
- close (display->tty_fd);
- close (display->console_fd);
- g_free (display);
- return NULL;
- }
-
- /* Disable normal text on the console */
- ioctl (display->fb_fd, KDSETMODE, KD_GRAPHICS);
-
- ioctl (display->fb_fd, FBIOBLANK, 0);
-
- /* We used to use sinfo.smem_len, but that seemed to be broken in many cases */
- display->fb_mmap = mmap (NULL,
- display->modeinfo.yres * display->sinfo.line_length,
- PROT_READ|PROT_WRITE,
- MAP_SHARED,
- display->fb_fd,
- 0);
- g_assert (display->fb_mmap != MAP_FAILED);
-
- if (display->sinfo.visual == FB_VISUAL_TRUECOLOR)
- {
- display->red_byte = display->modeinfo.red.offset >> 3;
- display->green_byte = display->modeinfo.green.offset >> 3;
- display->blue_byte = display->modeinfo.blue.offset >> 3;
- }
-
-#ifdef ENABLE_SHADOW_FB
- if (_gdk_fb_screen_angle % 2 == 0)
- {
- display->fb_width = display->modeinfo.xres;
- display->fb_height = display->modeinfo.yres;
- }
- else
- {
- display->fb_width = display->modeinfo.yres;
- display->fb_height = display->modeinfo.xres;
- }
- display->fb_stride =
- display->fb_width * (display->modeinfo.bits_per_pixel / 8);
- display->fb_mem = g_malloc(display->fb_height * display->fb_stride);
-#else
- display->fb_mem = display->fb_mmap;
- display->fb_width = display->modeinfo.xres;
- display->fb_height = display->modeinfo.yres;
- display->fb_stride = display->sinfo.line_length;
-#endif
-
- return display;
-}
-
-static void
-gdk_fb_display_destroy (GdkFBDisplay *display)
-{
- /* Restore old framebuffer mode */
- ioctl (display->fb_fd, FBIOPUT_VSCREENINFO, &display->orig_modeinfo);
-
- /* Enable normal text on the console */
- ioctl (display->fb_fd, KDSETMODE, KD_TEXT);
-
- munmap (display->fb_mmap, display->modeinfo.yres * display->sinfo.line_length);
- close (display->fb_fd);
-
- ioctl (display->console_fd, VT_ACTIVATE, display->start_vt);
- ioctl (display->console_fd, VT_WAITACTIVE, display->start_vt);
- if (display->vt != display->start_vt)
- ioctl (display->console_fd, VT_DISALLOCATE, display->vt);
-
- close (display->tty_fd);
- close (display->console_fd);
- g_free (display);
-}
-
-void
-_gdk_windowing_init (void)
-{
- if (gdk_initialized)
- return;
-
- /* Create new session and become session leader */
- setsid();
-
- gdk_display = gdk_fb_display_new ();
-
- if (!gdk_display)
- return;
-
- gdk_shadow_fb_init ();
-
- gdk_fb_manager_connect (gdk_display);
-
- if (!gdk_fb_keyboard_init (!gdk_display->manager_blocked))
- {
- g_warning ("Failed to initialize keyboard");
- gdk_fb_display_destroy (gdk_display);
- gdk_display = NULL;
- return;
- }
-
- if (!gdk_fb_mouse_init (!gdk_display->manager_blocked))
- {
- g_warning ("Failed to initialize mouse");
- gdk_fb_keyboard_close ();
- gdk_fb_display_destroy (gdk_display);
- gdk_display = NULL;
- return;
- }
-
- /* Although atexit is evil, we need it here because otherwise the
- * keyboard is left in a bad state. you can still run 'reset' but
- * that gets annoying after running testgtk for the 20th time.
- */
- g_atexit(_gdk_windowing_exit);
-
- gdk_initialized = TRUE;
-
- _gdk_selection_property = gdk_atom_intern ("GDK_SELECTION", FALSE);
-
-}
-
-void
-_gdk_windowing_set_default_display (GdkDisplay *display)
-{
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_pointer_grab
- *
- * Grabs the pointer to a specific window
- *
- * Arguments:
- * "window" is the window which will receive the grab
- * "owner_events" specifies whether events will be reported as is,
- * or relative to "window"
- * "event_mask" masks only interesting events
- * "confine_to" limits the cursor movement to the specified window
- * "cursor" changes the cursor for the duration of the grab
- * "time" specifies the time
- *
- * Results:
- *
- * Side effects:
- * requires a corresponding call to gdk_pointer_ungrab
- *
- *--------------------------------------------------------------
- */
-
-GdkGrabStatus
-gdk_pointer_grab (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- GdkCursor * cursor,
- guint32 time)
-{
- return gdk_fb_pointer_grab (window,
- owner_events,
- event_mask,
- confine_to,
- cursor,
- time, FALSE);
-}
-
-static gboolean _gdk_fb_pointer_implicit_grab = FALSE;
-
-GdkGrabStatus
-gdk_fb_pointer_grab (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- GdkCursor * cursor,
- 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 (implicit_grab && !_gdk_fb_pointer_implicit_grab)
- return GDK_GRAB_ALREADY_GRABBED;
-
- gdk_pointer_ungrab (time);
- }
-
- gdk_fb_window_send_crossing_events (NULL,
- window,
- GDK_CROSSING_GRAB);
-
- if (event_mask & GDK_BUTTON_MOTION_MASK)
- event_mask |=
- GDK_BUTTON1_MOTION_MASK |
- GDK_BUTTON2_MOTION_MASK |
- GDK_BUTTON3_MOTION_MASK;
-
- _gdk_fb_pointer_implicit_grab = implicit_grab;
-
- _gdk_fb_pointer_grab_window = gdk_window_ref (window);
- _gdk_fb_pointer_grab_owner_events = owner_events;
-
- _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;
-
-
-
- if (cursor)
- gdk_fb_cursor_reset ();
-
- return GDK_GRAB_SUCCESS;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_display_pointer_ungrab
- *
- * Releases any pointer grab
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_display_pointer_ungrab (GdkDisplay *display,
- guint32 time)
-{
- gdk_fb_pointer_ungrab (time, FALSE);
-}
-
-void
-gdk_fb_pointer_ungrab (guint32 time, gboolean implicit_grab)
-{
- gboolean have_grab_cursor = _gdk_fb_pointer_grab_cursor && 1;
- GdkWindow *mousewin;
- GdkWindow *old_grab_window;
-
- if (!_gdk_fb_pointer_grab_window)
- return;
-
- if (implicit_grab && !_gdk_fb_pointer_implicit_grab)
- return;
-
- 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);
- _gdk_fb_pointer_grab_cursor = NULL;
-
- if (have_grab_cursor)
- gdk_fb_cursor_reset ();
-
- old_grab_window = _gdk_fb_pointer_grab_window;
-
- _gdk_fb_pointer_grab_window = NULL;
-
- _gdk_fb_pointer_implicit_grab = FALSE;
-
- mousewin = gdk_window_at_pointer (NULL, NULL);
- gdk_fb_window_send_crossing_events (old_grab_window,
- mousewin,
- GDK_CROSSING_UNGRAB);
-
- if (old_grab_window)
- gdk_window_unref (old_grab_window);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_display_pointer_is_grabbed
- *
- * Tell wether there is an active x pointer grab in effect
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_display_pointer_is_grabbed (GdkDisplay *display)
-{
- return _gdk_fb_pointer_grab_window != NULL;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_keyboard_grab
- *
- * Grabs the keyboard to a specific window
- *
- * Arguments:
- * "window" is the window which will receive the grab
- * "owner_events" specifies whether events will be reported as is,
- * or relative to "window"
- * "time" specifies the time
- *
- * Results:
- *
- * Side effects:
- * requires a corresponding call to gdk_keyboard_ungrab
- *
- *--------------------------------------------------------------
- */
-
-GdkGrabStatus
-gdk_keyboard_grab (GdkWindow *window,
- gint owner_events,
- guint32 time)
-{
- 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);
-
- _gdk_fb_keyboard_grab_window = gdk_window_ref (window);
- _gdk_fb_keyboard_grab_owner_events = owner_events;
-
- return GDK_GRAB_SUCCESS;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_display_keyboard_ungrab
- *
- * Releases any keyboard grab
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_display_keyboard_ungrab (GdkDisplay *display,
- guint32 time)
-{
- if (_gdk_fb_keyboard_grab_window)
- gdk_window_unref (_gdk_fb_keyboard_grab_window);
- _gdk_fb_keyboard_grab_window = NULL;
-}
-
-gboolean
-gdk_pointer_grab_info_libgtk_only (GdkDisplay *display,
- GdkWindow **grab_window,
- gboolean *owner_events)
-{
- if (_gdk_fb_pointer_grab_window)
- {
- if (grab_window)
- *grab_window = (GdkWindow *)_gdk_fb_pointer_grab_window;
- if (owner_events)
- *owner_events = _gdk_fb_pointer_grab_owner_events;
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-gboolean
-gdk_keyboard_grab_info_libgtk_only (GdkDisplay *display,
- GdkWindow **grab_window,
- gboolean *owner_events)
-{
- if (_gdk_fb_keyboard_grab_window)
- {
- if (grab_window)
- *grab_window = (GdkWindow *)_gdk_fb_keyboard_grab_window;
- if (owner_events)
- *owner_events = _gdk_fb_keyboard_grab_owner_events;
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-
-/*
- *--------------------------------------------------------------
- * gdk_screen_get_width
- *
- * Return the width of the screen.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_screen_get_width (GdkScreen *screen)
-{
- return gdk_display->fb_width;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_screen_get_height
- *
- * Return the height of the screen.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_screen_get_height (GdkScreen *screen)
-{
- return gdk_display->fb_height;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_screen_get_width_mm
- *
- * Return the width of the screen in millimeters.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_screen_get_width_mm (GdkScreen *screen)
-{
- return 0.5 + gdk_screen_width () * (25.4 / 72.);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_screen_get_height_mm
- *
- * Return the height of the screen in millimeters.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_screen_get_height_mm (GdkScreen *screen)
-{
- return 0.5 + gdk_screen_height () * (25.4 / 72.);
-}
-
-void
-_gdk_windowing_display_set_sm_client_id (GdkDisplay* display,
- const gchar* sm_client_id)
-{
-}
-
-extern void keyboard_shutdown(void);
-
-void
-_gdk_windowing_exit (void)
-{
- struct sigaction action;
-
- /* don't get interrupted while exiting
- * (cf. gdkrender-fb.c:gdk_shadow_fb_init) */
- action.sa_handler = SIG_IGN;
- sigemptyset (&action.sa_mask);
- action.sa_flags = 0;
-
- gdk_fb_mouse_close ();
- /*leak g_free (gdk_fb_mouse);*/
-
- gdk_fb_keyboard_close ();
- /*leak g_free (gdk_fb_keyboard);*/
-
- gdk_fb_display_destroy (gdk_display);
-
- gdk_display = NULL;
-}
-
-gchar *
-gdk_get_display(void)
-{
- gchar *s;
-
- s = getenv ("GDK_DISPLAY");
- if (s==0)
- s = "/dev/fb0";
-
- return g_strdup (s);
-}
-
-void
-gdk_display_beep (GdkDisplay *display)
-{
- static int pitch = 600, duration = 100;
- gulong arg;
-
- /* Thank you XFree86 */
- arg = ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration) << 16);
-
- ioctl (gdk_display->tty_fd, KDMKTONE, arg);
-}
-
-/* utils */
-static const guint type_masks[] = {
- GDK_SUBSTRUCTURE_MASK, /* GDK_DELETE = 0, */
- GDK_STRUCTURE_MASK, /* GDK_DESTROY = 1, */
- GDK_EXPOSURE_MASK, /* GDK_EXPOSE = 2, */
- GDK_POINTER_MOTION_MASK, /* GDK_MOTION_NOTIFY = 3, */
- GDK_BUTTON_PRESS_MASK, /* GDK_BUTTON_PRESS = 4, */
- GDK_BUTTON_PRESS_MASK, /* GDK_2BUTTON_PRESS = 5, */
- GDK_BUTTON_PRESS_MASK, /* GDK_3BUTTON_PRESS = 6, */
- GDK_BUTTON_RELEASE_MASK, /* GDK_BUTTON_RELEASE = 7, */
- GDK_KEY_PRESS_MASK, /* GDK_KEY_PRESS = 8, */
- GDK_KEY_RELEASE_MASK, /* GDK_KEY_RELEASE = 9, */
- GDK_ENTER_NOTIFY_MASK, /* GDK_ENTER_NOTIFY = 10, */
- GDK_LEAVE_NOTIFY_MASK, /* GDK_LEAVE_NOTIFY = 11, */
- GDK_FOCUS_CHANGE_MASK, /* GDK_FOCUS_CHANGE = 12, */
- GDK_STRUCTURE_MASK, /* GDK_CONFIGURE = 13, */
- GDK_VISIBILITY_NOTIFY_MASK, /* GDK_MAP = 14, */
- GDK_VISIBILITY_NOTIFY_MASK, /* GDK_UNMAP = 15, */
- GDK_PROPERTY_CHANGE_MASK, /* GDK_PROPERTY_NOTIFY = 16, */
- GDK_PROPERTY_CHANGE_MASK, /* GDK_SELECTION_CLEAR = 17, */
- GDK_PROPERTY_CHANGE_MASK, /* GDK_SELECTION_REQUEST = 18, */
- GDK_PROPERTY_CHANGE_MASK, /* GDK_SELECTION_NOTIFY = 19, */
- GDK_PROXIMITY_IN_MASK, /* GDK_PROXIMITY_IN = 20, */
- GDK_PROXIMITY_OUT_MASK, /* GDK_PROXIMITY_OUT = 21, */
- GDK_ALL_EVENTS_MASK, /* GDK_DRAG_ENTER = 22, */
- GDK_ALL_EVENTS_MASK, /* GDK_DRAG_LEAVE = 23, */
- GDK_ALL_EVENTS_MASK, /* GDK_DRAG_MOTION = 24, */
- GDK_ALL_EVENTS_MASK, /* GDK_DRAG_STATUS = 25, */
- GDK_ALL_EVENTS_MASK, /* GDK_DROP_START = 26, */
- GDK_ALL_EVENTS_MASK, /* GDK_DROP_FINISHED = 27, */
- GDK_ALL_EVENTS_MASK, /* GDK_CLIENT_EVENT = 28, */
- GDK_VISIBILITY_NOTIFY_MASK, /* GDK_VISIBILITY_NOTIFY = 29, */
- GDK_EXPOSURE_MASK, /* GDK_NO_EXPOSE = 30, */
- GDK_SCROLL_MASK /* GDK_SCROLL = 31 */
-};
-
-GdkWindow *
-gdk_fb_other_event_window (GdkWindow *window,
- GdkEventType type)
-{
- guint32 evmask;
- GdkWindow *w;
-
- w = window;
- while (w != _gdk_parent_root)
- {
- /* Huge hack, so that we don't propagate events to GtkWindow->frame */
- if ((w != window) &&
- (GDK_WINDOW_P (w)->window_type != GDK_WINDOW_CHILD) &&
- (g_object_get_data (G_OBJECT (w), "gdk-window-child-handler")))
- break;
-
- evmask = GDK_WINDOW_OBJECT(window)->event_mask;
-
- if (evmask & type_masks[type])
- return w;
-
- w = gdk_window_get_parent (w);
- }
-
- return NULL;
-}
-
-GdkWindow *
-gdk_fb_pointer_event_window (GdkWindow *window,
- GdkEventType type)
-{
- guint evmask;
- GdkModifierType mask;
- GdkWindow *w;
-
- gdk_fb_mouse_get_info (NULL, NULL, &mask);
-
- if (_gdk_fb_pointer_grab_window &&
- !_gdk_fb_pointer_grab_owner_events)
- {
- evmask = _gdk_fb_pointer_grab_events;
-
- if (evmask & (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | 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])
- return _gdk_fb_pointer_grab_window;
- else
- return NULL;
- }
-
- w = window;
- while (w != _gdk_parent_root)
- {
- /* Huge hack, so that we don't propagate events to GtkWindow->frame */
- if ((w != window) &&
- (GDK_WINDOW_P (w)->window_type != GDK_WINDOW_CHILD) &&
- (g_object_get_data (G_OBJECT (w), "gdk-window-child-handler")))
- break;
-
- evmask = GDK_WINDOW_OBJECT(window)->event_mask;
-
- if (evmask & (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | 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])
- return w;
-
- w = gdk_window_get_parent (w);
- }
-
- if (_gdk_fb_pointer_grab_window &&
- _gdk_fb_pointer_grab_owner_events)
- {
- evmask = _gdk_fb_pointer_grab_events;
-
- if (evmask & (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | 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])
- return _gdk_fb_pointer_grab_window;
- }
-
- return NULL;
-}
-
-GdkWindow *
-gdk_fb_keyboard_event_window (GdkWindow *window,
- GdkEventType type)
-{
- guint32 evmask;
- GdkWindow *w;
-
- if (_gdk_fb_keyboard_grab_window &&
- !_gdk_fb_keyboard_grab_owner_events)
- {
- return _gdk_fb_keyboard_grab_window;
- }
-
- w = window;
- while (w != _gdk_parent_root)
- {
- /* Huge hack, so that we don't propagate events to GtkWindow->frame */
- if ((w != window) &&
- (GDK_WINDOW_P (w)->window_type != GDK_WINDOW_CHILD) &&
- (g_object_get_data (G_OBJECT (w), "gdk-window-child-handler")))
- break;
-
- evmask = GDK_WINDOW_OBJECT(window)->event_mask;
-
- if (evmask & type_masks[type])
- return w;
-
- w = gdk_window_get_parent (w);
- }
-
- if (_gdk_fb_keyboard_grab_window &&
- _gdk_fb_keyboard_grab_owner_events)
- {
- return _gdk_fb_keyboard_grab_window;
- }
-
- return NULL;
-}
-
-GdkEvent *
-gdk_event_make (GdkWindow *window,
- GdkEventType type,
- gboolean append_to_queue)
-{
- GdkEvent *event = gdk_event_new (type);
- guint32 the_time;
-
- the_time = gdk_fb_get_time ();
-
- event->any.window = gdk_window_ref (window);
- event->any.send_event = FALSE;
- switch (type)
- {
- case GDK_MOTION_NOTIFY:
- event->motion.time = the_time;
- event->motion.axes = NULL;
- break;
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- event->button.time = the_time;
- event->button.axes = NULL;
- break;
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- event->key.time = the_time;
- break;
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- event->crossing.time = the_time;
- break;
-
- case GDK_PROPERTY_NOTIFY:
- event->property.time = the_time;
- break;
-
- case GDK_SELECTION_CLEAR:
- case GDK_SELECTION_REQUEST:
- case GDK_SELECTION_NOTIFY:
- event->selection.time = the_time;
- break;
- case GDK_PROXIMITY_IN:
- case GDK_PROXIMITY_OUT:
- event->proximity.time = the_time;
- break;
- case GDK_DRAG_ENTER:
- case GDK_DRAG_LEAVE:
- case GDK_DRAG_MOTION:
- case GDK_DRAG_STATUS:
- case GDK_DROP_START:
- case GDK_DROP_FINISHED:
- event->dnd.time = the_time;
- break;
-
- case GDK_FOCUS_CHANGE:
- case GDK_CONFIGURE:
- case GDK_MAP:
- case GDK_UNMAP:
- case GDK_CLIENT_EVENT:
- case GDK_VISIBILITY_NOTIFY:
- case GDK_NO_EXPOSE:
- case GDK_SCROLL:
- case GDK_DELETE:
- case GDK_DESTROY:
- case GDK_EXPOSE:
- default:
- break;
- }
-
- if (append_to_queue)
- _gdk_event_queue_append (gdk_display_get_default (), event);
-
- return event;
-}
-
-void
-gdk_fb_set_rotation (GdkFBAngle angle)
-{
- if (angle == _gdk_fb_screen_angle)
- return;
-
-#ifdef ENABLE_SHADOW_FB
- if (gdk_display)
- {
- gdk_shadow_fb_stop_updates ();
-
- gdk_fb_cursor_hide ();
-
- _gdk_fb_screen_angle = angle;
-
- if (angle % 2 == 0)
- {
- gdk_display->fb_width = gdk_display->modeinfo.xres;
- gdk_display->fb_height = gdk_display->modeinfo.yres;
- }
- else
- {
- gdk_display->fb_width = gdk_display->modeinfo.yres;
- gdk_display->fb_height = gdk_display->modeinfo.xres;
- }
- gdk_display->fb_stride =
- gdk_display->fb_width * (gdk_display->modeinfo.bits_per_pixel / 8);
-
- gdk_fb_recompute_all();
- gdk_fb_redraw_all ();
-
- gdk_fb_cursor_unhide ();
- }
- else
- _gdk_fb_screen_angle = angle;
-#else
- g_warning ("Screen rotation without shadow fb not supported.");
-#endif
-}
-
-void
-gdk_error_trap_push (void)
-{
-}
-
-gint
-gdk_error_trap_pop (void)
-{
- return 0;
-}
-
-void
-gdk_notify_startup_complete (void)
-{
-}
diff --git a/gdk/linux-fb/gdkmouse-fb.c b/gdk/linux-fb/gdkmouse-fb.c
deleted file mode 100644
index 78c0e4b49..000000000
--- a/gdk/linux-fb/gdkmouse-fb.c
+++ /dev/null
@@ -1,864 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkinternals.h>
-#include "gdkprivate-fb.h"
-#include "gdkinputprivate.h"
-#include <stdlib.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <string.h>
-#include <math.h>
-#include <unistd.h>
-#include <errno.h>
-
-typedef struct _GdkFBMouse GdkFBMouse;
-typedef struct _GdkFBMouseDevice GdkFBMouseDevice;
-
-struct _GdkFBMouse {
- gint fd; /* Set by open */
- gchar *file;
-
- /* These are written to by parse_packet */
- gdouble x, y;
- gboolean button_pressed[3];
-
- guchar mouse_packet[5]; /* read by parse_packet */
- gint packet_nbytes;
-
- gboolean click_grab;
- GIOChannel *io;
- gint io_tag;
-
- GdkFBMouseDevice *dev;
-};
-
-static GdkFBMouse *gdk_fb_mouse = NULL;
-
-void
-gdk_fb_mouse_get_info (gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- if (x)
- *x = gdk_fb_mouse->x;
- if (y)
- *y = gdk_fb_mouse->y;
- if (mask)
- *mask =
- (gdk_fb_mouse->button_pressed[0]?GDK_BUTTON1_MASK:0) |
- (gdk_fb_mouse->button_pressed[1]?GDK_BUTTON2_MASK:0) |
- (gdk_fb_mouse->button_pressed[2]?GDK_BUTTON3_MASK:0) |
- gdk_fb_keyboard_modifiers ();
-}
-
-static void
-handle_mouse_movement(GdkFBMouse *mouse)
-{
- GdkWindow *mousewin;
- GdkEvent *event;
- gint x, y;
- GdkWindow *old_win, *win, *event_win, *cursor_win;
- guint state;
- GdkDrawableFBData *mousewin_private;
-
- old_win = gdk_window_at_pointer (NULL, NULL);
-
- if (_gdk_fb_pointer_grab_confine)
- mousewin = _gdk_fb_pointer_grab_confine;
- else
- mousewin = _gdk_parent_root;
-
- mousewin_private = GDK_DRAWABLE_IMPL_FBDATA (mousewin);
-
- if (mouse->x < mousewin_private->llim_x)
- mouse->x = mousewin_private->llim_x;
- else if (mouse->x > mousewin_private->lim_x - 1)
- mouse->x = mousewin_private->lim_x - 1;
-
- if (mouse->y < mousewin_private->llim_y)
- mouse->y = mousewin_private->llim_y;
- else if (mouse->y > mousewin_private->lim_y - 1)
- mouse->y = mousewin_private->lim_y - 1;
-
- win = gdk_window_at_pointer (NULL, NULL);
-
- cursor_win = win;
- if (_gdk_fb_pointer_grab_window)
- {
- GdkWindow *w;
-
- cursor_win = _gdk_fb_pointer_grab_window;
- w = win;
- while (w != _gdk_parent_root)
- {
- if (w == _gdk_fb_pointer_grab_window)
- {
- cursor_win = win;
- break;
- }
- w = gdk_window_get_parent (w);
- }
- }
-
- gdk_fb_cursor_move (mouse->x, mouse->y, cursor_win);
-
- event_win = gdk_fb_pointer_event_window (win, GDK_MOTION_NOTIFY);
-
- if (event_win && (win == old_win))
- {
- /* Only send motion events in the same window */
- gdk_window_get_origin (event_win, &x, &y);
- x = mouse->x - x;
- y = mouse->y - y;
-
- state = (mouse->button_pressed[0]?GDK_BUTTON1_MASK:0) |
- (mouse->button_pressed[1]?GDK_BUTTON2_MASK:0) |
- (mouse->button_pressed[2]?GDK_BUTTON3_MASK:0) |
- gdk_fb_keyboard_modifiers ();
-
- event = gdk_event_make (event_win, GDK_MOTION_NOTIFY, TRUE);
- event->motion.x = x;
- event->motion.y = y;
- event->motion.state = state;
- event->motion.is_hint = FALSE;
- event->motion.device = _gdk_core_pointer;
- event->motion.x_root = mouse->x;
- event->motion.y_root = mouse->y;
- }
-
- gdk_fb_window_send_crossing_events (NULL, win, GDK_CROSSING_NORMAL);
-}
-
-static void
-send_button_event (GdkFBMouse *mouse,
- guint button,
- gboolean press_event)
-{
- GdkEvent *event;
- gint x, y, i;
- GdkWindow *mouse_win;
- GdkWindow *event_win;
- int nbuttons;
-
-
- mouse_win = gdk_window_at_pointer(NULL, NULL);
- event_win = gdk_fb_pointer_event_window (mouse_win,
- press_event ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
-
- if (event_win)
- {
- event = gdk_event_make (event_win, press_event ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE, FALSE);
-
- gdk_window_get_origin (event_win, &x, &y);
- x = mouse->x - x;
- y = mouse->y - y;
-
- event->button.x = x;
- event->button.y = y;
- event->button.button = button;
- event->button.state = (mouse->button_pressed[0]?GDK_BUTTON1_MASK:0) |
- (mouse->button_pressed[1] ? GDK_BUTTON2_MASK : 0) |
- (mouse->button_pressed[2] ? GDK_BUTTON3_MASK : 0) |
- (1 << (button + 8)) /* badhack */ |
- gdk_fb_keyboard_modifiers ();
- event->button.device = _gdk_core_pointer;
- event->button.x_root = mouse->x;
- event->button.y_root = mouse->y;
-
- _gdk_event_queue_append (gdk_display_get_default (), event);
-
- /* For double-clicks */
- if (press_event)
- _gdk_event_button_generate (gdk_display_get_default (), event);
- }
-
- nbuttons = 0;
- for (i=0;i<3;i++)
- if (mouse->button_pressed[i])
- nbuttons++;
-
- /* Handle implicit button grabs: */
- if (press_event && nbuttons == 1)
- {
- gdk_fb_pointer_grab (mouse_win, FALSE,
- gdk_window_get_events (mouse_win),
- NULL, NULL,
- GDK_CURRENT_TIME, TRUE);
- mouse->click_grab = TRUE;
- }
- else if (!press_event && nbuttons == 0 && mouse->click_grab)
- {
- gdk_fb_pointer_ungrab (GDK_CURRENT_TIME, TRUE);
- mouse->click_grab = FALSE;
- }
-}
-
-static void
-handle_mouse_scroll (GdkFBMouse *mouse,
- gboolean up)
-{
- GdkEvent *event;
- gint x, y;
- GdkWindow *mouse_win;
-
- mouse_win = gdk_window_at_pointer(NULL, NULL);
-
- event = gdk_event_make (mouse_win, GDK_SCROLL, FALSE);
-
- gdk_window_get_origin (mouse_win, &x, &y);
- x = mouse->x - x;
- y = mouse->y - y;
-
- event->button.window = mouse_win;
- event->scroll.direction = up ? GDK_SCROLL_UP : GDK_SCROLL_DOWN;
- event->scroll.window = mouse_win;
- event->scroll.time = GDK_CURRENT_TIME;
- event->scroll.x = x;
- event->scroll.y = y;
- event->scroll.x_root = mouse->x;
- event->scroll.y_root = mouse->y;
- event->scroll.state = gdk_fb_keyboard_modifiers ();
- event->scroll.device = _gdk_core_pointer;
-
- _gdk_event_queue_append (gdk_display_get_default (), event);
-}
-
-/******************************************************
- ************ Device specific mouse code **************
- ******************************************************/
-
-/* proto is used to detect the start of the packet:
- * (buf[0]&proto[0]) == proto[1]
- * indicates start of packet.
- */
-
-struct _GdkFBMouseDevice {
- gchar *name;
- gchar *file;
- gint packet_size;
- gboolean (*open)(GdkFBMouse *mouse);
- void (*close)(GdkFBMouse *mouse);
- gboolean (*parse_packet)(GdkFBMouse *mouse, gboolean *got_motion);
- guchar proto[2];
-};
-
-static gboolean handle_mouse_io (GIOChannel *gioc,
- GIOCondition cond,
- gpointer data);
-static gboolean gdk_fb_mouse_ps2_open (GdkFBMouse *mouse);
-static gboolean gdk_fb_mouse_imps2_open (GdkFBMouse *mouse);
-static void gdk_fb_mouse_ps2_close (GdkFBMouse *mouse);
-static gboolean gdk_fb_mouse_ps2_packet (GdkFBMouse *mouse,
- gboolean *got_motion);
-static gboolean gdk_fb_mouse_ms_open (GdkFBMouse *mouse);
-static void gdk_fb_mouse_ms_close (GdkFBMouse *mouse);
-static gboolean gdk_fb_mouse_ms_packet (GdkFBMouse *mouse,
- gboolean *got_motion);
-static gboolean gdk_fb_mouse_fidmour_open (GdkFBMouse *mouse);
-static void gdk_fb_mouse_fidmour_close (GdkFBMouse *mouse);
-static gboolean gdk_fb_mouse_fidmour_packet (GdkFBMouse *mouse,
- gboolean *got_motion);
-
-static GdkFBMouseDevice mouse_devs[] =
-{
- { "ps2",
- "/dev/psaux",
- 3,
- gdk_fb_mouse_ps2_open,
- gdk_fb_mouse_ps2_close,
- gdk_fb_mouse_ps2_packet,
- { 0xc0, 0x00 }
- },
- { "imps2",
- "/dev/psaux",
- 4,
- gdk_fb_mouse_imps2_open,
- gdk_fb_mouse_ps2_close,
- gdk_fb_mouse_ps2_packet,
- { 0xc0, 0x00 }
- },
- { "ms",
- "/dev/mouse",
- 3,
- gdk_fb_mouse_ms_open,
- gdk_fb_mouse_ms_close,
- gdk_fb_mouse_ms_packet,
- { 0x40, 0x40 }
- },
- { "fidmour",
- "/dev/fidmour",
- 5,
- gdk_fb_mouse_fidmour_open,
- gdk_fb_mouse_fidmour_close,
- gdk_fb_mouse_fidmour_packet,
- { 0x00, 0x00 } /* don't know what packet start looks like */
- }
-};
-
-gboolean
-gdk_fb_mouse_init (gboolean open_dev)
-{
- gchar *mouse_type, *mouse_file;
- gint i;
-
- gdk_fb_mouse = g_new0 (GdkFBMouse, 1);
- gdk_fb_mouse->fd = -1;
-
- mouse_type = getenv ("GDK_MOUSE_TYPE");
- if (!mouse_type)
- mouse_type = "ps2";
-
- for (i=0;i<G_N_ELEMENTS(mouse_devs);i++)
- {
- if (g_ascii_strcasecmp(mouse_type, mouse_devs[i].name)==0)
- break;
- }
-
- if (i == G_N_ELEMENTS(mouse_devs))
- {
- g_warning ("No mouse driver of type %s found", mouse_type);
- return FALSE;
- }
-
- gdk_fb_mouse->dev = &mouse_devs[i];
-
- mouse_file = getenv ("GDK_MOUSE_FILE");
- if (!mouse_file)
- mouse_file = gdk_fb_mouse->dev->file;
- gdk_fb_mouse->file = mouse_file;
-
- gdk_fb_mouse->x = gdk_display->fb_width / 2;
- gdk_fb_mouse->y = gdk_display->fb_height / 2;
-
- if (open_dev)
- return gdk_fb_mouse_open ();
- else
- return TRUE;
-}
-
-gboolean
-gdk_fb_mouse_open (void)
-{
- GdkFBMouseDevice *device;
-
- device = gdk_fb_mouse->dev;
-
- if (!device->open(gdk_fb_mouse))
- {
- g_warning ("Mouse driver open failed");
- return FALSE;
- }
-
- gdk_fb_mouse->io =
- g_io_channel_unix_new (gdk_fb_mouse->fd);
- gdk_fb_mouse->io_tag =
- g_io_add_watch (gdk_fb_mouse->io,
- G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL,
- handle_mouse_io, gdk_fb_mouse);
-
- return TRUE;
-}
-
-void
-gdk_fb_mouse_close (void)
-{
- if (gdk_fb_mouse->io_tag)
- {
- g_source_remove (gdk_fb_mouse->io_tag);
- gdk_fb_mouse->io_tag = 0;
- }
-
- gdk_fb_mouse->dev->close(gdk_fb_mouse);
-
- if (gdk_fb_mouse->io)
- {
- g_io_channel_unref (gdk_fb_mouse->io);
- gdk_fb_mouse->io = NULL;
- }
-}
-
-static gboolean
-handle_mouse_io (GIOChannel *gioc,
- GIOCondition cond,
- gpointer data)
-{
- GdkFBMouse *mouse = (GdkFBMouse *)data;
- GdkFBMouseDevice *dev = mouse->dev;
- guchar *proto = dev->proto;
- gboolean got_motion;
- gint n, i;
-
- got_motion = FALSE;
-
- while (1)
- {
- n = read (mouse->fd, mouse->mouse_packet + mouse->packet_nbytes, dev->packet_size - mouse->packet_nbytes);
- if (n<=0) /* error or nothing to read */
- break;
-
- /* we just read in what should be the first byte of a packet */
- if (mouse->packet_nbytes == 0)
- {
- /* check to see if we have the first byte of a packet.
- * if not, throw it away */
- while ((mouse->mouse_packet[0] & proto[0]) != proto[1] && n > 0)
- {
- for (i = 1; i < n; i++)
- mouse->mouse_packet[i-1] = mouse->mouse_packet[i];
- n--;
- }
- /* if none of the bytes read were packet starts, break */
- if (n <= 0)
- break;
- }
-
- mouse->packet_nbytes += n;
-
- if (mouse->packet_nbytes == dev->packet_size)
- {
- if (dev->parse_packet (mouse, &got_motion))
- mouse->packet_nbytes = 0;
- }
- }
-
- if (got_motion)
- handle_mouse_movement (mouse);
-
- return TRUE;
-}
-
-static gint
-gdk_fb_mouse_dev_open (char *devname, gint mode)
-{
- gint fd;
-
- /* Use nonblocking mode to open, to not hang on device */
- fd = open (devname, mode | O_NONBLOCK);
- return fd;
-}
-
-static gboolean
-write_all (gint fd,
- gchar *buf,
- gsize to_write)
-{
- while (to_write > 0)
- {
- gssize count = write (fd, buf, to_write);
- if (count < 0)
- {
- if (errno != EINTR)
- return FALSE;
- }
- else
- {
- to_write -= count;
- buf += count;
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-gdk_fb_mouse_ps2_open (GdkFBMouse *mouse)
-{
- gint fd;
- guchar buf[7];
- int i = 0;
-
- fd = gdk_fb_mouse_dev_open (mouse->file, O_RDWR);
- if (fd < 0)
- {
- g_print ("Error opening %s: %s\n", mouse->file, strerror (errno));
- return FALSE;
- }
-
- /* From xf86_Mouse.c */
- buf[i++] = 230; /* 1:1 scaling */
- buf[i++] = 244; /* enable mouse */
- buf[i++] = 243; /* Sample rate */
- buf[i++] = 200;
- buf[i++] = 232; /* device resolution */
- buf[i++] = 1;
-
- if (!write_all (fd, buf, i))
- {
- close (fd);
- return FALSE;
- }
-
- usleep (10000); /* sleep 10 ms, then read whatever junk we can get from the mouse, in a vain attempt
- to get synchronized with the event stream */
-
- while ((i = read (fd, buf, sizeof(buf))) > 0)
- g_print ("Got %d bytes of junk from psaux\n", i);
-
- mouse->fd = fd;
- return TRUE;
-}
-
-static gboolean
-gdk_fb_mouse_imps2_open (GdkFBMouse *mouse)
-{
- gint fd;
- guchar buf[7];
- int i = 0;
-
- fd = gdk_fb_mouse_dev_open (mouse->file, O_RDWR);
- if (fd < 0)
- {
- g_print ("Error opening %s: %s\n", mouse->file, strerror (errno));
- return FALSE;
- }
-
- i = 0;
- buf[i++] = 243; /* Sample rate */
- buf[i++] = 200;
- buf[i++] = 243; /* Sample rate */
- buf[i++] = 100;
- buf[i++] = 243; /* Sample rate */
- buf[i++] = 80;
- buf[i++] = 242;
-
- if (!write_all (fd, buf, i))
- {
- close (fd);
- return FALSE;
- }
-
- if (read (fd, buf, 1) != 1)
- {
- close (fd);
- return FALSE;
- }
-
- i = 0;
- buf[i++] = 230; /* 1:1 scaling */
- buf[i++] = 244; /* enable mouse */
- buf[i++] = 243; /* Sample rate */
- buf[i++] = 100;
- buf[i++] = 232; /* device resolution */
- buf[i++] = 3;
-
- if (!write_all (fd, buf, i))
- {
- close (fd);
- return FALSE;
- }
-
- mouse->fd = fd;
- return TRUE;
-}
-
-static void
-gdk_fb_mouse_ps2_close (GdkFBMouse *mouse)
-{
- close (mouse->fd);
- mouse->fd = -1;
-}
-
-static gboolean
-gdk_fb_mouse_ps2_packet (GdkFBMouse *mouse, gboolean *got_motion)
-{
- int dx=0, dy=0;
- gboolean new_button1, new_button2, new_button3;
- guchar *buf;
-
- buf = mouse->mouse_packet;
-
- new_button1 = (buf[0] & 1) && 1;
- new_button3 = (buf[0] & 2) && 1;
- new_button2 = (buf[0] & 4) && 1;
- if (mouse->dev->packet_size == 4 && buf[3] != 0)
- handle_mouse_scroll (mouse, buf[3] & 0x80);
-
- if (*got_motion &&
- (new_button1 != mouse->button_pressed[0] ||
- new_button2 != mouse->button_pressed[1] ||
- new_button3 != mouse->button_pressed[2]))
- {
- /* If a mouse button state changes we need to get correct ordering with enter/leave events,
- so push those out via handle_mouse_input */
- *got_motion = FALSE;
- handle_mouse_movement (mouse);
- }
-
- if (new_button1 != mouse->button_pressed[0])
- {
- mouse->button_pressed[0] = new_button1;
- send_button_event (mouse, 1, new_button1);
- }
-
- if (new_button2 != mouse->button_pressed[1])
- {
- mouse->button_pressed[1] = new_button2;
- send_button_event (mouse, 2, new_button2);
- }
-
- if (new_button3 != mouse->button_pressed[2])
- {
- mouse->button_pressed[2] = new_button3;
- send_button_event (mouse, 3, new_button3);
- }
-
- if (buf[1] != 0)
- dx = ((buf[0] & 0x10) ? ((gint)buf[1])-256 : buf[1]);
- else
- dx = 0;
- if (buf[2] != 0)
- dy = -((buf[0] & 0x20) ? ((gint)buf[2])-256 : buf[2]);
- else
- dy = 0;
-
- mouse->x += dx;
- mouse->y += dy;
-
- if (dx || dy)
- *got_motion = TRUE;
-
- return TRUE;
-}
-
-
-static gboolean
-gdk_fb_mouse_ms_open (GdkFBMouse *mouse)
-{
- gint fd;
- gint i;
- guchar buf[7];
- struct termios tty;
-
- fd = gdk_fb_mouse_dev_open (mouse->file, O_RDWR);
- if (fd < 0)
- {
- g_print ("Error opening %s: %s\n", mouse->file, strerror (errno));
- return FALSE;
- }
-
- while ((i = read (fd, buf, sizeof(buf))) > 0)
- g_print ("Got %d bytes of junk from %s\n", i, mouse->file);
-
- tcgetattr (fd, &tty);
- tty.c_iflag = IGNBRK | IGNPAR;
- tty.c_cflag = CREAD|CLOCAL|HUPCL|CS7|B1200;
- tty.c_oflag = 0;
- tty.c_lflag = 0;
- tty.c_line = 0;
- tty.c_cc[VTIME] = 0;
- tty.c_cc[VMIN] = 1;
- tcsetattr (fd, TCSAFLUSH, &tty);
-
- if (!write_all (fd, "*n", 2))
- {
- close (fd);
- return FALSE;
- }
-
- mouse->fd = fd;
- return TRUE;
-}
-
-static void
-gdk_fb_mouse_ms_close (GdkFBMouse *mouse)
-{
- close (mouse->fd);
- mouse->fd = -1;
-}
-
-static gboolean
-gdk_fb_mouse_ms_packet (GdkFBMouse *mouse,
- gboolean *got_motion)
-{
- int dx=0, dy=0;
- gboolean new_button1, new_button2, new_button3;
- guchar *buf;
- static guchar prev = 0;
-
- buf = mouse->mouse_packet;
-
- /* handling of third button is adapted from gpm ms driver */
- if (buf[0] == 0x40 && !(prev|buf[1]|buf[2]))
- {
- new_button1 = 0;
- new_button2 = 1;
- new_button3 = 0;
- }
- else
- {
- new_button1 = (buf[0] & 0x20) && 1;
- new_button2 = 0;
- new_button3 = (buf[0] & 0x10) && 1;
- }
- prev = (new_button1 << 2) | (new_button2 << 1) | (new_button3 << 0);
-
- if (*got_motion &&
- (new_button1 != mouse->button_pressed[0] ||
- new_button2 != mouse->button_pressed[1] ||
- new_button3 != mouse->button_pressed[2]))
- {
- /* If a mouse button state changes we need to get correct ordering with enter/leave events,
- so push those out via handle_mouse_input */
- *got_motion = FALSE;
- handle_mouse_movement (mouse);
- }
-
- if (new_button1 != mouse->button_pressed[0])
- {
- mouse->button_pressed[0] = new_button1;
- send_button_event (mouse, 1, new_button1);
- }
-
- if (new_button2 != mouse->button_pressed[1])
- {
- mouse->button_pressed[1] = new_button2;
- send_button_event (mouse, 2, new_button2);
- }
-
- if (new_button3 != mouse->button_pressed[2])
- {
- mouse->button_pressed[2] = new_button3;
- send_button_event (mouse, 3, new_button3);
- }
-
- dx = (signed char)(((buf[0] & 0x03) << 6) | (buf[1] & 0x3F));
- dy = (signed char)(((buf[0] & 0x0C) << 4) | (buf[2] & 0x3F));
-
- mouse->x += dx;
- mouse->y += dy;
-
- if (dx || dy)
- *got_motion = TRUE;
-
- return TRUE;
-}
-
-static gboolean
-gdk_fb_mouse_fidmour_open (GdkFBMouse *mouse)
-{
- gint fd;
-
- fd = gdk_fb_mouse_dev_open (mouse->file, O_RDONLY);
- if (fd < 0)
- {
- g_print ("Error opening %s: %s\n", mouse->file, strerror (errno));
- return FALSE;
- }
-
- mouse->fd = fd;
- return TRUE;
-}
-
-static void
-gdk_fb_mouse_fidmour_close (GdkFBMouse *mouse)
-{
- close (mouse->fd);
-}
-
-static gboolean
-gdk_fb_mouse_fidmour_packet (GdkFBMouse *mouse,
- gboolean *got_motion)
-{
- int n;
- gboolean btn_down = 0;
- gdouble x = 0.0, y = 0.0;
-
- n = 0;
- if (!(mouse->mouse_packet[0] & 0x80))
- {
- int i;
- /* We haven't received any of the packet yet but there is no header at the beginning */
- for (i = 1; i < mouse->packet_nbytes; i++)
- {
- if (mouse->mouse_packet[i] & 0x80)
- {
- n = i;
- break;
- }
- }
- }
- else if (mouse->packet_nbytes > 1 &&
- ((mouse->mouse_packet[0] & 0x90) == 0x90))
- {
- /* eat the 0x90 and following byte, no clue what it's for */
- n = 2;
- }
- else
- {
- switch (mouse->mouse_packet[0] & 0xF)
- {
- case 2:
- btn_down = 0;
- break;
- case 1:
- case 0:
- btn_down = 1;
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- x = mouse->mouse_packet[1] + (mouse->mouse_packet[2] << 7);
- if (x > 8192)
- x -= 16384;
- y = mouse->mouse_packet[3] + (mouse->mouse_packet[4] << 7);
- if (y > 8192)
- y -= 16384;
- /* Now map touchscreen coords to screen coords */
- x *= ((double)gdk_display->fb_width)/4096.0;
- y *= ((double)gdk_display->fb_height)/4096.0;
- }
-
- if (n)
- {
- memmove (mouse->mouse_packet, mouse->mouse_packet+n, mouse->packet_nbytes-n);
- mouse->packet_nbytes -= n;
- return FALSE;
- }
-
- if (btn_down != mouse->button_pressed[0])
- {
- if (*got_motion)
- {
- /* If a mouse button state changes we need to get correct
- ordering with enter/leave events, so push those out
- via handle_mouse_input */
- *got_motion = FALSE;
- handle_mouse_movement (mouse);
- }
-
- mouse->button_pressed[0] = btn_down;
- send_button_event (mouse, 1, btn_down);
- }
-
- if (fabs(x - mouse->x) >= 1.0 || fabs(x - mouse->y) >= 1.0)
- {
- *got_motion = TRUE;
- mouse->x = x;
- mouse->y = y;
- }
-
- return TRUE;
-}
diff --git a/gdk/linux-fb/gdkpango-fb.c b/gdk/linux-fb/gdkpango-fb.c
deleted file mode 100644
index 7ba6bffbc..000000000
--- a/gdk/linux-fb/gdkpango-fb.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2000 Elliot Lee
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <glib.h>
-#include "gdkprivate-fb.h"
-#include "gdkpango.h"
-
-#include <pango/pangoft2.h>
-
-PangoContext *
-gdk_pango_context_get_for_screen (GdkScreen *screen)
-{
- return pango_ft2_get_context (75.0, 75.0);
-}
diff --git a/gdk/linux-fb/gdkpixmap-fb.c b/gdk/linux-fb/gdkpixmap-fb.c
deleted file mode 100644
index 00b58c4b4..000000000
--- a/gdk/linux-fb/gdkpixmap-fb.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-/* Needed for SEEK_END in SunOS */
-#include <unistd.h>
-
-#include "gdkpixmap.h"
-#include "gdkfb.h"
-#include "gdkprivate-fb.h"
-
-typedef struct
-{
- gchar *color_string;
- GdkColor color;
- gint transparent;
-} _GdkPixmapColor;
-
-typedef struct
-{
- guint ncolors;
- GdkColormap *colormap;
- gulong pixels[1];
-} _GdkPixmapInfo;
-
-static gpointer parent_class = NULL;
-
-static void
-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->mem = NULL;
- private->width = 1;
- private->height = 1;
-}
-
-static void
-gdk_pixmap_impl_fb_finalize (GObject *object)
-{
- g_free (GDK_DRAWABLE_FBDATA (object)->mem);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gdk_pixmap_impl_fb_class_init (GdkPixmapFBClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- /* GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); */
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_pixmap_impl_fb_finalize;
-}
-
-GType
-_gdk_pixmap_impl_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (GdkPixmapFBClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_pixmap_impl_fb_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkPixmapFBData),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gdk_pixmap_impl_fb_init
- };
-
- object_type = g_type_register_static (gdk_drawable_impl_fb_get_type(),
- "GdkPixmapFB",
- &object_info,
- 0);
- }
-
- return object_type;
-}
-
-GdkPixmap*
-gdk_pixmap_new (GdkDrawable *window,
- gint width,
- gint height,
- gint depth)
-{
- GdkPixmap *pixmap;
- GdkDrawableFBData *private;
-
- g_return_val_if_fail (window == NULL || GDK_IS_DRAWABLE (window), NULL);
- g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
- g_return_val_if_fail ((width != 0) && (height != 0), NULL);
-
- if (!window)
- window = _gdk_parent_root;
-
- 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);
- private->rowstride = (width * depth + 7) / 8; /* Round up to nearest whole byte */
- private->mem = g_malloc (private->rowstride * height);
- private->abs_x = 0;
- private->abs_y = 0;
- private->llim_x = 0;
- private->llim_y = 0;
- private->lim_x = width;
- private->lim_y = height;
- private->width = width;
- private->height = height;
- private->depth = ((GdkPixmapObject *)pixmap)->depth = depth;
-
- return pixmap;
-}
-
-GdkPixmap *
-gdk_bitmap_create_from_data (GdkDrawable *window,
- const gchar *data,
- gint width,
- gint height)
-{
- GdkPixmap *pixmap;
-
- g_return_val_if_fail (data != NULL, NULL);
- g_return_val_if_fail ((width != 0) && (height != 0), NULL);
- g_return_val_if_fail (window == NULL || GDK_IS_DRAWABLE (window), NULL);
-
- if (!window)
- window = _gdk_parent_root;
-
- pixmap = gdk_pixmap_new (window, width, height, 1);
-
- memcpy (GDK_DRAWABLE_IMPL_FBDATA (pixmap)->mem, data, ((width + 7) / 8) * height);
-
- return pixmap;
-}
-
-GdkPixmap*
-gdk_pixmap_create_from_data (GdkDrawable *window,
- const gchar *data,
- gint width,
- gint height,
- gint depth,
- const GdkColor *fg,
- const GdkColor *bg)
-{
- GdkPixmap *pixmap;
-
- g_return_val_if_fail (window == NULL || GDK_IS_DRAWABLE (window), NULL);
- g_return_val_if_fail (data != NULL, NULL);
- g_return_val_if_fail (fg != NULL, NULL);
- g_return_val_if_fail (bg != NULL, NULL);
- g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
- g_return_val_if_fail ((width != 0) && (height != 0), NULL);
-
- if (!window)
- window = _gdk_parent_root;
-
- if (depth == -1)
- depth = gdk_drawable_get_visual (window)->depth;
-
- pixmap = gdk_pixmap_new (window, width, height, depth);
-
- memcpy (GDK_DRAWABLE_IMPL_FBDATA (pixmap)->mem, data, height * GDK_DRAWABLE_IMPL_FBDATA (pixmap)->rowstride);
-
- return pixmap;
-}
-
-GdkPixmap*
-gdk_pixmap_foreign_new (GdkNativeWindow anid)
-{
- return (GdkPixmap*) gdk_drawable_ref ((GdkDrawable *)anid);
-}
-
-GdkPixmap*
-gdk_pixmap_lookup (GdkNativeWindow anid)
-{
- return (GdkPixmap*) (anid);
-}
-
diff --git a/gdk/linux-fb/gdkprivate-fb.h b/gdk/linux-fb/gdkprivate-fb.h
deleted file mode 100644
index 4466ffcb7..000000000
--- a/gdk/linux-fb/gdkprivate-fb.h
+++ /dev/null
@@ -1,471 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-/*
- * Private uninstalled header defining things local to X windowing code
- */
-
-#ifndef __GDK_PRIVATE_FB_H__
-#define __GDK_PRIVATE_FB_H__
-
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkinternals.h>
-#include <gdk/gdk.h>
-#include "gdkfb.h"
-#include "gdkregion-generic.h"
-#include <linux/fb.h>
-#include <stdio.h>
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#define GDK_TYPE_DRAWABLE_IMPL_FBDATA (gdk_drawable_impl_fb_get_type ())
-#define GDK_DRAWABLE_IMPL_FBDATA(win) ((GdkDrawableFBData *)((GdkWindowObject *)(win))->impl)
-#define GDK_IS_DRAWABLE_IMPL_FBDATA(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE_IMPL_FBDATA))
-#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))
-#define GDK_FONT_FB(f) ((GdkFontPrivateFB *)(f))
-#define GDK_CURSOR_FB(c) ((GdkCursorPrivateFB *)(c))
-
-#define CHECK_IMPL_AND_INTF
-
-#ifdef CHECK_IMPL_AND_INTF
-#define GDK_CHECK_IMPL(drawable) \
- g_assert(G_OBJECT_TYPE(drawable) == _gdk_window_impl_get_type() || G_OBJECT_TYPE(drawable) == _gdk_pixmap_impl_get_type())
-#define GDK_CHECK_INTF(drawable) \
- g_assert(G_OBJECT_TYPE(drawable) == gdk_window_object_get_type() || G_OBJECT_TYPE(drawable) == gdk_pixmap_get_type())
-#else
-#define GDK_CHECK_IMPL(drawable)
-#define GDK_CHECK_INTF(drawable)
-#endif
-typedef struct _GdkDrawableFBData GdkDrawableFBData;
-typedef struct _GdkWindowFBData GdkWindowFBData;
-typedef struct _GdkPixmapFBData GdkPixmapFBData;
-typedef struct _GdkFBDrawingContext GdkFBDrawingContext;
-
-#define GDK_DRAWABLE_PIXMAP (GDK_WINDOW_FOREIGN+1)
-
-struct _GdkDrawableFBData
-{
- GdkDrawable parent_object;
-
- GdkDrawable *wrapper;
-
- guchar *mem;
-
- gint abs_x, abs_y, lim_x, lim_y, llim_x, llim_y; /* computed values */
-
- guint rowstride;
-
- /* Due to excursions in gdk, this stuff has to be stored here
- instead of in GdkDrawable where it belongs */
- gint width, height, depth;
- GdkColormap *colormap;
- GdkWindowType window_type;
-};
-
-typedef struct {
- GdkDrawableClass base_class;
-} GdkDrawableFBClass;
-
-struct _GdkPixmapFBData
-{
- GdkDrawableFBData drawable_data;
-};
-
-typedef struct {
- GdkDrawableFBClass klass;
-} GdkPixmapFBClass;
-
-GType gdk_drawable_impl_fb_get_type (void) G_GNUC_CONST;
-
-typedef struct {
- gulong length;
- GdkAtom type;
- gint format;
- guchar data[1];
-} GdkWindowProperty;
-
-struct _GdkWindowFBData
-{
- GdkDrawableFBData drawable_data;
- GdkCursor *cursor;
- GHashTable *properties;
-
- GdkRegion *shape; /* Can also be GDK_FB_USE_CHILD_SHAPE */
-
- guint realized : 1;
-};
-
-typedef struct {
- GdkDrawableFBClass base_class;
-} GdkWindowFBClass;
-#define GDK_WINDOW_P(x) ((GdkWindowObject *)(x))
-
-struct _GdkFBDisplay
-{
- int tty_fd;
- int console_fd;
- int vt, start_vt;
-
- /* Used by rendering code: */
- guchar *fb_mem;
- gint fb_width; /* In pixels */
- gint fb_height; /* In pixels */
- gint fb_stride; /* In bytes */
-
- int fb_fd;
- guchar *fb_mmap;
- gpointer active_cmap;
- gulong mem_len;
- struct fb_fix_screeninfo sinfo;
- struct fb_var_screeninfo modeinfo;
- struct fb_var_screeninfo orig_modeinfo;
- int red_byte, green_byte, blue_byte; /* For truecolor */
-
- /* fb manager */
- int manager_fd;
- int manager_tag;
- int manager_blocked;
-};
-
-struct _GdkVisualClass
-{
- GObjectClass parent_class;
-};
-
-
-typedef struct {
- GHashTable *hash;
- GdkColorInfo *info;
- guint sync_tag;
-} GdkColormapPrivateFB;
-
-typedef struct {
- GdkCursor base;
- GdkPixmap *cursor, *mask;
- int hot_x, hot_y;
-} GdkCursorPrivateFB;
-
-/* Define this to emulate slow emulation of
- GdkFonts using PangoFont */
-#define EMULATE_GDKFONT
-
-typedef struct {
- GdkFontPrivate base;
-#ifdef EMULATE_GDKFONT
- /* For PangoFont emulation: */
- char *name;
- PangoFont *pango_font;
-#else
- /* For bogus GdkFonts: */
- int size;
-#endif
-} GdkFontPrivateFB;
-
-typedef struct {
- /* Empty */
-} GdkImagePrivateFB;
-
-#define GDK_GC_FBDATA(x) ((GdkGCFBData *)(x))
-#define GDK_GC_P(x) ((GdkGC *)(x))
-
-typedef enum {
- GPR_USED_BG,
- GPR_AA_GRAYVAL,
- GPR_NONE,
- GPR_ERR_BOUNDS
-} GetPixelRet;
-
-typedef enum {
- GDK_FB_SRC_BPP_1,
- GDK_FB_SRC_BPP_8,
- GDK_FB_SRC_BPP_16,
- GDK_FB_SRC_BPP_24,
- GDK_FB_SRC_BPP_32,
- GDK_FB_SRC_BPP_7_AA_GRAYVAL,
- GDK_FB_SRC_BPP_8_AA_GRAYVAL,
- GDK_NUM_FB_SRCBPP
-} GdkFbSrcBPP;
-
-typedef void gdk_fb_draw_drawable_func (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- GdkFBDrawingContext *dc,
- gint start_y,
- gint end_y,
- gint start_x,
- gint end_x,
- gint src_x_off,
- gint src_y_off,
- gint draw_direction);
-
-typedef struct {
- GdkGC parent_instance;
-
- gchar *dash_list;
- GdkGCValuesMask values_mask;
- GdkGCValues values;
- gint dash_offset;
- gushort dash_list_len;
- guchar alu;
-
- /* The GC can only be used with target drawables of
- * the same depth as the initial drawable
- * specified in gd_gc_new().
- */
- guchar depth;
-
- /* Calculated state: */
- /* These functions can only be called for drawables
- * that have the same depth as the gc.
- */
- void (*set_pixel) (GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- gulong pixel);
-
- GetPixelRet (*get_color) (GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- GdkColor *color);
-
- void (*fill_span) (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSpan *span,
- GdkColor *color);
-
- void (*fill_rectangle) (GdkDrawable *drawable,
- GdkGC *gc,
- GdkRectangle *rect,
- GdkColor *color);
-
- gdk_fb_draw_drawable_func *draw_drawable[GDK_NUM_FB_SRCBPP];
-} GdkGCFBData;
-
-typedef struct {
- GdkGCClass parent_class;
-} GdkGCFBClass;
-
-
-extern GdkGC *_gdk_fb_screen_gc;
-
-GType gdk_gc_fb_get_type (void) G_GNUC_CONST;
-
-void _gdk_selection_window_destroyed (GdkWindow *window);
-void gdk_window_invalidate_region_clear (GdkWindow *window,
- GdkRegion *region);
-void gdk_window_invalidate_rect_clear (GdkWindow *window,
- GdkRectangle *rect);
-void gdk_fb_window_send_crossing_events (GdkWindow *src,
- GdkWindow *dest,
- GdkCrossingMode mode);
-void gdk_fb_window_move_resize (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height,
- gboolean send_expose_events);
-GdkWindow *gdk_fb_window_find_focus (void);
-GdkRegion *gdk_fb_window_get_abs_shape (GdkDrawable *window);
-GdkRegion *gdk_fb_window_peek_shape (GdkDrawable *window,
- gint *dx,
- gint *dy);
-GdkGC * _gdk_fb_gc_new (GdkDrawable *drawable,
- GdkGCValues *values,
- GdkGCValuesMask values_mask);
-
-#define _GDK_FB_GC_DEPTH (1<<31)
-void _gdk_fb_gc_calc_state (GdkGC *gc,
- GdkGCValuesMask changed);
-
-GdkImage *_gdk_fb_copy_to_image (GdkDrawable *drawable,
- GdkImage *image,
- gint src_x,
- gint src_y,
- gint dest_x,
- gint dest_y,
- gint width,
- gint height);
-void gdk_fb_drawable_clear (GdkDrawable *drawable);
-void gdk_fb_draw_drawable (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-
-struct _GdkFBDrawingContext {
- GdkWindow *bg_relto;
- GdkPixmap *bgpm;
-
- GdkRegion *real_clip_region;
-
- guchar *mem, *clipmem;
- gpointer cursor_dc;
-
- guint rowstride, clip_rowstride;
- int clipxoff, clipyoff;
-
- guint draw_bg : 1;
- guint copy_region : 1;
- guint handle_cursor : 1;
-};
-
-void gdk_fb_drawing_context_init (GdkFBDrawingContext *dc,
- GdkDrawable *drawable,
- GdkGC *gc,
- gboolean draw_bg,
- gboolean do_clipping);
-void gdk_fb_drawing_context_finalize (GdkFBDrawingContext *dc);
-void gdk_fb_draw_drawable_3 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- GdkFBDrawingContext *dc,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-void gdk_fb_draw_drawable_2 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height,
- gboolean draw_bg,
- gboolean do_clipping);
-void gdk_fb_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height);
-void gdk_fb_fill_spans (GdkDrawable *real_drawable,
- GdkGC *gc,
- GdkSpan *spans,
- int nspans,
- gboolean sorted);
-GdkRegion *gdk_fb_clip_region (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean do_clipping,
- gboolean do_children,
- gboolean full_shapes);
-
-
-GdkGrabStatus gdk_fb_pointer_grab (GdkWindow *window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow *confine_to,
- GdkCursor *cursor,
- guint32 time,
- gboolean implicit_grab);
-void gdk_fb_pointer_ungrab (guint32 time,
- gboolean implicit_grab);
-
-guint32 gdk_fb_get_time (void);
-
-void gdk_shadow_fb_update (gint minx,
- gint miny,
- gint maxx,
- gint maxy);
-void gdk_shadow_fb_init (void);
-void gdk_shadow_fb_stop_updates (void);
-void gdk_fb_recompute_all (void);
-
-extern GdkAtom _gdk_selection_property;
-
-extern GdkFBAngle _gdk_fb_screen_angle;
-
-/* Pointer grab info */
-extern GdkWindow *_gdk_fb_pointer_grab_window;
-extern gboolean _gdk_fb_pointer_grab_owner_events;
-extern GdkWindow *_gdk_fb_pointer_grab_confine;
-extern GdkEventMask _gdk_fb_pointer_grab_events;
-extern GdkCursor *_gdk_fb_pointer_grab_cursor;
-/* Keyboard grab info */
-extern GdkWindow *_gdk_fb_keyboard_grab_window;
-extern GdkEventMask _gdk_fb_keyboard_grab_events;
-extern gboolean _gdk_fb_keyboard_grab_owner_events;
-
-extern GdkFBDisplay *gdk_display;
-extern GdkDisplay *_gdk_display;
-extern GdkScreen *_gdk_screen;
-
-extern volatile gboolean _gdk_fb_is_active_vt;
-
-GdkEvent *gdk_event_make(GdkWindow *window,
- GdkEventType type,
- gboolean append_to_queue);
-GdkWindow * gdk_fb_pointer_event_window (GdkWindow *window,
- GdkEventType type);
-GdkWindow *gdk_fb_keyboard_event_window (GdkWindow *window,
- GdkEventType type);
-GdkWindow *gdk_fb_other_event_window (GdkWindow *window,
- GdkEventType type);
-
-void gdk_fb_get_cursor_rect(GdkRectangle *rect);
-gboolean gdk_fb_cursor_need_hide(GdkRectangle *rect);
-gboolean gdk_fb_cursor_region_need_hide(GdkRegion *region);
-void gdk_fb_cursor_unhide(void);
-void gdk_fb_cursor_reset(void);
-void gdk_fb_cursor_hide(void);
-void gdk_fb_redraw_all(void);
-void gdk_fb_cursor_move (gint x, gint y, GdkWindow *in_window);
-
-guint gdk_fb_keyboard_modifiers (void);
-gboolean gdk_fb_keyboard_init (gboolean open_dev);
-gboolean gdk_fb_keyboard_open (void);
-void gdk_fb_keyboard_close (void);
-gboolean gdk_fb_mouse_init (gboolean open_dev);
-gboolean gdk_fb_mouse_open (void);
-void gdk_fb_mouse_close (void);
-void gdk_fb_mouse_get_info (gint *x,
- gint *y,
- GdkModifierType *mask);
-
-/* Initialization */
-void _gdk_windowing_window_init (void);
-void _gdk_visual_init (void);
-void _gdk_dnd_init (void);
-void _gdk_windowing_image_init (void);
-void _gdk_events_init (void);
-void _gdk_input_init (void);
-
-#endif /* __GDK_PRIVATE_FB_H__ */
diff --git a/gdk/linux-fb/gdkproperty-fb.c b/gdk/linux-fb/gdkproperty-fb.c
deleted file mode 100644
index 3c7ebc5e1..000000000
--- a/gdk/linux-fb/gdkproperty-fb.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <string.h>
-#include <time.h>
-
-#include "gdkfb.h"
-#include "gdkproperty.h"
-#include "gdkprivate.h"
-#include "gdkprivate-fb.h"
-
-GdkAtom
-gdk_atom_intern (const gchar *atom_name,
- gboolean only_if_exists)
-{
- g_return_val_if_fail (atom_name != NULL, GDK_NONE);
-
- if (strcmp (atom_name, "PRIMARY") == 0)
- return GDK_SELECTION_PRIMARY;
- else if (strcmp (atom_name, "SECONDARY") == 0)
- return GDK_SELECTION_SECONDARY;
- else if (strcmp (atom_name, "CLIPBOARD") == 0)
- return GDK_SELECTION_CLIPBOARD;
- else if (strcmp (atom_name, "ATOM") == 0)
- return GDK_SELECTION_TYPE_ATOM;
- else if (strcmp (atom_name, "BITMAP") == 0)
- return GDK_SELECTION_TYPE_BITMAP;
- else if (strcmp (atom_name, "COLORMAP") == 0)
- return GDK_SELECTION_TYPE_COLORMAP;
- else if (strcmp (atom_name, "DRAWABLE") == 0)
- return GDK_SELECTION_TYPE_DRAWABLE;
- else if (strcmp (atom_name, "INTEGER") == 0)
- return GDK_SELECTION_TYPE_INTEGER;
- else if (strcmp (atom_name, "PIXMAP") == 0)
- return GDK_SELECTION_TYPE_PIXMAP;
- else if (strcmp (atom_name, "WINDOW") == 0)
- return GDK_SELECTION_TYPE_WINDOW;
- else if (strcmp (atom_name, "STRING") == 0)
- return GDK_SELECTION_TYPE_STRING;
- else
- return GUINT_TO_POINTER (256 + g_quark_from_string (atom_name));
-}
-
-gchar*
-gdk_atom_name (GdkAtom atom)
-{
- if (GPOINTER_TO_UINT (atom) < 256)
- {
-
- switch (GPOINTER_TO_UINT (atom))
- {
- case GPOINTER_TO_UINT (GDK_SELECTION_PRIMARY):
- return g_strdup ("PRIMARY");
- case GPOINTER_TO_UINT (GDK_SELECTION_SECONDARY):
- return g_strdup ("SECONDARY");
- case GPOINTER_TO_UINT (GDK_SELECTION_CLIPBOARD):
- return g_strdup ("CLIPBOARD");
- case GPOINTER_TO_UINT (GDK_SELECTION_TYPE_ATOM):
- return g_strdup ("ATOM");
- case GPOINTER_TO_UINT (GDK_SELECTION_TYPE_BITMAP):
- return g_strdup ("BITMAP");
- case GPOINTER_TO_UINT (GDK_SELECTION_TYPE_COLORMAP):
- return g_strdup ("COLORMAP");
- case GPOINTER_TO_UINT (GDK_SELECTION_TYPE_DRAWABLE):
- return g_strdup ("DRAWABLE");
- case GPOINTER_TO_UINT (GDK_SELECTION_TYPE_INTEGER):
- return g_strdup ("INTEGER");
- case GPOINTER_TO_UINT (GDK_SELECTION_TYPE_PIXMAP):
- return g_strdup ("PIXMAP");
- case GPOINTER_TO_UINT (GDK_SELECTION_TYPE_WINDOW):
- return g_strdup ("WINDOW");
- case GPOINTER_TO_UINT (GDK_SELECTION_TYPE_STRING):
- return g_strdup ("STRING");
- default:
- g_warning (G_STRLOC "Invalid atom");
- return g_strdup ("<invalid>");
- }
- }
- else
- return g_strdup (g_quark_to_string (GPOINTER_TO_UINT (atom) - 256));
-}
-
-static void
-gdk_property_delete_2 (GdkWindow *window,
- GdkAtom property,
- GdkWindowProperty *prop)
-{
- GdkWindowFBData *fbd = GDK_WINDOW_IMPL_FBDATA(window);
- GdkEvent *event;
- GdkWindow *event_window;
-
- g_hash_table_remove (fbd->properties, GUINT_TO_POINTER (property));
- g_free (prop);
-
- event_window = gdk_fb_other_event_window (window, GDK_PROPERTY_NOTIFY);
- if (event_window)
- {
- event = gdk_event_make (event_window, GDK_PROPERTY_NOTIFY, TRUE);
- event->property.atom = property;
- event->property.state = GDK_PROPERTY_DELETE;
- }
-}
-
-void
-gdk_property_delete (GdkWindow *window,
- GdkAtom property)
-{
- 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)
- return;
-
- prop = g_hash_table_lookup (fbd->properties, GUINT_TO_POINTER(property));
- if (!prop)
- return;
-
- gdk_property_delete_2 (window, property, prop);
-}
-
-gint
-gdk_property_get (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gulong offset,
- gulong length,
- gint pdelete,
- GdkAtom *actual_property_type,
- gint *actual_format_type,
- gint *actual_length,
- guchar **data)
-{
- GdkWindowFBData *fbd = GDK_WINDOW_FBDATA (window);
- GdkWindowProperty *prop;
- int nbytes;
-
- g_return_val_if_fail (window != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
- g_return_val_if_fail (actual_length != NULL, FALSE);
- g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
-
- if (!fbd->properties)
- return FALSE;
-
- 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)
- {
- *data = g_malloc (nbytes+1);
- memcpy (*data, prop->data + offset, nbytes);
- (*data)[nbytes] = 0;
- }
- else
- *data = NULL;
- *actual_length = nbytes / (prop->format >> 3);
- *actual_property_type = prop->type;
- *actual_format_type = prop->format;
-
- if (pdelete)
- gdk_property_delete_2 (window, property, prop);
-
- return TRUE;
-}
-
-void
-gdk_property_change (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gint format,
- GdkPropMode mode,
- const guchar *data,
- gint nelements)
-{
- GdkWindowFBData *fbd = GDK_WINDOW_FBDATA (window);
- GdkWindowProperty *prop, *new_prop;
- int new_size = 0;
- GdkEvent *event;
- GdkWindow *event_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);
-
- prop = g_hash_table_lookup (fbd->properties, GUINT_TO_POINTER (property));
-
- switch(mode)
- {
- case GDK_PROP_MODE_REPLACE:
- new_size = nelements * (format >> 3);
- break;
- case GDK_PROP_MODE_PREPEND:
- case GDK_PROP_MODE_APPEND:
- new_size = nelements * (format >> 3);
- if (prop)
- new_size += prop->length;
- default:
- break;
- }
-
- 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)
- {
- case GDK_PROP_MODE_REPLACE:
- 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)));
- 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);
- break;
- }
-
- g_hash_table_insert (fbd->properties, GUINT_TO_POINTER (property), new_prop);
- g_free (prop);
-
- event_window = gdk_fb_other_event_window (window, GDK_PROPERTY_NOTIFY);
- if (event_window)
- {
- event = gdk_event_make (event_window, GDK_PROPERTY_NOTIFY, TRUE);
- event->property.atom = property;
- event->property.state = GDK_PROPERTY_NEW_VALUE;
- }
-}
diff --git a/gdk/linux-fb/gdkrender-fb.c b/gdk/linux-fb/gdkrender-fb.c
deleted file mode 100644
index eec62907c..000000000
--- a/gdk/linux-fb/gdkrender-fb.c
+++ /dev/null
@@ -1,1549 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2000 Alexander Larsson
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include "gdkprivate-fb.h"
-#include <string.h>
-#include <signal.h>
-#include <sys/time.h>
-
-/*
- * Reading pixel values from a generic drawable.
- */
-
-static GetPixelRet
-gdk_fb_drawable_get_color (GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- GdkColor *spot)
-{
- GetPixelRet retval = GPR_NONE;
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- guchar *mem = private->mem;
- guint rowstride = private->rowstride;
-
- switch (private->depth)
- {
- case 1:
- {
- guchar foo = mem[(x >> 3) + y * rowstride];
- if (foo & (1 << (x % 8)))
- *spot = GDK_GC_FBDATA (gc)->values.foreground;
- else
- {
- retval = GPR_USED_BG;
- *spot = GDK_GC_FBDATA (gc)->values.background;
- }
- }
- break;
- case 71:
- if (mem[x + y * rowstride])
- *spot = GDK_GC_FBDATA (gc)->values.foreground;
- else
- *spot = GDK_GC_FBDATA (gc)->values.background;
- break;
- case 77:
- retval = GPR_AA_GRAYVAL;
- spot->pixel = mem[x + y * rowstride] << 1;
- spot->red = spot->green = spot->blue = spot->pixel << 8;
- break;
- case 78: /* AA mode */
- retval = GPR_AA_GRAYVAL;
- spot->pixel = mem[x + y * rowstride];
- spot->red = spot->green = spot->blue = spot->pixel << 8;
- break;
- case 8:
- spot->pixel = mem[x + y * rowstride];
- *spot = private->colormap->colors[spot->pixel];
- break;
- case 16:
- {
- guint16 val16 = *((guint16 *)&mem[x*2 + y*rowstride]);
-
- spot->red = (((1<<gdk_display->modeinfo.red.length) - 1) & (val16 >> gdk_display->modeinfo.red.offset)) << (16 - gdk_display->modeinfo.red.length);
- spot->green = (((1<<gdk_display->modeinfo.green.length) - 1) & (val16 >> gdk_display->modeinfo.green.offset)) << (16 - gdk_display->modeinfo.green.length);
- spot->blue = (((1<<gdk_display->modeinfo.blue.length) - 1) & (val16 >> gdk_display->modeinfo.blue.offset)) << (16 - gdk_display->modeinfo.blue.length);
-
- spot->pixel = val16;
- }
- break;
- case 24:
- {
- guchar *smem = &mem[x*3 + y*rowstride];
- spot->red = smem[gdk_display->red_byte] << 8;
- spot->green = smem[gdk_display->green_byte] << 8;
- spot->blue = smem[gdk_display->blue_byte] << 8;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- spot->pixel = (smem[0]<<16)|(smem[1]<<8)|smem[2];
-#else
- spot->pixel = smem[0]|(smem[1]<<8)|(smem[2]<<16);
-#endif
- }
- break;
- case 32:
- {
- guchar *smem = &mem[x*4 + y*rowstride];
- spot->red = smem[gdk_display->red_byte] << 8;
- spot->green = smem[gdk_display->green_byte] << 8;
- spot->blue = smem[gdk_display->blue_byte] << 8;
- spot->pixel = *(guint32 *)smem;
- }
- break;
- }
-
- return retval;
-}
-
-/*************************************
- * gc->get_color() implementations
- *************************************/
-
-static GetPixelRet
-gdk_fb_get_color_1 (GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- GdkColor *color)
-{
- GetPixelRet retval = GPR_NONE;
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- guchar *mem = private->mem;
- guint rowstride = private->rowstride;
- guchar foo;
-
- g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
-
- foo = mem[(x >> 3) + y * rowstride];
- if (foo & (1 << (x % 8)))
- *color = GDK_GC_FBDATA (gc)->values.foreground;
- else
- {
- retval = GPR_USED_BG;
-
- *color = GDK_GC_FBDATA (gc)->values.background;
- }
-
- return retval;
-}
-
-static GetPixelRet
-gdk_fb_get_color_8 (GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- GdkColor *color)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- guchar *mem = private->mem;
- guint rowstride = private->rowstride;
- gint pixel;
-
- g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
-
- pixel = mem[x + y * rowstride];
- *color = private->colormap->colors[pixel];
-
- return GPR_NONE;
-}
-
-static GetPixelRet
-gdk_fb_get_color_16 (GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- GdkColor *color)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- guchar *mem = private->mem;
- guint rowstride = private->rowstride;
- guint16 val16;
-
- g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
-
- val16 = *((guint16 *)&mem[x*2 + y*rowstride]);
-
- color->red = (((1<<gdk_display->modeinfo.red.length) - 1) & (val16 >> gdk_display->modeinfo.red.offset)) << (16 - gdk_display->modeinfo.red.length);
- color->green = (((1<<gdk_display->modeinfo.green.length) - 1) & (val16 >> gdk_display->modeinfo.green.offset)) << (16 - gdk_display->modeinfo.green.length);
- color->blue = (((1<<gdk_display->modeinfo.blue.length) - 1) & (val16 >> gdk_display->modeinfo.blue.offset)) << (16 - gdk_display->modeinfo.blue.length);
-
- color->pixel = val16;
-
- return GPR_NONE;
-}
-
-static GetPixelRet
-gdk_fb_get_color_24 (GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- GdkColor *color)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- guchar *mem = private->mem;
- guint rowstride = private->rowstride;
- guchar *smem;
-
- g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
-
- smem = &mem[x*3 + y*rowstride];
- color->red = smem[gdk_display->red_byte] << 8;
- color->green = smem[gdk_display->green_byte] << 8;
- color->blue = smem[gdk_display->blue_byte] << 8;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- color->pixel = (smem[0]<<16)|(smem[1]<<8)|smem[2];
-#else
- color->pixel = smem[0]|(smem[1]<<8)|(smem[2]<<16);
-#endif
-
- return GPR_NONE;
-}
-
-static GetPixelRet
-gdk_fb_get_color_32 (GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- GdkColor *color)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- guchar *mem = private->mem;
- guint rowstride = private->rowstride;
- guchar *smem;
-
- g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
-
- smem = &mem[x*4 + y*rowstride];
- color->red = smem[gdk_display->red_byte] << 8;
- color->green = smem[gdk_display->green_byte] << 8;
- color->blue = smem[gdk_display->blue_byte] << 8;
- color->pixel = *(guint32 *)smem;
-
- return GPR_NONE;
-}
-
-/*************************************
- * gc->set_pixel() implementations
- *************************************/
-
-static void
-gdk_fb_set_pixel_1(GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- gulong pixel)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- guchar *mem = private->mem;
- guint rowstride = private->rowstride;
- guchar *ptr;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
-
- ptr = mem + (y*rowstride) + (x >> 3);
-
- if (pixel)
- *ptr |= (1 << (x % 8));
- else
- *ptr &= ~(1 << (x % 8));
-}
-
-static void
-gdk_fb_set_pixel_8(GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- gulong pixel)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- guchar *mem = private->mem;
- guint rowstride = private->rowstride;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
-
- mem[x + y*rowstride] = pixel;
-}
-
-static void
-gdk_fb_set_pixel_16(GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- gulong pixel)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- guchar *mem = private->mem;
- guint rowstride = private->rowstride;
- guint16 *ptr;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
-
- ptr = (guint16 *)&mem[x*2 + y*rowstride];
- *ptr = pixel;
-}
-
-static void
-gdk_fb_set_pixel_24(GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- gulong pixel)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- guchar *mem = private->mem;
- guint rowstride = private->rowstride;
- guchar *smem;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
-
- smem = &mem[x*3 + y*rowstride];
- smem[0] = pixel & 0xff;
- smem[1] = (pixel >> 8) & 0xff;
- smem[2] = (pixel >> 16) & 0xff;
-}
-
-static void
-gdk_fb_set_pixel_32(GdkDrawable *drawable,
- GdkGC *gc,
- int x,
- int y,
- gulong pixel)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- guchar *mem = private->mem;
- guint rowstride = private->rowstride;
- guint32 *smem;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
-
- smem = (guint32 *)&mem[x*4 + y*rowstride];
- *smem = pixel;
-}
-
-
-/*************************************
- * gc->fill_span() implementations
- *************************************/
-
-static void
-gdk_fb_fill_span_generic (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSpan *span,
- GdkColor *color)
-{
- int curx;
- GdkColor spot = *color;
- GdkGCFBData *gc_private;
- GdkDrawableFBData *private;
- gint left, right, y;
- int clipxoff, clipyoff; /* Amounts to add to curx & cury to get x & y in clip mask */
- int tsxoff, tsyoff;
- GdkDrawable *cmask;
- guchar *clipmem;
- guint mask_rowstride;
- GdkPixmap *ts = NULL;
- GdkDrawableFBData *ts_private;
- gboolean solid_stipple;
- GdkFunction func;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- gc_private = GDK_GC_FBDATA (gc);
-
- g_assert (gc);
-
- y = span->y;
- left = span->x;
- right = span->x + span->width;
-
- func = gc_private->values.function;
-
- cmask = gc_private->values.clip_mask;
- clipxoff = clipyoff = tsxoff = tsyoff = 0;
- mask_rowstride = 0;
- solid_stipple = FALSE;
- clipmem = NULL;
-
- if (cmask)
- {
- GdkDrawableFBData *cmask_private;
-
- cmask_private = GDK_DRAWABLE_IMPL_FBDATA (cmask);
-
- clipmem = cmask_private->mem;
- clipxoff = cmask_private->abs_x - gc_private->values.clip_x_origin - private->abs_x;
- clipyoff = cmask_private->abs_y - gc_private->values.clip_y_origin - private->abs_y;
- mask_rowstride = cmask_private->rowstride;
- }
-
- if (gc_private->values.fill == GDK_TILED &&
- gc_private->values.tile)
- {
- gint xstep;
- gint relx, rely;
- int drawh;
- GdkFBDrawingContext *dc, dc_data;
-
- dc = &dc_data;
-
- gdk_fb_drawing_context_init (dc, drawable, gc, FALSE, TRUE);
-
- ts = gc_private->values.tile;
- ts_private = GDK_DRAWABLE_IMPL_FBDATA (ts);
-
- rely = y - private->abs_y;
- drawh = (rely - gc_private->values.ts_y_origin) % ts_private->height;
- if (drawh < 0)
- drawh += ts_private->height;
-
- for (curx = left; curx < right; curx += xstep)
- {
- int draww;
-
- relx = curx - private->abs_x;
-
- draww = (relx - gc_private->values.ts_x_origin) % ts_private->width;
- if (draww < 0)
- draww += ts_private->width;
-
- xstep = MIN (ts_private->width - draww, right - relx);
-
- gdk_fb_draw_drawable_3 (drawable, gc, GDK_DRAWABLE_IMPL (ts),
- dc,
- draww, drawh,
- relx, rely,
- xstep, 1);
- }
-
- gdk_fb_drawing_context_finalize (dc);
-
- return;
- }
- else if ((gc_private->values.fill == GDK_STIPPLED ||
- gc_private->values.fill == GDK_OPAQUE_STIPPLED) &&
- gc_private->values.stipple)
- {
- ts = gc_private->values.stipple;
- tsxoff = - GDK_DRAWABLE_IMPL_FBDATA (ts)->abs_x - gc_private->values.ts_x_origin - private->abs_x;
- tsyoff = - GDK_DRAWABLE_IMPL_FBDATA (ts)->abs_y - gc_private->values.ts_y_origin - private->abs_y;
- solid_stipple = (gc_private->values.fill == GDK_OPAQUE_STIPPLED);
- }
-
- for (curx = left; curx < right; curx++)
- {
- int maskx = curx+clipxoff, masky = y + clipyoff;
- guchar foo;
-
- if (cmask)
- {
- foo = clipmem[masky*mask_rowstride + (maskx >> 3)];
-
- if (!(foo & (1 << (maskx % 8))))
- continue;
- }
-
- if (func == GDK_INVERT)
- {
- (gc_private->get_color) (drawable, gc, curx, y, &spot);
- spot.pixel = ~spot.pixel;
- spot.red = ~spot.red;
- spot.green = ~spot.green;
- spot.blue = ~spot.blue;
- }
- else if (func == GDK_XOR)
- {
- (gc_private->get_color) (drawable, gc, curx, y, &spot);
- spot.pixel ^= gc_private->values.foreground.pixel;
- }
- else if (func != GDK_COPY)
- {
- g_warning ("Unsupported GdkFunction %d\n", func);
- }
- else if (ts)
- {
- int wid, hih;
-
- ts_private = GDK_DRAWABLE_IMPL_FBDATA (ts);
-
- wid = ts_private->width;
- hih = ts_private->height;
-
- maskx = (curx+tsxoff)%wid;
- masky = (y+tsyoff)%hih;
- if (maskx < 0)
- maskx += wid;
- if (masky < 0)
- masky += hih;
-
- foo = ts_private->mem[(maskx >> 3) + ts_private->rowstride*masky];
- if (foo & (1 << (maskx % 8)))
- {
- spot = gc_private->values.foreground;
- }
- else if (solid_stipple)
- {
- spot = gc_private->values.background;
- }
- else
- continue;
- }
-
- (gc_private->set_pixel) (drawable, gc, curx, y, spot.pixel);
- }
-}
-
-static void
-gdk_fb_fill_span_simple_1 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSpan *span,
- GdkColor *color)
-{
- int curx;
- GdkGCFBData *gc_private;
- GdkDrawableFBData *private;
- guchar *mem, *ptr;
- guint rowstride;
- gint left, right, y;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- gc_private = GDK_GC_FBDATA (gc);
-
- g_assert (gc);
-
- g_assert (!gc_private->values.clip_mask &&
- !gc_private->values.tile &&
- !gc_private->values.stipple &&
- gc_private->values.function != GDK_INVERT);
-
- y = span->y;
- left = span->x;
- right = span->x + span->width;
-
- mem = private->mem;
- rowstride = private->rowstride;
-
- {
- int fromx = MIN ((left+7)&(~7), right);
- int begn = fromx - left, begoff = left % 8, endn;
- guchar begmask, endmask;
- int body_end = right & ~7;
- int body_len = (body_end - fromx)/8;
-
- begmask = ((1 << (begn + begoff)) - 1)
- & ~((1 << (begoff)) - 1);
- endn = right - body_end;
- endmask = (1 << endn) - 1;
-
- ptr = mem + y*rowstride + (left >> 3);
-
- if (color->pixel)
- *ptr |= begmask;
- else
- *ptr &= ~begmask;
-
- curx = fromx;
-
- if (curx < right)
- {
- ptr = mem + y*rowstride + (curx >> 3);
- memset (ptr, color->pixel?0xFF:0, body_len);
-
- if (endn)
- {
- ptr = mem + y*rowstride + (body_end >> 3);
- if (color->pixel)
- *ptr |= endmask;
- else
- *ptr &= ~endmask;
- }
- }
- }
-}
-
-static void
-gdk_fb_fill_span_simple_8 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSpan *span,
- GdkColor *color)
-{
- GdkGCFBData *gc_private;
- GdkDrawableFBData *private;
- guchar *mem, *ptr;
- guint rowstride;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- gc_private = GDK_GC_FBDATA (gc);
-
- g_assert (gc);
-
- g_assert (!gc_private->values.clip_mask &&
- !gc_private->values.tile &&
- !gc_private->values.stipple &&
- gc_private->values.function != GDK_INVERT);
-
- mem = private->mem;
- rowstride = private->rowstride;
-
- ptr = mem + span->y*rowstride + span->x;
- memset (ptr, color->pixel, span->width);
-}
-
-static void
-gdk_fb_fill_span_simple_16 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSpan *span,
- GdkColor *color)
-{
- GdkGCFBData *gc_private;
- GdkDrawableFBData *private;
- guchar *mem;
- guint rowstride;
- guint16 *p16;
- int n;
- int i;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- gc_private = GDK_GC_FBDATA (gc);
-
- g_assert (gc);
-
- g_assert (!gc_private->values.clip_mask &&
- !gc_private->values.tile &&
- !gc_private->values.stipple &&
- gc_private->values.function != GDK_INVERT);
-
- mem = private->mem;
- rowstride = private->rowstride;
-
- n = span->width;
- p16 = (guint16 *)(mem + span->y * rowstride + span->x*2);
- for (i = 0; i < n; i++)
- *(p16++) = color->pixel;
-}
-
-static void
-gdk_fb_fill_span_simple_24 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSpan *span,
- GdkColor *color)
-{
- GdkGCFBData *gc_private;
- GdkDrawableFBData *private;
- guchar *mem, *ptr;
- guint rowstride;
- int n;
- guchar redval, greenval, blueval;
- guchar *firstline, *ptr_end;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- gc_private = GDK_GC_FBDATA (gc);
-
- g_assert (gc);
-
- g_assert (!gc_private->values.clip_mask &&
- !gc_private->values.tile &&
- !gc_private->values.stipple &&
- gc_private->values.function != GDK_INVERT);
-
- mem = private->mem;
- rowstride = private->rowstride;
-
- redval = color->red>>8;
- greenval = color->green>>8;
- blueval = color->blue>>8;
-
- n = span->width*3;
-
- firstline = ptr = mem + span->y * rowstride + span->x*3;
- ptr_end = ptr+n;
- while (ptr < ptr_end)
- {
- ptr[gdk_display->red_byte] = redval;
- ptr[gdk_display->green_byte] = greenval;
- ptr[gdk_display->blue_byte] = blueval;
- ptr += 3;
- }
-}
-
-static void
-gdk_fb_fill_span_simple_32 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSpan *span,
- GdkColor *color)
-{
- GdkGCFBData *gc_private;
- GdkDrawableFBData *private;
- guchar *mem;
- guint rowstride;
- guint32 *p32;
- int n;
- int i;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- gc_private = GDK_GC_FBDATA (gc);
-
- g_assert (gc);
-
- g_assert (!gc_private->values.clip_mask &&
- !gc_private->values.tile &&
- !gc_private->values.stipple &&
- gc_private->values.function != GDK_INVERT);
-
- mem = private->mem;
- rowstride = private->rowstride;
-
- n = span->width;
- p32 = (guint32 *)(mem + span->y * rowstride + span->x*4);
- for (i = 0; i < n; i++)
- *(p32++) = color->pixel;
-}
-
-
-/*************************************
- * gc->draw_drawable() implementations
- *************************************/
-
-static void
-gdk_fb_draw_drawable_generic (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- GdkFBDrawingContext *dc,
- gint start_y,
- gint end_y,
- gint start_x,
- gint end_x,
- gint src_x_off,
- gint src_y_off,
- gint draw_direction)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- int cur_x, cur_y;
-
- if (draw_direction < 0)
- {
- int tmp;
- tmp = start_y;
- start_y = end_y;
- end_y = tmp;
- start_y--;
- end_y--;
-
- tmp = start_x;
- start_x = end_x;
- end_x = tmp;
- start_x--;
- end_x--;
- }
-
- for (cur_y = start_y; cur_y != end_y; cur_y+=draw_direction)
- {
- for (cur_x = start_x; cur_x != end_x; cur_x+=draw_direction)
- {
- GdkColor spot;
-
- if (GDK_GC_FBDATA(gc)->values.clip_mask)
- {
- int maskx = cur_x + dc->clipxoff, masky = cur_y + dc->clipyoff;
- guchar foo;
-
- foo = dc->clipmem[masky*dc->clip_rowstride + (maskx >> 3)];
-
- if (!(foo & (1 << (maskx % 8))))
- continue;
- }
-
- switch (gdk_fb_drawable_get_color (src, gc, cur_x + src_x_off, cur_y + src_y_off, &spot))
- {
- case GPR_AA_GRAYVAL:
- {
- GdkColor realspot, fg;
- guint graylevel = spot.pixel;
- gint tmp;
-
- if (private->depth == 1)
- {
- if (spot.pixel > 192)
- spot = GDK_GC_FBDATA (gc)->values.foreground;
- else
- spot = GDK_GC_FBDATA (gc)->values.background;
- break;
- }
- else
- {
- if (graylevel >= 254)
- {
- spot = GDK_GC_FBDATA (gc)->values.foreground;
- }
- else if (graylevel <= 2)
- {
- if (!dc->draw_bg)
- continue;
-
- spot = GDK_GC_FBDATA (gc)->values.background;
- }
- else
- {
- switch ((GDK_GC_FBDATA (gc)->get_color) (drawable, gc, cur_x, cur_y, &realspot))
- {
- case GPR_USED_BG:
- {
- int bgx, bgy;
-
- bgx = (cur_x - GDK_DRAWABLE_IMPL_FBDATA (dc->bg_relto)->abs_x) % GDK_DRAWABLE_IMPL_FBDATA (dc->bgpm)->width + private->abs_x;
- bgy = (cur_y - GDK_DRAWABLE_IMPL_FBDATA (dc->bg_relto)->abs_y) % GDK_DRAWABLE_IMPL_FBDATA (dc->bgpm)->height + private->abs_y;
- gdk_fb_drawable_get_color (dc->bgpm, gc, bgx, bgy, &realspot);
- }
- break;
- case GPR_NONE:
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- fg = GDK_GC_FBDATA (gc)->values.foreground;
-
- /* Now figure out what 'spot' should actually look like */
- fg.red >>= 8;
- fg.green >>= 8;
- fg.blue >>= 8;
- realspot.red >>= 8;
- realspot.green >>= 8;
- realspot.blue >>= 8;
-
-
- tmp = (fg.red - realspot.red) * graylevel;
- spot.red = realspot.red + ((tmp + (tmp >> 8) + 0x80) >> 8);
- spot.red <<= 8;
-
- tmp = (fg.green - realspot.green) * graylevel;
- spot.green = realspot.green + ((tmp + (tmp >> 8) + 0x80) >> 8);
- spot.green <<= 8;
-
- tmp = (fg.blue - realspot.blue) * graylevel;
- spot.blue = realspot.blue + ((tmp + (tmp >> 8) + 0x80) >> 8);
- spot.blue <<= 8;
-
- /* Now find the pixel for this thingie */
- switch (private->depth)
- {
- case 8:
- if (!gdk_colormap_alloc_color (private->colormap, &spot, FALSE, TRUE))
- {
- g_error ("Can't allocate AA color!");
- }
- break;
- case 16:
- spot.pixel = (spot.red >> (16 - gdk_display->modeinfo.red.length)) << gdk_display->modeinfo.red.offset;
- spot.pixel |= (spot.green >> (16 - gdk_display->modeinfo.green.length)) << gdk_display->modeinfo.green.offset;
- spot.pixel |= (spot.blue >> (16 - gdk_display->modeinfo.blue.length)) << gdk_display->modeinfo.blue.offset;
- break;
- case 24:
- case 32:
- spot.pixel = ((spot.red & 0xFF00) >> 8 << (gdk_display->modeinfo.red.offset))
- | ((spot.green & 0xFF00) >> 8 << (gdk_display->modeinfo.green.offset))
- | ((spot.blue & 0xFF00) >> 8 << (gdk_display->modeinfo.blue.offset));
- break;
- }
- }
- }
- }
- break;
- case GPR_USED_BG:
- if (!dc->draw_bg)
- continue;
- break;
- case GPR_NONE:
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- (GDK_GC_FBDATA (gc)->set_pixel) (drawable, gc, cur_x, cur_y, spot.pixel);
- }
- }
-
-}
-
-void
-gdk_fb_draw_drawable_memmove (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- GdkFBDrawingContext *dc,
- gint start_y,
- gint end_y,
- gint start_x,
- gint end_x,
- gint src_x_off,
- gint src_y_off,
- gint draw_direction)
-{
- GdkDrawableFBData *src_private = GDK_DRAWABLE_FBDATA (src);
- guint depth = src_private->depth;
- guint src_rowstride = src_private->rowstride;
- guchar *srcmem = src_private->mem;
- int linelen = (end_x - start_x)*(depth>>3);
- gint cur_y;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- if (draw_direction < 0)
- {
- int tmp;
- tmp = start_y;
- start_y = end_y;
- end_y = tmp;
- start_y--;
- end_y--;
- }
-
- for(cur_y = start_y; cur_y != end_y; cur_y += draw_direction)
- {
- memmove (dc->mem + (cur_y * dc->rowstride) + start_x*(depth>>3),
- srcmem + ((cur_y + src_y_off)*src_rowstride) + (start_x + src_x_off)*(depth>>3),
- linelen);
- }
-
-}
-
-static void
-gdk_fb_draw_drawable_aa_24 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- GdkFBDrawingContext *dc,
- gint start_y,
- gint end_y,
- gint start_x,
- gint end_x,
- gint src_x_off,
- gint src_y_off,
- gint draw_direction)
-{
- GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
- int x, y;
- GdkGCFBData *gc_private;
- guchar *dmem = private->mem;
- guint dst_rowstride = private->rowstride;
- guchar *smem = GDK_DRAWABLE_FBDATA (src)->mem;
- guint src_rowstride = GDK_DRAWABLE_FBDATA (src)->rowstride;
- guchar *dst;
- guint grayval;
- gint r, g, b, tmp;
- GdkColor fg;
- gint fg_r, fg_g, fg_b;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- gc_private = GDK_GC_FBDATA (gc);
-
- fg = GDK_GC_FBDATA (gc)->values.foreground;
- fg_r = fg.red >> 8;
- fg_g = fg.green >> 8;
- fg_b = fg.blue >> 8;
-
- if (draw_direction < 0)
- {
- int tmp;
- tmp = start_y;
- start_y = end_y;
- end_y = tmp;
- start_y--;
- end_y--;
-
- tmp = start_x;
- start_x = end_x;
- end_x = tmp;
- start_x--;
- end_x--;
- }
-
- for (y = start_y; y != end_y; y+=draw_direction)
- {
- for (x = start_x; x != end_x; x+=draw_direction)
- {
- grayval = smem[x + src_x_off + (y + src_y_off) * src_rowstride];
-
- if ((grayval <= 2) && (!dc->draw_bg))
- continue;
-
- dst = &dmem[x*3 + y*dst_rowstride];
-
- if (grayval >= 254)
- {
- dst[gdk_display->red_byte] = fg_r;
- dst[gdk_display->green_byte] = fg_g;
- dst[gdk_display->blue_byte] = fg_b;
- }
- else if (grayval <= 2)
- {
- dst[gdk_display->red_byte] = GDK_GC_FBDATA (gc)->values.background.red >> 8;
- dst[gdk_display->green_byte] = GDK_GC_FBDATA (gc)->values.background.green >> 8;
- dst[gdk_display->blue_byte] = GDK_GC_FBDATA (gc)->values.background.blue >> 8;
- }
- else
- {
- r = dst[gdk_display->red_byte];
- tmp = (fg_r - r) * (gint)grayval;
- r = r + ((tmp + (tmp >> 8) + 0x80) >> 8);
- dst[gdk_display->red_byte] = r;
-
- g = dst[gdk_display->green_byte];
- tmp = (fg_g - g) * (gint)grayval;
- g = g + ((tmp + (tmp >> 8) + 0x80) >> 8);
- dst[gdk_display->green_byte] = g;
-
- b = dst[gdk_display->blue_byte];
- tmp = (fg_b - b) * (gint)grayval;
- b = b + ((tmp + (tmp >> 8) + 0x80) >> 8);
- dst[gdk_display->blue_byte] = b;
- }
- }
- }
-}
-
-/*************************************
- * gc->fill_rectangle() implementations
- *************************************/
-
-void
-gdk_fb_fill_rectangle_generic (GdkDrawable *drawable,
- GdkGC *gc,
- GdkRectangle *rect,
- GdkColor *color)
-{
- GdkDrawableFBData *private;
- GdkSpan *spans;
- int i;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- private = GDK_DRAWABLE_FBDATA (drawable);
-
- spans = g_new (GdkSpan, rect->height);
- for (i = 0; i < rect->height; i++)
- {
- spans[i].x = rect->x - private->abs_x;
- spans[i].y = rect->y+i - private->abs_y;
- spans[i].width = rect->width;
- }
- gdk_fb_fill_spans (drawable, gc, spans, rect->height, TRUE);
- g_free (spans);
-}
-
-void
-gdk_fb_fill_rectangle_simple_16 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkRectangle *rect,
- GdkColor *color)
-{
- GdkGCFBData *gc_private;
- GdkDrawableFBData *private;
- guchar *ptr;
- guint rowstride;
- int n;
- gboolean extra;
- int i;
- guint32 pixel;
- gint height;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- gc_private = GDK_GC_FBDATA (gc);
-
- rowstride = private->rowstride - rect->width*2;
- ptr = (guchar *)private->mem + rect->y * private->rowstride + rect->x*2;
-
- extra = rect->width&1;
- n = rect->width>>1;
-
- pixel = (color->pixel << 16) | color->pixel;
-
- height = rect->height;
- while (height>0)
- {
- i = n;
- while (i>0)
- {
- *(guint32 *)ptr = pixel;
- ptr += 4;
- i--;
- }
- if (extra)
- {
- *(guint16 *)ptr = color->pixel;
- ptr += 2;
- }
- ptr += rowstride;
- height--;
- }
-}
-
-void
-gdk_fb_fill_rectangle_simple_32 (GdkDrawable *drawable,
- GdkGC *gc,
- GdkRectangle *rect,
- GdkColor *color)
-{
- GdkGCFBData *gc_private;
- GdkDrawableFBData *private;
- guchar *ptr;
- guint rowstride;
- int n;
- int i;
- guint32 pixel;
- gint height;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- private = GDK_DRAWABLE_FBDATA (drawable);
- gc_private = GDK_GC_FBDATA (gc);
-
- rowstride = private->rowstride - rect->width*4;
- ptr = (guchar *)private->mem + rect->y * private->rowstride + rect->x*4;
-
- n = rect->width;
-
- pixel = color->pixel;
-
- height = rect->height;
- while (height>0)
- {
- i = n;
- while (i>0)
- {
- *(guint32 *)ptr = pixel;
- ptr += 4;
- i--;
- }
- ptr += rowstride;
- height--;
- }
-}
-
-
-/*************************************
- * GC state calculation
- *************************************/
-
-void
-_gdk_fb_gc_calc_state (GdkGC *gc,
- GdkGCValuesMask changed)
-{
- GdkGCFBData *gc_private;
- int i;
-
- gc_private = GDK_GC_FBDATA (gc);
-
- gc_private->fill_span = gdk_fb_fill_span_generic;
- gc_private->fill_rectangle = gdk_fb_fill_rectangle_generic;
-
- for (i = 0; i < GDK_NUM_FB_SRCBPP; i++)
- gc_private->draw_drawable[i] = gdk_fb_draw_drawable_generic;
-
- if (changed & _GDK_FB_GC_DEPTH)
- switch (gc_private->depth)
- {
- case 1:
- gc_private->set_pixel = gdk_fb_set_pixel_1;
- gc_private->get_color = gdk_fb_get_color_1;
- break;
- case 8:
- gc_private->set_pixel = gdk_fb_set_pixel_8;
- gc_private->get_color = gdk_fb_get_color_8;
- break;
- case 16:
- gc_private->set_pixel = gdk_fb_set_pixel_16;
- gc_private->get_color = gdk_fb_get_color_16;
- break;
- case 24:
- gc_private->set_pixel = gdk_fb_set_pixel_24;
- gc_private->get_color = gdk_fb_get_color_24;
- break;
- case 32:
- gc_private->set_pixel = gdk_fb_set_pixel_32;
- gc_private->get_color = gdk_fb_get_color_32;
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- if (!gc_private->values.clip_mask)
- {
- switch (gc_private->depth)
- {
- case 8:
- gc_private->draw_drawable[GDK_FB_SRC_BPP_8] = gdk_fb_draw_drawable_memmove;
- break;
- case 16:
- gc_private->draw_drawable[GDK_FB_SRC_BPP_16] = gdk_fb_draw_drawable_memmove;
- break;
- case 24:
- gc_private->draw_drawable[GDK_FB_SRC_BPP_8_AA_GRAYVAL] = gdk_fb_draw_drawable_aa_24;
- gc_private->draw_drawable[GDK_FB_SRC_BPP_24] = gdk_fb_draw_drawable_memmove;
- break;
- case 32:
- gc_private->draw_drawable[GDK_FB_SRC_BPP_32] = gdk_fb_draw_drawable_memmove;
- break;
- }
- }
-
- if (!gc_private->values.clip_mask &&
- !gc_private->values.tile &&
- !gc_private->values.stipple &&
- gc_private->values.function == GDK_COPY)
- {
- switch (gc_private->depth)
- {
- case 1:
- gc_private->fill_span = gdk_fb_fill_span_simple_1;
- break;
- case 8:
- gc_private->fill_span = gdk_fb_fill_span_simple_8;
- break;
- case 16:
- gc_private->fill_span = gdk_fb_fill_span_simple_16;
- gc_private->fill_rectangle = gdk_fb_fill_rectangle_simple_16;
- break;
- case 24:
- gc_private->fill_span = gdk_fb_fill_span_simple_24;
- break;
- case 32:
- gc_private->fill_span = gdk_fb_fill_span_simple_32;
- gc_private->fill_rectangle = gdk_fb_fill_rectangle_simple_32;
- break;
- default:
- g_assert_not_reached ();
- break;
- }
- }
-}
-
-#ifdef ENABLE_SHADOW_FB
-static void
-gdk_shadow_fb_copy_rect_0 (gint x, gint y, gint width, gint height)
-{
- guchar *dst, *src;
- gint depth;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- depth = gdk_display->modeinfo.bits_per_pixel / 8;
-
- dst = gdk_display->fb_mmap + x * depth + gdk_display->sinfo.line_length * y;
- src = gdk_display->fb_mem + x * depth + gdk_display->fb_stride * y;
-
- width = width*depth;
- while (height>0)
- {
- memcpy (dst, src, width);
- dst += gdk_display->sinfo.line_length;
- src += gdk_display->fb_stride;
- height--;
- }
-}
-
-static void
-gdk_shadow_fb_copy_rect_90 (gint x, gint y, gint width, gint height)
-{
- guchar *dst, *src, *pdst;
- gint depth;
- gint w;
- gint i;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- depth = gdk_display->modeinfo.bits_per_pixel / 8;
-
- src = gdk_display->fb_mem + x * depth + gdk_display->fb_stride * y;
- dst = gdk_display->fb_mmap + y * depth + gdk_display->sinfo.line_length * (gdk_display->fb_width - x - 1);
-
- while (height>0)
- {
- w = width;
- pdst = dst;
- while (w>0) {
- for (i = 0; i < depth; i++)
- *pdst++ = *src++;
- pdst -= gdk_display->sinfo.line_length + depth;
- w--;
- }
- dst += depth;
- src += gdk_display->fb_stride - width * depth;
- height--;
- }
-}
-
-static void
-gdk_shadow_fb_copy_rect_180 (gint x, gint y, gint width, gint height)
-{
- guchar *dst, *src, *pdst;
- gint depth;
- gint w;
- gint i;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- depth = gdk_display->modeinfo.bits_per_pixel / 8;
-
- src = gdk_display->fb_mem + x * depth + gdk_display->fb_stride * y;
- dst = gdk_display->fb_mmap + (gdk_display->fb_width - x - 1) * depth + gdk_display->sinfo.line_length * (gdk_display->fb_height - y - 1) ;
-
- while (height>0)
- {
- w = width;
- pdst = dst;
- while (w>0) {
- for (i = 0; i < depth; i++)
- *pdst++ = *src++;
- pdst -= 2 * depth;
- w--;
- }
- dst -= gdk_display->sinfo.line_length;
- src += gdk_display->fb_stride - width * depth;
- height--;
- }
-}
-
-static void
-gdk_shadow_fb_copy_rect_270 (gint x, gint y, gint width, gint height)
-{
- guchar *dst, *src, *pdst;
- gint depth;
- gint w;
- gint i;
-
- if (!_gdk_fb_is_active_vt)
- return;
-
- depth = gdk_display->modeinfo.bits_per_pixel / 8;
-
- src = gdk_display->fb_mem + x * depth + gdk_display->fb_stride * y;
- dst = gdk_display->fb_mmap + (gdk_display->fb_height - y - 1) * depth + gdk_display->sinfo.line_length * x;
-
- while (height>0)
- {
- w = width;
- pdst = dst;
- while (w>0) {
- for (i = 0; i < depth; i++)
- *pdst++ = *src++;
- pdst += gdk_display->sinfo.line_length - depth;
- w--;
- }
- dst -= depth;
- src += gdk_display->fb_stride - width * depth;
- height--;
- }
-}
-
-static void (*shadow_copy_rect[4]) (gint x, gint y, gint width, gint height);
-
-volatile gint refresh_queued = 0;
-volatile gint refresh_x1, refresh_y1;
-volatile gint refresh_x2, refresh_y2;
-
-static void
-gdk_shadow_fb_refresh (int signum)
-{
- gint minx, miny, maxx, maxy;
-
- if (!refresh_queued)
- {
- struct itimerval timeout;
- /* Stop the timer */
- timeout.it_value.tv_sec = 0;
- timeout.it_value.tv_usec = 0;
- timeout.it_interval.tv_sec = 0;
- timeout.it_interval.tv_usec = 0;
- setitimer (ITIMER_REAL, &timeout, NULL);
- return;
- }
-
-
- minx = refresh_x1;
- miny = refresh_y1;
- maxx = refresh_x2;
- maxy = refresh_y2;
- refresh_queued = 0;
-
- /* clip x */
- if (minx < 0) {
- minx = 0;
- maxx = MAX (maxx, 0);
- }
- if (maxx >= gdk_display->fb_width) {
- maxx = gdk_display->fb_width-1;
- minx = MIN (minx, maxx);
- }
- /* clip y */
- if (miny < 0) {
- miny = 0;
- maxy = MAX (maxy, 0);
- }
- if (maxy >= gdk_display->fb_height) {
- maxy = gdk_display->fb_height-1;
- miny = MIN (miny, maxy);
- }
-
- (*shadow_copy_rect[_gdk_fb_screen_angle]) (minx, miny, maxx - minx + 1, maxy - miny + 1);
-}
-
-void
-gdk_shadow_fb_stop_updates (void)
-{
- struct itimerval timeout;
-
- refresh_queued = 0;
-
- /* Stop the timer */
- timeout.it_value.tv_sec = 0;
- timeout.it_value.tv_usec = 0;
- timeout.it_interval.tv_sec = 0;
- timeout.it_interval.tv_usec = 0;
- setitimer (ITIMER_REAL, &timeout, NULL);
-
- refresh_queued = 0;
-}
-
-void
-gdk_shadow_fb_init (void)
-{
- struct sigaction action;
-
- action.sa_handler = gdk_shadow_fb_refresh;
- sigemptyset (&action.sa_mask);
- action.sa_flags = 0;
-
- sigaction (SIGALRM, &action, NULL);
-
- shadow_copy_rect[GDK_FB_0_DEGREES] = gdk_shadow_fb_copy_rect_0;
- shadow_copy_rect[GDK_FB_90_DEGREES] = gdk_shadow_fb_copy_rect_90;
- shadow_copy_rect[GDK_FB_180_DEGREES] = gdk_shadow_fb_copy_rect_180;
- shadow_copy_rect[GDK_FB_270_DEGREES] = gdk_shadow_fb_copy_rect_270;
-}
-
-/* maxx and maxy are included */
-void
-gdk_shadow_fb_update (gint minx, gint miny, gint maxx, gint maxy)
-{
- struct itimerval timeout;
-
- if (gdk_display->manager_blocked)
- return;
-
- g_assert (minx <= maxx);
- g_assert (miny <= maxy);
-
- if (refresh_queued)
- {
- refresh_x1 = MIN (refresh_x1, minx);
- refresh_y1 = MIN (refresh_y1, miny);
- refresh_x2 = MAX (refresh_x2, maxx);
- refresh_y2 = MAX (refresh_y2, maxy);
- refresh_queued = 1;
- }
- else
- {
- refresh_x1 = minx;
- refresh_y1 = miny;
- refresh_x2 = maxx;
- refresh_y2 = maxy;
- refresh_queued = 1;
-
- getitimer (ITIMER_REAL, &timeout);
- if (timeout.it_value.tv_usec == 0)
- {
- timeout.it_value.tv_sec = 0;
- timeout.it_value.tv_usec = 20000; /* 20 ms => 50 fps */
- timeout.it_interval.tv_sec = 0;
- timeout.it_interval.tv_usec = 20000; /* 20 ms => 50 fps */
- setitimer (ITIMER_REAL, &timeout, NULL);
- }
- }
-
-}
-#else
-
-void
-gdk_shadow_fb_stop_updates (void)
-{
-}
-
-void
-gdk_shadow_fb_update (gint minx, gint miny, gint maxx, gint maxy)
-{
-}
-
-void
-gdk_shadow_fb_init (void)
-{
-}
-
-#endif
-
diff --git a/gdk/linux-fb/gdkscreen-fb.c b/gdk/linux-fb/gdkscreen-fb.c
deleted file mode 100644
index ff19caaa9..000000000
--- a/gdk/linux-fb/gdkscreen-fb.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include "gdk.h"
-#include "gdkprivate-fb.h"
-
-static GdkColormap *default_colormap = NULL;
-
-GdkDisplay *
-gdk_screen_get_display (GdkScreen *screen)
-{
- return _gdk_display;
-}
-
-GdkWindow *
-gdk_screen_get_root_window (GdkScreen *screen)
-{
- return _gdk_parent_root;
-}
-
-GdkColormap*
-gdk_screen_get_default_colormap (GdkScreen *screen)
-{
- return default_colormap;
-}
-
-void
-gdk_screen_set_default_colormap (GdkScreen *screen,
- GdkColormap *colormap)
-{
- GdkColormap *old_colormap;
-
- g_return_if_fail (GDK_IS_SCREEN (screen));
- g_return_if_fail (GDK_IS_COLORMAP (colormap));
-
- old_colormap = default_colormap;
-
- default_colormap = g_object_ref (colormap);
-
- if (old_colormap)
- g_object_unref (old_colormap);
-}
-
-int
-gdk_screen_get_n_monitors (GdkScreen *screen)
-{
- return 1;
-}
-
-void
-gdk_screen_get_monitor_geometry (GdkScreen *screen,
- gint num_monitor,
- GdkRectangle *dest)
-{
- dest->x = 0;
- dest->y = 0;
- dest->width = gdk_screen_width ();
- dest->height = gdk_screen_height ();
-}
-
-GdkColormap *
-gdk_screen_get_rgba_colormap (GdkScreen *screen)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- return NULL;
-}
-
-GdkVisual *
-gdk_screen_get_rgba_visual (GdkScreen *screen)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- return NULL;
-}
-
-gint
-gdk_screen_get_number (GdkScreen *screen)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
- return 0;
-}
-
-gchar *
-_gdk_windowing_substitute_screen_number (const gchar *display_name,
- int screen_number)
-{
- return g_strdup (display_name);
-}
-
-gchar *
-gdk_screen_make_display_name (GdkScreen *screen)
-{
- return g_strdup ("");
-}
diff --git a/gdk/linux-fb/gdkselection-fb.c b/gdk/linux-fb/gdkselection-fb.c
deleted file mode 100644
index 374cf3f20..000000000
--- a/gdk/linux-fb/gdkselection-fb.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <string.h>
-
-#include "gdkproperty.h"
-#include "gdkselection.h"
-#include "gdkprivate.h"
-#include "gdkprivate-fb.h"
-
-
-typedef struct _OwnerInfo OwnerInfo;
-
-struct _OwnerInfo
-{
- GdkAtom selection;
- GdkWindow *owner;
-};
-
-GSList *owner_list;
-
-/* When a window is destroyed we check if it is the owner
- * of any selections. This is somewhat inefficient, but
- * owner_list is typically short, and it is a low memory,
- * low code solution
- */
-void
-_gdk_selection_window_destroyed (GdkWindow *window)
-{
- GSList *tmp_list = owner_list;
- while (tmp_list)
- {
- OwnerInfo *info = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (info->owner == window)
- {
- owner_list = g_slist_remove (owner_list, info);
- g_free (info);
- }
- }
-}
-
-gint
-gdk_selection_owner_set_for_display (GdkDisplay *display,
- GdkWindow *owner,
- GdkAtom selection,
- guint32 time,
- gint send_event)
-{
- GSList *tmp_list;
- OwnerInfo *info;
-
- tmp_list = owner_list;
- while (tmp_list)
- {
- info = tmp_list->data;
- if (info->selection == selection)
- {
- owner_list = g_slist_remove (owner_list, info);
- g_free (info);
- break;
- }
- tmp_list = tmp_list->next;
- }
-
- if (owner)
- {
- info = g_new (OwnerInfo, 1);
- info->owner = owner;
- info->selection = selection;
-
- owner_list = g_slist_prepend (owner_list, info);
- }
-
- return TRUE;
-}
-
-GdkWindow*
-gdk_selection_owner_get_for_display (GdkDisplay *display,
- GdkAtom selection)
-{
- OwnerInfo *info;
- GSList *tmp_list;
-
- tmp_list = owner_list;
- while (tmp_list)
- {
- info = tmp_list->data;
- if (info->selection == selection)
- {
- return info->owner;
- }
- tmp_list = tmp_list->next;
- }
- return NULL;
-}
-
-void
-gdk_selection_convert (GdkWindow *requestor,
- GdkAtom selection,
- GdkAtom target,
- guint32 time)
-{
- GdkEvent *event;
- GdkWindow *owner;
- GdkWindow *event_window;
-
- owner = gdk_selection_owner_get (selection);
-
- if (owner)
- {
- event_window = gdk_fb_other_event_window (owner, GDK_SELECTION_REQUEST);
- if (event_window)
- {
- event = gdk_event_make (event_window, GDK_SELECTION_REQUEST, TRUE);
- event->selection.requestor = (unsigned int)requestor;
- event->selection.selection = selection;
- event->selection.target = target;
- event->selection.property = _gdk_selection_property;
- }
- }
- else
- {
- /* If no owner for the specified selection exists, the X server
- * generates a SelectionNotify event to the requestor with property None.
- */
- gdk_selection_send_notify ((guint32)requestor,
- selection,
- target,
- GDK_NONE,
- 0);
- }
-}
-
-gint
-gdk_selection_property_get (GdkWindow *requestor,
- guchar **data,
- GdkAtom *ret_type,
- gint *ret_format)
-{
- guchar *t = NULL;
- GdkAtom prop_type;
- gint prop_format;
- gint prop_len;
-
- g_return_val_if_fail (requestor != NULL, 0);
- g_return_val_if_fail (GDK_IS_WINDOW (requestor), 0);
-
- if (!gdk_property_get (requestor,
- _gdk_selection_property,
- NULL/*AnyPropertyType?*/,
- 0, 0,
- FALSE,
- &prop_type, &prop_format, &prop_len,
- &t))
- {
- *data = NULL;
- return 0;
- }
-
- if (ret_type)
- *ret_type = prop_type;
- if (ret_format)
- *ret_format = prop_format;
-
- if (!gdk_property_get (requestor,
- _gdk_selection_property,
- NULL/*AnyPropertyType?*/,
- 0, prop_len + 1,
- FALSE,
- &prop_type, &prop_format, &prop_len,
- &t))
- {
- *data = NULL;
- return 0;
- }
-
- *data = t;
-
- return prop_len;
-}
-
-
-void
-gdk_selection_send_notify_for_display (GdkDisplay *display,
- guint32 requestor,
- GdkAtom selection,
- GdkAtom target,
- GdkAtom property,
- guint32 time)
-{
- GdkEvent *event;
- GdkWindow *event_window;
-
- event_window = gdk_fb_other_event_window (gdk_window_lookup ((GdkNativeWindow) requestor), GDK_SELECTION_NOTIFY);
- if (event_window)
- {
- event = gdk_event_make (event_window, GDK_SELECTION_NOTIFY, TRUE);
- event->selection.selection = selection;
- event->selection.target = target;
- event->selection.property = property;
- event->selection.requestor = (GdkNativeWindow) requestor;
- }
-}
-
-gint
-gdk_text_property_to_text_list_for_display (GdkDisplay *display,
- GdkAtom encoding,
- gint format,
- const guchar *text,
- gint length,
- gchar ***list)
-{
- g_warning ("gdk_text_property_to_text_list() not implemented\n");
- return 0;
-}
-
-void
-gdk_free_text_list (gchar **list)
-{
- g_return_if_fail (list != NULL);
- g_warning ("gdk_free_text_list() not implemented\n");
-}
-
-gint
-gdk_string_to_compound_text_for_display (GdkDisplay *display,
- const gchar *str,
- GdkAtom *encoding,
- gint *format,
- guchar **ctext,
- gint *length)
-{
- g_warning ("gdk_string_to_compound_text() not implemented\n");
- return 0;
-}
-
-void gdk_free_compound_text (guchar *ctext)
-{
- g_warning ("gdk_free_compound_text() not implemented\n");
-}
-
-gchar *
-gdk_utf8_to_string_target (const gchar *str)
-{
- g_warning ("gdk_utf8_to_string_target() not implemented\n");
- return NULL;
-}
-
-gboolean
-gdk_utf8_to_compound_text_for_display (GdkDisplay *display,
- const gchar *str,
- GdkAtom *encoding,
- gint *format,
- guchar **ctext,
- gint *length)
-{
- g_warning ("gdk_utf8_to_compound_text() not implemented\n");
- return 0;
-}
-
-static gint
-make_list (const gchar *text,
- gint length,
- gboolean latin1,
- gchar ***list)
-{
- GSList *strings = NULL;
- gint n_strings = 0;
- gint i;
- const gchar *p = text;
- const gchar *q;
- GSList *tmp_list;
- GError *error = NULL;
-
- while (p < text + length)
- {
- gchar *str;
-
- q = p;
- while (*q && q < text + length)
- q++;
-
- if (latin1)
- {
- str = g_convert (p, q - p,
- "UTF-8", "ISO-8859-1",
- NULL, NULL, &error);
-
- if (!str)
- {
- g_warning ("Error converting selection from STRING: %s",
- error->message);
- g_error_free (error);
- }
- }
- else
- str = g_strndup (p, q - p);
-
- if (str)
- {
- strings = g_slist_prepend (strings, str);
- n_strings++;
- }
-
- p = q + 1;
- }
-
- if (list)
- *list = g_new (gchar *, n_strings + 1);
-
- (*list)[n_strings] = NULL;
-
- i = n_strings;
- tmp_list = strings;
- while (tmp_list)
- {
- if (list)
- (*list)[--i] = tmp_list->data;
- else
- g_free (tmp_list->data);
-
- tmp_list = tmp_list->next;
- }
-
- g_slist_free (strings);
-
- return n_strings;
-}
-
-
-gint
-gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
- GdkAtom encoding,
- gint format,
- const guchar *text,
- gint length,
- gchar ***list)
-{
- g_return_val_if_fail (text != NULL, 0);
- g_return_val_if_fail (length >= 0, 0);
-
- if (encoding == GDK_TARGET_STRING)
- {
- return make_list ((gchar *)text, length, TRUE, list);
- }
- else if (encoding == gdk_atom_intern ("UTF8_STRING", FALSE))
- {
- return make_list ((gchar *)text, length, FALSE, list);
- }
- else
- {
- gchar **local_list;
- gint local_count;
- gint i;
- const gchar *charset = NULL;
- gboolean need_conversion = !g_get_charset (&charset);
- gint count = 0;
- GError *error = NULL;
-
- /* Probably COMPOUND text, we fall back to Xlib routines
- */
- local_count = gdk_text_property_to_text_list (encoding,
- format,
- text,
- length,
- &local_list);
- if (list)
- *list = g_new (gchar *, local_count + 1);
-
- for (i = 0; i < local_count; i++)
- {
- /* list contains stuff in our default encoding
- */
- if (need_conversion)
- {
- gchar *utf = g_convert (local_list[i], -1,
- "UTF-8", charset,
- NULL, NULL, &error);
- if (utf)
- {
- if (list)
- (*list)[count++] = utf;
- else
- g_free (utf);
- }
- else
- {
- g_warning ("Error converting to UTF-8 from '%s': %s",
- charset, error->message);
- g_error_free (error);
- error = NULL;
- }
- }
- else
- {
- if (list)
- (*list)[count++] = g_strdup (local_list[i]);
- }
- }
-
- gdk_free_text_list (local_list);
- (*list)[count] = NULL;
-
- return count;
- }
-}
diff --git a/gdk/linux-fb/gdkspawn-fb.c b/gdk/linux-fb/gdkspawn-fb.c
deleted file mode 100644
index 8fdd9b416..000000000
--- a/gdk/linux-fb/gdkspawn-fb.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2003 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Mark McLoughlin <mark@skynet.ie>
- */
-
-#include <config.h>
-
-#include "gdkspawn.h"
-
-#include <glib.h>
-#include <gdk/gdk.h>
-
-gboolean
-gdk_spawn_on_screen (GdkScreen *screen,
- const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- gint *child_pid,
- GError **error)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
-
- return g_spawn_async (working_directory,
- argv,
- envp,
- flags,
- child_setup,
- user_data,
- child_pid,
- error);
-}
-
-gboolean
-gdk_spawn_on_screen_with_pipes (GdkScreen *screen,
- const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- gint *child_pid,
- gint *standard_input,
- gint *standard_output,
- gint *standard_error,
- GError **error)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
-
- return g_spawn_async_with_pipes (working_directory,
- argv,
- envp,
- flags,
- child_setup,
- user_data,
- child_pid,
- standard_input,
- standard_output,
- standard_error,
- error);
-}
-
-gboolean
-gdk_spawn_command_line_on_screen (GdkScreen *screen,
- const gchar *command_line,
- GError **error)
-{
- gchar **argv = NULL;
- gboolean retval;
-
- g_return_val_if_fail (command_line != NULL, FALSE);
-
- if (!g_shell_parse_argv (command_line,
- NULL, &argv,
- error))
- return FALSE;
-
- retval = gdk_spawn_on_screen (screen,
- NULL, argv, NULL,
- G_SPAWN_SEARCH_PATH,
- NULL, NULL, NULL,
- error);
- g_strfreev (argv);
-
- return retval;
-}
diff --git a/gdk/linux-fb/gdkvisual-fb.c b/gdk/linux-fb/gdkvisual-fb.c
deleted file mode 100644
index 4331bfc57..000000000
--- a/gdk/linux-fb/gdkvisual-fb.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include "gdkvisual.h"
-#include "gdkprivate-fb.h"
-#include "gdkinternals.h"
-#include <sys/ioctl.h>
-
-static GdkVisual *system_visual = NULL;
-
-static void
-gdk_visual_finalize (GObject *object)
-{
- g_error ("A GdkVisual object was finalized. This should not happen");
-}
-
-static void
-gdk_visual_class_init (GObjectClass *class)
-{
- class->finalize = gdk_visual_finalize;
-}
-
-
-GType
-gdk_visual_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (GdkVisualClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_visual_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkVisual),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "GdkVisual",
- &object_info, 0);
- }
-
- return object_type;
-}
-
-void
-_gdk_visual_init (void)
-{
- system_visual = g_object_new (GDK_TYPE_VISUAL, NULL);
-
- 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)
- {
- case FB_VISUAL_PSEUDOCOLOR:
- system_visual->colormap_size = 1 << gdk_display->modeinfo.bits_per_pixel;
- system_visual->type = GDK_VISUAL_PSEUDO_COLOR;
- break;
- case FB_VISUAL_DIRECTCOLOR:
- case FB_VISUAL_TRUECOLOR:
- system_visual->type = GDK_VISUAL_TRUE_COLOR;
-
- system_visual->red_prec = gdk_display->modeinfo.red.length;
- system_visual->red_shift = gdk_display->modeinfo.red.offset;
- system_visual->red_mask = ((1 << (system_visual->red_prec)) - 1) << system_visual->red_shift;
-
- system_visual->green_prec = gdk_display->modeinfo.green.length;
- system_visual->green_shift = gdk_display->modeinfo.green.offset;
- system_visual->green_mask = ((1 << (system_visual->green_prec)) - 1) << system_visual->green_shift;
-
- system_visual->blue_prec = gdk_display->modeinfo.blue.length;
- system_visual->blue_shift = gdk_display->modeinfo.blue.offset;
- system_visual->blue_mask = ((1 << (system_visual->blue_prec)) - 1) << system_visual->blue_shift;
-
- if (gdk_display->sinfo.visual == FB_VISUAL_DIRECTCOLOR)
- {
- guint16 red[256], green[256], blue[256];
- struct fb_cmap fbc = {0,0};
- int size, i;
- /* Load the colormap to ramps here, as they might be initialized to
- some other garbage */
-
- g_warning ("Directcolor visual, not very well tested\n");
- fbc.red = red;
- fbc.green = green;
- fbc.blue = blue;
-
- size = 1 << system_visual->red_prec;
- for (i = 0; i < size; i++)
- red[i] = i * 65535 / (size - 1);
-
- size = 1 << system_visual->green_prec;
- fbc.len = size;
- for (i = 0; i < size; i++)
- green[i] = i * 65535 / (size - 1);
-
- size = 1 << system_visual->blue_prec;
- for (i = 0; i < size; i++)
- blue[i] = i * 65535 / (size - 1);
-
- ioctl (gdk_display->fb_fd, FBIOPUTCMAP, &fbc);
- }
- break;
- case FB_VISUAL_STATIC_PSEUDOCOLOR:
- system_visual->type = GDK_VISUAL_STATIC_COLOR;
- system_visual->colormap_size = 1 << gdk_display->modeinfo.bits_per_pixel;
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-gint
-gdk_visual_get_best_depth (void)
-{
- return system_visual->depth;
-}
-
-GdkVisualType
-gdk_visual_get_best_type (void)
-{
- return system_visual->type;
-}
-
-GdkVisual*
-gdk_screen_get_system_visual (GdkScreen *screen)
-{
- return system_visual;
-}
-
-GdkVisual*
-gdk_visual_get_best (void)
-{
- return system_visual;
-}
-
-GdkVisual*
-gdk_visual_get_best_with_depth (gint depth)
-{
- if (system_visual->depth != depth)
- return NULL;
-
- return system_visual;
-}
-
-GdkVisual*
-gdk_visual_get_best_with_type (GdkVisualType visual_type)
-{
- if (system_visual->type != visual_type)
- return NULL;
-
- return system_visual;
-}
-
-GdkVisual*
-gdk_visual_get_best_with_both (gint depth,
- GdkVisualType visual_type)
-{
- if (system_visual->depth != depth)
- return NULL;
-
- if (system_visual->type != visual_type)
- return NULL;
-
- return system_visual;
-}
-
-void
-gdk_query_depths (gint **depths,
- gint *count)
-{
- *count = 1;
- *depths = &system_visual->depth;
-}
-
-void
-gdk_query_visual_types (GdkVisualType **visual_types,
- gint *count)
-{
- *count = 1;
- *visual_types = &system_visual->type;
-}
-
-GList*
-gdk_screen_list_visuals (GdkScreen *screen)
-{
- return g_list_append (NULL, gdk_visual_get_system ());
-}
-
-GdkScreen *
-gdk_visual_get_screen (GdkVisual *visual)
-{
- g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL);
-
- return gdk_screen_get_default ();
-}
diff --git a/gdk/linux-fb/gdkwindow-fb.c b/gdk/linux-fb/gdkwindow-fb.c
deleted file mode 100644
index fa0e02572..000000000
--- a/gdk/linux-fb/gdkwindow-fb.c
+++ /dev/null
@@ -1,2380 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include "gdk.h"
-
-#include "gdkwindow.h"
-#include "gdkinputprivate.h"
-#include "gdkprivate-fb.h"
-#include "gdkinternals.h"
-
-#include <limits.h>
-
-/* Global variables: */
-static GdkWindow *gdk_fb_window_containing_pointer = NULL;
-static GdkWindow *gdk_fb_focused_window = NULL;
-static gpointer parent_class = NULL;
-
-static void recompute_drawable (GdkDrawable *drawable);
-static void gdk_fb_window_raise (GdkWindow *window);
-static GdkRegion* gdk_window_fb_get_visible_region (GdkDrawable *drawable);
-
-typedef struct
-{
- GdkWindowChildChanged changed;
- GdkWindowChildGetPos get_pos;
- gpointer user_data;
-} GdkWindowChildHandlerData;
-
-static void
-g_free_2nd (gpointer a, gpointer b, gpointer data)
-{
- g_free (b);
-}
-
-static void
-gdk_window_impl_fb_finalize (GObject *object)
-{
- GdkWindowFBData *fbd = GDK_WINDOW_FBDATA (object);
-
- if (GDK_WINDOW_IS_MAPPED (fbd->drawable_data.wrapper))
- gdk_window_hide (fbd->drawable_data.wrapper);
-
- if (fbd->cursor)
- gdk_cursor_unref (fbd->cursor);
-
- if (fbd->properties)
- {
- g_hash_table_foreach (fbd->properties, g_free_2nd, NULL);
- g_hash_table_destroy (fbd->properties);
- }
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gdk_window_impl_fb_class_init (GdkWindowFBClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_window_impl_fb_finalize;
-
- /* Visible and clip regions are the same */
- drawable_class->get_clip_region = gdk_window_fb_get_visible_region;
- drawable_class->get_visible_region = gdk_window_fb_get_visible_region;
-}
-
-static void
-gdk_window_impl_fb_init (GdkWindowFBData *impl)
-{
- impl->drawable_data.depth = gdk_display->modeinfo.bits_per_pixel;
- impl->drawable_data.colormap = gdk_colormap_get_system ();
- impl->shape = NULL;
-}
-
-GType
-_gdk_window_impl_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (GdkWindowFBClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_window_impl_fb_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkWindowFBData),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gdk_window_impl_fb_init,
- };
-
- object_type = g_type_register_static (gdk_drawable_impl_fb_get_type(),
- "GdkWindowFB",
- &object_info,
- 0);
- }
-
- return object_type;
-}
-
-void
-_gdk_windowing_window_init (void)
-{
- GdkWindowAttr attr;
-
- GdkCursor *cursor;
- GdkWindowObject *private;
-
- attr.width = gdk_screen_width ();
- attr.height = gdk_screen_height ();
- attr.window_type = GDK_WINDOW_ROOT;
- attr.cursor = NULL;
- attr.event_mask = GDK_EXPOSURE_MASK;
- attr.wclass = GDK_INPUT_OUTPUT;
- _gdk_parent_root = gdk_window_new (NULL, &attr, GDK_WA_CURSOR);
- private = (GdkWindowObject *)_gdk_parent_root;
-
- private->state = 0;
-
- GDK_DRAWABLE_IMPL_FBDATA (_gdk_parent_root)->lim_x = attr.width;
- GDK_DRAWABLE_IMPL_FBDATA (_gdk_parent_root)->lim_y = attr.height;
-
- _gdk_fb_screen_gc = gdk_gc_new (_gdk_parent_root);
-
- gdk_fb_drawable_clear (_gdk_parent_root);
-
- /* Must be done after root is created, since gdk_cursor_new()
- * references _gdk_parent_root.
- */
- cursor = gdk_cursor_new (GDK_LEFT_PTR);
- gdk_window_set_cursor (_gdk_parent_root, cursor);
-}
-
-GdkWindow*
-gdk_window_new (GdkWindow *parent,
- GdkWindowAttr *attributes,
- gint attributes_mask)
-{
- GdkWindow *window;
- GdkWindowObject *private;
- GdkWindowObject *parent_private;
- GdkVisual *visual;
- GdkWindowFBData *impl;
-
- int x, y, depth;
-
- g_return_val_if_fail (attributes != NULL, NULL);
-
- if (!parent ||
- (attributes->window_type != GDK_WINDOW_CHILD &&
- attributes->window_type != GDK_WINDOW_TEMP))
- parent = _gdk_parent_root;
-
- parent_private = (GdkWindowObject*) parent;
-
- window = (GdkWindow *)g_object_new (GDK_TYPE_WINDOW, NULL);
- private = (GdkWindowObject *)window;
-
- private->parent = parent_private;
-
- private->accept_focus = TRUE;
- private->focus_on_map = TRUE;
-
- if (attributes_mask & GDK_WA_X)
- x = attributes->x;
- else
- x = 0;
-
- if (attributes_mask & GDK_WA_Y)
- y = attributes->y;
- else
- y = 0;
-
- gdk_window_set_events (window, attributes->event_mask);
-
- if (attributes_mask & GDK_WA_VISUAL)
- visual = attributes->visual;
- else
- visual = gdk_visual_get_system ();
-
- impl = (GdkWindowFBData *)private->impl;
- impl->drawable_data.wrapper = window;
- private->x = x;
- private->y = y;
- impl->drawable_data.width = (attributes->width > 1) ? (attributes->width) : (1);
- impl->drawable_data.height = (attributes->height > 1) ? (attributes->height) : (1);
- private->window_type = impl->drawable_data.window_type = attributes->window_type;
- impl->drawable_data.mem = gdk_display->fb_mem;
- impl->drawable_data.rowstride = gdk_display->fb_stride;
- gdk_window_move_resize (window, x, y,
- impl->drawable_data.width, impl->drawable_data.height);
-
- if (attributes->wclass == GDK_INPUT_OUTPUT)
- {
- depth = visual->depth;
-
- private->input_only = FALSE;
- private->depth = impl->drawable_data.depth;
-
- if ((attributes_mask & GDK_WA_COLORMAP) &&
- attributes->colormap)
- impl->drawable_data.colormap = attributes->colormap;
- else
- impl->drawable_data.colormap = gdk_colormap_get_system ();
-
- switch (impl->drawable_data.window_type)
- {
- case GDK_WINDOW_TOPLEVEL:
- case GDK_WINDOW_CHILD:
- case GDK_WINDOW_DIALOG:
- case GDK_WINDOW_TEMP:
- default:
- break;
-
- case GDK_WINDOW_ROOT:
- if (_gdk_parent_root)
- g_error ("cannot make windows of type GDK_WINDOW_ROOT");
- break;
- case GDK_DRAWABLE_PIXMAP:
- g_error ("cannot make windows of type GDK_DRAWABLE_PIXMAP (use gdk_pixmap_new)");
- break;
- }
- }
- else
- {
- depth = 0;
- private->input_only = TRUE;
- impl->drawable_data.colormap = NULL;
- }
-
- if (impl->drawable_data.colormap)
- gdk_colormap_ref (impl->drawable_data.colormap);
-
- gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
- (attributes->cursor) :
- NULL));
-
- if (parent_private)
- parent_private->children = g_list_prepend (parent_private->children, window);
-
- if (attributes_mask & GDK_WA_TYPE_HINT)
- gdk_window_set_type_hint (window, attributes->type_hint);
-
- return window;
-}
-
-/* This function is called when the XWindow is really gone. */
-void
-_gdk_windowing_window_destroy (GdkWindow *window,
- gboolean recursing,
- gboolean foreign_destroy)
-{
- GdkWindowObject *private;
- GdkRectangle r;
-
- private = (GdkWindowObject*) window;
-
- _gdk_selection_window_destroyed (window);
-
- r.x = private->x;
- r.y = private->y;
- r.width = GDK_DRAWABLE_IMPL_FBDATA (window)->width;
- r.height = GDK_DRAWABLE_IMPL_FBDATA (window)->height;
- /* Clear the root window, as it might be visible under
- the destroyed window */
- gdk_window_clear_area (_gdk_parent_root,
- r.x,
- r.y,
- r.width,
- r.height);
- /* Invalidate the rect */
- gdk_window_invalidate_rect ((GdkWindow *)private->parent, &r, TRUE);
-}
-
-static gboolean
-all_parents_shown (GdkWindowObject *private)
-{
- while (GDK_WINDOW_IS_MAPPED (private))
- {
- if (private->parent)
- private = (GdkWindowObject *)private->parent;
- else
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-send_map_events (GdkWindowObject *private, gboolean is_map)
-{
- GList *l;
- GdkWindow *parent = (GdkWindow *)private->parent;
- GdkWindow *event_win;
-
- g_assert (is_map);
-
- if (!GDK_WINDOW_IS_MAPPED (private))
- return;
-
- if (is_map)
- {
- event_win = gdk_fb_other_event_window ((GdkWindow *)private, GDK_MAP);
- if (event_win)
- gdk_event_make (event_win, GDK_MAP, TRUE);
- }
- if (private->input_only)
- return;
-
- if (!parent)
- parent = (GdkWindow *)private;
-
- if (((GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x > GDK_DRAWABLE_IMPL_FBDATA (parent)->lim_x) ||
- (GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y > GDK_DRAWABLE_IMPL_FBDATA (parent)->lim_y) ||
- (GDK_DRAWABLE_IMPL_FBDATA (private)->lim_x < GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_x) ||
- (GDK_DRAWABLE_IMPL_FBDATA (private)->lim_y < GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_y)))
- return;
-
- if (is_map)
- gdk_window_clear ((GdkWindow *)private);
-
- for (l = private->children; l; l = l->next)
- send_map_events (l->data, is_map);
-}
-
-/* Cut & paste versions of the stuff in gdkwindow.c, with the addition of clearing the newly exposed region. */
-void
-gdk_window_invalidate_region_clear(GdkWindow *window,
- GdkRegion *region)
-{
- int i;
- GdkWindowObject *private = GDK_WINDOW_P (window);
-
- if (private->input_only || !GDK_WINDOW_IS_MAPPED (private))
- return;
-
- if (private->bg_pixmap != GDK_NO_BG)
- for (i = 0; i < region->numRects; i++)
- gdk_window_clear_area (window,
- region->rects[i].x1,
- region->rects[i].y1,
- region->rects[i].x2 - region->rects[i].x1,
- region->rects[i].y2 - region->rects[i].y1);
-
- gdk_window_invalidate_region (window, region, FALSE);
-
- {
- GList *tmp_list;
- GdkRectangle child_rect;
- GdkRegion *child_region;
-
- tmp_list = private->children;
- while (tmp_list)
- {
- GdkWindowObject *child = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (!child->input_only)
- {
- gint width, height;
-
- gdk_drawable_get_size (GDK_DRAWABLE (child),
- &width, &height);
-
- child_rect.x = child->x;
- child_rect.y = child->y;
- child_rect.width = width;
- child_rect.height = height;
-
- child_region = gdk_region_rectangle (&child_rect);
- gdk_region_intersect (child_region, region);
-
- if (!gdk_region_empty (child_region))
- {
- gdk_region_offset (child_region, - child_rect.x, - child_rect.y);
- gdk_window_invalidate_region_clear ((GdkWindow *)child, child_region);
- }
-
- gdk_region_destroy (child_region);
- }
- }
- }
-}
-
-void
-gdk_window_invalidate_rect_clear (GdkWindow *window,
- GdkRectangle *rect)
-{
- GdkWindowObject *private = GDK_WINDOW_P (window);
-
- if (private->input_only || !GDK_WINDOW_IS_MAPPED (private))
- return;
-
- if (GDK_WINDOW_P (window)->bg_pixmap != GDK_NO_BG)
- gdk_window_clear_area (window, rect->x, rect->y, rect->width, rect->height);
- gdk_window_invalidate_rect (window, rect, FALSE);
-
- {
- GList *tmp_list;
- GdkRectangle child_rect, new_rect;
-
- tmp_list = private->children;
- while (tmp_list)
- {
- GdkWindowObject *child = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (!child->input_only)
- {
- gint width, height;
-
- width = GDK_DRAWABLE_IMPL_FBDATA (child)->width;
- height = GDK_DRAWABLE_IMPL_FBDATA (child)->height;
-
- child_rect.x = child->x;
- child_rect.y = child->y;
- child_rect.width = width;
- child_rect.height = height;
-
- if (gdk_rectangle_intersect (rect, &child_rect, &new_rect))
- {
- new_rect.x -= child_rect.x;
- new_rect.y -= child_rect.y;
-
- gdk_window_invalidate_rect_clear ((GdkWindow *)child, &new_rect);
- }
- }
- }
- }
-}
-
-void
-gdk_fb_redraw_all (void)
-{
- GdkRectangle r;
- r.x = r.y = 0;
- r.width = GDK_DRAWABLE_IMPL_FBDATA (_gdk_parent_root)->width;
- r.height = GDK_DRAWABLE_IMPL_FBDATA (_gdk_parent_root)->height;
- gdk_window_invalidate_rect_clear (_gdk_parent_root, &r);
- gdk_window_process_all_updates ();
-}
-
-
-/* Focus follows pointer */
-static GdkWindow *
-gdk_fb_window_find_toplevel (GdkWindow *window)
-{
- GdkWindowObject *priv = (GdkWindowObject *)window;
- while (priv != (GdkWindowObject *)_gdk_parent_root)
- {
- if ((priv->parent == (GdkWindowObject *)_gdk_parent_root) && GDK_WINDOW_IS_MAPPED (priv))
- return (GdkWindow *)priv;
- priv = priv->parent;
- }
-
- return _gdk_parent_root;
-}
-
-GdkWindow *
-gdk_fb_window_find_focus (void)
-{
- if (_gdk_fb_keyboard_grab_window)
- return _gdk_fb_keyboard_grab_window;
-
- if (!gdk_fb_focused_window)
- gdk_fb_focused_window = gdk_window_ref (_gdk_parent_root);
-
- return gdk_fb_focused_window;
-}
-
-
-static void
-gdk_fb_change_focus (GdkWindow *new_focus_window)
-{
- GdkEventFocus *event;
- GdkWindow *old_win, *new_win;
- GdkWindow *event_win;
-
- /* No focus changes while the pointer is grabbed */
- if (_gdk_fb_pointer_grab_window)
- return;
-
- old_win = gdk_fb_focused_window;
- new_win = gdk_fb_window_find_toplevel (new_focus_window);
-
- if (old_win != new_win)
- {
- if (old_win)
- {
- event_win = gdk_fb_keyboard_event_window (old_win, GDK_FOCUS_CHANGE);
- if (event_win)
- {
- event = (GdkEventFocus *)gdk_event_make (event_win, GDK_FOCUS_CHANGE, TRUE);
- event->in = FALSE;
- }
- }
- event_win = gdk_fb_keyboard_event_window (new_win, GDK_FOCUS_CHANGE);
- if (event_win)
- {
- event = (GdkEventFocus *)gdk_event_make (event_win, GDK_FOCUS_CHANGE, TRUE);
- event->in = TRUE;
- }
-
- if (gdk_fb_focused_window)
- gdk_window_unref (gdk_fb_focused_window);
- gdk_fb_focused_window = gdk_window_ref (new_win);
- }
-}
-
-static GdkWindow *
-gdk_fb_find_common_ancestor (GdkWindow *win1,
- GdkWindow *win2)
-{
- GdkWindowObject *tmp;
- GList *path1 = NULL, *path2 = NULL;
- GList *list1, *list2;
-
- tmp = GDK_WINDOW_OBJECT (win1);
- while (tmp)
- {
- path1 = g_list_prepend(path1, tmp);
- tmp = tmp->parent;
- }
-
- tmp = GDK_WINDOW_OBJECT (win2);
- while (tmp)
- {
- path2 = g_list_prepend(path2, tmp);
- tmp = tmp->parent;
- }
-
- list1 = path1;
- list2 = path2;
- tmp = NULL;
- while (list1 && list2 && (list1->data == list2->data))
- {
- tmp = (GdkWindowObject *)list1->data;
- list1 = g_list_next (list1);
- list2 = g_list_next (list2);
- }
- g_list_free (path1);
- g_list_free (path2);
- return GDK_WINDOW (tmp);
-}
-
-void
-gdk_fb_window_send_crossing_events (GdkWindow *src,
- GdkWindow *dest,
- GdkCrossingMode mode)
-{
- GdkWindow *c;
- GdkWindow *win, *last, *next;
- GdkEvent *event;
- gint x, y, x_int, y_int;
- GdkModifierType my_mask;
- GList *path, *list;
- gboolean non_linear;
- GdkWindow *a;
- GdkWindow *b;
- GdkWindow *event_win;
-
- if ((mode == GDK_CROSSING_NORMAL) &&
- (dest == gdk_fb_window_containing_pointer))
- return;
-
- if (gdk_fb_window_containing_pointer == NULL)
- gdk_fb_window_containing_pointer = gdk_window_ref (_gdk_parent_root);
-
- if (src)
- a = src;
- else
- a = gdk_fb_window_containing_pointer;
- b = dest;
-
- if (a==b)
- return;
-
- /* gdk_fb_window_containing_pointer might have been destroyed.
- * The refcount we hold on it should keep it, but it's parents
- * might have died.
- */
- if (GDK_WINDOW_DESTROYED (a))
- a = _gdk_parent_root;
-
- gdk_fb_mouse_get_info (&x, &y, &my_mask);
-
- c = gdk_fb_find_common_ancestor (a, b);
-
- non_linear = (c != a) && (c != b);
-
- event_win = gdk_fb_pointer_event_window (a, GDK_LEAVE_NOTIFY);
- if (event_win)
- {
- event = gdk_event_make (event_win, GDK_LEAVE_NOTIFY, TRUE);
- event->crossing.subwindow = NULL;
- gdk_window_get_root_origin (a, &x_int, &y_int);
- event->crossing.x = x - x_int;
- event->crossing.y = y - y_int;
- event->crossing.x_root = x;
- event->crossing.y_root = y;
- event->crossing.mode = mode;
- if (non_linear)
- event->crossing.detail = GDK_NOTIFY_NONLINEAR;
- else if (c==a)
- event->crossing.detail = GDK_NOTIFY_INFERIOR;
- else
- event->crossing.detail = GDK_NOTIFY_ANCESTOR;
- event->crossing.focus = FALSE;
- event->crossing.state = my_mask;
- }
-
- /* Traverse up from a to (excluding) c */
- if (c != a)
- {
- last = a;
- win = GDK_WINDOW (GDK_WINDOW_OBJECT (a)->parent);
- while (win != c)
- {
- event_win = gdk_fb_pointer_event_window (win, GDK_LEAVE_NOTIFY);
- if (event_win)
- {
- event = gdk_event_make (event_win, GDK_LEAVE_NOTIFY, TRUE);
- event->crossing.subwindow = gdk_window_ref (last);
- gdk_window_get_root_origin (win, &x_int, &y_int);
- event->crossing.x = x - x_int;
- event->crossing.y = y - y_int;
- event->crossing.x_root = x;
- event->crossing.y_root = y;
- event->crossing.mode = mode;
- if (non_linear)
- event->crossing.detail = GDK_NOTIFY_NONLINEAR_VIRTUAL;
- else
- event->crossing.detail = GDK_NOTIFY_VIRTUAL;
- event->crossing.focus = FALSE;
- event->crossing.state = my_mask;
- }
- last = win;
- win = GDK_WINDOW (GDK_WINDOW_OBJECT (win)->parent);
- }
- }
-
- /* Traverse down from c to b */
- if (c != b)
- {
- path = NULL;
- win = GDK_WINDOW( GDK_WINDOW_OBJECT (b)->parent);
- while (win != c)
- {
- path = g_list_prepend (path, win);
- win = GDK_WINDOW( GDK_WINDOW_OBJECT (win)->parent);
- }
-
- list = path;
- while (list)
- {
- win = (GdkWindow *)list->data;
- list = g_list_next (list);
- if (list)
- next = (GdkWindow *)list->data;
- else
- next = b;
-
- event_win = gdk_fb_pointer_event_window (win, GDK_ENTER_NOTIFY);
- if (event_win)
- {
- event = gdk_event_make (event_win, GDK_ENTER_NOTIFY, TRUE);
- event->crossing.subwindow = gdk_window_ref (next);
- gdk_window_get_root_origin (win, &x_int, &y_int);
- event->crossing.x = x - x_int;
- event->crossing.y = y - y_int;
- event->crossing.x_root = x;
- event->crossing.y_root = y;
- event->crossing.mode = mode;
- if (non_linear)
- event->crossing.detail = GDK_NOTIFY_NONLINEAR_VIRTUAL;
- else
- event->crossing.detail = GDK_NOTIFY_VIRTUAL;
- event->crossing.focus = FALSE;
- event->crossing.state = my_mask;
- }
- }
- g_list_free (path);
- }
-
- event_win = gdk_fb_pointer_event_window (b, GDK_ENTER_NOTIFY);
- if (event_win)
- {
- event = gdk_event_make (event_win, GDK_ENTER_NOTIFY, TRUE);
- event->crossing.subwindow = NULL;
- gdk_window_get_root_origin (b, &x_int, &y_int);
- event->crossing.x = x - x_int;
- event->crossing.y = y - y_int;
- event->crossing.x_root = x;
- event->crossing.y_root = y;
- event->crossing.mode = mode;
- if (non_linear)
- event->crossing.detail = GDK_NOTIFY_NONLINEAR;
- else if (c==a)
- event->crossing.detail = GDK_NOTIFY_ANCESTOR;
- else
- event->crossing.detail = GDK_NOTIFY_INFERIOR;
- event->crossing.focus = FALSE;
- event->crossing.state = my_mask;
- }
-
- if (mode != GDK_CROSSING_GRAB)
- {
- gdk_fb_change_focus (b);
- if (b != gdk_fb_window_containing_pointer)
- {
- gdk_window_unref (gdk_fb_window_containing_pointer);
- gdk_fb_window_containing_pointer = gdk_window_ref (b);
- }
- }
-}
-
-static void
-show_window_internal (GdkWindow *window,
- gboolean raise)
-{
- GdkWindowObject *private;
- GdkWindow *mousewin;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowObject*) window;
-
- if (!private->destroyed && !GDK_WINDOW_IS_MAPPED (private))
- {
- private->state = 0;
-
- if (raise)
- gdk_fb_window_raise (window);
-
- if (all_parents_shown ((GdkWindowObject *)private->parent))
- {
- GdkRectangle rect;
-
- recompute_drawable ((GdkDrawable *)window);
-
- send_map_events (private, TRUE);
-
- mousewin = gdk_window_at_pointer (NULL, NULL);
- gdk_fb_window_send_crossing_events (NULL,
- mousewin,
- GDK_CROSSING_NORMAL);
-
- if (private->input_only)
- return;
-
- rect.x = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
- rect.y = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
- rect.width = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_x - rect.x;
- rect.height = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_y - rect.y;
- gdk_window_invalidate_rect (_gdk_parent_root, &rect, TRUE);
- }
- }
-}
-
-void
-gdk_window_show_unraised (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
-
- show_window_internal (window, FALSE);
-}
-
-void
-gdk_window_show (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
-
- show_window_internal (window, TRUE);
-}
-
-void
-gdk_window_hide (GdkWindow *window)
-{
- GdkWindowObject *private;
- GdkWindow *mousewin;
- GdkWindow *event_win;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowObject*) window;
-
- if (!private->destroyed && GDK_WINDOW_IS_MAPPED (private))
- {
- GdkEvent *event;
- GdkRectangle r;
- gboolean do_hide;
-
- event_win = gdk_fb_other_event_window (window, GDK_UNMAP);
- if (event_win)
- event = gdk_event_make (event_win, GDK_UNMAP, TRUE);
-
- r.x = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
- r.y = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
- r.width = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_x - r.x;
- r.height = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_y - r.y;
-
- private->state = GDK_WINDOW_STATE_WITHDRAWN;
-
- mousewin = gdk_window_at_pointer (NULL, NULL);
- gdk_fb_window_send_crossing_events (NULL,
- mousewin,
- GDK_CROSSING_NORMAL);
-
- do_hide = gdk_fb_cursor_need_hide (&r);
-
- if (do_hide)
- gdk_fb_cursor_hide ();
- if (window == _gdk_fb_pointer_grab_window)
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- if (window == _gdk_fb_keyboard_grab_window)
- gdk_keyboard_ungrab (GDK_CURRENT_TIME);
-
- /* Clear the root window, as it might be visible under
- the hidden window*/
- gdk_window_clear_area (_gdk_parent_root,
- r.x,
- r.y,
- r.width,
- r.height);
- /* Invalidate the rect */
- gdk_window_invalidate_rect (_gdk_parent_root, &r, TRUE);
-
- if (do_hide)
- gdk_fb_cursor_unhide ();
- }
-}
-
-void
-gdk_window_withdraw (GdkWindow *window)
-{
- gdk_window_hide (window);
-}
-
-void
-gdk_window_move (GdkWindow *window,
- gint x,
- gint y)
-{
- GdkWindowObject *private = (GdkWindowObject *)window;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- gdk_window_move_resize (window, x, y,
- GDK_DRAWABLE_IMPL_FBDATA (private)->width,
- GDK_DRAWABLE_IMPL_FBDATA (private)->height);
-}
-
-void
-gdk_window_resize (GdkWindow *window,
- gint width,
- gint height)
-{
- GdkWindowObject *private;
- gint x, y;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- private = (GdkWindowObject*) window;
-
- if (width < 1)
- width = 1;
- if (height < 1)
- height = 1;
-
- x = private->x;
- y = private->y;
-
- if (private->parent && (private->parent->window_type != GDK_WINDOW_CHILD))
- {
- GdkWindowChildHandlerData *data;
-
- data = g_object_get_data (G_OBJECT (private->parent), "gdk-window-child-handler");
-
- if (data)
- (*data->get_pos) (window, &x, &y, data->user_data);
- }
-
- gdk_window_move_resize (window, x, y, width, height);
-}
-
-static void
-recompute_abs_positions(GdkDrawable *drawable,
- gint parent_x, gint parent_y,
- gint parent_llim_x, gint parent_llim_y,
- gint parent_lim_x, gint parent_lim_y)
-{
- GList *l;
-
- if (GDK_IS_WINDOW (drawable))
- {
- GdkWindowObject *private = GDK_WINDOW_P (drawable);
- int x, y;
-
- if (!GDK_WINDOW_IS_MAPPED (private))
- return;
-
-
- GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x = parent_x + private->x;
- GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y = parent_y + private->y;
- x = MAX (parent_llim_x, GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x);
- x = MIN (x, parent_lim_x);
- GDK_DRAWABLE_IMPL_FBDATA (private)->llim_x = x;
- y = MAX (parent_llim_y, GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y);
- y = MIN (y, parent_lim_y);
- GDK_DRAWABLE_IMPL_FBDATA (private)->llim_y = y;
- x = MIN (parent_lim_x,
- GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x + GDK_DRAWABLE_IMPL_FBDATA (private)->width);
- x = MAX (x, GDK_DRAWABLE_IMPL_FBDATA (private)->llim_x);
- GDK_DRAWABLE_IMPL_FBDATA (private)->lim_x = x;
- y = MIN (parent_lim_y,
- GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y + GDK_DRAWABLE_IMPL_FBDATA (private)->height);
- y = MAX (y, GDK_DRAWABLE_IMPL_FBDATA (private)->llim_y);
- GDK_DRAWABLE_IMPL_FBDATA (private)->lim_y = y;
-
- g_assert (GDK_DRAWABLE_IMPL_FBDATA (private)->llim_x <= GDK_DRAWABLE_IMPL_FBDATA (private)->lim_x);
- g_assert (GDK_DRAWABLE_IMPL_FBDATA (private)->llim_y <= GDK_DRAWABLE_IMPL_FBDATA (private)->lim_y);
-
- for (l = private->children; l; l = l->next)
- recompute_abs_positions (l->data,
- GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x,
- GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y,
- GDK_DRAWABLE_IMPL_FBDATA (private)->llim_x,
- GDK_DRAWABLE_IMPL_FBDATA (private)->llim_y,
- GDK_DRAWABLE_IMPL_FBDATA (private)->lim_x,
- GDK_DRAWABLE_IMPL_FBDATA (private)->lim_y);
- }
- else
- {
- GDK_DRAWABLE_IMPL_FBDATA (drawable)->abs_x = 0;
- GDK_DRAWABLE_IMPL_FBDATA (drawable)->abs_y = 0;
- GDK_DRAWABLE_IMPL_FBDATA (drawable)->llim_x = 0;
- GDK_DRAWABLE_IMPL_FBDATA (drawable)->llim_y = 0;
- GDK_DRAWABLE_IMPL_FBDATA (drawable)->lim_x = GDK_DRAWABLE_IMPL_FBDATA (drawable)->width;
- GDK_DRAWABLE_IMPL_FBDATA (drawable)->lim_y = GDK_DRAWABLE_IMPL_FBDATA (drawable)->height;
- }
-}
-
-static void
-recompute_rowstride(GdkDrawable *drawable)
-{
- GList *l;
- GdkWindowObject *private;
-
- g_return_if_fail (GDK_IS_WINDOW (drawable));
-
- private = GDK_WINDOW_P (drawable);
-
- GDK_DRAWABLE_IMPL_FBDATA (private)->rowstride = gdk_display->fb_stride;
- for (l = private->children; l; l = l->next)
- recompute_rowstride (l->data);
-}
-
-void
-gdk_fb_recompute_all (void)
-{
- GDK_DRAWABLE_IMPL_FBDATA (_gdk_parent_root)->width = gdk_display->fb_width;
- GDK_DRAWABLE_IMPL_FBDATA (_gdk_parent_root)->height = gdk_display->fb_height;
-
- recompute_abs_positions (_gdk_parent_root,
- 0, 0, 0, 0,
- gdk_display->fb_width, gdk_display->fb_height);
- recompute_rowstride (_gdk_parent_root);
-}
-
-static void
-recompute_drawable (GdkDrawable *drawable)
-{
- if (GDK_IS_WINDOW (drawable))
- {
- GdkWindowObject *private = GDK_WINDOW_P (drawable);
- GdkWindow *parent;
-
- parent = (GdkWindow *)private->parent;
- if (!parent)
- parent = _gdk_parent_root;
-
- recompute_abs_positions (drawable,
- GDK_DRAWABLE_IMPL_FBDATA (parent)->abs_x,
- GDK_DRAWABLE_IMPL_FBDATA (parent)->abs_y,
- GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_x,
- GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_y,
- GDK_DRAWABLE_IMPL_FBDATA (parent)->lim_x,
- GDK_DRAWABLE_IMPL_FBDATA (parent)->lim_y);
- }
- else
- recompute_abs_positions (drawable, 0, 0, 0, 0, INT_MAX, INT_MAX);
-}
-
-void
-gdk_fb_window_move_resize (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height,
- gboolean send_expose_events)
-{
- GdkWindowObject *private;
- gint dx, dy, dw, dh;
- gint i, draw_dir;
- GdkEvent *event;
- GdkWindow *mousewin;
- GdkRectangle root_rect;
- GdkRectangle update_rect;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- if (width < 1)
- width = 1;
- if (height < 1)
- height = 1;
-
- private = (GdkWindowObject*) window;
-
- if (private->parent && (private->parent->window_type != GDK_WINDOW_CHILD))
- {
- GdkWindowChildHandlerData *data;
-
- data = g_object_get_data (G_OBJECT (private->parent), "gdk-window-child-handler");
-
- if (data && (*data->changed) (window, x, y, width, height, data->user_data))
- return;
- }
-
- if (!private->destroyed)
- {
- GdkRegion *old_region = NULL;
-
- if (private->input_only)
- send_expose_events = FALSE;
-
- if (GDK_WINDOW_IS_MAPPED (private) && send_expose_events)
- old_region = gdk_fb_clip_region (GDK_DRAWABLE_IMPL(window), NULL, TRUE, FALSE, FALSE);
-
- dx = x - private->x;
- dy = y - private->y;
- dw = width - GDK_DRAWABLE_IMPL_FBDATA (private)->width;
- dh = height - GDK_DRAWABLE_IMPL_FBDATA (private)->height;
-
- private->x = x;
- private->y = y;
- GDK_DRAWABLE_IMPL_FBDATA (private)->width = width;
- GDK_DRAWABLE_IMPL_FBDATA (private)->height = height;
-
- if (GDK_WINDOW_IS_MAPPED (private))
- {
- recompute_drawable ((GdkDrawable *)window);
-
- if (send_expose_events)
- {
- GdkRegion *new_region, *region;
- gboolean handle_cursor = FALSE;
-
- new_region = gdk_fb_clip_region (GDK_DRAWABLE_IMPL (window), NULL, TRUE, FALSE, TRUE);
-
- region = gdk_region_copy (old_region);
- gdk_region_offset (region, dx, dy);
- gdk_region_intersect (region, new_region);
-
- if (region->numRects && ((dx != 0) || (dy != 0)))
- {
- GdkFBDrawingContext fbdc;
-
- if (gdk_fb_cursor_region_need_hide (old_region) ||
- gdk_fb_cursor_region_need_hide (new_region))
- {
- gdk_fb_cursor_hide ();
- handle_cursor = TRUE;
- }
-
- gdk_fb_drawing_context_init (&fbdc, GDK_DRAWABLE_IMPL (_gdk_parent_root), NULL, FALSE, FALSE);
-
- draw_dir = 1;
- if ((dy>0) || ((dy==0) && (dx>0)))
- draw_dir = -1;
-
- for (i=(draw_dir>0)?0:region->numRects-1;i >= 0 && i < region->numRects; i+=draw_dir)
- {
- GdkRegionBox *reg = &region->rects[i];
-
- gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL(_gdk_parent_root),
- _gdk_fb_screen_gc,
- GDK_DRAWABLE_IMPL(_gdk_parent_root),
- &fbdc,
- (reg->x1 - dx),
- (reg->y1 - dy),
- (reg->x1),
- (reg->y1),
- (reg->x2 - reg->x1),
- (reg->y2 - reg->y1));
- }
- gdk_fb_drawing_context_finalize (&fbdc);
- }
- gdk_shadow_fb_update (region->extents.x1, region->extents.y1,
- region->extents.x2, region->extents.y2);
-
- gdk_region_union (new_region, old_region);
- gdk_region_subtract (new_region, region);
- gdk_region_destroy (region);
-
-
- /* Clear the root window in new_region */
- root_rect.x = 0;
- root_rect.y = 0;
- root_rect.width = gdk_screen_width();
- root_rect.height = gdk_screen_height();
- gdk_region_get_clipbox (new_region, &update_rect);
- if (gdk_rectangle_intersect (&update_rect, &root_rect, &update_rect))
- gdk_window_clear_area (_gdk_parent_root,
- update_rect.x,
- update_rect.y,
- update_rect.width,
- update_rect.height);
- /* Invalidate regions in new_region */
- gdk_window_invalidate_region (_gdk_parent_root, new_region, TRUE);
-
- if (handle_cursor)
- gdk_fb_cursor_unhide ();
-
- gdk_region_destroy (old_region);
- gdk_region_destroy (new_region);
- }
- /* Send GdkEventConfigure for toplevel windows */
- if (private->window_type != GDK_WINDOW_CHILD)
- {
- GdkWindow *event_win;
- event_win = gdk_fb_other_event_window (window, GDK_CONFIGURE);
- if (event_win)
- {
- event = gdk_event_make (event_win, GDK_CONFIGURE, TRUE);
- event->configure.x = private->x;
- event->configure.y = private->y;
- event->configure.width = GDK_DRAWABLE_IMPL_FBDATA (private)->width;
- event->configure.height = GDK_DRAWABLE_IMPL_FBDATA (private)->height;
- }
- }
-
- /* The window the pointer is in might have changed */
- mousewin = gdk_window_at_pointer (NULL, NULL);
- gdk_fb_window_send_crossing_events (NULL,
- mousewin,
- GDK_CROSSING_NORMAL);
- }
- }
-}
-
-void
-gdk_window_move_resize (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- gdk_fb_window_move_resize (window, x, y, width, height, TRUE);
-}
-
-void
-gdk_window_reparent (GdkWindow *window,
- GdkWindow *new_parent,
- gint x,
- gint y)
-{
- GdkWindowObject *window_private;
- GdkWindowObject *parent_private;
- GdkWindowObject *old_parent_private;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
- g_return_if_fail (new_parent != NULL);
- g_return_if_fail (GDK_IS_WINDOW (new_parent));
-
- if (!new_parent)
- new_parent = _gdk_parent_root;
-
- window_private = (GdkWindowObject*) window;
- old_parent_private = (GdkWindowObject*)window_private->parent;
- parent_private = (GdkWindowObject*) new_parent;
-
- g_assert(GDK_DRAWABLE_IMPL_FBDATA (window_private)->colormap);
-
- window_private->parent = (GdkWindowObject *)new_parent;
-
- if (old_parent_private)
- old_parent_private->children = g_list_remove (old_parent_private->children, window);
-
- parent_private->children = g_list_prepend (parent_private->children, window);
-
- if (GDK_WINDOW_IS_MAPPED (window_private))
- {
- GdkRectangle r;
- GdkRegion *region;
-
- r.x = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
- r.y = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
- r.width = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_x - r.x;
- r.height = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_y - r.y;
- region = gdk_region_rectangle (&r);
-
- recompute_drawable ((GdkDrawable *)window);
- r.x = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
- r.y = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
- r.width = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_x - r.x;
- r.height = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_y - r.y;
- gdk_region_union_with_rect (region, &r);
-
- gdk_window_invalidate_region (_gdk_parent_root, region, TRUE);
- gdk_region_destroy (region);
- }
-}
-
-
-void
-_gdk_windowing_window_clear_area (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkPixmap *bgpm;
- GdkWindow *relto;
-
- if (GDK_WINDOW_P (window)->input_only)
- return;
-
- bgpm = GDK_WINDOW_P (window)->bg_pixmap;
-
- if (width == 0)
- width = GDK_DRAWABLE_IMPL_FBDATA (window)->width - x;
-
- if (height == 0)
- height = GDK_DRAWABLE_IMPL_FBDATA (window)->height - y;
-
- relto = window;
- while ((bgpm == GDK_PARENT_RELATIVE_BG) && relto)
- {
- relto = (GdkWindow *)GDK_WINDOW_P(relto)->parent;
- bgpm = GDK_WINDOW_P (relto)->bg_pixmap;
- }
-
- if (bgpm && bgpm != GDK_NO_BG)
- {
- int curx, cury;
- int xstep, ystep;
- int xtrans, ytrans;
- GdkFBDrawingContext fbdc;
-
- gdk_fb_drawing_context_init (&fbdc, GDK_DRAWABLE_IMPL (window), NULL, FALSE, TRUE);
-
- xtrans = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_x - GDK_DRAWABLE_IMPL_FBDATA (relto)->abs_x;
- ytrans = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_y - GDK_DRAWABLE_IMPL_FBDATA (relto)->abs_y;
-
- for (cury = y; cury < (y + height); cury += ystep)
- {
- int drawh = (cury + ytrans) % GDK_DRAWABLE_IMPL_FBDATA (bgpm)->height;
- ystep = GDK_DRAWABLE_IMPL_FBDATA (bgpm)->height - drawh;
-
- ystep = MIN (ystep, y + height - cury);
-
- for (curx = x; curx < (x + width); curx += xstep)
- {
- int draww = (curx + xtrans) % GDK_DRAWABLE_IMPL_FBDATA (bgpm)->width;
- xstep = GDK_DRAWABLE_IMPL_FBDATA (bgpm)->width - draww;
-
- xstep = MIN (xstep, x + width - curx);
- gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL (window),
- _gdk_fb_screen_gc,
- GDK_DRAWABLE_IMPL (bgpm),
- &fbdc,
- draww, drawh,
- curx, cury,
- xstep, ystep);
- }
- }
-
- gdk_fb_drawing_context_finalize (&fbdc);
- }
- else if (!bgpm)
- {
- if (relto == window)
- gdk_draw_rectangle (window, _gdk_fb_screen_gc, TRUE, x, y, width, height);
- else
- {
- /* GDK_PARENT_RELATIVE_BG, but no pixmap, get the color from the parent window. */
- GdkGC *gc;
- GdkGCValues values;
- values.foreground = GDK_WINDOW_P (relto)->bg_color;
- gc = gdk_gc_new_with_values (window, &values, GDK_GC_FOREGROUND);
- gdk_draw_rectangle (window, gc, TRUE, x, y, width, height);
- gdk_gc_unref (gc);
- }
- }
-}
-
-/* What's the diff? */
-void
-_gdk_windowing_window_clear_area_e (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- _gdk_windowing_window_clear_area (window, x, y, width, height);
-}
-
-static void
-gdk_fb_window_raise (GdkWindow *window)
-{
- GdkWindowObject *parent;
-
- parent = GDK_WINDOW_OBJECT (window)->parent;
-
- parent->children = g_list_remove (parent->children, window);
- parent->children = g_list_prepend (parent->children, window);
-}
-
-static void
-gdk_fb_window_lower (GdkWindow *window)
-{
- GdkWindowObject *parent;
-
- parent = GDK_WINDOW_OBJECT (window)->parent;
-
- parent->children = g_list_remove (parent->children, window);
- parent->children = g_list_append (parent->children, window);
-}
-
-
-void
-gdk_window_raise (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- gdk_fb_window_raise (window);
-
- if (GDK_WINDOW_OBJECT (window)->parent)
- gdk_window_invalidate_rect (window, NULL, TRUE);
-}
-
-void
-gdk_window_lower (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- gdk_fb_window_lower (window);
-
- if (GDK_WINDOW_OBJECT (window)->parent)
- gdk_window_invalidate_rect (window, NULL, TRUE);
-}
-
-void
-gdk_window_set_hints (GdkWindow *window,
- gint x,
- gint y,
- gint min_width,
- gint min_height,
- gint max_width,
- gint max_height,
- gint flags)
-{
-}
-
-void
-gdk_window_set_geometry_hints (GdkWindow *window,
- GdkGeometry *geometry,
- GdkWindowHints geom_mask)
-{
-}
-
-void
-gdk_window_set_title (GdkWindow *window,
- const gchar *title)
-{
-}
-
-void
-gdk_window_set_role (GdkWindow *window,
- const gchar *role)
-{
-}
-
-void
-gdk_window_set_transient_for (GdkWindow *window,
- GdkWindow *parent)
-{
- GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
- GdkWindowObject *root = GDK_WINDOW_OBJECT (_gdk_parent_root);
- int i;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- g_return_if_fail (parent != NULL);
- g_return_if_fail (GDK_IS_WINDOW (parent));
-
- g_return_if_fail ((GdkWindow *)private->parent == _gdk_parent_root);
- g_return_if_fail ((GdkWindow *)GDK_WINDOW_OBJECT (parent)->parent == _gdk_parent_root);
-
- root->children = g_list_remove (root->children, window);
-
- i = g_list_index (root->children, parent);
- if (i<0)
- root->children = g_list_prepend (root->children, window);
- else
- root->children = g_list_insert (root->children, window, i);
-}
-
-void
-gdk_window_set_background (GdkWindow *window,
- const GdkColor *color)
-{
- GdkWindowObject *private = (GdkWindowObject *)window;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- private->bg_color = *color;
-
- if (private->bg_pixmap &&
- private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
- private->bg_pixmap != GDK_NO_BG)
- {
- gdk_pixmap_unref (private->bg_pixmap);
- private->bg_pixmap = NULL;
- }
-}
-
-void
-gdk_window_set_back_pixmap (GdkWindow *window,
- GdkPixmap *pixmap,
- gboolean parent_relative)
-{
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkPixmap *old_pixmap;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
- g_return_if_fail (pixmap == NULL || !parent_relative);
- g_return_if_fail (pixmap == NULL || gdk_drawable_get_depth (window) == gdk_drawable_get_depth (pixmap));
-
- if (pixmap && !gdk_drawable_get_colormap (pixmap))
- {
- g_warning ("gdk_window_set_back_pixmap(): pixmap must have a colormap");
- return;
- }
-
- old_pixmap = private->bg_pixmap;
-
- if (parent_relative)
- {
- private->bg_pixmap = GDK_PARENT_RELATIVE_BG;
- }
- else
- {
- if (pixmap)
- {
- gdk_pixmap_ref (pixmap);
- private->bg_pixmap = pixmap;
- }
- else
- {
- private->bg_pixmap = GDK_NO_BG;
- }
- }
-
- if (old_pixmap &&
- old_pixmap != GDK_PARENT_RELATIVE_BG &&
- old_pixmap != GDK_NO_BG)
- gdk_pixmap_unref (old_pixmap);
-}
-
-void
-gdk_window_set_cursor (GdkWindow *window,
- GdkCursor *cursor)
-{
- GdkCursor *old_cursor = GDK_WINDOW_IMPL_FBDATA(window)->cursor;
- GdkRectangle window_reg;
-
- GDK_WINDOW_IMPL_FBDATA (window)->cursor = cursor ? gdk_cursor_ref (cursor) : NULL;
-
- if (old_cursor)
- gdk_cursor_unref (old_cursor);
-
- window_reg.x = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
- window_reg.y = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
- window_reg.width = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_x - window_reg.x;
- window_reg.height = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_y - window_reg.y;
- if (gdk_fb_cursor_need_hide (&window_reg))
- gdk_fb_cursor_reset ();
-}
-
-void
-gdk_window_get_geometry (GdkWindow *window,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- gint *depth)
-{
- GdkWindowObject *private = (GdkWindowObject *)window;
-
- g_return_if_fail (window == NULL || GDK_IS_WINDOW (window));
-
- if (!window)
- window = _gdk_parent_root;
-
- if (!private->destroyed)
- {
-
- if (x)
- *x = private->x;
- if (y)
- *y = private->y;
- if (width)
- *width = GDK_DRAWABLE_IMPL_FBDATA (window)->width;
- if (height)
- *height = GDK_DRAWABLE_IMPL_FBDATA (window)->height;
- if (depth)
- *depth = gdk_display->modeinfo.bits_per_pixel;
- }
-}
-
-gboolean
-gdk_window_get_origin (GdkWindow *window,
- gint *x,
- gint *y)
-{
- g_return_val_if_fail (window != NULL, FALSE);
-
- if (x)
- *x = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_x;
- if (y)
- *y = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_y;
-
- return TRUE;
-}
-
-gboolean
-gdk_window_get_deskrelative_origin (GdkWindow *window,
- gint *x,
- gint *y)
-{
- gint tx = 0;
- gint ty = 0;
- gboolean return_val;
-
- g_return_val_if_fail (window != NULL, 0);
-
- if (!GDK_WINDOW_DESTROYED (window))
- {
- tx = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_x;
- ty = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_y;
-
- return_val = TRUE;
- }
- else
- return_val = FALSE;
-
- if (x)
- *x = tx;
- if (y)
- *y = ty;
-
- return return_val;
-}
-
-void
-gdk_window_get_root_origin (GdkWindow *window,
- gint *x,
- gint *y)
-{
- gdk_window_get_deskrelative_origin (window, x, y);
-}
-
-static GdkRegion*
-gdk_window_fb_get_visible_region (GdkDrawable *drawable)
-{
- GdkDrawableFBData *priv = GDK_DRAWABLE_FBDATA (drawable);
- GdkRectangle result_rect;
- GdkRectangle screen_rect;
-
- result_rect.x = 0;
- result_rect.y = 0;
- result_rect.width = priv->width;
- result_rect.height = priv->height;
-
- screen_rect.x = -priv->abs_x;
- screen_rect.y = -priv->abs_y;
- screen_rect.width = gdk_display->fb_width;
- screen_rect.height = gdk_display->fb_height;
-
- gdk_rectangle_intersect (&result_rect, &screen_rect, &result_rect);
-
- return gdk_region_rectangle (&result_rect);
-}
-
-GdkWindow *
-_gdk_windowing_window_get_pointer (GdkDisplay *display,
- GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- GdkWindow *return_val;
- int winx = 0;
- int winy = 0;
- int x_int, y_int;
- gint shape_dx, shape_dy;
- GdkRegion *shape;
-
- g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
-
- gdk_window_get_root_origin (window, &x_int, &y_int);
- gdk_fb_mouse_get_info (&winx, &winy, mask);
-
- winx -= x_int;
- winy -= y_int;
-
- *x = winx;
- *y = winy;
-
- return_val = NULL;
-
- shape = gdk_fb_window_peek_shape (window, &shape_dx, &shape_dy);
- if ((winx >= 0) && (winx < GDK_DRAWABLE_IMPL_FBDATA (window)->width) &&
- (winy >= 0) && (winy < GDK_DRAWABLE_IMPL_FBDATA (window)->height) &&
- (!shape || gdk_region_point_in (shape, winx - shape_dx, winy - shape_dy)))
- {
- GdkWindowObject *private;
- GdkWindowObject *sub;
- int subx = winx, suby = winy;
-
- for (private = sub = (GdkWindowObject *)window; sub; private = sub)
- {
- GList *ltmp;
-
- for (ltmp = private->children; ltmp; ltmp = ltmp->next)
- {
- sub = ltmp->data;
-
- if (!GDK_WINDOW_IS_MAPPED (sub))
- continue;
-
- shape = gdk_fb_window_peek_shape (GDK_WINDOW (sub),
- &shape_dx, &shape_dy);
- if (subx >= sub->x &&
- (subx < (GDK_DRAWABLE_IMPL_FBDATA (sub)->width + sub->x)) &&
- (suby >= sub->y) &&
- (suby < (GDK_DRAWABLE_IMPL_FBDATA (sub)->height + sub->y)) &&
- (!shape || gdk_region_point_in (shape, subx - sub->x - shape_dx, suby - sub->y - shape_dy)))
- {
- subx -= sub->x;
- suby -= sub->y;
- break;
- }
- }
-
- if (!ltmp)
- {
- sub = NULL;
- break;
- }
- }
-
- return_val = (GdkWindow *)private;
- }
-
- if (!return_val)
- return_val = _gdk_parent_root;
-
- return return_val;
-}
-
-void
-_gdk_windowing_get_pointer (GdkDisplay *display,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- GdkScreen *default_screen = gdk_display_get_default_screen (display);
- GdkWindow *root_window = gdk_screen_get_root_window (default_screen);
-
- *screen = default_screen;
- _gdk_windowing_window_get_pointer (display, root_window, x, y, mask);
-}
-
-GdkWindow*
-_gdk_windowing_window_at_pointer (GdkDisplay *display,
- gint *win_x,
- gint *win_y)
-{
- gint rx, ry;
- GdkWindow *retval = gdk_window_get_pointer (NULL, win_x, win_y, NULL);
-
- if (retval)
- {
- gdk_window_get_origin (retval, &ry, &rx);
- (*win_x) -= rx;
- (*win_y) -= ry;
- }
-
- return retval;
-}
-
-GdkEventMask
-gdk_window_get_events (GdkWindow *window)
-{
- g_return_val_if_fail (window != NULL, 0);
- g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
-
- if (GDK_WINDOW_DESTROYED (window))
- return 0;
- else
- return GDK_WINDOW_OBJECT (window)->event_mask;
-}
-
-void
-gdk_window_set_events (GdkWindow *window,
- GdkEventMask event_mask)
-{
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- if (event_mask & GDK_BUTTON_MOTION_MASK)
- event_mask |=
- GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK |
- GDK_BUTTON3_MOTION_MASK;
-
- GDK_WINDOW_OBJECT (window)->event_mask = GDK_STRUCTURE_MASK | event_mask;
-}
-
-void
-gdk_window_add_colormap_windows (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- /* N/A */
-}
-
-
-GdkRegion*
-gdk_fb_region_create_from_bitmap (GdkBitmap *bitmap)
-{
- GdkDrawableFBData *private;
- GdkRegion *region;
- GdkRectangle rect;
- gboolean in_rect;
- gint x;
- guchar bit_mask;
- guchar *src;
-
- g_return_val_if_fail(bitmap != NULL, NULL);
- g_return_val_if_fail(GDK_IS_PIXMAP(bitmap), NULL);
-
- private = GDK_DRAWABLE_IMPL_FBDATA (bitmap);
-
- g_return_val_if_fail(private->depth == 1, NULL);
-
- region = gdk_region_new();
-
- rect.height = 1;
-
- in_rect = FALSE; /* Haven't started a rectangle yet */
-
- for (rect.y = 0; rect.y < private->height; (rect.y)++)
- {
- src = private->mem + rect.y * private->rowstride;
- bit_mask = 1;
- for (x = 0; x < private->width; x++)
- {
- if ((*src & bit_mask) && !in_rect)
- {
- /* Start of rect */
- in_rect = TRUE;
- rect.x = x;
- }
- else if (!(*src & bit_mask) && in_rect)
- {
- /* End of rect */
- in_rect = FALSE;
- rect.width = x - rect.x;
- gdk_region_union_with_rect (region, &rect);
- }
-
- if (bit_mask == 1<<7)
- {
- bit_mask = 1;
- src++;
- }
- else
- bit_mask <<= 1;
- }
-
- if (in_rect)
- {
- /* Past end of line */
- in_rect = FALSE;
- rect.width = x - rect.x;
- gdk_region_union_with_rect (region, &rect);
- }
- }
-
- return region;
-}
-
-GdkRegion *
-gdk_fb_window_peek_shape (GdkDrawable *window, gint *dx, gint *dy)
-{
- gint x, y;
-
- if (!GDK_IS_WINDOW (window))
- return NULL;
-
- if (GDK_WINDOW_IMPL_FBDATA (window)->shape == NULL)
- return NULL;
-
- x = y = 0;
-
- while (GDK_WINDOW_IMPL_FBDATA (window)->shape == GDK_FB_USE_CHILD_SHAPE)
- {
- GList *children;
- children = ((GdkWindowObject*)window)->children;
- if (children)
- {
- window = (GdkDrawable *)children->data;
- x += GDK_WINDOW_P(window)->x;
- y += GDK_WINDOW_P(window)->y;
- }
- else
- return NULL;
- }
-
- *dx = x;
- *dy = y;
-
- return GDK_WINDOW_IMPL_FBDATA (window)->shape;
-}
-GdkRegion *
-gdk_fb_window_get_abs_shape (GdkDrawable *window)
-{
- GdkRegion *shape;
-
- if (!GDK_IS_WINDOW (window))
- return NULL;
-
- if (GDK_WINDOW_IMPL_FBDATA (window)->shape == NULL)
- return NULL;
-
- if (GDK_WINDOW_IMPL_FBDATA (window)->shape == GDK_FB_USE_CHILD_SHAPE)
- {
- GList *children;
- children = ((GdkWindowObject*)window)->children;
- if (children)
- return gdk_fb_window_get_abs_shape ((GdkDrawable *)children->data);
- else
- return NULL;
- }
-
- shape = gdk_region_copy (GDK_WINDOW_IMPL_FBDATA (window)->shape);
- gdk_region_offset (shape,
- GDK_DRAWABLE_IMPL_FBDATA (window)->abs_x,
- GDK_DRAWABLE_IMPL_FBDATA (window)->abs_y);
- return shape;
-}
-
-
-static void
-_gdk_window_shape_combine_region (GdkWindow *window,
- GdkRegion *shape,
- gint x,
- gint y)
-{
- GdkWindowFBData *private;
- GdkDrawableFBData *drawable_private;
- GdkRegion *old_region = NULL;
- GdkRegion *new_region = NULL;
- GdkRectangle rect;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- private = GDK_WINDOW_IMPL_FBDATA (window);
- drawable_private = GDK_DRAWABLE_IMPL_FBDATA (window);
-
- if (GDK_WINDOW_IS_MAPPED (window))
- {
- old_region = gdk_fb_window_get_abs_shape (window);
- if (old_region == NULL)
- {
- rect.x = drawable_private->llim_x;
- rect.y = drawable_private->llim_y;
- rect.width = drawable_private->lim_x - rect.x;
- rect.height = drawable_private->lim_y - rect.y;
- old_region = gdk_region_rectangle (&rect);
- }
- }
-
- if (private->shape && private->shape != GDK_FB_USE_CHILD_SHAPE)
- gdk_region_destroy (private->shape);
-
- if (shape)
- {
- private->shape = shape;
- if (shape != GDK_FB_USE_CHILD_SHAPE)
- gdk_region_offset (private->shape, x, y);
- }
- else
- private->shape = NULL;
-
- if (GDK_WINDOW_IS_MAPPED (window))
- {
- new_region = gdk_fb_window_get_abs_shape (window);
- if (new_region == NULL)
- {
- rect.x = drawable_private->llim_x;
- rect.y = drawable_private->llim_y;
- rect.width = drawable_private->lim_x - rect.x;
- rect.height = drawable_private->lim_y - rect.y;
- new_region = gdk_region_rectangle (&rect);
- }
-
- gdk_region_subtract (old_region, new_region);
- gdk_region_destroy (new_region);
- gdk_window_invalidate_region (_gdk_parent_root, old_region, TRUE);
- gdk_region_destroy (old_region);
- }
-}
-
-void
-gdk_window_shape_combine_mask (GdkWindow *window,
- GdkBitmap *mask,
- gint x, gint y)
-{
- _gdk_window_shape_combine_region (window,
- (mask == GDK_FB_USE_CHILD_SHAPE)?
- GDK_FB_USE_CHILD_SHAPE :
- mask ?
- gdk_fb_region_create_from_bitmap (mask) :
- NULL,
- x, y);
-}
-
-void
-gdk_window_shape_combine_region (GdkWindow *window,
- GdkRegion *shape,
- gint x,
- gint y)
-{
- _gdk_window_shape_combine_region (window,
- gdk_region_copy (shape),
- x, y);
-}
-
-void
-gdk_window_set_override_redirect (GdkWindow *window,
- gboolean override_redirect)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- /* N/A */
-}
-
-void
-gdk_window_set_accept_focus (GdkWindow *window,
- gboolean accept_focus)
-{
- GdkWindowObject *private;
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- private = (GdkWindowObject *)window;
-
- accept_focus = accept_focus != FALSE;
-
- if (private->accept_focus != accept_focus)
- private->accept_focus = accept_focus;
-}
-
-void
-gdk_window_set_focus_on_map (GdkWindow *window,
- gboolean focus_on_map)
-{
- GdkWindowObject *private;
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- private = (GdkWindowObject *)window;
-
- focus_on_map = focus_on_map != FALSE;
-
- if (private->focus_on_map != focus_on_map)
- private->focus_on_map = focus_on_map;
-}
-
-void
-gdk_window_set_icon (GdkWindow *window,
- GdkWindow *icon_window,
- GdkPixmap *pixmap,
- GdkBitmap *mask)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- /* N/A */
-}
-
-void
-gdk_window_set_icon_name (GdkWindow *window,
- const gchar * name)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- /* N/A */
-}
-
-void
-gdk_window_set_group (GdkWindow *window,
- GdkWindow *leader)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
- g_return_if_fail (leader != NULL);
- g_return_if_fail (GDK_IS_WINDOW (leader));
-
- /* N/A */
-}
-
-void
-gdk_fb_window_set_child_handler (GdkWindow *window,
- GdkWindowChildChanged changed,
- GdkWindowChildGetPos get_pos,
- gpointer user_data)
-{
- GdkWindowChildHandlerData *data;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- data = g_new (GdkWindowChildHandlerData, 1);
- data->changed = changed;
- data->get_pos = get_pos;
- data->user_data = user_data;
-
- g_object_set_data_full (G_OBJECT (window), "gdk-window-child-handler",
- data, (GDestroyNotify) g_free);
-}
-
-void
-gdk_window_set_decorations (GdkWindow *window,
- GdkWMDecoration decorations)
-{
- GdkWMDecoration *dec;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- dec = g_new (GdkWMDecoration, 1);
- *dec = decorations;
-
- g_object_set_data_full (G_OBJECT (window), "gdk-window-decorations",
- dec, (GDestroyNotify) g_free);
-}
-
-gboolean
-gdk_window_get_decorations(GdkWindow *window,
- GdkWMDecoration *decorations)
-{
- GdkWMDecoration *dec;
-
- g_return_val_if_fail (window != NULL, FALSE);
- g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
-
-
- dec = g_object_get_data (G_OBJECT (window), "gdk-window-decorations");
- if (dec)
- {
- *decorations = *dec;
- return TRUE;
- }
- return FALSE;
-}
-
-void
-gdk_window_set_functions (GdkWindow *window,
- GdkWMFunction functions)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- /* N/A */
-}
-
-void
-gdk_window_set_child_shapes (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
-}
-
-void
-gdk_window_merge_child_shapes (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
-}
-
-/*************************************************************
- * gdk_window_set_static_gravities:
- * Set the bit gravity of the given window to static,
- * and flag it so all children get static subwindow
- * gravity.
- * arguments:
- * window: window for which to set static gravity
- * use_static: Whether to turn static gravity on or off.
- * results:
- * Does the XServer support static gravity?
- *************************************************************/
-
-gboolean
-gdk_window_set_static_gravities (GdkWindow *window,
- gboolean use_static)
-{
- g_return_val_if_fail (window != NULL, FALSE);
- g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
-
- return TRUE;
-}
-
-void
-_gdk_windowing_window_get_offsets (GdkWindow *window,
- gint *x_offset,
- gint *y_offset)
-{
- *x_offset = *y_offset = 0;
-}
-
-gboolean
-_gdk_windowing_window_queue_antiexpose (GdkWindow *window,
- GdkRegion *area)
-{
- return FALSE;
-}
-
-void
-gdk_window_stick (GdkWindow *window)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-}
-
-void
-gdk_window_unstick (GdkWindow *window)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-}
-
-void
-gdk_window_maximize (GdkWindow *window)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- gdk_synthesize_window_state (window,
- 0,
- GDK_WINDOW_STATE_MAXIMIZED);
-}
-
-void
-gdk_window_unmaximize (GdkWindow *window)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_MAXIMIZED,
- 0);
-}
-
-void
-gdk_window_iconify (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- g_warning ("gdk_window_iconify() not implemented.\n");
-}
-
-void
-gdk_window_deiconify (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- /* g_warning ("gdk_window_deiconify() not implemented.\n");*/
-}
-
-void
-gdk_window_fullscreen (GdkWindow *window)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- g_warning ("gdk_window_fullscreen() not implemented.\n");
-}
-
-void
-gdk_window_unfullscreen (GdkWindow *window)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- /* g_warning ("gdk_window_unfullscreen() not implemented.\n");*/
-}
-
-void
-gdk_window_set_keep_above (GdkWindow *window, gboolean setting)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- g_warning ("gdk_window_set_keep_above() not implemented.\n");
-}
-
-void
-gdk_window_set_keep_below (GdkWindow *window, gboolean setting)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- g_warning ("gdk_window_set_keep_below() not implemented.\n");
-}
-
-void
-gdk_window_focus (GdkWindow *window,
- guint32 timestamp)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- g_warning ("gdk_window_focus() not implemented.\n");
-}
-
-void
-gdk_window_set_type_hint (GdkWindow *window,
- GdkWindowTypeHint hint)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-}
-
-void
-gdk_window_set_modal_hint (GdkWindow *window,
- gboolean modal)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-}
-
-void
-gdk_window_set_skip_taskbar_hint (GdkWindow *window,
- gboolean skips_taskbar)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-}
-
-void
-gdk_window_set_skip_pager_hint (GdkWindow *window,
- gboolean skips_pager)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-}
-
-void
-gdk_window_begin_resize_drag (GdkWindow *window,
- GdkWindowEdge edge,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-
-}
-
-void
-gdk_window_begin_move_drag (GdkWindow *window,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-}
-
-void
-gdk_window_set_icon_list (GdkWindow *window,
- GList *pixbufs)
-{
- /* We don't support icons right now */
-}
-
-/* No need to care about frames. Decoration is done by GtkWindow */
-void
-gdk_window_get_frame_extents (GdkWindow *window,
- GdkRectangle *rect)
-{
- g_return_if_fail (window != NULL);
-
- rect->x = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_x;
- rect->y = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_y;
- rect->width = GDK_DRAWABLE_IMPL_FBDATA (window)->width;
- rect->height = GDK_DRAWABLE_IMPL_FBDATA (window)->height;
-}
-
-GdkWindow*
-gdk_window_foreign_new_for_display (GdkDisplay *display,
- GdkNativeWindow anid)
-{
- return (GdkWindow*) gdk_drawable_ref ((GdkDrawable *)anid);
-}
-
-GdkWindow*
-gdk_window_lookup (GdkNativeWindow anid)
-{
- return (GdkWindow*) (anid);
-}
-
-GdkWindow *
-gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid)
-{
- g_return_val_if_fail (display == gdk_display_get_default(), NULL);
-
- return (GdkWindow*) (anid);
-}
-
-void
-gdk_window_enable_synchronized_configure (GdkWindow *window)
-{
-}
-
-void
-gdk_window_configure_finished (GdkWindow *window)
-{
-}
diff --git a/gdk/linux-fb/mi.h b/gdk/linux-fb/mi.h
deleted file mode 100644
index b65179700..000000000
--- a/gdk/linux-fb/mi.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef MI_H
-#define MI_H 1
-
-#include "mitypes.h"
-#include "mistruct.h"
-#include "mifpoly.h"
-#include "mifillarc.h"
-#include "mipoly.h"
-
-void miPolyArc(GdkDrawable *pDraw, GdkGC *pGC, int narcs, miArc *parcs);
-void miPolyFillArc(GdkDrawable *pDraw, GdkGC *pGC, int narcs, miArc *parcs);
-void miFillPolygon(GdkDrawable *dst, GdkGC *pgc, int shape, int mode, int count, GdkPoint *pPts);
-
-miDashPtr miDashLine(int npt, GdkPoint *ppt, unsigned int nDash, unsigned char *pDash, unsigned int offset, int *pnseg);
-void miZeroLine(GdkDrawable *pDraw, GdkGC *pGC, int mode, int npt, GdkPoint *pptInit);
-void miZeroDashLine(GdkDrawable *dst, GdkGC *pgc, int mode, int nptInit, GdkPoint *pptInit);
-void miStepDash (int dist, int *pDashIndex, unsigned char *pDash, int numInDashList, int *pDashOffset);
-void miWideDash (GdkDrawable *pDrawable, GdkGC *pGC, int mode, int npt, GdkPoint *pPts);
-void miWideLine (GdkDrawable *pDrawable, GdkGC *pGC, int mode, int npt, GdkPoint *pPts);
-
-#endif
diff --git a/gdk/linux-fb/miarc.c b/gdk/linux-fb/miarc.c
deleted file mode 100644
index ea237d9d7..000000000
--- a/gdk/linux-fb/miarc.c
+++ /dev/null
@@ -1,3470 +0,0 @@
-/* $XFree86: xc/programs/Xserver/mi/miarc.c,v 3.7 1999/12/27 00:39:56 robin Exp $ */
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* $TOG: miarc.c /main/91 1998/02/09 14:45:57 kaleb $ */
-/* Author: Keith Packard and Bob Scheifler */
-/* Warning: this code is toxic, do not dally very long here. */
-
-#define _XOPEN_SOURCE_EXTENDED /* to get prototype for cbrt on some systems */
-#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */
-
-#include <config.h>
-#include <string.h> /* memmove */
-#include <limits.h>
-
-#include <math.h>
-
-#include "mi.h"
-#include "gdkprivate-fb.h"
-
-static double miDsin(double a), miDcos(double a), miDasin(double a), miDatan2(double x, double y);
-
-#ifdef ICEILTEMPDECL
-ICEILTEMPDECL
-#endif
-
-/*
- * some interesting sematic interpretation of the protocol:
- *
- * Self intersecting arcs (i.e. those spanning 360 degrees)
- * never join with other arcs, and are drawn without caps
- * (unless on/off dashed, in which case each dash segment
- * is capped, except when the last segment meets the
- * first segment, when no caps are drawn)
- *
- * double dash arcs are drawn in two parts, first the
- * odd dashes (drawn in background) then the even dashes
- * (drawn in foreground). This means that overlapping
- * sections of foreground/background are drawn twice,
- * first in background then in foreground. The double-draw
- * occurs even when the function uses the destination values
- * (e.g. xor mode). This is the same way the wide-line
- * code works and should be "fixed".
- *
- */
-
-#undef max
-#undef min
-
-#if defined (__GNUC__) && defined (__STDC__) && !defined (__STRICT_ANSI__)
-#define USE_INLINE
-#endif
-
-struct bound {
- double min, max;
-};
-
-struct ibound {
- int min, max;
-};
-
-#define boundedLe(value, bounds)\
- ((bounds).min <= (value) && (value) <= (bounds).max)
-
-struct line {
- double m, b;
- int valid;
-};
-
-#define intersectLine(y,line) (line.m * (y) + line.b)
-
-/*
- * these are all y value bounds
- */
-
-struct arc_bound {
- struct bound ellipse;
- struct bound inner;
- struct bound outer;
- struct bound right;
- struct bound left;
- struct ibound inneri;
- struct ibound outeri;
-};
-
-struct accelerators {
- double tail_y;
- double h2;
- double w2;
- double h4;
- double w4;
- double h2mw2;
- double h2l;
- double w2l;
- double fromIntX;
- double fromIntY;
- struct line left, right;
- int yorgu;
- int yorgl;
- int xorg;
-};
-
-struct arc_def {
- double w, h, l;
- double a0, a1;
-};
-
-# define todeg(xAngle) (((double) (xAngle)) / 64.0)
-
-# define RIGHT_END 0
-# define LEFT_END 1
-
-typedef struct _miArcJoin {
- int arcIndex0, arcIndex1;
- int phase0, phase1;
- int end0, end1;
-} miArcJoinRec, *miArcJoinPtr;
-
-typedef struct _miArcCap {
- int arcIndex;
- int end;
-} miArcCapRec, *miArcCapPtr;
-
-typedef struct _miArcFace {
- SppPointRec clock;
- SppPointRec center;
- SppPointRec counterClock;
-} miArcFaceRec, *miArcFacePtr;
-
-typedef struct _miArcData {
- miArc arc;
- int render; /* non-zero means render after drawing */
- int join; /* related join */
- int cap; /* related cap */
- int selfJoin; /* final dash meets first dash */
- miArcFaceRec bounds[2];
- double x0, y0, x1, y1;
-} miArcDataRec, *miArcDataPtr;
-
-/*
- * This is an entire sequence of arcs, computed and categorized according
- * to operation. miDashArcs generates either one or two of these.
- */
-
-typedef struct _miPolyArc {
- int narcs;
- miArcDataPtr arcs;
- int ncaps;
- miArcCapPtr caps;
- int njoins;
- miArcJoinPtr joins;
-} miPolyArcRec, *miPolyArcPtr;
-
-typedef struct {
- short lx, lw, rx, rw;
-} miArcSpan;
-
-typedef struct {
- miArcSpan *spans;
- int count1, count2, k;
- char top, bot, hole;
-} miArcSpanData;
-
-typedef struct {
- unsigned long lrustamp;
- unsigned short lw;
- unsigned short width, height;
- miArcSpanData *spdata;
-} arcCacheRec;
-
-# define DASH_MAP_SIZE 91
-
-typedef struct {
- double map[DASH_MAP_SIZE];
-} dashMap;
-
-static void fillSpans(GdkDrawable *pDrawable, GdkGC *pGC);
-static void newFinalSpan(int y, int xmin, int xmax);
-static void drawArc (miArc *tarc, int l, int a0, int a1, miArcFacePtr right, miArcFacePtr left);
-static void drawQuadrant(struct arc_def *def, struct accelerators *acc,
- int a0, int a1, int mask, miArcFacePtr right, miArcFacePtr left,
- miArcSpanData *spdata);
-static void drawZeroArc(GdkDrawable *pDraw, GdkGC *pGC, miArc *tarc, int lw, miArcFacePtr right, miArcFacePtr left);
-static void miArcJoin(GdkDrawable *pDraw, GdkGC *pGC, miArcFacePtr pRight, miArcFacePtr pLeft, int xOrgRight, int yOrgRight,
- double xFtransRight, double yFtransRight,
- int xOrgLeft, int yOrgLeft,
- double xFtransLeft, double yFtransLeft);
-static void miArcCap(GdkDrawable *pDraw, GdkGC *pGC, miArcFacePtr pFace, int end, int xOrg, int yOrg,
- double xFtrans, double yFtrans);
-static void miRoundCap(GdkDrawable *pDraw, GdkGC *pGC, SppPointRec pCenter, SppPointRec pEnd, SppPointRec pCorner,
- SppPointRec pOtherCorner, int fLineEnd, int xOrg, int yOrg,
- double xFtrans, double yFtrans);
-static void miFreeArcs(miPolyArcPtr arcs, GdkGC *pGC);
-static int computeAngleFromPath(int startAngle, int endAngle, dashMap *map, int *lenp, int backwards);
-static miPolyArcPtr miComputeArcs (miArc *parcs, int narcs, GdkGC *gc);
-static int miGetArcPts(SppArcPtr parc, int cpt, SppPointPtr *ppPts);
-
-# define CUBED_ROOT_2 1.2599210498948732038115849718451499938964
-# define CUBED_ROOT_4 1.5874010519681993173435330390930175781250
-
-/*
- * draw one segment of the arc using the arc spans generation routines
- */
-
-static void
-miArcSegment(GdkDrawable *pDraw, GdkGC *pGC, miArc tarc, miArcFacePtr right, miArcFacePtr left)
-{
- int l = GDK_GC_FBDATA(pGC)->values.line_width;
- int a0, a1, startAngle, endAngle;
- miArcFacePtr temp;
-
- if (!l)
- l = 1;
-
- if (tarc.width == 0 || tarc.height == 0) {
- drawZeroArc (pDraw, pGC, &tarc, l, left, right);
- return;
- }
-
- a0 = tarc.angle1;
- a1 = tarc.angle2;
- if (a1 > FULLCIRCLE)
- a1 = FULLCIRCLE;
- else if (a1 < -FULLCIRCLE)
- a1 = -FULLCIRCLE;
- if (a1 < 0) {
- startAngle = a0 + a1;
- endAngle = a0;
- temp = right;
- right = left;
- left = temp;
- } else {
- startAngle = a0;
- endAngle = a0 + a1;
- }
- /*
- * bounds check the two angles
- */
- if (startAngle < 0)
- startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE;
- if (startAngle >= FULLCIRCLE)
- startAngle = startAngle % FULLCIRCLE;
- if (endAngle < 0)
- endAngle = FULLCIRCLE - (-endAngle) % FULLCIRCLE;
- if (endAngle > FULLCIRCLE)
- endAngle = (endAngle-1) % FULLCIRCLE + 1;
- if ((startAngle == endAngle) && a1) {
- startAngle = 0;
- endAngle = FULLCIRCLE;
- }
-
- drawArc (&tarc, l, startAngle, endAngle, right, left);
-}
-
-/*
-
-Three equations combine to describe the boundaries of the arc
-
-x^2/w^2 + y^2/h^2 = 1 ellipse itself
-(X-x)^2 + (Y-y)^2 = r^2 circle at (x, y) on the ellipse
-(Y-y) = (X-x)*w^2*y/(h^2*x) normal at (x, y) on the ellipse
-
-These lead to a quartic relating Y and y
-
-y^4 - (2Y)y^3 + (Y^2 + (h^4 - w^2*r^2)/(w^2 - h^2))y^2
- - (2Y*h^4/(w^2 - h^2))y + (Y^2*h^4)/(w^2 - h^2) = 0
-
-The reducible cubic obtained from this quartic is
-
-z^3 - (3N)z^2 - 2V = 0
-
-where
-
-N = (Y^2 + (h^4 - w^2*r^2/(w^2 - h^2)))/6
-V = w^2*r^2*Y^2*h^4/(4 *(w^2 - h^2)^2)
-
-Let
-
-t = z - N
-p = -N^2
-q = -N^3 - V
-
-Then we get
-
-t^3 + 3pt + 2q = 0
-
-The discriminant of this cubic is
-
-D = q^2 + p^3
-
-When D > 0, a real root is obtained as
-
-z = N + cbrt(-q+sqrt(D)) + cbrt(-q-sqrt(D))
-
-When D < 0, a real root is obtained as
-
-z = N - 2m*cos(acos(-q/m^3)/3)
-
-where
-
-m = sqrt(|p|) * sign(q)
-
-Given a real root Z of the cubic, the roots of the quartic are the roots
-of the two quadratics
-
-y^2 + ((b+A)/2)y + (Z + (bZ - d)/A) = 0
-
-where
-
-A = +/- sqrt(8Z + b^2 - 4c)
-b, c, d are the cubic, quadratic, and linear coefficients of the quartic
-
-Some experimentation is then required to determine which solutions
-correspond to the inner and outer boundaries.
-
-*/
-
-#define CACHESIZE 25
-
-static arcCacheRec arcCache[CACHESIZE];
-static unsigned long lrustamp;
-static arcCacheRec *lastCacheHit = &arcCache[0];
-
-#if 0
-static RESTYPE cacheType;
-
-/*
- * External so it can be called when low on memory.
- * Call with a zero ID in that case.
- */
-/*ARGSUSED*/
-int
-miFreeArcCache (data, id)
- gpointer data;
- guint id;
-{
- int k;
- arcCacheRec *cent;
-
- if (id)
- cacheType = 0;
-
- for (k = CACHESIZE, cent = &arcCache[0]; --k >= 0; cent++)
- {
- if (cent->spdata)
- {
- cent->lrustamp = 0;
- cent->lw = 0;
- g_free(cent->spdata);
- cent->spdata = NULL;
- }
- }
- lrustamp = 0;
- return TRUE;
-}
-#endif
-
-static void
-miComputeCircleSpans(int lw, miArc *parc, miArcSpanData *spdata)
-{
- register miArcSpan *span;
- int doinner;
- register int x, y, e;
- int xk, yk, xm, ym, dx, dy;
- register int slw, inslw;
- int inx = 0, iny, ine = 0;
- int inxk = 0, inyk = 0, inxm = 0, inym = 0;
-
- doinner = -lw;
- slw = parc->width - doinner;
- y = parc->height >> 1;
- dy = parc->height & 1;
- dx = 1 - dy;
- MIWIDEARCSETUP(x, y, dy, slw, e, xk, xm, yk, ym);
- inslw = parc->width + doinner;
- if (inslw > 0)
- {
- spdata->hole = spdata->top;
- MIWIDEARCSETUP(inx, iny, dy, inslw, ine, inxk, inxm, inyk, inym);
- }
- else
- {
- spdata->hole = FALSE;
- doinner = -y;
- }
- spdata->count1 = -doinner - spdata->top;
- spdata->count2 = y + doinner;
- span = spdata->spans;
- while (y)
- {
- MIFILLARCSTEP(slw);
- span->lx = dy - x;
- if (++doinner <= 0)
- {
- span->lw = slw;
- span->rx = 0;
- span->rw = span->lx + slw;
- }
- else
- {
- MIFILLINARCSTEP(inslw);
- span->lw = x - inx;
- span->rx = dy - inx + inslw;
- span->rw = inx - x + slw - inslw;
- }
- span++;
- }
- if (spdata->bot)
- {
- if (spdata->count2)
- spdata->count2--;
- else
- {
- if (lw > (int)parc->height)
- span[-1].rx = span[-1].rw = -((lw - (int)parc->height) >> 1);
- else
- span[-1].rw = 0;
- spdata->count1--;
- }
- }
-}
-
-static void
-miComputeEllipseSpans(int lw, miArc *parc, miArcSpanData *spdata)
-{
- register miArcSpan *span;
- double w, h, r, xorg;
- double Hs, Hf, WH, K, Vk, Nk, Fk, Vr, N, Nc, Z, rs;
- double A, T, b, d, x, y, t, inx, outx = 0.0, hepp, hepm;
- int flip, solution;
-
- w = (double)parc->width / 2.0;
- h = (double)parc->height / 2.0;
- r = lw / 2.0;
- rs = r * r;
- Hs = h * h;
- WH = w * w - Hs;
- Nk = w * r;
- Vk = (Nk * Hs) / (WH + WH);
- Hf = Hs * Hs;
- Nk = (Hf - Nk * Nk) / WH;
- Fk = Hf / WH;
- hepp = h + EPSILON;
- hepm = h - EPSILON;
- K = h + ((lw - 1) >> 1);
- span = spdata->spans;
- if (parc->width & 1)
- xorg = .5;
- else
- xorg = 0.0;
- if (spdata->top)
- {
- span->lx = 0;
- span->lw = 1;
- span++;
- }
- spdata->count1 = 0;
- spdata->count2 = 0;
- spdata->hole = (spdata->top &&
- (int)parc->height * lw <= (int)(parc->width * parc->width) &&
- lw < (int)parc->height);
- for (; K > 0.0; K -= 1.0)
- {
- N = (K * K + Nk) / 6.0;
- Nc = N * N * N;
- Vr = Vk * K;
- t = Nc + Vr * Vr;
- d = Nc + t;
- if (d < 0.0) {
- d = Nc;
- b = N;
- if ( (b < 0.0) == (t < 0.0) )
- {
- b = -b;
- d = -d;
- }
- Z = N - 2.0 * b * cos(acos(-t / d) / 3.0);
- if ( (Z < 0.0) == (Vr < 0.0) )
- flip = 2;
- else
- flip = 1;
- }
- else
- {
- d = Vr * sqrt(d);
- Z = N + cbrt(t + d) + cbrt(t - d);
- flip = 0;
- }
- A = sqrt((Z + Z) - Nk);
- T = (Fk - Z) * K / A;
- inx = 0.0;
- solution = FALSE;
- b = -A + K;
- d = b * b - 4 * (Z + T);
- if (d >= 0)
- {
- d = sqrt(d);
- y = (b + d) / 2;
- if ((y >= 0.0) && (y < hepp))
- {
- solution = TRUE;
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- t = sqrt(rs - (t * t));
- else
- t = 0;
- if (flip == 2)
- inx = x - t;
- else
- outx = x + t;
- }
- }
- b = A + K;
- d = b * b - 4 * (Z - T);
- /* Because of the large magnitudes involved, we lose enough precision
- * that sometimes we end up with a negative value near the axis, when
- * it should be positive. This is a workaround.
- */
- if (d < 0 && !solution)
- d = 0.0;
- if (d >= 0) {
- d = sqrt(d);
- y = (b + d) / 2;
- if (y < hepp)
- {
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- inx = x - sqrt(rs - (t * t));
- else
- inx = x;
- }
- y = (b - d) / 2;
- if (y >= 0.0)
- {
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- t = sqrt(rs - (t * t));
- else
- t = 0;
- if (flip == 1)
- inx = x - t;
- else
- outx = x + t;
- }
- }
- span->lx = ICEIL(xorg - outx);
- if (inx <= 0.0)
- {
- spdata->count1++;
- span->lw = ICEIL(xorg + outx) - span->lx;
- span->rx = ICEIL(xorg + inx);
- span->rw = -ICEIL(xorg - inx);
- }
- else
- {
- spdata->count2++;
- span->lw = ICEIL(xorg - inx) - span->lx;
- span->rx = ICEIL(xorg + inx);
- span->rw = ICEIL(xorg + outx) - span->rx;
- }
- span++;
- }
- if (spdata->bot)
- {
- outx = w + r;
- if (r >= h && r <= w)
- inx = 0.0;
- else if (Nk < 0.0 && -Nk < Hs)
- {
- inx = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk);
- if (inx > w - r)
- inx = w - r;
- }
- else
- inx = w - r;
- span->lx = ICEIL(xorg - outx);
- if (inx <= 0.0)
- {
- span->lw = ICEIL(xorg + outx) - span->lx;
- span->rx = ICEIL(xorg + inx);
- span->rw = -ICEIL(xorg - inx);
- }
- else
- {
- span->lw = ICEIL(xorg - inx) - span->lx;
- span->rx = ICEIL(xorg + inx);
- span->rw = ICEIL(xorg + outx) - span->rx;
- }
- }
- if (spdata->hole)
- {
- span = &spdata->spans[spdata->count1];
- span->lw = -span->lx;
- span->rx = 1;
- span->rw = span->lw;
- spdata->count1--;
- spdata->count2++;
- }
-}
-
-static double
-tailX(double K, struct arc_def *def, struct arc_bound *bounds, struct accelerators *acc)
-{
- double w, h, r;
- double Hs, Hf, WH, Vk, Nk, Fk, Vr, N, Nc, Z, rs;
- double A, T, b, d, x, y, t, hepp, hepm;
- int flip, solution;
- double xs[2];
- double *xp;
-
- w = def->w;
- h = def->h;
- r = def->l;
- rs = r * r;
- Hs = acc->h2;
- WH = -acc->h2mw2;
- Nk = def->w * r;
- Vk = (Nk * Hs) / (WH + WH);
- Hf = acc->h4;
- Nk = (Hf - Nk * Nk) / WH;
- if (K == 0.0) {
- if (Nk < 0.0 && -Nk < Hs) {
- xs[0] = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk);
- xs[1] = w - r;
- if (acc->left.valid && boundedLe(K, bounds->left) &&
- !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0)
- return xs[1];
- if (acc->right.valid && boundedLe(K, bounds->right) &&
- !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0)
- return xs[1];
- return xs[0];
- }
- return w - r;
- }
- Fk = Hf / WH;
- hepp = h + EPSILON;
- hepm = h - EPSILON;
- N = (K * K + Nk) / 6.0;
- Nc = N * N * N;
- Vr = Vk * K;
- xp = xs;
- xs[0] = 0.0;
- t = Nc + Vr * Vr;
- d = Nc + t;
- if (d < 0.0) {
- d = Nc;
- b = N;
- if ( (b < 0.0) == (t < 0.0) )
- {
- b = -b;
- d = -d;
- }
- Z = N - 2.0 * b * cos(acos(-t / d) / 3.0);
- if ( (Z < 0.0) == (Vr < 0.0) )
- flip = 2;
- else
- flip = 1;
- }
- else
- {
- d = Vr * sqrt(d);
- Z = N + cbrt(t + d) + cbrt(t - d);
- flip = 0;
- }
- A = sqrt((Z + Z) - Nk);
- T = (Fk - Z) * K / A;
- solution = FALSE;
- b = -A + K;
- d = b * b - 4 * (Z + T);
- if (d >= 0 && flip == 2)
- {
- d = sqrt(d);
- y = (b + d) / 2;
- if ((y >= 0.0) && (y < hepp))
- {
- solution = TRUE;
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- t = sqrt(rs - (t * t));
- else
- t = 0;
- *xp++ = x - t;
- }
- }
- b = A + K;
- d = b * b - 4 * (Z - T);
- /* Because of the large magnitudes involved, we lose enough precision
- * that sometimes we end up with a negative value near the axis, when
- * it should be positive. This is a workaround.
- */
- if (d < 0 && !solution)
- d = 0.0;
- if (d >= 0) {
- d = sqrt(d);
- y = (b + d) / 2;
- if (y < hepp)
- {
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- *xp++ = x - sqrt(rs - (t * t));
- else
- *xp++ = x;
- }
- y = (b - d) / 2;
- if (y >= 0.0 && flip == 1)
- {
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- t = sqrt(rs - (t * t));
- else
- t = 0;
- *xp++ = x - t;
- }
- }
- if (xp > &xs[1]) {
- if (acc->left.valid && boundedLe(K, bounds->left) &&
- !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0)
- return xs[1];
- if (acc->right.valid && boundedLe(K, bounds->right) &&
- !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0)
- return xs[1];
- }
- return xs[0];
-}
-
-static miArcSpanData *
-miComputeWideEllipse(int lw, miArc *parc, gboolean *mustFree)
-{
- register miArcSpanData *spdata;
- register arcCacheRec *cent, *lruent;
- register int k;
- arcCacheRec fakeent;
-
- if (!lw)
- lw = 1;
- if (parc->height <= 1500)
- {
- *mustFree = FALSE;
- cent = lastCacheHit;
- if (cent->lw == lw &&
- cent->width == parc->width && cent->height == parc->height)
- {
- cent->lrustamp = ++lrustamp;
- return cent->spdata;
- }
- lruent = &arcCache[0];
- for (k = CACHESIZE, cent = lruent; --k >= 0; cent++)
- {
- if (cent->lw == lw &&
- cent->width == parc->width && cent->height == parc->height)
- {
- cent->lrustamp = ++lrustamp;
- lastCacheHit = cent;
- return cent->spdata;
- }
- if (cent->lrustamp < lruent->lrustamp)
- lruent = cent;
- }
-#if 0
- if (!cacheType)
- {
- cacheType = CreateNewResourceType(miFreeArcCache);
- (void) AddResource(FakeClientID(0), cacheType, NULL);
- }
-#endif
- } else {
- lruent = &fakeent;
- lruent->spdata = NULL;
- *mustFree = TRUE;
- }
- k = (parc->height >> 1) + ((lw - 1) >> 1);
- spdata = lruent->spdata;
- if (!spdata || spdata->k != k)
- {
- g_free(spdata);
- spdata = (miArcSpanData *)g_malloc(sizeof(miArcSpanData) +
- sizeof(miArcSpan) * (k + 2));
- lruent->spdata = spdata;
- if (!spdata)
- {
- lruent->lrustamp = 0;
- lruent->lw = 0;
- return spdata;
- }
- spdata->spans = (miArcSpan *)(spdata + 1);
- spdata->k = k;
- }
- spdata->top = !(lw & 1) && !(parc->width & 1);
- spdata->bot = !(parc->height & 1);
- lruent->lrustamp = ++lrustamp;
- lruent->lw = lw;
- lruent->width = parc->width;
- lruent->height = parc->height;
- if (lruent != &fakeent)
- lastCacheHit = lruent;
- if (parc->width == parc->height)
- miComputeCircleSpans(lw, parc, spdata);
- else
- miComputeEllipseSpans(lw, parc, spdata);
- return spdata;
-}
-
-static void
-miFillWideEllipse(GdkDrawable *pDraw, GdkGC *pGC, miArc *parc)
-{
- GdkSpan* points;
- register GdkSpan* pts;
- miArcSpanData *spdata;
- gboolean mustFree;
- register miArcSpan *span;
- register int xorg, yorgu, yorgl;
- register int n;
-
- yorgu = parc->height + GDK_GC_FBDATA(pGC)->values.line_width;
- points = ALLOCATE_LOCAL(sizeof(GdkSpan) * yorgu * 2);
- spdata = miComputeWideEllipse(GDK_GC_FBDATA(pGC)->values.line_width, parc, &mustFree);
- if (!spdata)
- {
- DEALLOCATE_LOCAL(points);
- return;
- }
- pts = points;
- span = spdata->spans;
- xorg = parc->x + (parc->width >> 1);
- yorgu = parc->y + (parc->height >> 1);
- yorgl = yorgu + (parc->height & 1);
- yorgu -= spdata->k;
- yorgl += spdata->k;
- if (spdata->top)
- {
- pts->x = xorg;
- pts->y = yorgu - 1;
- pts->width = 1;
- pts++;
- span++;
- }
- for (n = spdata->count1; --n >= 0; )
- {
- pts[0].x = xorg + span->lx;
- pts[0].y = yorgu;
- pts[0].width = span->lw;
- pts[1] = pts[0];
- pts[1].y = yorgl;
- yorgu++;
- yorgl--;
- pts += 2;
- span++;
- }
- if (spdata->hole)
- {
- pts[0].x = xorg;
- pts[0].y = yorgl;
- pts[0].width = 1;
- pts++;
- }
- for (n = spdata->count2; --n >= 0; )
- {
- pts[0].x = xorg + span->lx;
- pts[0].y = yorgu;
- pts[0].width = span->lw;
-
- pts[1].x = xorg + span->rx;
- pts[1].y = pts[0].y;
- pts[1].width = span->rw;
-
- pts[2].x = pts[0].x;
- pts[2].y = yorgl;
- pts[2].width = pts[0].width;
-
- pts[3].x = pts[1].x;
- pts[3].y = pts[2].y;
- pts[3].width = pts[1].width;
-
- yorgu++;
- yorgl--;
- pts += 4;
- span++;
- }
- if (spdata->bot)
- {
- if (span->rw <= 0)
- {
- pts[0].x = xorg + span->lx;
- pts[0].y = yorgu;
- pts[0].width = span->lw;
- pts++;
- }
- else
- {
- pts[0].x = xorg + span->lx;
- pts[0].y = yorgu;
- pts[0].width = span->lw;
- pts[1].x = xorg + span->rx;
- pts[1].y = pts[0].y;
- pts[1].width = span->rw;
- pts += 2;
- }
- }
- if (mustFree)
- g_free(spdata);
-
- gdk_fb_fill_spans(pDraw, pGC, points, pts - points, FALSE);
-
- DEALLOCATE_LOCAL(points);
-}
-
-/*
- * miPolyArc strategy:
- *
- * If arc is zero width and solid, we don't have to worry about the rasterop
- * or join styles. For wide solid circles, we use a fast integer algorithm.
- * For wide solid ellipses, we use special case floating point code.
- * Otherwise, we set up pDrawTo and pGCTo according to the rasterop, then
- * draw using pGCTo and pDrawTo. If the raster-op was "tricky," that is,
- * if it involves the destination, then we use PushPixels to move the bits
- * from the scratch drawable to pDraw. (See the wide line code for a
- * fuller explanation of this.)
- */
-
-void
-miPolyArc(GdkDrawable *pDraw, GdkGC *pGC, int narcs, miArc *parcs)
-{
- register int i;
- miArc *parc;
- int xMin, xMax, yMin, yMax;
- int pixmapWidth = 0, pixmapHeight = 0;
- int xOrg = 0, yOrg = 0;
- int width;
- gboolean fTricky;
- GdkDrawable* pDrawTo;
- GdkColor fg, bg;
- GdkGC* pGCTo;
- miPolyArcPtr polyArcs;
- int cap[2], join[2];
- int iphase;
- int halfWidth;
- GdkGCValues gcv;
-
- width = GDK_GC_FBDATA(pGC)->values.line_width;
- if(width == 0 && GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_SOLID)
- {
- for(i = narcs, parc = parcs; --i >= 0; parc++)
- miArcSegment( pDraw, pGC, *parc,
- (miArcFacePtr) 0, (miArcFacePtr) 0 );
- fillSpans (pDraw, pGC);
- }
- else
- {
- if ((GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_SOLID) && narcs)
- {
- while (parcs->width && parcs->height &&
- (parcs->angle2 >= FULLCIRCLE ||
- parcs->angle2 <= -FULLCIRCLE))
- {
- miFillWideEllipse(pDraw, pGC, parcs);
- if (!--narcs)
- return;
- parcs++;
- }
- }
-
- /* Set up pDrawTo and pGCTo based on the rasterop */
- switch(GDK_GC_FBDATA(pGC)->alu)
- {
- case GDK_CLEAR: /* 0 */
- case GDK_COPY: /* src */
- case GDK_COPY_INVERT: /* NOT src */
- case GDK_SET: /* 1 */
- fTricky = FALSE;
- pDrawTo = pDraw;
- pGCTo = pGC;
- break;
- default:
- fTricky = TRUE;
-
- /* find bounding box around arcs */
- xMin = yMin = SHRT_MAX;
- xMax = yMax = SHRT_MIN;
-
- for(i = narcs, parc = parcs; --i >= 0; parc++)
- {
- xMin = MIN (xMin, parc->x);
- yMin = MIN (yMin, parc->y);
- xMax = MAX (xMax, (parc->x + (int) parc->width));
- yMax = MAX (yMax, (parc->y + (int) parc->height));
- }
-
- /* expand box to deal with line widths */
- halfWidth = (width + 1)/2;
- xMin -= halfWidth;
- yMin -= halfWidth;
- xMax += halfWidth;
- yMax += halfWidth;
-
- /* compute pixmap size; limit it to size of drawable */
- xOrg = MAX(xMin, 0);
- yOrg = MAX(yMin, 0);
- pixmapWidth = MIN(xMax, GDK_DRAWABLE_FBDATA(pDraw)->width) - xOrg;
- pixmapHeight = MIN(yMax, GDK_DRAWABLE_FBDATA(pDraw)->height) - yOrg;
-
- /* if nothing left, return */
- if ( (pixmapWidth <= 0) || (pixmapHeight <= 0) ) return;
-
- for(i = narcs, parc = parcs; --i >= 0; parc++)
- {
- parc->x -= xOrg;
- parc->y -= yOrg;
- }
-
- /* set up scratch GC */
- /* allocate a 1 bit deep pixmap of the appropriate size, and
- * validate it */
- pDrawTo = gdk_pixmap_new(NULL, pixmapWidth, pixmapHeight, 1);
- if (!pDrawTo)
- return;
-
- pGCTo = gdk_gc_new(pDrawTo);
- if (!pGCTo)
- {
- gdk_pixmap_unref(pDrawTo);
- return;
- }
- gdk_gc_set_function(pGCTo, GDK_COPY);
- memset(&gcv.background, 0, sizeof(GdkColor));
- gcv.foreground.pixel = 1;
- gcv.foreground.red = gcv.foreground.green = gcv.foreground.blue = 1;
- gdk_gc_set_foreground(pGCTo, &gcv.foreground);
- gdk_gc_set_background(pGCTo, &gcv.background);
- gdk_gc_set_line_attributes(pGCTo,
- GDK_GC_FBDATA(pGC)->values.line_width,
- GDK_GC_FBDATA(pGC)->values.line_style,
- GDK_GC_FBDATA(pGC)->values.cap_style,
- GDK_GC_FBDATA(pGC)->values.join_style);
- gdk_fb_drawable_clear(pDrawTo);
- }
-
- fg = GDK_GC_FBDATA(pGC)->values.foreground;
- bg = GDK_GC_FBDATA(pGC)->values.background;
- if ((GDK_GC_FBDATA(pGC)->values.fill == GDK_TILED) ||
- (GDK_GC_FBDATA(pGC)->values.fill == GDK_OPAQUE_STIPPLED))
- bg = fg; /* the protocol sez these don't cause color changes */
-
- polyArcs = miComputeArcs (parcs, narcs, pGC);
-
- if (!polyArcs)
- {
- if (fTricky) {
- gdk_pixmap_unref(pDrawTo);
- gdk_gc_unref(pGCTo);
- }
- return;
- }
-
- cap[0] = cap[1] = 0;
- join[0] = join[1] = 0;
- for (iphase = ((GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH) ? 1 : 0);
- iphase >= 0;
- iphase--)
- {
- if (iphase == 1)
- gdk_gc_set_foreground(pGC, &bg);
- else if (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH)
- gdk_gc_set_foreground(pGC, &fg);
- for (i = 0; i < polyArcs[iphase].narcs; i++) {
- miArcDataPtr arcData;
-
- arcData = &polyArcs[iphase].arcs[i];
- miArcSegment(pDrawTo, pGCTo, arcData->arc,
- &arcData->bounds[RIGHT_END],
- &arcData->bounds[LEFT_END]);
- if (polyArcs[iphase].arcs[i].render) {
- fillSpans (pDrawTo, pGCTo);
- /*
- * don't cap self-joining arcs
- */
- if (polyArcs[iphase].arcs[i].selfJoin &&
- cap[iphase] < polyArcs[iphase].arcs[i].cap)
- cap[iphase]++;
- while (cap[iphase] < polyArcs[iphase].arcs[i].cap) {
- int arcIndex, end;
- miArcDataPtr arcData0;
-
- arcIndex = polyArcs[iphase].caps[cap[iphase]].arcIndex;
- end = polyArcs[iphase].caps[cap[iphase]].end;
- arcData0 = &polyArcs[iphase].arcs[arcIndex];
- miArcCap (pDrawTo, pGCTo,
- &arcData0->bounds[end], end,
- arcData0->arc.x, arcData0->arc.y,
- (double) arcData0->arc.width / 2.0,
- (double) arcData0->arc.height / 2.0);
- ++cap[iphase];
- }
- while (join[iphase] < polyArcs[iphase].arcs[i].join) {
- int arcIndex0, arcIndex1, end0, end1;
- int phase0, phase1;
- miArcDataPtr arcData0, arcData1;
- miArcJoinPtr joinp;
-
- joinp = &polyArcs[iphase].joins[join[iphase]];
- arcIndex0 = joinp->arcIndex0;
- end0 = joinp->end0;
- arcIndex1 = joinp->arcIndex1;
- end1 = joinp->end1;
- phase0 = joinp->phase0;
- phase1 = joinp->phase1;
- arcData0 = &polyArcs[phase0].arcs[arcIndex0];
- arcData1 = &polyArcs[phase1].arcs[arcIndex1];
- miArcJoin (pDrawTo, pGCTo,
- &arcData0->bounds[end0],
- &arcData1->bounds[end1],
- arcData0->arc.x, arcData0->arc.y,
- (double) arcData0->arc.width / 2.0,
- (double) arcData0->arc.height / 2.0,
- arcData1->arc.x, arcData1->arc.y,
- (double) arcData1->arc.width / 2.0,
- (double) arcData1->arc.height / 2.0);
- ++join[iphase];
- }
- if (fTricky) {
- gdk_fb_draw_drawable(pDraw, pGC, pDrawTo, 0, 0, xOrg, yOrg, pixmapWidth, pixmapHeight);
- gdk_fb_drawable_clear(pDrawTo);
- }
- }
- }
- }
- miFreeArcs(polyArcs, pGC);
-
- if(fTricky)
- {
- gdk_pixmap_unref(pDrawTo);
- gdk_gc_unref(pGCTo);
- }
- }
-}
-
-static double
-angleBetween (SppPointRec center, SppPointRec point1, SppPointRec point2)
-{
- double a1, a2, a;
-
- /*
- * reflect from X coordinates back to ellipse
- * coordinates -- y increasing upwards
- */
- a1 = miDatan2 (- (point1.y - center.y), point1.x - center.x);
- a2 = miDatan2 (- (point2.y - center.y), point2.x - center.x);
- a = a2 - a1;
- if (a <= -180.0)
- a += 360.0;
- else if (a > 180.0)
- a -= 360.0;
- return a;
-}
-
-static void
-translateBounds (miArcFacePtr b, int x, int y, double fx, double fy)
-{
- fx += x;
- fy += y;
- b->clock.x -= fx;
- b->clock.y -= fy;
- b->center.x -= fx;
- b->center.y -= fy;
- b->counterClock.x -= fx;
- b->counterClock.y -= fy;
-}
-
-static void
-miArcJoin (GdkDrawable *pDraw, GdkGC *pGC, miArcFacePtr pLeft, miArcFacePtr pRight,
- int xOrgLeft, int yOrgLeft, double xFtransLeft, double yFtransLeft,
- int xOrgRight, int yOrgRight, double xFtransRight, double yFtransRight)
-{
- SppPointRec center, corner, otherCorner;
- SppPointRec poly[5], e;
- SppPointPtr pArcPts;
- int cpt;
- SppArcRec arc;
- miArcFaceRec Right, Left;
- int polyLen = 0;
- int xOrg, yOrg;
- double xFtrans, yFtrans;
- double a;
- double ae, ac2, ec2, bc2, de;
- double width;
-
- xOrg = (xOrgRight + xOrgLeft) / 2;
- yOrg = (yOrgRight + yOrgLeft) / 2;
- xFtrans = (xFtransLeft + xFtransRight) / 2;
- yFtrans = (yFtransLeft + yFtransRight) / 2;
- Right = *pRight;
- translateBounds (&Right, xOrg - xOrgRight, yOrg - yOrgRight,
- xFtrans - xFtransRight, yFtrans - yFtransRight);
- Left = *pLeft;
- translateBounds (&Left, xOrg - xOrgLeft, yOrg - yOrgLeft,
- xFtrans - xFtransLeft, yFtrans - yFtransLeft);
- pRight = &Right;
- pLeft = &Left;
-
- if (pRight->clock.x == pLeft->counterClock.x &&
- pRight->clock.y == pLeft->counterClock.y)
- return;
- center = pRight->center;
- if (0 <= (a = angleBetween (center, pRight->clock, pLeft->counterClock))
- && a <= 180.0)
- {
- corner = pRight->clock;
- otherCorner = pLeft->counterClock;
- } else {
- a = angleBetween (center, pLeft->clock, pRight->counterClock);
- corner = pLeft->clock;
- otherCorner = pRight->counterClock;
- }
- switch (GDK_GC_FBDATA(pGC)->values.join_style) {
- case GDK_JOIN_ROUND:
- width = (GDK_GC_FBDATA(pGC)->values.line_width ? (double)GDK_GC_FBDATA(pGC)->values.line_width : (double)1);
-
- arc.x = center.x - width/2;
- arc.y = center.y - width/2;
- arc.width = width;
- arc.height = width;
- arc.angle1 = -miDatan2 (corner.y - center.y, corner.x - center.x);
- arc.angle2 = a;
- pArcPts = (SppPointPtr) g_malloc (3 * sizeof (SppPointRec));
- if (!pArcPts)
- return;
- pArcPts[0].x = otherCorner.x;
- pArcPts[0].y = otherCorner.y;
- pArcPts[1].x = center.x;
- pArcPts[1].y = center.y;
- pArcPts[2].x = corner.x;
- pArcPts[2].y = corner.y;
- if( (cpt = miGetArcPts(&arc, 3, &pArcPts)) )
- {
- /* by drawing with miFillSppPoly and setting the endpoints of the arc
- * to be the corners, we assure that the cap will meet up with the
- * rest of the line */
- miFillSppPoly(pDraw, pGC, cpt, pArcPts, xOrg, yOrg, xFtrans, yFtrans);
- }
- g_free(pArcPts);
- return;
- case GDK_JOIN_MITER:
- /*
- * don't miter arcs with less than 11 degrees between them
- */
- if (a < 169.0) {
- poly[0] = corner;
- poly[1] = center;
- poly[2] = otherCorner;
- bc2 = (corner.x - otherCorner.x) * (corner.x - otherCorner.x) +
- (corner.y - otherCorner.y) * (corner.y - otherCorner.y);
- ec2 = bc2 / 4;
- ac2 = (corner.x - center.x) * (corner.x - center.x) +
- (corner.y - center.y) * (corner.y - center.y);
- ae = sqrt (ac2 - ec2);
- de = ec2 / ae;
- e.x = (corner.x + otherCorner.x) / 2;
- e.y = (corner.y + otherCorner.y) / 2;
- poly[3].x = e.x + de * (e.x - center.x) / ae;
- poly[3].y = e.y + de * (e.y - center.y) / ae;
- poly[4] = corner;
- polyLen = 5;
- break;
- }
- case GDK_JOIN_BEVEL:
- poly[0] = corner;
- poly[1] = center;
- poly[2] = otherCorner;
- poly[3] = corner;
- polyLen = 4;
- break;
- }
- miFillSppPoly (pDraw, pGC, polyLen, poly, xOrg, yOrg, xFtrans, yFtrans);
-}
-
-/*ARGSUSED*/
-static void
-miArcCap (GdkDrawable *pDraw, GdkGC *pGC, miArcFacePtr pFace, int end,
- int xOrg, int yOrg, double xFtrans, double yFtrans)
-{
- SppPointRec corner, otherCorner, center, endPoint, poly[5];
-
- corner = pFace->clock;
- otherCorner = pFace->counterClock;
- center = pFace->center;
- switch (GDK_GC_FBDATA(pGC)->values.cap_style) {
- case GDK_CAP_PROJECTING:
- poly[0].x = otherCorner.x;
- poly[0].y = otherCorner.y;
- poly[1].x = corner.x;
- poly[1].y = corner.y;
- poly[2].x = corner.x -
- (center.y - corner.y);
- poly[2].y = corner.y +
- (center.x - corner.x);
- poly[3].x = otherCorner.x -
- (otherCorner.y - center.y);
- poly[3].y = otherCorner.y +
- (otherCorner.x - center.x);
- poly[4].x = otherCorner.x;
- poly[4].y = otherCorner.y;
- miFillSppPoly (pDraw, pGC, 5, poly, xOrg, yOrg, xFtrans, yFtrans);
- break;
- case GDK_CAP_ROUND:
- /*
- * miRoundCap just needs these to be unequal.
- */
- endPoint = center;
- endPoint.x = endPoint.x + 100;
- miRoundCap (pDraw, pGC, center, endPoint, corner, otherCorner, 0,
- -xOrg, -yOrg, xFtrans, yFtrans);
- break;
- default:
- break;
- }
-}
-
-/* MIROUNDCAP -- a private helper function
- * Put Rounded cap on end. pCenter is the center of this end of the line
- * pEnd is the center of the other end of the line. pCorner is one of the
- * two corners at this end of the line.
- * NOTE: pOtherCorner must be counter-clockwise from pCorner.
- */
-/*ARGSUSED*/
-static void miRoundCap(GdkDrawable *pDraw, GdkGC *pGC, SppPointRec pCenter, SppPointRec pEnd, SppPointRec pCorner,
- SppPointRec pOtherCorner, int fLineEnd, int xOrg, int yOrg,
- double xFtrans, double yFtrans)
-{
- int cpt;
- double width;
- SppArcRec arc;
- SppPointPtr pArcPts;
-
- width = (GDK_GC_FBDATA(pGC)->values.line_width ? (double)GDK_GC_FBDATA(pGC)->values.line_width : (double)1);
-
- arc.x = pCenter.x - width/2;
- arc.y = pCenter.y - width/2;
- arc.width = width;
- arc.height = width;
- arc.angle1 = -(miDatan2 (pCorner.y - pCenter.y, pCorner.x - pCenter.x));
- if(PTISEQUAL(pCenter, pEnd))
- arc.angle2 = - 180.0;
- else {
- arc.angle2 = -miDatan2 (pOtherCorner.y - pCenter.y, pOtherCorner.x - pCenter.x) - arc.angle1;
- if (arc.angle2 < 0)
- arc.angle2 += 360.0;
- }
- pArcPts = (SppPointPtr) NULL;
- if( (cpt = miGetArcPts(&arc, 0, &pArcPts)) )
- {
- /* by drawing with miFillSppPoly and setting the endpoints of the arc
- * to be the corners, we assure that the cap will meet up with the
- * rest of the line */
- miFillSppPoly(pDraw, pGC, cpt, pArcPts, -xOrg, -yOrg, xFtrans, yFtrans);
- }
- g_free(pArcPts);
-}
-
-/*
- * To avoid inaccuracy at the cardinal points, use trig functions
- * which are exact for those angles
- */
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923
-#endif
-
-# define Dsin(d) ((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0)))
-# define Dcos(d) ((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0)))
-# define mod(a,b) ((a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
-
-static double
-miDcos (double a)
-{
- int i;
-
- if (floor (a/90) == a/90) {
- i = (int) (a/90.0);
- switch (mod (i, 4)) {
- case 0: return 1;
- case 1: return 0;
- case 2: return -1;
- case 3: return 0;
- }
- }
- return cos (a * M_PI / 180.0);
-}
-
-static double
-miDsin (double a)
-{
- int i;
-
- if (floor (a/90) == a/90) {
- i = (int) (a/90.0);
- switch (mod (i, 4)) {
- case 0: return 0;
- case 1: return 1;
- case 2: return 0;
- case 3: return -1;
- }
- }
- return sin (a * M_PI / 180.0);
-}
-
-static double
-miDasin (double v)
-{
- if (v == 0)
- return 0.0;
- if (v == 1.0)
- return 90.0;
- if (v == -1.0)
- return -90.0;
- return asin(v) * (180.0 / M_PI);
-}
-
-static double
-miDatan2 (double dy, double dx)
-{
- if (dy == 0) {
- if (dx >= 0)
- return 0.0;
- return 180.0;
- } else if (dx == 0) {
- if (dy > 0)
- return 90.0;
- return -90.0;
- } else if (fabs (dy) == fabs (dx)) {
- if (dy > 0) {
- if (dx > 0)
- return 45.0;
- return 135.0;
- } else {
- if (dx > 0)
- return 315.0;
- return 225.0;
- }
- } else {
- return atan2 (dy, dx) * (180.0 / M_PI);
- }
-}
-
-/* MIGETARCPTS -- Converts an arc into a set of line segments -- a helper
- * routine for filled arc and line (round cap) code.
- * Returns the number of points in the arc. Note that it takes a pointer
- * to a pointer to where it should put the points and an index (cpt).
- * This procedure allocates the space necessary to fit the arc points.
- * Sometimes it's convenient for those points to be at the end of an existing
- * array. (For example, if we want to leave a spare point to make sectors
- * instead of segments.) So we pass in the g_malloc()ed chunk that contains the
- * array and an index saying where we should start stashing the points.
- * If there isn't an array already, we just pass in a null pointer and
- * count on g_realloc() to handle the null pointer correctly.
- */
-static int
-miGetArcPts(SppArcPtr parc, int cpt, SppPointPtr *ppPts)
-#if 0
- SppArcPtr parc; /* points to an arc */
- int cpt; /* number of points already in arc list */
- SppPointPtr *ppPts; /* pointer to pointer to arc-list -- modified */
-#endif
-{
- double st, /* Start Theta, start angle */
- et, /* End Theta, offset from start theta */
- dt, /* Delta Theta, angle to sweep ellipse */
- cdt, /* Cos Delta Theta, actually 2 cos(dt) */
- x0, y0, /* the recurrence formula needs two points to start */
- x1, y1,
- x2, y2, /* this will be the new point generated */
- xc, yc; /* the center point */
- int count, i;
- SppPointPtr poly;
- GdkPoint last; /* last point on integer boundaries */
-
- /* The spec says that positive angles indicate counterclockwise motion.
- * Given our coordinate system (with 0,0 in the upper left corner),
- * the screen appears flipped in Y. The easiest fix is to negate the
- * angles given */
-
- st = - parc->angle1;
-
- et = - parc->angle2;
-
- /* Try to get a delta theta that is within 1/2 pixel. Then adjust it
- * so that it divides evenly into the total.
- * I'm just using cdt 'cause I'm lazy.
- */
- cdt = parc->width;
- if (parc->height > cdt)
- cdt = parc->height;
- cdt /= 2.0;
- if(cdt <= 0)
- return 0;
- if (cdt < 1.0)
- cdt = 1.0;
- dt = miDasin ( 1.0 / cdt ); /* minimum step necessary */
- count = et/dt;
- count = abs(count) + 1;
- dt = et/count;
- count++;
-
- cdt = 2 * miDcos(dt);
- if (!(poly = (SppPointPtr) g_realloc((gpointer)*ppPts,
- (cpt + count) * sizeof(SppPointRec))))
- return(0);
- *ppPts = poly;
-
- xc = parc->width/2.0; /* store half width and half height */
- yc = parc->height/2.0;
-
- x0 = xc * miDcos(st);
- y0 = yc * miDsin(st);
- x1 = xc * miDcos(st + dt);
- y1 = yc * miDsin(st + dt);
- xc += parc->x; /* by adding initial point, these become */
- yc += parc->y; /* the center point */
-
- poly[cpt].x = (xc + x0);
- poly[cpt].y = (yc + y0);
- last.x = ROUNDTOINT( poly[cpt + 1].x = (xc + x1) );
- last.y = ROUNDTOINT( poly[cpt + 1].y = (yc + y1) );
-
- for(i = 2; i < count; i++)
- {
- x2 = cdt * x1 - x0;
- y2 = cdt * y1 - y0;
-
- poly[cpt + i].x = (xc + x2);
- poly[cpt + i].y = (yc + y2);
-
- x0 = x1; y0 = y1;
- x1 = x2; y1 = y2;
- }
- /* adjust the last point */
- if (fabs(parc->angle2) >= 360.0)
- poly[cpt +i -1] = poly[0];
- else {
- poly[cpt +i -1].x = (miDcos(st + et) * parc->width/2.0 + xc);
- poly[cpt +i -1].y = (miDsin(st + et) * parc->height/2.0 + yc);
- }
-
- return(count);
-}
-
-struct arcData {
- double x0, y0, x1, y1;
- int selfJoin;
-};
-
-# define ADD_REALLOC_STEP 20
-
-static void
-addCap (miArcCapPtr *capsp, int *ncapsp, int *sizep, int end, int arcIndex)
-{
- int newsize;
- miArcCapPtr cap;
-
- if (*ncapsp == *sizep)
- {
- newsize = *sizep + ADD_REALLOC_STEP;
- cap = (miArcCapPtr) g_realloc (*capsp,
- newsize * sizeof (**capsp));
- if (!cap)
- return;
- *sizep = newsize;
- *capsp = cap;
- }
- cap = &(*capsp)[*ncapsp];
- cap->end = end;
- cap->arcIndex = arcIndex;
- ++*ncapsp;
-}
-
-static void
-addJoin (miArcJoinPtr *joinsp, int *njoinsp, int *sizep, int end0, int index0,
- int phase0, int end1, int index1, int phase1)
-{
- int newsize;
- miArcJoinPtr join;
-
- if (*njoinsp == *sizep)
- {
- newsize = *sizep + ADD_REALLOC_STEP;
- join = (miArcJoinPtr) g_realloc (*joinsp,
- newsize * sizeof (**joinsp));
- if (!join)
- return;
- *sizep = newsize;
- *joinsp = join;
- }
- join = &(*joinsp)[*njoinsp];
- join->end0 = end0;
- join->arcIndex0 = index0;
- join->phase0 = phase0;
- join->end1 = end1;
- join->arcIndex1 = index1;
- join->phase1 = phase1;
- ++*njoinsp;
-}
-
-static miArcDataPtr
-addArc (miArcDataPtr *arcsp, int *narcsp, int *sizep, miArc *xarc)
-{
- int newsize;
- miArcDataPtr arc;
-
- if (*narcsp == *sizep)
- {
- newsize = *sizep + ADD_REALLOC_STEP;
- arc = (miArcDataPtr) g_realloc (*arcsp,
- newsize * sizeof (**arcsp));
- if (!arc)
- return (miArcDataPtr)NULL;
- *sizep = newsize;
- *arcsp = arc;
- }
- arc = &(*arcsp)[*narcsp];
- arc->arc = *xarc;
- ++*narcsp;
- return arc;
-}
-
-static void
-miFreeArcs(miPolyArcPtr arcs, GdkGC *pGC)
-{
- int iphase;
-
- for (iphase = ((GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH) ? 1 : 0);
- iphase >= 0;
- iphase--)
- {
- if (arcs[iphase].narcs > 0)
- g_free(arcs[iphase].arcs);
- if (arcs[iphase].njoins > 0)
- g_free(arcs[iphase].joins);
- if (arcs[iphase].ncaps > 0)
- g_free(arcs[iphase].caps);
- }
- g_free(arcs);
-}
-
-/*
- * map angles to radial distance. This only deals with the first quadrant
- */
-
-/*
- * a polygonal approximation to the arc for computing arc lengths
- */
-
-# define dashIndexToAngle(di) ((((double) (di)) * 90.0) / ((double) DASH_MAP_SIZE - 1))
-# define xAngleToDashIndex(xa) ((((long) (xa)) * (DASH_MAP_SIZE - 1)) / (90 * 64))
-# define dashIndexToXAngle(di) ((((long) (di)) * (90 * 64)) / (DASH_MAP_SIZE - 1))
-# define dashXAngleStep (((double) (90 * 64)) / ((double) (DASH_MAP_SIZE - 1)))
-
-static void
-computeDashMap (miArc *arcp, dashMap *map)
-{
- int di;
- double a, x, y, prevx = 0.0, prevy = 0.0, dist;
-
- for (di = 0; di < DASH_MAP_SIZE; di++) {
- a = dashIndexToAngle (di);
- x = ((double) arcp->width / 2.0) * miDcos (a);
- y = ((double) arcp->height / 2.0) * miDsin (a);
- if (di == 0) {
- map->map[di] = 0.0;
- } else {
- dist = hypot (x - prevx, y - prevy);
- map->map[di] = map->map[di - 1] + dist;
- }
- prevx = x;
- prevy = y;
- }
-}
-
-typedef enum {HORIZONTAL, VERTICAL, OTHER} arcTypes;
-
-/* this routine is a bit gory */
-
-static miPolyArcPtr
-miComputeArcs (miArc *parcs, int narcs, GdkGC *pGC)
-{
- int isDashed, isDoubleDash;
- int dashOffset;
- miPolyArcPtr arcs;
- int start, i, j, k = 0, nexti, nextk = 0;
- int joinSize[2];
- int capSize[2];
- int arcSize[2];
- int angle2;
- double a0, a1;
- struct arcData *data;
- miArcDataPtr arc;
- miArc xarc;
- int iphase, prevphase = 0, joinphase;
- int arcsJoin;
- int selfJoin;
-
- int iDash = 0, dashRemaining;
- int iDashStart = 0, dashRemainingStart = 0, iphaseStart;
- int startAngle, spanAngle, endAngle, backwards = 0;
- int prevDashAngle, dashAngle;
- dashMap map;
-
- isDashed = !(GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_SOLID);
- isDoubleDash = (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH);
- dashOffset = GDK_GC_FBDATA(pGC)->dash_offset;
-
- data = (struct arcData *) ALLOCATE_LOCAL (narcs * sizeof (struct arcData));
- if (!data)
- return (miPolyArcPtr)NULL;
- arcs = (miPolyArcPtr) g_malloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1));
- if (!arcs)
- {
- DEALLOCATE_LOCAL(data);
- return (miPolyArcPtr)NULL;
- }
- for (i = 0; i < narcs; i++) {
- a0 = todeg (parcs[i].angle1);
- angle2 = parcs[i].angle2;
- if (angle2 > FULLCIRCLE)
- angle2 = FULLCIRCLE;
- else if (angle2 < -FULLCIRCLE)
- angle2 = -FULLCIRCLE;
- data[i].selfJoin = angle2 == FULLCIRCLE || angle2 == -FULLCIRCLE;
- a1 = todeg (parcs[i].angle1 + angle2);
- data[i].x0 = parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos (a0));
- data[i].y0 = parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin (a0));
- data[i].x1 = parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos (a1));
- data[i].y1 = parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin (a1));
- }
-
- for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++) {
- arcs[iphase].njoins = 0;
- arcs[iphase].joins = NULL;
- joinSize[iphase] = 0;
-
- arcs[iphase].ncaps = 0;
- arcs[iphase].caps = NULL;
- capSize[iphase] = 0;
-
- arcs[iphase].narcs = 0;
- arcs[iphase].arcs = NULL;
- arcSize[iphase] = 0;
- }
-
- iphase = 0;
- if (isDashed) {
- iDash = 0;
- dashRemaining = GDK_GC_FBDATA(pGC)->dash_list[0];
- while (dashOffset > 0) {
- if (dashOffset >= dashRemaining) {
- dashOffset -= dashRemaining;
- iphase = iphase ? 0 : 1;
- iDash++;
- if (iDash == GDK_GC_FBDATA(pGC)->dash_list_len)
- iDash = 0;
- dashRemaining = GDK_GC_FBDATA(pGC)->dash_list[iDash];
- } else {
- dashRemaining -= dashOffset;
- dashOffset = 0;
- }
- }
- iDashStart = iDash;
- dashRemainingStart = dashRemaining;
- }
- iphaseStart = iphase;
-
- for (i = narcs - 1; i >= 0; i--) {
- j = i + 1;
- if (j == narcs)
- j = 0;
- if (data[i].selfJoin || i == j ||
- (UNEQUAL (data[i].x1, data[j].x0) ||
- UNEQUAL (data[i].y1, data[j].y0)))
- {
- if (iphase == 0 || isDoubleDash)
- addCap (&arcs[iphase].caps, &arcs[iphase].ncaps,
- &capSize[iphase], RIGHT_END, 0);
- break;
- }
- }
- start = i + 1;
- if (start == narcs)
- start = 0;
- i = start;
- for (;;) {
- j = i + 1;
- if (j == narcs)
- j = 0;
- nexti = i+1;
- if (nexti == narcs)
- nexti = 0;
- if (isDashed) {
- /*
- ** deal with dashed arcs. Use special rules for certain 0 area arcs.
- ** Presumably, the other 0 area arcs still aren't done right.
- */
- arcTypes arcType = OTHER;
- guint16 thisLength;
-
- if (parcs[i].height == 0
- && (parcs[i].angle1 % FULLCIRCLE) == 0x2d00
- && parcs[i].angle2 == 0x2d00)
- arcType = HORIZONTAL;
- else if (parcs[i].width == 0
- && (parcs[i].angle1 % FULLCIRCLE) == 0x1680
- && parcs[i].angle2 == 0x2d00)
- arcType = VERTICAL;
- if (arcType == OTHER) {
- /*
- * precompute an approximation map
- */
- computeDashMap (&parcs[i], &map);
- /*
- * compute each individual dash segment using the path
- * length function
- */
- startAngle = parcs[i].angle1;
- spanAngle = parcs[i].angle2;
- if (spanAngle > FULLCIRCLE)
- spanAngle = FULLCIRCLE;
- else if (spanAngle < -FULLCIRCLE)
- spanAngle = -FULLCIRCLE;
- if (startAngle < 0)
- startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE;
- if (startAngle >= FULLCIRCLE)
- startAngle = startAngle % FULLCIRCLE;
- endAngle = startAngle + spanAngle;
- backwards = spanAngle < 0;
- } else {
- xarc = parcs[i];
- if (arcType == VERTICAL) {
- xarc.angle1 = 0x1680;
- startAngle = parcs[i].y;
- endAngle = startAngle + parcs[i].height;
- } else {
- xarc.angle1 = 0x2d00;
- startAngle = parcs[i].x;
- endAngle = startAngle + parcs[i].width;
- }
- }
- dashAngle = startAngle;
- selfJoin = data[i].selfJoin &&
- (iphase == 0 || isDoubleDash);
- /*
- * add dashed arcs to each bucket
- */
- arc = NULL;
- while (dashAngle != endAngle) {
- prevDashAngle = dashAngle;
- if (arcType == OTHER) {
- dashAngle = computeAngleFromPath (prevDashAngle, endAngle,
- &map, &dashRemaining, backwards);
- /* avoid troubles with huge arcs and small dashes */
- if (dashAngle == prevDashAngle) {
- if (backwards)
- dashAngle--;
- else
- dashAngle++;
- }
- } else {
- thisLength = (dashAngle + dashRemaining <= endAngle) ?
- dashRemaining : endAngle - dashAngle;
- if (arcType == VERTICAL) {
- xarc.y = dashAngle;
- xarc.height = thisLength;
- } else {
- xarc.x = dashAngle;
- xarc.width = thisLength;
- }
- dashAngle += thisLength;
- dashRemaining -= thisLength;
- }
- if (iphase == 0 || isDoubleDash) {
- if (arcType == OTHER) {
- xarc = parcs[i];
- spanAngle = prevDashAngle;
- if (spanAngle < 0)
- spanAngle = FULLCIRCLE - (-spanAngle) % FULLCIRCLE;
- if (spanAngle >= FULLCIRCLE)
- spanAngle = spanAngle % FULLCIRCLE;
- xarc.angle1 = spanAngle;
- spanAngle = dashAngle - prevDashAngle;
- if (backwards) {
- if (dashAngle > prevDashAngle)
- spanAngle = - FULLCIRCLE + spanAngle;
- } else {
- if (dashAngle < prevDashAngle)
- spanAngle = FULLCIRCLE + spanAngle;
- }
- if (spanAngle > FULLCIRCLE)
- spanAngle = FULLCIRCLE;
- if (spanAngle < -FULLCIRCLE)
- spanAngle = -FULLCIRCLE;
- xarc.angle2 = spanAngle;
- }
- arc = addArc (&arcs[iphase].arcs, &arcs[iphase].narcs,
- &arcSize[iphase], &xarc);
- if (!arc)
- goto arcfail;
- /*
- * cap each end of an on/off dash
- */
- if (!isDoubleDash) {
- if (prevDashAngle != startAngle) {
- addCap (&arcs[iphase].caps,
- &arcs[iphase].ncaps,
- &capSize[iphase], RIGHT_END,
- arc - arcs[iphase].arcs);
-
- }
- if (dashAngle != endAngle) {
- addCap (&arcs[iphase].caps,
- &arcs[iphase].ncaps,
- &capSize[iphase], LEFT_END,
- arc - arcs[iphase].arcs);
- }
- }
- arc->cap = arcs[iphase].ncaps;
- arc->join = arcs[iphase].njoins;
- arc->render = 0;
- arc->selfJoin = 0;
- if (dashAngle == endAngle)
- arc->selfJoin = selfJoin;
- }
- prevphase = iphase;
- if (dashRemaining <= 0) {
- ++iDash;
- if (iDash == GDK_GC_FBDATA(pGC)->dash_list_len)
- iDash = 0;
- iphase = iphase ? 0:1;
- dashRemaining = GDK_GC_FBDATA(pGC)->dash_list[iDash];
- }
- }
- /*
- * make sure a place exists for the position data when
- * drawing a zero-length arc
- */
- if (startAngle == endAngle) {
- prevphase = iphase;
- if (!isDoubleDash && iphase == 1)
- prevphase = 0;
- arc = addArc (&arcs[prevphase].arcs, &arcs[prevphase].narcs,
- &arcSize[prevphase], &parcs[i]);
- if (!arc)
- goto arcfail;
- arc->join = arcs[prevphase].njoins;
- arc->cap = arcs[prevphase].ncaps;
- arc->selfJoin = data[i].selfJoin;
- }
- } else {
- arc = addArc (&arcs[iphase].arcs, &arcs[iphase].narcs,
- &arcSize[iphase], &parcs[i]);
- if (!arc)
- goto arcfail;
- arc->join = arcs[iphase].njoins;
- arc->cap = arcs[iphase].ncaps;
- arc->selfJoin = data[i].selfJoin;
- prevphase = iphase;
- }
- if (prevphase == 0 || isDoubleDash)
- k = arcs[prevphase].narcs - 1;
- if (iphase == 0 || isDoubleDash)
- nextk = arcs[iphase].narcs;
- if (nexti == start) {
- nextk = 0;
- if (isDashed) {
- iDash = iDashStart;
- iphase = iphaseStart;
- dashRemaining = dashRemainingStart;
- }
- }
- arcsJoin = narcs > 1 && i != j &&
- ISEQUAL (data[i].x1, data[j].x0) &&
- ISEQUAL (data[i].y1, data[j].y0) &&
- !data[i].selfJoin && !data[j].selfJoin;
- if (arc)
- {
- if (arcsJoin)
- arc->render = 0;
- else
- arc->render = 1;
- }
- if (arcsJoin &&
- (prevphase == 0 || isDoubleDash) &&
- (iphase == 0 || isDoubleDash))
- {
- joinphase = iphase;
- if (isDoubleDash) {
- if (nexti == start)
- joinphase = iphaseStart;
- /*
- * if the join is right at the dash,
- * draw the join in foreground
- * This is because the foreground
- * arcs are computed second, the results
- * of which are needed to draw the join
- */
- if (joinphase != prevphase)
- joinphase = 0;
- }
- if (joinphase == 0 || isDoubleDash) {
- addJoin (&arcs[joinphase].joins,
- &arcs[joinphase].njoins,
- &joinSize[joinphase],
- LEFT_END, k, prevphase,
- RIGHT_END, nextk, iphase);
- arc->join = arcs[prevphase].njoins;
- }
- } else {
- /*
- * cap the left end of this arc
- * unless it joins itself
- */
- if ((prevphase == 0 || isDoubleDash) &&
- !arc->selfJoin)
- {
- addCap (&arcs[prevphase].caps, &arcs[prevphase].ncaps,
- &capSize[prevphase], LEFT_END, k);
- arc->cap = arcs[prevphase].ncaps;
- }
- if (isDashed && !arcsJoin) {
- iDash = iDashStart;
- iphase = iphaseStart;
- dashRemaining = dashRemainingStart;
- }
- nextk = arcs[iphase].narcs;
- if (nexti == start) {
- nextk = 0;
- iDash = iDashStart;
- iphase = iphaseStart;
- dashRemaining = dashRemainingStart;
- }
- /*
- * cap the right end of the next arc. If the
- * next arc is actually the first arc, only
- * cap it if it joins with this arc. This
- * case will occur when the final dash segment
- * of an on/off dash is off. Of course, this
- * cap will be drawn at a strange time, but that
- * hardly matters...
- */
- if ((iphase == 0 || isDoubleDash) &&
- (nexti != start || (arcsJoin && isDashed)))
- addCap (&arcs[iphase].caps, &arcs[iphase].ncaps,
- &capSize[iphase], RIGHT_END, nextk);
- }
- i = nexti;
- if (i == start)
- break;
- }
- /*
- * make sure the last section is rendered
- */
- for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++)
- if (arcs[iphase].narcs > 0) {
- arcs[iphase].arcs[arcs[iphase].narcs-1].render = 1;
- arcs[iphase].arcs[arcs[iphase].narcs-1].join =
- arcs[iphase].njoins;
- arcs[iphase].arcs[arcs[iphase].narcs-1].cap =
- arcs[iphase].ncaps;
- }
- DEALLOCATE_LOCAL(data);
- return arcs;
-arcfail:
- miFreeArcs(arcs, pGC);
- DEALLOCATE_LOCAL(data);
- return (miPolyArcPtr)NULL;
-}
-
-static double
-angleToLength (int angle, dashMap *map)
-{
- double len, excesslen, sidelen = map->map[DASH_MAP_SIZE - 1], totallen;
- int di;
- int excess;
- gboolean oddSide = FALSE;
-
- totallen = 0;
- if (angle >= 0) {
- while (angle >= 90 * 64) {
- angle -= 90 * 64;
- totallen += sidelen;
- oddSide = !oddSide;
- }
- } else {
- while (angle < 0) {
- angle += 90 * 64;
- totallen -= sidelen;
- oddSide = !oddSide;
- }
- }
- if (oddSide)
- angle = 90 * 64 - angle;
-
- di = xAngleToDashIndex (angle);
- excess = angle - dashIndexToXAngle (di);
-
- len = map->map[di];
- /*
- * linearly interpolate between this point and the next
- */
- if (excess > 0) {
- excesslen = (map->map[di + 1] - map->map[di]) *
- ((double) excess) / dashXAngleStep;
- len += excesslen;
- }
- if (oddSide)
- totallen += (sidelen - len);
- else
- totallen += len;
- return totallen;
-}
-
-/*
- * len is along the arc, but may be more than one rotation
- */
-
-static int
-lengthToAngle (double len, dashMap *map)
-{
- double sidelen = map->map[DASH_MAP_SIZE - 1];
- int angle, angleexcess;
- gboolean oddSide = FALSE;
- int a0, a1, a;
-
- angle = 0;
- /*
- * step around the ellipse, subtracting sidelens and
- * adding 90 degrees. oddSide will tell if the
- * map should be interpolated in reverse
- */
- if (len >= 0) {
- if (sidelen == 0)
- return 2 * FULLCIRCLE; /* infinity */
- while (len >= sidelen) {
- angle += 90 * 64;
- len -= sidelen;
- oddSide = !oddSide;
- }
- } else {
- if (sidelen == 0)
- return -2 * FULLCIRCLE; /* infinity */
- while (len < 0) {
- angle -= 90 * 64;
- len += sidelen;
- oddSide = !oddSide;
- }
- }
- if (oddSide)
- len = sidelen - len;
- a0 = 0;
- a1 = DASH_MAP_SIZE - 1;
- /*
- * binary search for the closest pre-computed length
- */
- while (a1 - a0 > 1) {
- a = (a0 + a1) / 2;
- if (len > map->map[a])
- a0 = a;
- else
- a1 = a;
- }
- angleexcess = dashIndexToXAngle (a0);
- /*
- * linearly interpolate to the next point
- */
- angleexcess += (len - map->map[a0]) /
- (map->map[a0+1] - map->map[a0]) * dashXAngleStep;
- if (oddSide)
- angle += (90 * 64) - angleexcess;
- else
- angle += angleexcess;
- return angle;
-}
-
-/*
- * compute the angle of an ellipse which cooresponds to
- * the given path length. Note that the correct solution
- * to this problem is an eliptic integral, we'll punt and
- * approximate (it's only for dashes anyway). This
- * approximation uses a polygon.
- *
- * The remaining portion of len is stored in *lenp -
- * this will be negative if the arc extends beyond
- * len and positive if len extends beyond the arc.
- */
-
-static int computeAngleFromPath(int startAngle, int endAngle, dashMap *map, int *lenp, int backwards)
-/* int startAngle, endAngle; *//* normalized absolute angles in *64 degrees */
-{
- int a0, a1, a;
- double len0;
- int len;
-
- a0 = startAngle;
- a1 = endAngle;
- len = *lenp;
- if (backwards) {
- /*
- * flip the problem around to always be
- * forwards
- */
- a0 = FULLCIRCLE - a0;
- a1 = FULLCIRCLE - a1;
- }
- if (a1 < a0)
- a1 += FULLCIRCLE;
- len0 = angleToLength (a0, map);
- a = lengthToAngle (len0 + len, map);
- if (a > a1) {
- a = a1;
- len -= angleToLength (a1, map) - len0;
- } else
- len = 0;
- if (backwards)
- a = FULLCIRCLE - a;
- *lenp = len;
- return a;
-}
-
-/*
- * scan convert wide arcs.
- */
-
-/*
- * draw zero width/height arcs
- */
-
-static void
-drawZeroArc (GdkDrawable *pDraw, GdkGC *pGC, miArc *tarc, int lw,
- miArcFacePtr left, miArcFacePtr right)
-{
- double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0, w, h, x, y;
- double xmax, ymax, xmin, ymin;
- int a0, a1;
- double a, startAngle, endAngle;
- double l, lx, ly;
-
- l = lw / 2.0;
- a0 = tarc->angle1;
- a1 = tarc->angle2;
- if (a1 > FULLCIRCLE)
- a1 = FULLCIRCLE;
- else if (a1 < -FULLCIRCLE)
- a1 = -FULLCIRCLE;
- w = (double)tarc->width / 2.0;
- h = (double)tarc->height / 2.0;
- /*
- * play in X coordinates right away
- */
- startAngle = - ((double) a0 / 64.0);
- endAngle = - ((double) (a0 + a1) / 64.0);
-
- xmax = -w;
- xmin = w;
- ymax = -h;
- ymin = h;
- a = startAngle;
- for (;;)
- {
- x = w * miDcos(a);
- y = h * miDsin(a);
- if (a == startAngle)
- {
- x0 = x;
- y0 = y;
- }
- if (a == endAngle)
- {
- x1 = x;
- y1 = y;
- }
- if (x > xmax)
- xmax = x;
- if (x < xmin)
- xmin = x;
- if (y > ymax)
- ymax = y;
- if (y < ymin)
- ymin = y;
- if (a == endAngle)
- break;
- if (a1 < 0) /* clockwise */
- {
- if (floor (a / 90.0) == floor (endAngle / 90.0))
- a = endAngle;
- else
- a = 90 * (floor (a/90.0) + 1);
- }
- else
- {
- if (ceil (a / 90.0) == ceil (endAngle / 90.0))
- a = endAngle;
- else
- a = 90 * (ceil (a/90.0) - 1);
- }
- }
- lx = ly = l;
- if ((x1 - x0) + (y1 - y0) < 0)
- lx = ly = -l;
- if (h)
- {
- ly = 0.0;
- lx = -lx;
- }
- else
- lx = 0.0;
- if (right)
- {
- right->center.x = x0;
- right->center.y = y0;
- right->clock.x = x0 - lx;
- right->clock.y = y0 - ly;
- right->counterClock.x = x0 + lx;
- right->counterClock.y = y0 + ly;
- }
- if (left)
- {
- left->center.x = x1;
- left->center.y = y1;
- left->clock.x = x1 + lx;
- left->clock.y = y1 + ly;
- left->counterClock.x = x1 - lx;
- left->counterClock.y = y1 - ly;
- }
-
- x0 = xmin;
- x1 = xmax;
- y0 = ymin;
- y1 = ymax;
- if (ymin != y1) {
- xmin = -l;
- xmax = l;
- } else {
- ymin = -l;
- ymax = l;
- }
- if (xmax != xmin && ymax != ymin) {
- int minx, maxx, miny, maxy;
-
- minx = ICEIL (xmin + w) + tarc->x;
- maxx = ICEIL (xmax + w) + tarc->x;
- miny = ICEIL (ymin + h) + tarc->y;
- maxy = ICEIL (ymax + h) + tarc->y;
-
- gdk_fb_draw_rectangle(pDraw, pGC, TRUE, minx, miny, maxx - minx, maxy - miny);
- }
-}
-
-/*
- * this computes the ellipse y value associated with the
- * bottom of the tail.
- */
-
-static void
-tailEllipseY (struct arc_def *def, struct accelerators *acc)
-{
- double t;
-
- acc->tail_y = 0.0;
- if (def->w == def->h)
- return;
- t = def->l * def->w;
- if (def->w > def->h) {
- if (t < acc->h2)
- return;
- } else {
- if (t > acc->h2)
- return;
- }
- t = 2.0 * def->h * t;
- t = (CUBED_ROOT_4 * acc->h2 - cbrt(t * t)) / acc->h2mw2;
- if (t > 0.0)
- acc->tail_y = def->h / CUBED_ROOT_2 * sqrt(t);
-}
-
-/*
- * inverse functions -- compute edge coordinates
- * from the ellipse
- */
-
-static double
-outerXfromXY (double x, double y,
- struct arc_def *def, struct accelerators *acc)
-{
- return x + (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
-}
-
-static double
-outerYfromXY (double x, double y,
- struct arc_def *def, struct accelerators *acc)
-{
- return y + (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
-}
-
-static double
-innerXfromXY (double x, double y,
- struct arc_def *def, struct accelerators *acc)
-{
- return x - (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
-}
-
-static double
-innerYfromXY (double x, double y,
- struct arc_def *def, struct accelerators *acc)
-{
- return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
-}
-
-static double
-innerYfromY (double y, struct arc_def *def, struct accelerators *acc)
-{
- double x;
-
- x = (def->w / def->h) * sqrt (acc->h2 - y*y);
-
- return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
-}
-
-static void
-computeLine (double x1, double y1, double x2, double y2, struct line *line)
-{
- if (y1 == y2)
- line->valid = 0;
- else {
- line->m = (x1 - x2) / (y1 - y2);
- line->b = x1 - y1 * line->m;
- line->valid = 1;
- }
-}
-
-/*
- * compute various accelerators for an ellipse. These
- * are simply values that are used repeatedly in
- * the computations
- */
-
-static void
-computeAcc (miArc *tarc, int lw, struct arc_def *def, struct accelerators *acc)
-{
- def->w = ((double) tarc->width) / 2.0;
- def->h = ((double) tarc->height) / 2.0;
- def->l = ((double) lw) / 2.0;
- acc->h2 = def->h * def->h;
- acc->w2 = def->w * def->w;
- acc->h4 = acc->h2 * acc->h2;
- acc->w4 = acc->w2 * acc->w2;
- acc->h2l = acc->h2 * def->l;
- acc->w2l = acc->w2 * def->l;
- acc->h2mw2 = acc->h2 - acc->w2;
- acc->fromIntX = (tarc->width & 1) ? 0.5 : 0.0;
- acc->fromIntY = (tarc->height & 1) ? 0.5 : 0.0;
- acc->xorg = tarc->x + (tarc->width >> 1);
- acc->yorgu = tarc->y + (tarc->height >> 1);
- acc->yorgl = acc->yorgu + (tarc->height & 1);
- tailEllipseY (def, acc);
-}
-
-/*
- * compute y value bounds of various portions of the arc,
- * the outer edge, the ellipse and the inner edge.
- */
-
-static void
-computeBound (struct arc_def *def, struct arc_bound *bound,
- struct accelerators *acc, miArcFacePtr right, miArcFacePtr left)
-{
- double t;
- double innerTaily;
- double tail_y;
- struct bound innerx, outerx;
- struct bound ellipsex;
-
- bound->ellipse.min = Dsin (def->a0) * def->h;
- bound->ellipse.max = Dsin (def->a1) * def->h;
- if (def->a0 == 45 && def->w == def->h)
- ellipsex.min = bound->ellipse.min;
- else
- ellipsex.min = Dcos (def->a0) * def->w;
- if (def->a1 == 45 && def->w == def->h)
- ellipsex.max = bound->ellipse.max;
- else
- ellipsex.max = Dcos (def->a1) * def->w;
- bound->outer.min = outerYfromXY (ellipsex.min, bound->ellipse.min, def, acc);
- bound->outer.max = outerYfromXY (ellipsex.max, bound->ellipse.max, def, acc);
- bound->inner.min = innerYfromXY (ellipsex.min, bound->ellipse.min, def, acc);
- bound->inner.max = innerYfromXY (ellipsex.max, bound->ellipse.max, def, acc);
-
- outerx.min = outerXfromXY (ellipsex.min, bound->ellipse.min, def, acc);
- outerx.max = outerXfromXY (ellipsex.max, bound->ellipse.max, def, acc);
- innerx.min = innerXfromXY (ellipsex.min, bound->ellipse.min, def, acc);
- innerx.max = innerXfromXY (ellipsex.max, bound->ellipse.max, def, acc);
-
- /*
- * save the line end points for the
- * cap code to use. Careful here, these are
- * in cartesean coordinates (y increasing upwards)
- * while the cap code uses inverted coordinates
- * (y increasing downwards)
- */
-
- if (right) {
- right->counterClock.y = bound->outer.min;
- right->counterClock.x = outerx.min;
- right->center.y = bound->ellipse.min;
- right->center.x = ellipsex.min;
- right->clock.y = bound->inner.min;
- right->clock.x = innerx.min;
- }
-
- if (left) {
- left->clock.y = bound->outer.max;
- left->clock.x = outerx.max;
- left->center.y = bound->ellipse.max;
- left->center.x = ellipsex.max;
- left->counterClock.y = bound->inner.max;
- left->counterClock.x = innerx.max;
- }
-
- bound->left.min = bound->inner.max;
- bound->left.max = bound->outer.max;
- bound->right.min = bound->inner.min;
- bound->right.max = bound->outer.min;
-
- computeLine (innerx.min, bound->inner.min, outerx.min, bound->outer.min,
- &acc->right);
- computeLine (innerx.max, bound->inner.max, outerx.max, bound->outer.max,
- &acc->left);
-
- if (bound->inner.min > bound->inner.max) {
- t = bound->inner.min;
- bound->inner.min = bound->inner.max;
- bound->inner.max = t;
- }
- tail_y = acc->tail_y;
- if (tail_y > bound->ellipse.max)
- tail_y = bound->ellipse.max;
- else if (tail_y < bound->ellipse.min)
- tail_y = bound->ellipse.min;
- innerTaily = innerYfromY (tail_y, def, acc);
- if (bound->inner.min > innerTaily)
- bound->inner.min = innerTaily;
- if (bound->inner.max < innerTaily)
- bound->inner.max = innerTaily;
- bound->inneri.min = ICEIL(bound->inner.min - acc->fromIntY);
- bound->inneri.max = floor(bound->inner.max - acc->fromIntY);
- bound->outeri.min = ICEIL(bound->outer.min - acc->fromIntY);
- bound->outeri.max = floor(bound->outer.max - acc->fromIntY);
-}
-
-/*
- * this section computes the x value of the span at y
- * intersected with the specified face of the ellipse.
- *
- * this is the min/max X value over the set of normal
- * lines to the entire ellipse, the equation of the
- * normal lines is:
- *
- * ellipse_x h^2 h^2
- * x = ------------ y + ellipse_x (1 - --- )
- * ellipse_y w^2 w^2
- *
- * compute the derivative with-respect-to ellipse_y and solve
- * for zero:
- *
- * (w^2 - h^2) ellipse_y^3 + h^4 y
- * 0 = - ----------------------------------
- * h w ellipse_y^2 sqrt (h^2 - ellipse_y^2)
- *
- * ( h^4 y )
- * ellipse_y = ( ---------- ) ^ (1/3)
- * ( (h^2 - w^2) )
- *
- * The other two solutions to the equation are imaginary.
- *
- * This gives the position on the ellipse which generates
- * the normal with the largest/smallest x intersection point.
- *
- * Now compute the second derivative to check whether
- * the intersection is a minimum or maximum:
- *
- * h (y0^3 (w^2 - h^2) + h^2 y (3y0^2 - 2h^2))
- * - -------------------------------------------
- * w y0^3 (sqrt (h^2 - y^2)) ^ 3
- *
- * as we only care about the sign,
- *
- * - (y0^3 (w^2 - h^2) + h^2 y (3y0^2 - 2h^2))
- *
- * or (to use accelerators),
- *
- * y0^3 (h^2 - w^2) - h^2 y (3y0^2 - 2h^2)
- *
- */
-
-/*
- * computes the position on the ellipse whose normal line
- * intersects the given scan line maximally
- */
-
-static double
-hookEllipseY (double scan_y, struct arc_bound *bound,
- struct accelerators *acc, int left)
-{
- double ret;
-
- if (acc->h2mw2 == 0) {
- if ( (scan_y > 0 && !left) || (scan_y < 0 && left) )
- return bound->ellipse.min;
- return bound->ellipse.max;
- }
- ret = (acc->h4 * scan_y) / (acc->h2mw2);
- if (ret >= 0)
- return cbrt (ret);
- else
- return -cbrt (-ret);
-}
-
-/*
- * computes the X value of the intersection of the
- * given scan line with the right side of the lower hook
- */
-
-static double
-hookX (double scan_y, struct arc_def *def,
- struct arc_bound *bound, struct accelerators *acc, int left)
-{
- double ellipse_y, x;
- double maxMin;
-
- if (def->w != def->h) {
- ellipse_y = hookEllipseY (scan_y, bound, acc, left);
- if (boundedLe (ellipse_y, bound->ellipse)) {
- /*
- * compute the value of the second
- * derivative
- */
- maxMin = ellipse_y*ellipse_y*ellipse_y * acc->h2mw2 -
- acc->h2 * scan_y * (3 * ellipse_y*ellipse_y - 2*acc->h2);
- if ((left && maxMin > 0) || (!left && maxMin < 0)) {
- if (ellipse_y == 0)
- return def->w + left ? -def->l : def->l;
- x = (acc->h2 * scan_y - ellipse_y * acc->h2mw2) *
- sqrt (acc->h2 - ellipse_y * ellipse_y) /
- (def->h * def->w * ellipse_y);
- return x;
- }
- }
- }
- if (left) {
- if (acc->left.valid && boundedLe (scan_y, bound->left)) {
- x = intersectLine (scan_y, acc->left);
- } else {
- if (acc->right.valid)
- x = intersectLine (scan_y, acc->right);
- else
- x = def->w - def->l;
- }
- } else {
- if (acc->right.valid && boundedLe (scan_y, bound->right)) {
- x = intersectLine (scan_y, acc->right);
- } else {
- if (acc->left.valid)
- x = intersectLine (scan_y, acc->left);
- else
- x = def->w - def->l;
- }
- }
- return x;
-}
-
-/*
- * generate the set of spans with
- * the given y coordinate
- */
-
-static void
-arcSpan (int y, int lx, int lw, int rx, int rw,
- struct arc_def *def, struct arc_bound *bounds,
- struct accelerators *acc, int mask)
-{
- int linx, loutx, rinx, routx;
- double x, altx;
-
- if (boundedLe (y, bounds->inneri)) {
- linx = -(lx + lw);
- rinx = rx;
- } else {
- /*
- * intersection with left face
- */
- x = hookX (y + acc->fromIntY, def, bounds, acc, 1);
- if (acc->right.valid &&
- boundedLe (y + acc->fromIntY, bounds->right))
- {
- altx = intersectLine (y + acc->fromIntY, acc->right);
- if (altx < x)
- x = altx;
- }
- linx = -ICEIL(acc->fromIntX - x);
- rinx = ICEIL(acc->fromIntX + x);
- }
- if (boundedLe (y, bounds->outeri)) {
- loutx = -lx;
- routx = rx + rw;
- } else {
- /*
- * intersection with right face
- */
- x = hookX (y + acc->fromIntY, def, bounds, acc, 0);
- if (acc->left.valid &&
- boundedLe (y + acc->fromIntY, bounds->left))
- {
- altx = x;
- x = intersectLine (y + acc->fromIntY, acc->left);
- if (x < altx)
- x = altx;
- }
- loutx = -ICEIL(acc->fromIntX - x);
- routx = ICEIL(acc->fromIntX + x);
- }
- if (routx > rinx) {
- if (mask & 1)
- newFinalSpan (acc->yorgu - y,
- acc->xorg + rinx, acc->xorg + routx);
- if (mask & 8)
- newFinalSpan (acc->yorgl + y,
- acc->xorg + rinx, acc->xorg + routx);
- }
- if (loutx > linx) {
- if (mask & 2)
- newFinalSpan (acc->yorgu - y,
- acc->xorg - loutx, acc->xorg - linx);
- if (mask & 4)
- newFinalSpan (acc->yorgl + y,
- acc->xorg - loutx, acc->xorg - linx);
- }
-}
-
-static void
-arcSpan0 (int lx, int lw, int rx, int rw,
- struct arc_def *def, struct arc_bound *bounds,
- struct accelerators *acc, int mask)
-{
- double x;
-
- if (boundedLe (0, bounds->inneri) &&
- acc->left.valid && boundedLe (0, bounds->left) &&
- acc->left.b > 0)
- {
- x = def->w - def->l;
- if (acc->left.b < x)
- x = acc->left.b;
- lw = ICEIL(acc->fromIntX - x) - lx;
- rw += rx;
- rx = ICEIL(acc->fromIntX + x);
- rw -= rx;
- }
- arcSpan (0, lx, lw, rx, rw, def, bounds, acc, mask);
-}
-
-static void
-tailSpan (int y, int lw, int rw,
- struct arc_def *def, struct arc_bound *bounds,
- struct accelerators *acc, int mask)
-{
- double yy, xalt, x, lx, rx;
- int n;
-
- if (boundedLe(y, bounds->outeri))
- arcSpan (y, 0, lw, -rw, rw, def, bounds, acc, mask);
- else if (def->w != def->h) {
- yy = y + acc->fromIntY;
- x = tailX(yy, def, bounds, acc);
- if (yy == 0.0 && x == -rw - acc->fromIntX)
- return;
- if (acc->right.valid && boundedLe (yy, bounds->right)) {
- rx = x;
- lx = -x;
- xalt = intersectLine (yy, acc->right);
- if (xalt >= -rw - acc->fromIntX && xalt <= rx)
- rx = xalt;
- n = ICEIL(acc->fromIntX + lx);
- if (lw > n) {
- if (mask & 2)
- newFinalSpan (acc->yorgu - y,
- acc->xorg + n, acc->xorg + lw);
- if (mask & 4)
- newFinalSpan (acc->yorgl + y,
- acc->xorg + n, acc->xorg + lw);
- }
- n = ICEIL(acc->fromIntX + rx);
- if (n > -rw) {
- if (mask & 1)
- newFinalSpan (acc->yorgu - y,
- acc->xorg - rw, acc->xorg + n);
- if (mask & 8)
- newFinalSpan (acc->yorgl + y,
- acc->xorg - rw, acc->xorg + n);
- }
- }
- arcSpan (y,
- ICEIL(acc->fromIntX - x), 0,
- ICEIL(acc->fromIntX + x), 0,
- def, bounds, acc, mask);
- }
-}
-
-/*
- * create whole arcs out of pieces. This code is
- * very bad.
- */
-
-static struct finalSpan **finalSpans = NULL;
-static int finalMiny = 0, finalMaxy = -1;
-static int finalSize = 0;
-
-static int nspans = 0; /* total spans, not just y coords */
-
-struct finalSpan {
- struct finalSpan *next;
- int min, max; /* x values */
-};
-
-static struct finalSpan *freeFinalSpans, *tmpFinalSpan;
-
-# define allocFinalSpan() (freeFinalSpans ?\
- ((tmpFinalSpan = freeFinalSpans), \
- (freeFinalSpans = freeFinalSpans->next), \
- (tmpFinalSpan->next = NULL), \
- tmpFinalSpan) : \
- realAllocSpan ())
-
-# define SPAN_CHUNK_SIZE 128
-
-struct finalSpanChunk {
- struct finalSpan data[SPAN_CHUNK_SIZE];
- struct finalSpanChunk *next;
-};
-
-static struct finalSpanChunk *chunks;
-
-struct finalSpan *
-realAllocSpan (void)
-{
- register struct finalSpanChunk *newChunk;
- register struct finalSpan *span;
- register int i;
-
- newChunk = (struct finalSpanChunk *) g_malloc (sizeof (struct finalSpanChunk));
- if (!newChunk)
- return (struct finalSpan *) NULL;
- newChunk->next = chunks;
- chunks = newChunk;
- freeFinalSpans = span = newChunk->data + 1;
- for (i = 1; i < SPAN_CHUNK_SIZE-1; i++) {
- span->next = span+1;
- span++;
- }
- span->next = NULL;
- span = newChunk->data;
- span->next = NULL;
- return span;
-}
-
-static void
-disposeFinalSpans (void)
-{
- struct finalSpanChunk *chunk, *next;
-
- for (chunk = chunks; chunk; chunk = next) {
- next = chunk->next;
- g_free (chunk);
- }
- chunks = NULL;
- freeFinalSpans = NULL;
- g_free(finalSpans);
- finalSpans = NULL;
-}
-
-static void
-fillSpans (GdkDrawable *pDrawable, GdkGC *pGC)
-{
- register struct finalSpan *span;
- register GdkSpan* xSpan;
- register int i;
- register struct finalSpan **f;
- register int spany;
- GdkSpan* xSpans;
-
- if (nspans == 0)
- return;
- xSpan = xSpans = (GdkSpan*) ALLOCATE_LOCAL (nspans * sizeof (GdkSpan));
- if (xSpans)
- {
- i = 0;
- f = finalSpans;
- for (spany = finalMiny; spany <= finalMaxy; spany++, f++) {
- for (span = *f; span; span=span->next) {
- if (span->max <= span->min)
- continue;
- xSpan->x = span->min;
- xSpan->y = spany;
- xSpan->width = span->max - span->min;
- ++xSpan;
- ++i;
- }
- }
-
- gdk_fb_fill_spans(pDrawable, pGC, xSpans, i, TRUE);
- }
- disposeFinalSpans ();
- if (xSpans)
- DEALLOCATE_LOCAL (xSpans);
- finalMiny = 0;
- finalMaxy = -1;
- finalSize = 0;
- nspans = 0;
-}
-
-# define SPAN_REALLOC 100
-
-# define findSpan(y) ((finalMiny <= (y) && (y) <= finalMaxy) ? \
- &finalSpans[(y) - finalMiny] : \
- realFindSpan (y))
-
-static struct finalSpan **
-realFindSpan (int y)
-{
- struct finalSpan **newSpans;
- int newSize, newMiny, newMaxy;
- int change;
- int i;
-
- if (y < finalMiny || y > finalMaxy) {
- if (!finalSize) {
- finalMiny = y;
- finalMaxy = y - 1;
- }
- if (y < finalMiny)
- change = finalMiny - y;
- else
- change = y - finalMaxy;
- if (change >= SPAN_REALLOC)
- change += SPAN_REALLOC;
- else
- change = SPAN_REALLOC;
- newSize = finalSize + change;
- newSpans = (struct finalSpan **) g_malloc
- (newSize * sizeof (struct finalSpan *));
- if (!newSpans)
- return (struct finalSpan **)NULL;
- newMiny = finalMiny;
- newMaxy = finalMaxy;
- if (y < finalMiny)
- newMiny = finalMiny - change;
- else
- newMaxy = finalMaxy + change;
- if (finalSpans) {
- g_memmove(((char *) newSpans) + (finalMiny-newMiny) * sizeof (struct finalSpan *),
- (char *) finalSpans,
- finalSize * sizeof (struct finalSpan *));
- g_free (finalSpans);
- }
- if ((i = finalMiny - newMiny) > 0)
- memset ((char *)newSpans, 0, i * sizeof (struct finalSpan *));
- if ((i = newMaxy - finalMaxy) > 0)
- memset ((char *)(newSpans + newSize - i), 0,
- i * sizeof (struct finalSpan *));
- finalSpans = newSpans;
- finalMaxy = newMaxy;
- finalMiny = newMiny;
- finalSize = newSize;
- }
- return &finalSpans[y - finalMiny];
-}
-
-static void
-newFinalSpan (int y, register int xmin, register int xmax)
-{
- register struct finalSpan *x;
- register struct finalSpan **f;
- struct finalSpan *oldx;
- struct finalSpan *prev;
-
- f = findSpan (y);
- if (!f)
- return;
- oldx = NULL;
- for (;;) {
- prev = NULL;
- for (x = *f; x; x=x->next) {
- if (x == oldx) {
- prev = x;
- continue;
- }
- if (x->min <= xmax && xmin <= x->max) {
- if (oldx) {
- oldx->min = MIN (x->min, xmin);
- oldx->max = MAX (x->max, xmax);
- if (prev)
- prev->next = x->next;
- else
- *f = x->next;
- --nspans;
- } else {
- x->min = MIN (x->min, xmin);
- x->max = MAX (x->max, xmax);
- oldx = x;
- }
- xmin = oldx->min;
- xmax = oldx->max;
- break;
- }
- prev = x;
- }
- if (!x)
- break;
- }
- if (!oldx) {
- x = allocFinalSpan ();
- if (x)
- {
- x->min = xmin;
- x->max = xmax;
- x->next = *f;
- *f = x;
- ++nspans;
- }
- }
-}
-
-static void
-mirrorSppPoint (int quadrant, SppPointPtr sppPoint)
-{
- switch (quadrant) {
- case 0:
- break;
- case 1:
- sppPoint->x = -sppPoint->x;
- break;
- case 2:
- sppPoint->x = -sppPoint->x;
- sppPoint->y = -sppPoint->y;
- break;
- case 3:
- sppPoint->y = -sppPoint->y;
- break;
- }
- /*
- * and translate to X coordinate system
- */
- sppPoint->y = -sppPoint->y;
-}
-
-/*
- * split an arc into pieces which are scan-converted
- * in the first-quadrant and mirrored into position.
- * This is necessary as the scan-conversion code can
- * only deal with arcs completely contained in the
- * first quadrant.
- */
-
-static void
-drawArc (miArc *tarc, int l, int a0, int a1, miArcFacePtr right, miArcFacePtr left)
- /* miArcFacePtr right, left; */ /* save end line points */
-{
- struct arc_def def;
- struct accelerators acc;
- int startq, endq, curq;
- int rightq, leftq = 0, righta = 0, lefta = 0;
- miArcFacePtr passRight, passLeft;
- int q0 = 0, q1 = 0, mask;
- struct band {
- int a0, a1;
- int mask;
- } band[5], sweep[20];
- int bandno, sweepno;
- int i, j;
- int flipRight = 0, flipLeft = 0;
- int copyEnd = 0;
- miArcSpanData *spdata;
- gboolean mustFree;
-
- spdata = miComputeWideEllipse(l, tarc, &mustFree);
- if (!spdata)
- return;
-
- if (a1 < a0)
- a1 += 360 * 64;
- startq = a0 / (90 * 64);
- if (a0 == a1)
- endq = startq;
- else
- endq = (a1-1) / (90 * 64);
- bandno = 0;
- curq = startq;
- rightq = -1;
- for (;;) {
- switch (curq) {
- case 0:
- if (a0 > 90 * 64)
- q0 = 0;
- else
- q0 = a0;
- if (a1 < 360 * 64)
- q1 = MIN (a1, 90 * 64);
- else
- q1 = 90 * 64;
- if (curq == startq && a0 == q0 && rightq < 0) {
- righta = q0;
- rightq = curq;
- }
- if (curq == endq && a1 == q1) {
- lefta = q1;
- leftq = curq;
- }
- break;
- case 1:
- if (a1 < 90 * 64)
- q0 = 0;
- else
- q0 = 180 * 64 - MIN (a1, 180 * 64);
- if (a0 > 180 * 64)
- q1 = 90 * 64;
- else
- q1 = 180 * 64 - MAX (a0, 90 * 64);
- if (curq == startq && 180 * 64 - a0 == q1) {
- righta = q1;
- rightq = curq;
- }
- if (curq == endq && 180 * 64 - a1 == q0) {
- lefta = q0;
- leftq = curq;
- }
- break;
- case 2:
- if (a0 > 270 * 64)
- q0 = 0;
- else
- q0 = MAX (a0, 180 * 64) - 180 * 64;
- if (a1 < 180 * 64)
- q1 = 90 * 64;
- else
- q1 = MIN (a1, 270 * 64) - 180 * 64;
- if (curq == startq && a0 - 180*64 == q0) {
- righta = q0;
- rightq = curq;
- }
- if (curq == endq && a1 - 180 * 64 == q1) {
- lefta = q1;
- leftq = curq;
- }
- break;
- case 3:
- if (a1 < 270 * 64)
- q0 = 0;
- else
- q0 = 360 * 64 - MIN (a1, 360 * 64);
- q1 = 360 * 64 - MAX (a0, 270 * 64);
- if (curq == startq && 360 * 64 - a0 == q1) {
- righta = q1;
- rightq = curq;
- }
- if (curq == endq && 360 * 64 - a1 == q0) {
- lefta = q0;
- leftq = curq;
- }
- break;
- }
- band[bandno].a0 = q0;
- band[bandno].a1 = q1;
- band[bandno].mask = 1 << curq;
- bandno++;
- if (curq == endq)
- break;
- curq++;
- if (curq == 4) {
- a0 = 0;
- a1 -= 360 * 64;
- curq = 0;
- endq -= 4;
- }
- }
- sweepno = 0;
- for (;;) {
- q0 = 90 * 64;
- mask = 0;
- /*
- * find left-most point
- */
- for (i = 0; i < bandno; i++)
- if (band[i].a0 <= q0) {
- q0 = band[i].a0;
- q1 = band[i].a1;
- mask = band[i].mask;
- }
- if (!mask)
- break;
- /*
- * locate next point of change
- */
- for (i = 0; i < bandno; i++)
- if (!(mask & band[i].mask)) {
- if (band[i].a0 == q0) {
- if (band[i].a1 < q1)
- q1 = band[i].a1;
- mask |= band[i].mask;
- } else if (band[i].a0 < q1)
- q1 = band[i].a0;
- }
- /*
- * create a new sweep
- */
- sweep[sweepno].a0 = q0;
- sweep[sweepno].a1 = q1;
- sweep[sweepno].mask = mask;
- sweepno++;
- /*
- * subtract the sweep from the affected bands
- */
- for (i = 0; i < bandno; i++)
- if (band[i].a0 == q0) {
- band[i].a0 = q1;
- /*
- * check if this band is empty
- */
- if (band[i].a0 == band[i].a1)
- band[i].a1 = band[i].a0 = 90 * 64 + 1;
- }
- }
- computeAcc (tarc, l, &def, &acc);
- for (j = 0; j < sweepno; j++) {
- mask = sweep[j].mask;
- passRight = passLeft = NULL;
- if (mask & (1 << rightq)) {
- if (sweep[j].a0 == righta)
- passRight = right;
- else if (sweep[j].a1 == righta) {
- passLeft = right;
- flipRight = 1;
- }
- }
- if (mask & (1 << leftq)) {
- if (sweep[j].a1 == lefta)
- {
- if (passLeft)
- copyEnd = 1;
- passLeft = left;
- }
- else if (sweep[j].a0 == lefta) {
- if (passRight)
- copyEnd = 1;
- passRight = left;
- flipLeft = 1;
- }
- }
- drawQuadrant (&def, &acc, sweep[j].a0, sweep[j].a1, mask,
- passRight, passLeft, spdata);
- }
- /*
- * when copyEnd is set, both ends of the arc were computed
- * at the same time; drawQuadrant only takes one end though,
- * so the left end will be the only one holding the data. Copy
- * it from there.
- */
- if (copyEnd)
- *right = *left;
- /*
- * mirror the coordinates generated for the
- * faces of the arc
- */
- if (right) {
- mirrorSppPoint (rightq, &right->clock);
- mirrorSppPoint (rightq, &right->center);
- mirrorSppPoint (rightq, &right->counterClock);
- if (flipRight) {
- SppPointRec temp;
-
- temp = right->clock;
- right->clock = right->counterClock;
- right->counterClock = temp;
- }
- }
- if (left) {
- mirrorSppPoint (leftq, &left->counterClock);
- mirrorSppPoint (leftq, &left->center);
- mirrorSppPoint (leftq, &left->clock);
- if (flipLeft) {
- SppPointRec temp;
-
- temp = left->clock;
- left->clock = left->counterClock;
- left->counterClock = temp;
- }
- }
- if (mustFree)
- g_free(spdata);
-}
-
-static void
-drawQuadrant (struct arc_def *def, struct accelerators *acc,
- int a0, int a1, int mask, miArcFacePtr right,
- miArcFacePtr left, miArcSpanData *spdata)
-{
- struct arc_bound bound;
- double yy, x, xalt;
- int y, miny, maxy;
- int n;
- miArcSpan *span;
-
- def->a0 = ((double) a0) / 64.0;
- def->a1 = ((double) a1) / 64.0;
- computeBound (def, &bound, acc, right, left);
- yy = bound.inner.min;
- if (bound.outer.min < yy)
- yy = bound.outer.min;
- miny = ICEIL(yy - acc->fromIntY);
- yy = bound.inner.max;
- if (bound.outer.max > yy)
- yy = bound.outer.max;
- maxy = floor(yy - acc->fromIntY);
- y = spdata->k;
- span = spdata->spans;
- if (spdata->top)
- {
- if (a1 == 90 * 64 && (mask & 1))
- newFinalSpan (acc->yorgu - y - 1, acc->xorg, acc->xorg + 1);
- span++;
- }
- for (n = spdata->count1; --n >= 0; )
- {
- if (y < miny)
- return;
- if (y <= maxy) {
- arcSpan (y,
- span->lx, -span->lx, 0, span->lx + span->lw,
- def, &bound, acc, mask);
- if (span->rw + span->rx)
- tailSpan (y, -span->rw, -span->rx, def, &bound, acc, mask);
- }
- y--;
- span++;
- }
- if (y < miny)
- return;
- if (spdata->hole)
- {
- if (y <= maxy)
- arcSpan (y, 0, 0, 0, 1, def, &bound, acc, mask & 0xc);
- }
- for (n = spdata->count2; --n >= 0; )
- {
- if (y < miny)
- return;
- if (y <= maxy)
- arcSpan (y, span->lx, span->lw, span->rx, span->rw,
- def, &bound, acc, mask);
- y--;
- span++;
- }
- if (spdata->bot && miny <= y && y <= maxy)
- {
- n = mask;
- if (y == miny)
- n &= 0xc;
- if (span->rw <= 0) {
- arcSpan0 (span->lx, -span->lx, 0, span->lx + span->lw,
- def, &bound, acc, n);
- if (span->rw + span->rx)
- tailSpan (y, -span->rw, -span->rx, def, &bound, acc, n);
- }
- else
- arcSpan0 (span->lx, span->lw, span->rx, span->rw,
- def, &bound, acc, n);
- y--;
- }
- while (y >= miny) {
- yy = y + acc->fromIntY;
- if (def->w == def->h) {
- xalt = def->w - def->l;
- x = -sqrt(xalt * xalt - yy * yy);
- } else {
- x = tailX(yy, def, &bound, acc);
- if (acc->left.valid && boundedLe (yy, bound.left)) {
- xalt = intersectLine (yy, acc->left);
- if (xalt < x)
- x = xalt;
- }
- if (acc->right.valid && boundedLe (yy, bound.right)) {
- xalt = intersectLine (yy, acc->right);
- if (xalt < x)
- x = xalt;
- }
- }
- arcSpan (y,
- ICEIL(acc->fromIntX - x), 0,
- ICEIL(acc->fromIntX + x), 0,
- def, &bound, acc, mask);
- y--;
- }
-}
diff --git a/gdk/linux-fb/midash.c b/gdk/linux-fb/midash.c
deleted file mode 100644
index 0e90516a6..000000000
--- a/gdk/linux-fb/midash.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* $TOG: midash.c /main/14 1998/02/09 14:46:34 kaleb $ */
-
-#include <config.h>
-#include "mi.h"
-
-static miDashPtr
-CheckDashStorage(miDashPtr *ppseg, int nseg, int *pnsegMax);
-
-/* return a list of DashRec. there will be an extra
-entry at the end holding the last point of the polyline.
- this means that the code that actually draws dashes can
-get a pair of points for every dash. only the point in the last
-dash record is useful; the other fields are not used.
- nseg is the number of segments, not the number of points.
-
-example:
-
- dash1.start
- dash2.start
- dash3.start
- last-point
-
-defines a list of segments
- (dash1.pt, dash2.pt)
- (dash2.pt, dash3.pt)
- (dash3.pt, last-point)
-and nseg == 3.
-
-NOTE:
- EVEN_DASH == ~ODD_DASH
-
-NOTE ALSO:
- miDashLines may return 0 segments, going from pt[0] to pt[0] with one dash.
-*/
-
-enum { EVEN_DASH=0, ODD_DASH=1 };
-
-#define sign(x) ((x)>0)?1:( ((x)<0)?-1:0 )
-
-miDashPtr
-miDashLine(int npt, GdkPoint *ppt, unsigned int nDash,
- unsigned char *pDash, unsigned int offset, int *pnseg)
-{
- GdkPoint pt1, pt2;
- int lenCur; /* npt used from this dash */
- int lenMax; /* npt in this dash */
- int iDash = 0; /* index of current dash */
- int which; /* EVEN_DASH or ODD_DASH */
- miDashPtr pseg; /* list of dash segments */
- miDashPtr psegBase; /* start of list */
- int nseg = 0; /* number of dashes so far */
- int nsegMax = 0; /* num segs we can fit in this list */
-
- int x, y, len;
- int adx, ady, signdx, signdy;
- int du, dv, e1, e2, e, base_e = 0;
-
- lenCur = offset;
- which = EVEN_DASH;
- while(lenCur >= pDash[iDash])
- {
- lenCur -= pDash[iDash];
- iDash++;
- if (iDash >= nDash)
- iDash = 0;
- which = ~which;
- }
- lenMax = pDash[iDash];
-
- psegBase = (miDashPtr)NULL;
- pt2 = ppt[0]; /* just in case there is only one point */
-
- while(--npt)
- {
- if (PtEqual(ppt[0], ppt[1]))
- {
- ppt++;
- continue; /* no duplicated points in polyline */
- }
- pt1 = *ppt++;
- pt2 = *ppt;
-
- adx = pt2.x - pt1.x;
- ady = pt2.y - pt1.y;
- signdx = sign(adx);
- signdy = sign(ady);
- adx = abs(adx);
- ady = abs(ady);
-
- if (adx > ady)
- {
- du = adx;
- dv = ady;
- len = adx;
- }
- else
- {
- du = ady;
- dv = adx;
- len = ady;
- }
-
- e1 = dv * 2;
- e2 = e1 - 2*du;
- e = e1 - du;
- x = pt1.x;
- y = pt1.y;
-
- nseg++;
- pseg = CheckDashStorage(&psegBase, nseg, &nsegMax);
- if (!pseg)
- return (miDashPtr)NULL;
- pseg->pt = pt1;
- pseg->e1 = e1;
- pseg->e2 = e2;
- base_e = pseg->e = e;
- pseg->which = which;
- pseg->newLine = 1;
-
- while (len--)
- {
- if (adx > ady)
- {
- /* X_AXIS */
- if (((signdx > 0) && (e < 0)) ||
- ((signdx <=0) && (e <=0))
- )
- {
- e += e1;
- }
- else
- {
- y += signdy;
- e += e2;
- }
- x += signdx;
- }
- else
- {
- /* Y_AXIS */
- if (((signdx > 0) && (e < 0)) ||
- ((signdx <=0) && (e <=0))
- )
- {
- e +=e1;
- }
- else
- {
- x += signdx;
- e += e2;
- }
- y += signdy;
- }
-
- lenCur++;
- if (lenCur >= lenMax && (len || npt <= 1))
- {
- nseg++;
- pseg = CheckDashStorage(&psegBase, nseg, &nsegMax);
- if (!pseg)
- return (miDashPtr)NULL;
- pseg->pt.x = x;
- pseg->pt.y = y;
- pseg->e1 = e1;
- pseg->e2 = e2;
- pseg->e = e;
- which = ~which;
- pseg->which = which;
- pseg->newLine = 0;
-
- /* move on to next dash */
- iDash++;
- if (iDash >= nDash)
- iDash = 0;
- lenMax = pDash[iDash];
- lenCur = 0;
- }
- } /* while len-- */
- } /* while --npt */
-
- if (lenCur == 0 && nseg != 0)
- {
- nseg--;
- which = ~which;
- }
- *pnseg = nseg;
- pseg = CheckDashStorage(&psegBase, nseg+1, &nsegMax);
- if (!pseg)
- return (miDashPtr)NULL;
- pseg->pt = pt2;
- pseg->e = base_e;
- pseg->which = which;
- pseg->newLine = 0;
- return psegBase;
-}
-
-
-#define NSEGDELTA 16
-
-/* returns a pointer to the pseg[nseg-1], growing the storage as
-necessary. this interface seems unnecessarily cumbersome.
-
-*/
-
-static miDashPtr
-CheckDashStorage(miDashPtr *ppseg, int nseg, int *pnsegMax)
-#if 0
-miDashPtr *ppseg; /* base pointer */
-int nseg; /* number of segment we want to write to */
-int *pnsegMax; /* size (in segments) of list so far */
-#endif
-{
- if (nseg > *pnsegMax)
- {
- miDashPtr newppseg;
-
- *pnsegMax += NSEGDELTA;
- newppseg = (miDashPtr)g_realloc(*ppseg,
- (*pnsegMax)*sizeof(miDashRec));
- if (!newppseg)
- {
- g_free(*ppseg);
- return (miDashPtr)NULL;
- }
- *ppseg = newppseg;
- }
- return(*ppseg+(nseg-1));
-}
-
-void
-miStepDash (int dist, int *pDashIndex, unsigned char *pDash,
- int numInDashList, int *pDashOffset)
-#if 0
- int dist; /* distance to step */
- int *pDashIndex; /* current dash */
- unsigned char *pDash; /* dash list */
- int numInDashList; /* total length of dash list */
- int *pDashOffset; /* offset into current dash */
-#endif
-{
- int dashIndex, dashOffset;
- int totallen;
- int i;
-
- dashIndex = *pDashIndex;
- dashOffset = *pDashOffset;
- if (dist < pDash[dashIndex] - dashOffset)
- {
- *pDashOffset = dashOffset + dist;
- return;
- }
- dist -= pDash[dashIndex] - dashOffset;
- if (++dashIndex == numInDashList)
- dashIndex = 0;
- totallen = 0;
- for (i = 0; i < numInDashList; i++)
- totallen += pDash[i];
- if (totallen <= dist)
- dist = dist % totallen;
- while (dist >= pDash[dashIndex])
- {
- dist -= pDash[dashIndex];
- if (++dashIndex == numInDashList)
- dashIndex = 0;
- }
- *pDashIndex = dashIndex;
- *pDashOffset = dist;
-}
diff --git a/gdk/linux-fb/mifillarc.c b/gdk/linux-fb/mifillarc.c
deleted file mode 100644
index 5f1206799..000000000
--- a/gdk/linux-fb/mifillarc.c
+++ /dev/null
@@ -1,707 +0,0 @@
-/* $XFree86: xc/programs/Xserver/mi/mifillarc.c,v 3.4 1999/04/11 13:11:20 dawes Exp $ */
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Author: Bob Scheifler, MIT X Consortium
-
-********************************************************/
-
-/* $TOG: mifillarc.c /main/20 1998/02/09 14:46:52 kaleb $ */
-
-#include <config.h>
-#include <math.h>
-#include "mi.h"
-#include "mifillarc.h"
-#include "gdkprivate-fb.h"
-
-#define QUADRANT (90 * 64)
-#define HALFCIRCLE (180 * 64)
-#define QUADRANT3 (270 * 64)
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#define Dsin(d) sin((double)d*(M_PI/11520.0))
-#define Dcos(d) cos((double)d*(M_PI/11520.0))
-
-void
-miFillArcSetup(register miArc *arc, register miFillArcRec *info)
-{
- info->y = arc->height >> 1;
- info->dy = arc->height & 1;
- info->yorg = arc->y + info->y;
- info->dx = arc->width & 1;
- info->xorg = arc->x + (arc->width >> 1) + info->dx;
- info->dx = 1 - info->dx;
- if (arc->width == arc->height)
- {
- /* (2x - 2xorg)^2 = d^2 - (2y - 2yorg)^2 */
- /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */
- info->ym = 8;
- info->xm = 8;
- info->yk = info->y << 3;
- if (!info->dx)
- {
- info->xk = 0;
- info->e = -1;
- }
- else
- {
- info->y++;
- info->yk += 4;
- info->xk = -4;
- info->e = - (info->y << 3);
- }
- }
- else
- {
- /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */
- /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */
- info->ym = (arc->width * arc->width) << 3;
- info->xm = (arc->height * arc->height) << 3;
- info->yk = info->y * info->ym;
- if (!info->dy)
- info->yk -= info->ym >> 1;
- if (!info->dx)
- {
- info->xk = 0;
- info->e = - (info->xm >> 3);
- }
- else
- {
- info->y++;
- info->yk += info->ym;
- info->xk = -(info->xm >> 1);
- info->e = info->xk - info->yk;
- }
- }
-}
-
-void
-miFillArcDSetup(register miArc *arc, register miFillArcDRec *info)
-{
- /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */
- /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */
- info->y = arc->height >> 1;
- info->dy = arc->height & 1;
- info->yorg = arc->y + info->y;
- info->dx = arc->width & 1;
- info->xorg = arc->x + (arc->width >> 1) + info->dx;
- info->dx = 1 - info->dx;
- info->ym = ((double)arc->width) * (arc->width * 8);
- info->xm = ((double)arc->height) * (arc->height * 8);
- info->yk = info->y * info->ym;
- if (!info->dy)
- info->yk -= info->ym / 2.0;
- if (!info->dx)
- {
- info->xk = 0;
- info->e = - (info->xm / 8.0);
- }
- else
- {
- info->y++;
- info->yk += info->ym;
- info->xk = -info->xm / 2.0;
- info->e = info->xk - info->yk;
- }
-}
-
-static void
-miGetArcEdge(register miArc *arc, register miSliceEdgePtr edge, int k,
- gboolean top, gboolean left)
-{
- register int xady, y;
-
- y = arc->height >> 1;
- if (!(arc->width & 1))
- y++;
- if (!top)
- {
- y = -y;
- if (arc->height & 1)
- y--;
- }
- xady = k + y * edge->dx;
- if (xady <= 0)
- edge->x = - ((-xady) / edge->dy + 1);
- else
- edge->x = (xady - 1) / edge->dy;
- edge->e = xady - edge->x * edge->dy;
- if ((top && (edge->dx < 0)) || (!top && (edge->dx > 0)))
- edge->e = edge->dy - edge->e + 1;
- if (left)
- edge->x++;
- edge->x += arc->x + (arc->width >> 1);
- if (edge->dx > 0)
- {
- edge->deltax = 1;
- edge->stepx = edge->dx / edge->dy;
- edge->dx = edge->dx % edge->dy;
- }
- else
- {
- edge->deltax = -1;
- edge->stepx = - ((-edge->dx) / edge->dy);
- edge->dx = (-edge->dx) % edge->dy;
- }
- if (!top)
- {
- edge->deltax = -edge->deltax;
- edge->stepx = -edge->stepx;
- }
-}
-
-void
-miEllipseAngleToSlope (int angle, int width, int height, int *dxp, int *dyp,
- double *d_dxp, double *d_dyp)
-{
- int dx, dy;
- double d_dx, d_dy, scale;
- gboolean negative_dx, negative_dy;
-
- switch (angle) {
- case 0:
- *dxp = -1;
- *dyp = 0;
- if (d_dxp) {
- *d_dxp = width / 2.0;
- *d_dyp = 0;
- }
- break;
- case QUADRANT:
- *dxp = 0;
- *dyp = 1;
- if (d_dxp) {
- *d_dxp = 0;
- *d_dyp = - height / 2.0;
- }
- break;
- case HALFCIRCLE:
- *dxp = 1;
- *dyp = 0;
- if (d_dxp) {
- *d_dxp = - width / 2.0;
- *d_dyp = 0;
- }
- break;
- case QUADRANT3:
- *dxp = 0;
- *dyp = -1;
- if (d_dxp) {
- *d_dxp = 0;
- *d_dyp = height / 2.0;
- }
- break;
- default:
- d_dx = Dcos(angle) * width;
- d_dy = Dsin(angle) * height;
- if (d_dxp) {
- *d_dxp = d_dx / 2.0;
- *d_dyp = - d_dy / 2.0;
- }
- negative_dx = FALSE;
- if (d_dx < 0.0)
- {
- d_dx = -d_dx;
- negative_dx = TRUE;
- }
- negative_dy = FALSE;
- if (d_dy < 0.0)
- {
- d_dy = -d_dy;
- negative_dy = TRUE;
- }
- scale = d_dx;
- if (d_dy > d_dx)
- scale = d_dy;
- dx = floor ((d_dx * 32768) / scale + 0.5);
- if (negative_dx)
- dx = -dx;
- *dxp = dx;
- dy = floor ((d_dy * 32768) / scale + 0.5);
- if (negative_dy)
- dy = -dy;
- *dyp = dy;
- break;
- }
-}
-
-static void
-miGetPieEdge(register miArc *arc, register int angle,
- register miSliceEdgePtr edge, gboolean top, gboolean left)
-{
- register int k;
- int dx, dy;
-
- miEllipseAngleToSlope (angle, arc->width, arc->height, &dx, &dy, NULL, NULL);
-
- if (dy == 0)
- {
- edge->x = left ? -65536 : 65536;
- edge->stepx = 0;
- edge->e = 0;
- edge->dx = -1;
- return;
- }
- if (dx == 0)
- {
- edge->x = arc->x + (arc->width >> 1);
- if (left && (arc->width & 1))
- edge->x++;
- else if (!left && !(arc->width & 1))
- edge->x--;
- edge->stepx = 0;
- edge->e = 0;
- edge->dx = -1;
- return;
- }
- if (dy < 0) {
- dx = -dx;
- dy = -dy;
- }
- k = (arc->height & 1) ? dx : 0;
- if (arc->width & 1)
- k += dy;
- edge->dx = dx << 1;
- edge->dy = dy << 1;
- miGetArcEdge(arc, edge, k, top, left);
-}
-
-void
-miFillArcSliceSetup(register miArc *arc, register miArcSliceRec *slice,
- GdkGC *pGC)
-{
- register int angle1, angle2;
-
- angle1 = arc->angle1;
- if (arc->angle2 < 0)
- {
- angle2 = angle1;
- angle1 += arc->angle2;
- }
- else
- angle2 = angle1 + arc->angle2;
- while (angle1 < 0)
- angle1 += FULLCIRCLE;
- while (angle1 >= FULLCIRCLE)
- angle1 -= FULLCIRCLE;
- while (angle2 < 0)
- angle2 += FULLCIRCLE;
- while (angle2 >= FULLCIRCLE)
- angle2 -= FULLCIRCLE;
- slice->min_top_y = 0;
- slice->max_top_y = arc->height >> 1;
- slice->min_bot_y = 1 - (arc->height & 1);
- slice->max_bot_y = slice->max_top_y - 1;
- slice->flip_top = FALSE;
- slice->flip_bot = FALSE;
- if (1 /* pGC->arcMode == ArcPieSlice */)
- {
- slice->edge1_top = (angle1 < HALFCIRCLE);
- slice->edge2_top = (angle2 <= HALFCIRCLE);
- if ((angle2 == 0) || (angle1 == HALFCIRCLE))
- {
- if (angle2 ? slice->edge2_top : slice->edge1_top)
- slice->min_top_y = slice->min_bot_y;
- else
- slice->min_top_y = arc->height;
- slice->min_bot_y = 0;
- }
- else if ((angle1 == 0) || (angle2 == HALFCIRCLE))
- {
- slice->min_top_y = slice->min_bot_y;
- if (angle1 ? slice->edge1_top : slice->edge2_top)
- slice->min_bot_y = arc->height;
- else
- slice->min_bot_y = 0;
- }
- else if (slice->edge1_top == slice->edge2_top)
- {
- if (angle2 < angle1)
- {
- slice->flip_top = slice->edge1_top;
- slice->flip_bot = !slice->edge1_top;
- }
- else if (slice->edge1_top)
- {
- slice->min_top_y = 1;
- slice->min_bot_y = arc->height;
- }
- else
- {
- slice->min_bot_y = 0;
- slice->min_top_y = arc->height;
- }
- }
- miGetPieEdge(arc, angle1, &slice->edge1,
- slice->edge1_top, !slice->edge1_top);
- miGetPieEdge(arc, angle2, &slice->edge2,
- slice->edge2_top, slice->edge2_top);
- }
- else
- {
- double w2, h2, x1, y1, x2, y2, dx, dy, scale;
- int signdx, signdy, y, k;
- gboolean isInt1 = TRUE, isInt2 = TRUE;
-
- w2 = (double)arc->width / 2.0;
- h2 = (double)arc->height / 2.0;
- if ((angle1 == 0) || (angle1 == HALFCIRCLE))
- {
- x1 = angle1 ? -w2 : w2;
- y1 = 0.0;
- }
- else if ((angle1 == QUADRANT) || (angle1 == QUADRANT3))
- {
- x1 = 0.0;
- y1 = (angle1 == QUADRANT) ? h2 : -h2;
- }
- else
- {
- isInt1 = FALSE;
- x1 = Dcos(angle1) * w2;
- y1 = Dsin(angle1) * h2;
- }
- if ((angle2 == 0) || (angle2 == HALFCIRCLE))
- {
- x2 = angle2 ? -w2 : w2;
- y2 = 0.0;
- }
- else if ((angle2 == QUADRANT) || (angle2 == QUADRANT3))
- {
- x2 = 0.0;
- y2 = (angle2 == QUADRANT) ? h2 : -h2;
- }
- else
- {
- isInt2 = FALSE;
- x2 = Dcos(angle2) * w2;
- y2 = Dsin(angle2) * h2;
- }
- dx = x2 - x1;
- dy = y2 - y1;
- if (arc->height & 1)
- {
- y1 -= 0.5;
- y2 -= 0.5;
- }
- if (arc->width & 1)
- {
- x1 += 0.5;
- x2 += 0.5;
- }
- if (dy < 0.0)
- {
- dy = -dy;
- signdy = -1;
- }
- else
- signdy = 1;
- if (dx < 0.0)
- {
- dx = -dx;
- signdx = -1;
- }
- else
- signdx = 1;
- if (isInt1 && isInt2)
- {
- slice->edge1.dx = dx * 2;
- slice->edge1.dy = dy * 2;
- }
- else
- {
- scale = (dx > dy) ? dx : dy;
- slice->edge1.dx = floor((dx * 32768) / scale + .5);
- slice->edge1.dy = floor((dy * 32768) / scale + .5);
- }
- if (!slice->edge1.dy)
- {
- if (signdx < 0)
- {
- y = floor(y1 + 1.0);
- if (y >= 0)
- {
- slice->min_top_y = y;
- slice->min_bot_y = arc->height;
- }
- else
- {
- slice->max_bot_y = -y - (arc->height & 1);
- }
- }
- else
- {
- y = floor(y1);
- if (y >= 0)
- slice->max_top_y = y;
- else
- {
- slice->min_top_y = arc->height;
- slice->min_bot_y = -y - (arc->height & 1);
- }
- }
- slice->edge1_top = TRUE;
- slice->edge1.x = 65536;
- slice->edge1.stepx = 0;
- slice->edge1.e = 0;
- slice->edge1.dx = -1;
- slice->edge2 = slice->edge1;
- slice->edge2_top = FALSE;
- }
- else if (!slice->edge1.dx)
- {
- if (signdy < 0)
- x1 -= 1.0;
- slice->edge1.x = ceil(x1);
- slice->edge1_top = signdy < 0;
- slice->edge1.x += arc->x + (arc->width >> 1);
- slice->edge1.stepx = 0;
- slice->edge1.e = 0;
- slice->edge1.dx = -1;
- slice->edge2_top = !slice->edge1_top;
- slice->edge2 = slice->edge1;
- }
- else
- {
- if (signdx < 0)
- slice->edge1.dx = -slice->edge1.dx;
- if (signdy < 0)
- slice->edge1.dx = -slice->edge1.dx;
- k = ceil(((x1 + x2) * slice->edge1.dy - (y1 + y2) * slice->edge1.dx) / 2.0);
- slice->edge2.dx = slice->edge1.dx;
- slice->edge2.dy = slice->edge1.dy;
- slice->edge1_top = signdy < 0;
- slice->edge2_top = !slice->edge1_top;
- miGetArcEdge(arc, &slice->edge1, k,
- slice->edge1_top, !slice->edge1_top);
- miGetArcEdge(arc, &slice->edge2, k,
- slice->edge2_top, slice->edge2_top);
- }
- }
-}
-
-#define ADDSPANS() \
- pts->x = xorg - x; \
- pts->y = yorg - y; \
- pts->width = slw; \
- pts++; \
- if (miFillArcLower(slw)) \
- { \
- pts->x = xorg - x; \
- pts->y = yorg + y + dy; \
- pts->width = slw; \
- pts++; \
- }
-
-static void
-miFillEllipseI(GdkDrawable *pDraw, GdkGC *pGC, miArc *arc)
-{
- register int x, y, e;
- int yk, xk, ym, xm, dx, dy, xorg, yorg;
- int slw;
- miFillArcRec info;
- GdkSpan* points;
- register GdkSpan* pts;
-
- points = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * arc->height);
- if (!points)
- return;
- miFillArcSetup(arc, &info);
- MIFILLARCSETUP();
- pts = points;
- while (y > 0)
- {
- MIFILLARCSTEP(slw);
- ADDSPANS();
- }
- gdk_fb_fill_spans(pDraw, pGC, points, pts - points, FALSE);
-
- DEALLOCATE_LOCAL(points);
-}
-
-static void
-miFillEllipseD(GdkDrawable *pDraw, GdkGC *pGC, miArc *arc)
-{
- register int x, y;
- int xorg, yorg, dx, dy, slw;
- double e, yk, xk, ym, xm;
- miFillArcDRec info;
- GdkSpan* points;
- register GdkSpan* pts;
-
- points = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * arc->height);
- if (!points)
- return;
- miFillArcDSetup(arc, &info);
- MIFILLARCSETUP();
- pts = points;
- while (y > 0)
- {
- MIFILLARCSTEP(slw);
- ADDSPANS();
- }
- gdk_fb_fill_spans(pDraw, pGC, points, pts - points, FALSE);
- DEALLOCATE_LOCAL(points);
-}
-
-#define ADDSPAN(l,r) \
- if (r >= l) \
- { \
- pts->x = l; \
- pts->y = ya; \
- pts->width = r - l + 1; \
- pts++; \
- }
-
-#define ADDSLICESPANS(flip) \
- if (!flip) \
- { \
- ADDSPAN(xl, xr); \
- } \
- else \
- { \
- xc = xorg - x; \
- ADDSPAN(xc, xr); \
- xc += slw - 1; \
- ADDSPAN(xl, xc); \
- }
-
-static void
-miFillArcSliceI(GdkDrawable *pDraw, GdkGC *pGC, miArc *arc)
-{
- int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
- register int x, y, e;
- miFillArcRec info;
- miArcSliceRec slice;
- int ya, xl, xr, xc;
- GdkSpan* points;
- register GdkSpan* pts;
-
- miFillArcSetup(arc, &info);
- miFillArcSliceSetup(arc, &slice, pGC);
- MIFILLARCSETUP();
- slw = arc->height;
- if (slice.flip_top || slice.flip_bot)
- slw += (arc->height >> 1) + 1;
- points = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * slw);
- if (!points)
- return;
- pts = points;
- while (y > 0)
- {
- MIFILLARCSTEP(slw);
- MIARCSLICESTEP(slice.edge1);
- MIARCSLICESTEP(slice.edge2);
- if (miFillSliceUpper(slice))
- {
- ya = yorg - y;
- MIARCSLICEUPPER(xl, xr, slice, slw);
- ADDSLICESPANS(slice.flip_top);
- }
- if (miFillSliceLower(slice))
- {
- ya = yorg + y + dy;
- MIARCSLICELOWER(xl, xr, slice, slw);
- ADDSLICESPANS(slice.flip_bot);
- }
- }
-
- gdk_fb_fill_spans(pDraw, pGC, points, pts - points, FALSE);
- DEALLOCATE_LOCAL(points);
-}
-
-static void
-miFillArcSliceD(GdkDrawable *pDraw, GdkGC *pGC, miArc *arc)
-{
- register int x, y;
- int dx, dy, xorg, yorg, slw;
- double e, yk, xk, ym, xm;
- miFillArcDRec info;
- miArcSliceRec slice;
- int ya, xl, xr, xc;
- GdkSpan* points;
- register GdkSpan* pts;
-
- miFillArcDSetup(arc, &info);
- miFillArcSliceSetup(arc, &slice, pGC);
- MIFILLARCSETUP();
- slw = arc->height;
- if (slice.flip_top || slice.flip_bot)
- slw += (arc->height >> 1) + 1;
- points = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * slw);
- if (!points)
- return;
- pts = points;
- while (y > 0)
- {
- MIFILLARCSTEP(slw);
- MIARCSLICESTEP(slice.edge1);
- MIARCSLICESTEP(slice.edge2);
- if (miFillSliceUpper(slice))
- {
- ya = yorg - y;
- MIARCSLICEUPPER(xl, xr, slice, slw);
- ADDSLICESPANS(slice.flip_top);
- }
- if (miFillSliceLower(slice))
- {
- ya = yorg + y + dy;
- MIARCSLICELOWER(xl, xr, slice, slw);
- ADDSLICESPANS(slice.flip_bot);
- }
- }
- gdk_fb_fill_spans(pDraw, pGC, points, pts - points, FALSE);
-
- DEALLOCATE_LOCAL(points);
-}
-
-/* MIPOLYFILLARC -- The public entry for the PolyFillArc request.
- * Since we don't have to worry about overlapping segments, we can just
- * fill each arc as it comes.
- */
-void
-miPolyFillArc(GdkDrawable *pDraw, GdkGC *pGC, int narcs, miArc *parcs)
-{
- register int i;
- register miArc *arc;
-
- for(i = narcs, arc = parcs; --i >= 0; arc++)
- {
- if (miFillArcEmpty(arc))
- continue;;
- if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE))
- {
- if (miCanFillArc(arc))
- miFillEllipseI(pDraw, pGC, arc);
- else
- miFillEllipseD(pDraw, pGC, arc);
- }
- else
- {
- if (miCanFillArc(arc))
- miFillArcSliceI(pDraw, pGC, arc);
- else
- miFillArcSliceD(pDraw, pGC, arc);
- }
- }
-}
diff --git a/gdk/linux-fb/mifillarc.h b/gdk/linux-fb/mifillarc.h
deleted file mode 100644
index f11c53ebb..000000000
--- a/gdk/linux-fb/mifillarc.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/* $XFree86: xc/programs/Xserver/mi/mifillarc.h,v 3.3 1998/10/04 09:39:27 dawes Exp $ */
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-********************************************************/
-
-/* $TOG: mifillarc.h /main/11 1998/02/09 14:46:57 kaleb $ */
-
-#ifndef MIFILLARC_H
-#define MIFILLARC_H 1
-
-#define FULLCIRCLE (360 * 64)
-
-typedef struct _miFillArc {
- int xorg, yorg;
- int y;
- int dx, dy;
- int e;
- int ym, yk, xm, xk;
-} miFillArcRec;
-
-/* could use 64-bit integers */
-typedef struct _miFillArcD {
- int xorg, yorg;
- int y;
- int dx, dy;
- double e;
- double ym, yk, xm, xk;
-} miFillArcDRec;
-
-#define miFillArcEmpty(arc) (!(arc)->angle2 || \
- !(arc)->width || !(arc)->height || \
- (((arc)->width == 1) && ((arc)->height & 1)))
-
-#define miCanFillArc(arc) (((arc)->width == (arc)->height) || \
- (((arc)->width <= 800) && ((arc)->height <= 800)))
-
-#define MIFILLARCSETUP() \
- x = 0; \
- y = info.y; \
- e = info.e; \
- xk = info.xk; \
- xm = info.xm; \
- yk = info.yk; \
- ym = info.ym; \
- dx = info.dx; \
- dy = info.dy; \
- xorg = info.xorg; \
- yorg = info.yorg
-
-#define MIFILLARCSTEP(slw) \
- e += yk; \
- while (e >= 0) \
- { \
- x++; \
- xk -= xm; \
- e += xk; \
- } \
- y--; \
- yk -= ym; \
- slw = (x << 1) + dx; \
- if ((e == xk) && (slw > 1)) \
- slw--
-
-#define MIFILLCIRCSTEP(slw) MIFILLARCSTEP(slw)
-#define MIFILLELLSTEP(slw) MIFILLARCSTEP(slw)
-
-#define miFillArcLower(slw) (((y + dy) != 0) && ((slw > 1) || (e != xk)))
-
-typedef struct _miSliceEdge {
- int x;
- int stepx;
- int deltax;
- int e;
- int dy;
- int dx;
-} miSliceEdgeRec, *miSliceEdgePtr;
-
-typedef struct _miArcSlice {
- miSliceEdgeRec edge1, edge2;
- int min_top_y, max_top_y;
- int min_bot_y, max_bot_y;
- gboolean edge1_top, edge2_top;
- gboolean flip_top, flip_bot;
-} miArcSliceRec;
-
-#define MIARCSLICESTEP(edge) \
- edge.x -= edge.stepx; \
- edge.e -= edge.dx; \
- if (edge.e <= 0) \
- { \
- edge.x -= edge.deltax; \
- edge.e += edge.dy; \
- }
-
-#define miFillSliceUpper(slice) \
- ((y >= slice.min_top_y) && (y <= slice.max_top_y))
-
-#define miFillSliceLower(slice) \
- ((y >= slice.min_bot_y) && (y <= slice.max_bot_y))
-
-#define MIARCSLICEUPPER(xl,xr,slice,slw) \
- xl = xorg - x; \
- xr = xl + slw - 1; \
- if (slice.edge1_top && (slice.edge1.x < xr)) \
- xr = slice.edge1.x; \
- if (slice.edge2_top && (slice.edge2.x > xl)) \
- xl = slice.edge2.x;
-
-#define MIARCSLICELOWER(xl,xr,slice,slw) \
- xl = xorg - x; \
- xr = xl + slw - 1; \
- if (!slice.edge1_top && (slice.edge1.x > xl)) \
- xl = slice.edge1.x; \
- if (!slice.edge2_top && (slice.edge2.x < xr)) \
- xr = slice.edge2.x;
-
-#define MIWIDEARCSETUP(x,y,dy,slw,e,xk,xm,yk,ym) \
- x = 0; \
- y = slw >> 1; \
- yk = y << 3; \
- xm = 8; \
- ym = 8; \
- if (dy) \
- { \
- xk = 0; \
- if (slw & 1) \
- e = -1; \
- else \
- e = -(y << 2) - 2; \
- } \
- else \
- { \
- y++; \
- yk += 4; \
- xk = -4; \
- if (slw & 1) \
- e = -(y << 2) - 3; \
- else \
- e = - (y << 3); \
- }
-
-#define MIFILLINARCSTEP(slw) \
- ine += inyk; \
- while (ine >= 0) \
- { \
- inx++; \
- inxk -= inxm; \
- ine += inxk; \
- } \
- iny--; \
- inyk -= inym; \
- slw = (inx << 1) + dx; \
- if ((ine == inxk) && (slw > 1)) \
- slw--
-
-#define miFillInArcLower(slw) (((iny + dy) != 0) && \
- ((slw > 1) || (ine != inxk)))
-
-extern int miFreeArcCache(gpointer data, guint id);
-
-extern struct finalSpan *realAllocSpan(void);
-
-extern void miFillArcSetup(miArc *arc, miFillArcRec *info);
-
-extern void miFillArcDSetup(miArc *arc, miFillArcDRec *info);
-
-extern void miEllipseAngleToSlope(int angle, int width, int height, int *dxp,
- int *dyp, double *d_dxp, double *d_dyp);
-
-extern void miFillArcSliceSetup(miArc *arc, miArcSliceRec *slice, GdkGC* pGC);
-
-#endif
-
diff --git a/gdk/linux-fb/mifpoly.h b/gdk/linux-fb/mifpoly.h
deleted file mode 100644
index a405fd6a8..000000000
--- a/gdk/linux-fb/mifpoly.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* $TOG: mifpoly.h /main/10 1998/02/09 14:47:09 kaleb $ */
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifndef MIFPOLY_H
-#define MIFPOLY_H 1
-
-#define EPSILON 0.000001
-#define ISEQUAL(a,b) (fabs((a) - (b)) <= EPSILON)
-#define UNEQUAL(a,b) (fabs((a) - (b)) > EPSILON)
-#define WITHINHALF(a, b) (((a) - (b) > 0.0) ? (a) - (b) < 0.5 : \
- (b) - (a) <= 0.5)
-#define ROUNDTOINT(x) ((int) (((x) > 0.0) ? ((x) + 0.5) : ((x) - 0.5)))
-#define ISZERO(x) (fabs((x)) <= EPSILON)
-#define PTISEQUAL(a,b) (ISEQUAL(a.x,b.x) && ISEQUAL(a.y,b.y))
-#define PTUNEQUAL(a,b) (UNEQUAL(a.x,b.x) || UNEQUAL(a.y,b.y))
-#define PtEqual(a, b) (((a).x == (b).x) && ((a).y == (b).y))
-
-#define NotEnd 0
-#define FirstEnd 1
-#define SecondEnd 2
-
-#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - for 11o miter cutoff */
-#define D2SECANT 5.21671526231167 /* 1/2*sin(11/2) - max extension per width */
-
-#ifndef ICIEL
-#ifdef NOINLINEICEIL
-#define ICEIL(x) ((int)ceil(x))
-#else
-#ifdef __GNUC__
-#define ICEIL ICIEL
-static __inline int ICEIL(double x)
-{
- int _cTmp = x;
- return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1;
-}
-#else
-#define ICEIL(x) ((((x) == (_cTmp = (x))) || ((x) < 0.0)) ? _cTmp : _cTmp+1)
-#define ICEILTEMPDECL static int _cTmp;
-#endif
-#endif
-#endif
-
-/* Point with sub-pixel positioning. In this case we use doubles, but
- * see mifpolycon.c for other suggestions
- */
-typedef struct _SppPoint {
- double x, y;
-} SppPointRec, *SppPointPtr;
-
-typedef struct _SppArc {
- double x, y, width, height;
- double angle1, angle2;
-} SppArcRec, *SppArcPtr;
-
-/* mifpolycon.c */
-
-extern void miFillSppPoly(
- GdkDrawable* dst,
- GdkGC* pgc,
- int count,
- SppPointPtr ptsIn,
- int xTrans,
- int yTrans,
- double xFtrans,
- double yFtrans
-);
-
-#endif /* MIFPOLY_H */
diff --git a/gdk/linux-fb/mifpolycon.c b/gdk/linux-fb/mifpolycon.c
deleted file mode 100644
index 70e4dcdd7..000000000
--- a/gdk/linux-fb/mifpolycon.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* $TOG: mifpolycon.c /main/13 1998/02/09 14:47:05 kaleb $ */
-#include <config.h>
-#include <math.h>
-#include "mi.h"
-#include "mifpoly.h"
-
-static int
-GetFPolyYBounds(register SppPointPtr pts, int n, double yFtrans, int *by, int *ty);
-
-#ifdef ICEILTEMPDECL
-ICEILTEMPDECL
-#endif
-
-/*
- * Written by Todd Newman; April. 1987.
- *
- * Fill a convex polygon. If the given polygon
- * is not convex, then the result is undefined.
- * The algorithm is to order the edges from smallest
- * y to largest by partitioning the array into a left
- * edge list and a right edge list. The algorithm used
- * to traverse each edge is digital differencing analyzer
- * line algorithm with y as the major axis. There's some funny linear
- * interpolation involved because of the subpixel postioning.
- */
-void
-miFillSppPoly(GdkDrawable *dst, GdkGC *pgc, int count, SppPointPtr ptsIn, int xTrans, int yTrans, double xFtrans, double yFtrans)
-#if 0
- GdkDrawable* dst;
- GdkGC* pgc;
- int count; /* number of points */
- SppPointPtr ptsIn; /* the points */
- int xTrans, yTrans; /* Translate each point by this */
- double xFtrans, yFtrans; /* translate before conversion
- by this amount. This provides
- a mechanism to match rounding
- errors with any shape that must
- meet the polygon exactly.
- */
-#endif
-{
- double xl = 0.0, xr = 0.0, /* x vals of left and right edges */
- ml = 0.0, /* left edge slope */
- mr = 0.0, /* right edge slope */
- dy, /* delta y */
- i; /* loop counter */
- int y, /* current scanline */
- j,
- imin, /* index of vertex with smallest y */
- ymin, /* y-extents of polygon */
- ymax,
- *Marked; /* set if this vertex has been used */
- register int left, right, /* indices to first endpoints */
- nextleft,
- nextright; /* indices to second endpoints */
- GdkSpan* ptsOut,
- *FirstPoint; /* output buffer */
-
- imin = GetFPolyYBounds(ptsIn, count, yFtrans, &ymin, &ymax);
-
- y = ymax - ymin + 1;
- if ((count < 3) || (y <= 0))
- return;
- ptsOut = FirstPoint = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * y);
- Marked = (int *) ALLOCATE_LOCAL(sizeof(int) * count);
-
- if(!ptsOut || !Marked)
- {
- if (Marked) DEALLOCATE_LOCAL(Marked);
- if (ptsOut) DEALLOCATE_LOCAL(ptsOut);
- return;
- }
-
- for(j = 0; j < count; j++)
- Marked[j] = 0;
- nextleft = nextright = imin;
- Marked[imin] = -1;
- y = ICEIL(ptsIn[nextleft].y + yFtrans);
-
- /*
- * loop through all edges of the polygon
- */
- do
- {
- /* add a left edge if we need to */
- if ((y > (ptsIn[nextleft].y + yFtrans) ||
- ISEQUAL(y, ptsIn[nextleft].y + yFtrans)) &&
- Marked[nextleft] != 1)
- {
- Marked[nextleft]++;
- left = nextleft++;
-
- /* find the next edge, considering the end conditions */
- if (nextleft >= count)
- nextleft = 0;
-
- /* now compute the starting point and slope */
- dy = ptsIn[nextleft].y - ptsIn[left].y;
- if (dy != 0.0)
- {
- ml = (ptsIn[nextleft].x - ptsIn[left].x) / dy;
- dy = y - (ptsIn[left].y + yFtrans);
- xl = (ptsIn[left].x + xFtrans) + ml * MAX(dy, 0);
- }
- }
-
- /* add a right edge if we need to */
- if ((y > ptsIn[nextright].y + yFtrans) ||
- (ISEQUAL(y, ptsIn[nextright].y + yFtrans)
- && Marked[nextright] != 1))
- {
- Marked[nextright]++;
- right = nextright--;
-
- /* find the next edge, considering the end conditions */
- if (nextright < 0)
- nextright = count - 1;
-
- /* now compute the starting point and slope */
- dy = ptsIn[nextright].y - ptsIn[right].y;
- if (dy != 0.0)
- {
- mr = (ptsIn[nextright].x - ptsIn[right].x) / dy;
- dy = y - (ptsIn[right].y + yFtrans);
- xr = (ptsIn[right].x + xFtrans) + mr * MAX(dy, 0);
- }
- }
-
-
- /*
- * generate scans to fill while we still have
- * a right edge as well as a left edge.
- */
- i = (MIN(ptsIn[nextleft].y, ptsIn[nextright].y) + yFtrans) - y;
-
- if (i < EPSILON)
- {
- if(Marked[nextleft] && Marked[nextright])
- {
- /* Arrgh, we're trapped! (no more points)
- * Out, we've got to get out of here before this decadence saps
- * our will completely! */
- break;
- }
- continue;
- }
- else
- {
- j = (int) i;
- if(!j)
- j++;
- }
- while (j > 0)
- {
- int cxl, cxr;
-
- ptsOut->y = (y) + yTrans;
-
- cxl = ICEIL(xl);
- cxr = ICEIL(xr);
- /* reverse the edges if necessary */
- if (xl < xr)
- {
- ptsOut->width = cxr - cxl;
- (ptsOut++)->x = cxl + xTrans;
- }
- else
- {
- ptsOut->width = cxl - cxr;
- (ptsOut++)->x = cxr + xTrans;
- }
- y++;
-
- /* increment down the edges */
- xl += ml;
- xr += mr;
- j--;
- }
- } while (y <= ymax);
-
- /* Finally, fill the spans we've collected */
- gdk_fb_fill_spans(dst, pgc, FirstPoint, ptsOut-FirstPoint, TRUE);
- DEALLOCATE_LOCAL(Marked);
- DEALLOCATE_LOCAL(FirstPoint);
-}
-
-
-/* Find the index of the point with the smallest y.also return the
- * smallest and largest y */
-static int
-GetFPolyYBounds(register SppPointPtr pts, int n, double yFtrans, int *by, int *ty)
-{
- register SppPointPtr ptMin;
- double ymin, ymax;
- SppPointPtr ptsStart = pts;
-
- ptMin = pts;
- ymin = ymax = (pts++)->y;
-
- while (--n > 0) {
- if (pts->y < ymin)
- {
- ptMin = pts;
- ymin = pts->y;
- }
- if(pts->y > ymax)
- ymax = pts->y;
-
- pts++;
- }
-
- *by = ICEIL(ymin + yFtrans);
- *ty = ICEIL(ymax + yFtrans - 1);
- return(ptMin-ptsStart);
-}
diff --git a/gdk/linux-fb/miline.h b/gdk/linux-fb/miline.h
deleted file mode 100644
index 4ac4695cd..000000000
--- a/gdk/linux-fb/miline.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/* $TOG: miline.h /main/7 1998/02/09 14:47:30 kaleb $ */
-
-/*
-
-Copyright 1994, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/* $XFree86: xc/programs/Xserver/mi/miline.h,v 1.4 1999/10/13 22:33:11 dawes Exp $ */
-
-#ifndef MILINE_H
-
-/*
- * Public definitions used for configuring basic pixelization aspects
- * of the sample implementation line-drawing routines provided in
- * {mfb,mi,cfb*} at run-time.
- */
-
-#define XDECREASING 4
-#define YDECREASING 2
-#define YMAJOR 1
-
-#define OCTANT1 (1 << (YDECREASING))
-#define OCTANT2 (1 << (YDECREASING|YMAJOR))
-#define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR))
-#define OCTANT4 (1 << (XDECREASING|YDECREASING))
-#define OCTANT5 (1 << (XDECREASING))
-#define OCTANT6 (1 << (XDECREASING|YMAJOR))
-#define OCTANT7 (1 << (YMAJOR))
-#define OCTANT8 (1 << (0))
-
-#define XMAJOROCTANTS (OCTANT1 | OCTANT4 | OCTANT5 | OCTANT8)
-
-#define DEFAULTZEROLINEBIAS (OCTANT2 | OCTANT3 | OCTANT4 | OCTANT5)
-
-/*
- * Devices can configure the rendering of routines in mi, mfb, and cfb*
- * by specifying a thin line bias to be applied to a particular screen
- * using the following function. The bias parameter is an OR'ing of
- * the appropriate OCTANT constants defined above to indicate which
- * octants to bias a line to prefer an axial step when the Bresenham
- * error term is exactly zero. The octants are mapped as follows:
- *
- * \ | /
- * \ 3 | 2 /
- * \ | /
- * 4 \ | / 1
- * \|/
- * -----------
- * /|\
- * 5 / | \ 8
- * / | \
- * / 6 | 7 \
- * / | \
- *
- * For more information, see "Ambiguities in Incremental Line Rastering,"
- * Jack E. Bresenham, IEEE CG&A, May 1987.
- */
-
-#if 0
-extern void miSetZeroLineBias(
-#if NeedFunctionPrototypes
- ScreenPtr /* pScreen */,
- unsigned int /* bias */
-#endif
-);
-#endif
-
-/*
- * Private definitions needed for drawing thin (zero width) lines
- * Used by the mi, mfb, and all cfb* components.
- */
-
-#define X_AXIS 0
-#define Y_AXIS 1
-
-#define OUT_LEFT 0x08
-#define OUT_RIGHT 0x04
-#define OUT_ABOVE 0x02
-#define OUT_BELOW 0x01
-
-#define OUTCODES(_result, _x, _y, _pbox) \
- if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \
- else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \
- if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \
- else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW;
-
-#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \
-{\
- if (x < xmin) outcode |= OUT_LEFT;\
- if (x > xmax) outcode |= OUT_RIGHT;\
- if (y < ymin) outcode |= OUT_ABOVE;\
- if (y > ymax) outcode |= OUT_BELOW;\
-}
-
-#define SWAPINT(i, j) \
-{ register int _t = i; i = j; j = _t; }
-
-#define SWAPPT(i, j) \
-{ GdkPoint _t; _t = i; i = j; j = _t; }
-
-#define SWAPINT_PAIR(x1, y1, x2, y2)\
-{ int t = x1; x1 = x2; x2 = t;\
- t = y1; y1 = y2; y2 = t;\
-}
-
-#if 0
-#define miGetZeroLineBias(_pScreen) \
- ((miZeroLineScreenIndex < 0) ? \
- 0 : ((_pScreen)->devPrivates[miZeroLineScreenIndex].uval))
-#endif
-#define miGetZeroLineBias() DEFAULTZEROLINEBIAS
-
-#define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \
- (_octant) = 0; \
- (_sx) = (_SX); \
- if (((_adx) = (_x2) - (_x1)) < 0) { \
- (_adx) = -(_adx); \
- (_sx = -(_sx)); \
- (_octant) |= XDECREASING; \
- } \
- (_sy) = (_SY); \
- if (((_ady) = (_y2) - (_y1)) < 0) { \
- (_ady) = -(_ady); \
- (_sy = -(_sy)); \
- (_octant) |= YDECREASING; \
- }
-
-#define SetYMajorOctant(_octant) ((_octant) |= YMAJOR)
-
-#define FIXUP_ERROR(_e, _octant, _bias) \
- (_e) -= (((_bias) >> (_octant)) & 1)
-
-#define IsXMajorOctant(_octant) (!((_octant) & YMAJOR))
-#define IsYMajorOctant(_octant) ((_octant) & YMAJOR)
-#define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING)
-#define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING)
-
-extern int miZeroLineScreenIndex;
-
-extern int miZeroClipLine(
- int xmin,
- int ymin,
- int xmax,
- int ymax,
- int * new_x1,
- int * new_y1,
- int * new_x2,
- int * new_y2,
- unsigned int adx,
- unsigned int ady,
- int * pt1_clipped,
- int * pt2_clipped,
- int octant,
- unsigned int bias,
- int oc1,
- int oc2
-);
-
-#endif /* MILINE_H */
diff --git a/gdk/linux-fb/mipoly.c b/gdk/linux-fb/mipoly.c
deleted file mode 100644
index fdb4b5eef..000000000
--- a/gdk/linux-fb/mipoly.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* $TOG: mipoly.c /main/5 1998/02/09 14:48:16 kaleb $ */
-/*
- * mipoly.c
- *
- * Written by Brian Kelleher; June 1986
- *
- * Draw polygons. This routine translates the point by the
- * origin if pGC->miTranslate is non-zero, and calls
- * to the appropriate routine to actually scan convert the
- * polygon.
- */
-#include <config.h>
-#include "mi.h"
-
-extern gboolean miFillGeneralPoly(GdkDrawable* dst, GdkGC* pgc,
- int count, GdkPoint* ptsIn);
-
-void
-miFillPolygon(GdkDrawable *dst, register GdkGC *pgc, int shape,
- int mode, register int count, GdkPoint *pPts)
-{
- if (count == 0)
- return;
-
- miFillGeneralPoly(dst, pgc, count, pPts);
-}
diff --git a/gdk/linux-fb/mipoly.h b/gdk/linux-fb/mipoly.h
deleted file mode 100644
index 545aa00e2..000000000
--- a/gdk/linux-fb/mipoly.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/* $TOG: mipoly.h /main/6 1998/02/09 14:48:20 kaleb $ */
-/*
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-#ifndef MIPOLY_H
-#define MIPOLY_H
-
-#include "miscanfill.h"
-
-/*
- * fill.h
- *
- * Created by Brian Kelleher; Oct 1985
- *
- * Include file for filled polygon routines.
- *
- * These are the data structures needed to scan
- * convert regions. Two different scan conversion
- * methods are available -- the even-odd method, and
- * the winding number method.
- * The even-odd rule states that a point is inside
- * the polygon if a ray drawn from that point in any
- * direction will pass through an odd number of
- * path segments.
- * By the winding number rule, a point is decided
- * to be inside the polygon if a ray drawn from that
- * point in any direction passes through a different
- * number of clockwise and counter-clockwise path
- * segments.
- *
- * These data structures are adapted somewhat from
- * the algorithm in (Foley/Van Dam) for scan converting
- * polygons.
- * The basic algorithm is to start at the top (smallest y)
- * of the polygon, stepping down to the bottom of
- * the polygon by incrementing the y coordinate. We
- * keep a list of edges which the current scanline crosses,
- * sorted by x. This list is called the Active Edge Table (AET)
- * As we change the y-coordinate, we update each entry in
- * in the active edge table to reflect the edges new xcoord.
- * This list must be sorted at each scanline in case
- * two edges intersect.
- * We also keep a data structure known as the Edge Table (ET),
- * which keeps track of all the edges which the current
- * scanline has not yet reached. The ET is basically a
- * list of ScanLineList structures containing a list of
- * edges which are entered at a given scanline. There is one
- * ScanLineList per scanline at which an edge is entered.
- * When we enter a new edge, we move it from the ET to the AET.
- *
- * From the AET, we can implement the even-odd rule as in
- * (Foley/Van Dam).
- * The winding number rule is a little trickier. We also
- * keep the EdgeTableEntries in the AET linked by the
- * nextWETE (winding EdgeTableEntry) link. This allows
- * the edges to be linked just as before for updating
- * purposes, but only uses the edges linked by the nextWETE
- * link as edges representing spans of the polygon to
- * drawn (as with the even-odd rule).
- */
-
-/*
- * for the winding number rule
- */
-#define CLOCKWISE 1
-#define COUNTERCLOCKWISE -1
-
-typedef struct _EdgeTableEntry {
- int ymax; /* ycoord at which we exit this edge. */
- BRESINFO bres; /* Bresenham info to run the edge */
- struct _EdgeTableEntry *next; /* next in the list */
- struct _EdgeTableEntry *back; /* for insertion sort */
- struct _EdgeTableEntry *nextWETE; /* for winding num rule */
- int ClockWise; /* flag for winding number rule */
-} EdgeTableEntry;
-
-
-typedef struct _ScanLineList{
- int scanline; /* the scanline represented */
- EdgeTableEntry *edgelist; /* header node */
- struct _ScanLineList *next; /* next in the list */
-} ScanLineList;
-
-
-typedef struct {
- int ymax; /* ymax for the polygon */
- int ymin; /* ymin for the polygon */
- ScanLineList scanlines; /* header node */
-} EdgeTable;
-
-
-/*
- * Here is a struct to help with storage allocation
- * so we can allocate a big chunk at a time, and then take
- * pieces from this heap when we need to.
- */
-#define SLLSPERBLOCK 25
-
-typedef struct _ScanLineListBlock {
- ScanLineList SLLs[SLLSPERBLOCK];
- struct _ScanLineListBlock *next;
-} ScanLineListBlock;
-
-/*
- * number of points to buffer before sending them off
- * to scanlines() : Must be an even number
- */
-#define NUMPTSTOBUFFER 200
-
-
-/*
- *
- * a few macros for the inner loops of the fill code where
- * performance considerations don't allow a procedure call.
- *
- * Evaluate the given edge at the given scanline.
- * If the edge has expired, then we leave it and fix up
- * the active edge table; otherwise, we increment the
- * x value to be ready for the next scanline.
- * The winding number rule is in effect, so we must notify
- * the caller when the edge has been removed so he
- * can reorder the Winding Active Edge Table.
- */
-#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \
- if (pAET->ymax == y) { /* leaving this edge */ \
- pPrevAET->next = pAET->next; \
- pAET = pPrevAET->next; \
- fixWAET = 1; \
- if (pAET) \
- pAET->back = pPrevAET; \
- } \
- else { \
- BRESINCRPGONSTRUCT(pAET->bres); \
- pPrevAET = pAET; \
- pAET = pAET->next; \
- } \
-}
-
-
-/*
- * Evaluate the given edge at the given scanline.
- * If the edge has expired, then we leave it and fix up
- * the active edge table; otherwise, we increment the
- * x value to be ready for the next scanline.
- * The even-odd rule is in effect.
- */
-#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \
- if (pAET->ymax == y) { /* leaving this edge */ \
- pPrevAET->next = pAET->next; \
- pAET = pPrevAET->next; \
- if (pAET) \
- pAET->back = pPrevAET; \
- } \
- else { \
- BRESINCRPGONSTRUCT(pAET->bres); \
- pPrevAET = pAET; \
- pAET = pAET->next; \
- } \
-}
-
-/* mipolyutil.c */
-
-extern gboolean miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline,
- ScanLineListBlock **SLLBlock, int *iSLLBlock);
-
-extern gboolean miCreateETandAET(int count, GdkPoint* pts, EdgeTable *ET,
- EdgeTableEntry *AET, EdgeTableEntry *pETEs,
- ScanLineListBlock *pSLLBlock);
-
-extern void miloadAET(EdgeTableEntry *AET, EdgeTableEntry *ETEs);
-
-extern void micomputeWAET(EdgeTableEntry *AET);
-
-extern int miInsertionSort(EdgeTableEntry *AET);
-
-extern void miFreeStorage(ScanLineListBlock *pSLLBlock);
-
-#endif
diff --git a/gdk/linux-fb/mipolygen.c b/gdk/linux-fb/mipolygen.c
deleted file mode 100644
index bb7a4bbd6..000000000
--- a/gdk/linux-fb/mipolygen.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* $TOG: mipolygen.c /main/9 1998/02/09 14:47:51 kaleb $ */
-#include <config.h>
-#include "mi.h"
-#include "mipoly.h"
-
-/*
- *
- * Written by Brian Kelleher; Oct. 1985
- *
- * Routine to fill a polygon. Two fill rules are
- * supported: frWINDING and frEVENODD.
- *
- * See fillpoly.h for a complete description of the algorithm.
- */
-
-gboolean
-miFillGeneralPoly(GdkDrawable *dst, GdkGC *pgc, int count, GdkPoint *ptsIn)
-{
- register EdgeTableEntry *pAET; /* the Active Edge Table */
- register int y; /* the current scanline */
- register int nPts = 0; /* number of pts in buffer */
- register EdgeTableEntry *pWETE; /* Winding Edge Table */
- register ScanLineList *pSLL; /* Current ScanLineList */
- register GdkSpan* ptsOut; /* ptr to output buffers */
- GdkSpan FirstPoint[NUMPTSTOBUFFER]; /* the output buffers */
- EdgeTableEntry *pPrevAET; /* previous AET entry */
- EdgeTable ET; /* Edge Table header node */
- EdgeTableEntry AET; /* Active ET header node */
- EdgeTableEntry *pETEs; /* Edge Table Entries buff */
- ScanLineListBlock SLLBlock; /* header for ScanLineList */
- int fixWAET = 0;
-
- if (count < 3)
- return(TRUE);
-
- if(!(pETEs = (EdgeTableEntry *)
- ALLOCATE_LOCAL(sizeof(EdgeTableEntry) * count)))
- return(FALSE);
- ptsOut = FirstPoint;
- if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock))
- {
- DEALLOCATE_LOCAL(pETEs);
- return(FALSE);
- }
- pSLL = ET.scanlines.next;
-
- if (0 /* pgc->fillRule == EvenOddRule */)
- {
- /*
- * for each scanline
- */
- for (y = ET.ymin; y < ET.ymax; y++)
- {
- /*
- * Add a new edge to the active edge table when we
- * get to the next edge.
- */
- if (pSLL && y == pSLL->scanline)
- {
- miloadAET(&AET, pSLL->edgelist);
- pSLL = pSLL->next;
- }
- pPrevAET = &AET;
- pAET = AET.next;
-
- /*
- * for each active edge
- */
- while (pAET)
- {
- ptsOut->x = pAET->bres.minor;
- ptsOut->width = pAET->next->bres.minor - pAET->bres.minor;
- ptsOut++->y = y;
- nPts++;
-
- /*
- * send out the buffer when its full
- */
- if (nPts == NUMPTSTOBUFFER)
- {
- gdk_fb_fill_spans(dst, pgc, FirstPoint, nPts, TRUE);
- ptsOut = FirstPoint;
- nPts = 0;
- }
- EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
- EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
- }
- miInsertionSort(&AET);
- }
- }
- else /* default to WindingNumber */
- {
- /*
- * for each scanline
- */
- for (y = ET.ymin; y < ET.ymax; y++)
- {
- /*
- * Add a new edge to the active edge table when we
- * get to the next edge.
- */
- if (pSLL && y == pSLL->scanline)
- {
- miloadAET(&AET, pSLL->edgelist);
- micomputeWAET(&AET);
- pSLL = pSLL->next;
- }
- pPrevAET = &AET;
- pAET = AET.next;
- pWETE = pAET;
-
- /*
- * for each active edge
- */
- while (pAET)
- {
- /*
- * if the next edge in the active edge table is
- * also the next edge in the winding active edge
- * table.
- */
- if (pWETE == pAET)
- {
- ptsOut->x = pAET->bres.minor;
- ptsOut->width = pAET->nextWETE->bres.minor - pAET->bres.minor;
- ptsOut++->y = y;
- nPts++;
-
- /*
- * send out the buffer
- */
- if (nPts == NUMPTSTOBUFFER)
- {
- gdk_fb_fill_spans(dst, pgc, FirstPoint, nPts, TRUE);
- ptsOut = FirstPoint;
- nPts = 0;
- }
-
- pWETE = pWETE->nextWETE;
- while (pWETE != pAET)
- EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
- pWETE = pWETE->nextWETE;
- }
- EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
- }
-
- /*
- * reevaluate the Winding active edge table if we
- * just had to resort it or if we just exited an edge.
- */
- if (miInsertionSort(&AET) || fixWAET)
- {
- micomputeWAET(&AET);
- fixWAET = 0;
- }
- }
- }
-
- /*
- * Get any spans that we missed by buffering
- */
- if(nPts > 0)
- gdk_fb_fill_spans(dst, pgc, FirstPoint, nPts, TRUE);
- DEALLOCATE_LOCAL(pETEs);
- miFreeStorage(SLLBlock.next);
- return(TRUE);
-}
diff --git a/gdk/linux-fb/mipolyutil.c b/gdk/linux-fb/mipolyutil.c
deleted file mode 100644
index 7f0a187da..000000000
--- a/gdk/linux-fb/mipolyutil.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/* $XFree86: xc/programs/Xserver/mi/mipolyutil.c,v 1.7 1998/10/04 09:39:31 dawes Exp $ */
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* $TOG: mipolyutil.c /main/6 1998/02/09 14:48:12 kaleb $ */
-#include <config.h>
-#include <limits.h>
-#include "mi.h"
-#include "miscanfill.h"
-#include "mipoly.h"
-
-/*
- * fillUtils.c
- *
- * Written by Brian Kelleher; Oct. 1985
- *
- * This module contains all of the utility functions
- * needed to scan convert a polygon.
- *
- */
-
-/*
- * InsertEdgeInET
- *
- * Insert the given edge into the edge table.
- * First we must find the correct bucket in the
- * Edge table, then find the right slot in the
- * bucket. Finally, we can insert it.
- *
- */
-gboolean
-miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline,
- ScanLineListBlock **SLLBlock, int *iSLLBlock)
-{
- register EdgeTableEntry *start, *prev;
- register ScanLineList *pSLL, *pPrevSLL;
- ScanLineListBlock *tmpSLLBlock;
-
- /*
- * find the right bucket to put the edge into
- */
- pPrevSLL = &ET->scanlines;
- pSLL = pPrevSLL->next;
- while (pSLL && (pSLL->scanline < scanline))
- {
- pPrevSLL = pSLL;
- pSLL = pSLL->next;
- }
-
- /*
- * reassign pSLL (pointer to ScanLineList) if necessary
- */
- if ((!pSLL) || (pSLL->scanline > scanline))
- {
- if (*iSLLBlock > SLLSPERBLOCK-1)
- {
- tmpSLLBlock =
- (ScanLineListBlock *)g_malloc(sizeof(ScanLineListBlock));
- if (!tmpSLLBlock)
- return FALSE;
- (*SLLBlock)->next = tmpSLLBlock;
- tmpSLLBlock->next = (ScanLineListBlock *)NULL;
- *SLLBlock = tmpSLLBlock;
- *iSLLBlock = 0;
- }
- pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]);
-
- pSLL->next = pPrevSLL->next;
- pSLL->edgelist = (EdgeTableEntry *)NULL;
- pPrevSLL->next = pSLL;
- }
- pSLL->scanline = scanline;
-
- /*
- * now insert the edge in the right bucket
- */
- prev = (EdgeTableEntry *)NULL;
- start = pSLL->edgelist;
- while (start && (start->bres.minor < ETE->bres.minor))
- {
- prev = start;
- start = start->next;
- }
- ETE->next = start;
-
- if (prev)
- prev->next = ETE;
- else
- pSLL->edgelist = ETE;
- return TRUE;
-}
-
-/*
- * CreateEdgeTable
- *
- * This routine creates the edge table for
- * scan converting polygons.
- * The Edge Table (ET) looks like:
- *
- * EdgeTable
- * --------
- * | ymax | ScanLineLists
- * |scanline|-->------------>-------------->...
- * -------- |scanline| |scanline|
- * |edgelist| |edgelist|
- * --------- ---------
- * | |
- * | |
- * V V
- * list of ETEs list of ETEs
- *
- * where ETE is an EdgeTableEntry data structure,
- * and there is one ScanLineList per scanline at
- * which an edge is initially entered.
- *
- */
-
-gboolean
-miCreateETandAET(register int count, register GdkPoint *pts, EdgeTable *ET,
- EdgeTableEntry *AET, register EdgeTableEntry *pETEs,
- ScanLineListBlock *pSLLBlock)
-{
- register GdkPoint* top, *bottom;
- register GdkPoint* PrevPt, *CurrPt;
- int iSLLBlock = 0;
-
- int dy;
-
- if (count < 2) return TRUE;
-
- /*
- * initialize the Active Edge Table
- */
- AET->next = (EdgeTableEntry *)NULL;
- AET->back = (EdgeTableEntry *)NULL;
- AET->nextWETE = (EdgeTableEntry *)NULL;
- AET->bres.minor = INT_MIN;
-
- /*
- * initialize the Edge Table.
- */
- ET->scanlines.next = (ScanLineList *)NULL;
- ET->ymax = INT_MIN;
- ET->ymin = INT_MAX;
- pSLLBlock->next = (ScanLineListBlock *)NULL;
-
- PrevPt = &pts[count-1];
-
- /*
- * for each vertex in the array of points.
- * In this loop we are dealing with two vertices at
- * a time -- these make up one edge of the polygon.
- */
- while (count--)
- {
- CurrPt = pts++;
-
- /*
- * find out which point is above and which is below.
- */
- if (PrevPt->y > CurrPt->y)
- {
- bottom = PrevPt, top = CurrPt;
- pETEs->ClockWise = 0;
- }
- else
- {
- bottom = CurrPt, top = PrevPt;
- pETEs->ClockWise = 1;
- }
-
- /*
- * don't add horizontal edges to the Edge table.
- */
- if (bottom->y != top->y)
- {
- pETEs->ymax = bottom->y-1; /* -1 so we don't get last scanline */
-
- /*
- * initialize integer edge algorithm
- */
- dy = bottom->y - top->y;
- BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres);
-
- if (!miInsertEdgeInET(ET, pETEs, top->y, &pSLLBlock, &iSLLBlock))
- {
- miFreeStorage(pSLLBlock->next);
- return FALSE;
- }
-
- ET->ymax = MAX(ET->ymax, PrevPt->y);
- ET->ymin = MIN(ET->ymin, PrevPt->y);
- pETEs++;
- }
-
- PrevPt = CurrPt;
- }
- return TRUE;
-}
-
-/*
- * loadAET
- *
- * This routine moves EdgeTableEntries from the
- * EdgeTable into the Active Edge Table,
- * leaving them sorted by smaller x coordinate.
- *
- */
-
-void
-miloadAET(register EdgeTableEntry *AET, register EdgeTableEntry *ETEs)
-{
- register EdgeTableEntry *pPrevAET;
- register EdgeTableEntry *tmp;
-
- pPrevAET = AET;
- AET = AET->next;
- while (ETEs)
- {
- while (AET && (AET->bres.minor < ETEs->bres.minor))
- {
- pPrevAET = AET;
- AET = AET->next;
- }
- tmp = ETEs->next;
- ETEs->next = AET;
- if (AET)
- AET->back = ETEs;
- ETEs->back = pPrevAET;
- pPrevAET->next = ETEs;
- pPrevAET = ETEs;
-
- ETEs = tmp;
- }
-}
-
-/*
- * computeWAET
- *
- * This routine links the AET by the
- * nextWETE (winding EdgeTableEntry) link for
- * use by the winding number rule. The final
- * Active Edge Table (AET) might look something
- * like:
- *
- * AET
- * ---------- --------- ---------
- * |ymax | |ymax | |ymax |
- * | ... | |... | |... |
- * |next |->|next |->|next |->...
- * |nextWETE| |nextWETE| |nextWETE|
- * --------- --------- ^--------
- * | | |
- * V-------------------> V---> ...
- *
- */
-void
-micomputeWAET(register EdgeTableEntry *AET)
-{
- register EdgeTableEntry *pWETE;
- register int inside = 1;
- register int isInside = 0;
-
- AET->nextWETE = (EdgeTableEntry *)NULL;
- pWETE = AET;
- AET = AET->next;
- while (AET)
- {
- if (AET->ClockWise)
- isInside++;
- else
- isInside--;
-
- if ((!inside && !isInside) ||
- ( inside && isInside))
- {
- pWETE->nextWETE = AET;
- pWETE = AET;
- inside = !inside;
- }
- AET = AET->next;
- }
- pWETE->nextWETE = (EdgeTableEntry *)NULL;
-}
-
-/*
- * InsertionSort
- *
- * Just a simple insertion sort using
- * pointers and back pointers to sort the Active
- * Edge Table.
- *
- */
-
-int
-miInsertionSort(register EdgeTableEntry *AET)
-{
- register EdgeTableEntry *pETEchase;
- register EdgeTableEntry *pETEinsert;
- register EdgeTableEntry *pETEchaseBackTMP;
- register int changed = 0;
-
- AET = AET->next;
- while (AET)
- {
- pETEinsert = AET;
- pETEchase = AET;
- while (pETEchase->back->bres.minor > AET->bres.minor)
- pETEchase = pETEchase->back;
-
- AET = AET->next;
- if (pETEchase != pETEinsert)
- {
- pETEchaseBackTMP = pETEchase->back;
- pETEinsert->back->next = AET;
- if (AET)
- AET->back = pETEinsert->back;
- pETEinsert->next = pETEchase;
- pETEchase->back->next = pETEinsert;
- pETEchase->back = pETEinsert;
- pETEinsert->back = pETEchaseBackTMP;
- changed = 1;
- }
- }
- return(changed);
-}
-
-/*
- * Clean up our act.
- */
-void
-miFreeStorage(register ScanLineListBlock *pSLLBlock)
-{
- register ScanLineListBlock *tmpSLLBlock;
-
- while (pSLLBlock)
- {
- tmpSLLBlock = pSLLBlock->next;
- g_free(pSLLBlock);
- pSLLBlock = tmpSLLBlock;
- }
-}
diff --git a/gdk/linux-fb/miscanfill.h b/gdk/linux-fb/miscanfill.h
deleted file mode 100644
index c9e1f5027..000000000
--- a/gdk/linux-fb/miscanfill.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/* $TOG: miscanfill.h /main/6 1998/02/09 14:48:35 kaleb $ */
-/*
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-#ifndef SCANFILLINCLUDED
-#define SCANFILLINCLUDED
-/*
- * scanfill.h
- *
- * Written by Brian Kelleher; Jan 1985
- *
- * This file contains a few macros to help track
- * the edge of a filled object. The object is assumed
- * to be filled in scanline order, and thus the
- * algorithm used is an extension of Bresenham's line
- * drawing algorithm which assumes that y is always the
- * major axis.
- * Since these pieces of code are the same for any filled shape,
- * it is more convenient to gather the library in one
- * place, but since these pieces of code are also in
- * the inner loops of output primitives, procedure call
- * overhead is out of the question.
- * See the author for a derivation if needed.
- */
-
-
-/*
- * In scan converting polygons, we want to choose those pixels
- * which are inside the polygon. Thus, we add .5 to the starting
- * x coordinate for both left and right edges. Now we choose the
- * first pixel which is inside the pgon for the left edge and the
- * first pixel which is outside the pgon for the right edge.
- * Draw the left pixel, but not the right.
- *
- * How to add .5 to the starting x coordinate:
- * If the edge is moving to the right, then subtract dy from the
- * error term from the general form of the algorithm.
- * If the edge is moving to the left, then add dy to the error term.
- *
- * The reason for the difference between edges moving to the left
- * and edges moving to the right is simple: If an edge is moving
- * to the right, then we want the algorithm to flip immediately.
- * If it is moving to the left, then we don't want it to flip until
- * we traverse an entire pixel.
- */
-#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \
- int dx; /* local storage */ \
-\
- /* \
- * if the edge is horizontal, then it is ignored \
- * and assumed not to be processed. Otherwise, do this stuff. \
- */ \
- if ((dy) != 0) { \
- xStart = (x1); \
- dx = (x2) - xStart; \
- if (dx < 0) { \
- m = dx / (dy); \
- m1 = m - 1; \
- incr1 = -2 * dx + 2 * (dy) * m1; \
- incr2 = -2 * dx + 2 * (dy) * m; \
- d = 2 * m * (dy) - 2 * dx - 2 * (dy); \
- } else { \
- m = dx / (dy); \
- m1 = m + 1; \
- incr1 = 2 * dx - 2 * (dy) * m1; \
- incr2 = 2 * dx - 2 * (dy) * m; \
- d = -2 * m * (dy) + 2 * dx; \
- } \
- } \
-}
-
-#define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \
- if (m1 > 0) { \
- if (d > 0) { \
- minval += m1; \
- d += incr1; \
- } \
- else { \
- minval += m; \
- d += incr2; \
- } \
- } else {\
- if (d >= 0) { \
- minval += m1; \
- d += incr1; \
- } \
- else { \
- minval += m; \
- d += incr2; \
- } \
- } \
-}
-
-
-/*
- * This structure contains all of the information needed
- * to run the bresenham algorithm.
- * The variables may be hardcoded into the declarations
- * instead of using this structure to make use of
- * register declarations.
- */
-typedef struct {
- int minor; /* minor axis */
- int d; /* decision variable */
- int m, m1; /* slope and slope+1 */
- int incr1, incr2; /* error increments */
-} BRESINFO;
-
-
-#define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \
- BRESINITPGON(dmaj, min1, min2, bres.minor, bres.d, \
- bres.m, bres.m1, bres.incr1, bres.incr2)
-
-#define BRESINCRPGONSTRUCT(bres) \
- BRESINCRPGON(bres.d, bres.minor, bres.m, bres.m1, bres.incr1, bres.incr2)
-
-
-#endif
diff --git a/gdk/linux-fb/mispans.c b/gdk/linux-fb/mispans.c
deleted file mode 100644
index dbcefafaa..000000000
--- a/gdk/linux-fb/mispans.c
+++ /dev/null
@@ -1,483 +0,0 @@
-/* $XFree86: xc/programs/Xserver/mi/mispans.c,v 3.1 1998/10/04 09:39:33 dawes Exp $ */
-/***********************************************************
-
-Copyright 1989, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-/* $TOG: mispans.c /main/7 1998/02/09 14:48:44 kaleb $ */
-
-#include <config.h>
-#include "mi.h"
-#include "mispans.h"
-#include <string.h> /* for memmove */
-
-/*
-
-These routines maintain lists of Spans, in order to implement the
-``touch-each-pixel-once'' rules of wide lines and arcs.
-
-Written by Joel McCormack, Summer 1989.
-
-*/
-
-
-void miInitSpanGroup(SpanGroup *spanGroup)
-{
- spanGroup->size = 0;
- spanGroup->count = 0;
- spanGroup->group = NULL;
- spanGroup->ymin = SHRT_MAX;
- spanGroup->ymax = SHRT_MIN;
-} /* InitSpanGroup */
-
-#define YMIN(spans) (spans->points[0].y)
-#define YMAX(spans) (spans->points[spans->count-1].y)
-
-void miSubtractSpans (SpanGroup *spanGroup, Spans *sub)
-{
- int i, subCount, spansCount;
- int ymin, ymax, xmin, xmax;
- Spans *spans;
- GdkSpan* subPt, *spansPt;
- int extra;
-
- ymin = YMIN(sub);
- ymax = YMAX(sub);
- spans = spanGroup->group;
- for (i = spanGroup->count; i; i--, spans++) {
- if (YMIN(spans) <= ymax && ymin <= YMAX(spans)) {
- subCount = sub->count;
- subPt = sub->points;
- spansCount = spans->count;
- spansPt = spans->points;
- extra = 0;
- for (;;)
- {
- while (spansCount && spansPt->y < subPt->y)
- {
- spansPt++; spansCount--;
- }
- if (!spansCount)
- break;
- while (subCount && subPt->y < spansPt->y)
- {
- subPt++; subCount--;
- }
- if (!subCount)
- break;
- if (subPt->y == spansPt->y)
- {
- xmin = subPt->x;
- xmax = xmin + subPt->width;
- if (xmin >= (spansPt->x + spansPt->width) || spansPt->x >= xmax)
- {
- ;
- }
- else if (xmin <= spansPt->x)
- {
- if (xmax >= (spansPt->x + spansPt->width))
- {
- g_memmove (spansPt, spansPt + 1, sizeof *spansPt * (spansCount - 1));
- spansPt--;
- spans->count--;
- extra++;
- }
- else
- {
- spansPt->width -= xmax - spansPt->x;
- spansPt->x = xmax;
- }
- }
- else
- {
- if (xmax >= (spansPt->x + spansPt->width))
- {
- spansPt->width = xmin - spansPt->x;
- }
- else
- {
- if (!extra) {
- GdkSpan* newPt;
-
-#define EXTRA 8
- newPt = (GdkSpan*) g_realloc (spans->points, (spans->count + EXTRA) * sizeof (GdkSpan));
- if (!newPt)
- break;
- spansPt = newPt + (spansPt - spans->points);
- spans->points = newPt;
- extra = EXTRA;
- }
- g_memmove (spansPt + 1, spansPt, sizeof *spansPt * (spansCount));
- spans->count++;
- extra--;
- spansPt->width = xmin - spansPt->x;
- spansPt++;
- spansPt->width -= xmax - spansPt->x;
- spansPt->x = xmax;
- }
- }
- }
- spansPt++; spansCount--;
- }
- }
- }
-}
-
-void miAppendSpans(SpanGroup *spanGroup, SpanGroup *otherGroup, Spans *spans)
-{
- register int ymin, ymax;
- register int spansCount;
-
- spansCount = spans->count;
- if (spansCount > 0) {
- if (spanGroup->size == spanGroup->count) {
- spanGroup->size = (spanGroup->size + 8) * 2;
- spanGroup->group = (Spans *)
- g_realloc(spanGroup->group, sizeof(Spans) * spanGroup->size);
- }
-
- spanGroup->group[spanGroup->count] = *spans;
- (spanGroup->count)++;
- ymin = spans->points[0].y;
- if (ymin < spanGroup->ymin) spanGroup->ymin = ymin;
- ymax = spans->points[spansCount - 1].y;
- if (ymax > spanGroup->ymax) spanGroup->ymax = ymax;
- if (otherGroup &&
- otherGroup->ymin < ymax &&
- ymin < otherGroup->ymax)
- {
- miSubtractSpans (otherGroup, spans);
- }
- }
- else
- {
- g_free (spans->points);
- }
-} /* AppendSpans */
-
-void miFreeSpanGroup(SpanGroup *spanGroup)
-{
- g_free(spanGroup->group);
-}
-
-static void QuickSortSpansX(register GdkSpan points[], register int numSpans)
-{
- register int x;
- register int i, j, m;
- register GdkSpan* r;
-
-/* Always called with numSpans > 1 */
-/* Sorts only by x, as all y should be the same */
-
-#define ExchangeSpans(a, b) \
-{ \
- GdkSpan tpt; \
- \
- tpt = points[a]; points[a] = points[b]; points[b] = tpt; \
-}
-
- do {
- if (numSpans < 9) {
- /* Do insertion sort */
- register int xprev;
-
- xprev = points[0].x;
- i = 1;
- do { /* while i != numSpans */
- x = points[i].x;
- if (xprev > x) {
- /* points[i] is out of order. Move into proper location. */
- GdkSpan tpt;
- int k;
-
- for (j = 0; x >= points[j].x; j++) {}
- tpt = points[i];
- for (k = i; k != j; k--) {
- points[k] = points[k-1];
- }
- points[j] = tpt;
- x = points[i].x;
- } /* if out of order */
- xprev = x;
- i++;
- } while (i != numSpans);
- return;
- }
-
- /* Choose partition element, stick in location 0 */
- m = numSpans / 2;
- if (points[m].x > points[0].x) ExchangeSpans(m, 0);
- if (points[m].x > points[numSpans-1].x) ExchangeSpans(m, numSpans-1);
- if (points[m].x > points[0].x) ExchangeSpans(m, 0);
- x = points[0].x;
-
- /* Partition array */
- i = 0;
- j = numSpans;
- do {
- r = &(points[i]);
- do {
- r++;
- i++;
- } while (i != numSpans && r->x < x);
- r = &(points[j]);
- do {
- r--;
- j--;
- } while (x < r->x);
- if (i < j) ExchangeSpans(i, j);
- } while (i < j);
-
- /* Move partition element back to middle */
- ExchangeSpans(0, j);
-
- /* Recurse */
- if (numSpans-j-1 > 1)
- QuickSortSpansX(&points[j+1], numSpans-j-1);
- numSpans = j;
- } while (numSpans > 1);
-} /* QuickSortSpans */
-
-
-static int UniquifySpansX(Spans *spans, register GdkSpan *newPoints)
-{
- register int newx1, newx2, oldpt, i, y;
- GdkSpan *oldPoints, *startNewPoints = newPoints;
-
-/* Always called with numSpans > 1 */
-/* Uniquify the spans, and stash them into newPoints and newWidths. Return the
- number of unique spans. */
-
-
- oldPoints = spans->points;
-
- y = oldPoints->y;
- newx1 = oldPoints->x;
- newx2 = newx1 + oldPoints->width;
-
- for (i = spans->count-1; i != 0; i--) {
- oldPoints++;
- oldpt = oldPoints->x;
- if (oldpt > newx2) {
- /* Write current span, start a new one */
- newPoints->x = newx1;
- newPoints->y = y;
- newPoints->width = newx2 - newx1;
- newPoints++;
- newx1 = oldpt;
- newx2 = oldpt + oldPoints->width;
- } else {
- /* extend current span, if old extends beyond new */
- oldpt = oldpt + oldPoints->width;
- if (oldpt > newx2) newx2 = oldpt;
- }
- } /* for */
-
- /* Write final span */
- newPoints->x = newx1;
- newPoints->width = newx2 - newx1;
- newPoints->y = y;
-
- return (newPoints - startNewPoints) + 1;
-} /* UniquifySpansX */
-
-void
-miDisposeSpanGroup (SpanGroup *spanGroup)
-{
- int i;
- Spans *spans;
-
- for (i = 0; i < spanGroup->count; i++)
- {
- spans = spanGroup->group + i;
- g_free (spans->points);
- }
-}
-
-void miFillUniqueSpanGroup(GdkDrawable *pDraw, GdkGC *pGC, SpanGroup *spanGroup)
-{
- register int i;
- register Spans *spans;
- register Spans *yspans;
- register int *ysizes;
- register int ymin, ylength;
-
- /* Outgoing spans for one big call to FillSpans */
- register GdkSpan* points;
- register int count;
-
- if (spanGroup->count == 0) return;
-
- if (spanGroup->count == 1) {
- /* Already should be sorted, unique */
- spans = spanGroup->group;
- gdk_fb_fill_spans(pDraw, pGC, spans->points, spans->count, TRUE);
- g_free(spans->points);
- }
- else
- {
- /* Yuck. Gross. Radix sort into y buckets, then sort x and uniquify */
- /* This seems to be the fastest thing to do. I've tried sorting on
- both x and y at the same time rather than creating into all those
- y buckets, but it was somewhat slower. */
-
- ymin = spanGroup->ymin;
- ylength = spanGroup->ymax - ymin + 1;
-
- /* Allocate Spans for y buckets */
- yspans = (Spans *) g_malloc(ylength * sizeof(Spans));
- ysizes = (int *) g_malloc(ylength * sizeof (int));
-
- if (!yspans || !ysizes)
- {
- g_free (yspans);
- g_free (ysizes);
- miDisposeSpanGroup (spanGroup);
- return;
- }
-
- for (i = 0; i != ylength; i++) {
- ysizes[i] = 0;
- yspans[i].count = 0;
- yspans[i].points = NULL;
- }
-
- /* Go through every single span and put it into the correct bucket */
- count = 0;
- for (i = 0, spans = spanGroup->group;
- i != spanGroup->count;
- i++, spans++) {
- int index;
- int j;
-
- for (j = 0, points = spans->points;
- j != spans->count;
- j++, points++) {
- index = points->y - ymin;
- if (index >= 0 && index < ylength) {
- Spans *newspans = &(yspans[index]);
- if (newspans->count == ysizes[index]) {
- GdkSpan* newpoints;
- ysizes[index] = (ysizes[index] + 8) * 2;
- newpoints = (GdkSpan*) g_realloc(
- newspans->points,
- ysizes[index] * sizeof(GdkSpan));
- if (!newpoints)
- {
- int i;
-
- for (i = 0; i < ylength; i++)
- {
- g_free (yspans[i].points);
- }
- g_free (yspans);
- g_free (ysizes);
- miDisposeSpanGroup (spanGroup);
- return;
- }
- newspans->points = newpoints;
- }
- newspans->points[newspans->count] = *points;
- (newspans->count)++;
- } /* if y value of span in range */
- } /* for j through spans */
- count += spans->count;
- g_free(spans->points);
- spans->points = NULL;
- } /* for i thorough Spans */
-
- /* Now sort by x and uniquify each bucket into the final array */
- points = (GdkSpan*) g_malloc(count * sizeof(GdkSpan));
- if (!points)
- {
- int i;
-
- for (i = 0; i < ylength; i++)
- {
- g_free (yspans[i].points);
- }
- g_free (yspans);
- g_free (ysizes);
- g_free (points);
- return;
- }
- count = 0;
- for (i = 0; i != ylength; i++) {
- int ycount = yspans[i].count;
- if (ycount > 0) {
- if (ycount > 1) {
- QuickSortSpansX(yspans[i].points, ycount);
- count += UniquifySpansX
- (&(yspans[i]), &(points[count]));
- } else {
- points[count] = yspans[i].points[0];
- count++;
- }
- g_free(yspans[i].points);
- }
- }
-
- gdk_fb_fill_spans(pDraw, pGC, points, count, TRUE);
- g_free(points);
- g_free(yspans);
- g_free(ysizes); /* use (DE)ALLOCATE_LOCAL for these? */
- }
-
- spanGroup->count = 0;
- spanGroup->ymin = SHRT_MAX;
- spanGroup->ymax = SHRT_MIN;
-}
-
-
-void miFillSpanGroup(GdkDrawable *pDraw, GdkGC *pGC, SpanGroup *spanGroup)
-{
- register int i;
- register Spans *spans;
-
- for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) {
- gdk_fb_fill_spans(pDraw, pGC, spans->points, spans->count, TRUE);
- g_free(spans->points);
- }
-
- spanGroup->count = 0;
- spanGroup->ymin = SHRT_MAX;
- spanGroup->ymax = SHRT_MIN;
-} /* FillSpanGroup */
diff --git a/gdk/linux-fb/mispans.h b/gdk/linux-fb/mispans.h
deleted file mode 100644
index f46c44d19..000000000
--- a/gdk/linux-fb/mispans.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/***********************************************************
-
-Copyright 1989, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-/* $TOG: mispans.h /main/5 1998/02/09 14:48:48 kaleb $ */
-
-typedef struct {
- int count; /* number of spans */
- GdkSpan* points; /* pointer to list of start points */
-} Spans;
-
-typedef struct {
- int size; /* Total number of *Spans allocated */
- int count; /* Number of *Spans actually in group */
- Spans *group; /* List of Spans */
- int ymin, ymax; /* Min, max y values encountered */
-} SpanGroup;
-
-/* Initialize SpanGroup. MUST BE DONE before use. */
-extern void miInitSpanGroup(SpanGroup *spanGroup);
-
-/* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */
-extern void miAppendSpans(SpanGroup *spanGroup, SpanGroup *otherGroup,
- Spans *spans);
-
-/* Paint a span group, possibly with some overlap */
-extern void miFillSpanGroup(GdkDrawable* pDraw, GdkGC* pGC,
- SpanGroup *spanGroup);
-
-/* Paint a span group, insuring that each pixel is painted at most once */
-extern void miFillUniqueSpanGroup(GdkDrawable* pDraw, GdkGC* pGC,
- SpanGroup *spanGroup);
-
-/* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */
-extern void miFreeSpanGroup(SpanGroup *spanGroup);
-
-extern void miSubtractSpans(SpanGroup *spanGroup, Spans *sub);
-
-extern void miDisposeSpanGroup(SpanGroup *spanGroup);
-
-extern int miClipSpans(GdkRegion* prgnDst, GdkPoint* ppt,
- int *pwidth, int nspans, GdkPoint* pptNew,
- int *pwidthNew, int fSorted);
-
-/* Rops which must use span groups */
-#define miSpansCarefulRop(rop) (((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2)
-#define miSpansEasyRop(rop) (!miSpansCarefulRop(rop))
-
diff --git a/gdk/linux-fb/mistruct.h b/gdk/linux-fb/mistruct.h
deleted file mode 100644
index ff5d73821..000000000
--- a/gdk/linux-fb/mistruct.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $TOG: mistruct.h /main/4 1998/02/09 14:49:07 kaleb $ */
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifndef MISTRUCT_H
-#define MISTRUCT_H
-
-#include "mitypes.h"
-
-/* information about dashes */
-typedef struct _miDash {
- GdkPoint pt;
- int e1, e2; /* keep these, so we don't have to do it again */
- int e; /* bresenham error term for this point on line */
- int which;
- int newLine;/* 0 if part of same original line as previous dash */
-} miDashRec;
-
-#endif /* MISTRUCT_H */
diff --git a/gdk/linux-fb/mitypes.h b/gdk/linux-fb/mitypes.h
deleted file mode 100644
index 527e0dc1c..000000000
--- a/gdk/linux-fb/mitypes.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef MITYPES_H
-#define MITYPES_H
-
-#include <alloca.h>
-
-#define ALLOCATE_LOCAL(size) alloca((int)(size))
-#define DEALLOCATE_LOCAL(ptr) /* as nothing */
-
-#include <stdlib.h>
-#include <glib.h>
-#include <gdk/gdk.h>
-#include <gdkfb.h>
-#include <gdkprivate-fb.h>
-#include <gdkregion-generic.h>
-
-typedef struct _miDash *miDashPtr;
-
-#define CT_NONE 0
-#define CT_PIXMAP 1
-#define CT_REGION 2
-#define CT_UNSORTED 6
-#define CT_YSORTED 10
-#define CT_YXSORTED 14
-#define CT_YXBANDED 18
-
-#define PixmapBytePad(w, d) (w)
-#define BitmapBytePad(w) (w)
-
-typedef struct _miArc {
- gint16 x, y;
- guint16 width, height;
- gint16 angle1, angle2;
-} miArc;
-
-#define SCRRIGHT(x, n) ((x)>>(n))
-
-#endif /* MITYPES_H */
diff --git a/gdk/linux-fb/miwideline.c b/gdk/linux-fb/miwideline.c
deleted file mode 100644
index 508dfa3b5..000000000
--- a/gdk/linux-fb/miwideline.c
+++ /dev/null
@@ -1,2028 +0,0 @@
-/* $TOG: miwideline.c /main/60 1998/03/07 17:40:23 kaleb $ */
-/*
-
-Copyright 1988, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-/* $XFree86: xc/programs/Xserver/mi/miwideline.c,v 1.7 1999/10/13 22:33:13 dawes Exp $ */
-
-/* Author: Keith Packard, MIT X Consortium */
-
-/*
- * Mostly integer wideline code. Uses a technique similar to
- * bresenham zero-width lines, except walks an X edge
- */
-
-#include <config.h>
-#include <stdio.h>
-#ifdef _XOPEN_SOURCE
-#include <math.h>
-#else
-#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */
-#include <math.h>
-#undef _XOPEN_SOURCE
-#endif
-
-#include "mi.h"
-#include "miwideline.h"
-
-#ifdef ICEILTEMPDECL
-ICEILTEMPDECL
-#endif
-
-static void
-miLineArc (GdkDrawable *pDraw, GdkGC *pGC, GdkColor *pixel, SpanDataPtr spanData,
- LineFacePtr leftFace, LineFacePtr rightFace, double xorg, double yorg, gboolean isInt);
-
-/*
- * spans-based polygon filler
- */
-
-void
-miFillPolyHelper (GdkDrawable *pDrawable, GdkGC *pGC, GdkColor *pixel,
- SpanDataPtr spanData, int y, int overall_height,
- PolyEdgePtr left, PolyEdgePtr right, int left_count,
- int right_count)
-{
- register int left_x = 0, left_e = 0;
- int left_stepx = 0;
- int left_signdx = 0;
- int left_dy = 0, left_dx = 0;
-
- register int right_x = 0, right_e = 0;
- int right_stepx = 0;
- int right_signdx = 0;
- int right_dy = 0, right_dx = 0;
-
- int height = 0;
- int left_height = 0, right_height = 0;
-
- register GdkSpan* ppt;
- GdkSpan* pptInit = NULL;
- GdkColor oldPixel;
- int xorg;
- Spans spanRec;
-
- left_height = 0;
- right_height = 0;
-
- if (!spanData)
- {
- pptInit = (GdkSpan*) ALLOCATE_LOCAL (overall_height * sizeof(*ppt));
- if (!pptInit)
- return;
- ppt = pptInit;
- oldPixel = GDK_GC_FBDATA(pGC)->values.foreground;
- if (pixel->pixel != oldPixel.pixel)
- {
- gdk_gc_set_foreground(pGC, pixel);
- }
- }
- else
- {
- spanRec.points = (GdkSpan*) g_malloc (overall_height * sizeof (*ppt));
- if (!spanRec.points)
- return;
- ppt = spanRec.points;
- }
-
- xorg = 0;
- while ((left_count || left_height) &&
- (right_count || right_height))
- {
- MIPOLYRELOADLEFT
- MIPOLYRELOADRIGHT
-
- height = left_height;
- if (height > right_height)
- height = right_height;
-
- left_height -= height;
- right_height -= height;
-
- while (--height >= 0)
- {
- if (right_x >= left_x)
- {
- ppt->y = y;
- ppt->x = left_x + xorg;
- ppt->width = right_x - left_x + 1;
- ppt++;
- }
- y++;
-
- MIPOLYSTEPLEFT
-
- MIPOLYSTEPRIGHT
- }
- }
- if (!spanData)
- {
- gdk_fb_fill_spans(pDrawable, pGC, pptInit, ppt - pptInit, TRUE);
- DEALLOCATE_LOCAL (pptInit);
- if (pixel->pixel != oldPixel.pixel)
- {
- gdk_gc_set_foreground(pGC, &oldPixel);
- }
- }
- else
- {
- spanRec.count = ppt - spanRec.points;
- AppendSpanGroup (pGC, pixel, &spanRec, spanData)
- }
-}
-
-static void
-miFillRectPolyHelper (GdkDrawable *pDrawable, GdkGC *pGC, GdkColor *pixel,
- SpanDataPtr spanData, int x, int y, int w, int h)
-{
- register GdkSpan* ppt;
- GdkColor oldPixel;
- Spans spanRec;
-
- if (!spanData)
- {
- oldPixel = GDK_GC_FBDATA(pGC)->values.foreground;
- if (pixel->pixel != oldPixel.pixel)
- {
- gdk_gc_set_foreground(pGC, pixel);
- }
- gdk_fb_draw_rectangle(pDrawable, pGC, TRUE, x, y, w, h);
- if (pixel->pixel != oldPixel.pixel)
- {
- gdk_gc_set_foreground(pGC, &oldPixel);
- }
- }
- else
- {
- spanRec.points = (GdkSpan*) g_malloc (h * sizeof (*ppt));
- if (!spanRec.points)
- return;
- ppt = spanRec.points;
-
- while (h--)
- {
- ppt->x = x;
- ppt->y = y;
- ppt->width = w;
- ppt++;
- y++;
- }
- spanRec.count = ppt - spanRec.points;
- AppendSpanGroup (pGC, pixel, &spanRec, spanData)
- }
-}
-
-/* static */ int
-miPolyBuildEdge (double x0, double y0, double k, register int dx,
- register int dy, int xi, int yi, int left,
- register PolyEdgePtr edge)
-{
- int x, y, e;
- int xady;
-
- if (dy < 0)
- {
- dy = -dy;
- dx = -dx;
- k = -k;
- }
-
-#ifdef NOTDEF
- {
- double realk, kerror;
- realk = x0 * dy - y0 * dx;
- kerror = Fabs (realk - k);
- if (kerror > .1)
- printf ("realk: %g k: %g\n", realk, k);
- }
-#endif
- y = ICEIL (y0);
- xady = ICEIL (k) + y * dx;
-
- if (xady <= 0)
- x = - (-xady / dy) - 1;
- else
- x = (xady - 1) / dy;
-
- e = xady - x * dy;
-
- if (dx >= 0)
- {
- edge->signdx = 1;
- edge->stepx = dx / dy;
- edge->dx = dx % dy;
- }
- else
- {
- edge->signdx = -1;
- edge->stepx = - (-dx / dy);
- edge->dx = -dx % dy;
- e = dy - e + 1;
- }
- edge->dy = dy;
- edge->x = x + left + xi;
- edge->e = e - dy; /* bias to compare against 0 instead of dy */
- return y + yi;
-}
-
-#define StepAround(v, incr, max) (((v) + (incr) < 0) ? (max - 1) : ((v) + (incr) == max) ? 0 : ((v) + (incr)))
-
-/* static */ int
-miPolyBuildPoly (register PolyVertexPtr vertices, register PolySlopePtr slopes,
- int count, int xi, int yi, PolyEdgePtr left, PolyEdgePtr right,
- int *pnleft, int *pnright, int *h)
-{
- int top, bottom;
- double miny, maxy;
- register int i;
- int j;
- int clockwise;
- int slopeoff;
- register int s;
- register int nright, nleft;
- int y, lasty = 0, bottomy, topy = 0;
-
- /* find the top of the polygon */
- maxy = miny = vertices[0].y;
- bottom = top = 0;
- for (i = 1; i < count; i++)
- {
- if (vertices[i].y < miny)
- {
- top = i;
- miny = vertices[i].y;
- }
- if (vertices[i].y >= maxy)
- {
- bottom = i;
- maxy = vertices[i].y;
- }
- }
- clockwise = 1;
- slopeoff = 0;
-
- i = top;
- j = StepAround (top, -1, count);
-
- if (slopes[j].dy * slopes[i].dx > slopes[i].dy * slopes[j].dx)
- {
- clockwise = -1;
- slopeoff = -1;
- }
-
- bottomy = ICEIL (maxy) + yi;
-
- nright = 0;
-
- s = StepAround (top, slopeoff, count);
- i = top;
- while (i != bottom)
- {
- if (slopes[s].dy != 0)
- {
- y = miPolyBuildEdge (vertices[i].x, vertices[i].y,
- slopes[s].k,
- slopes[s].dx, slopes[s].dy,
- xi, yi, 0,
- &right[nright]);
- if (nright != 0)
- right[nright-1].height = y - lasty;
- else
- topy = y;
- nright++;
- lasty = y;
- }
-
- i = StepAround (i, clockwise, count);
- s = StepAround (s, clockwise, count);
- }
- if (nright != 0)
- right[nright-1].height = bottomy - lasty;
-
- if (slopeoff == 0)
- slopeoff = -1;
- else
- slopeoff = 0;
-
- nleft = 0;
- s = StepAround (top, slopeoff, count);
- i = top;
- while (i != bottom)
- {
- if (slopes[s].dy != 0)
- {
- y = miPolyBuildEdge (vertices[i].x, vertices[i].y,
- slopes[s].k,
- slopes[s].dx, slopes[s].dy, xi, yi, 1,
- &left[nleft]);
-
- if (nleft != 0)
- left[nleft-1].height = y - lasty;
- nleft++;
- lasty = y;
- }
- i = StepAround (i, -clockwise, count);
- s = StepAround (s, -clockwise, count);
- }
- if (nleft != 0)
- left[nleft-1].height = bottomy - lasty;
- *pnleft = nleft;
- *pnright = nright;
- *h = bottomy - topy;
- return topy;
-}
-
-static void
-miLineOnePoint (GdkDrawable *pDrawable, GdkGC *pGC, GdkColor *pixel,
- SpanDataPtr spanData, int x, int y)
-{
- GdkColor oldPixel;
- GdkSpan span;
-
- MILINESETPIXEL (pDrawable, pGC, pixel, oldPixel);
- span.x = x;
- span.y = y;
- span.width = 1;
-
- gdk_fb_fill_spans(pDrawable, pGC, &span, 1, TRUE);
- MILINERESETPIXEL (pDrawable, pGC, pixel, oldPixel);
-}
-
-static void
-miLineJoin (GdkDrawable *pDrawable, GdkGC *pGC, GdkColor *pixel,
- SpanDataPtr spanData, LineFacePtr pLeft, LineFacePtr pRight)
-{
- double mx, my;
- double denom = 0.0;
- PolyVertexRec vertices[4];
- PolySlopeRec slopes[4];
- int edgecount;
- PolyEdgeRec left[4], right[4];
- int nleft, nright;
- int y, height;
- int swapslopes;
- int joinStyle = GDK_GC_FBDATA(pGC)->values.join_style;
- int lw = GDK_GC_FBDATA(pGC)->values.line_width;
-
- if (lw == 1 && !spanData) {
- /* Lines going in the same direction have no join */
- if (pLeft->dx >= 0 == pRight->dx <= 0)
- return;
- if (joinStyle != GDK_JOIN_ROUND) {
- denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy;
- if (denom == 0)
- return; /* no join to draw */
- }
- if (joinStyle != GDK_JOIN_MITER) {
- miLineOnePoint (pDrawable, pGC, pixel, spanData, pLeft->x, pLeft->y);
- return;
- }
- } else {
- if (joinStyle == GDK_JOIN_ROUND)
- {
- miLineArc(pDrawable, pGC, pixel, spanData,
- pLeft, pRight,
- (double)0.0, (double)0.0, TRUE);
- return;
- }
- denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy;
- if (denom == 0.0)
- return; /* no join to draw */
- }
-
- swapslopes = 0;
- if (denom > 0)
- {
- pLeft->xa = -pLeft->xa;
- pLeft->ya = -pLeft->ya;
- pLeft->dx = -pLeft->dx;
- pLeft->dy = -pLeft->dy;
- }
- else
- {
- swapslopes = 1;
- pRight->xa = -pRight->xa;
- pRight->ya = -pRight->ya;
- pRight->dx = -pRight->dx;
- pRight->dy = -pRight->dy;
- }
-
- vertices[0].x = pRight->xa;
- vertices[0].y = pRight->ya;
- slopes[0].dx = -pRight->dy;
- slopes[0].dy = pRight->dx;
- slopes[0].k = 0;
-
- vertices[1].x = 0;
- vertices[1].y = 0;
- slopes[1].dx = pLeft->dy;
- slopes[1].dy = -pLeft->dx;
- slopes[1].k = 0;
-
- vertices[2].x = pLeft->xa;
- vertices[2].y = pLeft->ya;
-
- if (joinStyle == GDK_JOIN_MITER)
- {
- my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) -
- pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx )) /
- denom;
- if (pLeft->dy != 0)
- {
- mx = pLeft->xa + (my - pLeft->ya) *
- (double) pLeft->dx / (double) pLeft->dy;
- }
- else
- {
- mx = pRight->xa + (my - pRight->ya) *
- (double) pRight->dx / (double) pRight->dy;
- }
- /* check miter limit */
- if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw)
- joinStyle = GDK_JOIN_BEVEL;
- }
-
- if (joinStyle == GDK_JOIN_MITER)
- {
- slopes[2].dx = pLeft->dx;
- slopes[2].dy = pLeft->dy;
- slopes[2].k = pLeft->k;
- if (swapslopes)
- {
- slopes[2].dx = -slopes[2].dx;
- slopes[2].dy = -slopes[2].dy;
- slopes[2].k = -slopes[2].k;
- }
- vertices[3].x = mx;
- vertices[3].y = my;
- slopes[3].dx = pRight->dx;
- slopes[3].dy = pRight->dy;
- slopes[3].k = pRight->k;
- if (swapslopes)
- {
- slopes[3].dx = -slopes[3].dx;
- slopes[3].dy = -slopes[3].dy;
- slopes[3].k = -slopes[3].k;
- }
- edgecount = 4;
- }
- else
- {
- double scale, dx, dy, adx, ady;
-
- adx = dx = pRight->xa - pLeft->xa;
- ady = dy = pRight->ya - pLeft->ya;
- if (adx < 0)
- adx = -adx;
- if (ady < 0)
- ady = -ady;
- scale = ady;
- if (adx > ady)
- scale = adx;
- slopes[2].dx = (dx * 65536) / scale;
- slopes[2].dy = (dy * 65536) / scale;
- slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy -
- (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0;
- edgecount = 3;
- }
-
- y = miPolyBuildPoly (vertices, slopes, edgecount, pLeft->x, pLeft->y,
- left, right, &nleft, &nright, &height);
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, height, left, right, nleft, nright);
-}
-
-static int
-miLineArcI (GdkDrawable *pDraw, GdkGC *pGC, int xorg, int yorg, GdkSpan *points)
-{
- register GdkSpan* tpts, *bpts;
- register int x, y, e, ex, slw;
-
- tpts = points;
- slw = GDK_GC_FBDATA(pGC)->values.line_width;
- if (slw == 1)
- {
- tpts->x = xorg;
- tpts->y = yorg;
- tpts->width = 1;
- return 1;
- }
- bpts = tpts + slw;
- y = (slw >> 1) + 1;
- if (slw & 1)
- e = - ((y << 2) + 3);
- else
- e = - (y << 3);
- ex = -4;
- x = 0;
- while (y)
- {
- e += (y << 3) - 4;
- while (e >= 0)
- {
- x++;
- e += (ex = -((x << 3) + 4));
- }
- y--;
- slw = (x << 1) + 1;
- if ((e == ex) && (slw > 1))
- slw--;
- tpts->x = xorg - x;
- tpts->y = yorg - y;
- tpts->width = slw;
- tpts++;
- if ((y != 0) && ((slw > 1) || (e != ex)))
- {
- bpts--;
- bpts->x = xorg - x;
- bpts->y = yorg + y;
- bpts->width = slw;
- }
- }
- return (GDK_GC_FBDATA(pGC)->values.line_width);
-}
-
-#define CLIPSTEPEDGE(edgey,edge,edgeleft) \
- if (ybase == edgey) \
- { \
- if (edgeleft) \
- { \
- if (edge->x > xcl) \
- xcl = edge->x; \
- } \
- else \
- { \
- if (edge->x < xcr) \
- xcr = edge->x; \
- } \
- edgey++; \
- edge->x += edge->stepx; \
- edge->e += edge->dx; \
- if (edge->e > 0) \
- { \
- edge->x += edge->signdx; \
- edge->e -= edge->dy; \
- } \
- }
-
-static int
-miLineArcD (GdkDrawable *pDraw, GdkGC *pGC, double xorg, double yorg, GdkSpan *points,
- PolyEdgePtr edge1, int edgey1, gboolean edgeleft1,
- PolyEdgePtr edge2, int edgey2, gboolean edgeleft2)
-{
- register GdkSpan* pts;
- double radius, x0, y0, el, er, yk, xlk, xrk, k;
- int xbase, ybase, y, boty, xl, xr, xcl, xcr;
- int ymin, ymax;
- gboolean edge1IsMin, edge2IsMin;
- int ymin1, ymin2;
-
- pts = points;
- xbase = floor(xorg);
- x0 = xorg - xbase;
- ybase = ICEIL (yorg);
- y0 = yorg - ybase;
- xlk = x0 + x0 + 1.0;
- xrk = x0 + x0 - 1.0;
- yk = y0 + y0 - 1.0;
- radius = ((double)GDK_GC_FBDATA(pGC)->values.line_width) / 2.0;
- y = floor(radius - y0 + 1.0);
- ybase -= y;
- ymin = ybase;
- ymax = 65536;
- edge1IsMin = FALSE;
- ymin1 = edgey1;
- if (edge1->dy >= 0)
- {
- if (!edge1->dy)
- {
- if (edgeleft1)
- edge1IsMin = TRUE;
- else
- ymax = edgey1;
- edgey1 = 65536;
- }
- else
- {
- if ((edge1->signdx < 0) == edgeleft1)
- edge1IsMin = TRUE;
- }
- }
- edge2IsMin = FALSE;
- ymin2 = edgey2;
- if (edge2->dy >= 0)
- {
- if (!edge2->dy)
- {
- if (edgeleft2)
- edge2IsMin = TRUE;
- else
- ymax = edgey2;
- edgey2 = 65536;
- }
- else
- {
- if ((edge2->signdx < 0) == edgeleft2)
- edge2IsMin = TRUE;
- }
- }
- if (edge1IsMin)
- {
- ymin = ymin1;
- if (edge2IsMin && ymin1 > ymin2)
- ymin = ymin2;
- } else if (edge2IsMin)
- ymin = ymin2;
- el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0);
- er = el + xrk;
- xl = 1;
- xr = 0;
- if (x0 < 0.5)
- {
- xl = 0;
- el -= xlk;
- }
- boty = (y0 < -0.5) ? 1 : 0;
- if (ybase + y - boty > ymax)
- boty = ymax - ybase - y;
- while (y > boty)
- {
- k = (y << 1) + yk;
- er += k;
- while (er > 0.0)
- {
- xr++;
- er += xrk - (xr << 1);
- }
- el += k;
- while (el >= 0.0)
- {
- xl--;
- el += (xl << 1) - xlk;
- }
- y--;
- ybase++;
- if (ybase < ymin)
- continue;
- xcl = xl + xbase;
- xcr = xr + xbase;
- CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
- CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
- if (xcr >= xcl)
- {
- pts->x = xcl;
- pts->y = ybase;
- pts->width = xcr - xcl + 1;
- pts++;
- }
- }
- er = xrk - (xr << 1) - er;
- el = (xl << 1) - xlk - el;
- boty = floor(-y0 - radius + 1.0);
- if (ybase + y - boty > ymax)
- boty = ymax - ybase - y;
- while (y > boty)
- {
- k = (y << 1) + yk;
- er -= k;
- while ((er >= 0.0) && (xr >= 0))
- {
- xr--;
- er += xrk - (xr << 1);
- }
- el -= k;
- while ((el > 0.0) && (xl <= 0))
- {
- xl++;
- el += (xl << 1) - xlk;
- }
- y--;
- ybase++;
- if (ybase < ymin)
- continue;
- xcl = xl + xbase;
- xcr = xr + xbase;
- CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
- CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
- if (xcr >= xcl)
- {
- pts->x = xcl;
- pts->y = ybase;
- pts->width = xcr - xcl + 1;
- pts++;
- }
- }
- return (pts - points);
-}
-
-int
-miRoundJoinFace (register LineFacePtr face, register PolyEdgePtr edge,
- gboolean *leftEdge)
-{
- int y;
- int dx, dy;
- double xa, ya;
- gboolean left;
-
- dx = -face->dy;
- dy = face->dx;
- xa = face->xa;
- ya = face->ya;
- left = 1;
- if (ya > 0)
- {
- ya = 0.0;
- xa = 0.0;
- }
- if (dy < 0 || (dy == 0 && dx > 0))
- {
- dx = -dx;
- dy = -dy;
- left = !left;
- }
- if (dx == 0 && dy == 0)
- dy = 1;
- if (dy == 0)
- {
- y = ICEIL (face->ya) + face->y;
- edge->x = -32767;
- edge->stepx = 0;
- edge->signdx = 0;
- edge->e = -1;
- edge->dy = 0;
- edge->dx = 0;
- edge->height = 0;
- }
- else
- {
- y = miPolyBuildEdge (xa, ya, 0.0, dx, dy, face->x, face->y, !left, edge);
- edge->height = 32767;
- }
- *leftEdge = !left;
- return y;
-}
-
-void
-miRoundJoinClip (register LineFacePtr pLeft, register LineFacePtr pRight,
- PolyEdgePtr edge1, PolyEdgePtr edge2, int *y1, int *y2,
- gboolean *left1, gboolean *left2)
-{
- double denom;
-
- denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy;
-
- if (denom >= 0)
- {
- pLeft->xa = -pLeft->xa;
- pLeft->ya = -pLeft->ya;
- }
- else
- {
- pRight->xa = -pRight->xa;
- pRight->ya = -pRight->ya;
- }
- *y1 = miRoundJoinFace (pLeft, edge1, left1);
- *y2 = miRoundJoinFace (pRight, edge2, left2);
-}
-
-int
-miRoundCapClip (register LineFacePtr face, gboolean isInt,
- register PolyEdgePtr edge, gboolean *leftEdge)
-{
- int y;
- register int dx, dy;
- double xa, ya, k;
- gboolean left;
-
- dx = -face->dy;
- dy = face->dx;
- xa = face->xa;
- ya = face->ya;
- k = 0.0;
- if (!isInt)
- k = face->k;
- left = 1;
- if (dy < 0 || (dy == 0 && dx > 0))
- {
- dx = -dx;
- dy = -dy;
- xa = -xa;
- ya = -ya;
- left = !left;
- }
- if (dx == 0 && dy == 0)
- dy = 1;
- if (dy == 0)
- {
- y = ICEIL (face->ya) + face->y;
- edge->x = -32767;
- edge->stepx = 0;
- edge->signdx = 0;
- edge->e = -1;
- edge->dy = 0;
- edge->dx = 0;
- edge->height = 0;
- }
- else
- {
- y = miPolyBuildEdge (xa, ya, k, dx, dy, face->x, face->y, !left, edge);
- edge->height = 32767;
- }
- *leftEdge = !left;
- return y;
-}
-
-static void
-miLineArc (GdkDrawable *pDraw, GdkGC *pGC, GdkColor *pixel,
- SpanDataPtr spanData, register LineFacePtr leftFace,
- register LineFacePtr rightFace, double xorg, double yorg,
- gboolean isInt)
-{
- GdkSpan* points;
- int xorgi = 0, yorgi = 0;
- GdkColor oldPixel;
- Spans spanRec;
- int n;
- PolyEdgeRec edge1, edge2;
- int edgey1, edgey2;
- gboolean edgeleft1, edgeleft2;
-
- if (isInt)
- {
- xorgi = leftFace ? leftFace->x : rightFace->x;
- yorgi = leftFace ? leftFace->y : rightFace->y;
- }
- edgey1 = 65536;
- edgey2 = 65536;
- edge1.x = 0; /* not used, keep memory checkers happy */
- edge1.dy = -1;
- edge2.x = 0; /* not used, keep memory checkers happy */
- edge2.dy = -1;
- edgeleft1 = FALSE;
- edgeleft2 = FALSE;
- if (((GDK_GC_FBDATA(pGC)->values.line_style != GDK_LINE_SOLID || GDK_GC_FBDATA(pGC)->values.line_width > 2) &&
- (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND && GDK_GC_FBDATA(pGC)->values.join_style != GDK_JOIN_ROUND)) ||
- (GDK_GC_FBDATA(pGC)->values.join_style == GDK_JOIN_ROUND && GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_BUTT))
- {
- if (isInt)
- {
- xorg = (double) xorgi;
- yorg = (double) yorgi;
- }
- if (leftFace && rightFace)
- {
- miRoundJoinClip (leftFace, rightFace, &edge1, &edge2,
- &edgey1, &edgey2, &edgeleft1, &edgeleft2);
- }
- else if (leftFace)
- {
- edgey1 = miRoundCapClip (leftFace, isInt, &edge1, &edgeleft1);
- }
- else if (rightFace)
- {
- edgey2 = miRoundCapClip (rightFace, isInt, &edge2, &edgeleft2);
- }
- isInt = FALSE;
- }
- if (!spanData)
- {
- points = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * GDK_GC_FBDATA(pGC)->values.line_width);
- if (!points)
- return;
- oldPixel = GDK_GC_FBDATA(pGC)->values.foreground;
- if (pixel->pixel != oldPixel.pixel)
- {
- gdk_gc_set_foreground(pGC, pixel);
- }
- }
- else
- {
- points = (GdkSpan*) g_malloc (GDK_GC_FBDATA(pGC)->values.line_width * sizeof (GdkSpan));
- if (!points)
- return;
- spanRec.points = points;
- }
- if (isInt)
- n = miLineArcI(pDraw, pGC, xorgi, yorgi, points);
- else
- n = miLineArcD(pDraw, pGC, xorg, yorg, points,
- &edge1, edgey1, edgeleft1,
- &edge2, edgey2, edgeleft2);
-
- if (!spanData)
- {
- gdk_fb_fill_spans(pDraw, pGC, points, n, TRUE);
- DEALLOCATE_LOCAL(points);
- if (pixel->pixel != oldPixel.pixel)
- {
- gdk_gc_set_foreground(pGC, &oldPixel);
- }
- }
- else
- {
- spanRec.count = n;
- AppendSpanGroup (pGC, pixel, &spanRec, spanData)
- }
-}
-
-void
-miLineProjectingCap (GdkDrawable *pDrawable, register GdkGC *pGC, GdkColor *pixel,
- SpanDataPtr spanData, register LineFacePtr face,
- gboolean isLeft, double xorg, double yorg, gboolean isInt)
-{
- int xorgi = 0, yorgi = 0;
- int lw;
- PolyEdgeRec lefts[2], rights[2];
- int lefty, righty, topy, bottomy;
- PolyEdgePtr left, right;
- PolyEdgePtr top, bottom;
- double xa,ya;
- double k;
- double xap, yap;
- int dx, dy;
- double projectXoff, projectYoff;
- double maxy;
- int finaly;
-
- if (isInt)
- {
- xorgi = face->x;
- yorgi = face->y;
- }
- lw = GDK_GC_FBDATA(pGC)->values.line_width;
- dx = face->dx;
- dy = face->dy;
- k = face->k;
- if (dy == 0)
- {
- lefts[0].height = lw;
- lefts[0].x = xorgi;
- if (isLeft)
- lefts[0].x -= (lw >> 1);
- lefts[0].stepx = 0;
- lefts[0].signdx = 1;
- lefts[0].e = -lw;
- lefts[0].dx = 0;
- lefts[0].dy = lw;
- rights[0].height = lw;
- rights[0].x = xorgi;
- if (!isLeft)
- rights[0].x += ((lw + 1) >> 1);
- rights[0].stepx = 0;
- rights[0].signdx = 1;
- rights[0].e = -lw;
- rights[0].dx = 0;
- rights[0].dy = lw;
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, yorgi - (lw >> 1), lw,
- lefts, rights, 1, 1);
- }
- else if (dx == 0)
- {
- topy = yorgi;
- bottomy = yorgi + dy;
- if (isLeft)
- topy -= (lw >> 1);
- else
- bottomy += (lw >> 1);
- lefts[0].height = bottomy - topy;
- lefts[0].x = xorgi - (lw >> 1);
- lefts[0].stepx = 0;
- lefts[0].signdx = 1;
- lefts[0].e = -dy;
- lefts[0].dx = dx;
- lefts[0].dy = dy;
-
- rights[0].height = bottomy - topy;
- rights[0].x = lefts[0].x + (lw-1);
- rights[0].stepx = 0;
- rights[0].signdx = 1;
- rights[0].e = -dy;
- rights[0].dx = dx;
- rights[0].dy = dy;
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy, bottomy - topy, lefts, rights, 1, 1);
- }
- else
- {
- xa = face->xa;
- ya = face->ya;
- projectXoff = -ya;
- projectYoff = xa;
- if (dx < 0)
- {
- right = &rights[1];
- left = &lefts[0];
- top = &rights[0];
- bottom = &lefts[1];
- }
- else
- {
- right = &rights[0];
- left = &lefts[1];
- top = &lefts[0];
- bottom = &rights[1];
- }
- if (isLeft)
- {
- righty = miPolyBuildEdge (xa, ya,
- k, dx, dy, xorgi, yorgi, 0, right);
-
- xa = -xa;
- ya = -ya;
- k = -k;
- lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
- k, dx, dy, xorgi, yorgi, 1, left);
- if (dx > 0)
- {
- ya = -ya;
- xa = -xa;
- }
- xap = xa - projectXoff;
- yap = ya - projectYoff;
- topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
- -dy, dx, xorgi, yorgi, dx > 0, top);
- bottomy = miPolyBuildEdge (xa, ya,
- 0.0, -dy, dx, xorgi, yorgi, dx < 0, bottom);
- maxy = -ya;
- }
- else
- {
- righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
- k, dx, dy, xorgi, yorgi, 0, right);
-
- xa = -xa;
- ya = -ya;
- k = -k;
- lefty = miPolyBuildEdge (xa, ya,
- k, dx, dy, xorgi, yorgi, 1, left);
- if (dx > 0)
- {
- ya = -ya;
- xa = -xa;
- }
- xap = xa - projectXoff;
- yap = ya - projectYoff;
- topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, xorgi, xorgi, dx > 0, top);
- bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
- -dy, dx, xorgi, xorgi, dx < 0, bottom);
- maxy = -ya + projectYoff;
- }
- finaly = ICEIL(maxy) + yorgi;
- if (dx < 0)
- {
- left->height = bottomy - lefty;
- right->height = finaly - righty;
- top->height = righty - topy;
- }
- else
- {
- right->height = bottomy - righty;
- left->height = finaly - lefty;
- top->height = lefty - topy;
- }
- bottom->height = finaly - bottomy;
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy,
- bottom->height + bottomy - topy, lefts, rights, 2, 2);
- }
-}
-
-static void
-miWideSegment (GdkDrawable *pDrawable, GdkGC *pGC, GdkColor *pixel, SpanDataPtr spanData,
- int x1, int y1, int x2, int y2, gboolean projectLeft, gboolean projectRight, LineFacePtr leftFace, LineFacePtr rightFace)
-{
- double l, L, r;
- double xa, ya;
- double projectXoff = 0.0, projectYoff = 0.0;
- double k;
- double maxy;
- int x, y;
- int dx, dy;
- int finaly;
- PolyEdgePtr left, right;
- PolyEdgePtr top, bottom;
- int lefty, righty, topy, bottomy;
- int signdx;
- PolyEdgeRec lefts[2], rights[2];
- LineFacePtr tface;
- int lw = GDK_GC_FBDATA(pGC)->values.line_width;
-
- g_assert(leftFace);
- /* draw top-to-bottom always */
- if (y2 < y1 || (y2 == y1 && x2 < x1))
- {
- x = x1;
- x1 = x2;
- x2 = x;
-
- y = y1;
- y1 = y2;
- y2 = y;
-
- x = projectLeft;
- projectLeft = projectRight;
- projectRight = x;
-
- tface = leftFace;
- leftFace = rightFace;
- rightFace = tface;
- }
-
- dy = y2 - y1;
- signdx = 1;
- dx = x2 - x1;
- if (dx < 0)
- signdx = -1;
-
- g_assert(leftFace);
- leftFace->x = x1;
- leftFace->y = y1;
- leftFace->dx = dx;
- leftFace->dy = dy;
-
- rightFace->x = x2;
- rightFace->y = y2;
- rightFace->dx = -dx;
- rightFace->dy = -dy;
-
- if (dy == 0)
- {
- rightFace->xa = 0;
- rightFace->ya = (double) lw / 2.0;
- rightFace->k = -(double) (lw * dx) / 2.0;
- leftFace->xa = 0;
- leftFace->ya = -rightFace->ya;
- leftFace->k = rightFace->k;
- x = x1;
- if (projectLeft)
- x -= (lw >> 1);
- y = y1 - (lw >> 1);
- dx = x2 - x;
- if (projectRight)
- dx += ((lw + 1) >> 1);
- dy = lw;
- miFillRectPolyHelper (pDrawable, pGC, pixel, spanData,
- x, y, dx, dy);
- }
- else if (dx == 0)
- {
- leftFace->xa = (double) lw / 2.0;
- leftFace->ya = 0;
- leftFace->k = (double) (lw * dy) / 2.0;
- rightFace->xa = -leftFace->xa;
- rightFace->ya = 0;
- rightFace->k = leftFace->k;
- y = y1;
- if (projectLeft)
- y -= lw >> 1;
- x = x1 - (lw >> 1);
- dy = y2 - y;
- if (projectRight)
- dy += ((lw + 1) >> 1);
- dx = lw;
- miFillRectPolyHelper (pDrawable, pGC, pixel, spanData,
- x, y, dx, dy);
- }
- else
- {
- l = ((double) lw) / 2.0;
- L = hypot ((double) dx, (double) dy);
-
- if (dx < 0)
- {
- right = &rights[1];
- left = &lefts[0];
- top = &rights[0];
- bottom = &lefts[1];
- }
- else
- {
- right = &rights[0];
- left = &lefts[1];
- top = &lefts[0];
- bottom = &rights[1];
- }
- r = l / L;
-
- /* coord of upper bound at integral y */
- ya = -r * dx;
- xa = r * dy;
-
- if (projectLeft | projectRight)
- {
- projectXoff = -ya;
- projectYoff = xa;
- }
-
- /* xa * dy - ya * dx */
- k = l * L;
-
- leftFace->xa = xa;
- leftFace->ya = ya;
- leftFace->k = k;
- rightFace->xa = -xa;
- rightFace->ya = -ya;
- rightFace->k = k;
-
- if (projectLeft)
- righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
- k, dx, dy, x1, y1, 0, right);
- else
- righty = miPolyBuildEdge (xa, ya,
- k, dx, dy, x1, y1, 0, right);
-
- /* coord of lower bound at integral y */
- ya = -ya;
- xa = -xa;
-
- /* xa * dy - ya * dx */
- k = - k;
-
- if (projectLeft)
- lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
- k, dx, dy, x1, y1, 1, left);
- else
- lefty = miPolyBuildEdge (xa, ya,
- k, dx, dy, x1, y1, 1, left);
-
- /* coord of top face at integral y */
-
- if (signdx > 0)
- {
- ya = -ya;
- xa = -xa;
- }
-
- if (projectLeft)
- {
- double xap = xa - projectXoff;
- double yap = ya - projectYoff;
- topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
- -dy, dx, x1, y1, dx > 0, top);
- }
- else
- topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, x1, y1, dx > 0, top);
-
- /* coord of bottom face at integral y */
-
- if (projectRight)
- {
- double xap = xa + projectXoff;
- double yap = ya + projectYoff;
- bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
- -dy, dx, x2, y2, dx < 0, bottom);
- maxy = -ya + projectYoff;
- }
- else
- {
- bottomy = miPolyBuildEdge (xa, ya,
- 0.0, -dy, dx, x2, y2, dx < 0, bottom);
- maxy = -ya;
- }
-
- finaly = ICEIL (maxy) + y2;
-
- if (dx < 0)
- {
- left->height = bottomy - lefty;
- right->height = finaly - righty;
- top->height = righty - topy;
- }
- else
- {
- right->height = bottomy - righty;
- left->height = finaly - lefty;
- top->height = lefty - topy;
- }
- bottom->height = finaly - bottomy;
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy,
- bottom->height + bottomy - topy, lefts, rights, 2, 2);
- }
-}
-
-SpanDataPtr
-miSetupSpanData (register GdkGC *pGC, SpanDataPtr spanData, int npt)
-{
- if ((npt < 3 && GDK_GC_FBDATA(pGC)->values.cap_style != GDK_CAP_ROUND) || miSpansEasyRop(GDK_GC_FBDATA(pGC)->alu))
- return (SpanDataPtr) NULL;
- if (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH)
- miInitSpanGroup (&spanData->bgGroup);
- miInitSpanGroup (&spanData->fgGroup);
- return spanData;
-}
-
-void
-miCleanupSpanData (GdkDrawable *pDrawable, GdkGC *pGC, SpanDataPtr spanData)
-{
- if (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH)
- {
- GdkColor oldPixel, pixel;
-
- pixel = GDK_GC_FBDATA(pGC)->values.background;
- oldPixel = GDK_GC_FBDATA(pGC)->values.foreground;
- if (pixel.pixel != oldPixel.pixel)
- gdk_gc_set_foreground(pGC, &pixel);
- miFillUniqueSpanGroup (pDrawable, pGC, &spanData->bgGroup);
- miFreeSpanGroup (&spanData->bgGroup);
- if (pixel.pixel != oldPixel.pixel)
- gdk_gc_set_foreground(pGC, &oldPixel);
- }
- miFillUniqueSpanGroup (pDrawable, pGC, &spanData->fgGroup);
- miFreeSpanGroup (&spanData->fgGroup);
-}
-
-void
-miWideLine (GdkDrawable *pDrawable, GdkGC *pGC, int mode,
- register int npt, register GdkPoint *pPts)
-{
- int x1, y1, x2, y2;
- SpanDataRec spanDataRec;
- SpanDataPtr spanData;
- GdkColor pixel;
- gboolean projectLeft, projectRight;
- LineFaceRec leftFace, rightFace, prevRightFace;
- LineFaceRec firstFace;
- register int first;
- gboolean somethingDrawn = FALSE;
- gboolean selfJoin;
-
- spanData = miSetupSpanData (pGC, &spanDataRec, npt);
- pixel = GDK_GC_FBDATA(pGC)->values.foreground;
- x2 = pPts->x;
- y2 = pPts->y;
- first = TRUE;
- selfJoin = FALSE;
- if (npt > 1)
- {
- if (0 /* mode == CoordModePrevious*/)
- {
- int nptTmp;
- GdkPoint* pPtsTmp;
-
- x1 = x2;
- y1 = y2;
- nptTmp = npt;
- pPtsTmp = pPts + 1;
- while (--nptTmp)
- {
- x1 += pPtsTmp->x;
- y1 += pPtsTmp->y;
- ++pPtsTmp;
- }
- if (x2 == x1 && y2 == y1)
- selfJoin = TRUE;
- }
- else if (x2 == pPts[npt-1].x && y2 == pPts[npt-1].y)
- {
- selfJoin = TRUE;
- }
- }
- projectLeft = GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_PROJECTING && !selfJoin;
- projectRight = FALSE;
- while (--npt)
- {
- x1 = x2;
- y1 = y2;
- ++pPts;
- x2 = pPts->x;
- y2 = pPts->y;
- if (0 /* mode == CoordModePrevious */)
- {
- x2 += x1;
- y2 += y1;
- }
- if (x1 != x2 || y1 != y2)
- {
- somethingDrawn = TRUE;
- if (npt == 1 && GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_PROJECTING && !selfJoin)
- projectRight = TRUE;
- miWideSegment (pDrawable, pGC, &pixel, spanData, x1, y1, x2, y2,
- projectLeft, projectRight, &leftFace, &rightFace);
- if (first)
- {
- if (selfJoin)
- firstFace = leftFace;
- else if (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND)
- {
- if (GDK_GC_FBDATA(pGC)->values.line_width == 1 && !spanData)
- miLineOnePoint (pDrawable, pGC, &pixel, spanData, x1, y1);
- else
- miLineArc (pDrawable, pGC, &pixel, spanData,
- &leftFace, (LineFacePtr) NULL,
- (double)0.0, (double)0.0,
- TRUE);
- }
- }
- else
- {
- miLineJoin (pDrawable, pGC, &pixel, spanData, &leftFace,
- &prevRightFace);
- }
- prevRightFace = rightFace;
- first = FALSE;
- projectLeft = FALSE;
- }
- if (npt == 1 && somethingDrawn)
- {
- if (selfJoin)
- miLineJoin (pDrawable, pGC, &pixel, spanData, &firstFace,
- &rightFace);
- else if (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND)
- {
- if (GDK_GC_FBDATA(pGC)->values.line_width == 1 && !spanData)
- miLineOnePoint (pDrawable, pGC, &pixel, spanData, x2, y2);
- else
- miLineArc (pDrawable, pGC, &pixel, spanData,
- (LineFacePtr) NULL, &rightFace,
- (double)0.0, (double)0.0,
- TRUE);
- }
- }
- }
- /* handle crock where all points are coincedent */
- if (!somethingDrawn)
- {
- projectLeft = GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_PROJECTING;
- miWideSegment (pDrawable, pGC, &pixel, spanData,
- x2, y2, x2, y2, projectLeft, projectLeft,
- &leftFace, &rightFace);
- if (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND)
- {
- miLineArc (pDrawable, pGC, &pixel, spanData,
- &leftFace, (LineFacePtr) NULL,
- (double)0.0, (double)0.0,
- TRUE);
- rightFace.dx = -1; /* sleezy hack to make it work */
- miLineArc (pDrawable, pGC, &pixel, spanData,
- (LineFacePtr) NULL, &rightFace,
- (double)0.0, (double)0.0,
- TRUE);
- }
- }
- if (spanData)
- miCleanupSpanData (pDrawable, pGC, spanData);
-}
-
-#define V_TOP 0
-#define V_RIGHT 1
-#define V_BOTTOM 2
-#define V_LEFT 3
-
-static void
-miWideDashSegment (GdkDrawable *pDrawable, register GdkGC *pGC,
- SpanDataPtr spanData, int *pDashOffset, int *pDashIndex,
- int x1, int y1, int x2, int y2, gboolean projectLeft,
- gboolean projectRight, LineFacePtr leftFace,
- LineFacePtr rightFace)
-{
- int dashIndex, dashRemain;
- unsigned char *pDash;
- double L, l;
- double k;
- PolyVertexRec vertices[4];
- PolyVertexRec saveRight, saveBottom;
- PolySlopeRec slopes[4];
- PolyEdgeRec left[2], right[2];
- LineFaceRec lcapFace, rcapFace;
- int nleft, nright;
- int h;
- int y;
- int dy, dx;
- GdkColor pixel;
- double LRemain;
- double r;
- double rdx, rdy;
- double dashDx, dashDy;
- double saveK = 0.0;
- gboolean first = TRUE;
- double lcenterx, lcentery, rcenterx = 0.0, rcentery = 0.0;
- GdkColor fgPixel, bgPixel;
-
- dx = x2 - x1;
- dy = y2 - y1;
- dashIndex = *pDashIndex;
- pDash = GDK_GC_FBDATA(pGC)->dash_list;
- dashRemain = pDash[dashIndex] - *pDashOffset;
- fgPixel = GDK_GC_FBDATA(pGC)->values.foreground;
- bgPixel = GDK_GC_FBDATA(pGC)->values.background;
- if (GDK_GC_FBDATA(pGC)->values.fill == GDK_OPAQUE_STIPPLED ||
- GDK_GC_FBDATA(pGC)->values.fill == GDK_TILED)
- {
- bgPixel = fgPixel;
- }
-
- l = ((double) GDK_GC_FBDATA(pGC)->values.line_width) / 2.0;
- if (dx == 0)
- {
- L = dy;
- rdx = 0;
- rdy = l;
- if (dy < 0)
- {
- L = -dy;
- rdy = -l;
- }
- }
- else if (dy == 0)
- {
- L = dx;
- rdx = l;
- rdy = 0;
- if (dx < 0)
- {
- L = -dx;
- rdx = -l;
- }
- }
- else
- {
- L = hypot ((double) dx, (double) dy);
- r = l / L;
-
- rdx = r * dx;
- rdy = r * dy;
- }
- k = l * L;
- LRemain = L;
- /* All position comments are relative to a line with dx and dy > 0,
- * but the code does not depend on this */
- /* top */
- slopes[V_TOP].dx = dx;
- slopes[V_TOP].dy = dy;
- slopes[V_TOP].k = k;
- /* right */
- slopes[V_RIGHT].dx = -dy;
- slopes[V_RIGHT].dy = dx;
- slopes[V_RIGHT].k = 0;
- /* bottom */
- slopes[V_BOTTOM].dx = -dx;
- slopes[V_BOTTOM].dy = -dy;
- slopes[V_BOTTOM].k = k;
- /* left */
- slopes[V_LEFT].dx = dy;
- slopes[V_LEFT].dy = -dx;
- slopes[V_LEFT].k = 0;
-
- /* preload the start coordinates */
- vertices[V_RIGHT].x = vertices[V_TOP].x = rdy;
- vertices[V_RIGHT].y = vertices[V_TOP].y = -rdx;
-
- vertices[V_BOTTOM].x = vertices[V_LEFT].x = -rdy;
- vertices[V_BOTTOM].y = vertices[V_LEFT].y = rdx;
-
- if (projectLeft)
- {
- vertices[V_TOP].x -= rdx;
- vertices[V_TOP].y -= rdy;
-
- vertices[V_LEFT].x -= rdx;
- vertices[V_LEFT].y -= rdy;
-
- slopes[V_LEFT].k = rdx * dx + rdy * dy;
- }
-
- lcenterx = x1;
- lcentery = y1;
-
- if (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND)
- {
- lcapFace.dx = dx;
- lcapFace.dy = dy;
- lcapFace.x = x1;
- lcapFace.y = y1;
-
- rcapFace.dx = -dx;
- rcapFace.dy = -dy;
- rcapFace.x = x1;
- rcapFace.y = y1;
- }
- while (LRemain > dashRemain)
- {
- dashDx = (dashRemain * dx) / L;
- dashDy = (dashRemain * dy) / L;
-
- rcenterx = lcenterx + dashDx;
- rcentery = lcentery + dashDy;
-
- vertices[V_RIGHT].x += dashDx;
- vertices[V_RIGHT].y += dashDy;
-
- vertices[V_BOTTOM].x += dashDx;
- vertices[V_BOTTOM].y += dashDy;
-
- slopes[V_RIGHT].k = vertices[V_RIGHT].x * dx + vertices[V_RIGHT].y * dy;
-
- if (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH || !(dashIndex & 1))
- {
- if (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_ON_OFF_DASH &&
- GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_PROJECTING)
- {
- saveRight = vertices[V_RIGHT];
- saveBottom = vertices[V_BOTTOM];
- saveK = slopes[V_RIGHT].k;
-
- if (!first)
- {
- vertices[V_TOP].x -= rdx;
- vertices[V_TOP].y -= rdy;
-
- vertices[V_LEFT].x -= rdx;
- vertices[V_LEFT].y -= rdy;
-
- slopes[V_LEFT].k = vertices[V_LEFT].x *
- slopes[V_LEFT].dy -
- vertices[V_LEFT].y *
- slopes[V_LEFT].dx;
- }
-
- vertices[V_RIGHT].x += rdx;
- vertices[V_RIGHT].y += rdy;
-
- vertices[V_BOTTOM].x += rdx;
- vertices[V_BOTTOM].y += rdy;
-
- slopes[V_RIGHT].k = vertices[V_RIGHT].x *
- slopes[V_RIGHT].dy -
- vertices[V_RIGHT].y *
- slopes[V_RIGHT].dx;
- }
- y = miPolyBuildPoly (vertices, slopes, 4, x1, y1,
- left, right, &nleft, &nright, &h);
- pixel = (dashIndex & 1) ? bgPixel : fgPixel;
- miFillPolyHelper (pDrawable, pGC, &pixel, spanData, y, h, left, right, nleft, nright);
-
- if (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_ON_OFF_DASH)
- {
- switch (GDK_GC_FBDATA(pGC)->values.cap_style)
- {
- case GDK_CAP_PROJECTING:
- vertices[V_BOTTOM] = saveBottom;
- vertices[V_RIGHT] = saveRight;
- slopes[V_RIGHT].k = saveK;
- break;
- case GDK_CAP_ROUND:
- if (!first)
- {
- if (dx < 0)
- {
- lcapFace.xa = -vertices[V_LEFT].x;
- lcapFace.ya = -vertices[V_LEFT].y;
- lcapFace.k = slopes[V_LEFT].k;
- }
- else
- {
- lcapFace.xa = vertices[V_TOP].x;
- lcapFace.ya = vertices[V_TOP].y;
- lcapFace.k = -slopes[V_LEFT].k;
- }
- miLineArc (pDrawable, pGC, &pixel, spanData,
- &lcapFace, (LineFacePtr) NULL,
- lcenterx, lcentery, FALSE);
- }
- if (dx < 0)
- {
- rcapFace.xa = vertices[V_BOTTOM].x;
- rcapFace.ya = vertices[V_BOTTOM].y;
- rcapFace.k = slopes[V_RIGHT].k;
- }
- else
- {
- rcapFace.xa = -vertices[V_RIGHT].x;
- rcapFace.ya = -vertices[V_RIGHT].y;
- rcapFace.k = -slopes[V_RIGHT].k;
- }
- miLineArc (pDrawable, pGC, &pixel, spanData,
- (LineFacePtr) NULL, &rcapFace,
- rcenterx, rcentery, FALSE);
- break;
- default:
- break;
- }
- }
- }
- LRemain -= dashRemain;
- ++dashIndex;
- if (dashIndex == GDK_GC_FBDATA(pGC)->dash_list_len)
- dashIndex = 0;
- dashRemain = pDash[dashIndex];
-
- lcenterx = rcenterx;
- lcentery = rcentery;
-
- vertices[V_TOP] = vertices[V_RIGHT];
- vertices[V_LEFT] = vertices[V_BOTTOM];
- slopes[V_LEFT].k = -slopes[V_RIGHT].k;
- first = FALSE;
- }
-
- if (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH || !(dashIndex & 1))
- {
- vertices[V_TOP].x -= dx;
- vertices[V_TOP].y -= dy;
-
- vertices[V_LEFT].x -= dx;
- vertices[V_LEFT].y -= dy;
-
- vertices[V_RIGHT].x = rdy;
- vertices[V_RIGHT].y = -rdx;
-
- vertices[V_BOTTOM].x = -rdy;
- vertices[V_BOTTOM].y = rdx;
-
-
- if (projectRight)
- {
- vertices[V_RIGHT].x += rdx;
- vertices[V_RIGHT].y += rdy;
-
- vertices[V_BOTTOM].x += rdx;
- vertices[V_BOTTOM].y += rdy;
- slopes[V_RIGHT].k = vertices[V_RIGHT].x *
- slopes[V_RIGHT].dy -
- vertices[V_RIGHT].y *
- slopes[V_RIGHT].dx;
- }
- else
- slopes[V_RIGHT].k = 0;
-
- if (!first && GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_ON_OFF_DASH &&
- GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_PROJECTING)
- {
- vertices[V_TOP].x -= rdx;
- vertices[V_TOP].y -= rdy;
-
- vertices[V_LEFT].x -= rdx;
- vertices[V_LEFT].y -= rdy;
- slopes[V_LEFT].k = vertices[V_LEFT].x *
- slopes[V_LEFT].dy -
- vertices[V_LEFT].y *
- slopes[V_LEFT].dx;
- }
- else
- slopes[V_LEFT].k += dx * dx + dy * dy;
-
-
- y = miPolyBuildPoly (vertices, slopes, 4, x2, y2,
- left, right, &nleft, &nright, &h);
-
- pixel = (dashIndex & 1) ? GDK_GC_FBDATA(pGC)->values.background : GDK_GC_FBDATA(pGC)->values.foreground;
- miFillPolyHelper (pDrawable, pGC, &pixel, spanData, y, h, left, right, nleft, nright);
- if (!first && GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_ON_OFF_DASH &&
- GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND)
- {
- lcapFace.x = x2;
- lcapFace.y = y2;
- if (dx < 0)
- {
- lcapFace.xa = -vertices[V_LEFT].x;
- lcapFace.ya = -vertices[V_LEFT].y;
- lcapFace.k = slopes[V_LEFT].k;
- }
- else
- {
- lcapFace.xa = vertices[V_TOP].x;
- lcapFace.ya = vertices[V_TOP].y;
- lcapFace.k = -slopes[V_LEFT].k;
- }
- miLineArc (pDrawable, pGC, &pixel, spanData,
- &lcapFace, (LineFacePtr) NULL,
- rcenterx, rcentery, FALSE);
- }
- }
- dashRemain = ((double) dashRemain) - LRemain;
- if (dashRemain == 0)
- {
- dashIndex++;
- if (dashIndex == GDK_GC_FBDATA(pGC)->dash_list_len)
- dashIndex = 0;
- dashRemain = pDash[dashIndex];
- }
-
- leftFace->x = x1;
- leftFace->y = y1;
- leftFace->dx = dx;
- leftFace->dy = dy;
- leftFace->xa = rdy;
- leftFace->ya = -rdx;
- leftFace->k = k;
-
- rightFace->x = x2;
- rightFace->y = y2;
- rightFace->dx = -dx;
- rightFace->dy = -dy;
- rightFace->xa = -rdy;
- rightFace->ya = rdx;
- rightFace->k = k;
-
- *pDashIndex = dashIndex;
- *pDashOffset = pDash[dashIndex] - dashRemain;
-}
-
-void
-miWideDash (GdkDrawable *pDrawable, register GdkGC *pGC, int mode,
- register int npt, register GdkPoint *pPts)
-{
- int x1, y1, x2, y2;
- GdkColor pixel;
- gboolean projectLeft, projectRight;
- LineFaceRec leftFace, rightFace, prevRightFace;
- LineFaceRec firstFace;
- int first;
- int dashIndex, dashOffset;
- register int prevDashIndex;
- SpanDataRec spanDataRec;
- SpanDataPtr spanData;
- gboolean somethingDrawn = FALSE;
- gboolean selfJoin;
- gboolean endIsFg = FALSE, startIsFg = FALSE;
- gboolean firstIsFg = FALSE, prevIsFg = FALSE;
-
-#ifndef XFree86Server
- /* XXX backward compatibility */
- if (GDK_GC_FBDATA(pGC)->values.line_width == 0)
- {
- miZeroDashLine (pDrawable, pGC, mode, npt, pPts);
- return;
- }
-#endif
- if (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH &&
- (GDK_GC_FBDATA(pGC)->values.fill == GDK_OPAQUE_STIPPLED || GDK_GC_FBDATA(pGC)->values.fill == GDK_TILED))
- {
- miWideLine (pDrawable, pGC, mode, npt, pPts);
- return;
- }
- if (npt == 0)
- return;
- spanData = miSetupSpanData (pGC, &spanDataRec, npt);
- x2 = pPts->x;
- y2 = pPts->y;
- first = TRUE;
- selfJoin = FALSE;
- if (0 /* mode == CoordModePrevious */)
- {
- int nptTmp;
- GdkPoint* pPtsTmp;
-
- x1 = x2;
- y1 = y2;
- nptTmp = npt;
- pPtsTmp = pPts + 1;
- while (--nptTmp)
- {
- x1 += pPtsTmp->x;
- y1 += pPtsTmp->y;
- ++pPtsTmp;
- }
- if (x2 == x1 && y2 == y1)
- selfJoin = TRUE;
- }
- else if (x2 == pPts[npt-1].x && y2 == pPts[npt-1].y)
- {
- selfJoin = TRUE;
- }
- projectLeft = GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_PROJECTING && !selfJoin;
- projectRight = FALSE;
- dashIndex = 0;
- dashOffset = 0;
- miStepDash (GDK_GC_FBDATA(pGC)->dash_offset, &dashIndex,
- GDK_GC_FBDATA(pGC)->dash_list, (int)GDK_GC_FBDATA(pGC)->dash_list_len, &dashOffset);
- while (--npt)
- {
- x1 = x2;
- y1 = y2;
- ++pPts;
- x2 = pPts->x;
- y2 = pPts->y;
- if (0 /* mode == CoordModePrevious */)
- {
- x2 += x1;
- y2 += y1;
- }
- if (x1 != x2 || y1 != y2)
- {
- somethingDrawn = TRUE;
- if (npt == 1 && GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_PROJECTING &&
- (!selfJoin || !firstIsFg))
- projectRight = TRUE;
- prevDashIndex = dashIndex;
- miWideDashSegment (pDrawable, pGC, spanData, &dashOffset, &dashIndex,
- x1, y1, x2, y2,
- projectLeft, projectRight, &leftFace, &rightFace);
- startIsFg = !(prevDashIndex & 1);
- endIsFg = (dashIndex & 1) ^ (dashOffset != 0);
- if (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH || startIsFg)
- {
- pixel = startIsFg ? GDK_GC_FBDATA(pGC)->values.foreground : GDK_GC_FBDATA(pGC)->values.background;
- if (first || (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_ON_OFF_DASH && !prevIsFg))
- {
- if (first && selfJoin)
- {
- firstFace = leftFace;
- firstIsFg = startIsFg;
- }
- else if (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND)
- miLineArc (pDrawable, pGC, &pixel, spanData,
- &leftFace, (LineFacePtr) NULL,
- (double)0.0, (double)0.0, TRUE);
- }
- else
- {
- miLineJoin (pDrawable, pGC, &pixel, spanData, &leftFace,
- &prevRightFace);
- }
- }
- prevRightFace = rightFace;
- prevIsFg = endIsFg;
- first = FALSE;
- projectLeft = FALSE;
- }
- if (npt == 1 && somethingDrawn)
- {
- if (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH || endIsFg)
- {
- pixel = endIsFg ? GDK_GC_FBDATA(pGC)->values.foreground : GDK_GC_FBDATA(pGC)->values.background;
- if (selfJoin && (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH || firstIsFg))
- {
- miLineJoin (pDrawable, pGC, &pixel, spanData, &firstFace,
- &rightFace);
- }
- else
- {
- if (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND)
- miLineArc (pDrawable, pGC, &pixel, spanData,
- (LineFacePtr) NULL, &rightFace,
- (double)0.0, (double)0.0, TRUE);
- }
- }
- else
- {
- /* glue a cap to the start of the line if
- * we're OnOffDash and ended on odd dash
- */
- if (selfJoin && firstIsFg)
- {
- pixel = GDK_GC_FBDATA(pGC)->values.foreground;
- if (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_PROJECTING)
- miLineProjectingCap (pDrawable, pGC, &pixel, spanData,
- &firstFace, TRUE,
- (double)0.0, (double)0.0, TRUE);
- else if (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND)
- miLineArc (pDrawable, pGC, &pixel, spanData,
- &firstFace, (LineFacePtr) NULL,
- (double)0.0, (double)0.0, TRUE);
- }
- }
- }
- }
- /* handle crock where all points are coincident */
- if (!somethingDrawn && (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH || !(dashIndex & 1)))
- {
- /* not the same as endIsFg computation above */
- pixel = (dashIndex & 1) ? GDK_GC_FBDATA(pGC)->values.background : GDK_GC_FBDATA(pGC)->values.foreground;
- switch (GDK_GC_FBDATA(pGC)->values.cap_style) {
- case GDK_CAP_ROUND:
- miLineArc (pDrawable, pGC, &pixel, spanData,
- (LineFacePtr) NULL, (LineFacePtr) NULL,
- (double)x2, (double)y2,
- FALSE);
- break;
- case GDK_CAP_PROJECTING:
- x1 = GDK_GC_FBDATA(pGC)->values.line_width;
- miFillRectPolyHelper (pDrawable, pGC, &pixel, spanData,
- x2 - (x1 >> 1), y2 - (x1 >> 1), x1, x1);
- break;
- default:
- break;
- }
- }
- if (spanData)
- miCleanupSpanData (pDrawable, pGC, spanData);
-}
-
-/* these are stubs to allow old ddx miValidateGCs to work without change */
-
-void
-miMiter(void)
-{
-}
-
-void
-miNotMiter(void)
-{
-}
diff --git a/gdk/linux-fb/miwideline.h b/gdk/linux-fb/miwideline.h
deleted file mode 100644
index b4e60bc3c..000000000
--- a/gdk/linux-fb/miwideline.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/* $TOG: miwideline.h /main/12 1998/02/09 14:49:26 kaleb $ */
-/*
-
-Copyright 1988, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-/* $XFree86: xc/programs/Xserver/mi/miwideline.h,v 1.7 1998/10/04 09:39:35 dawes Exp $ */
-
-/* Author: Keith Packard, MIT X Consortium */
-
-#ifndef MI_WIDELINE_H
-#define MI_WIDELINE_H 1
-
-#include "mispans.h"
-
-/*
- * interface data to span-merging polygon filler
- */
-
-typedef struct _SpanData {
- SpanGroup fgGroup, bgGroup;
-} SpanDataRec, *SpanDataPtr;
-
-#define AppendSpanGroup(pGC, pixel, spanPtr, spanData) { \
- SpanGroup *group, *othergroup = NULL; \
- if (pixel->pixel == GDK_GC_FBDATA(pGC)->values.foreground.pixel) \
- { \
- group = &spanData->fgGroup; \
- if (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH) \
- othergroup = &spanData->bgGroup; \
- } \
- else \
- { \
- group = &spanData->bgGroup; \
- othergroup = &spanData->fgGroup; \
- } \
- miAppendSpans (group, othergroup, spanPtr); \
-}
-
-/*
- * Polygon edge description for integer wide-line routines
- */
-
-typedef struct _PolyEdge {
- int height; /* number of scanlines to process */
- int x; /* starting x coordinate */
- int stepx; /* fixed integral dx */
- int signdx; /* variable dx sign */
- int e; /* initial error term */
- int dy;
- int dx;
-} PolyEdgeRec, *PolyEdgePtr;
-
-#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */
-
-/*
- * types for general polygon routines
- */
-
-typedef struct _PolyVertex {
- double x, y;
-} PolyVertexRec, *PolyVertexPtr;
-
-typedef struct _PolySlope {
- int dx, dy;
- double k; /* x0 * dy - y0 * dx */
-} PolySlopeRec, *PolySlopePtr;
-
-/*
- * Line face description for caps/joins
- */
-
-typedef struct _LineFace {
- double xa, ya;
- int dx, dy;
- int x, y;
- double k;
-} LineFaceRec, *LineFacePtr;
-
-/*
- * macros for polygon fillers
- */
-
-#define MIPOLYRELOADLEFT if (!left_height && left_count) { \
- left_height = left->height; \
- left_x = left->x; \
- left_stepx = left->stepx; \
- left_signdx = left->signdx; \
- left_e = left->e; \
- left_dy = left->dy; \
- left_dx = left->dx; \
- --left_count; \
- ++left; \
- }
-
-#define MIPOLYRELOADRIGHT if (!right_height && right_count) { \
- right_height = right->height; \
- right_x = right->x; \
- right_stepx = right->stepx; \
- right_signdx = right->signdx; \
- right_e = right->e; \
- right_dy = right->dy; \
- right_dx = right->dx; \
- --right_count; \
- ++right; \
- }
-
-#define MIPOLYSTEPLEFT left_x += left_stepx; \
- left_e += left_dx; \
- if (left_e > 0) \
- { \
- left_x += left_signdx; \
- left_e -= left_dy; \
- }
-
-#define MIPOLYSTEPRIGHT right_x += right_stepx; \
- right_e += right_dx; \
- if (right_e > 0) \
- { \
- right_x += right_signdx; \
- right_e -= right_dy; \
- }
-
-#define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
- oldPixel = GDK_GC_FBDATA(pGC)->values.foreground; \
- if (pixel->pixel != oldPixel.pixel) { \
- gdk_gc_set_foreground(pGC, pixel); \
- } \
-}
-#define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
- if (pixel->pixel != oldPixel.pixel) { \
- gdk_gc_set_foreground(pGC, &oldPixel); \
- } \
-}
-
-#ifndef ICEIL
-#ifdef NOINLINEICEIL
-#define ICEIL(x) ((int)ceil(x))
-#else
-#ifdef __GNUC__
-#define ICEIL ICIEL
-static __inline int ICEIL(double x)
-{
- int _cTmp = x;
- return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1;
-}
-#else
-#define ICEIL(x) ((((x) == (_cTmp = (x))) || ((x) < 0.0)) ? _cTmp : _cTmp+1)
-#define ICEILTEMPDECL static int _cTmp;
-#endif
-#endif
-#endif
-
-extern void miFillPolyHelper(GdkDrawable* pDrawable, GdkGC* pGC,
- GdkColor * pixel, SpanDataPtr spanData, int y,
- int overall_height, PolyEdgePtr left,
- PolyEdgePtr right, int left_count,
- int right_count);
-
-extern int miRoundJoinFace(LineFacePtr face, PolyEdgePtr edge,
- gboolean * leftEdge);
-
-extern void miRoundJoinClip(LineFacePtr pLeft, LineFacePtr pRight,
- PolyEdgePtr edge1, PolyEdgePtr edge2, int *y1,
- int *y2, gboolean *left1, gboolean *left2);
-
-extern int miRoundCapClip(LineFacePtr face, gboolean isInt, PolyEdgePtr edge,
- gboolean *leftEdge);
-
-extern void miLineProjectingCap(GdkDrawable* pDrawable, GdkGC* pGC,
- GdkColor *pixel, SpanDataPtr spanData,
- LineFacePtr face, gboolean isLeft,
- double xorg, double yorg, gboolean isInt);
-
-extern SpanDataPtr miSetupSpanData(GdkGC* pGC, SpanDataPtr spanData, int npt);
-
-extern void miCleanupSpanData(GdkDrawable* pDrawable, GdkGC* pGC,
- SpanDataPtr spanData);
-
-extern int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy,
- int xi, int yi, int left, PolyEdgePtr edge);
-extern int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes,
- int count, int xi, int yi, PolyEdgePtr left,
- PolyEdgePtr right, int *pnleft, int *pnright,
- int *h);
-
-#endif
diff --git a/gdk/linux-fb/mizerclip.c b/gdk/linux-fb/mizerclip.c
deleted file mode 100644
index 72b6bc756..000000000
--- a/gdk/linux-fb/mizerclip.c
+++ /dev/null
@@ -1,617 +0,0 @@
-/* $XFree86: xc/programs/Xserver/mi/mizerclip.c,v 1.1 1999/10/13 22:33:13 dawes Exp $ */
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#include <config.h>
-#include "mi.h"
-#include "miline.h"
-
-/*
-
-The bresenham error equation used in the mi/mfb/cfb line routines is:
-
- e = error
- dx = difference in raw X coordinates
- dy = difference in raw Y coordinates
- M = # of steps in X direction
- N = # of steps in Y direction
- B = 0 to prefer diagonal steps in a given octant,
- 1 to prefer axial steps in a given octant
-
- For X major lines:
- e = 2Mdy - 2Ndx - dx - B
- -2dx <= e < 0
-
- For Y major lines:
- e = 2Ndx - 2Mdy - dy - B
- -2dy <= e < 0
-
-At the start of the line, we have taken 0 X steps and 0 Y steps,
-so M = 0 and N = 0:
-
- X major e = 2Mdy - 2Ndx - dx - B
- = -dx - B
-
- Y major e = 2Ndx - 2Mdy - dy - B
- = -dy - B
-
-At the end of the line, we have taken dx X steps and dy Y steps,
-so M = dx and N = dy:
-
- X major e = 2Mdy - 2Ndx - dx - B
- = 2dxdy - 2dydx - dx - B
- = -dx - B
- Y major e = 2Ndx - 2Mdy - dy - B
- = 2dydx - 2dxdy - dy - B
- = -dy - B
-
-Thus, the error term is the same at the start and end of the line.
-
-Let us consider clipping an X coordinate. There are 4 cases which
-represent the two independent cases of clipping the start vs. the
-end of the line and an X major vs. a Y major line. In any of these
-cases, we know the number of X steps (M) and we wish to find the
-number of Y steps (N). Thus, we will solve our error term equation.
-If we are clipping the start of the line, we will find the smallest
-N that satisfies our error term inequality. If we are clipping the
-end of the line, we will find the largest number of Y steps that
-satisfies the inequality. In that case, since we are representing
-the Y steps as (dy - N), we will actually want to solve for the
-smallest N in that equation.
-
-Case 1: X major, starting X coordinate moved by M steps
-
- -2dx <= 2Mdy - 2Ndx - dx - B < 0
- 2Ndx <= 2Mdy - dx - B + 2dx 2Ndx > 2Mdy - dx - B
- 2Ndx <= 2Mdy + dx - B N > (2Mdy - dx - B) / 2dx
- N <= (2Mdy + dx - B) / 2dx
-
-Since we are trying to find the smallest N that satisfies these
-equations, we should use the > inequality to find the smallest:
-
- N = floor((2Mdy - dx - B) / 2dx) + 1
- = floor((2Mdy - dx - B + 2dx) / 2dx)
- = floor((2Mdy + dx - B) / 2dx)
-
-Case 1b: X major, ending X coordinate moved to M steps
-
-Same derivations as Case 1, but we want the largest N that satisfies
-the equations, so we use the <= inequality:
-
- N = floor((2Mdy + dx - B) / 2dx)
-
-Case 2: X major, ending X coordinate moved by M steps
-
- -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0
- -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0
- -2dx <= 2Ndx - 2Mdy - dx - B < 0
- 2Ndx >= 2Mdy + dx + B - 2dx 2Ndx < 2Mdy + dx + B
- 2Ndx >= 2Mdy - dx + B N < (2Mdy + dx + B) / 2dx
- N >= (2Mdy - dx + B) / 2dx
-
-Since we are trying to find the highest number of Y steps that
-satisfies these equations, we need to find the smallest N, so
-we should use the >= inequality to find the smallest:
-
- N = ceiling((2Mdy - dx + B) / 2dx)
- = floor((2Mdy - dx + B + 2dx - 1) / 2dx)
- = floor((2Mdy + dx + B - 1) / 2dx)
-
-Case 2b: X major, starting X coordinate moved to M steps from end
-
-Same derivations as Case 2, but we want the smallest number of Y
-steps, so we want the highest N, so we use the < inequality:
-
- N = ceiling((2Mdy + dx + B) / 2dx) - 1
- = floor((2Mdy + dx + B + 2dx - 1) / 2dx) - 1
- = floor((2Mdy + dx + B + 2dx - 1 - 2dx) / 2dx)
- = floor((2Mdy + dx + B - 1) / 2dx)
-
-Case 3: Y major, starting X coordinate moved by M steps
-
- -2dy <= 2Ndx - 2Mdy - dy - B < 0
- 2Ndx >= 2Mdy + dy + B - 2dy 2Ndx < 2Mdy + dy + B
- 2Ndx >= 2Mdy - dy + B N < (2Mdy + dy + B) / 2dx
- N >= (2Mdy - dy + B) / 2dx
-
-Since we are trying to find the smallest N that satisfies these
-equations, we should use the >= inequality to find the smallest:
-
- N = ceiling((2Mdy - dy + B) / 2dx)
- = floor((2Mdy - dy + B + 2dx - 1) / 2dx)
- = floor((2Mdy - dy + B - 1) / 2dx) + 1
-
-Case 3b: Y major, ending X coordinate moved to M steps
-
-Same derivations as Case 3, but we want the largest N that satisfies
-the equations, so we use the < inequality:
-
- N = ceiling((2Mdy + dy + B) / 2dx) - 1
- = floor((2Mdy + dy + B + 2dx - 1) / 2dx) - 1
- = floor((2Mdy + dy + B + 2dx - 1 - 2dx) / 2dx)
- = floor((2Mdy + dy + B - 1) / 2dx)
-
-Case 4: Y major, ending X coordinate moved by M steps
-
- -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0
- -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0
- -2dy <= 2Mdy - 2Ndx - dy - B < 0
- 2Ndx <= 2Mdy - dy - B + 2dy 2Ndx > 2Mdy - dy - B
- 2Ndx <= 2Mdy + dy - B N > (2Mdy - dy - B) / 2dx
- N <= (2Mdy + dy - B) / 2dx
-
-Since we are trying to find the highest number of Y steps that
-satisfies these equations, we need to find the smallest N, so
-we should use the > inequality to find the smallest:
-
- N = floor((2Mdy - dy - B) / 2dx) + 1
-
-Case 4b: Y major, starting X coordinate moved to M steps from end
-
-Same analysis as Case 4, but we want the smallest number of Y steps
-which means the largest N, so we use the <= inequality:
-
- N = floor((2Mdy + dy - B) / 2dx)
-
-Now let's try the Y coordinates, we have the same 4 cases.
-
-Case 5: X major, starting Y coordinate moved by N steps
-
- -2dx <= 2Mdy - 2Ndx - dx - B < 0
- 2Mdy >= 2Ndx + dx + B - 2dx 2Mdy < 2Ndx + dx + B
- 2Mdy >= 2Ndx - dx + B M < (2Ndx + dx + B) / 2dy
- M >= (2Ndx - dx + B) / 2dy
-
-Since we are trying to find the smallest M, we use the >= inequality:
-
- M = ceiling((2Ndx - dx + B) / 2dy)
- = floor((2Ndx - dx + B + 2dy - 1) / 2dy)
- = floor((2Ndx - dx + B - 1) / 2dy) + 1
-
-Case 5b: X major, ending Y coordinate moved to N steps
-
-Same derivations as Case 5, but we want the largest M that satisfies
-the equations, so we use the < inequality:
-
- M = ceiling((2Ndx + dx + B) / 2dy) - 1
- = floor((2Ndx + dx + B + 2dy - 1) / 2dy) - 1
- = floor((2Ndx + dx + B + 2dy - 1 - 2dy) / 2dy)
- = floor((2Ndx + dx + B - 1) / 2dy)
-
-Case 6: X major, ending Y coordinate moved by N steps
-
- -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0
- -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0
- -2dx <= 2Ndx - 2Mdy - dx - B < 0
- 2Mdy <= 2Ndx - dx - B + 2dx 2Mdy > 2Ndx - dx - B
- 2Mdy <= 2Ndx + dx - B M > (2Ndx - dx - B) / 2dy
- M <= (2Ndx + dx - B) / 2dy
-
-Largest # of X steps means smallest M, so use the > inequality:
-
- M = floor((2Ndx - dx - B) / 2dy) + 1
-
-Case 6b: X major, starting Y coordinate moved to N steps from end
-
-Same derivations as Case 6, but we want the smallest # of X steps
-which means the largest M, so use the <= inequality:
-
- M = floor((2Ndx + dx - B) / 2dy)
-
-Case 7: Y major, starting Y coordinate moved by N steps
-
- -2dy <= 2Ndx - 2Mdy - dy - B < 0
- 2Mdy <= 2Ndx - dy - B + 2dy 2Mdy > 2Ndx - dy - B
- 2Mdy <= 2Ndx + dy - B M > (2Ndx - dy - B) / 2dy
- M <= (2Ndx + dy - B) / 2dy
-
-To find the smallest M, use the > inequality:
-
- M = floor((2Ndx - dy - B) / 2dy) + 1
- = floor((2Ndx - dy - B + 2dy) / 2dy)
- = floor((2Ndx + dy - B) / 2dy)
-
-Case 7b: Y major, ending Y coordinate moved to N steps
-
-Same derivations as Case 7, but we want the largest M that satisfies
-the equations, so use the <= inequality:
-
- M = floor((2Ndx + dy - B) / 2dy)
-
-Case 8: Y major, ending Y coordinate moved by N steps
-
- -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0
- -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0
- -2dy <= 2Mdy - 2Ndx - dy - B < 0
- 2Mdy >= 2Ndx + dy + B - 2dy 2Mdy < 2Ndx + dy + B
- 2Mdy >= 2Ndx - dy + B M < (2Ndx + dy + B) / 2dy
- M >= (2Ndx - dy + B) / 2dy
-
-To find the highest X steps, find the smallest M, use the >= inequality:
-
- M = ceiling((2Ndx - dy + B) / 2dy)
- = floor((2Ndx - dy + B + 2dy - 1) / 2dy)
- = floor((2Ndx + dy + B - 1) / 2dy)
-
-Case 8b: Y major, starting Y coordinate moved to N steps from the end
-
-Same derivations as Case 8, but we want to find the smallest # of X
-steps which means the largest M, so we use the < inequality:
-
- M = ceiling((2Ndx + dy + B) / 2dy) - 1
- = floor((2Ndx + dy + B + 2dy - 1) / 2dy) - 1
- = floor((2Ndx + dy + B + 2dy - 1 - 2dy) / 2dy)
- = floor((2Ndx + dy + B - 1) / 2dy)
-
-So, our equations are:
-
- 1: X major move x1 to x1+M floor((2Mdy + dx - B) / 2dx)
- 1b: X major move x2 to x1+M floor((2Mdy + dx - B) / 2dx)
- 2: X major move x2 to x2-M floor((2Mdy + dx + B - 1) / 2dx)
- 2b: X major move x1 to x2-M floor((2Mdy + dx + B - 1) / 2dx)
-
- 3: Y major move x1 to x1+M floor((2Mdy - dy + B - 1) / 2dx) + 1
- 3b: Y major move x2 to x1+M floor((2Mdy + dy + B - 1) / 2dx)
- 4: Y major move x2 to x2-M floor((2Mdy - dy - B) / 2dx) + 1
- 4b: Y major move x1 to x2-M floor((2Mdy + dy - B) / 2dx)
-
- 5: X major move y1 to y1+N floor((2Ndx - dx + B - 1) / 2dy) + 1
- 5b: X major move y2 to y1+N floor((2Ndx + dx + B - 1) / 2dy)
- 6: X major move y2 to y2-N floor((2Ndx - dx - B) / 2dy) + 1
- 6b: X major move y1 to y2-N floor((2Ndx + dx - B) / 2dy)
-
- 7: Y major move y1 to y1+N floor((2Ndx + dy - B) / 2dy)
- 7b: Y major move y2 to y1+N floor((2Ndx + dy - B) / 2dy)
- 8: Y major move y2 to y2-N floor((2Ndx + dy + B - 1) / 2dy)
- 8b: Y major move y1 to y2-N floor((2Ndx + dy + B - 1) / 2dy)
-
-We have the following constraints on all of the above terms:
-
- 0 < M,N <= 2^15 2^15 can be imposed by miZeroClipLine
- 0 <= dx/dy <= 2^16 - 1
- 0 <= B <= 1
-
-The floor in all of the above equations can be accomplished with a
-simple C divide operation provided that both numerator and denominator
-are positive.
-
-Since dx,dy >= 0 and since moving an X coordinate implies that dx != 0
-and moving a Y coordinate implies dy != 0, we know that the denominators
-are all > 0.
-
-For all lines, (-B) and (B-1) are both either 0 or -1, depending on the
-bias. Thus, we have to show that the 2MNdxy +/- dxy terms are all >= 1
-or > 0 to prove that the numerators are positive (or zero).
-
-For X Major lines we know that dx > 0 and since 2Mdy is >= 0 due to the
-constraints, the first four equations all have numerators >= 0.
-
-For the second four equations, M > 0, so 2Mdy >= 2dy so (2Mdy - dy) >= dy
-So (2Mdy - dy) > 0, since they are Y major lines. Also, (2Mdy + dy) >= 3dy
-or (2Mdy + dy) > 0. So all of their numerators are >= 0.
-
-For the third set of four equations, N > 0, so 2Ndx >= 2dx so (2Ndx - dx)
->= dx > 0. Similarly (2Ndx + dx) >= 3dx > 0. So all numerators >= 0.
-
-For the fourth set of equations, dy > 0 and 2Ndx >= 0, so all numerators
-are > 0.
-
-To consider overflow, consider the case of 2 * M,N * dx,dy + dx,dy. This
-is bounded <= 2 * 2^15 * (2^16 - 1) + (2^16 - 1)
- <= 2^16 * (2^16 - 1) + (2^16 - 1)
- <= 2^32 - 2^16 + 2^16 - 1
- <= 2^32 - 1
-Since the (-B) and (B-1) terms are all 0 or -1, the maximum value of
-the numerator is therefore (2^32 - 1), which does not overflow an unsigned
-32 bit variable.
-
-*/
-
-/* Bit codes for the terms of the 16 clipping equations defined below. */
-
-#define T_2NDX (1 << 0)
-#define T_2MDY (0) /* implicit term */
-#define T_DXNOTY (1 << 1)
-#define T_DYNOTX (0) /* implicit term */
-#define T_SUBDXORY (1 << 2)
-#define T_ADDDX (T_DXNOTY) /* composite term */
-#define T_SUBDX (T_DXNOTY | T_SUBDXORY) /* composite term */
-#define T_ADDDY (T_DYNOTX) /* composite term */
-#define T_SUBDY (T_DYNOTX | T_SUBDXORY) /* composite term */
-#define T_BIASSUBONE (1 << 3)
-#define T_SUBBIAS (0) /* implicit term */
-#define T_DIV2DX (1 << 4)
-#define T_DIV2DY (0) /* implicit term */
-#define T_ADDONE (1 << 5)
-
-/* Bit masks defining the 16 equations used in miZeroClipLine. */
-
-#define EQN1 (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX)
-#define EQN1B (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX)
-#define EQN2 (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX)
-#define EQN2B (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX)
-
-#define EQN3 (T_2MDY | T_SUBDY | T_BIASSUBONE | T_DIV2DX | T_ADDONE)
-#define EQN3B (T_2MDY | T_ADDDY | T_BIASSUBONE | T_DIV2DX)
-#define EQN4 (T_2MDY | T_SUBDY | T_SUBBIAS | T_DIV2DX | T_ADDONE)
-#define EQN4B (T_2MDY | T_ADDDY | T_SUBBIAS | T_DIV2DX)
-
-#define EQN5 (T_2NDX | T_SUBDX | T_BIASSUBONE | T_DIV2DY | T_ADDONE)
-#define EQN5B (T_2NDX | T_ADDDX | T_BIASSUBONE | T_DIV2DY)
-#define EQN6 (T_2NDX | T_SUBDX | T_SUBBIAS | T_DIV2DY | T_ADDONE)
-#define EQN6B (T_2NDX | T_ADDDX | T_SUBBIAS | T_DIV2DY)
-
-#define EQN7 (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY)
-#define EQN7B (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY)
-#define EQN8 (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY)
-#define EQN8B (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY)
-
-/* miZeroClipLine
- *
- * returns: 1 for partially clipped line
- * -1 for completely clipped line
- *
- */
-int
-miZeroClipLine(int xmin, int ymin, int xmax, int ymax,
- int *new_x1, int *new_y1, int *new_x2, int *new_y2,
- unsigned int adx, unsigned int ady,
- int *pt1_clipped, int *pt2_clipped, int octant,
- unsigned int bias, int oc1, int oc2)
-{
- int swapped = 0;
- int clipDone = 0;
- guint32 utmp = 0;
- int clip1, clip2;
- int x1, y1, x2, y2;
- int x1_orig, y1_orig, x2_orig, y2_orig;
- int xmajor;
- int negslope = 0, anchorval = 0;
- unsigned int eqn = 0;
-
- x1 = x1_orig = *new_x1;
- y1 = y1_orig = *new_y1;
- x2 = x2_orig = *new_x2;
- y2 = y2_orig = *new_y2;
-
- clip1 = 0;
- clip2 = 0;
-
- xmajor = IsXMajorOctant(octant);
- bias = ((bias >> octant) & 1);
-
- while (1)
- {
- if ((oc1 & oc2) != 0) /* trivial reject */
- {
- clipDone = -1;
- clip1 = oc1;
- clip2 = oc2;
- break;
- }
- else if ((oc1 | oc2) == 0) /* trivial accept */
- {
- clipDone = 1;
- if (swapped)
- {
- SWAPINT_PAIR(x1, y1, x2, y2);
- SWAPINT(clip1, clip2);
- }
- break;
- }
- else /* have to clip */
- {
- /* only clip one point at a time */
- if (oc1 == 0)
- {
- SWAPINT_PAIR(x1, y1, x2, y2);
- SWAPINT_PAIR(x1_orig, y1_orig, x2_orig, y2_orig);
- SWAPINT(oc1, oc2);
- SWAPINT(clip1, clip2);
- swapped = !swapped;
- }
-
- clip1 |= oc1;
- if (oc1 & OUT_LEFT)
- {
- negslope = IsYDecreasingOctant(octant);
- utmp = xmin - x1_orig;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN2 : EQN1;
- else
- eqn = (swapped) ? EQN4 : EQN3;
- anchorval = y1_orig;
- }
- else /* clip based on far endpt */
- {
- utmp = x2_orig - xmin;
- if (xmajor)
- eqn = (swapped) ? EQN1B : EQN2B;
- else
- eqn = (swapped) ? EQN3B : EQN4B;
- anchorval = y2_orig;
- negslope = !negslope;
- }
- x1 = xmin;
- }
- else if (oc1 & OUT_ABOVE)
- {
- negslope = IsXDecreasingOctant(octant);
- utmp = ymin - y1_orig;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN6 : EQN5;
- else
- eqn = (swapped) ? EQN8 : EQN7;
- anchorval = x1_orig;
- }
- else /* clip based on far endpt */
- {
- utmp = y2_orig - ymin;
- if (xmajor)
- eqn = (swapped) ? EQN5B : EQN6B;
- else
- eqn = (swapped) ? EQN7B : EQN8B;
- anchorval = x2_orig;
- negslope = !negslope;
- }
- y1 = ymin;
- }
- else if (oc1 & OUT_RIGHT)
- {
- negslope = IsYDecreasingOctant(octant);
- utmp = x1_orig - xmax;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN2 : EQN1;
- else
- eqn = (swapped) ? EQN4 : EQN3;
- anchorval = y1_orig;
- }
- else /* clip based on far endpt */
- {
- /*
- * Technically since the equations can handle
- * utmp == 32768, this overflow code isn't
- * needed since X11 protocol can't generate
- * a line which goes more than 32768 pixels
- * to the right of a clip rectangle.
- */
- utmp = xmax - x2_orig;
- if (xmajor)
- eqn = (swapped) ? EQN1B : EQN2B;
- else
- eqn = (swapped) ? EQN3B : EQN4B;
- anchorval = y2_orig;
- negslope = !negslope;
- }
- x1 = xmax;
- }
- else if (oc1 & OUT_BELOW)
- {
- negslope = IsXDecreasingOctant(octant);
- utmp = y1_orig - ymax;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN6 : EQN5;
- else
- eqn = (swapped) ? EQN8 : EQN7;
- anchorval = x1_orig;
- }
- else /* clip based on far endpt */
- {
- /*
- * Technically since the equations can handle
- * utmp == 32768, this overflow code isn't
- * needed since X11 protocol can't generate
- * a line which goes more than 32768 pixels
- * below the bottom of a clip rectangle.
- */
- utmp = ymax - y2_orig;
- if (xmajor)
- eqn = (swapped) ? EQN5B : EQN6B;
- else
- eqn = (swapped) ? EQN7B : EQN8B;
- anchorval = x2_orig;
- negslope = !negslope;
- }
- y1 = ymax;
- }
-
- if (swapped)
- negslope = !negslope;
-
- utmp <<= 1; /* utmp = 2N or 2M */
- if (eqn & T_2NDX)
- utmp = (utmp * adx);
- else /* (eqn & T_2MDY) */
- utmp = (utmp * ady);
- if (eqn & T_DXNOTY)
- if (eqn & T_SUBDXORY)
- utmp -= adx;
- else
- utmp += adx;
- else /* (eqn & T_DYNOTX) */
- if (eqn & T_SUBDXORY)
- utmp -= ady;
- else
- utmp += ady;
- if (eqn & T_BIASSUBONE)
- utmp += bias - 1;
- else /* (eqn & T_SUBBIAS) */
- utmp -= bias;
- if (eqn & T_DIV2DX)
- utmp /= (adx << 1);
- else /* (eqn & T_DIV2DY) */
- utmp /= (ady << 1);
- if (eqn & T_ADDONE)
- utmp++;
-
- if (negslope)
- utmp = -utmp;
-
- if (eqn & T_2NDX) /* We are calculating X steps */
- x1 = anchorval + utmp;
- else /* else, Y steps */
- y1 = anchorval + utmp;
-
- oc1 = 0;
- MIOUTCODES(oc1, x1, y1, xmin, ymin, xmax, ymax);
- }
- }
-
- *new_x1 = x1;
- *new_y1 = y1;
- *new_x2 = x2;
- *new_y2 = y2;
-
- *pt1_clipped = clip1;
- *pt2_clipped = clip2;
-
- return clipDone;
-}
diff --git a/gdk/linux-fb/mizerline.c b/gdk/linux-fb/mizerline.c
deleted file mode 100644
index c9a5ce163..000000000
--- a/gdk/linux-fb/mizerline.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/* $XFree86: xc/programs/Xserver/mi/mizerline.c,v 3.4 1999/10/14 04:43:16 dawes Exp $ */
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* $TOG: mizerline.c /main/18 1998/02/09 14:49:45 kaleb $ */
-
-#include <config.h>
-#include "mi.h"
-#include "miline.h"
-
-/* Draw lineSolid, fillStyle-independent zero width lines.
- *
- * Must keep X and Y coordinates in "ints" at least until after they're
- * translated and clipped to accomodate CoordModePrevious lines with very
- * large coordinates.
- *
- * Draws the same pixels regardless of sign(dx) or sign(dy).
- *
- * Ken Whaley
- *
- */
-
-/* largest positive value that can fit into a component of a point.
- * Assumes that the point structure is {type x, y;} where type is
- * a signed type.
- */
-#define MAX_COORDINATE ((1 << (((sizeof(GdkPoint) >> 1) << 3) - 1)) - 1)
-
-#define MI_OUTPUT_POINT(xx, yy)\
-{\
- if ( !new_span && yy == current_y)\
- {\
- if (xx < spans->x)\
- spans->x = xx;\
- spans->width++; \
- }\
- else\
- {\
- ++Nspans;\
- ++spans;\
- spans->x = xx;\
- spans->y = yy;\
- spans->width = 1; \
- current_y = yy;\
- new_span = FALSE;\
- }\
-}
-
-void
-miZeroLine(GdkDrawable *pDraw, GdkGC *pGC,
- int mode, int npt, GdkPoint *pptInit)
-{
- int Nspans, current_y = 0;
- GdkPoint* ppt;
- GdkSpan* pspanInit, *spans;
- int list_len;
- int xleft, ytop, xright, ybottom;
- int new_x1, new_y1, new_x2, new_y2;
- int x = 0, y = 0, x1, y1, x2, y2, xstart, ystart;
- int oc1, oc2;
- int result;
- int pt1_clipped, pt2_clipped = 0;
- gboolean new_span;
- int signdx, signdy;
- int clipdx, clipdy;
- int width, height;
- int adx, ady;
- int octant;
- unsigned int bias = miGetZeroLineBias();
- int e, e1, e2, e3; /* Bresenham error terms */
- int length; /* length of lines == # of pixels on major axis */
-
- xleft = 0;
- ytop = 0;
- xright = GDK_DRAWABLE_FBDATA(pDraw)->width - 1;
- ybottom = GDK_DRAWABLE_FBDATA(pDraw)->height - 1;
-
- /* it doesn't matter whether we're in drawable or screen coordinates,
- * FillSpans simply cannot take starting coordinates outside of the
- * range of a GdkPoint component.
- */
-
- /* since we're clipping to the drawable's boundaries & coordinate
- * space boundaries, we're guaranteed that the larger of width/height
- * is the longest span we'll need to output
- */
- width = xright - xleft + 1;
- height = ybottom - ytop + 1;
- list_len = (height >= width) ? height : width;
- pspanInit = (GdkSpan*)ALLOCATE_LOCAL(list_len * sizeof(GdkSpan));
- if (!pspanInit)
- return;
-
- Nspans = 0;
- new_span = TRUE;
- spans = pspanInit - 1;
- ppt = pptInit;
-
- xstart = ppt->x;
- ystart = ppt->y;
-
- /* x2, y2, oc2 copied to x1, y1, oc1 at top of loop to simplify
- * iteration logic
- */
- x2 = xstart;
- y2 = ystart;
- oc2 = 0;
- MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom);
-
- while (--npt > 0)
- {
- if (Nspans > 0)
- gdk_fb_fill_spans(pDraw, pGC, pspanInit, Nspans, FALSE);
- Nspans = 0;
- new_span = TRUE;
- spans = pspanInit - 1;
-
- x1 = x2;
- y1 = y2;
- oc1 = oc2;
- ++ppt;
-
- x2 = ppt->x;
- y2 = ppt->y;
-
- oc2 = 0;
- MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom);
-
- CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
-
- if (adx > ady)
- {
- e1 = ady << 1;
- e2 = e1 - (adx << 1);
- e = e1 - adx;
- length = adx; /* don't draw endpoint in main loop */
-
- FIXUP_ERROR(e, octant, bias);
-
- new_x1 = x1;
- new_y1 = y1;
- new_x2 = x2;
- new_y2 = y2;
- pt1_clipped = 0;
- pt2_clipped = 0;
-
- if ((oc1 | oc2) != 0)
- {
- result = miZeroClipLine(xleft, ytop, xright, ybottom,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady,
- &pt1_clipped, &pt2_clipped,
- octant, bias, oc1, oc2);
- if (result == -1)
- continue;
-
- length = abs(new_x2 - new_x1);
-
- /* if we've clipped the endpoint, always draw the full length
- * of the segment, because then the capstyle doesn't matter
- */
- if (pt2_clipped)
- length++;
-
- if (pt1_clipped)
- {
- /* must calculate new error terms */
- clipdx = abs(new_x1 - x1);
- clipdy = abs(new_y1 - y1);
- e += (clipdy * e2) + ((clipdx - clipdy) * e1);
- }
- }
-
- /* draw the segment */
-
- x = new_x1;
- y = new_y1;
-
- e3 = e2 - e1;
- e = e - e1;
-
- while (length--)
- {
- MI_OUTPUT_POINT(x, y);
- e += e1;
- if (e >= 0)
- {
- y += signdy;
- e += e3;
- }
- x += signdx;
- }
- }
- else /* Y major line */
- {
- e1 = adx << 1;
- e2 = e1 - (ady << 1);
- e = e1 - ady;
- length = ady; /* don't draw endpoint in main loop */
-
- SetYMajorOctant(octant);
- FIXUP_ERROR(e, octant, bias);
-
- new_x1 = x1;
- new_y1 = y1;
- new_x2 = x2;
- new_y2 = y2;
- pt1_clipped = 0;
- pt2_clipped = 0;
-
- if ((oc1 | oc2) != 0)
- {
- result = miZeroClipLine(xleft, ytop, xright, ybottom,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady,
- &pt1_clipped, &pt2_clipped,
- octant, bias, oc1, oc2);
- if (result == -1)
- continue;
-
- length = abs(new_y2 - new_y1);
-
- /* if we've clipped the endpoint, always draw the full length
- * of the segment, because then the capstyle doesn't matter
- */
- if (pt2_clipped)
- length++;
-
- if (pt1_clipped)
- {
- /* must calculate new error terms */
- clipdx = abs(new_x1 - x1);
- clipdy = abs(new_y1 - y1);
- e += (clipdx * e2) + ((clipdy - clipdx) * e1);
- }
- }
-
- /* draw the segment */
-
- x = new_x1;
- y = new_y1;
-
- e3 = e2 - e1;
- e = e - e1;
-
- while (length--)
- {
- MI_OUTPUT_POINT(x, y);
- e += e1;
- if (e >= 0)
- {
- x += signdx;
- e += e3;
- }
- y += signdy;
- }
- }
- }
-
- /* only do the capnotlast check on the last segment
- * and only if the endpoint wasn't clipped. And then, if the last
- * point is the same as the first point, do not draw it, unless the
- * line is degenerate
- */
- if ( (! pt2_clipped) && (GDK_GC_FBDATA(pGC)->values.cap_style != GDK_CAP_NOT_LAST) &&
- (((xstart != x2) || (ystart != y2)) || (ppt == pptInit + 1)))
- {
- MI_OUTPUT_POINT(x, y);
- }
-
- if (Nspans > 0)
- gdk_fb_fill_spans(pDraw, pGC, pspanInit, Nspans, FALSE);
-
- DEALLOCATE_LOCAL(pspanInit);
-}
-
-void
-miZeroDashLine(GdkDrawable *dst, GdkGC *pgc,
- int mode, int nptInit, GdkPoint *pptInit)
-{
- /* XXX kludge until real zero-width dash code is written */
- GDK_GC_FBDATA(pgc)->values.line_width = 1;
- miWideDash (dst, pgc, mode, nptInit, pptInit);
- GDK_GC_FBDATA(pgc)->values.line_width = 0;
-}
diff --git a/gdk/linux-fb/x-cursors.xbm b/gdk/linux-fb/x-cursors.xbm
deleted file mode 100644
index 0e130d603..000000000
--- a/gdk/linux-fb/x-cursors.xbm
+++ /dev/null
@@ -1,924 +0,0 @@
-#define X_cursor_width 14
-#define X_cursor_height 14
-#define X_cursor_x_hot 6
-#define X_cursor_y_hot 6
-static char X_cursor_bits[] = {
-0x07, 0xb8, 0x0f, 0x3c, 0x1f, 0x3e, 0x3e, 0x1f, 0xfc, 0x0f, 0xf8, 0x07, 0xf0, 0x03, 0xf0, 0x03, 0xf8, 0x07, 0xfc, 0x0f, 0x3e, 0x1f, 0x1f, 0x3e, 0x0f, 0x3c, 0x07, 0x38};
-#define X_cursor_mask_width 16
-#define X_cursor_mask_height 16
-#define X_cursor_mask_x_hot 7
-#define X_cursor_mask_y_hot 7
-static char X_cursor_mask_bits[] = {
-0x0f, 0xf0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, 0xfe, 0x7f, 0xfc, 0x3f, 0xf8, 0x1f, 0xf0, 0x0f, 0xf0, 0x0f, 0xf8, 0x1f, 0xfc, 0x3f, 0xfe, 0x7f, 0x7f, 0xfe, 0x3f, 0xfc, 0x1f, 0xf8, 0x0f, 0xf0};
-#define arrow_width 14
-#define arrow_height 14
-#define arrow_x_hot 13
-#define arrow_y_hot 0
-static char arrow_bits[] = {
-00, 0xb0, 00, 0x3c, 00, 0x1f, 0xc0, 0x1f, 0xf0, 0x0f, 0xfc, 0x0f, 0xc0, 0x07, 0xe0, 0x07, 0x70, 0x03, 0x38, 0x03, 0x1c, 0x01, 0x0e, 0x01, 0x07, 00, 0x02, 00};
-#define arrow_mask_width 16
-#define arrow_mask_height 16
-#define arrow_mask_x_hot 14
-#define arrow_mask_y_hot 1
-static char arrow_mask_bits[] = {
-00, 0xe0, 00, 0xf8, 00, 0xfe, 0x80, 0x7f, 0xe0, 0x7f, 0xf8, 0x3f, 0xfc, 0x3f, 0xfc, 0x1f, 0xe0, 0x1f, 0xf0, 0x0f, 0xf8, 0x0f, 0x7c, 0x07, 0x3e, 0x07, 0x1f, 0x02, 0x0e, 00, 0x04, 00};
-#define based_arrow_down_width 8
-#define based_arrow_down_height 10
-#define based_arrow_down_x_hot 3
-#define based_arrow_down_y_hot 9
-static char based_arrow_down_bits[] = {
-0xff, 00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x5a, 0x3c, 0x18};
-#define based_arrow_down_mask_width 10
-#define based_arrow_down_mask_height 12
-#define based_arrow_down_mask_x_hot 4
-#define based_arrow_down_mask_y_hot 10
-static char based_arrow_down_mask_bits[] = {
-0xff, 0x23, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0x78, 00, 0x78, 00, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfc, 00, 0x78, 00};
-#define based_arrow_up_width 8
-#define based_arrow_up_height 10
-#define based_arrow_up_x_hot 3
-#define based_arrow_up_y_hot 9
-static char based_arrow_up_bits[] = {
-0x18, 0x3c, 0x5a, 0x18, 0x18, 0x18, 0x18, 0xff, 00, 0xff};
-#define based_arrow_up_mask_width 10
-#define based_arrow_up_mask_height 12
-#define based_arrow_up_mask_x_hot 4
-#define based_arrow_up_mask_y_hot 10
-static char based_arrow_up_mask_bits[] = {
-0x30, 0x20, 0x78, 00, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0x78, 00, 0x78, 00, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03};
-#define boat_width 16
-#define boat_height 8
-#define boat_x_hot 14
-#define boat_y_hot 3
-static char boat_bits[] = {
-0x80, 00, 0xe0, 0x03, 0x11, 0x06, 0xff, 0xff, 00, 0x18, 00, 0x04, 00, 0x02, 0xff, 0x03};
-#define boat_mask_width 16
-#define boat_mask_height 9
-#define boat_mask_x_hot 14
-#define boat_mask_y_hot 4
-static char boat_mask_bits[] = {
-0xe0, 00, 0xf0, 0x03, 0xf9, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xff, 0x07, 0xff, 0x03};
-#define bogosity_width 13
-#define bogosity_height 14
-#define bogosity_x_hot 6
-#define bogosity_y_hot 6
-static char bogosity_bits[] = {
-0x47, 0x9c, 0x44, 0x04, 0x44, 0x04, 0x44, 0x04, 0xff, 0x1f, 0x45, 0x14, 0x45, 0x14, 0x45, 0x14, 0x45, 0x14, 0xff, 0x1f, 0x44, 0x04, 0x44, 0x04, 0x44, 0x04, 0x47, 0x1c};
-#define bogosity_mask_width 15
-#define bogosity_mask_height 16
-#define bogosity_mask_x_hot 7
-#define bogosity_mask_y_hot 7
-static char bogosity_mask_bits[] = {
-0xdf, 0x7d, 0xdf, 0x7d, 0xdf, 0x7d, 0xdc, 0x1d, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xdf, 0x7d, 0xdf, 0x7d, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xdc, 0x1d, 0xdf, 0x7d, 0xdf, 0x7d, 0xdf, 0x7d};
-#define bottom_left_corner_width 14
-#define bottom_left_corner_height 14
-#define bottom_left_corner_x_hot 0
-#define bottom_left_corner_y_hot 13
-static char bottom_left_corner_bits[] = {
-0x03, 0x80, 0x03, 00, 0x23, 0x08, 0x23, 0x04, 0x23, 0x02, 0x23, 0x01, 0xa3, 00, 0x63, 00, 0xe3, 0x0f, 0x03, 00, 0x03, 00, 0x03, 00, 0xff, 0x3f, 0xff, 0x3f};
-#define bottom_left_corner_mask_width 16
-#define bottom_left_corner_mask_height 16
-#define bottom_left_corner_mask_x_hot 1
-#define bottom_left_corner_mask_y_hot 14
-static char bottom_left_corner_mask_bits[] = {
-0x0f, 00, 0x0f, 00, 0xef, 0x30, 0xef, 0x38, 0xef, 0x1c, 0xef, 0x0e, 0xef, 0x07, 0xef, 0x03, 0xef, 0x3f, 0xef, 0x3f, 0xef, 0x3f, 0x0f, 00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-#define bottom_right_corner_width 14
-#define bottom_right_corner_height 14
-#define bottom_right_corner_x_hot 13
-#define bottom_right_corner_y_hot 13
-static char bottom_right_corner_bits[] = {
-00, 0xb0, 00, 0x30, 0x04, 0x31, 0x08, 0x31, 0x10, 0x31, 0x20, 0x31, 0x40, 0x31, 0x80, 0x31, 0xfc, 0x31, 00, 0x30, 00, 0x30, 00, 0x30, 0xff, 0x3f, 0xff, 0x3f};
-#define bottom_right_corner_mask_width 16
-#define bottom_right_corner_mask_height 16
-#define bottom_right_corner_mask_x_hot 14
-#define bottom_right_corner_mask_y_hot 14
-static char bottom_right_corner_mask_bits[] = {
-00, 0xf0, 00, 0xf0, 0x0c, 0xf7, 0x1c, 0xf7, 0x38, 0xf7, 0x70, 0xf7, 0xe0, 0xf7, 0xc0, 0xf7, 0xfc, 0xf7, 0xfc, 0xf7, 0xfc, 0xf7, 00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-#define bottom_side_width 13
-#define bottom_side_height 14
-#define bottom_side_x_hot 6
-#define bottom_side_y_hot 13
-static char bottom_side_bits[] = {
-0x40, 0x80, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00, 0x44, 0x04, 0x48, 0x02, 0x50, 0x01, 0xe0, 00, 0x40, 00, 00, 00, 0xff, 0x1f, 0xff, 0x1f};
-#define bottom_side_mask_width 15
-#define bottom_side_mask_height 16
-#define bottom_side_mask_x_hot 7
-#define bottom_side_mask_y_hot 14
-static char bottom_side_mask_bits[] = {
-0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xcc, 0x19, 0xdc, 0x1d, 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f};
-#define bottom_tee_width 14
-#define bottom_tee_height 10
-#define bottom_tee_x_hot 7
-#define bottom_tee_y_hot 9
-static char bottom_tee_bits[] = {
-0xc0, 0x80, 0xc0, 00, 0xc0, 00, 0xc0, 00, 0xc0, 00, 0xc0, 00, 0xc0, 00, 0xc0, 00, 0xff, 0x3f, 0xff, 0x3f};
-#define bottom_tee_mask_width 16
-#define bottom_tee_mask_height 12
-#define bottom_tee_mask_x_hot 8
-#define bottom_tee_mask_y_hot 10
-static char bottom_tee_mask_bits[] = {
-0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-#define box_spiral_width 15
-#define box_spiral_height 16
-#define box_spiral_x_hot 8
-#define box_spiral_y_hot 8
-static char box_spiral_bits[] = {
-0xff, 0xff, 0x01, 00, 0xfd, 0x7f, 0x05, 0x40, 0xf5, 0x5f, 0x15, 0x50, 0xd5, 0x57, 0x55, 0x54, 0x55, 0x55, 0xd5, 0x55, 0x15, 0x54, 0xf5, 0x57, 0x05, 0x50, 0xfd, 0x5f, 0x01, 0x40, 0xff, 0x7f};
-#define box_spiral_mask_width 16
-#define box_spiral_mask_height 16
-#define box_spiral_mask_x_hot 8
-#define box_spiral_mask_y_hot 8
-static char box_spiral_mask_bits[] = {
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-#define center_ptr_width 10
-#define center_ptr_height 14
-#define center_ptr_x_hot 4
-#define center_ptr_y_hot 0
-static char center_ptr_bits[] = {
-0x30, 0x90, 0x30, 00, 0x78, 00, 0x78, 00, 0xfc, 00, 0xfc, 00, 0xfe, 0x01, 0xfe, 0x01, 0x33, 0x03, 0x31, 0x02, 0x30, 00, 0x30, 00, 0x30, 00, 0x30, 00};
-#define center_ptr_mask_width 12
-#define center_ptr_mask_height 16
-#define center_ptr_mask_x_hot 5
-#define center_ptr_mask_y_hot 1
-static char center_ptr_mask_bits[] = {
-0xf0, 0x20, 0xf0, 00, 0xf8, 0x01, 0xf8, 0x01, 0xfc, 0x03, 0xfc, 0x03, 0xfe, 0x07, 0xfe, 0x07, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xf7, 0x0e, 0xf0, 00, 0xf0, 00, 0xf0, 00, 0xf0, 00};
-#define circle_width 14
-#define circle_height 14
-#define circle_x_hot 7
-#define circle_y_hot 7
-static char circle_bits[] = {
-0xe0, 0x81, 0xf8, 0x07, 0xfc, 0x0f, 0x1e, 0x1e, 0x0e, 0x1c, 0x07, 0x38, 0x07, 0x38, 0x07, 0x38, 0x07, 0x38, 0x0e, 0x1c, 0x1e, 0x1e, 0xfc, 0x0f, 0xf8, 0x07, 0xe0, 0x01};
-#define circle_mask_width 16
-#define circle_mask_height 16
-#define circle_mask_x_hot 8
-#define circle_mask_y_hot 8
-static char circle_mask_bits[] = {
-0xe0, 0x07, 0xf8, 0x1f, 0xfc, 0x3f, 0xfe, 0x7f, 0xfe, 0x7f, 0x3f, 0xfc, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x3f, 0xfc, 0xfe, 0x7f, 0xfe, 0x7f, 0xfc, 0x3f, 0xf8, 0x1f, 0xe0, 0x07};
-#define clock_width 14
-#define clock_height 16
-#define clock_x_hot 6
-#define clock_y_hot 3
-static char clock_bits[] = {
-0xfc, 0x8f, 0xe6, 0x19, 0x13, 0x33, 0xc9, 0x24, 0x79, 0x24, 0x11, 0x22, 0xe3, 0x31, 0xfe, 0x1f, 0xca, 0x14, 0xca, 0x14, 0xca, 0x14, 0xea, 0x15, 0xcb, 0x34, 0x0f, 0x3c, 0xff, 0x3f, 0xff, 0x3f};
-#define clock_mask_width 15
-#define clock_mask_height 16
-#define clock_mask_x_hot 6
-#define clock_mask_y_hot 3
-static char clock_mask_bits[] = {
-0xfe, 0x1f, 0xf7, 0x39, 0xdb, 0x77, 0xed, 0x6d, 0xfd, 0x6f, 0xf9, 0x66, 0xf3, 0x73, 0xff, 0x3f, 0xeb, 0x35, 0xeb, 0x35, 0xeb, 0x35, 0xfb, 0x37, 0xeb, 0x75, 0xcf, 0x7c, 0xff, 0x7f, 0xff, 0x7f};
-#define coffee_mug_width 15
-#define coffee_mug_height 16
-#define coffee_mug_x_hot 7
-#define coffee_mug_y_hot 9
-static char coffee_mug_bits[] = {
-0xf8, 0x8f, 0x04, 0x10, 0x06, 0x60, 0x0a, 0x58, 0xf2, 0x47, 0x03, 0x40, 0x03, 0x40, 0x02, 0x40, 0x02, 0x40, 0x9a, 0x58, 0x56, 0x55, 0xd7, 0x55, 0x5b, 0x59, 0x02, 0x40, 0x02, 0x40, 0xfc, 0x3f};
-#define coffee_mug_mask_width 16
-#define coffee_mug_mask_height 16
-#define coffee_mug_mask_x_hot 7
-#define coffee_mug_mask_y_hot 9
-static char coffee_mug_mask_bits[] = {
-0xf8, 0x0f, 0xfc, 0x1f, 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfc, 0x3f};
-#define cross_width 16
-#define cross_height 15
-#define cross_x_hot 7
-#define cross_y_hot 7
-static char cross_bits[] = {
-0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x7f, 0xff, 00, 00, 0x7f, 0xff, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01};
-#define cross_mask_width 16
-#define cross_mask_height 16
-#define cross_mask_x_hot 7
-#define cross_mask_y_hot 7
-static char cross_mask_bits[] = {
-0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03};
-#define cross_reverse_width 16
-#define cross_reverse_height 15
-#define cross_reverse_x_hot 7
-#define cross_reverse_y_hot 7
-static char cross_reverse_bits[] = {
-0x42, 0x21, 0x45, 0x51, 0x4a, 0x29, 0x54, 0x15, 0x68, 0x0b, 0x50, 0x05, 0xbf, 0xfe, 0x40, 0x01, 0xbf, 0xfe, 0x50, 0x05, 0x68, 0x0b, 0x54, 0x15, 0x4a, 0x29, 0x45, 0x51, 0x42, 0x21};
-#define cross_reverse_mask_width 16
-#define cross_reverse_mask_height 15
-#define cross_reverse_mask_x_hot 7
-#define cross_reverse_mask_y_hot 7
-static char cross_reverse_mask_bits[] = {
-0x66, 0x33, 0x6d, 0xdb, 0x7b, 0x6f, 0x76, 0x37, 0x6c, 0x1b, 0x5f, 0xfd, 0x3f, 0xfe, 0x80, 00, 0x3f, 0xfe, 0x5f, 0xfd, 0x6c, 0x1b, 0x76, 0x37, 0x7b, 0x6f, 0x6d, 0xdb, 0x66, 0x33};
-#define crosshair_width 16
-#define crosshair_height 15
-#define crosshair_x_hot 7
-#define crosshair_y_hot 7
-static char crosshair_bits[] = {
-0x80, 00, 0x80, 00, 0x80, 00, 0x80, 00, 0x80, 00, 0x80, 00, 0x80, 00, 0x7f, 0xff, 0x80, 00, 0x80, 00, 0x80, 00, 0x80, 00, 0x80, 00, 0x80, 00, 0x80, 00};
-#define crosshair_mask_width 16
-#define crosshair_mask_height 16
-#define crosshair_mask_x_hot 7
-#define crosshair_mask_y_hot 7
-static char crosshair_mask_bits[] = {
-0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01};
-#define diamond_cross_width 15
-#define diamond_cross_height 15
-#define diamond_cross_x_hot 7
-#define diamond_cross_y_hot 7
-static char diamond_cross_bits[] = {
-0x40, 0x81, 0x60, 0x03, 0x50, 0x05, 0x48, 0x09, 0x44, 0x11, 0x42, 0x21, 0x7f, 0x7f, 00, 00, 0x7f, 0x7f, 0x42, 0x21, 0x44, 0x11, 0x48, 0x09, 0x50, 0x05, 0x60, 0x03, 0x40, 0x01};
-#define diamond_cross_mask_width 16
-#define diamond_cross_mask_height 16
-#define diamond_cross_mask_x_hot 7
-#define diamond_cross_mask_y_hot 7
-static char diamond_cross_mask_bits[] = {
-0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xdc, 0x1d, 0xce, 0x39, 0xc7, 0x71, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xc7, 0x71, 0xce, 0x39, 0xdc, 0x1d, 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01};
-#define dot_width 10
-#define dot_height 10
-#define dot_x_hot 5
-#define dot_y_hot 5
-static char dot_bits[] = {
-0x78, 0x90, 0xfe, 0x01, 0xfe, 0x01, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xfe, 0x01, 0xfe, 0x01, 0x78, 00};
-#define dot_mask_width 12
-#define dot_mask_height 12
-#define dot_mask_x_hot 6
-#define dot_mask_y_hot 6
-static char dot_mask_bits[] = {
-0xf8, 0x21, 0xfe, 0x07, 0xfe, 0x07, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xfe, 0x07, 0xfe, 0x07, 0xf8, 0x01};
-#define dotbox_width 12
-#define dotbox_height 12
-#define dotbox_x_hot 6
-#define dotbox_y_hot 5
-static char dotbox_bits[] = {
-0xff, 0x9f, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x61, 0x08, 0x61, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0xff, 0x0f};
-#define dotbox_mask_width 14
-#define dotbox_mask_height 14
-#define dotbox_mask_x_hot 7
-#define dotbox_mask_y_hot 6
-static char dotbox_mask_bits[] = {
-0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0x07, 0x38, 0x07, 0x38, 0xe7, 0x39, 0xe7, 0x39, 0xe7, 0x39, 0xe7, 0x39, 0x07, 0x38, 0x07, 0x38, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f};
-#define double_arrow_width 10
-#define double_arrow_height 14
-#define double_arrow_x_hot 5
-#define double_arrow_y_hot 7
-static char double_arrow_bits[] = {
-0x30, 0x90, 0x78, 00, 0xfc, 00, 0xb6, 0x01, 0x33, 0x03, 0x30, 00, 0x30, 00, 0x30, 00, 0x30, 00, 0x33, 0x03, 0xb6, 0x01, 0xfc, 00, 0x78, 00, 0x30, 00};
-#define double_arrow_mask_width 12
-#define double_arrow_mask_height 16
-#define double_arrow_mask_x_hot 6
-#define double_arrow_mask_y_hot 8
-static char double_arrow_mask_bits[] = {
-0xf0, 0x20, 0xf8, 0x01, 0xfc, 0x03, 0xfe, 0x07, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xf0, 00, 0xf0, 00, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xfe, 0x07, 0xfc, 0x03, 0xf8, 0x01, 0xf0, 00};
-#define draft_large_width 15
-#define draft_large_height 15
-#define draft_large_x_hot 14
-#define draft_large_y_hot 0
-static char draft_large_bits[] = {
-00, 0xc0, 00, 0x30, 00, 0x3c, 00, 0x1f, 0xc0, 0x1f, 0xf0, 0x0f, 0xfc, 0x0f, 0x80, 0x07, 0x40, 0x07, 0x20, 0x03, 0x10, 0x03, 0x08, 0x01, 0x04, 0x01, 0x02, 00, 0x01, 00};
-#define draft_large_mask_width 15
-#define draft_large_mask_height 16
-#define draft_large_mask_x_hot 14
-#define draft_large_mask_y_hot 0
-static char draft_large_mask_bits[] = {
-00, 0x60, 00, 0x78, 00, 0x7e, 0x80, 0x3f, 0xe0, 0x1f, 0xf8, 0x1f, 0xfe, 0x0f, 0xfe, 0x0f, 0xe0, 0x07, 0xf0, 0x07, 0xb8, 0x03, 0x9c, 0x03, 0x8e, 0x01, 0x87, 0x01, 0x03, 00, 0x01, 00};
-#define draft_small_width 15
-#define draft_small_height 15
-#define draft_small_x_hot 14
-#define draft_small_y_hot 0
-static char draft_small_bits[] = {
-00, 0x40, 00, 0x30, 00, 0x3c, 00, 0x1f, 0xc0, 0x1f, 00, 0x0e, 00, 0x0d, 0x80, 0x04, 0x40, 0x04, 0x20, 00, 0x10, 00, 0x08, 00, 0x04, 00, 0x02, 00, 0x01, 00};
-#define draft_small_mask_width 15
-#define draft_small_mask_height 15
-#define draft_small_mask_x_hot 14
-#define draft_small_mask_y_hot 0
-static char draft_small_mask_bits[] = {
-00, 0x60, 00, 0x78, 00, 0x3e, 0x80, 0x3f, 0xe0, 0x1f, 0xe0, 0x1f, 0x80, 0x0f, 0xc0, 0x0f, 0xe0, 0x06, 0x70, 0x02, 0x38, 00, 0x1c, 00, 0x0e, 00, 0x07, 00, 0x03, 00};
-#define draped_box_width 12
-#define draped_box_height 12
-#define draped_box_x_hot 6
-#define draped_box_y_hot 5
-static char draped_box_bits[] = {
-0xff, 0x1f, 0x91, 0x08, 0x99, 0x09, 0x0d, 0x0b, 0x07, 0x0e, 0x61, 0x08, 0x61, 0x08, 0x07, 0x0e, 0x0d, 0x0b, 0x99, 0x09, 0x91, 0x08, 0xff, 0x0f};
-#define draped_box_mask_width 14
-#define draped_box_mask_height 14
-#define draped_box_mask_x_hot 7
-#define draped_box_mask_y_hot 6
-static char draped_box_mask_bits[] = {
-0xff, 0x3f, 0xff, 0x3f, 0xf3, 0x33, 0xfb, 0x37, 0x3f, 0x3f, 0xdf, 0x3e, 0xef, 0x3d, 0xef, 0x3d, 0xdf, 0x3e, 0x3f, 0x3f, 0xfb, 0x37, 0xf3, 0x33, 0xff, 0x3f, 0xff, 0x3f};
-#define exchange_width 14
-#define exchange_height 14
-#define exchange_x_hot 6
-#define exchange_y_hot 6
-static char exchange_bits[] = {
-0xf1, 0x03, 0xfb, 0x07, 0x1f, 0x0c, 0x09, 0x08, 0x19, 00, 0x3f, 00, 00, 00, 00, 00, 00, 0x3f, 00, 0x26, 0x04, 0x24, 0x0c, 0x3e, 0xf8, 0x37, 0xf0, 0x23};
-#define exchange_mask_width 16
-#define exchange_mask_height 16
-#define exchange_mask_x_hot 7
-#define exchange_mask_y_hot 7
-static char exchange_mask_bits[] = {
-0xe3, 0x07, 0xf7, 0x0f, 0xff, 0x1f, 0xff, 0x3f, 0x3f, 0x38, 0xff, 0x30, 0xff, 00, 0xff, 00, 00, 0xff, 00, 0xff, 0x0c, 0xfe, 0x1c, 0xfc, 0xfc, 0xff, 0xf8, 0xff, 0xf0, 0xef, 0xe0, 0xc7};
-#define fleur_width 14
-#define fleur_height 14
-#define fleur_x_hot 7
-#define fleur_y_hot 7
-static char fleur_bits[] = {
-0xc0, 00, 0xe0, 0x01, 0xf0, 0x03, 0xc0, 00, 0xc4, 0x08, 0xc6, 0x18, 0xff, 0x3f, 0xff, 0x3f, 0xc6, 0x18, 0xc4, 0x08, 0xc0, 00, 0xf0, 0x03, 0xe0, 0x01, 0xc0, 00};
-#define fleur_mask_width 16
-#define fleur_mask_height 16
-#define fleur_mask_x_hot 8
-#define fleur_mask_y_hot 8
-static char fleur_mask_bits[] = {
-0xc0, 0x03, 0xc0, 0x07, 0xe0, 0x07, 0xf0, 0x0f, 0xe8, 0x17, 0xdc, 0x3b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdc, 0x3b, 0xe8, 0x17, 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0xc0, 0x03};
-#define gobbler_width 16
-#define gobbler_height 15
-#define gobbler_x_hot 14
-#define gobbler_y_hot 2
-static char gobbler_bits[] = {
-00, 0x1e, 00, 0x0e, 0x01, 0xcc, 0xf9, 0x0d, 0xff, 0x0f, 0x7f, 0x0c, 0x3f, 0x0c, 0x06, 0x1c, 00, 0x0f, 0xf8, 0x07, 0x10, 00, 0x10, 00, 0x10, 00, 0x10, 00, 0x78, 00};
-#define gobbler_mask_width 16
-#define gobbler_mask_height 16
-#define gobbler_mask_x_hot 14
-#define gobbler_mask_y_hot 3
-static char gobbler_mask_bits[] = {
-00, 0x3f, 00, 0x3f, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xfe, 0x1f, 0xf8, 0x0f, 0x38, 00, 0x38, 00, 0xfc, 00, 0xfc, 00};
-#define gumby_width 16
-#define gumby_height 16
-#define gumby_x_hot 2
-#define gumby_y_hot 0
-static char gumby_bits[] = {
-0xfc, 00, 0x08, 0x01, 0x13, 0x02, 0x57, 0x05, 0x13, 0x04, 0xd3, 0x05, 0x1f, 0x3c, 0x1c, 0xfc, 0x10, 0xe4, 0x10, 0xe4, 0x90, 0xf4, 0x90, 0xe4, 0x90, 0x04, 0x88, 0x08, 0x84, 0x10, 0x7c, 0x1f};
-#define gumby_mask_width 16
-#define gumby_mask_height 16
-#define gumby_mask_x_hot 2
-#define gumby_mask_y_hot 0
-static char gumby_mask_bits[] = {
-0xfc, 00, 0xfb, 0x01, 0xf7, 0x03, 0xff, 0x07, 0xf7, 0x07, 0xf7, 0x3f, 0xff, 0x7f, 0xff, 0xff, 0xfc, 0xf7, 0xf0, 0xf7, 0xf0, 0xff, 0xf0, 0xf7, 0xf0, 0xe7, 0xf8, 0x0f, 0xfc, 0x1f, 0x7c, 0x1f};
-#define hand1_width 13
-#define hand1_height 16
-#define hand1_x_hot 12
-#define hand1_y_hot 0
-static char hand1_bits[] = {
-00, 0x18, 00, 0x1e, 0x80, 0x07, 0xc0, 0x03, 0xe0, 0x01, 0xf0, 0x03, 0xf8, 0x07, 0xfa, 0x03, 0xff, 0x07, 0xfd, 0x07, 0xf0, 0x03, 0xf0, 0x01, 0x29, 00, 0x23, 00, 0x16, 00, 0x0c, 00};
-#define hand1_mask_width 13
-#define hand1_mask_height 16
-#define hand1_mask_x_hot 12
-#define hand1_mask_y_hot 0
-static char hand1_mask_bits[] = {
-00, 0xdc, 00, 0x1f, 0xc0, 0x0f, 0xe0, 0x07, 0xf0, 0x03, 0xf8, 0x07, 0xfe, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x07, 0xff, 0x03, 0xff, 0x01, 0x7f, 00, 0x3f, 00, 0x1e, 00};
-#define hand2_width 15
-#define hand2_height 14
-#define hand2_x_hot 0
-#define hand2_y_hot 0
-static char hand2_bits[] = {
-0xfe, 0x01, 0x01, 0x02, 0x7e, 0x04, 0x08, 0x08, 0x70, 0x08, 0x08, 0x08, 0x70, 0x14, 0x08, 0x22, 0x30, 0x41, 0xc0, 0x20, 0x40, 0x12, 0x80, 0x08, 00, 0x05, 00, 0x02};
-#define hand2_mask_width 16
-#define hand2_mask_height 16
-#define hand2_mask_x_hot 0
-#define hand2_mask_y_hot 1
-static char hand2_mask_bits[] = {
-0xfe, 0x01, 0xff, 0x03, 0xff, 0x07, 0xff, 0x0f, 0xfe, 0x1f, 0xf8, 0x1f, 0xfc, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xf8, 0xff, 0xf0, 0x7f, 0xe0, 0x3f, 0xc0, 0x1f, 0x80, 0x0f, 00, 0x07, 00, 0x02};
-#define heart_width 15
-#define heart_height 14
-#define heart_x_hot 6
-#define heart_y_hot 8
-static char heart_bits[] = {
-0x7c, 0x1f, 0xc6, 0x31, 0x83, 0x60, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x03, 0x60, 0x06, 0x30, 0x0c, 0x18, 0x18, 0x0c, 0x30, 0x06, 0x60, 0x03, 0xc0, 0x01};
-#define heart_mask_width 15
-#define heart_mask_height 14
-#define heart_mask_x_hot 6
-#define heart_mask_y_hot 8
-static char heart_mask_bits[] = {
-0x7c, 0x9f, 0xfe, 0x3f, 0xc7, 0x71, 0x83, 0x60, 0x03, 0x60, 0x03, 0x60, 0x43, 0x61, 0x87, 0x70, 0x0e, 0x38, 0x1c, 0x1c, 0x38, 0x0e, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01};
-#define icon_width 16
-#define icon_height 16
-#define icon_x_hot 8
-#define icon_y_hot 8
-static char icon_bits[] = {
-0xff, 0xff, 0xab, 0xaa, 0x55, 0xd5, 0xab, 0xaa, 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, 0x55, 0xd5, 0xab, 0xaa, 0x55, 0xd5, 0xff, 0xff};
-#define icon_mask_width 16
-#define icon_mask_height 16
-#define icon_mask_x_hot 8
-#define icon_mask_y_hot 8
-static char icon_mask_bits[] = {
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-#define iron_cross_width 14
-#define iron_cross_height 14
-#define iron_cross_x_hot 7
-#define iron_cross_y_hot 6
-static char iron_cross_bits[] = {
-0xfe, 0x1f, 0xfc, 0x0f, 0xf9, 0x27, 0xf3, 0x33, 0xe7, 0x39, 0xcf, 0x3c, 0xff, 0x3f, 0xff, 0x3f, 0xcf, 0x3c, 0xe7, 0x39, 0xf3, 0x33, 0xf9, 0x27, 0xfc, 0x0f, 0xfe, 0x1f};
-#define iron_cross_mask_width 16
-#define iron_cross_mask_height 16
-#define iron_cross_mask_x_hot 8
-#define iron_cross_mask_y_hot 7
-static char iron_cross_mask_bits[] = {
-0xfc, 0x3f, 0xfe, 0x7f, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xfe, 0x7f, 0xfc, 0x3f};
-#define left_ptr_width 8
-#define left_ptr_height 14
-#define left_ptr_x_hot 0
-#define left_ptr_y_hot 0
-static char left_ptr_bits[] = {
-0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff, 0x1f, 0x1b, 0x31, 0x30, 0x60, 0x60};
-#define left_ptr_mask_width 10
-#define left_ptr_mask_height 16
-#define left_ptr_mask_x_hot 1
-#define left_ptr_mask_y_hot 1
-static char left_ptr_mask_bits[] = {
-0x03, 0xc0, 0x07, 00, 0x0f, 00, 0x1f, 00, 0x3f, 00, 0x7f, 00, 0xff, 00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x03, 0x7f, 00, 0xf7, 00, 0xf3, 00, 0xe0, 0x01, 0xe0, 0x01, 0xc0, 00};
-#define left_side_width 14
-#define left_side_height 13
-#define left_side_x_hot 0
-#define left_side_y_hot 6
-static char left_side_bits[] = {
-0x03, 00, 0x03, 00, 0x83, 00, 0x43, 00, 0x23, 00, 0x13, 00, 0xfb, 0x3f, 0x13, 00, 0x23, 00, 0x43, 00, 0x83, 00, 0x03, 00, 0x03, 00};
-#define left_side_mask_width 16
-#define left_side_mask_height 15
-#define left_side_mask_x_hot 1
-#define left_side_mask_y_hot 7
-static char left_side_mask_bits[] = {
-0x0f, 00, 0x0f, 00, 0x0f, 0x03, 0x8f, 0x03, 0xcf, 0x01, 0xef, 00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 00, 0xcf, 0x01, 0x8f, 0x03, 0x0f, 0x03, 0x0f, 00, 0x0f, 00};
-#define left_tee_width 10
-#define left_tee_height 14
-#define left_tee_x_hot 0
-#define left_tee_y_hot 7
-static char left_tee_bits[] = {
-0x03, 0x10, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0xff, 0x03, 0xff, 0x03, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00};
-#define left_tee_mask_width 12
-#define left_tee_mask_height 16
-#define left_tee_mask_x_hot 1
-#define left_tee_mask_y_hot 8
-static char left_tee_mask_bits[] = {
-0x0f, 0xc0, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00};
-#define leftbutton_width 16
-#define leftbutton_height 16
-#define leftbutton_x_hot 8
-#define leftbutton_y_hot 8
-static char leftbutton_bits[] = {
-0x01, 0xc0, 0xfe, 0xbf, 0xfe, 0xbf, 0x22, 0xa2, 0xa2, 0xaa, 0xa2, 0xaa, 0xa2, 0xaa, 0xa2, 0xaa, 0x22, 0xa2, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0x01, 0xc0};
-#define leftbutton_mask_width 15
-#define leftbutton_mask_height 16
-#define leftbutton_mask_x_hot 8
-#define leftbutton_mask_y_hot 8
-static char leftbutton_mask_bits[] = {
-0xfe, 0xbf, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xfe, 0x3f};
-#define ll_angle_width 10
-#define ll_angle_height 10
-#define ll_angle_x_hot 0
-#define ll_angle_y_hot 9
-static char ll_angle_bits[] = {
-0x03, 0x10, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0xff, 0x03, 0xff, 0x03};
-#define ll_angle_mask_width 12
-#define ll_angle_mask_height 12
-#define ll_angle_mask_x_hot 1
-#define ll_angle_mask_y_hot 10
-static char ll_angle_mask_bits[] = {
-0x0f, 0xc0, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f};
-#define lr_angle_width 10
-#define lr_angle_height 10
-#define lr_angle_x_hot 9
-#define lr_angle_y_hot 9
-static char lr_angle_bits[] = {
-00, 0x13, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 0xff, 0x03, 0xff, 0x03};
-#define lr_angle_mask_width 12
-#define lr_angle_mask_height 12
-#define lr_angle_mask_x_hot 10
-#define lr_angle_mask_y_hot 10
-static char lr_angle_mask_bits[] = {
-00, 0xcf, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f};
-#define man_width 16
-#define man_height 16
-#define man_x_hot 14
-#define man_y_hot 5
-static char man_bits[] = {
-0xc0, 0x01, 0x78, 0x0f, 0x40, 0x01, 0x81, 00, 0xc2, 0xe1, 0x24, 0xd2, 0xb8, 0x0e, 0xa0, 0x02, 0x20, 0x02, 0x40, 0x01, 0x20, 0x02, 0x90, 0x04, 0x48, 0x09, 0x28, 0x0a, 0x1e, 0x3c, 0x1f, 0xfc};
-#define man_mask_width 16
-#define man_mask_height 16
-#define man_mask_x_hot 14
-#define man_mask_y_hot 5
-static char man_mask_bits[] = {
-0xf8, 0x07, 0xfc, 0x0f, 0xfc, 0x1f, 0xc3, 0x41, 0xe7, 0xe3, 0xfe, 0xff, 0xfc, 0xdf, 0xf8, 0x0f, 0xe0, 0x07, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xfc, 0x1f, 0x7e, 0x3f, 0x3f, 0xfe, 0x3f, 0xfe};
-#define middlebutton_width 16
-#define middlebutton_height 16
-#define middlebutton_x_hot 8
-#define middlebutton_y_hot 8
-static char middlebutton_bits[] = {
-0x01, 0xc0, 0xfe, 0xbf, 0xfe, 0xbf, 0x22, 0xa2, 0x2a, 0xaa, 0x2a, 0xaa, 0x2a, 0xaa, 0x2a, 0xaa, 0x22, 0xa2, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0x01, 0xc0};
-#define middlebutton_mask_width 15
-#define middlebutton_mask_height 16
-#define middlebutton_mask_x_hot 8
-#define middlebutton_mask_y_hot 8
-static char middlebutton_mask_bits[] = {
-0xfe, 0xbf, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xfe, 0x3f};
-#define mouse_width 15
-#define mouse_height 14
-#define mouse_x_hot 4
-#define mouse_y_hot 1
-static char mouse_bits[] = {
-0xe0, 00, 0x30, 00, 0x60, 00, 0xc0, 00, 0xfe, 0x1f, 0x01, 0x20, 0xcd, 0x6c, 0xcd, 0x6c, 0xcd, 0x6c, 0x01, 0x60, 0x01, 0x60, 0x06, 0x38, 0x18, 0x06, 0xe0, 0x01};
-#define mouse_mask_width 16
-#define mouse_mask_height 16
-#define mouse_mask_x_hot 4
-#define mouse_mask_y_hot 1
-static char mouse_mask_bits[] = {
-0xf0, 0x01, 0x78, 00, 0xf0, 00, 0xe0, 00, 0xfe, 0x1f, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xef, 0xf8, 0x07, 0xf0, 0x03, 0xe0, 0x01};
-#define pencil_width 11
-#define pencil_height 16
-#define pencil_x_hot 10
-#define pencil_y_hot 15
-static char pencil_bits[] = {
-0x0e, 0x10, 0x11, 00, 0x31, 00, 0x52, 00, 0x5e, 00, 0x84, 00, 0x88, 00, 0x08, 0x01, 0x10, 0x01, 0x30, 0x02, 0x20, 0x02, 0x40, 0x04, 0x80, 0x07, 00, 0x07, 00, 0x06, 00, 0x04};
-#define pencil_mask_width 13
-#define pencil_mask_height 16
-#define pencil_mask_x_hot 11
-#define pencil_mask_y_hot 15
-static char pencil_mask_bits[] = {
-0x3f, 0xc0, 0x7f, 00, 0xff, 00, 0xfe, 00, 0xfc, 0x01, 0xfc, 0x01, 0xf8, 0x03, 0xf0, 0x03, 0xf0, 0x07, 0xe0, 0x07, 0xe0, 0x0f, 0xc0, 0x1f, 0x80, 0x1f, 00, 0x1f, 00, 0x1e, 00, 0x1c};
-#define pirate_width 15
-#define pirate_height 16
-#define pirate_x_hot 7
-#define pirate_y_hot 12
-static char pirate_bits[] = {
-0xe0, 0x01, 0xf0, 0x03, 0xf8, 0x07, 0xcc, 0x0c, 0xcc, 0x0c, 0xf8, 0x07, 0xf0, 0x03, 0xe0, 0x01, 0xe1, 0x21, 0xe1, 0x61, 0xc2, 0x10, 0x1c, 0x0e, 0xe0, 0x01, 0xf8, 0x47, 0x0f, 0x7c, 0x01, 0x20};
-#define pirate_mask_width 16
-#define pirate_mask_height 16
-#define pirate_mask_x_hot 7
-#define pirate_mask_y_hot 12
-static char pirate_mask_bits[] = {
-0xf0, 0x03, 0xf8, 0x07, 0xfc, 0x0f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfc, 0x0f, 0xf8, 0x07, 0xf1, 0x83, 0xf1, 0xe3, 0xf3, 0xf3, 0xef, 0x39, 0x1e, 0x1e, 0xe0, 0x01, 0xfe, 0xc7, 0xff, 0xff, 0x0f, 0x7c};
-#define plus_width 10
-#define plus_height 10
-#define plus_x_hot 4
-#define plus_y_hot 5
-static char plus_bits[] = {
-0x30, 0x10, 0x30, 00, 0x30, 00, 0x30, 00, 0xff, 0x03, 0xff, 0x03, 0x30, 00, 0x30, 00, 0x30, 00, 0x30, 00};
-#define plus_mask_width 12
-#define plus_mask_height 12
-#define plus_mask_x_hot 5
-#define plus_mask_y_hot 6
-static char plus_mask_bits[] = {
-0xf0, 0xc0, 0xf0, 00, 0xf0, 00, 0xf0, 00, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xf0, 00, 0xf0, 00, 0xf0, 00, 0xf0, 00};
-#define question_arrow_width 9
-#define question_arrow_height 15
-#define question_arrow_x_hot 4
-#define question_arrow_y_hot 7
-static char question_arrow_bits[] = {
-0x7c, 0x10, 0xfe, 00, 0xc7, 0x01, 0x83, 0x01, 0x87, 0x01, 0xc6, 0x01, 0xe0, 00, 0x78, 00, 0x38, 00, 0x28, 00, 0x28, 00, 0xee, 00, 0x6c, 00, 0x38, 00, 0x10, 00};
-#define question_arrow_mask_width 11
-#define question_arrow_mask_height 16
-#define question_arrow_mask_x_hot 5
-#define question_arrow_mask_y_hot 8
-static char question_arrow_mask_bits[] = {
-0xf8, 0xc0, 0xfc, 0x01, 0xfe, 0x03, 0xff, 0x07, 0x8f, 0x07, 0x9f, 0x07, 0xde, 0x07, 0xfc, 0x03, 0xf8, 0x01, 0xf8, 00, 0xf8, 00, 0xfc, 0x01, 0xfe, 0x03, 0xfc, 0x01, 0xf8, 00, 0x70, 00};
-#define right_ptr_width 8
-#define right_ptr_height 14
-#define right_ptr_x_hot 7
-#define right_ptr_y_hot 0
-static char right_ptr_bits[] = {
-0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff, 0xf8, 0xd8, 0x8c, 0x0c, 0x06, 0x06};
-#define right_ptr_mask_width 10
-#define right_ptr_mask_height 16
-#define right_ptr_mask_x_hot 8
-#define right_ptr_mask_y_hot 1
-static char right_ptr_mask_bits[] = {
-00, 0xc3, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x03, 0xf0, 0x03, 0xf8, 0x03, 0xfc, 0x03, 0xfe, 0x03, 0xff, 0x03, 0xff, 0x03, 0xf8, 0x03, 0xbc, 0x03, 0x3c, 0x03, 0x1e, 00, 0x1e, 00, 0x0c, 00};
-#define right_side_width 14
-#define right_side_height 13
-#define right_side_x_hot 13
-#define right_side_y_hot 6
-static char right_side_bits[] = {
-00, 0x30, 00, 0x30, 0x40, 0x30, 0x80, 0x30, 00, 0x31, 00, 0x32, 0xff, 0x37, 00, 0x32, 00, 0x31, 0x80, 0x30, 0x40, 0x30, 00, 0x30, 00, 0x30};
-#define right_side_mask_width 16
-#define right_side_mask_height 15
-#define right_side_mask_x_hot 14
-#define right_side_mask_y_hot 7
-static char right_side_mask_bits[] = {
-00, 0xf0, 00, 0xf0, 0xc0, 0xf0, 0xc0, 0xf1, 0x80, 0xf3, 00, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 00, 0xf7, 0x80, 0xf3, 0xc0, 0xf1, 0xc0, 0xf0, 00, 0xf0, 00, 0xf0};
-#define right_tee_width 10
-#define right_tee_height 14
-#define right_tee_x_hot 9
-#define right_tee_y_hot 7
-static char right_tee_bits[] = {
-00, 0x13, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 0xff, 0x03, 0xff, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03};
-#define right_tee_mask_width 12
-#define right_tee_mask_height 16
-#define right_tee_mask_x_hot 10
-#define right_tee_mask_y_hot 8
-static char right_tee_mask_bits[] = {
-00, 0xcf, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f};
-#define rightbutton_width 16
-#define rightbutton_height 16
-#define rightbutton_x_hot 8
-#define rightbutton_y_hot 8
-static char rightbutton_bits[] = {
-0x01, 0xc0, 0xfe, 0xbf, 0xfe, 0xbf, 0x22, 0xa2, 0xaa, 0xa2, 0xaa, 0xa2, 0xaa, 0xa2, 0xaa, 0xa2, 0x22, 0xa2, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0x01, 0xc0};
-#define rightbutton_mask_width 15
-#define rightbutton_mask_height 16
-#define rightbutton_mask_x_hot 8
-#define rightbutton_mask_y_hot 8
-static char rightbutton_mask_bits[] = {
-0xfe, 0xbf, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xfe, 0x3f};
-#define rtl_logo_width 14
-#define rtl_logo_height 14
-#define rtl_logo_x_hot 6
-#define rtl_logo_y_hot 6
-static char rtl_logo_bits[] = {
-0xff, 0x3f, 0x01, 0x22, 0x01, 0x22, 0x01, 0x22, 0xff, 0x23, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0xf1, 0x3f, 0x11, 0x20, 0x11, 0x20, 0x11, 0x20, 0xff, 0x3f};
-#define rtl_logo_mask_width 16
-#define rtl_logo_mask_height 16
-#define rtl_logo_mask_x_hot 7
-#define rtl_logo_mask_y_hot 7
-static char rtl_logo_mask_bits[] = {
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xee, 0xff, 0xef, 0xff, 0xef, 0xff, 0xef, 0x77, 0xee, 0x77, 0xee, 0xf7, 0xff, 0xf7, 0xff, 0xf7, 0xff, 0x77, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-#define sailboat_width 12
-#define sailboat_height 13
-#define sailboat_x_hot 6
-#define sailboat_y_hot -1
-static char sailboat_bits[] = {
-0x80, 0x10, 0x80, 00, 0xa0, 0x01, 0xa0, 0x01, 0xb0, 0x01, 0xb0, 0x03, 0xb8, 0x03, 0xb8, 0x03, 0xbc, 0x07, 0xbc, 0x07, 0xbe, 0x07, 0xbe, 0x0f, 0x1f, 0x07};
-#define sailboat_mask_width 16
-#define sailboat_mask_height 16
-#define sailboat_mask_x_hot 8
-#define sailboat_mask_y_hot 0
-static char sailboat_mask_bits[] = {
-00, 0x03, 00, 0x07, 0x80, 0x07, 0xc0, 0x0f, 0xc0, 0x0f, 0xe0, 0x0f, 0xe0, 0x1f, 0xf0, 0x1f, 0xf0, 0x1f, 0xf8, 0x3f, 0xf8, 0x3f, 0xfc, 0x3f, 0xfc, 0xff, 0xfe, 0xff, 0xff, 0x1f, 0xfe, 0x07};
-#define sb_down_arrow_width 7
-#define sb_down_arrow_height 15
-#define sb_down_arrow_x_hot 3
-#define sb_down_arrow_y_hot 15
-static char sb_down_arrow_bits[] = {
-0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x7f, 0x3e, 0x1c, 0x08};
-#define sb_down_arrow_mask_width 9
-#define sb_down_arrow_mask_height 16
-#define sb_down_arrow_mask_x_hot 4
-#define sb_down_arrow_mask_y_hot 15
-static char sb_down_arrow_mask_bits[] = {
-0x7c, 0xc0, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0xff, 0x01, 0xff, 0x01, 0xfe, 00, 0x7c, 00, 0x38, 00, 0x10, 00};
-#define sb_h_double_arrow_width 15
-#define sb_h_double_arrow_height 7
-#define sb_h_double_arrow_x_hot 7
-#define sb_h_double_arrow_y_hot 3
-static char sb_h_double_arrow_bits[] = {
-0x08, 0x08, 0x0c, 0x18, 0xfe, 0x3f, 0x0f, 0x78, 0xfe, 0x3f, 0x0c, 0x18, 0x08, 0x08};
-#define sb_h_double_arrow_mask_width 15
-#define sb_h_double_arrow_mask_height 9
-#define sb_h_double_arrow_mask_x_hot 7
-#define sb_h_double_arrow_mask_y_hot 4
-static char sb_h_double_arrow_mask_bits[] = {
-0x18, 0x8c, 0x1c, 0x1c, 0xfe, 0x3f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xfe, 0x3f, 0x1c, 0x1c, 0x18, 0x0c};
-#define sb_left_arrow_width 15
-#define sb_left_arrow_height 7
-#define sb_left_arrow_x_hot -1
-#define sb_left_arrow_y_hot 3
-static char sb_left_arrow_bits[] = {
-0x08, 00, 0x0c, 00, 0xfe, 0x7f, 0x0f, 00, 0xfe, 0x7f, 0x0c, 00, 0x08, 00};
-#define sb_left_arrow_mask_width 16
-#define sb_left_arrow_mask_height 9
-#define sb_left_arrow_mask_x_hot 0
-#define sb_left_arrow_mask_y_hot 4
-static char sb_left_arrow_mask_bits[] = {
-0x30, 00, 0x38, 00, 0xfc, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfc, 0xff, 0x38, 00, 0x30, 00};
-#define sb_right_arrow_width 15
-#define sb_right_arrow_height 7
-#define sb_right_arrow_x_hot 15
-#define sb_right_arrow_y_hot 3
-static char sb_right_arrow_bits[] = {
-00, 0x08, 00, 0x18, 0xff, 0x3f, 00, 0x78, 0xff, 0x3f, 00, 0x18, 00, 0x08};
-#define sb_right_arrow_mask_width 16
-#define sb_right_arrow_mask_height 9
-#define sb_right_arrow_mask_x_hot 15
-#define sb_right_arrow_mask_y_hot 4
-static char sb_right_arrow_mask_bits[] = {
-00, 0x0c, 00, 0x1c, 0xff, 0x3f, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0x3f, 00, 0x1c, 00, 0x0c};
-#define sb_up_arrow_width 7
-#define sb_up_arrow_height 15
-#define sb_up_arrow_x_hot 3
-#define sb_up_arrow_y_hot -1
-static char sb_up_arrow_bits[] = {
-0x08, 0x9c, 0x3e, 0x7f, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14};
-#define sb_up_arrow_mask_width 9
-#define sb_up_arrow_mask_height 16
-#define sb_up_arrow_mask_x_hot 4
-#define sb_up_arrow_mask_y_hot 0
-static char sb_up_arrow_mask_bits[] = {
-0x10, 0xc0, 0x38, 00, 0x7c, 00, 0xfe, 00, 0xff, 0x01, 0xff, 0x01, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00};
-#define sb_v_double_arrow_width 7
-#define sb_v_double_arrow_height 15
-#define sb_v_double_arrow_x_hot 3
-#define sb_v_double_arrow_y_hot 7
-static char sb_v_double_arrow_bits[] = {
-0x08, 0x9c, 0x3e, 0x7f, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x7f, 0x3e, 0x1c, 0x08};
-#define sb_v_double_arrow_mask_width 9
-#define sb_v_double_arrow_mask_height 15
-#define sb_v_double_arrow_mask_x_hot 4
-#define sb_v_double_arrow_mask_y_hot 7
-static char sb_v_double_arrow_mask_bits[] = {
-0x38, 0xc0, 0x7c, 00, 0xfe, 00, 0xff, 0x01, 0xff, 0x01, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0x7c, 00, 0xff, 0x01, 0xff, 0x01, 0xfe, 00, 0x7c, 00, 0x38, 00};
-#define shuttle_width 15
-#define shuttle_height 16
-#define shuttle_x_hot 10
-#define shuttle_y_hot 0
-static char shuttle_bits[] = {
-00, 0x84, 00, 0x0e, 00, 0x1f, 0x80, 0x7b, 0xa0, 0x7b, 0x90, 0x7b, 0x88, 0x7b, 0x88, 0x7b, 0x88, 0x7b, 0x88, 0x7b, 0x8c, 0x7b, 0x8e, 0x7b, 0xbf, 0x7b, 0x18, 0x11, 00, 0x1e, 00, 0x0c};
-#define shuttle_mask_width 16
-#define shuttle_mask_height 16
-#define shuttle_mask_x_hot 11
-#define shuttle_mask_y_hot 0
-static char shuttle_mask_bits[] = {
-00, 0x1c, 00, 0x3e, 00, 0x7f, 00, 0xff, 0x60, 0xff, 0x70, 0xff, 0x78, 0xff, 0x78, 0xff, 0x78, 0xff, 0x78, 0xff, 0x7c, 0xff, 0x7e, 0xff, 0x7f, 0xff, 0x7e, 0x7f, 0x30, 0x7e, 00, 0x3c};
-#define sizing_width 14
-#define sizing_height 14
-#define sizing_x_hot 7
-#define sizing_y_hot 7
-static char sizing_bits[] = {
-0xff, 0xc0, 0x01, 00, 0x01, 00, 0x01, 00, 0xf1, 0x03, 0x11, 0x02, 0x11, 0x22, 0x11, 0x22, 0x10, 0x22, 0xf0, 0x23, 00, 0x24, 00, 0x28, 00, 0x30, 0xc0, 0x3f};
-#define sizing_mask_width 16
-#define sizing_mask_height 16
-#define sizing_mask_x_hot 8
-#define sizing_mask_y_hot 8
-static char sizing_mask_bits[] = {
-0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0x07, 00, 0xf7, 0x0f, 0xf7, 0x0f, 0xf7, 0xef, 0x77, 0xee, 0x77, 0xee, 0xf7, 0xef, 0xf0, 0xef, 0xf0, 0xff, 00, 0xf8, 0xc0, 0xff, 0xc0, 0xff, 0xc0, 0xff};
-#define spider_width 16
-#define spider_height 16
-#define spider_x_hot 6
-#define spider_y_hot 7
-static char spider_bits[] = {
-0x04, 0x08, 0x08, 0x04, 0x08, 0x04, 0x10, 0x02, 0x10, 0x02, 0xe1, 0xe1, 0xe6, 0x19, 0xf8, 0x07, 0xf8, 0x07, 0xe6, 0x19, 0xe1, 0xe1, 0x10, 0x02, 0x10, 0x02, 0x08, 0x04, 0x08, 0x04, 0x04, 0x08};
-#define spider_mask_width 16
-#define spider_mask_height 16
-#define spider_mask_x_hot 6
-#define spider_mask_y_hot 7
-static char spider_mask_bits[] = {
-0x06, 0x18, 0x0c, 0x0c, 0x08, 0x04, 0x18, 0x06, 0xf1, 0x83, 0xf3, 0xf3, 0xf6, 0x3b, 0xfc, 0x0f, 0xfc, 0x07, 0xf6, 0x1f, 0xf3, 0xf3, 0xf1, 0x83, 0x18, 0x02, 0x18, 0x06, 0x0c, 0x0c, 0x06, 0x18};
-#define spraycan_width 11
-#define spraycan_height 16
-#define spraycan_x_hot 9
-#define spraycan_y_hot 2
-static char spraycan_bits[] = {
-00, 0xe6, 0x80, 00, 0x2c, 0x06, 0x9e, 00, 0x16, 0x06, 0x3f, 00, 0x21, 00, 0x27, 00, 0x25, 00, 0x27, 00, 0x25, 00, 0x27, 00, 0x27, 00, 0x21, 00, 0x21, 00, 0x3f, 00};
-#define spraycan_mask_width 12
-#define spraycan_mask_height 16
-#define spraycan_mask_x_hot 10
-#define spraycan_mask_y_hot 2
-static char spraycan_mask_bits[] = {
-00, 0x4c, 0x18, 0x0d, 0x7c, 0x0d, 0x7c, 0x0d, 0x7e, 0x0d, 0xff, 00, 0xff, 00, 0xff, 00, 0xff, 00, 0xff, 00, 0xff, 00, 0xff, 00, 0xff, 00, 0xff, 00, 0xff, 00, 0xff, 00};
-#define star_width 15
-#define star_height 16
-#define star_x_hot 7
-#define star_y_hot 7
-static char star_bits[] = {
-0x80, 0x80, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x20, 0x02, 0x9c, 0x1c, 0x03, 0x60, 0x1c, 0x1c, 0x90, 0x04, 0x48, 0x09, 0x24, 0x12, 0x14, 0x14, 0x0c, 0x18, 0x04, 0x10};
-#define star_mask_width 16
-#define star_mask_height 16
-#define star_mask_x_hot 7
-#define star_mask_y_hot 7
-static char star_mask_bits[] = {
-0x80, 00, 0xc0, 0x01, 0xc0, 0x01, 0x60, 0x03, 0x60, 0x03, 0x30, 0x06, 0x38, 0x1e, 0x9f, 0x7c, 0x03, 0xe0, 0x1f, 0x7c, 0x9c, 0x1c, 0xcc, 0x19, 0x66, 0x33, 0x36, 0x36, 0x1e, 0x3c, 0x0e, 0x38};
-#define target_width 15
-#define target_height 13
-#define target_x_hot 7
-#define target_y_hot 6
-static char target_bits[] = {
-0xc0, 0x81, 0xf0, 0x07, 0x38, 0x0e, 0x0c, 0x18, 0x06, 0x30, 0x83, 0x60, 0x43, 0x61, 0x83, 0x60, 0x06, 0x30, 0x0c, 0x18, 0x38, 0x0e, 0xf0, 0x07, 0xc0, 0x01};
-#define target_mask_width 16
-#define target_mask_height 14
-#define target_mask_x_hot 7
-#define target_mask_y_hot 7
-static char target_mask_bits[] = {
-0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0x3c, 0x1e, 0x0e, 0x38, 0x87, 0x70, 0xc3, 0xe1, 0x63, 0xe3, 0xc3, 0xe1, 0x87, 0x70, 0x0e, 0x38, 0x3c, 0x1e, 0xf8, 0x0f, 0xe0, 0x03};
-#define tcross_width 13
-#define tcross_height 13
-#define tcross_x_hot 6
-#define tcross_y_hot 6
-static char tcross_bits[] = {
-0x40, 0xe0, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00, 0xff, 0x1f, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00};
-#define tcross_mask_width 15
-#define tcross_mask_height 15
-#define tcross_mask_x_hot 7
-#define tcross_mask_y_hot 7
-static char tcross_mask_bits[] = {
-0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01};
-#define top_left_arrow_width 14
-#define top_left_arrow_height 14
-#define top_left_arrow_x_hot 0
-#define top_left_arrow_y_hot 0
-static char top_left_arrow_bits[] = {
-0x03, 0xc0, 0x0f, 00, 0x3e, 00, 0xfe, 00, 0xfc, 0x03, 0xfc, 0x0f, 0xf8, 00, 0xf8, 00, 0x30, 0x01, 0x30, 0x02, 0x20, 0x04, 0x20, 0x08, 00, 0x10, 00, 0x20};
-#define top_left_arrow_mask_width 16
-#define top_left_arrow_mask_height 16
-#define top_left_arrow_mask_x_hot 1
-#define top_left_arrow_mask_y_hot 1
-static char top_left_arrow_mask_bits[] = {
-0x07, 00, 0x1f, 00, 0x7f, 00, 0xfe, 0x01, 0xfe, 0x07, 0xfc, 0x3f, 0xfc, 0x3f, 0xf8, 0x3f, 0xf8, 0x03, 0xf0, 0x07, 0xf0, 0x0e, 0xe0, 0x1c, 0xe0, 0x38, 0xe0, 0x70, 00, 0xe0, 00, 0xc0};
-#define top_left_corner_width 14
-#define top_left_corner_height 14
-#define top_left_corner_x_hot 0
-#define top_left_corner_y_hot 0
-static char top_left_corner_bits[] = {
-0xff, 0xff, 0xff, 0x3f, 0x03, 00, 0x03, 00, 0x03, 00, 0xe3, 0x0f, 0x63, 00, 0xa3, 00, 0x23, 0x01, 0x23, 0x02, 0x23, 0x04, 0x23, 0x08, 0x03, 00, 0x03, 00};
-#define top_left_corner_mask_width 16
-#define top_left_corner_mask_height 16
-#define top_left_corner_mask_x_hot 1
-#define top_left_corner_mask_y_hot 1
-static char top_left_corner_mask_bits[] = {
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 00, 0xef, 0x3f, 0xef, 0x3f, 0xef, 0x3f, 0xef, 0x03, 0xef, 0x07, 0xef, 0x0e, 0xef, 0x1c, 0xef, 0x38, 0xef, 0x30, 0x0f, 00, 0x0f, 00};
-#define top_right_corner_width 14
-#define top_right_corner_height 14
-#define top_right_corner_x_hot 13
-#define top_right_corner_y_hot 0
-static char top_right_corner_bits[] = {
-0xff, 0xff, 0xff, 0x3f, 00, 0x30, 00, 0x30, 00, 0x30, 0xfc, 0x31, 0x80, 0x31, 0x40, 0x31, 0x20, 0x31, 0x10, 0x31, 0x08, 0x31, 0x04, 0x31, 00, 0x30, 00, 0x30};
-#define top_right_corner_mask_width 16
-#define top_right_corner_mask_height 16
-#define top_right_corner_mask_x_hot 14
-#define top_right_corner_mask_y_hot 1
-static char top_right_corner_mask_bits[] = {
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 00, 0xf0, 0xfc, 0xf7, 0xfc, 0xf7, 0xfc, 0xf7, 0xc0, 0xf7, 0xe0, 0xf7, 0x70, 0xf7, 0x38, 0xf7, 0x1c, 0xf7, 0x0c, 0xf7, 00, 0xf0, 00, 0xf0};
-#define top_side_width 13
-#define top_side_height 14
-#define top_side_x_hot 6
-#define top_side_y_hot 0
-static char top_side_bits[] = {
-0xff, 0xff, 0xff, 0x1f, 00, 00, 0x40, 00, 0xe0, 00, 0x50, 0x01, 0x48, 0x02, 0x44, 0x04, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00};
-#define top_side_mask_width 15
-#define top_side_mask_height 16
-#define top_side_mask_x_hot 7
-#define top_side_mask_y_hot 1
-static char top_side_mask_bits[] = {
-0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xdc, 0x1d, 0xcc, 0x19, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01};
-#define top_tee_width 14
-#define top_tee_height 10
-#define top_tee_x_hot 7
-#define top_tee_y_hot 0
-static char top_tee_bits[] = {
-0xff, 0xff, 0xff, 0x3f, 0xc0, 00, 0xc0, 00, 0xc0, 00, 0xc0, 00, 0xc0, 00, 0xc0, 00, 0xc0, 00, 0xc0, 00};
-#define top_tee_mask_width 16
-#define top_tee_mask_height 12
-#define top_tee_mask_x_hot 8
-#define top_tee_mask_y_hot 1
-static char top_tee_mask_bits[] = {
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03};
-#define trek_width 7
-#define trek_height 16
-#define trek_x_hot 3
-#define trek_y_hot 0
-static char trek_bits[] = {
-0x88, 0x80, 0x1c, 0x3e, 0x7f, 0x77, 0x7f, 0x3e, 0x1c, 0x08, 0x5d, 0x6b, 0x49, 0x41, 0x41, 0x41};
-#define trek_mask_width 9
-#define trek_mask_height 16
-#define trek_mask_x_hot 4
-#define trek_mask_y_hot 0
-static char trek_mask_bits[] = {
-0x38, 0x40, 0x38, 00, 0x7c, 00, 0xfe, 00, 0xff, 0x01, 0xff, 0x01, 0xff, 0x01, 0xfe, 00, 0x7c, 00, 0xba, 00, 0xff, 0x01, 0xff, 0x01, 0xff, 0x01, 0xd7, 0x01, 0xd7, 0x01, 0xc7, 0x01};
-#define ul_angle_width 10
-#define ul_angle_height 10
-#define ul_angle_x_hot 0
-#define ul_angle_y_hot 0
-static char ul_angle_bits[] = {
-0xff, 0xe3, 0xff, 0x03, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00};
-#define ul_angle_mask_width 12
-#define ul_angle_mask_height 12
-#define ul_angle_mask_x_hot 1
-#define ul_angle_mask_y_hot 1
-static char ul_angle_mask_bits[] = {
-0xff, 0x4f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00};
-#define umbrella_width 14
-#define umbrella_height 14
-#define umbrella_x_hot 7
-#define umbrella_y_hot 2
-static char umbrella_bits[] = {
-0x88, 0xc4, 0x20, 0x0a, 0xc9, 0x32, 0xf2, 0x09, 0x4c, 0x06, 0x43, 0x18, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 00, 0x40, 0x01, 0x40, 0x01, 0x80, 00};
-#define umbrella_mask_width 16
-#define umbrella_mask_height 16
-#define umbrella_mask_x_hot 8
-#define umbrella_mask_y_hot 2
-static char umbrella_mask_bits[] = {
-0xe8, 0x76, 0xfb, 0xdf, 0xfd, 0x3f, 0xfe, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xcf, 0x79, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0x80, 0x03};
-#define ur_angle_width 10
-#define ur_angle_height 10
-#define ur_angle_x_hot 9
-#define ur_angle_y_hot 0
-static char ur_angle_bits[] = {
-0xff, 0xe3, 0xff, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03, 00, 0x03};
-#define ur_angle_mask_width 12
-#define ur_angle_mask_height 12
-#define ur_angle_mask_x_hot 10
-#define ur_angle_mask_y_hot 1
-static char ur_angle_mask_bits[] = {
-0xff, 0x4f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f, 00, 0x0f};
-#define watch_width 16
-#define watch_height 16
-#define watch_x_hot 15
-#define watch_y_hot 9
-static char watch_bits[] = {
-0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x07, 0xfc, 0x0f, 0x86, 0x18, 0x83, 0x30, 0x81, 0xe0, 0xc1, 0xe1, 0xc1, 0xe1, 0x21, 0xe0, 0x13, 0x30, 0x06, 0x18, 0xfc, 0x0f, 0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x07};
-#define watch_mask_width 16
-#define watch_mask_height 16
-#define watch_mask_x_hot 15
-#define watch_mask_y_hot 9
-static char watch_mask_bits[] = {
-0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfe, 0x1f, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x1f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f};
-#define xterm_width 7
-#define xterm_height 14
-#define xterm_x_hot 3
-#define xterm_y_hot 7
-static char xterm_bits[] = {
-0xf7, 0x9c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1c, 0x77};
-#define xterm_mask_width 9
-#define xterm_mask_height 16
-#define xterm_mask_x_hot 4
-#define xterm_mask_y_hot 8
-static char xterm_mask_bits[] = {
-0xef, 0x41, 0xff, 0x01, 0xff, 0x01, 0x7c, 00, 0x38, 00, 0x38, 00, 0x38, 00, 0x38, 00, 0x38, 00, 0x38, 00, 0x38, 00, 0x38, 00, 0x7c, 00, 0xff, 0x01, 0xff, 0x01, 0xef, 0x01};
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 9c11680dd..35ddd2db9 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -847,19 +847,16 @@ gtkunixprintincludedir = $(includedir)/gtk-unix-print-2.0/gtk
gtkunixprintinclude_HEADERS = $(gtk_unix_print_public_h_sources)
libgtk_x11_2_0_la_SOURCES = $(gtk_c_sources)
-libgtk_linux_fb_2_0_la_SOURCES = $(gtk_c_sources)
libgtk_win32_2_0_la_SOURCES = $(gtk_c_sources)
libgtk_quartz_2_0_la_SOURCES = $(gtk_c_sources)
libgtk_directfb_2_0_la_SOURCES = $(gtk_c_sources)
libgtk_x11_2_0_la_LDFLAGS = $(libtool_opts)
-libgtk_linux_fb_2_0_la_LDFLAGS = $(libtool_opts)
libgtk_win32_2_0_la_LDFLAGS = $(libtool_opts) -Wl,-luuid
libgtk_quartz_2_0_la_LDFLAGS = $(libtool_opts)
libgtk_directfb_2_0_la_LDFLAGS = $(libtool_opts)
libgtk_x11_2_0_la_LIBADD = $(libadd)
-libgtk_linux_fb_2_0_la_LIBADD = $(libadd)
libgtk_win32_2_0_la_LIBADD = $(libadd) -lole32 -lgdi32 -lcomdlg32 -lwinspool -lcomctl32
libgtk_win32_2_0_la_DEPENDENCIES = $(gtk_def) $(gtk_win32_res)
libgtk_quartz_2_0_la_LIBADD = $(libadd)
@@ -868,7 +865,7 @@ libgtk_directfb_2_0_la_LIBADD = $(libadd)
if USE_WIN32
libgtk_target_ldflags = $(gtk_win32_res_ldflag) $(gtk_win32_symbols)
endif
-EXTRA_LTLIBRARIES = libgtk-x11-2.0.la libgtk-linux-fb-2.0.la libgtk-win32-2.0.la libgtk-quartz-2.0.la libgtk-directfb-2.0.la
+EXTRA_LTLIBRARIES = libgtk-x11-2.0.la libgtk-win32-2.0.la libgtk-quartz-2.0.la libgtk-directfb-2.0.la
install-exec-hook:
if DISABLE_EXPLICIT_DEPS
diff --git a/gtk/gtkwindow-decorate.c b/gtk/gtkwindow-decorate.c
index 20750b8a5..e6bfa06a7 100644
--- a/gtk/gtkwindow-decorate.c
+++ b/gtk/gtkwindow-decorate.c
@@ -26,15 +26,11 @@
#include "gtkwindow.h"
#include "gtkmain.h"
#include "gtkwindow-decorate.h"
+#include "gtkintl.h"
#include "gtkalias.h"
-#ifdef GDK_WINDOWING_FB
-#define DECORATE_WINDOWS
-#endif
-
#ifdef DECORATE_WINDOWS
-#include "linux-fb/gdkfb.h"
typedef enum
{
@@ -283,7 +279,11 @@ gtk_decorated_window_realize (GtkWindow *window)
font_desc = pango_font_description_from_string(DECORATION_TITLE_FONT);
pango_layout_set_font_description (deco->title_layout, font_desc);
pango_font_description_free (font_desc);
-
+
+#if 0
+ /* What is this code exactly doing? I remember we were using the
+ decorated windows with the DirectFB port and it did just work,
+ and there was definitely no code in linux-fb involved. */
gdk_fb_window_set_child_handler (window->frame,
gtk_decorated_window_inner_change,
gtk_decorated_window_inner_get_pos,
@@ -292,6 +292,7 @@ gtk_decorated_window_realize (GtkWindow *window)
/* This is a huge hack to make frames have the same shape as
the window they wrap */
gdk_window_shape_combine_mask (window->frame, GDK_FB_USE_CHILD_SHAPE, 0, 0);
+#endif
}