forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
1e1f49e09a
commit
e8c3fbf4d8
17
ChangeLog
17
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):
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
@ -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 ();
|
||||
}
|
@ -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 ();
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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)
|
||||
{
|
||||
}
|
@ -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 */
|
@ -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;
|
||||
}
|
@ -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__ */
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
@ -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 ();
|
||||
}
|
@ -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;
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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__ */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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__ */
|
@ -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;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -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 ("");
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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 ();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -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
|
3470
gdk/linux-fb/miarc.c
3470
gdk/linux-fb/miarc.c
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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 */
|
@ -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);
|
||||
}
|
@ -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 */
|
@ -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);
|
||||
}
|
@ -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
|
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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
|
@ -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 */
|
@ -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))
|
||||
|
@ -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 */
|
@ -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 */
|
File diff suppressed because it is too large
Load Diff
@ -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
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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};
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user