(Part 2) Remove gdk_*_lookup() defines, since they are defined by the

(Part 2)
	* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
	individual backends already.
	* gdk/gdkregion-generic.h, gdk/gdktypes.h: Put gdkregionbox & gdksegment back together
	again. Yes, there really is a good reason for this, if you are using the gdkregion
	internals, and if you're not, why do you care?
	* gdk/gdkwindow.c: Fix inverted condition
	* gdk/linux-fb: Compiles (for me - it will not work elsewhere most likely).
	* gtk/gtkcolorsel.c, gtk/gtkwindow.c: Add include for linux-fb
	* gtk/gtkrange.c: Redraw trough when moving.
	* gtk/gtktypeutils.c: Fix warning by adding const cast.
	* modules/linux-fb/basic.c: Fix unknown glyph retrieval.
This commit is contained in:
Elliot Lee 2000-07-24 16:19:00 +00:00
parent 72aa0d6611
commit 6d7a643f7c
35 changed files with 2340 additions and 2174 deletions

View File

@ -1,3 +1,16 @@
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
* gdk/gdkregion-generic.h, gdk/gdktypes.h: Put gdkregionbox & gdksegment back together
again. Yes, there really is a good reason for this, if you are using the gdkregion
internals, and if you're not, why do you care?
* gdk/gdkwindow.c: Fix inverted condition
* gdk/linux-fb: Compiles (for me - it will not work elsewhere most likely).
* gtk/gtkcolorsel.c, gtk/gtkwindow.c: Add include for linux-fb
* gtk/gtkrange.c: Redraw trough when moving.
* gtk/gtktypeutils.c: Fix warning by adding const cast.
* modules/linux-fb/basic.c: Fix unknown glyph retrieval.
2000-07-23 Tor Lillqvist <tml@iki.fi>
* configure.in: Check for mkstemp and sigsetjmp. Output

View File

@ -1,3 +1,16 @@
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
* gdk/gdkregion-generic.h, gdk/gdktypes.h: Put gdkregionbox & gdksegment back together
again. Yes, there really is a good reason for this, if you are using the gdkregion
internals, and if you're not, why do you care?
* gdk/gdkwindow.c: Fix inverted condition
* gdk/linux-fb: Compiles (for me - it will not work elsewhere most likely).
* gtk/gtkcolorsel.c, gtk/gtkwindow.c: Add include for linux-fb
* gtk/gtkrange.c: Redraw trough when moving.
* gtk/gtktypeutils.c: Fix warning by adding const cast.
* modules/linux-fb/basic.c: Fix unknown glyph retrieval.
2000-07-23 Tor Lillqvist <tml@iki.fi>
* configure.in: Check for mkstemp and sigsetjmp. Output

View File

@ -1,3 +1,16 @@
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
* gdk/gdkregion-generic.h, gdk/gdktypes.h: Put gdkregionbox & gdksegment back together
again. Yes, there really is a good reason for this, if you are using the gdkregion
internals, and if you're not, why do you care?
* gdk/gdkwindow.c: Fix inverted condition
* gdk/linux-fb: Compiles (for me - it will not work elsewhere most likely).
* gtk/gtkcolorsel.c, gtk/gtkwindow.c: Add include for linux-fb
* gtk/gtkrange.c: Redraw trough when moving.
* gtk/gtktypeutils.c: Fix warning by adding const cast.
* modules/linux-fb/basic.c: Fix unknown glyph retrieval.
2000-07-23 Tor Lillqvist <tml@iki.fi>
* configure.in: Check for mkstemp and sigsetjmp. Output

View File

@ -1,3 +1,16 @@
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
* gdk/gdkregion-generic.h, gdk/gdktypes.h: Put gdkregionbox & gdksegment back together
again. Yes, there really is a good reason for this, if you are using the gdkregion
internals, and if you're not, why do you care?
* gdk/gdkwindow.c: Fix inverted condition
* gdk/linux-fb: Compiles (for me - it will not work elsewhere most likely).
* gtk/gtkcolorsel.c, gtk/gtkwindow.c: Add include for linux-fb
* gtk/gtkrange.c: Redraw trough when moving.
* gtk/gtktypeutils.c: Fix warning by adding const cast.
* modules/linux-fb/basic.c: Fix unknown glyph retrieval.
2000-07-23 Tor Lillqvist <tml@iki.fi>
* configure.in: Check for mkstemp and sigsetjmp. Output

View File

@ -1,3 +1,16 @@
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
* gdk/gdkregion-generic.h, gdk/gdktypes.h: Put gdkregionbox & gdksegment back together
again. Yes, there really is a good reason for this, if you are using the gdkregion
internals, and if you're not, why do you care?
* gdk/gdkwindow.c: Fix inverted condition
* gdk/linux-fb: Compiles (for me - it will not work elsewhere most likely).
* gtk/gtkcolorsel.c, gtk/gtkwindow.c: Add include for linux-fb
* gtk/gtkrange.c: Redraw trough when moving.
* gtk/gtktypeutils.c: Fix warning by adding const cast.
* modules/linux-fb/basic.c: Fix unknown glyph retrieval.
2000-07-23 Tor Lillqvist <tml@iki.fi>
* configure.in: Check for mkstemp and sigsetjmp. Output

View File

@ -1,3 +1,16 @@
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
* gdk/gdkregion-generic.h, gdk/gdktypes.h: Put gdkregionbox & gdksegment back together
again. Yes, there really is a good reason for this, if you are using the gdkregion
internals, and if you're not, why do you care?
* gdk/gdkwindow.c: Fix inverted condition
* gdk/linux-fb: Compiles (for me - it will not work elsewhere most likely).
* gtk/gtkcolorsel.c, gtk/gtkwindow.c: Add include for linux-fb
* gtk/gtkrange.c: Redraw trough when moving.
* gtk/gtktypeutils.c: Fix warning by adding const cast.
* modules/linux-fb/basic.c: Fix unknown glyph retrieval.
2000-07-23 Tor Lillqvist <tml@iki.fi>
* configure.in: Check for mkstemp and sigsetjmp. Output

View File

@ -1,3 +1,16 @@
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
* gdk/gdkregion-generic.h, gdk/gdktypes.h: Put gdkregionbox & gdksegment back together
again. Yes, there really is a good reason for this, if you are using the gdkregion
internals, and if you're not, why do you care?
* gdk/gdkwindow.c: Fix inverted condition
* gdk/linux-fb: Compiles (for me - it will not work elsewhere most likely).
* gtk/gtkcolorsel.c, gtk/gtkwindow.c: Add include for linux-fb
* gtk/gtkrange.c: Redraw trough when moving.
* gtk/gtktypeutils.c: Fix warning by adding const cast.
* modules/linux-fb/basic.c: Fix unknown glyph retrieval.
2000-07-23 Tor Lillqvist <tml@iki.fi>
* configure.in: Check for mkstemp and sigsetjmp. Output

View File

@ -32,6 +32,7 @@ LDFLAGS = @STRIP_BEGIN@ \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-export-dynamic \
-rpath @prefix@/lib \
-L../gdk-pixbuf/.libs -lgdk_pixbuf \
@PANGO_LIBS@ \
@GLIB_DEPLIBS@ \
@more_ldflags@ \

View File

@ -47,10 +47,6 @@ extern "C" {
#define GDK_WINDOW_TYPE(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->window_type)
#define GDK_WINDOW_DESTROYED(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->destroyed)
#define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
#define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
#define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup (xid))
typedef struct _GdkColorInfo GdkColorInfo;
typedef struct _GdkFontPrivate GdkFontPrivate;
typedef struct _GdkEventFilter GdkEventFilter;

View File

@ -45,12 +45,7 @@ SOFTWARE.
#ifndef __GDK_REGION_GENERIC_H__
#define __GDK_REGION_GENERIC_H__
typedef struct _GdkRegionBox GdkRegionBox;
struct _GdkRegionBox
{
int x1, x2, y1, y2;
};
typedef GdkSegment GdkRegionBox;
/*
* clip region

View File

@ -1631,7 +1631,7 @@ gdk_window_invalidate_region (GdkWindow *window,
GdkWindowObject *child = tmp_list->data;
tmp_list = tmp_list->next;
if (child->input_only)
if (!child->input_only)
{
gint width, height;

View File

@ -155,12 +155,12 @@ struct _GdkWindowObject
{
GdkDrawable parent_instance;
gpointer user_data;
GdkDrawable *impl; /* window-system-specific delegate object */
GdkWindowObject *parent;
gpointer user_data;
gint x;
gint y;

View File

@ -1,3 +1,5 @@
. Fix CTree
. DnD?
. All the standard X cursors
. Fix xbm cursors (almost done, need to figure out edges thingie).
. When cursor is changed on active window, really change the cursor
. Faster

View File

@ -35,6 +35,71 @@
static gint gdk_colormap_match_color (GdkColormap *cmap,
GdkColor *color,
const gchar *available);
static gpointer parent_class;
static void
gdk_colormap_finalize (GObject *object)
{
GdkColormap *colormap = GDK_COLORMAP(object);
GdkColormapPrivateFB *private = (GdkColormapPrivateFB*) colormap;
if (private->hash)
g_hash_table_destroy (private->hash);
g_free (private->info);
g_free (colormap->colors);
G_OBJECT_CLASS(parent_class)->finalize(object);
}
static void
gdk_colormap_init (GdkColormap *colormap)
{
colormap->windowing_data = NULL;
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 (GdkColormapFBClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_colormap_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkColormapPrivateFB),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_colormap_init,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
"GdkColormap",
&object_info);
}
return object_type;
}
GdkColormap*
gdk_colormap_new (GdkVisual *visual,
gint private_cmap)
@ -46,11 +111,10 @@ gdk_colormap_new (GdkVisual *visual,
g_return_val_if_fail (visual != NULL, NULL);
private = g_new (GdkColormapPrivateFB, 1);
private = (GdkColormapPrivateFB *)g_type_create_instance(gdk_colormap_get_type());
colormap = (GdkColormap*) private;
private->base.visual = visual;
private->base.ref_count = 1;
fbd = gdk_display;
private->hash = NULL;
@ -125,19 +189,6 @@ gdk_colormap_new (GdkVisual *visual,
return colormap;
}
void
_gdk_colormap_real_destroy (GdkColormap *colormap)
{
GdkColormapPrivateFB *private = (GdkColormapPrivateFB*) colormap;
if (private->hash)
g_hash_table_destroy (private->hash);
g_free (private->info);
g_free (colormap->colors);
g_free (colormap);
}
#define MIN_SYNC_TIME 2
void

View File

@ -28,169 +28,200 @@
#include "gdkprivate-fb.h"
#include "gdkcursor.h"
#include "/home/sopwith/bin/t.xbm"
#include "/home/sopwith/bin/t2.xbm"
static struct {
const guchar *bits;
int width, height, hotx, hoty;
GdkPixmap *pm;
} stock_cursors[] = {
{X_cursor_bits, 14, 14, 6, 8},
{X_cursor_mask_bits, 16, 16, 7, 9},
{arrow_bits, 14, 14, 13, 14},
{arrow_mask_bits, 16, 16, 14, 15},
{based_arrow_down_bits, 8, 10, 3, 1},
{based_arrow_down_mask_bits, 10, 12, 4, 2},
{based_arrow_up_bits, 8, 10, 3, 1},
{based_arrow_up_mask_bits, 10, 12, 4, 2},
{boat_bits, 16, 8, 14, 5},
{boat_mask_bits, 16, 9, 14, 5},
{bogosity_bits, 13, 14, 6, 8},
{bogosity_mask_bits, 15, 16, 7, 9},
{bottom_left_corner_bits, 14, 14, 0, 1},
{bottom_left_corner_mask_bits, 16, 16, 1, 2},
{bottom_right_corner_bits, 14, 14, 13, 1},
{bottom_right_corner_mask_bits, 16, 16, 14, 2},
{bottom_side_bits, 13, 14, 6, 1},
{bottom_side_mask_bits, 15, 16, 7, 2},
{bottom_tee_bits, 14, 10, 7, 1},
{bottom_tee_mask_bits, 16, 12, 8, 2},
{box_spiral_bits, 15, 16, 8, 8},
{box_spiral_mask_bits, 16, 16, 8, 8},
{center_ptr_bits, 10, 14, 4, 14},
{center_ptr_mask_bits, 12, 16, 5, 15},
{circle_bits, 14, 14, 7, 7},
{circle_mask_bits, 16, 16, 8, 8},
{clock_bits, 14, 16, 6, 13},
{clock_mask_bits, 15, 16, 6, 13},
{coffee_mug_bits, 15, 16, 7, 7},
{coffee_mug_mask_bits, 16, 16, 7, 7},
{cross_bits, 16, 15, 7, 8},
{cross_mask_bits, 16, 16, 7, 9},
{cross_reverse_bits, 16, 15, 7, 8},
{cross_reverse_mask_bits, 16, 15, 7, 8},
{crosshair_bits, 16, 15, 7, 8},
{crosshair_mask_bits, 16, 16, 7, 9},
{diamond_cross_bits, 15, 15, 7, 8},
{diamond_cross_mask_bits, 16, 16, 7, 9},
{dot_bits, 10, 10, 5, 5},
{dot_mask_bits, 12, 12, 6, 6},
{dotbox_bits, 12, 12, 6, 7},
{dotbox_mask_bits, 14, 14, 7, 8},
{double_arrow_bits, 10, 14, 5, 7},
{double_arrow_mask_bits, 12, 16, 6, 8},
{draft_large_bits, 15, 15, 14, 15},
{draft_large_mask_bits, 15, 16, 14, 16},
{draft_small_bits, 15, 15, 14, 15},
{draft_small_mask_bits, 15, 15, 14, 15},
{draped_box_bits, 12, 12, 6, 7},
{draped_box_mask_bits, 14, 14, 7, 8},
{exchange_bits, 14, 14, 6, 8},
{exchange_mask_bits, 16, 16, 7, 9},
{fleur_bits, 14, 14, 7, 7},
{fleur_mask_bits, 16, 16, 8, 8},
{gobbler_bits, 16, 15, 14, 13},
{gobbler_mask_bits, 16, 16, 14, 13},
{gumby_bits, 16, 16, 2, 16},
{gumby_mask_bits, 16, 16, 2, 16},
{hand1_bits, 13, 16, 12, 16},
{hand1_mask_bits, 13, 16, 12, 16},
{hand2_bits, 15, 14, 0, 14},
{hand2_mask_bits, 16, 16, 0, 15},
{heart_bits, 15, 14, 6, 6},
{heart_mask_bits, 15, 14, 6, 6},
{icon_bits, 16, 16, 8, 8},
{icon_mask_bits, 16, 16, 8, 8},
{iron_cross_bits, 14, 14, 7, 8},
{iron_cross_mask_bits, 16, 16, 8, 9},
{left_ptr_bits, 8, 14, 0, 14},
{left_ptr_mask_bits, 10, 16, 1, 15},
{left_side_bits, 14, 13, 0, 7},
{left_side_mask_bits, 16, 15, 1, 8},
{left_tee_bits, 10, 14, 0, 7},
{left_tee_mask_bits, 12, 16, 1, 8},
{leftbutton_bits, 16, 16, 8, 8},
{leftbutton_mask_bits, 15, 16, 8, 8},
{ll_angle_bits, 10, 10, 0, 1},
{ll_angle_mask_bits, 12, 12, 1, 2},
{lr_angle_bits, 10, 10, 9, 1},
{lr_angle_mask_bits, 12, 12, 10, 2},
{man_bits, 16, 16, 14, 11},
{man_mask_bits, 16, 16, 14, 11},
{middlebutton_bits, 16, 16, 8, 8},
{middlebutton_mask_bits, 15, 16, 8, 8},
{mouse_bits, 15, 14, 4, 13},
{mouse_mask_bits, 16, 16, 4, 15},
{pencil_bits, 11, 16, 10, 1},
{pencil_mask_bits, 13, 16, 11, 1},
{pirate_bits, 15, 16, 7, 4},
{pirate_mask_bits, 16, 16, 7, 4},
{plus_bits, 10, 10, 4, 5},
{plus_mask_bits, 12, 12, 5, 6},
{question_arrow_bits, 9, 15, 4, 8},
{question_arrow_mask_bits, 11, 16, 5, 8},
{right_ptr_bits, 8, 14, 7, 14},
{right_ptr_mask_bits, 10, 16, 8, 15},
{right_side_bits, 14, 13, 13, 7},
{right_side_mask_bits, 16, 15, 14, 8},
{right_tee_bits, 10, 14, 9, 7},
{right_tee_mask_bits, 12, 16, 10, 8},
{rightbutton_bits, 16, 16, 8, 8},
{rightbutton_mask_bits, 15, 16, 8, 8},
{rtl_logo_bits, 14, 14, 6, 8},
{rtl_logo_mask_bits, 16, 16, 7, 9},
{sailboat_bits, 12, 13, 6, 14},
{sailboat_mask_bits, 16, 16, 8, 16},
{sb_down_arrow_bits, 7, 15, 3, 0},
{sb_down_arrow_mask_bits, 9, 16, 4, 1},
{sb_h_double_arrow_bits, 15, 7, 7, 4},
{sb_h_double_arrow_mask_bits, 15, 9, 7, 5},
{sb_left_arrow_bits, 15, 7, -1, 4},
{sb_left_arrow_mask_bits, 16, 9, 0, 5},
{sb_right_arrow_bits, 15, 7, 15, 4},
{sb_right_arrow_mask_bits, 16, 9, 15, 5},
{sb_up_arrow_bits, 7, 15, 3, 16},
{sb_up_arrow_mask_bits, 9, 16, 4, 16},
{sb_v_double_arrow_bits, 7, 15, 3, 8},
{sb_v_double_arrow_mask_bits, 9, 15, 4, 8},
{shuttle_bits, 15, 16, 10, 16},
{shuttle_mask_bits, 16, 16, 11, 16},
{sizing_bits, 14, 14, 7, 7},
{sizing_mask_bits, 16, 16, 8, 8},
{spider_bits, 16, 16, 6, 9},
{spider_mask_bits, 16, 16, 6, 9},
{spraycan_bits, 11, 16, 9, 14},
{spraycan_mask_bits, 12, 16, 10, 14},
{star_bits, 15, 16, 7, 9},
{star_mask_bits, 16, 16, 7, 9},
{target_bits, 15, 13, 7, 7},
{target_mask_bits, 16, 14, 7, 7},
{tcross_bits, 13, 13, 6, 7},
{tcross_mask_bits, 15, 15, 7, 8},
{top_left_arrow_bits, 14, 14, 0, 14},
{top_left_arrow_mask_bits, 16, 16, 1, 15},
{top_left_corner_bits, 14, 14, 0, 14},
{top_left_corner_mask_bits, 16, 16, 1, 15},
{top_right_corner_bits, 14, 14, 13, 14},
{top_right_corner_mask_bits, 16, 16, 14, 15},
{top_side_bits, 13, 14, 6, 14},
{top_side_mask_bits, 15, 16, 7, 15},
{top_tee_bits, 14, 10, 7, 10},
{top_tee_mask_bits, 16, 12, 8, 11},
{trek_bits, 7, 16, 3, 16},
{trek_mask_bits, 9, 16, 4, 16},
{ul_angle_bits, 10, 10, 0, 10},
{ul_angle_mask_bits, 12, 12, 1, 11},
{umbrella_bits, 14, 14, 7, 12},
{umbrella_mask_bits, 16, 16, 8, 14},
{ur_angle_bits, 10, 10, 9, 10},
{ur_angle_mask_bits, 12, 12, 10, 11},
{watch_bits, 16, 16, 15, 7},
{watch_mask_bits, 16, 16, 15, 7},
{xterm_bits, 7, 14, 3, 7},
{xterm_mask_bits, 9, 16, 4, 8}
{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_from_pixmap (GdkPixmap *source,
GdkPixmap *mask,
GdkColor *fg,
GdkColor *bg,
gint x,
gint y,
gint mask_off_x,
gint mask_off_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;
private->mask_off_x = mask_off_x;
private->mask_off_y = mask_off_y;
return cursor;
}
GdkCursor*
gdk_cursor_new (GdkCursorType cursor_type)
{
@ -218,9 +249,11 @@ gdk_cursor_new (GdkCursorType cursor_type)
gdk_pixmap_ref(mask);
}
return gdk_cursor_new_from_pixmap(pm, mask, NULL, NULL,
stock_cursors[cursor_type].hotx,
stock_cursors[cursor_type].hoty);
return _gdk_cursor_new_from_pixmap(pm, mask, NULL, NULL,
stock_cursors[cursor_type].hotx,
stock_cursors[cursor_type].hoty,
(stock_cursors[cursor_type].hotx - stock_cursors[cursor_type+1].hotx) * 1,
(stock_cursors[cursor_type].hoty - stock_cursors[cursor_type+1].hoty) * 1);
}
GdkCursor*
@ -231,21 +264,7 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
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;
return _gdk_cursor_new_from_pixmap(source, mask, fg, bg, x, y, 0, 0);
}
void

View File

@ -53,67 +53,92 @@ struct _GdkDragContextPrivate {
/* Drag Contexts */
static GList *contexts;
static gpointer parent_class = NULL;
static void
gdk_drag_context_init (GdkDragContext *dragcontext)
{
dragcontext->windowing_data = NULL;
contexts = g_list_prepend (contexts, dragcontext);
}
static void
gdk_drag_context_finalize (GObject *object)
{
GdkDragContext *context = GDK_DRAG_CONTEXT (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);
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);
}
return object_type;
}
GdkDragContext *
gdk_drag_context_new (void)
{
GdkDragContextPrivate *result;
result = g_new0 (GdkDragContextPrivate, 1);
result->ref_count = 1;
contexts = g_list_prepend (contexts, result);
return (GdkDragContext *)result;
return (GdkDragContext *)g_type_create_instance(gdk_drag_context_get_type());
}
void
gdk_drag_context_ref (GdkDragContext *context)
{
g_return_if_fail (context != NULL);
((GdkDragContextPrivate *)context)->ref_count++;
g_object_ref(G_OBJECT(context));
}
void
gdk_drag_context_unref (GdkDragContext *context)
{
GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
g_return_if_fail (context != NULL);
g_return_if_fail (private->ref_count > 0);
private->ref_count--;
if (private->ref_count == 0)
{
g_dataset_destroy (private);
g_list_free (context->targets);
if (context->source_window)
{
#if 0
if ((context->protocol == GDK_DRAG_PROTO_XDND) &&
!context->is_source)
xdnd_manage_source_filter (context, context->source_window, FALSE);
#endif
gdk_window_unref (context->source_window);
}
if (context->dest_window)
gdk_window_unref (context->dest_window);
#if 0
if (private->window_cache)
gdk_window_cache_destroy (private->window_cache);
#endif
contexts = g_list_remove (contexts, private);
g_free (private);
}
g_object_unref(G_OBJECT(context));
}
/*************************************************************

View File

@ -1,10 +1,9 @@
#include "gdkprivate-fb.h"
#include "mi.h"
/* #define USE_FTGRAYS */
#define USE_AA
#include <freetype/ftglyph.h>
#include <string.h>
#include <endian.h>
#ifndef __BYTE_ORDER
#error "endian.h needs to #define __BYTE_ORDER"
@ -15,8 +14,10 @@
#endif
static void gdk_fb_drawable_set_pixel(GdkDrawable *drawable, GdkGC *gc, int x, int y, GdkColor *spot, gboolean abs_coords);
typedef enum { GPR_USED_BG, GPR_AA_GRAYVAL, GPR_NONE, GPR_ERR_BOUNDS } GetPixelRet;
static GetPixelRet gdk_fb_drawable_get_pixel(GdkDrawable *drawable, GdkGC *gc, int x, int y, GdkColor *spot,
gboolean abs_coords, GdkDrawable *bg_relto, GdkDrawable *bgpm);
static void gdk_fb_drawable_destroy (GdkDrawable *drawable);
void gdk_fb_draw_rectangle (GdkDrawable *drawable,
GdkGC *gc,
gint filled,
@ -67,6 +68,15 @@ void gdk_fb_draw_drawable (GdkDrawable *drawable,
gint ydest,
gint width,
gint height);
static void gdk_fb_draw_image(GdkDrawable *drawable,
GdkGC *gc,
GdkImage *image,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height);
static void gdk_fb_draw_points (GdkDrawable *drawable,
GdkGC *gc,
GdkPoint *points,
@ -79,30 +89,82 @@ static void gdk_fb_draw_lines (GdkDrawable *drawable,
GdkGC *gc,
GdkPoint *points,
gint npoints);
static GdkColormap* gdk_fb_get_colormap (GdkDrawable *drawable);
static void gdk_fb_set_colormap (GdkDrawable *drawable,
GdkColormap *colormap);
GdkDrawableClass _gdk_fb_drawable_class = {
gdk_fb_drawable_destroy,
(gpointer)_gdk_fb_gc_new,
gdk_fb_draw_rectangle,
gdk_fb_draw_arc,
gdk_fb_draw_polygon,
gdk_fb_draw_text,
gdk_fb_draw_text_wc,
gdk_fb_draw_drawable,
gdk_fb_draw_points,
gdk_fb_draw_segments,
gdk_fb_draw_lines,
gdk_fb_draw_glyphs
};
static gpointer parent_class = NULL;
static void
gdk_fb_get_size(GdkDrawable *d, gint *width, gint *height)
{
if(width)
*width = GDK_DRAWABLE_P(d)->width;
if(height)
*height = GDK_DRAWABLE_P(d)->height;
}
static void
gdk_drawable_impl_fb_class_init (GdkDrawableFBClass *klass)
{
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
drawable_class->create_gc = _gdk_fb_gc_new;
drawable_class->draw_rectangle = gdk_fb_draw_rectangle;
drawable_class->draw_arc = gdk_fb_draw_arc;
drawable_class->draw_polygon = gdk_fb_draw_polygon;
drawable_class->draw_text = gdk_fb_draw_text;
drawable_class->draw_text_wc = gdk_fb_draw_text_wc;
drawable_class->draw_drawable = gdk_fb_draw_drawable;
drawable_class->draw_points = gdk_fb_draw_points;
drawable_class->draw_segments = gdk_fb_draw_segments;
drawable_class->draw_lines = gdk_fb_draw_lines;
drawable_class->draw_glyphs = gdk_fb_draw_glyphs;
drawable_class->draw_image = gdk_fb_draw_image;
drawable_class->set_colormap = gdk_fb_set_colormap;
drawable_class->get_colormap = gdk_fb_get_colormap;
drawable_class->get_size = gdk_fb_get_size;
}
GType
gdk_drawable_impl_fb_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDrawableFBClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_drawable_impl_fb_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDrawableFBData),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
"GdkDrawableFB",
&object_info);
}
return object_type;
}
/*****************************************************
* FB specific implementations of generic functions *
*****************************************************/
GdkColormap*
gdk_drawable_get_colormap (GdkDrawable *drawable)
static GdkColormap*
gdk_fb_get_colormap (GdkDrawable *drawable)
{
GdkColormap *retval = GDK_DRAWABLE_P(drawable)->colormap;
GdkColormap *retval = GDK_DRAWABLE_FBDATA(drawable)->colormap;
if(!retval)
retval = gdk_colormap_get_system();
@ -110,30 +172,26 @@ gdk_drawable_get_colormap (GdkDrawable *drawable)
return retval;
}
void
gdk_drawable_set_colormap (GdkDrawable *drawable,
GdkColormap *colormap)
static void
gdk_fb_set_colormap (GdkDrawable *drawable,
GdkColormap *colormap)
{
GdkColormap *old_cmap;
old_cmap = GDK_DRAWABLE_P(drawable)->colormap;
GDK_DRAWABLE_P(drawable)->colormap = gdk_colormap_ref(colormap);
old_cmap = GDK_DRAWABLE_FBDATA(drawable)->colormap;
GDK_DRAWABLE_FBDATA(drawable)->colormap = gdk_colormap_ref(colormap);
gdk_colormap_unref(old_cmap);
}
/* Drawing
*/
static void
gdk_fb_drawable_destroy (GdkDrawable *drawable)
{
}
static GdkRegion *
gdk_fb_clip_region(GdkDrawable *drawable, GdkGC *gc, gboolean do_clipping)
GdkRegion *
gdk_fb_clip_region(GdkDrawable *drawable, GdkGC *gc, gboolean do_clipping, gboolean do_children)
{
GdkRectangle draw_rect;
GdkRegion *real_clip_region, *tmpreg;
gboolean watchit = FALSE;
g_assert(!GDK_IS_WINDOW(drawable) || !GDK_WINDOW_P(drawable)->input_only);
g_assert(!GDK_IS_WINDOW(GDK_DRAWABLE_P(drawable)->wrapper) || !GDK_WINDOW_P(GDK_DRAWABLE_P(drawable)->wrapper)->input_only);
draw_rect.x = GDK_DRAWABLE_FBDATA(drawable)->llim_x;
draw_rect.y = GDK_DRAWABLE_FBDATA(drawable)->llim_y;
@ -141,27 +199,41 @@ gdk_fb_clip_region(GdkDrawable *drawable, GdkGC *gc, gboolean do_clipping)
draw_rect.height = GDK_DRAWABLE_FBDATA(drawable)->lim_y - draw_rect.y;
real_clip_region = gdk_region_rectangle(&draw_rect);
if(do_clipping && GDK_IS_WINDOW(drawable) && GDK_WINDOW_P(drawable)->mapped && !GDK_WINDOW_P(drawable)->input_only)
if(do_clipping && GDK_IS_WINDOW(GDK_DRAWABLE_FBDATA(drawable)->wrapper) && GDK_WINDOW_P(GDK_DRAWABLE_P(drawable)->wrapper)->mapped && !GDK_WINDOW_P(GDK_DRAWABLE_FBDATA(drawable)->wrapper)->input_only)
{
GdkWindow *parentwin, *lastwin;
for(parentwin = lastwin = ((GdkWindow *)drawable);
parentwin; lastwin = parentwin, parentwin = GDK_WINDOW_P(parentwin)->parent)
lastwin = GDK_DRAWABLE_FBDATA(drawable)->wrapper;
if(do_children)
parentwin = lastwin;
else
parentwin = (GdkWindow *)GDK_WINDOW_P(lastwin)->parent;
for(;
parentwin; lastwin = parentwin, parentwin = (GdkWindow *)GDK_WINDOW_P(parentwin)->parent)
{
GList *cur;
for(cur = GDK_WINDOW_P(parentwin)->children; cur && cur->data != lastwin; cur = cur->next)
{
GdkRegion *reg2;
if(!GDK_WINDOW_P(cur->data)->mapped || GDK_WINDOW_P(cur->data)->input_only)
continue;
draw_rect.x = GDK_DRAWABLE_FBDATA(cur->data)->llim_x;
draw_rect.y = GDK_DRAWABLE_FBDATA(cur->data)->llim_y;
draw_rect.width = GDK_DRAWABLE_FBDATA(cur->data)->lim_x - draw_rect.x;
draw_rect.height = GDK_DRAWABLE_FBDATA(cur->data)->lim_y - draw_rect.y;
draw_rect.x = GDK_DRAWABLE_IMPL_FBDATA(cur->data)->llim_x;
draw_rect.y = GDK_DRAWABLE_IMPL_FBDATA(cur->data)->llim_y;
draw_rect.width = GDK_DRAWABLE_IMPL_FBDATA(cur->data)->lim_x - draw_rect.x;
draw_rect.height = GDK_DRAWABLE_IMPL_FBDATA(cur->data)->lim_y - draw_rect.y;
tmpreg = gdk_region_rectangle(&draw_rect);
gdk_region_subtract(real_clip_region, tmpreg);
reg2 = gdk_region_copy(real_clip_region);
gdk_region_subtract(reg2, tmpreg);
if(watchit && !gdk_region_point_in(reg2, 100, 353))
G_BREAKPOINT();
gdk_region_destroy(real_clip_region); real_clip_region = reg2;
gdk_region_destroy(tmpreg);
}
}
@ -182,18 +254,20 @@ gdk_fb_clip_region(GdkDrawable *drawable, GdkGC *gc, gboolean do_clipping)
{
GdkDrawable *cmask = GDK_GC_FBDATA(gc)->values.clip_mask;
g_assert(GDK_DRAWABLE_P(cmask)->depth == 1);
g_assert(GDK_DRAWABLE_FBDATA(cmask)->abs_x == 0
&& GDK_DRAWABLE_FBDATA(cmask)->abs_y == 0);
g_assert(GDK_DRAWABLE_IMPL_FBDATA(cmask)->depth == 1);
g_assert(GDK_DRAWABLE_IMPL_FBDATA(cmask)->abs_x == 0
&& GDK_DRAWABLE_IMPL_FBDATA(cmask)->abs_y == 0);
draw_rect.x = GDK_DRAWABLE_FBDATA(drawable)->abs_x + GDK_DRAWABLE_FBDATA(cmask)->llim_x + GDK_GC_FBDATA(gc)->values.clip_x_origin;
draw_rect.y = GDK_DRAWABLE_FBDATA(drawable)->abs_y + GDK_DRAWABLE_FBDATA(cmask)->llim_y + GDK_GC_FBDATA(gc)->values.clip_y_origin;
draw_rect.width = GDK_DRAWABLE_P(cmask)->width;
draw_rect.height = GDK_DRAWABLE_P(cmask)->height;
draw_rect.x = GDK_DRAWABLE_FBDATA(drawable)->abs_x + GDK_DRAWABLE_IMPL_FBDATA(cmask)->llim_x + GDK_GC_FBDATA(gc)->values.clip_x_origin;
draw_rect.y = GDK_DRAWABLE_FBDATA(drawable)->abs_y + GDK_DRAWABLE_IMPL_FBDATA(cmask)->llim_y + GDK_GC_FBDATA(gc)->values.clip_y_origin;
draw_rect.width = GDK_DRAWABLE_IMPL_FBDATA(cmask)->width;
draw_rect.height = GDK_DRAWABLE_IMPL_FBDATA(cmask)->height;
tmpreg = gdk_region_rectangle(&draw_rect);
gdk_region_intersect(real_clip_region, tmpreg);
gdk_region_destroy(tmpreg);
if(!real_clip_region->numRects)
g_warning("Empty clip region");
}
}
@ -209,7 +283,8 @@ gdk_fb_fill_span(GdkDrawable *drawable, GdkGC *gc, GdkSegment *cur, GdkColor *co
if(gc
&& (GDK_GC_FBDATA(gc)->values.clip_mask
|| GDK_GC_FBDATA(gc)->values.tile
|| GDK_GC_FBDATA(gc)->values.stipple))
|| GDK_GC_FBDATA(gc)->values.stipple
|| GDK_GC_FBDATA(gc)->values.function == GDK_INVERT))
{
int clipxoff, clipyoff; /* Amounts to add to curx & cury to get x & y in clip mask */
int tsxoff, tsyoff;
@ -218,14 +293,15 @@ gdk_fb_fill_span(GdkDrawable *drawable, GdkGC *gc, GdkSegment *cur, GdkColor *co
guint mask_rowstride;
GdkPixmap *ts = NULL;
gboolean solid_stipple;
GdkFunction func = GDK_GC_FBDATA(gc)->values.function;
cmask = GDK_GC_FBDATA(gc)->values.clip_mask;
if(cmask)
{
clipmem = GDK_DRAWABLE_FBDATA(cmask)->mem;
clipxoff = GDK_DRAWABLE_FBDATA(cmask)->abs_x - GDK_GC_FBDATA(gc)->values.clip_x_origin - GDK_DRAWABLE_FBDATA(drawable)->abs_x;
clipyoff = GDK_DRAWABLE_FBDATA(cmask)->abs_y - GDK_GC_FBDATA(gc)->values.clip_y_origin - GDK_DRAWABLE_FBDATA(drawable)->abs_y;
mask_rowstride = GDK_DRAWABLE_FBDATA(cmask)->rowstride;
clipmem = GDK_DRAWABLE_IMPL_FBDATA(cmask)->mem;
clipxoff = GDK_DRAWABLE_IMPL_FBDATA(cmask)->abs_x - GDK_GC_FBDATA(gc)->values.clip_x_origin - GDK_DRAWABLE_FBDATA(drawable)->abs_x;
clipyoff = GDK_DRAWABLE_IMPL_FBDATA(cmask)->abs_y - GDK_GC_FBDATA(gc)->values.clip_y_origin - GDK_DRAWABLE_FBDATA(drawable)->abs_y;
mask_rowstride = GDK_DRAWABLE_IMPL_FBDATA(cmask)->rowstride;
}
if(GDK_GC_FBDATA(gc)->values.fill == GDK_TILED
@ -244,11 +320,11 @@ gdk_fb_fill_span(GdkDrawable *drawable, GdkGC *gc, GdkSegment *cur, GdkColor *co
int drawh;
rely = cury - GDK_DRAWABLE_FBDATA(drawable)->abs_y;
drawh = (rely + GDK_GC_FBDATA(gc)->values.ts_y_origin) % GDK_DRAWABLE_P(ts)->height;
drawh = (rely + GDK_GC_FBDATA(gc)->values.ts_y_origin) % GDK_DRAWABLE_IMPL_FBDATA(ts)->height;
if(drawh < 0)
drawh += GDK_DRAWABLE_P(ts)->height;
ystep = MIN(GDK_DRAWABLE_P(ts)->height - drawh, cur->y2 - rely);
ystep = MIN(GDK_DRAWABLE_IMPL_FBDATA(ts)->height - drawh, cur->y2 - rely);
for(curx = cur->x1; curx < cur->x2; curx += xstep)
{
@ -256,13 +332,13 @@ gdk_fb_fill_span(GdkDrawable *drawable, GdkGC *gc, GdkSegment *cur, GdkColor *co
relx = curx - GDK_DRAWABLE_FBDATA(drawable)->abs_x;
draww = (relx + GDK_GC_FBDATA(gc)->values.ts_x_origin) % GDK_DRAWABLE_P(ts)->width;
draww = (relx + GDK_GC_FBDATA(gc)->values.ts_x_origin) % GDK_DRAWABLE_IMPL_FBDATA(ts)->width;
if(draww < 0)
draww += GDK_DRAWABLE_P(ts)->width;
draww += GDK_DRAWABLE_IMPL_FBDATA(ts)->width;
xstep = MIN(GDK_DRAWABLE_P(ts)->width - draww, cur->x2 - relx);
xstep = MIN(GDK_DRAWABLE_IMPL_FBDATA(ts)->width - draww, cur->x2 - relx);
gdk_fb_draw_drawable_3(drawable, gc, ts,
gdk_fb_draw_drawable_3(drawable, gc, GDK_DRAWABLE_IMPL(ts),
dc,
draww, drawh,
relx, rely,
@ -299,9 +375,17 @@ gdk_fb_fill_span(GdkDrawable *drawable, GdkGC *gc, GdkSegment *cur, GdkColor *co
continue;
}
if(ts)
if(func == GDK_INVERT)
{
int wid = GDK_DRAWABLE_P(ts)->width, hih = GDK_DRAWABLE_P(ts)->height;
gdk_fb_drawable_get_pixel(drawable, gc, curx, cury, &spot, TRUE, NULL, NULL);
spot.pixel = ~spot.pixel;
spot.red = ~spot.red;
spot.green = ~spot.green;
spot.blue = ~spot.blue;
}
else if(ts)
{
int wid = GDK_DRAWABLE_IMPL_FBDATA(ts)->width, hih = GDK_DRAWABLE_IMPL_FBDATA(ts)->height;
maskx = (curx+tsxoff)%wid;
masky = (cury+tsyoff)%hih;
@ -310,7 +394,7 @@ gdk_fb_fill_span(GdkDrawable *drawable, GdkGC *gc, GdkSegment *cur, GdkColor *co
if(masky < 0)
masky += hih;
foo = GDK_DRAWABLE_FBDATA(ts)->mem[(maskx >> 3) + GDK_DRAWABLE_FBDATA(ts)->rowstride*masky];
foo = GDK_DRAWABLE_IMPL_FBDATA(ts)->mem[(maskx >> 3) + GDK_DRAWABLE_IMPL_FBDATA(ts)->rowstride*masky];
if(foo & (1 << (maskx % 8)))
{
spot = GDK_GC_FBDATA(gc)->values.foreground;
@ -449,35 +533,38 @@ gdk_fb_fill_span(GdkDrawable *drawable, GdkGC *gc, GdkSegment *cur, GdkColor *co
}
void
gdk_fb_fill_spans(GdkDrawable *drawable,
gdk_fb_fill_spans(GdkDrawable *real_drawable,
GdkGC *gc,
GdkRectangle *rects, int nrects)
{
int i;
GdkColor color;
GdkRegion *real_clip_region, *tmpreg;
GdkRectangle draw_rect, cursor_rect;
GdkRectangle draw_rect;
GdkVisual *visual = gdk_visual_get_system();
gboolean handle_cursor = FALSE;
GdkDrawable *drawable;
if(GDK_IS_WINDOW(drawable) && !GDK_WINDOW_P(drawable)->mapped)
drawable = real_drawable;
GDK_CHECK_IMPL(drawable);
if(GDK_IS_WINDOW(GDK_DRAWABLE_P(drawable)->wrapper) && !GDK_WINDOW_P(GDK_DRAWABLE_P(drawable)->wrapper)->mapped)
return;
if(GDK_IS_WINDOW(drawable) && GDK_WINDOW_P(drawable)->input_only)
if(GDK_IS_WINDOW(GDK_DRAWABLE_P(drawable)->wrapper) && GDK_WINDOW_P(GDK_DRAWABLE_P(drawable)->wrapper)->input_only)
g_error("Drawing on the evil input-only!");
if(gc && (GDK_GC_FBDATA(gc)->values_mask | GDK_GC_FOREGROUND))
color = GDK_GC_FBDATA(gc)->values.foreground;
else if(GDK_IS_WINDOW(drawable))
color = GDK_WINDOW_P(drawable)->bg_color;
else if(GDK_IS_WINDOW(GDK_DRAWABLE_P(drawable)->wrapper))
color = GDK_WINDOW_P(GDK_DRAWABLE_P(drawable)->wrapper)->bg_color;
else
gdk_color_black(GDK_DRAWABLE_P(drawable)->colormap, &color);
real_clip_region = gdk_fb_clip_region(drawable, gc, TRUE);
real_clip_region = gdk_fb_clip_region(drawable, gc, TRUE, (!gc || GDK_GC_FBDATA(gc)->values.function!=GDK_INVERT));
gdk_fb_get_cursor_rect(&cursor_rect);
if(GDK_DRAWABLE_FBDATA(drawable)->mem == GDK_DRAWABLE_FBDATA(gdk_parent_root)->mem
&& cursor_rect.x >= 0
&& gdk_region_rect_in(real_clip_region, &cursor_rect) != GDK_OVERLAP_RECTANGLE_OUT)
if(GDK_DRAWABLE_FBDATA(drawable)->mem == GDK_DRAWABLE_IMPL_FBDATA(gdk_parent_root)->mem
&& gdk_fb_cursor_region_need_hide(real_clip_region))
{
handle_cursor = TRUE;
gdk_fb_cursor_hide();
@ -539,7 +626,6 @@ gdk_fb_fill_spans(GdkDrawable *drawable,
gdk_fb_cursor_unhide();
}
typedef enum { GPR_USED_BG, GPR_AA_GRAYVAL, GPR_NONE, GPR_ERR_BOUNDS } GetPixelRet;
static GetPixelRet
gdk_fb_drawable_get_pixel(GdkDrawable *drawable, GdkGC *gc, int x, int y, GdkColor *spot,
gboolean abs_coords, GdkDrawable *bg_relto, GdkDrawable *bgpm)
@ -569,8 +655,8 @@ gdk_fb_drawable_get_pixel(GdkDrawable *drawable, GdkGC *gc, int x, int y, GdkCol
{
int bgx, bgy;
bgx = (x - GDK_DRAWABLE_FBDATA(bg_relto)->abs_x) % GDK_DRAWABLE_P(bgpm)->width;
bgy = (y - GDK_DRAWABLE_FBDATA(bg_relto)->abs_y) % GDK_DRAWABLE_P(bgpm)->height;
bgx = (x - GDK_DRAWABLE_IMPL_FBDATA(bg_relto)->abs_x) % GDK_DRAWABLE_IMPL_FBDATA(bgpm)->width;
bgy = (y - GDK_DRAWABLE_IMPL_FBDATA(bg_relto)->abs_y) % GDK_DRAWABLE_IMPL_FBDATA(bgpm)->height;
gdk_fb_drawable_get_pixel(bgpm, gc, bgx, bgy, spot, FALSE, NULL, NULL);
retval = GPR_USED_BG;
@ -706,15 +792,17 @@ gdk_fb_drawing_context_init(GdkFBDrawingContext *dc,
dc->rowstride = GDK_DRAWABLE_FBDATA(drawable)->rowstride;
dc->handle_cursor = FALSE;
dc->bgpm = NULL;
dc->bg_relto = drawable;
dc->bg_relto = GDK_DRAWABLE_P(drawable)->wrapper;
dc->draw_bg = draw_bg;
if(GDK_IS_WINDOW(drawable))
GDK_CHECK_IMPL(drawable);
if(GDK_IS_WINDOW(GDK_DRAWABLE_P(drawable)->wrapper))
{
dc->bgpm = GDK_WINDOW_P(drawable)->bg_pixmap;
dc->bgpm = GDK_WINDOW_P(GDK_DRAWABLE_P(drawable)->wrapper)->bg_pixmap;
if(dc->bgpm == GDK_PARENT_RELATIVE_BG)
{
for(; dc->bgpm == GDK_PARENT_RELATIVE_BG && dc->bg_relto; dc->bg_relto = GDK_WINDOW_P(dc->bg_relto)->parent)
for(; dc->bgpm == GDK_PARENT_RELATIVE_BG && dc->bg_relto; dc->bg_relto = (GdkWindow *)GDK_WINDOW_P(dc->bg_relto)->parent)
dc->bgpm = GDK_WINDOW_P(dc->bg_relto)->bg_pixmap;
}
@ -724,7 +812,7 @@ gdk_fb_drawing_context_init(GdkFBDrawingContext *dc,
dc->clipxoff = - GDK_DRAWABLE_FBDATA(drawable)->abs_x;
dc->clipyoff = - GDK_DRAWABLE_FBDATA(drawable)->abs_y;
dc->real_clip_region = gdk_fb_clip_region(drawable, gc, do_clipping);
dc->real_clip_region = gdk_fb_clip_region(drawable, gc, do_clipping, TRUE);
if(gc)
{
@ -733,24 +821,17 @@ gdk_fb_drawing_context_init(GdkFBDrawingContext *dc,
if(GDK_GC_FBDATA(gc)->values.clip_mask)
{
dc->clipmem = GDK_DRAWABLE_FBDATA(GDK_GC_FBDATA(gc)->values.clip_mask)->mem;
dc->clip_rowstride = GDK_DRAWABLE_FBDATA(GDK_GC_FBDATA(gc)->values.clip_mask)->rowstride;
dc->clipmem = GDK_DRAWABLE_IMPL_FBDATA(GDK_GC_FBDATA(gc)->values.clip_mask)->mem;
dc->clip_rowstride = GDK_DRAWABLE_IMPL_FBDATA(GDK_GC_FBDATA(gc)->values.clip_mask)->rowstride;
}
}
if(do_clipping)
if(do_clipping
&& GDK_DRAWABLE_FBDATA(drawable)->mem == GDK_DRAWABLE_IMPL_FBDATA(gdk_parent_root)->mem
&& gdk_fb_cursor_region_need_hide(dc->real_clip_region))
{
GdkRectangle cursor_rect;
gdk_fb_get_cursor_rect(&cursor_rect);
if(GDK_DRAWABLE_FBDATA(drawable)->mem == GDK_DRAWABLE_FBDATA(gdk_parent_root)->mem
&& cursor_rect.x >= 0
&& gdk_region_rect_in(dc->real_clip_region, &cursor_rect) != GDK_OVERLAP_RECTANGLE_OUT)
{
dc->handle_cursor = TRUE;
gdk_fb_cursor_hide();
}
dc->handle_cursor = TRUE;
gdk_fb_cursor_hide();
}
}
@ -801,22 +882,44 @@ gdk_fb_draw_drawable_3 (GdkDrawable *drawable,
int src_x_off, src_y_off;
GdkRegion *tmpreg, *real_clip_region;
int i;
int draw_direction = 1;
gboolean do_quick_draw;
if(GDK_IS_WINDOW(drawable))
GDK_CHECK_IMPL(drawable);
if(GDK_IS_WINDOW(GDK_DRAWABLE_P(drawable)->wrapper))
{
if(!GDK_WINDOW_P(drawable)->mapped)
if(!GDK_WINDOW_P(GDK_DRAWABLE_P(drawable)->wrapper)->mapped)
return;
if(GDK_WINDOW_P(drawable)->input_only)
if(GDK_WINDOW_P(GDK_DRAWABLE_P(drawable)->wrapper)->input_only)
g_error("Drawing on the evil input-only!");
}
if(drawable == src)
{
GdkDrawableFBData *fbd = GDK_DRAWABLE_FBDATA(src);
GdkRegionBox srcb, destb;
srcb.x1 = xsrc;
srcb.y1 = ysrc;
srcb.x2 = xsrc + width;
srcb.y2 = ysrc + height;
destb.x1 = xdest;
destb.y1 = ydest;
destb.x2 = xdest + width;
destb.y2 = xdest + height;
/* One lame hack deserves another ;-) */
srcmem = g_alloca(fbd->rowstride * fbd->lim_y);
memcpy(srcmem, dc->mem, fbd->rowstride * fbd->lim_y);
if(EXTENTCHECK(&srcb, &destb)
&& ydest > ysrc)
draw_direction = -1;
#if 0
{
GdkDrawableFBData *fbd = GDK_DRAWABLE_FBDATA(src);
/* One lame hack deserves another ;-) */
srcmem = g_alloca(fbd->rowstride * (fbd->lim_y - fbd->llim_y));
memmove(srcmem, dc->mem + (fbd->rowstride * fbd->llim_y), fbd->rowstride * (fbd->lim_y - fbd->llim_y));
srcmem -= (fbd->rowstride * fbd->llim_y);
}
#endif
}
/* Do some magic to avoid creating extra regions unnecessarily */
@ -842,32 +945,45 @@ gdk_fb_draw_drawable_3 (GdkDrawable *drawable,
src_x_off = (GDK_DRAWABLE_FBDATA(src)->abs_x + xsrc) - (GDK_DRAWABLE_FBDATA(drawable)->abs_x + xdest);
src_y_off = (GDK_DRAWABLE_FBDATA(src)->abs_y + ysrc) - (GDK_DRAWABLE_FBDATA(drawable)->abs_y + ydest);
do_quick_draw = GDK_DRAWABLE_P(src)->depth == GDK_DRAWABLE_P(drawable)->depth
&& GDK_DRAWABLE_P(src)->depth >= 8
&& GDK_DRAWABLE_P(src)->depth <= 32
&& (!gc || !GDK_GC_FBDATA(gc)->values.clip_mask);
for(i = 0; i < real_clip_region->numRects; i++)
{
GdkRegionBox *cur = &real_clip_region->rects[i];
int cur_y;
int start_y, end_y, cur_y;
if(GDK_DRAWABLE_P(src)->depth == GDK_DRAWABLE_P(drawable)->depth
&& GDK_DRAWABLE_P(src)->depth >= 8
&& GDK_DRAWABLE_P(src)->depth <= 32
&& (!gc || !GDK_GC_FBDATA(gc)->values.clip_mask))
if(draw_direction > 0)
{
start_y = cur->y1;
end_y = cur->y2;
}
else
{
start_y = cur->y2 - 1;
end_y = cur->y1 - 1;
}
if(do_quick_draw)
{
guint depth = GDK_DRAWABLE_P(src)->depth;
guint src_rowstride = GDK_DRAWABLE_FBDATA(src)->rowstride;
int linelen = (cur->x2 - cur->x1)*(depth>>3);
for(cur_y = cur->y1; cur_y < cur->y2; cur_y++)
for(cur_y = start_y; cur_y*draw_direction < end_y*draw_direction; cur_y += draw_direction)
{
memcpy(dc->mem + (cur_y * dc->rowstride) + cur->x1*(depth>>3),
srcmem + ((cur_y + src_y_off)*src_rowstride) + (cur->x1 + src_x_off)*(depth>>3),
linelen);
memmove(dc->mem + (cur_y * dc->rowstride) + cur->x1*(depth>>3),
srcmem + ((cur_y + src_y_off)*src_rowstride) + (cur->x1 + src_x_off)*(depth>>3),
linelen);
}
}
else
{
int cur_x;
for(cur_y = cur->y1; cur_y < cur->y2; cur_y++)
for(cur_y = start_y; cur_y*draw_direction < end_y*draw_direction; cur_y+=draw_direction)
{
for(cur_x = cur->x1; cur_x < cur->x2; cur_x++)
{
@ -1003,7 +1119,7 @@ gdk_fb_draw_drawable (GdkDrawable *drawable,
gint width,
gint height)
{
gdk_fb_draw_drawable_2(drawable, gc, src, xsrc, ysrc, xdest, ydest, width, height, TRUE, TRUE);
gdk_fb_draw_drawable_2(drawable, gc, GDK_DRAWABLE_IMPL(src), xsrc, ysrc, xdest, ydest, width, height, TRUE, TRUE);
}
static void
@ -1165,7 +1281,7 @@ gdk_fb_drawable_clear(GdkDrawable *d)
gint width,
gint height);
_gdk_windowing_window_clear_area(d, 0, 0, GDK_DRAWABLE_P(d)->width, GDK_DRAWABLE_P(d)->height);
_gdk_windowing_window_clear_area(d, 0, 0, GDK_DRAWABLE_IMPL_FBDATA(d)->width, GDK_DRAWABLE_IMPL_FBDATA(d)->height);
}
extern FT_Library gdk_fb_ft_lib;
@ -1180,9 +1296,6 @@ static void gdk_fb_draw_glyphs(GdkDrawable *drawable,
PangoGlyphString *glyphs)
{
int i;
GdkPixmapFBData fbd;
GdkDrawablePrivate tmp_foo;
FT_Face ftf;
int xpos;
GdkFBDrawingContext fbdc;
@ -1190,80 +1303,62 @@ static void gdk_fb_draw_glyphs(GdkDrawable *drawable,
gdk_fb_drawing_context_init(&fbdc, drawable, gc, FALSE, TRUE);
ftf = PANGO_FB_FONT(font)->ftf;
/* Fake its existence as a pixmap */
memset(&tmp_foo, 0, sizeof(tmp_foo));
memset(&fbd, 0, sizeof(fbd));
tmp_foo.klass = &_gdk_fb_drawable_class;
tmp_foo.klass_data = &fbd;
tmp_foo.window_type = GDK_DRAWABLE_PIXMAP;
pango_fb_font_set_size(font);
for(i = xpos = 0; i < glyphs->num_glyphs; i++)
{
FT_GlyphSlot g;
FT_Bitmap *renderme;
PangoFBGlyphInfo *pgi;
int this_wid;
FT_Load_Glyph(ftf, glyphs->glyphs[i].glyph, FT_LOAD_DEFAULT);
g = ftf->glyph;
if(g->format != ft_glyph_format_bitmap)
{
FT_BitmapGlyph bgy;
int bdepth;
#ifdef USE_AA
#ifdef USE_FTGRAYS
bdepth = 256;
#else
bdepth = 128;
#endif
#else
bdepth = 0;
#endif
if(FT_Get_Glyph_Bitmap(ftf, glyphs->glyphs[i].glyph, 0, bdepth, NULL, &bgy))
continue;
renderme = &bgy->bitmap;
}
else
renderme = &g->bitmap;
fbd.drawable_data.mem = renderme->buffer;
fbd.drawable_data.rowstride = renderme->pitch;
tmp_foo.width = fbd.drawable_data.lim_x = renderme->width;
tmp_foo.height = fbd.drawable_data.lim_y = renderme->rows;
switch(renderme->pixel_mode)
{
case ft_pixel_mode_mono:
tmp_foo.depth = 1;
break;
case ft_pixel_mode_grays:
#if defined(USE_FTGRAYS)
tmp_foo.depth = 78;
#else
tmp_foo.depth = 77;
#endif
break;
default:
g_assert_not_reached();
break;
}
pgi = pango_fb_font_get_glyph_info(font, glyphs->glyphs[i].glyph);
this_wid = (xpos + glyphs->glyphs[i].geometry.width)/PANGO_SCALE;
gdk_fb_draw_drawable_3(drawable, gc, (GdkDrawable *)&tmp_foo,
gdk_fb_draw_drawable_3(drawable, gc, (GdkPixmap *)&pgi->fbd,
&fbdc,
0, 0,
x + (xpos + glyphs->glyphs[i].geometry.x_offset)/PANGO_SCALE,
y + glyphs->glyphs[i].geometry.y_offset / PANGO_SCALE
+ ((-ftf->glyph->metrics.horiBearingY) >> 6),
this_wid, renderme->rows);
+ pgi->hbearing,
this_wid, pgi->fbd.drawable_data.height);
xpos += glyphs->glyphs[i].geometry.width;
}
gdk_fb_drawing_context_finalize(&fbdc);
}
static void
gdk_fb_draw_image(GdkDrawable *drawable,
GdkGC *gc,
GdkImage *image,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height)
{
GdkImagePrivateFB *image_private;
GdkPixmapFBData fbd;
g_return_if_fail (drawable != NULL);
g_return_if_fail (image != NULL);
g_return_if_fail (gc != NULL);
image_private = (GdkImagePrivateFB*) image;
g_return_if_fail (image->type == GDK_IMAGE_NORMAL);
/* Fake its existence as a pixmap */
memset(&fbd, 0, sizeof(fbd));
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;
gdk_fb_draw_drawable_2(drawable, gc, (GdkPixmap *)&fbd, xsrc, ysrc, xdest, ydest, width, height, TRUE, TRUE);
}

View File

@ -110,7 +110,7 @@ gdk_events_init (void)
NULL
};
g_source_add(G_PRIORITY_HIGH_IDLE, TRUE, &fb_events_funcs, NULL, NULL, NULL);
g_source_add(GDK_PRIORITY_EVENTS, TRUE, &fb_events_funcs, NULL, NULL, NULL);
}
/*
@ -205,7 +205,9 @@ fb_events_dispatch(gpointer source_data, GTimeVal *dispatch_time, gpointer user_
{
if(event->type == GDK_EXPOSE
&& event->expose.window == gdk_parent_root)
gdk_fb_drawable_clear(event->expose.window);
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);

View File

@ -15,9 +15,10 @@ extern GdkFBDisplay *gdk_display;
extern const char *gdk_progclass;
#define gdk_window_lookup(xid) (xid)
#define gdk_pixmap_lookup(xid) (xid)
#define gdk_font_lookup(xid) (xid)
#define gdk_window_foreign_new(xid) gdk_window_ref(xid)
#define gdk_window_lookup(xid) ((GdkWindow*) (xid))
#define gdk_pixmap_lookup(xid) ((GdkPixmap*) (xid))
#define gdk_font_lookup(xid) ((GdkFont*) (xid))
#endif /* GDKFB_H */

View File

@ -8,7 +8,7 @@ typedef enum {
GDK_GC_DIRTY_TS = 1 << 1
} GdkGCDirtyValues;
static void gdk_fb_gc_destroy (GdkGC *gc);
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,
@ -16,15 +16,52 @@ static void gdk_fb_gc_set_values (GdkGC *gc,
GdkGCValuesMask values_mask);
static void gdk_fb_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gchar dash_list[],
gint8 dash_list[],
gint n);
static GdkGCClass gdk_fb_gc_class = {
gdk_fb_gc_destroy,
gdk_fb_gc_get_values,
gdk_fb_gc_set_values,
gdk_fb_gc_set_dashes
};
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);
}
return object_type;
}
GdkGC *
_gdk_fb_gc_new (GdkDrawable *drawable,
@ -32,14 +69,13 @@ _gdk_fb_gc_new (GdkDrawable *drawable,
GdkGCValuesMask values_mask)
{
GdkGC *gc;
GdkGCPrivate *private;
GdkGC *private;
GdkGCFBData *data;
gc = gdk_gc_alloc ();
private = (GdkGCPrivate *)gc;
gc = GDK_GC(g_type_create_instance(gdk_gc_fb_get_type()));
private = (GdkGC *)gc;
private->klass = &gdk_fb_gc_class;
private->klass_data = data = g_new0 (GdkGCFBData, 1);
data = (GdkGCFBData *)gc;
data->values.foreground.pixel = 255;
data->values.foreground.red = data->values.foreground.green = data->values.foreground.blue = 65535;
@ -49,12 +85,18 @@ _gdk_fb_gc_new (GdkDrawable *drawable,
}
static void
gdk_fb_gc_destroy (GdkGC *gc)
gdk_fb_gc_finalize (GObject *obj)
{
GdkGC *gc = GDK_GC_P(obj);
if (GDK_GC_FBDATA (gc)->clip_region)
gdk_region_destroy (GDK_GC_FBDATA (gc)->clip_region);
g_free (GDK_GC_FBDATA (gc));
if (GDK_GC_FBDATA (gc)->values.clip_mask)
gdk_pixmap_unref(GDK_GC_FBDATA (gc)->values.clip_mask);
if (GDK_GC_FBDATA (gc)->values.stipple)
gdk_pixmap_unref(GDK_GC_FBDATA (gc)->values.stipple);
if (GDK_GC_FBDATA (gc)->values.tile)
gdk_pixmap_unref(GDK_GC_FBDATA (gc)->values.tile);
}
static void
@ -110,7 +152,7 @@ gdk_fb_gc_set_values (GdkGC *gc,
{
oldpm = GDK_GC_FBDATA(gc)->values.tile;
if(values->tile)
g_assert(GDK_DRAWABLE_P(values->tile)->depth >= 8);
g_assert(GDK_DRAWABLE_IMPL_FBDATA(values->tile)->depth >= 8);
GDK_GC_FBDATA(gc)->values.tile = values->tile?gdk_pixmap_ref(values->tile):NULL;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_TILE;
@ -122,7 +164,7 @@ gdk_fb_gc_set_values (GdkGC *gc,
{
oldpm = GDK_GC_FBDATA(gc)->values.stipple;
if(values->stipple)
g_assert(GDK_DRAWABLE_P(values->stipple)->depth == 1);
g_assert(GDK_DRAWABLE_IMPL_FBDATA(values->stipple)->depth == 1);
GDK_GC_FBDATA(gc)->values.stipple = values->stipple?gdk_pixmap_ref(values->stipple):NULL;
GDK_GC_FBDATA(gc)->values_mask |= GDK_GC_STIPPLE;
if(oldpm)
@ -209,7 +251,7 @@ gdk_fb_gc_set_values (GdkGC *gc,
static void
gdk_fb_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gchar dash_list[],
gint8 dash_list[],
gint n)
{
GDK_GC_FBDATA(gc)->dash_offset = dash_offset;
@ -229,7 +271,6 @@ gdk_fb_gc_set_dashes (GdkGC *gc,
static void
gc_unset_cmask(GdkGC *gc)
{
GdkGCPrivate *private = (GdkGCPrivate *)gc;
GdkGCFBData *data;
data = GDK_GC_FBDATA (gc);
if(data->values.clip_mask)
@ -243,7 +284,7 @@ void
gdk_gc_set_clip_rectangle (GdkGC *gc,
GdkRectangle *rectangle)
{
GdkGCPrivate *private = (GdkGCPrivate *)gc;
GdkGC *private = (GdkGC *)gc;
GdkGCFBData *data;
g_return_if_fail (gc != NULL);
@ -271,7 +312,7 @@ void
gdk_gc_set_clip_region (GdkGC *gc,
GdkRegion *region)
{
GdkGCPrivate *private = (GdkGCPrivate *)gc;
GdkGC *private = (GdkGC *)gc;
GdkGCFBData *data;
g_return_if_fail (gc != NULL);

View File

@ -5,22 +5,23 @@ gdk_window_scroll (GdkWindow *window,
gint dx,
gint dy)
{
GdkWindowPrivate *private = GDK_WINDOW_P(window);
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));
if (GDK_DRAWABLE_DESTROYED (window))
return;
clip_rect.x = GDK_DRAWABLE_FBDATA(window)->llim_x - GDK_DRAWABLE_FBDATA(window)->abs_x;
clip_rect.y = GDK_DRAWABLE_FBDATA(window)->llim_y - GDK_DRAWABLE_FBDATA(window)->abs_y;
clip_rect.width = GDK_DRAWABLE_FBDATA(window)->lim_x - GDK_DRAWABLE_FBDATA(window)->llim_x;
clip_rect.height = GDK_DRAWABLE_FBDATA(window)->lim_y - GDK_DRAWABLE_FBDATA(window)->llim_y;
clip_rect.x = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x;
clip_rect.y = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y;
clip_rect.width = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_x - GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x;
clip_rect.height = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_y - GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y;
handle_cursor = gdk_fb_cursor_need_hide(&clip_rect);
clip_rect.x -= GDK_DRAWABLE_IMPL_FBDATA(window)->abs_x;
clip_rect.y -= GDK_DRAWABLE_IMPL_FBDATA(window)->abs_y;
invalidate_region = gdk_region_rectangle (&clip_rect);
dest_rect = clip_rect;
@ -28,6 +29,9 @@ gdk_window_scroll (GdkWindow *window,
dest_rect.y += dy;
gdk_rectangle_intersect (&dest_rect, &clip_rect, &dest_rect);
if(handle_cursor)
gdk_fb_cursor_hide();
if (dest_rect.width > 0 && dest_rect.height > 0)
{
GdkRegion *tmp_region;
@ -35,15 +39,21 @@ gdk_window_scroll (GdkWindow *window,
tmp_region = gdk_region_rectangle (&dest_rect);
gdk_region_subtract (invalidate_region, tmp_region);
gdk_region_destroy (tmp_region);
gdk_fb_draw_drawable_2(window, NULL, window, dest_rect.x - dx, dest_rect.y - dy, dest_rect.x, dest_rect.y,
gdk_fb_draw_drawable_2(GDK_DRAWABLE_IMPL(window), NULL, GDK_DRAWABLE_IMPL(window), dest_rect.x - dx, dest_rect.y - dy, dest_rect.x, dest_rect.y,
dest_rect.width, dest_rect.height,
FALSE, FALSE);
}
gdk_window_invalidate_region (window, invalidate_region, TRUE);
gdk_region_destroy (invalidate_region);
for(tmp_list = private->children; tmp_list; tmp_list = tmp_list->next)
gdk_window_move (tmp_list->data, GDK_WINDOW_P(tmp_list->data)->x + dx, GDK_WINDOW_P(tmp_list->data)->y + dy);
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();
}

View File

@ -39,26 +39,68 @@
#include "gdkprivate.h"
#include "gdkprivate-fb.h"
struct _GdkImagePrivateFB
static gpointer parent_class = NULL;
void _gdk_windowing_image_init(void)
{
GdkImagePrivate base;
};
}
static void gdk_fb_image_destroy (GdkImage *image);
static void gdk_image_put_normal (GdkImage *image,
GdkDrawable *drawable,
GdkGC *gc,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height);
static void
gdk_image_init (GdkImage *image)
{
}
static GdkImageClass image_class_normal = {
gdk_fb_image_destroy,
gdk_image_put_normal
};
static void
gdk_image_finalize (GObject *object)
{
GdkImage *image = GDK_IMAGE (object);
GdkImagePrivateFB *private;
private = (GdkImagePrivateFB*) image;
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);
}
return object_type;
}
GdkImage *
gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h)
@ -66,10 +108,7 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h)
GdkImage *image;
GdkImagePrivateFB *private;
private = g_new(GdkImagePrivateFB, 1);
image = (GdkImage *) private;
private->base.ref_count = 1;
private->base.klass = &image_class_normal;
image = (GdkImage *)private = (GdkImagePrivateFB *)g_type_create_instance(gdk_image_get_type());
image->type = GDK_IMAGE_NORMAL;
image->visual = visual;
image->width = w;
@ -84,11 +123,6 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h)
return image;
}
void
gdk_image_init (void)
{
}
GdkImage*
gdk_image_new (GdkImageType type,
GdkVisual *visual,
@ -98,26 +132,18 @@ gdk_image_new (GdkImageType type,
GdkImage *image;
GdkImagePrivateFB *private;
private = g_new (GdkImagePrivateFB, 1);
image = (GdkImage*) private;
image = (GdkImage *)private = (GdkImagePrivateFB *)g_type_create_instance(gdk_image_get_type());
private->base.ref_count = 1;
image->type = 0;
image->visual = visual;
image->width = width;
image->height = height;
image->depth = visual->depth;
private->base.klass = &image_class_normal;
if (image)
{
image->byte_order = 0;
image->mem = g_malloc(width * height * (image->depth >> 3));
image->bpp = image->depth/8;
image->bpl = (width * image->depth + 7)/8;
}
image->byte_order = 0;
image->mem = g_malloc(width * height * (image->depth >> 3));
image->bpp = image->depth/8;
image->bpl = (width * image->depth + 7)/8;
return image;
}
@ -131,20 +157,12 @@ gdk_image_get (GdkWindow *window,
{
GdkImage *image;
GdkImagePrivateFB *private;
gint bits_per_pixel = GDK_DRAWABLE_P(gdk_parent_root)->depth;
gint bits_per_pixel = GDK_DRAWABLE_IMPL_FBDATA(gdk_parent_root)->depth;
GdkPixmapFBData fbd;
GdkDrawablePrivate tmp_foo;
g_return_val_if_fail (window != NULL, NULL);
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
private = g_new (GdkImagePrivateFB, 1);
image = (GdkImage*) private;
private->base.ref_count = 1;
private->base.klass = &image_class_normal;
image = (GdkImage *)private = (GdkImagePrivateFB *)g_type_create_instance(gdk_image_get_type());
image->type = GDK_IMAGE_NORMAL;
image->visual = gdk_window_get_visual (window);
@ -165,18 +183,15 @@ gdk_image_get (GdkWindow *window,
image->mem = g_malloc(image->bpl * image->height);
/* Fake its existence as a pixmap */
memset(&tmp_foo, 0, sizeof(tmp_foo));
memset(&fbd, 0, sizeof(fbd));
tmp_foo.klass = &_gdk_fb_drawable_class;
tmp_foo.klass_data = &fbd;
fbd.drawable_data.mem = image->mem;
fbd.drawable_data.rowstride = image->bpl;
tmp_foo.width = fbd.drawable_data.lim_x = image->width;
tmp_foo.height = fbd.drawable_data.lim_y = image->height;
tmp_foo.depth = image->depth;
tmp_foo.window_type = GDK_DRAWABLE_PIXMAP;
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;
gdk_fb_draw_drawable((GdkPixmap *)&tmp_foo, NULL, window, x, y, 0, 0, width, height);
gdk_fb_draw_drawable_2((GdkPixmap *)&fbd, NULL, window, x, y, 0, 0, width, height, TRUE, TRUE);
return image;
}
@ -253,61 +268,6 @@ gdk_image_put_pixel (GdkImage *image,
}
}
static void
gdk_fb_image_destroy (GdkImage *image)
{
GdkImagePrivateFB *private;
g_return_if_fail (image != NULL);
private = (GdkImagePrivateFB*) image;
g_free(image->mem); image->mem = NULL;
g_free (image);
}
static void
gdk_image_put_normal (GdkImage *image,
GdkDrawable *drawable,
GdkGC *gc,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height)
{
GdkImagePrivateFB *image_private;
GdkPixmapFBData fbd;
GdkDrawablePrivate tmp_foo;
g_return_if_fail (drawable != NULL);
g_return_if_fail (image != NULL);
g_return_if_fail (gc != NULL);
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
image_private = (GdkImagePrivateFB*) image;
g_return_if_fail (image->type == GDK_IMAGE_NORMAL);
/* Fake its existence as a pixmap */
memset(&tmp_foo, 0, sizeof(tmp_foo));
memset(&fbd, 0, sizeof(fbd));
tmp_foo.klass = &_gdk_fb_drawable_class;
tmp_foo.klass_data = &fbd;
fbd.drawable_data.mem = image->mem;
fbd.drawable_data.rowstride = image->bpl;
tmp_foo.width = fbd.drawable_data.lim_x = image->width;
tmp_foo.height = fbd.drawable_data.lim_y = image->height;
tmp_foo.depth = image->depth;
tmp_foo.window_type = GDK_DRAWABLE_PIXMAP;
gdk_fb_draw_drawable(drawable, gc, (GdkPixmap *)&tmp_foo, xsrc, ysrc, xdest, ydest, width, height);
}
void
gdk_image_exit(void)
{

File diff suppressed because it is too large Load Diff

View File

@ -27,108 +27,159 @@
#include <stdlib.h>
#include "config.h"
#include "gdkfb.h"
#include "gdkprivate-fb.h"
#include "gdkinput.h"
#include "gdkprivate.h"
#include "gdkinputprivate.h"
static const GdkAxisUse gdk_input_core_axes[] = { GDK_AXIS_X, GDK_AXIS_Y };
static const GdkDeviceAxis gdk_input_core_axes[] = {
{ GDK_AXIS_X, 0, 0 },
{ GDK_AXIS_Y, 0, 0 }
};
const GdkDeviceInfo gdk_input_core_info =
static GdkDevice gdk_input_core_info =
{
GDK_CORE_POINTER,
"Core Pointer",
GDK_SOURCE_MOUSE,
GDK_MODE_SCREEN,
TRUE,
2,
gdk_input_core_axes
(GdkDeviceAxis *)gdk_input_core_axes,
0,
NULL
};
GdkDevice *gdk_core_pointer = (GdkDevice *)&gdk_input_core_info;
/* Global variables */
GdkInputVTable gdk_input_vtable;
/* information about network port and host for gxid daemon */
gchar *gdk_input_gxid_host;
gint gdk_input_gxid_port;
gint gdk_input_ignore_core;
GList *gdk_input_devices;
GList *gdk_input_windows;
GList *gdk_input_devices;
GList *
gdk_input_list_devices (void)
gdk_devices_list (void)
{
return gdk_input_devices;
}
void
gdk_input_set_source (guint32 deviceid, GdkInputSource source)
gdk_device_set_source (GdkDevice *device, GdkInputSource source)
{
GdkDevicePrivate *gdkdev = gdk_input_find_device(deviceid);
g_return_if_fail (gdkdev != NULL);
gdkdev->info.source = source;
device->source = source;
}
gint
gdk_input_set_mode (guint32 deviceid, GdkInputMode mode)
{
if (deviceid == GDK_CORE_POINTER)
return FALSE;
if (gdk_input_vtable.set_mode)
return gdk_input_vtable.set_mode(deviceid,mode);
else
return FALSE;
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_input_set_axes (guint32 deviceid, GdkAxisUse *axes)
gdk_device_set_axis_use (GdkDevice *device,
guint index,
GdkAxisUse use)
{
if (deviceid != GDK_CORE_POINTER && gdk_input_vtable.set_axes)
gdk_input_vtable.set_axes (deviceid, axes);
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_input_set_key (guint32 deviceid,
guint index,
guint keyval,
GdkModifierType modifiers)
void
gdk_device_get_state (GdkDevice *device,
GdkWindow *window,
gdouble *axes,
GdkModifierType *mask)
{
if (deviceid != GDK_CORE_POINTER && gdk_input_vtable.set_key)
gdk_input_vtable.set_key (deviceid, index, keyval, modifiers);
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;
}
}
GdkTimeCoord *
gdk_input_motion_events (GdkWindow *window,
guint32 deviceid,
guint32 start,
guint32 stop,
gint *nevents_return)
void
gdk_device_free_history (GdkTimeCoord **events,
gint n_events)
{
g_return_val_if_fail (window != NULL, NULL);
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
gint i;
for (i=0; i<n_events; i++)
g_free (events[i]);
*nevents_return = 0;
return NULL;
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)
{
if (gdk_input_vtable.enable_window)
return gdk_input_vtable.enable_window (window, gdkdev);
else
return TRUE;
return TRUE;
}
gint
gdk_input_disable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
{
if (gdk_input_vtable.disable_window)
return gdk_input_vtable.disable_window(window,gdkdev);
else
return TRUE;
return TRUE;
}
@ -162,8 +213,6 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
g_return_if_fail (GDK_IS_WINDOW (window));
window_private = (GdkWindowPrivate*) window;
if (GDK_DRAWABLE_DESTROYED (window))
return;
if (mode == GDK_EXTENSION_EVENTS_NONE)
mask = 0;
@ -204,7 +253,7 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
{
GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)(tmp_list->data);
if (gdkdev->info.deviceid != GDK_CORE_POINTER)
if (gdkdev != (GdkDevicePrivate *)gdk_core_pointer)
{
if (mask != 0 && gdkdev->info.mode != GDK_MODE_DISABLED
&& (gdkdev->info.has_cursor || mode == GDK_EXTENSION_EVENTS_ALL))
@ -236,9 +285,9 @@ gdk_input_exit (void)
for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
{
gdkdev = (GdkDevicePrivate *)(tmp_list->data);
if (gdkdev->info.deviceid != GDK_CORE_POINTER)
if (gdkdev != (GdkDevicePrivate *)gdk_core_pointer)
{
gdk_input_set_mode(gdkdev->info.deviceid,GDK_MODE_DISABLED);
gdk_device_set_mode((GdkDevice *)gdkdev, GDK_MODE_DISABLED);
g_free(gdkdev->info.name);
g_free(gdkdev->info.axes);
@ -256,32 +305,35 @@ gdk_input_exit (void)
g_list_free(gdk_input_windows);
}
GdkDevicePrivate *
gdk_input_find_device(guint32 id)
/**
* gdk_device_get_axis:
* @axis: a #GdkDevice
* @axes: pointer to an array of axes
* @use: the use to look for
* @value: location to store the found value.
*
* Interprets an array of double as axis values for a given device,
* and locates the value in the array for a given axis use.
*
* Return value: %TRUE if the given axis use was found, otherwies %FALSE
**/
gboolean
gdk_device_get_axis (GdkDevice *device, gdouble *axes, GdkAxisUse use, gdouble *value)
{
GList *tmp_list = gdk_input_devices;
GdkDevicePrivate *gdkdev;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)(tmp_list->data);
if (gdkdev->info.deviceid == id)
return gdkdev;
tmp_list = tmp_list->next;
}
return NULL;
}
gint i;
g_return_val_if_fail (device != NULL, FALSE);
void
gdk_input_window_get_pointer (GdkWindow *window,
guint32 deviceid,
gdouble *x,
gdouble *y,
gdouble *pressure,
gdouble *xtilt,
gdouble *ytilt,
GdkModifierType *mask)
{
if (gdk_input_vtable.get_pointer)
gdk_input_vtable.get_pointer (window, deviceid, x, y, pressure,
xtilt, ytilt, mask);
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;
}

View File

@ -95,7 +95,7 @@ struct _GdkAxisInfo
#define GDK_INPUT_NUM_EVENTC 6
struct _GdkDevicePrivate {
GdkDeviceInfo info;
GdkDevice info;
};
struct _GdkInputWindow
@ -120,7 +120,7 @@ struct _GdkInputWindow
/* Global data */
extern const GdkDeviceInfo gdk_input_core_info;
extern const GdkDevice gdk_input_core_info;
extern GList *gdk_input_devices;
extern GList *gdk_input_windows;

View File

@ -173,15 +173,12 @@ gdk_pointer_grab (GdkWindow * window,
if(!owner_events)
_gdk_fb_pointer_grab_window = gdk_window_ref(window);
if(cursor)
gdk_fb_cursor_hide();
_gdk_fb_pointer_grab_confine = confine_to?gdk_window_ref(confine_to):NULL;
_gdk_fb_pointer_grab_events = event_mask;
_gdk_fb_pointer_grab_cursor = cursor?gdk_cursor_ref(cursor):NULL;
if(cursor)
gdk_fb_cursor_unhide();
gdk_fb_cursor_reset();
return GDK_GRAB_SUCCESS;
}
@ -206,9 +203,6 @@ gdk_pointer_ungrab (guint32 time)
{
gboolean have_grab_cursor = _gdk_fb_pointer_grab_cursor && 1;
if(have_grab_cursor)
gdk_fb_cursor_hide();
if(_gdk_fb_pointer_grab_window)
gdk_window_unref(_gdk_fb_pointer_grab_window);
_gdk_fb_pointer_grab_window = NULL;
@ -222,7 +216,7 @@ gdk_pointer_ungrab (guint32 time)
_gdk_fb_pointer_grab_cursor = NULL;
if(have_grab_cursor)
gdk_fb_cursor_unhide();
gdk_fb_cursor_reset();
}
/*
@ -471,7 +465,7 @@ gdk_event_make(GdkWindow *window, GdkEventType type, gboolean append_to_queue)
GDK_SUBSTRUCTURE_MASK, /* GDK_DELETE = 0, */
GDK_STRUCTURE_MASK, /* GDK_DESTROY = 1, */
GDK_EXPOSURE_MASK, /* GDK_EXPOSE = 2, */
GDK_POINTER_MOTION_MASK|GDK_BUTTON_MOTION_MASK, /* GDK_MOTION_NOTIFY = 3, */
GDK_POINTER_MOTION_MASK, /* GDK_MOTION_NOTIFY = 3, */
GDK_BUTTON_PRESS_MASK, /* GDK_BUTTON_PRESS = 4, */
GDK_BUTTON_PRESS_MASK, /* GDK_2BUTTON_PRESS = 5, */
GDK_BUTTON_PRESS_MASK, /* GDK_3BUTTON_PRESS = 6, */
@ -501,24 +495,47 @@ gdk_event_make(GdkWindow *window, GdkEventType type, gboolean append_to_queue)
GDK_EXPOSURE_MASK, /* GDK_NO_EXPOSE = 30, */
GDK_SCROLL_MASK /* GDK_SCROLL = 31 */
};
guint evmask;
evmask = GDK_WINDOW_IMPL_FBDATA(window)->event_mask;
if(GDK_WINDOW_FBDATA(window)->event_mask & type_masks[type])
if(evmask & GDK_BUTTON_MOTION_MASK)
{
evmask |= GDK_BUTTON1_MOTION_MASK|GDK_BUTTON2_MOTION_MASK|GDK_BUTTON3_MOTION_MASK;
}
if(evmask & (GDK_BUTTON1_MOTION_MASK|GDK_BUTTON2_MOTION_MASK|GDK_BUTTON3_MOTION_MASK))
{
gint x, y;
GdkModifierType mask;
gdk_input_ps2_get_mouseinfo(&x, &y, &mask);
if(((mask & GDK_BUTTON1_MASK) && (evmask & GDK_BUTTON1_MOTION_MASK))
|| ((mask & GDK_BUTTON2_MASK) && (evmask & GDK_BUTTON2_MOTION_MASK))
|| ((mask & GDK_BUTTON3_MASK) && (evmask & GDK_BUTTON3_MOTION_MASK)))
evmask |= GDK_POINTER_MOTION_MASK;
}
if(evmask & type_masks[type])
{
GdkEvent *event = gdk_event_new();
guint32 the_time = g_latest_time.tv_sec;
guint32 the_time = g_latest_time.tv_sec * 1000 + g_latest_time.tv_usec / 1000;
event->any.type = type;
event->any.window = gdk_window_ref(window);
event->any.send_event = FALSE;
switch(type)
{
case GDK_MOTION_NOTIFY:
event->motion.time = the_time;
event->motion.axes = NULL;
break;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
event->button.time = the_time;
event->button.axes = NULL;
break;
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
@ -581,6 +598,8 @@ void CM(void)
gpointer arry[256];
int i;
return;
free(mymem);
for(i = 0; i < sizeof(arry)/sizeof(arry[0]); i++)
@ -610,9 +629,9 @@ void RP(GdkDrawable *d)
if(!GDK_PIXMAP_FBDATA(d)->no_free_mem)
{
guchar *oldmem = GDK_DRAWABLE_FBDATA(d)->mem;
guint len = ((GDK_DRAWABLE_P(d)->width * GDK_DRAWABLE_P(d)->depth + 7) / 8) * GDK_DRAWABLE_P(d)->height;
GDK_DRAWABLE_FBDATA(d)->mem = g_malloc(len);
memcpy(GDK_DRAWABLE_FBDATA(d)->mem, oldmem, len);
guint len = ((GDK_DRAWABLE_IMPL_FBDATA(d)->width * GDK_DRAWABLE_IMPL_FBDATA(d)->depth + 7) / 8) * GDK_DRAWABLE_IMPL_FBDATA(d)->height;
GDK_DRAWABLE_IMPL_FBDATA(d)->mem = g_malloc(len);
memcpy(GDK_DRAWABLE_IMPL_FBDATA(d)->mem, oldmem, len);
g_free(oldmem);
}
}

View File

@ -9,6 +9,7 @@
#include <pango/pango-modules.h>
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
#include <freetype/ftgrays.h>
#if !defined(FREETYPE_MAJOR) || FREETYPE_MAJOR != 2
#error "We need Freetype 2.0 (beta?)"
@ -38,11 +39,13 @@ typedef struct {
FT_Library gdk_fb_ft_lib = NULL;
#define USE_FTGRAYS
void
gdk_fb_font_init(void)
{
FT_Init_FreeType(&gdk_fb_ft_lib);
#if 0
#ifdef USE_FTGRAYS
FT_Set_Raster(gdk_fb_ft_lib, &ft_grays_raster); /* If this is removed, also turn off USE_FTGRAYS define in gdkdrawable-fb2.c */
#endif
}
@ -53,6 +56,8 @@ gdk_fb_font_fini(void)
FT_Done_FreeType(gdk_fb_ft_lib);
}
void pango_fb_font_set_size(PangoFont *font);
static void pango_fb_font_map_init(PangoFBFontMap *fontmap);
static PangoFont *pango_fb_font_map_load_font(PangoFontMap *fontmap,
const PangoFontDescription *desc);
@ -187,7 +192,7 @@ list_fonts(PangoFBFontMap *fm, const char *family,
{
ec = FT_New_Face(gdk_fb_ft_lib, buf, i, &ftf);
if(ec)
continue; /* error opening */
break; /* error opening */
FT_Select_Charmap(ftf, ft_encoding_unicode);
@ -197,14 +202,15 @@ list_fonts(PangoFBFontMap *fm, const char *family,
{
g_warning("No family/style on %s", buf);
FT_Done_Face(ftf);
i = n;
continue;
break;
}
g_message("Typeface %s/%s", ftf->family_name, ftf->style_name);
pfd = g_new0(PangoFBFontListing, 1);
/* Now add the item */
pfd->desc.family_name = g_strdup(ftf->family_name);
if(ftf->family_name[0] == '/')
pfd->desc.family_name = g_strdup(ftf->family_name+1);
else
pfd->desc.family_name = g_strdup(ftf->family_name);
pfd->desc.style = PANGO_STYLE_NORMAL;
pfd->desc.variant = PANGO_VARIANT_NORMAL;
@ -238,6 +244,8 @@ list_fonts(PangoFBFontMap *fm, const char *family,
i++;
}
}
closedir(dirh);
}
static guint
@ -430,12 +438,14 @@ static void
pango_fb_font_init (PangoFBFont *font)
{
font->desc.size = -1;
font->extents = g_hash_table_new(NULL, NULL);
font->glyph_info = g_hash_table_new(NULL, NULL);
}
static gboolean
g_free_2(gpointer key, gpointer value, gpointer data)
{
PangoFBGlyphInfo *pgi = value;
g_free(pgi->fbd.drawable_data.mem);
g_free(value);
return TRUE;
}
@ -443,9 +453,101 @@ g_free_2(gpointer key, gpointer value, gpointer data)
static void
pango_fb_font_clear_extent_cache(PangoFBFont *fbf)
{
g_hash_table_foreach_remove(fbf->extents, g_free_2, NULL);
g_hash_table_foreach_remove(fbf->glyph_info, g_free_2, NULL);
}
PangoFBGlyphInfo *
pango_fb_font_get_glyph_info(PangoFont *font, PangoGlyph glyph)
{
PangoFBGlyphInfo *pgi;
PangoFBFont *fbf = PANGO_FB_FONT(font);
FT_Bitmap *renderme;
FT_GlyphSlot g;
PangoRectangle *my_logical_rect, *my_ink_rect;
FT_Face ftf;
ftf = fbf->ftf;
pango_fb_font_set_size(font);
pgi = g_hash_table_lookup(fbf->glyph_info, GUINT_TO_POINTER(glyph));
if(pgi)
return pgi;
pgi = g_new0(PangoFBGlyphInfo, 1);
FT_Load_Glyph(ftf, glyph, FT_LOAD_DEFAULT);
g = ftf->glyph;
if(g->format != ft_glyph_format_bitmap)
{
FT_BitmapGlyph bgy;
int bdepth;
#if defined(USE_AA) || 1
#ifdef USE_FTGRAYS
bdepth = 256;
#else
bdepth = 128;
#endif
#else
bdepth = 0;
#endif
if(FT_Get_Glyph_Bitmap(ftf, glyph, 0, bdepth, NULL, &bgy))
g_error("Glyph render failed");
renderme = &bgy->bitmap;
}
else
renderme = &g->bitmap;
pgi->fbd.drawable_data.mem = g_memdup(renderme->buffer, renderme->pitch * renderme->rows);
pgi->fbd.drawable_data.rowstride = renderme->pitch;
pgi->fbd.drawable_data.width = pgi->fbd.drawable_data.lim_x = renderme->width;
pgi->fbd.drawable_data.height = pgi->fbd.drawable_data.lim_y = renderme->rows;
switch(renderme->pixel_mode)
{
case ft_pixel_mode_mono:
pgi->fbd.drawable_data.depth = 1;
break;
case ft_pixel_mode_grays:
#if defined(USE_FTGRAYS)
pgi->fbd.drawable_data.depth = 78;
#else
pgi->fbd.drawable_data.depth = 77;
#endif
break;
default:
g_assert_not_reached();
break;
}
my_ink_rect = &pgi->extents[0];
my_logical_rect = &pgi->extents[1];
{
my_ink_rect->width = (PANGO_SCALE * g->metrics.width) >> 6;
my_ink_rect->height = (PANGO_SCALE * g->metrics.height) >> 6;
my_ink_rect->x = - ((PANGO_SCALE * g->metrics.horiBearingX) >> 6);
my_ink_rect->y = - ((PANGO_SCALE * g->metrics.horiBearingY) >> 6);
}
{
my_logical_rect->width = (PANGO_SCALE * g->metrics.horiAdvance) >> 6;
my_logical_rect->height = (PANGO_SCALE * ftf->size->metrics.height) >> 6;
my_logical_rect->x = - ((PANGO_SCALE * g->metrics.horiBearingX) >> 6);
my_logical_rect->y = - ((PANGO_SCALE * ftf->size->metrics.ascender) >> 6);
}
pgi->hbearing = ((-g->metrics.horiBearingY) >> 6);
g_hash_table_insert(fbf->glyph_info, GUINT_TO_POINTER(glyph), pgi);
return pgi;
}
static void pango_fb_font_finalize (GObject *object)
{
@ -455,7 +557,7 @@ static void pango_fb_font_finalize (GObject *object)
pango_coverage_unref(fbf->coverage);
g_free(fbf->desc.family_name);
pango_fb_font_clear_extent_cache(fbf);
g_hash_table_destroy(fbf->extents);
g_hash_table_destroy(fbf->glyph_info);
}
static void
@ -575,56 +677,17 @@ pango_fb_font_get_glyph_extents (PangoFont *font,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect)
{
FT_Face ftf;
PangoFBFont *fbf;
PangoRectangle *my_extents, *my_logical_rect, *my_ink_rect;
FT_GlyphSlot gs;
PangoRectangle *my_extents;
PangoFBGlyphInfo *gi;
fbf = PANGO_FB_FONT(font);
pango_fb_font_set_size(font);
my_extents = g_hash_table_lookup(fbf->extents, GUINT_TO_POINTER(glyph));
if(my_extents)
goto out;
gi = pango_fb_font_get_glyph_info(font, glyph);
my_extents = gi->extents;
if(!strcmp(fbf->desc.family_name, "Bitstream Charter"))
G_BREAKPOINT();
ftf = fbf->ftf;
if(FT_Load_Glyph(ftf, glyph, FT_LOAD_DEFAULT))
{
if(ink_rect)
memset(ink_rect, 0, sizeof(*ink_rect));
if(logical_rect)
memset(logical_rect, 0, sizeof(*logical_rect));
return;
}
gs = ftf->glyph;
my_extents = g_new(PangoRectangle, 2);
my_ink_rect = my_extents;
my_logical_rect = my_extents + 1;
{
my_ink_rect->width = (PANGO_SCALE * gs->metrics.width) >> 6;
my_ink_rect->height = (PANGO_SCALE * gs->metrics.height) >> 6;
my_ink_rect->x = - ((PANGO_SCALE * gs->metrics.horiBearingX) >> 6);
my_ink_rect->y = - ((PANGO_SCALE * gs->metrics.horiBearingY) >> 6);
}
{
my_logical_rect->width = (PANGO_SCALE * gs->metrics.horiAdvance) >> 6;
my_logical_rect->height = (PANGO_SCALE * ftf->size->metrics.height) >> 6;
my_logical_rect->x = - ((PANGO_SCALE * gs->metrics.horiBearingX) >> 6);
my_logical_rect->y = - ((PANGO_SCALE * ftf->size->metrics.ascender) >> 6);
}
g_hash_table_insert(fbf->extents, GUINT_TO_POINTER(glyph), my_extents);
out:
if(ink_rect)
*ink_rect = my_extents[0];

View File

@ -49,40 +49,65 @@ typedef struct
gulong pixels[1];
} _GdkPixmapInfo;
static gpointer parent_class = NULL;
static void
gdk_fb_pixmap_destroy (GdkPixmap *pixmap)
gdk_pixmap_impl_fb_init (GdkPixmapFBData *impl)
{
g_free (GDK_DRAWABLE_FBDATA(pixmap)->mem);
g_free (GDK_DRAWABLE_FBDATA (pixmap));
}
GdkDrawableFBData *private = (GdkDrawableFBData *)impl;
static GdkDrawable *
gdk_fb_pixmap_alloc (void)
{
GdkDrawable *drawable;
GdkDrawablePrivate *private;
static GdkDrawableClass klass;
static gboolean initialized = FALSE;
if (!initialized)
{
initialized = TRUE;
klass = _gdk_fb_drawable_class;
klass.destroy = gdk_fb_pixmap_destroy;
}
drawable = gdk_drawable_alloc ();
private = (GdkDrawablePrivate *)drawable;
private->klass = &klass;
private->klass_data = g_new0 (GdkDrawableFBData, 1);
private->window_type = GDK_DRAWABLE_PIXMAP;
private->colormap = gdk_colormap_ref(gdk_colormap_get_system());
GDK_DRAWABLE_FBDATA(private)->mem = NULL;
private->mem = NULL;
private->width = 1;
private->height = 1;
}
return drawable;
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);
}
return object_type;
}
GdkPixmap*
@ -92,7 +117,7 @@ gdk_pixmap_new (GdkWindow *window,
gint depth)
{
GdkPixmap *pixmap;
GdkDrawablePrivate *private;
GdkDrawableFBData *private;
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
@ -101,22 +126,19 @@ gdk_pixmap_new (GdkWindow *window,
if (!window)
window = gdk_parent_root;
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
if (depth == -1)
depth = gdk_drawable_get_visual (window)->depth;
pixmap = gdk_fb_pixmap_alloc ();
private = (GdkDrawablePrivate *)pixmap;
pixmap = (GdkPixmap *)g_type_create_instance(gdk_pixmap_get_type());
private = GDK_DRAWABLE_IMPL_FBDATA(pixmap);
GDK_DRAWABLE_FBDATA(pixmap)->mem = g_malloc(((width * depth + 7) / 8) * height);
GDK_DRAWABLE_FBDATA(pixmap)->rowstride = (width * depth + 7) / 8; /* Round up to nearest whole byte */
GDK_DRAWABLE_FBDATA(pixmap)->lim_x = width;
GDK_DRAWABLE_FBDATA(pixmap)->lim_y = height;
GDK_DRAWABLE_IMPL_FBDATA(pixmap)->mem = g_malloc(((width * depth + 7) / 8) * height);
GDK_DRAWABLE_IMPL_FBDATA(pixmap)->rowstride = (width * depth + 7) / 8; /* Round up to nearest whole byte */
GDK_DRAWABLE_IMPL_FBDATA(pixmap)->lim_x = width;
GDK_DRAWABLE_IMPL_FBDATA(pixmap)->lim_y = height;
private->width = width;
private->height = height;
private->depth = depth;
private->depth = ((GdkPixmapObject *)pixmap)->depth = depth;
return pixmap;
}
@ -136,12 +158,9 @@ gdk_bitmap_create_from_data (GdkWindow *window,
if (!window)
window = gdk_parent_root;
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
pixmap = gdk_pixmap_new(window, width, height, 1);
memcpy(GDK_DRAWABLE_FBDATA(pixmap)->mem, data, ((width + 7) / 8) * height);
memcpy(GDK_DRAWABLE_IMPL_FBDATA(pixmap)->mem, data, ((width + 7) / 8) * height);
return pixmap;
}
@ -156,7 +175,6 @@ gdk_pixmap_create_from_data (GdkWindow *window,
GdkColor *bg)
{
GdkPixmap *pixmap;
GdkDrawablePrivate *private;
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail (data != NULL, NULL);
@ -168,602 +186,12 @@ gdk_pixmap_create_from_data (GdkWindow *window,
if (!window)
window = gdk_parent_root;
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
if (depth == -1)
depth = gdk_drawable_get_visual (window)->depth;
pixmap = gdk_pixmap_new(window, width, height, depth);
private = (GdkDrawablePrivate *)pixmap;
memcpy(GDK_DRAWABLE_IMPL_FBDATA(pixmap)->mem, data, height * GDK_DRAWABLE_IMPL_FBDATA(pixmap)->rowstride);
return pixmap;
}
static gint
gdk_pixmap_seek_string (FILE *infile,
const gchar *str,
gint skip_comments)
{
char instr[1024];
while (!feof (infile))
{
fscanf (infile, "%1023s", instr);
if (skip_comments == TRUE && strcmp (instr, "/*") == 0)
{
fscanf (infile, "%1023s", instr);
while (!feof (infile) && strcmp (instr, "*/") != 0)
fscanf (infile, "%1023s", instr);
fscanf(infile, "%1023s", instr);
}
if (strcmp (instr, str)==0)
return TRUE;
}
return FALSE;
}
static gint
gdk_pixmap_seek_char (FILE *infile,
gchar c)
{
gint b, oldb;
while ((b = getc(infile)) != EOF)
{
if (c != b && b == '/')
{
b = getc (infile);
if (b == EOF)
return FALSE;
else if (b == '*') /* we have a comment */
{
b = -1;
do
{
oldb = b;
b = getc (infile);
if (b == EOF)
return FALSE;
}
while (!(oldb == '*' && b == '/'));
}
}
else if (c == b)
return TRUE;
}
return FALSE;
}
static gint
gdk_pixmap_read_string (FILE *infile,
gchar **buffer,
guint *buffer_size)
{
gint c;
guint cnt = 0, bufsiz, ret = FALSE;
gchar *buf;
buf = *buffer;
bufsiz = *buffer_size;
if (buf == NULL)
{
bufsiz = 10 * sizeof (gchar);
buf = g_new(gchar, bufsiz);
}
do
c = getc (infile);
while (c != EOF && c != '"');
if (c != '"')
goto out;
while ((c = getc(infile)) != EOF)
{
if (cnt == bufsiz)
{
guint new_size = bufsiz * 2;
if (new_size > bufsiz)
bufsiz = new_size;
else
goto out;
buf = (gchar *) g_realloc (buf, bufsiz);
buf[bufsiz-1] = '\0';
}
if (c != '"')
buf[cnt++] = c;
else
{
buf[cnt] = 0;
ret = TRUE;
break;
}
}
out:
buf[bufsiz-1] = '\0'; /* ensure null termination for errors */
*buffer = buf;
*buffer_size = bufsiz;
return ret;
}
static gchar*
gdk_pixmap_skip_whitespaces (gchar *buffer)
{
gint32 index = 0;
while (buffer[index] != 0 && (buffer[index] == 0x20 || buffer[index] == 0x09))
index++;
return &buffer[index];
}
static gchar*
gdk_pixmap_skip_string (gchar *buffer)
{
gint32 index = 0;
while (buffer[index] != 0 && buffer[index] != 0x20 && buffer[index] != 0x09)
index++;
return &buffer[index];
}
/* Xlib crashed once at a color name lengths around 125 */
#define MAX_COLOR_LEN 120
static gchar*
gdk_pixmap_extract_color (gchar *buffer)
{
gint counter, numnames;
gchar *ptr = NULL, ch, temp[128];
gchar color[MAX_COLOR_LEN], *retcol;
gint space;
counter = 0;
while (ptr == NULL)
{
if (buffer[counter] == 'c')
{
ch = buffer[counter + 1];
if (ch == 0x20 || ch == 0x09)
ptr = &buffer[counter + 1];
}
else if (buffer[counter] == 0)
return NULL;
counter++;
}
ptr = gdk_pixmap_skip_whitespaces (ptr);
if (ptr[0] == 0)
return NULL;
else if (ptr[0] == '#')
{
counter = 1;
while (ptr[counter] != 0 &&
((ptr[counter] >= '0' && ptr[counter] <= '9') ||
(ptr[counter] >= 'a' && ptr[counter] <= 'f') ||
(ptr[counter] >= 'A' && ptr[counter] <= 'F')))
counter++;
retcol = g_new (gchar, counter+1);
strncpy (retcol, ptr, counter);
retcol[counter] = 0;
return retcol;
}
color[0] = 0;
numnames = 0;
space = MAX_COLOR_LEN - 1;
while (space > 0)
{
sscanf (ptr, "%127s", temp);
if (((gint)ptr[0] == 0) ||
(strcmp ("s", temp) == 0) || (strcmp ("m", temp) == 0) ||
(strcmp ("g", temp) == 0) || (strcmp ("g4", temp) == 0))
{
break;
}
else
{
if (numnames > 0)
{
space -= 1;
strcat (color, " ");
}
strncat (color, temp, space);
space -= MIN (space, strlen (temp));
ptr = gdk_pixmap_skip_string (ptr);
ptr = gdk_pixmap_skip_whitespaces (ptr);
numnames++;
}
}
retcol = g_strdup (color);
return retcol;
}
enum buffer_op
{
op_header,
op_cmap,
op_body
};
static void
gdk_xpm_destroy_notify (gpointer data)
{
_GdkPixmapInfo *info = (_GdkPixmapInfo *)data;
GdkColor color;
int i;
for (i=0; i<info->ncolors; i++)
{
color.pixel = info->pixels[i];
gdk_colormap_free_colors (info->colormap, &color, 1);
}
gdk_colormap_unref (info->colormap);
g_free (info);
}
static GdkPixmap *
_gdk_pixmap_create_from_xpm (GdkWindow *window,
GdkColormap *colormap,
GdkBitmap **mask,
GdkColor *transparent_color,
gchar * (*get_buf) (enum buffer_op op,
gpointer handle),
gpointer handle)
{
GdkPixmap *pixmap = NULL;
GdkImage *image = NULL;
GdkVisual *visual;
GdkGC *gc = NULL;
GdkColor tmp_color;
gint width, height, num_cols, cpp, n, ns, cnt, xcnt, ycnt, wbytes;
gchar *buffer, pixel_str[32];
gchar *name_buf;
_GdkPixmapColor *color = NULL, *fallbackcolor = NULL;
_GdkPixmapColor *colors = NULL;
gulong index;
GHashTable *color_hash = NULL;
_GdkPixmapInfo *color_info = NULL;
if ((window == NULL) && (colormap == NULL))
g_warning ("Creating pixmap from xpm with NULL window and colormap");
if (window == NULL)
window = gdk_parent_root;
if (colormap == NULL)
{
colormap = gdk_drawable_get_colormap (window);
visual = gdk_drawable_get_visual (window);
}
else
visual = ((GdkColormapPrivate *)colormap)->visual;
buffer = (*get_buf) (op_header, handle);
if (buffer == NULL)
return NULL;
sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
if (cpp >= 32)
{
g_warning ("Pixmap has more than 31 characters per color\n");
return NULL;
}
color_hash = g_hash_table_new (g_str_hash, g_str_equal);
if (transparent_color == NULL)
{
gdk_color_white (colormap, &tmp_color);
transparent_color = &tmp_color;
}
/* For pseudo-color and grayscale visuals, we have to remember
* the colors we allocated, so we can free them later.
*/
if ((visual->type == GDK_VISUAL_PSEUDO_COLOR) ||
(visual->type == GDK_VISUAL_GRAYSCALE))
{
color_info = g_malloc (sizeof (_GdkPixmapInfo) +
sizeof(gulong) * (num_cols - 1));
color_info->ncolors = num_cols;
color_info->colormap = colormap;
gdk_colormap_ref (colormap);
}
name_buf = g_new (gchar, num_cols * (cpp+1));
colors = g_new (_GdkPixmapColor, num_cols);
for (cnt = 0; cnt < num_cols; cnt++)
{
gchar *color_name;
buffer = (*get_buf) (op_cmap, handle);
if (buffer == NULL)
goto error;
color = &colors[cnt];
color->color_string = &name_buf [cnt * (cpp + 1)];
strncpy (color->color_string, buffer, cpp);
color->color_string[cpp] = 0;
buffer += strlen (color->color_string);
color->transparent = FALSE;
color_name = gdk_pixmap_extract_color (buffer);
if (color_name == NULL || g_strcasecmp (color_name, "None") == 0 ||
gdk_color_parse (color_name, &color->color) == FALSE)
{
color->color = *transparent_color;
color->transparent = TRUE;
}
g_free (color_name);
/* FIXME: The remaining slowness appears to happen in this
function. */
gdk_color_alloc (colormap, &color->color);
if (color_info)
color_info->pixels[cnt] = color->color.pixel;
g_hash_table_insert (color_hash, color->color_string, color);
if (cnt == 0)
fallbackcolor = color;
}
index = 0;
image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
if (mask)
{
/* The pixmap mask is just a bits pattern.
* Color 0 is used for background and 1 for foreground.
* We don't care about the colormap, we just need 0 and 1.
*/
GdkColor mask_pattern;
*mask = gdk_pixmap_new (window, width, height, 1);
gc = gdk_gc_new (*mask);
mask_pattern.pixel = 0;
gdk_gc_set_foreground (gc, &mask_pattern);
gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, width, height);
mask_pattern.pixel = 255;
gdk_gc_set_foreground (gc, &mask_pattern);
}
wbytes = width * cpp;
for (ycnt = 0; ycnt < height; ycnt++)
{
buffer = (*get_buf) (op_body, handle);
/* FIXME: this slows things down a little - it could be
* integrated into the strncpy below, perhaps. OTOH, strlen
* is fast.
*/
if ((buffer == NULL) || strlen (buffer) < wbytes)
continue;
for (n = 0, cnt = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++)
{
strncpy (pixel_str, &buffer[n], cpp);
pixel_str[cpp] = 0;
ns = 0;
color = g_hash_table_lookup (color_hash, pixel_str);
if (!color) /* screwed up XPM file */
color = fallbackcolor;
gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
if (mask && color->transparent)
{
if (cnt < xcnt)
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
cnt = xcnt + 1;
}
}
if (mask && (cnt < xcnt))
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
}
error:
if (mask)
gdk_gc_unref (gc);
if (image != NULL)
{
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
if (color_info)
gdk_drawable_set_data (pixmap, "gdk-xpm", color_info,
gdk_xpm_destroy_notify);
gc = gdk_gc_new (pixmap);
gdk_gc_set_foreground (gc, transparent_color);
gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
gdk_gc_unref (gc);
gdk_image_unref (image);
#if 0
g_print("%dx%d\n", width, height);
for(y = 0; y < height; y++)
{
for(x = 0; x < width; x++)
{
guchar foo = GDK_DRAWABLE_FBDATA(pixmap)->mem[(x + GDK_DRAWABLE_FBDATA(pixmap)->rowstride * y];
if(foo == 0)
g_print("o");
else if(foo == 255)
g_print("w");
else if(foo == transparent_color->pixel)
g_print(" ");
else
g_print(".");
}
g_print("\n");
}
#endif
}
else if (color_info)
gdk_xpm_destroy_notify (color_info);
if (color_hash != NULL)
g_hash_table_destroy (color_hash);
if (colors != NULL)
g_free (colors);
if (name_buf != NULL)
g_free (name_buf);
return pixmap;
}
struct file_handle
{
FILE *infile;
gchar *buffer;
guint buffer_size;
};
static gchar *
file_buffer (enum buffer_op op, gpointer handle)
{
struct file_handle *h = handle;
switch (op)
{
case op_header:
if (gdk_pixmap_seek_string (h->infile, "XPM", FALSE) != TRUE)
break;
if (gdk_pixmap_seek_char (h->infile,'{') != TRUE)
break;
/* Fall through to the next gdk_pixmap_seek_char. */
case op_cmap:
gdk_pixmap_seek_char (h->infile, '"');
fseek (h->infile, -1, SEEK_CUR);
/* Fall through to the gdk_pixmap_read_string. */
case op_body:
gdk_pixmap_read_string (h->infile, &h->buffer, &h->buffer_size);
return h->buffer;
}
return 0;
}
GdkPixmap*
gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
GdkColormap *colormap,
GdkBitmap **mask,
GdkColor *transparent_color,
const gchar *filename)
{
struct file_handle h;
GdkPixmap *pixmap = NULL;
memset (&h, 0, sizeof (h));
h.infile = fopen (filename, "rb");
if (h.infile != NULL)
{
pixmap = _gdk_pixmap_create_from_xpm (window, colormap, mask,
transparent_color,
file_buffer, &h);
fclose (h.infile);
g_free (h.buffer);
}
return pixmap;
}
GdkPixmap*
gdk_pixmap_create_from_xpm (GdkWindow *window,
GdkBitmap **mask,
GdkColor *transparent_color,
const gchar *filename)
{
return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
transparent_color, filename);
}
struct mem_handle
{
gchar **data;
int offset;
};
static gchar *
mem_buffer (enum buffer_op op, gpointer handle)
{
struct mem_handle *h = handle;
switch (op)
{
case op_header:
case op_cmap:
case op_body:
if (h->data[h->offset])
return h->data[h->offset ++];
}
return 0;
}
GdkPixmap*
gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
GdkColormap *colormap,
GdkBitmap **mask,
GdkColor *transparent_color,
gchar **data)
{
struct mem_handle h;
GdkPixmap *pixmap = NULL;
memset (&h, 0, sizeof (h));
h.data = data;
pixmap = _gdk_pixmap_create_from_xpm (window, colormap, mask,
transparent_color,
mem_buffer, &h);
return pixmap;
}
GdkPixmap*
gdk_pixmap_create_from_xpm_d (GdkWindow *window,
GdkBitmap **mask,
GdkColor *transparent_color,
gchar **data)
{
return gdk_pixmap_colormap_create_from_xpm_d (window, NULL, mask,
transparent_color, data);
}

View File

@ -39,30 +39,62 @@
#include <stdio.h>
#include <freetype/freetype.h>
#define GDK_DRAWABLE_FBDATA(win) ((GdkDrawableFBData *)(((GdkDrawablePrivate*)(win))->klass_data))
#define GDK_PIXMAP_FBDATA(win) ((GdkPixmapFBData *)(((GdkDrawablePrivate*)(win))->klass_data))
#define GDK_WINDOW_FBDATA(win) ((GdkWindowFBData *)(((GdkDrawablePrivate*)(win))->klass_data))
#define GDK_DRAWABLE_IMPL_FBDATA(win) ((GdkDrawableFBData *)((GdkWindowPrivate *)(win))->impl)
#define GDK_DRAWABLE_IMPL(win) ((GdkDrawable *)((GdkWindowPrivate *)(win))->impl)
#define GDK_WINDOW_IMPL_FBDATA(win) ((GdkWindowFBData *)((GdkWindowPrivate *)(win))->impl)
#define GDK_PIXMAP_IMPL_FBDATA(win) ((GdkPixmapFBData *)((GdkWindowPrivate *)(win))->impl)
#define GDK_DRAWABLE_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 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_get_type() || G_OBJECT_TYPE(drawable) == gdk_pixmap_get_type())
typedef struct _GdkDrawableFBData GdkDrawableFBData;
typedef struct _GdkWindowFBData GdkWindowFBData;
typedef struct _GdkPixmapFBData GdkPixmapFBData;
typedef GdkWindowObject GdkWindowPrivate;
#define GDK_DRAWABLE_PIXMAP (GDK_WINDOW_FOREIGN+1)
struct _GdkDrawableFBData
{
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;
#define GDK_DRAWABLE_P(x) ((GdkDrawableFBData *)(x))
struct _GdkPixmapFBData
{
GdkDrawableFBData drawable_data;
};
typedef struct {
GdkDrawableFBClass klass;
} GdkPixmapFBClass;
GType gdk_drawable_impl_fb_get_type (void);
typedef struct {
gulong length;
GdkAtom type;
@ -81,6 +113,11 @@ struct _GdkWindowFBData
gboolean realized : 1;
};
typedef struct {
GdkDrawableFBClass base_class;
} GdkWindowFBClass;
#define GDK_WINDOW_P(x) ((GdkWindowObject *)(x))
struct _GdkFBDisplay
{
int fd;
@ -97,17 +134,22 @@ typedef struct {
} GdkVisualPrivateFB;
typedef struct {
GdkColormapPrivate base;
GdkColormap base;
GHashTable *hash;
GdkColorInfo *info;
guint sync_tag;
} GdkColormapPrivateFB;
typedef struct {
GdkColormapClass base_class;
} GdkColormapFBClass;
typedef struct {
GdkCursor base;
GdkPixmap *cursor, *mask;
int hot_x, hot_y;
int mask_off_x, mask_off_y;
} GdkCursorPrivateFB;
typedef struct {
@ -121,11 +163,15 @@ void gdk_fb_font_init(void);
void gdk_fb_font_fini(void);
typedef struct {
GdkImagePrivate base;
GdkImage base;
} GdkImagePrivateFB;
#define GDK_GC_FBDATA(x) ((GdkGCFBData *)((GdkGCPrivate *)x)->klass_data)
#define GDK_GC_FBDATA(x) ((GdkGCFBData *)(x))
#define GDK_GC_P(x) ((GdkGC *)(x))
typedef struct {
GdkGC parent_instance;
GdkRegion *clip_region;
gchar *dash_list;
GdkGCValuesMask values_mask;
@ -135,9 +181,16 @@ typedef struct {
guchar depth, alu;
} GdkGCFBData;
typedef struct {
GdkGCClass parent_class;
} GdkGCFBClass;
GType gdk_gc_fb_get_type (void);
#if 0
GdkGC * _gdk_fb_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
#endif
/* Routines from gdkgeometry-fb.c */
@ -150,6 +203,8 @@ void _gdk_window_move_resize_child (GdkWindow *window,
void _gdk_window_process_expose (GdkWindow *window,
gulong serial,
GdkRectangle *area);
void gdk_window_invalidate_region_clear(GdkWindow *window, GdkRegion *region);
void gdk_window_invalidate_rect_clear(GdkWindow *window, GdkRectangle *rect);
GdkGC *_gdk_fb_gc_new(GdkDrawable *drawable, GdkGCValues *values, GdkGCValuesMask values_mask);
void gdk_fb_drawable_clear(GdkDrawable *drawable);
@ -213,7 +268,8 @@ void gdk_fb_draw_rectangle (GdkDrawable *drawable,
gint y,
gint width,
gint height);
void gdk_fb_fill_spans(GdkDrawable *drawable, GdkGC *gc, GdkRectangle *rects, int nrects);
void gdk_fb_fill_spans(GdkDrawable *real_drawable, GdkGC *gc, GdkRectangle *rects, int nrects);
GdkRegion *gdk_fb_clip_region(GdkDrawable *drawable, GdkGC *gc, gboolean do_clipping, gboolean do_children);
extern GdkWindow *_gdk_fb_pointer_grab_window, *_gdk_fb_keyboard_grab_window, *_gdk_fb_pointer_grab_confine;
extern GdkEventMask _gdk_fb_pointer_grab_events, _gdk_fb_keyboard_grab_events;
@ -222,13 +278,18 @@ extern GdkFBDisplay *gdk_display;
extern GdkDrawableClass _gdk_fb_drawable_class;
extern FILE *debug_out;
GdkEvent *gdk_event_make(GdkWindow *window, GdkEventType type, gboolean append_to_queue);
GdkEvent *gdk_event_make_2(GdkWindow *window, GdkEventType type, gboolean append_to_queue, gint button_press_num);
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_input_ps2_get_mouseinfo(gint *x, gint *y, GdkModifierType *mask);
void gdk_fb_window_visibility_crossing(GdkWindow *window, gboolean is_show);
#define PANGO_TYPE_FB_FONT (pango_fb_font_get_type ())
#define PANGO_FB_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FB_FONT, PangoFBFont))
@ -240,11 +301,25 @@ struct _PangoFBFont
FT_Face ftf;
PangoFontDescription desc;
PangoCoverage *coverage;
GHashTable *extents;
GHashTable *glyph_info;
};
typedef struct {
PangoRectangle extents[2];
GdkPixmapFBData fbd;
int hbearing;
} PangoFBGlyphInfo;
GType pango_fb_font_get_type (void);
gboolean pango_fb_has_glyph(PangoFont *font, PangoGlyph glyph);
PangoGlyph pango_fb_get_unknown_glyph(PangoFont *font);
PangoFBGlyphInfo *pango_fb_font_get_glyph_info(PangoFont *font, PangoGlyph glyph);
void gdk_fb_window_move_resize (GdkWindow *window,
gint x,
gint y,
gint width,
gint height,
gboolean send_expose_events);
extern void CM(void); /* Check for general mem corruption */
extern void RP(GdkDrawable *drawable); /* Same, for pixmaps */

View File

@ -52,7 +52,7 @@ gdk_property_delete_2 (GdkWindow *window,
GdkAtom property,
GdkWindowProperty *prop)
{
GdkWindowFBData *fbd = GDK_WINDOW_FBDATA(window);
GdkWindowFBData *fbd = GDK_WINDOW_IMPL_FBDATA(window);
GdkEvent *event;
g_hash_table_remove(fbd->properties, GUINT_TO_POINTER(property));

File diff suppressed because it is too large Load Diff

View File

@ -1066,8 +1066,8 @@ miPolyArc(GdkDrawable *pDraw, GdkGC *pGC, int narcs, miArc *parcs)
/* compute pixmap size; limit it to size of drawable */
xOrg = MAX(xMin, 0);
yOrg = MAX(yMin, 0);
pixmapWidth = MIN(xMax, GDK_DRAWABLE_P(pDraw)->width) - xOrg;
pixmapHeight = MIN(yMax, GDK_DRAWABLE_P(pDraw)->height) - yOrg;
pixmapWidth = MIN(xMax, GDK_DRAWABLE_FBDATA(pDraw)->width) - xOrg;
pixmapHeight = MIN(yMax, GDK_DRAWABLE_FBDATA(pDraw)->height) - yOrg;
/* if nothing left, return */
if ( (pixmapWidth <= 0) || (pixmapHeight <= 0) ) return;

View File

@ -394,12 +394,7 @@ miLineOnePoint (pDrawable, pGC, pixel, spanData, x, y)
}
static void
miLineJoin (pDrawable, pGC, pixel, spanData, pLeft, pRight)
GdkDrawable* pDrawable;
GdkGC* pGC;
GdkColor *pixel;
SpanDataPtr spanData;
register LineFacePtr pLeft, pRight;
miLineJoin (GdkDrawable *pDrawable, GdkGC *pGC, GdkColor *pixel, SpanDataPtr spanData, LineFacePtr pLeft, LineFacePtr pRight)
{
double mx, my;
double denom = 0.0;
@ -1493,9 +1488,9 @@ miWideLine (pDrawable, pGC, mode, npt, pPts)
else if (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND)
{
if (GDK_GC_FBDATA(pGC)->values.line_width == 1 && !spanData)
miLineOnePoint (pDrawable, pGC, pixel, spanData, x1, y1);
miLineOnePoint (pDrawable, pGC, &pixel, spanData, x1, y1);
else
miLineArc (pDrawable, pGC, pixel, spanData,
miLineArc (pDrawable, pGC, &pixel, spanData,
&leftFace, (LineFacePtr) NULL,
(double)0.0, (double)0.0,
TRUE);
@ -1503,7 +1498,7 @@ miWideLine (pDrawable, pGC, mode, npt, pPts)
}
else
{
miLineJoin (pDrawable, pGC, pixel, spanData, &leftFace,
miLineJoin (pDrawable, pGC, &pixel, spanData, &leftFace,
&prevRightFace);
}
prevRightFace = rightFace;
@ -1513,14 +1508,14 @@ miWideLine (pDrawable, pGC, mode, npt, pPts)
if (npt == 1 && somethingDrawn)
{
if (selfJoin)
miLineJoin (pDrawable, pGC, pixel, spanData, &firstFace,
miLineJoin (pDrawable, pGC, &pixel, spanData, &firstFace,
&rightFace);
else if (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND)
{
if (GDK_GC_FBDATA(pGC)->values.line_width == 1 && !spanData)
miLineOnePoint (pDrawable, pGC, pixel, spanData, x2, y2);
miLineOnePoint (pDrawable, pGC, &pixel, spanData, x2, y2);
else
miLineArc (pDrawable, pGC, pixel, spanData,
miLineArc (pDrawable, pGC, &pixel, spanData,
(LineFacePtr) NULL, &rightFace,
(double)0.0, (double)0.0,
TRUE);
@ -2023,7 +2018,7 @@ miWideDash (pDrawable, pGC, mode, npt, pPts)
}
else
{
miLineJoin (pDrawable, pGC, pixel, spanData, &leftFace,
miLineJoin (pDrawable, pGC, &pixel, spanData, &leftFace,
&prevRightFace);
}
}
@ -2039,13 +2034,13 @@ miWideDash (pDrawable, pGC, mode, npt, pPts)
pixel = endIsFg ? GDK_GC_FBDATA(pGC)->values.foreground : GDK_GC_FBDATA(pGC)->values.background;
if (selfJoin && (GDK_GC_FBDATA(pGC)->values.line_style == GDK_LINE_DOUBLE_DASH || firstIsFg))
{
miLineJoin (pDrawable, pGC, pixel, spanData, &firstFace,
miLineJoin (pDrawable, pGC, &pixel, spanData, &firstFace,
&rightFace);
}
else
{
if (GDK_GC_FBDATA(pGC)->values.cap_style == GDK_CAP_ROUND)
miLineArc (pDrawable, pGC, pixel, spanData,
miLineArc (pDrawable, pGC, &pixel, spanData,
(LineFacePtr) NULL, &rightFace,
(double)0.0, (double)0.0, TRUE);
}

View File

@ -115,8 +115,8 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
xleft = 0;
ytop = 0;
xright = GDK_DRAWABLE_P(pDraw)->width - 1;
ybottom = GDK_DRAWABLE_P(pDraw)->height - 1;
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

View File

@ -29,7 +29,7 @@
PangoGlyph
pango_fb_get_unknown_glyph(PangoFont *font)
{
return '*';
return FT_Get_Char_Index(PANGO_FB_FONT(font)->ftf, '~');
}
typedef struct _CharRange CharRange;
@ -220,7 +220,7 @@ conv_8bit (CharCache *cache,
char *outptr = &outbuf;
size_t outbytesleft = 1;
inbytesleft = g_utf8_next_char (input) - input;
inbytesleft = g_utf8_next_char(input) - input;
cd = find_converter (cache, charset);
@ -242,7 +242,7 @@ conv_euc (CharCache *cache,
char *outptr = outbuf;
size_t outbytesleft = 2;
inbytesleft = g_utf8_next_char (input) - input;
inbytesleft = g_utf8_next_char(input) - input;
cd = find_converter (cache, charset);
@ -330,7 +330,7 @@ basic_engine_shape (PangoFont *font,
char buf[6];
const char *input;
wc = g_utf8_get_char (p);
wc = g_utf8_get_char(p);
input = p;
if (analysis->level % 2)
@ -377,7 +377,7 @@ basic_engine_shape (PangoFont *font,
set_glyph (font, glyphs, i, p - text, pango_fb_get_unknown_glyph (font));
}
p = g_utf8_next_char (p);
p = g_utf8_next_char(p);
}
/* Simple bidi support... may have separate modules later */