summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--ChangeLog.pre-2-013
-rw-r--r--ChangeLog.pre-2-1013
-rw-r--r--ChangeLog.pre-2-213
-rw-r--r--ChangeLog.pre-2-413
-rw-r--r--ChangeLog.pre-2-613
-rw-r--r--ChangeLog.pre-2-813
-rw-r--r--gdk/Makefile.am1
-rw-r--r--gdk/gdkprivate.h4
-rw-r--r--gdk/gdkregion-generic.h7
-rw-r--r--gdk/gdkwindow.c2
-rw-r--r--gdk/gdkwindow.h4
-rw-r--r--gdk/linux-fb/TODO4
-rw-r--r--gdk/linux-fb/gdkcolor-fb.c81
-rw-r--r--gdk/linux-fb/gdkcursor-fb.c365
-rw-r--r--gdk/linux-fb/gdkdnd-fb.c109
-rw-r--r--gdk/linux-fb/gdkdrawable-fb2.c445
-rw-r--r--gdk/linux-fb/gdkevents-fb.c6
-rw-r--r--gdk/linux-fb/gdkfb.h7
-rw-r--r--gdk/linux-fb/gdkgc-fb.c85
-rw-r--r--gdk/linux-fb/gdkgeometry-fb.c34
-rw-r--r--gdk/linux-fb/gdkimage-fb.c188
-rw-r--r--gdk/linux-fb/gdkinput-ps2.c919
-rw-r--r--gdk/linux-fb/gdkinput.c214
-rw-r--r--gdk/linux-fb/gdkinputprivate.h4
-rw-r--r--gdk/linux-fb/gdkmain-fb.c47
-rw-r--r--gdk/linux-fb/gdkpango-fb.c169
-rw-r--r--gdk/linux-fb/gdkpixmap-fb.c690
-rw-r--r--gdk/linux-fb/gdkprivate-fb.h91
-rw-r--r--gdk/linux-fb/gdkproperty-fb.c2
-rw-r--r--gdk/linux-fb/gdkwindow-fb.c812
-rw-r--r--gdk/linux-fb/miarc.c4
-rw-r--r--gdk/linux-fb/miwideline.c25
-rw-r--r--gdk/linux-fb/mizerline.c4
-rw-r--r--modules/linux-fb/basic.c10
35 files changed, 2295 insertions, 2129 deletions
diff --git a/ChangeLog b/ChangeLog
index dd6f3dc1a0..f914cf3f64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index dd6f3dc1a0..f914cf3f64 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -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
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index dd6f3dc1a0..f914cf3f64 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -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
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index dd6f3dc1a0..f914cf3f64 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -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
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index dd6f3dc1a0..f914cf3f64 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -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
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index dd6f3dc1a0..f914cf3f64 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -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
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index dd6f3dc1a0..f914cf3f64 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -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
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index d4b3e924f7..bfbdf1902c 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -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@ \
diff --git a/gdk/gdkprivate.h b/gdk/gdkprivate.h
index 3df7bbbf6d..a9e461406f 100644
--- a/gdk/gdkprivate.h
+++ b/gdk/gdkprivate.h
@@ -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;
diff --git a/gdk/gdkregion-generic.h b/gdk/gdkregion-generic.h
index 659d44eb4c..33d0683dfb 100644
--- a/gdk/gdkregion-generic.h
+++ b/gdk/gdkregion-generic.h
@@ -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
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index fddc2c6d25..4b37c90ee1 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -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;
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index ccce0dbb70..65d916b9ee 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -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;
diff --git a/gdk/linux-fb/TODO b/gdk/linux-fb/TODO
index fd308a5b33..190b0253a5 100644
--- a/gdk/linux-fb/TODO
+++ b/gdk/linux-fb/TODO
@@ -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
diff --git a/gdk/linux-fb/gdkcolor-fb.c b/gdk/linux-fb/gdkcolor-fb.c
index 684dec443b..e5e0330988 100644
--- a/gdk/linux-fb/gdkcolor-fb.c
+++ b/gdk/linux-fb/gdkcolor-fb.c
@@ -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
diff --git a/gdk/linux-fb/gdkcursor-fb.c b/gdk/linux-fb/gdkcursor-fb.c
index 1184259dd3..cbc5b2d3ca 100644
--- a/gdk/linux-fb/gdkcursor-fb.c
+++ b/gdk/linux-fb/gdkcursor-fb.c
@@ -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
diff --git a/gdk/linux-fb/gdkdnd-fb.c b/gdk/linux-fb/gdkdnd-fb.c
index b65c55a8e5..8c17c2a59e 100644
--- a/gdk/linux-fb/gdkdnd-fb.c
+++ b/gdk/linux-fb/gdkdnd-fb.c
@@ -53,67 +53,92 @@ struct _GdkDragContextPrivate {
/* Drag Contexts */
static GList *contexts;
+static gpointer parent_class = NULL;
-GdkDragContext *
-gdk_drag_context_new (void)
+
+static void
+gdk_drag_context_init (GdkDragContext *dragcontext)
{
- GdkDragContextPrivate *result;
+ dragcontext->windowing_data = NULL;
- result = g_new0 (GdkDragContextPrivate, 1);
+ contexts = g_list_prepend (contexts, dragcontext);
+}
- result->ref_count = 1;
+static void
+gdk_drag_context_finalize (GObject *object)
+{
+ GdkDragContext *context = GDK_DRAG_CONTEXT (object);
+
+ g_list_free (context->targets);
- contexts = g_list_prepend (contexts, result);
+ 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);
- return (GdkDragContext *)result;
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
-void
-gdk_drag_context_ref (GdkDragContext *context)
+static void
+gdk_drag_context_class_init (GdkDragContextClass *klass)
{
- g_return_if_fail (context != NULL);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
- ((GdkDragContextPrivate *)context)->ref_count++;
+ object_class->finalize = gdk_drag_context_finalize;
}
-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);
+GType
+gdk_drag_context_get_type (void)
+{
+ static GType object_type = 0;
- private->ref_count--;
-
- if (private->ref_count == 0)
+ if (!object_type)
{
- g_dataset_destroy (private);
+ 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,
+ };
- 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);
- }
+ object_type = g_type_register_static (G_TYPE_OBJECT,
+ "GdkDragContext",
+ &object_info);
+ }
+
+ return object_type;
+}
- if (context->dest_window)
- gdk_window_unref (context->dest_window);
+GdkDragContext *
+gdk_drag_context_new (void)
+{
+ return (GdkDragContext *)g_type_create_instance(gdk_drag_context_get_type());
+}
-#if 0
- if (private->window_cache)
- gdk_window_cache_destroy (private->window_cache);
-#endif
+void
+gdk_drag_context_ref (GdkDragContext *context)
+{
+ g_object_ref(G_OBJECT(context));
+}
- contexts = g_list_remove (contexts, private);
- g_free (private);
- }
+void
+gdk_drag_context_unref (GdkDragContext *context)
+{
+ g_object_unref(G_OBJECT(context));
}
/*************************************************************
diff --git a/gdk/linux-fb/gdkdrawable-fb2.c b/gdk/linux-fb/gdkdrawable-fb2.c
index 81ef83091a..04428f6664 100644
--- a/gdk/linux-fb/gdkdrawable-fb2.c
+++ b/gdk/linux-fb/gdkdrawable-fb2.c
@@ -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);
+
+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;
-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
-};
+ 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;
+
+ drawable = real_drawable;
- if(GDK_IS_WINDOW(drawable) && !GDK_WINDOW_P(drawable)->mapped)
+ 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;
+
+ 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);
- memcpy(srcmem, dc->mem, fbd->rowstride * fbd->lim_y);
+ /* 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);
+}
diff --git a/gdk/linux-fb/gdkevents-fb.c b/gdk/linux-fb/gdkevents-fb.c
index f353dc3c39..8538f5a6b4 100644
--- a/gdk/linux-fb/gdkevents-fb.c
+++ b/gdk/linux-fb/gdkevents-fb.c
@@ -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);
diff --git a/gdk/linux-fb/gdkfb.h b/gdk/linux-fb/gdkfb.h
index 93608ff917..0fe8da541f 100644
--- a/gdk/linux-fb/gdkfb.h
+++ b/gdk/linux-fb/gdkfb.h
@@ -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 */
diff --git a/gdk/linux-fb/gdkgc-fb.c b/gdk/linux-fb/gdkgc-fb.c
index 0d7287bff9..5c75182521 100644
--- a/gdk/linux-fb/gdkgc-fb.c
+++ b/gdk/linux-fb/gdkgc-fb.c
@@ -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);
diff --git a/gdk/linux-fb/gdkgeometry-fb.c b/gdk/linux-fb/gdkgeometry-fb.c
index 7605bf4221..1ce3429951 100644
--- a/gdk/linux-fb/gdkgeometry-fb.c
+++ b/gdk/linux-fb/gdkgeometry-fb.c
@@ -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();
}
diff --git a/gdk/linux-fb/gdkimage-fb.c b/gdk/linux-fb/gdkimage-fb.c
index 9b5c73a6a6..ced5156890 100644
--- a/gdk/linux-fb/gdkimage-fb.c
+++ b/gdk/linux-fb/gdkimage-fb.c
@@ -39,26 +39,68 @@
#include "gdkprivate.h"
#include "gdkprivate-fb.h"
-struct _GdkImagePrivateFB
+static gpointer parent_class = NULL;
+
+void _gdk_windowing_image_init(void)
+{
+}
+
+static void
+gdk_image_init (GdkImage *image)
+{
+}
+
+static void
+gdk_image_finalize (GObject *object)
{
- 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 GdkImageClass image_class_normal = {
- gdk_fb_image_destroy,
- gdk_image_put_normal
-};
+ 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)
{
diff --git a/gdk/linux-fb/gdkinput-ps2.c b/gdk/linux-fb/gdkinput-ps2.c
index 3631acf7c6..f643186255 100644
--- a/gdk/linux-fb/gdkinput-ps2.c
+++ b/gdk/linux-fb/gdkinput-ps2.c
@@ -57,18 +57,10 @@ typedef struct {
gboolean caps_lock : 1;
} Keyboard;
-static void gdk_input_ps2_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
static Keyboard * tty_keyboard_open(void);
static guint keyboard_get_state(Keyboard *k);
-static PS2Mouse *ps2mouse = NULL;
+PS2Mouse *gdk_fb_ps2mouse = NULL;
static Keyboard *keyboard = NULL;
FILE *debug_out;
@@ -151,15 +143,12 @@ send_button_event(PS2Mouse *mouse, guint button, gboolean press_event, time_t th
event->button.x = x;
event->button.y = y;
event->button.button = button;
- event->button.pressure = 0.5;
- event->button.xtilt = event->button.ytilt = 0;
event->button.state = (mouse->button1_pressed?GDK_BUTTON1_MASK:0)
| (mouse->button2_pressed?GDK_BUTTON2_MASK:0)
| (mouse->button3_pressed?GDK_BUTTON3_MASK:0)
| (1 << (button + 8)) /* badhack */
| keyboard_get_state(keyboard);
- event->button.source = GDK_SOURCE_MOUSE;
- event->button.deviceid = 0;
+ event->button.device = gdk_core_pointer;
event->button.x_root = mouse->x;
event->button.y_root = mouse->y;
@@ -192,8 +181,8 @@ send_button_event(PS2Mouse *mouse, guint button, gboolean press_event, time_t th
tmp_gc = gdk_gc_new(window);
GDK_GC_FBDATA(tmp_gc)->values.foreground.pixel = 0;
- gdk_fb_draw_rectangle(window, tmp_gc, TRUE, 0, 0,
- GDK_DRAWABLE_P(window)->width, GDK_DRAWABLE_P(window)->height);
+ gdk_fb_draw_rectangle(GDK_DRAWABLE_IMPL(window), tmp_gc, TRUE, 0, 0,
+ GDK_DRAWABLE_IMPL_FBDATA(window)->width, GDK_DRAWABLE_IMPL_FBDATA(window)->height);
gdk_gc_unref(tmp_gc);
}
#endif
@@ -213,6 +202,7 @@ static GdkCursor *last_cursor = NULL;
GdkFBDrawingContext *gdk_fb_cursor_dc = NULL;
static GdkFBDrawingContext cursor_dc_dat;
static GdkGC *cursor_gc;
+static gint cursor_visibility_count = 1;
static GdkFBDrawingContext *
gdk_fb_cursor_dc_reset(void)
@@ -221,7 +211,7 @@ gdk_fb_cursor_dc_reset(void)
gdk_fb_drawing_context_finalize(gdk_fb_cursor_dc);
gdk_fb_cursor_dc = &cursor_dc_dat;
- gdk_fb_drawing_context_init(gdk_fb_cursor_dc, gdk_parent_root, cursor_gc, TRUE, FALSE);
+ gdk_fb_drawing_context_init(gdk_fb_cursor_dc, GDK_DRAWABLE_IMPL(gdk_parent_root), cursor_gc, TRUE, FALSE);
return gdk_fb_cursor_dc;
}
@@ -231,6 +221,11 @@ gdk_fb_cursor_hide(void)
{
GdkFBDrawingContext *mydc = gdk_fb_cursor_dc;
+ cursor_visibility_count--;
+ g_assert(cursor_visibility_count <= 0);
+ if(cursor_visibility_count < 0)
+ return;
+
if(!mydc)
mydc = gdk_fb_cursor_dc_reset();
@@ -238,7 +233,7 @@ gdk_fb_cursor_hide(void)
{
gdk_gc_set_clip_mask(cursor_gc, NULL);
/* Restore old picture */
- gdk_fb_draw_drawable_3(gdk_parent_root, cursor_gc, last_contents,
+ gdk_fb_draw_drawable_3(GDK_DRAWABLE_IMPL(gdk_parent_root), cursor_gc, GDK_DRAWABLE_IMPL(last_contents),
mydc,
0, 0,
last_location.x,
@@ -251,8 +246,11 @@ gdk_fb_cursor_hide(void)
void
gdk_fb_cursor_invalidate(void)
{
- gdk_pixmap_unref(last_contents);
- last_contents = NULL;
+ if(last_contents)
+ {
+ gdk_pixmap_unref(last_contents);
+ last_contents = NULL;
+ }
}
void
@@ -260,44 +258,82 @@ gdk_fb_cursor_unhide()
{
GdkFBDrawingContext *mydc = gdk_fb_cursor_dc;
+ cursor_visibility_count++;
+ g_assert(cursor_visibility_count <= 1);
+ if(cursor_visibility_count < 1)
+ return;
+
if(!mydc)
mydc = gdk_fb_cursor_dc_reset();
if(last_cursor)
{
if(!last_contents
- || GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->width > GDK_DRAWABLE_P(last_contents)->width
- || GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->height > GDK_DRAWABLE_P(last_contents)->height)
+ || GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->width > GDK_DRAWABLE_IMPL_FBDATA(last_contents)->width
+ || GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->height > GDK_DRAWABLE_IMPL_FBDATA(last_contents)->height)
{
if(last_contents)
gdk_pixmap_unref(last_contents);
last_contents = gdk_pixmap_new(gdk_parent_root,
- GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->width,
- GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->height,
- GDK_DRAWABLE_P(gdk_parent_root)->depth);
+ GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->width,
+ GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->height,
+ GDK_DRAWABLE_IMPL_FBDATA(gdk_parent_root)->depth);
}
gdk_gc_set_clip_mask(cursor_gc, NULL);
- gdk_fb_draw_drawable_2(last_contents, cursor_gc, gdk_parent_root, last_location.x,
+ gdk_fb_draw_drawable_2(GDK_DRAWABLE_IMPL(last_contents), cursor_gc, GDK_DRAWABLE_IMPL(gdk_parent_root), last_location.x,
last_location.y, 0, 0,
- GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->width,
- GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->height, TRUE, FALSE);
- last_contents_size.x = GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->width;
- last_contents_size.y = GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->height;
+ GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->width,
+ GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->height, TRUE, FALSE);
+ last_contents_size.x = GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->width;
+ last_contents_size.y = GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->height;
gdk_gc_set_clip_mask(cursor_gc, GDK_CURSOR_FB(last_cursor)->mask);
- gdk_gc_set_clip_origin(cursor_gc, last_location.x, last_location.y);
+ gdk_gc_set_clip_origin(cursor_gc, last_location.x + GDK_CURSOR_FB(last_cursor)->mask_off_x,
+ last_location.y + GDK_CURSOR_FB(last_cursor)->mask_off_y);
gdk_fb_cursor_dc_reset();
- gdk_fb_draw_drawable_3(gdk_parent_root, cursor_gc, GDK_CURSOR_FB(last_cursor)->cursor, mydc,
- 0, 0, last_location.x, last_location.y,
- GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->width,
- GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->height);
+ gdk_fb_draw_drawable_3(GDK_DRAWABLE_IMPL(gdk_parent_root), cursor_gc, GDK_DRAWABLE_IMPL(GDK_CURSOR_FB(last_cursor)->cursor),
+ mydc, 0, 0, last_location.x, last_location.y,
+ GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->width,
+ GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->height);
}
else
gdk_fb_cursor_invalidate();
}
+gboolean
+gdk_fb_cursor_region_need_hide(GdkRegion *region)
+{
+ GdkRectangle testme;
+
+ if(!last_cursor)
+ return FALSE;
+
+ testme.x = last_location.x;
+ testme.y = last_location.y;
+ testme.width = GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->width;
+ testme.height = GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->height;
+
+ return (gdk_region_rect_in(region, &testme)!=GDK_OVERLAP_RECTANGLE_OUT);
+}
+
+gboolean
+gdk_fb_cursor_need_hide(GdkRectangle *rect)
+{
+ GdkRectangle testme;
+
+ if(!last_cursor)
+ return FALSE;
+
+ testme.x = last_location.x;
+ testme.y = last_location.y;
+ testme.width = GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->width;
+ testme.height = GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->height;
+
+ return gdk_rectangle_intersect(rect, &testme, &testme);
+}
+
void
gdk_fb_get_cursor_rect(GdkRectangle *rect)
{
@@ -305,8 +341,8 @@ gdk_fb_get_cursor_rect(GdkRectangle *rect)
{
rect->x = last_location.x;
rect->y = last_location.y;
- rect->width = GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->width;
- rect->height = GDK_DRAWABLE_P(GDK_CURSOR_FB(last_cursor)->cursor)->height;
+ rect->width = GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->width;
+ rect->height = GDK_DRAWABLE_IMPL_FBDATA(GDK_CURSOR_FB(last_cursor)->cursor)->height;
}
else
{
@@ -336,9 +372,9 @@ move_pointer(PS2Mouse *mouse, GdkWindow *in_window)
the_cursor = _gdk_fb_pointer_grab_cursor;
else
{
- while(!GDK_WINDOW_FBDATA(in_window)->cursor && GDK_WINDOW_P(in_window)->parent)
- in_window = GDK_WINDOW_P(in_window)->parent;
- the_cursor = GDK_WINDOW_FBDATA(in_window)->cursor;
+ while(!GDK_WINDOW_IMPL_FBDATA(in_window)->cursor && GDK_WINDOW_P(in_window)->parent)
+ in_window = (GdkWindow *)GDK_WINDOW_P(in_window)->parent;
+ the_cursor = GDK_WINDOW_IMPL_FBDATA(in_window)->cursor;
}
last_location.x = mouse->x - GDK_CURSOR_FB(the_cursor)->hot_x;
@@ -353,6 +389,82 @@ move_pointer(PS2Mouse *mouse, GdkWindow *in_window)
gdk_fb_cursor_unhide();
}
+void
+gdk_fb_cursor_reset(void)
+{
+ GdkWindow *win = gdk_window_get_pointer(NULL, NULL, NULL, NULL);
+
+ move_pointer(gdk_fb_ps2mouse, win);
+}
+
+void gdk_fb_window_visibility_crossing(GdkWindow *window, gboolean is_show)
+{
+ gint winx, winy;
+ GdkModifierType my_mask;
+
+ gdk_input_ps2_get_mouseinfo(&winx, &winy, &my_mask);
+
+ if(winx >= GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x
+ && winx < GDK_DRAWABLE_IMPL_FBDATA(window)->lim_x
+ && winy >= GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y
+ && winy < GDK_DRAWABLE_IMPL_FBDATA(window)->lim_y)
+ {
+ GdkWindow *oldwin, *newwin, *curwin;
+ GdkEvent *event;
+
+ curwin = gdk_window_get_pointer(NULL, NULL, NULL, NULL);
+
+ if(is_show)
+ {
+ /* Window is about to be shown */
+ oldwin = curwin;
+ newwin = window;
+ }
+ else
+ {
+ /* Window is about to be hidden */
+ oldwin = window;
+ newwin = curwin;
+ }
+
+ event = gdk_event_make(oldwin, GDK_LEAVE_NOTIFY, TRUE);
+ if(event)
+ {
+ guint x_int, y_int;
+ event->crossing.subwindow = gdk_window_ref(newwin);
+ gdk_window_get_root_origin(oldwin, &x_int, &y_int);
+ event->crossing.x = winx - x_int;
+ event->crossing.y = winy - y_int;
+ event->crossing.x_root = winx;
+ event->crossing.y_root = winy;
+ event->crossing.mode = GDK_CROSSING_NORMAL;
+ event->crossing.detail = GDK_NOTIFY_UNKNOWN;
+ event->crossing.focus = FALSE;
+ event->crossing.state = my_mask;
+ }
+
+ event = gdk_event_make(newwin, GDK_ENTER_NOTIFY, TRUE);
+ if(event)
+ {
+ guint x_int, y_int;
+ event->crossing.subwindow = gdk_window_ref(oldwin);
+ gdk_window_get_root_origin(newwin, &x_int, &y_int);
+ event->crossing.x = winx - x_int;
+ event->crossing.y = winy - y_int;
+ event->crossing.x_root = winx;
+ event->crossing.y_root = winy;
+ event->crossing.mode = GDK_CROSSING_NORMAL;
+ event->crossing.detail = GDK_NOTIFY_UNKNOWN;
+ event->crossing.focus = FALSE;
+ event->crossing.state = my_mask;
+ }
+
+ if(gdk_fb_ps2mouse->prev_window)
+ gdk_window_unref(gdk_fb_ps2mouse->prev_window);
+ gdk_fb_ps2mouse->prev_window = gdk_window_ref(newwin);
+ }
+}
+
static gboolean
handle_input(GIOChannel *gioc, GIOCondition cond, gpointer data)
{
@@ -362,47 +474,63 @@ handle_input(GIOChannel *gioc, GIOCondition cond, gpointer data)
gboolean new_button1, new_button2, new_button3;
time_t the_time = g_latest_time.tv_sec;
GdkWindow *mousewin;
+ gboolean got_motion = FALSE;
- for(left = sizeof(buf); left > 0; )
+ while(1) /* Go through as many mouse events as we can */
{
- n = read(mouse->fd, buf+sizeof(buf)-left, left);
- g_assert(n > 0);
- left -= n;
- }
+ for(left = sizeof(buf); left > 0; )
+ {
+ n = read(mouse->fd, buf+sizeof(buf)-left, left);
- new_button1 = (buf[0] & 1) && 1;
- new_button3 = (buf[0] & 2) && 1;
- new_button2 = (buf[0] & 4) && 1;
+ if(n <= 0)
+ {
+ if(left != sizeof(buf))
+ continue; /* XXX FIXME - this will be slow compared to turning on blocking mode, etc. */
- if(new_button1 != mouse->button1_pressed)
- {
- mouse->button1_pressed = new_button1;
- send_button_event(mouse, 1, new_button1, the_time);
- }
+ goto done_reading_mouse_events;
+ }
- if(new_button2 != mouse->button2_pressed)
- {
- mouse->button2_pressed = new_button2;
- send_button_event(mouse, 2, new_button2, the_time);
- }
+ left -= n;
+ }
- if(new_button3 != mouse->button3_pressed)
- {
- mouse->button3_pressed = new_button3;
- send_button_event(mouse, 3, new_button3, the_time);
- }
+ new_button1 = (buf[0] & 1) && 1;
+ new_button3 = (buf[0] & 2) && 1;
+ new_button2 = (buf[0] & 4) && 1;
- if(buf[1] != 0)
- dx = ((buf[0] & 0x10) ? ((gint)buf[1])-256 : buf[1]);
- else
- dx = 0;
- if(buf[2] != 0)
- dy = -((buf[0] & 0x20) ? ((gint)buf[2])-256 : buf[2]);
- else
- dy = 0;
+ if(new_button1 != mouse->button1_pressed)
+ {
+ mouse->button1_pressed = new_button1;
+ send_button_event(mouse, 1, new_button1, the_time);
+ }
+
+ if(new_button2 != mouse->button2_pressed)
+ {
+ mouse->button2_pressed = new_button2;
+ send_button_event(mouse, 2, new_button2, the_time);
+ }
+
+ if(new_button3 != mouse->button3_pressed)
+ {
+ mouse->button3_pressed = new_button3;
+ send_button_event(mouse, 3, new_button3, the_time);
+ }
+
+ if(buf[1] != 0)
+ dx = ((buf[0] & 0x10) ? ((gint)buf[1])-256 : buf[1]);
+ else
+ dx = 0;
+ if(buf[2] != 0)
+ dy = -((buf[0] & 0x20) ? ((gint)buf[2])-256 : buf[2]);
+ else
+ dy = 0;
+
+ mouse->x += dx;
+ mouse->y += dy;
+ if(dx || dy)
+ got_motion = TRUE;
+ }
+ done_reading_mouse_events:
- mouse->x += dx;
- mouse->y += dy;
if(_gdk_fb_pointer_grab_confine)
mousewin = _gdk_fb_pointer_grab_confine;
else
@@ -410,14 +538,14 @@ handle_input(GIOChannel *gioc, GIOCondition cond, gpointer data)
if(mouse->x < 0)
mouse->x = 0;
- else if(mouse->x > (GDK_DRAWABLE_FBDATA(mousewin)->lim_x - 1))
- mouse->x = GDK_DRAWABLE_FBDATA(mousewin)->lim_x - 1;
+ else if(mouse->x > (GDK_DRAWABLE_IMPL_FBDATA(mousewin)->lim_x - 1))
+ mouse->x = GDK_DRAWABLE_IMPL_FBDATA(mousewin)->lim_x - 1;
if(mouse->y < 0)
mouse->y = 0;
- else if(mouse->y > (GDK_DRAWABLE_FBDATA(mousewin)->lim_y - 1))
- mouse->y = GDK_DRAWABLE_FBDATA(mousewin)->lim_y - 1;
+ else if(mouse->y > (GDK_DRAWABLE_IMPL_FBDATA(mousewin)->lim_y - 1))
+ mouse->y = GDK_DRAWABLE_IMPL_FBDATA(mousewin)->lim_y - 1;
- if(dx || dy) {
+ if(got_motion) {
GdkEvent *event;
gint x, y;
GdkWindow *win;
@@ -443,12 +571,9 @@ handle_input(GIOChannel *gioc, GIOCondition cond, gpointer data)
{
event->motion.x = x;
event->motion.y = y;
- event->motion.pressure = 0.5;
- event->motion.xtilt = event->motion.ytilt = 0;
event->motion.state = state;
event->motion.is_hint = FALSE;
- event->motion.source = GDK_SOURCE_MOUSE;
- event->motion.deviceid = 0;
+ event->motion.device = gdk_core_pointer;
event->motion.x_root = mouse->x;
event->motion.y_root = mouse->y;
}
@@ -518,6 +643,8 @@ mouse_open(void)
write(retval->fd, buf, i);
read(retval->fd, buf, 3); /* Get rid of misc garbage whatever stuff from mouse */
+ fcntl(retval->fd, F_SETFL, O_RDWR|O_NONBLOCK);
+
gioc = g_io_channel_unix_new(retval->fd);
retval->fd_tag = g_io_add_watch(gioc, G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL, handle_input, retval);
@@ -530,60 +657,25 @@ mouse_open(void)
void
gdk_input_init (void)
{
- gdk_input_vtable.set_mode = NULL;
- gdk_input_vtable.set_axes = NULL;
- gdk_input_vtable.set_key = NULL;
- gdk_input_vtable.motion_events = NULL;
- gdk_input_vtable.get_pointer = gdk_input_ps2_get_pointer;
- gdk_input_vtable.grab_pointer = NULL;
- gdk_input_vtable.ungrab_pointer = NULL;
- gdk_input_vtable.configure_event = NULL;
- gdk_input_vtable.enter_event = NULL;
- gdk_input_vtable.other_event = NULL;
- gdk_input_vtable.window_none_event = NULL;
- gdk_input_vtable.enable_window = NULL;
- gdk_input_vtable.disable_window = NULL;
-
- gdk_input_devices = g_list_append (NULL, (GdkDeviceInfo *) &gdk_input_core_info);
+ gdk_input_devices = g_list_append (NULL, gdk_core_pointer);
gdk_input_ignore_core = FALSE;
- ps2mouse = mouse_open();
+ gdk_fb_ps2mouse = mouse_open();
}
void
gdk_input_ps2_get_mouseinfo(gint *x, gint *y, GdkModifierType *mask)
{
- *x = ps2mouse->x;
- *y = ps2mouse->y;
+ *x = gdk_fb_ps2mouse->x;
+ *y = gdk_fb_ps2mouse->y;
*mask =
- (ps2mouse->button1_pressed?GDK_BUTTON1_MASK:0)
- | (ps2mouse->button2_pressed?GDK_BUTTON2_MASK:0)
- | (ps2mouse->button3_pressed?GDK_BUTTON3_MASK:0)
+ (gdk_fb_ps2mouse->button1_pressed?GDK_BUTTON1_MASK:0)
+ | (gdk_fb_ps2mouse->button2_pressed?GDK_BUTTON2_MASK:0)
+ | (gdk_fb_ps2mouse->button3_pressed?GDK_BUTTON3_MASK:0)
| keyboard_get_state(keyboard);
}
-static void
-gdk_input_ps2_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- gint x_int, y_int;
-
- gdk_window_get_root_origin(window, &x_int, &y_int);
-
- if (x) *x = ps2mouse->x - x_int;
- if (y) *y = ps2mouse->y - y_int;
- if (pressure) *pressure = 0.5;
- if (xtilt) *xtilt = 0;
- if (ytilt) *ytilt = 0;
-}
-
/* Returns the modifier mask for the keyboard */
static guint
keyboard_get_state(Keyboard *k)
@@ -629,314 +721,314 @@ gdk_window_find_focus(void)
return gdk_parent_root;
}
-static gboolean
-handle_keyboard_input(GIOChannel *gioc, GIOCondition cond, gpointer data)
-{
- guchar buf[128];
- int i, n;
- Keyboard *k = data;
- time_t now;
-
- n = read(k->fd, buf, sizeof(buf));
- if(n <= 0)
- g_error("Nothing from keyboard!");
-
- /* Now turn this into a keyboard event */
- now = g_latest_time.tv_sec;
-
- for(i = 0; i < n; i++)
- {
- guchar base_char;
- static const guint trans_table[256][3] = {
- /* 0x00 */
- {0, 0, 0},
- {GDK_Escape, 0, 0},
- {'1', '!', 0},
- {'2', '@', 0},
- {'3', '#', 0},
- {'4', '$', 0},
- {'5', '%', 0},
- {'6', '^', 0},
- {'7', '&', 0},
- {'8', '*', 0},
- {'9', '(', 0},
- {'0', ')', 0},
- {'-', '_', 0},
- {'=', '+', 0},
- {GDK_BackSpace, 0, 0},
- {GDK_Tab, 0, 0},
-
- /* 0x10 */
- {'q', 'Q', 0},
- {'w', 'W', 0},
- {'e', 'E', 0},
- {'r', 'R', 0},
- {'t', 'T', 0},
- {'y', 'Y', 0},
- {'u', 'U', 0},
- {'i', 'I', 0},
- {'o', 'O', 0},
- {'p', 'P', 0},
- {'[', '{', 0},
- {']', '}', 0},
- {GDK_Return, 0, 0},
- {GDK_Control_L, 0, 0}, /* mod */
- {'a', 'A', 0},
- {'s', 'S', 0},
+static const guint trans_table[256][3] = {
+ /* 0x00 */
+ {0, 0, 0},
+ {GDK_Escape, 0, 0},
+ {'1', '!', 0},
+ {'2', '@', 0},
+ {'3', '#', 0},
+ {'4', '$', 0},
+ {'5', '%', 0},
+ {'6', '^', 0},
+ {'7', '&', 0},
+ {'8', '*', 0},
+ {'9', '(', 0},
+ {'0', ')', 0},
+ {'-', '_', 0},
+ {'=', '+', 0},
+ {GDK_BackSpace, 0, 0},
+ {GDK_Tab, 0, 0},
+
+ /* 0x10 */
+ {'q', 'Q', 0},
+ {'w', 'W', 0},
+ {'e', 'E', 0},
+ {'r', 'R', 0},
+ {'t', 'T', 0},
+ {'y', 'Y', 0},
+ {'u', 'U', 0},
+ {'i', 'I', 0},
+ {'o', 'O', 0},
+ {'p', 'P', 0},
+ {'[', '{', 0},
+ {']', '}', 0},
+ {GDK_Return, 0, 0},
+ {GDK_Control_L, 0, 0}, /* mod */
+ {'a', 'A', 0},
+ {'s', 'S', 0},
/* 0x20 */
- {'d', 'D', 0},
- {'f', 'F', 0},
- {'g', 'G', 0},
- {'h', 'H', 0},
- {'j', 'J', 0},
- {'k', 'K', 0},
- {'l', 'L', 0},
- {';', ':', 0},
- {'\'', '"', 0},
- {'`', '~', 0},
- {GDK_Shift_L, 0, 0}, /* mod */
- {'\\', 0, 0},
- {'z', 0, 0},
- {'x', 0, 0},
- {'c', 0, 0},
-
- {'v', 'V', 0},
+ {'d', 'D', 0},
+ {'f', 'F', 0},
+ {'g', 'G', 0},
+ {'h', 'H', 0},
+ {'j', 'J', 0},
+ {'k', 'K', 0},
+ {'l', 'L', 0},
+ {';', ':', 0},
+ {'\'', '"', 0},
+ {'`', '~', 0},
+ {GDK_Shift_L, 0, 0}, /* mod */
+ {'\\', 0, 0},
+ {'z', 0, 0},
+ {'x', 0, 0},
+ {'c', 0, 0},
+
+ {'v', 'V', 0},
/* 0x30 */
- {'b', 'B', 0},
- {'n', 'N', 0},
- {'m', 'M', 0},
- {',', 0, 0},
- {'.', 0, 0},
- {'/', 0, 0},
- {GDK_Shift_R, 0, 0}, /* mod */
- {GDK_KP_Multiply, 0, 0},
- {0, 0, 0},
- {GDK_space, 0, 0},
- {0, 0, 0},
- {GDK_F1, 0, 0},
- {GDK_F2, 0, 0},
- {GDK_F3, 0, 0},
- {GDK_F4, 0, 0},
- {GDK_F5, 0, 0},
+ {'b', 'B', 0},
+ {'n', 'N', 0},
+ {'m', 'M', 0},
+ {',', 0, 0},
+ {'.', 0, 0},
+ {'/', 0, 0},
+ {GDK_Shift_R, 0, 0}, /* mod */
+ {GDK_KP_Multiply, 0, 0},
+ {0, 0, 0},
+ {GDK_space, 0, 0},
+ {0, 0, 0},
+ {GDK_F1, 0, 0},
+ {GDK_F2, 0, 0},
+ {GDK_F3, 0, 0},
+ {GDK_F4, 0, 0},
+ {GDK_F5, 0, 0},
/* 0x40 */
- {GDK_F6, 0, 0},
- {GDK_F7, 0, 0},
- {GDK_F8, 0, 0},
- {GDK_F9, 0, 0},
- {GDK_F10, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
+ {GDK_F6, 0, 0},
+ {GDK_F7, 0, 0},
+ {GDK_F8, 0, 0},
+ {GDK_F9, 0, 0},
+ {GDK_F10, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
/* 0x50 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {GDK_F11, 0, 0},
- {GDK_F12, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {GDK_F11, 0, 0},
+ {GDK_F12, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
/* 0x60 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
/* 0x70 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
/* 0x80 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
/* 0x90 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
/* 0xA0 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
/* 0xB0 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
/* 0xC0 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {GDK_Up, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {GDK_Left, 0, 0},
- {GDK_Right, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {GDK_Up, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {GDK_Left, 0, 0},
+ {GDK_Right, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
/* 0xD0 */
- {GDK_Down, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
+ {GDK_Down, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
/* 0xE0 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
/* 0xF0 */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- };
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+};
+static gboolean
+handle_keyboard_input(GIOChannel *gioc, GIOCondition cond, gpointer data)
+{
+ guchar buf[128];
+ int i, n;
+ Keyboard *k = data;
+ time_t now;
+
+ n = read(k->fd, buf, sizeof(buf));
+ if(n <= 0)
+ g_error("Nothing from keyboard!");
+
+ /* Now turn this into a keyboard event */
+ now = g_latest_time.tv_sec;
+
+ for(i = 0; i < n; i++)
+ {
+ guchar base_char;
GdkEvent *event;
GdkWindow *win;
char dummy[2];
@@ -1023,12 +1115,31 @@ handle_keyboard_input(GIOChannel *gioc, GIOCondition cond, gpointer data)
mod = 1;
do {
keyval = trans_table[base_char][mod--];
- } while(!keyval && (mod > 0));
+ } while(!keyval && (mod >= 0));
if(k->caps_lock && (keyval >= 'a')
&& (keyval <= 'z'))
keyval = toupper(keyval);
+ /* handle some magic keys */
+ if(state & (GDK_CONTROL_MASK|GDK_MOD1_MASK))
+ {
+ if(!k->states[base_char])
+ {
+ if(keyval == GDK_BackSpace)
+ exit(1);
+
+ if(keyval == GDK_Return)
+ gdk_fb_redraw_all();
+
+ }
+
+ keyval = 0;
+ }
+
+ if(!keyval)
+ continue;
+
win = gdk_window_find_focus();
event = gdk_event_make(win, k->states[base_char]?GDK_KEY_PRESS:GDK_KEY_RELEASE, TRUE);
if(event)
diff --git a/gdk/linux-fb/gdkinput.c b/gdk/linux-fb/gdkinput.c
index c70de7023e..20e2bdc60d 100644
--- a/gdk/linux-fb/gdkinput.c
+++ b/gdk/linux-fb/gdkinput.c
@@ -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)
+
+void
+gdk_device_set_key (GdkDevice *device,
+ guint index,
+ guint keyval,
+ GdkModifierType modifiers)
{
- if (deviceid == GDK_CORE_POINTER)
- return FALSE;
+ g_return_if_fail (device != NULL);
+ g_return_if_fail (index < device->num_keys);
- if (gdk_input_vtable.set_mode)
- return gdk_input_vtable.set_mode(deviceid,mode);
- else
- return FALSE;
+ 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)
+{
+ g_return_if_fail (device != NULL);
+ g_return_if_fail (index < device->num_axes);
+
+ device->axes[index].use = use;
+
+ switch (use)
+ {
+ case GDK_AXIS_X:
+ case GDK_AXIS_Y:
+ device->axes[index].min = 0.;
+ device->axes[index].max = 0.;
+ break;
+ case GDK_AXIS_XTILT:
+ case GDK_AXIS_YTILT:
+ device->axes[index].min = -1.;
+ device->axes[index].max = 1;
+ break;
+ default:
+ device->axes[index].min = 0.;
+ device->axes[index].max = 1;
+ break;
+ }
+}
+
+void
+gdk_device_get_state (GdkDevice *device,
+ GdkWindow *window,
+ gdouble *axes,
+ GdkModifierType *mask)
{
- if (deviceid != GDK_CORE_POINTER && gdk_input_vtable.set_axes)
- gdk_input_vtable.set_axes (deviceid, axes);
+ gint x_int, y_int;
+
+ g_assert(device == gdk_core_pointer);
+
+ gdk_window_get_pointer (window, &x_int, &y_int, mask);
+
+ if (axes)
+ {
+ axes[0] = x_int;
+ axes[1] = y_int;
+ }
}
-void gdk_input_set_key (guint32 deviceid,
- guint index,
- guint keyval,
- GdkModifierType modifiers)
+void
+gdk_device_free_history (GdkTimeCoord **events,
+ gint n_events)
{
- if (deviceid != GDK_CORE_POINTER && gdk_input_vtable.set_key)
- gdk_input_vtable.set_key (deviceid, index, keyval, modifiers);
+ gint i;
+
+ for (i=0; i<n_events; i++)
+ g_free (events[i]);
+
+ g_free (events);
}
-GdkTimeCoord *
-gdk_input_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return)
+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, NULL);
- g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
+ 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;
+}
- *nevents_return = 0;
- return NULL;
+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;
}
diff --git a/gdk/linux-fb/gdkinputprivate.h b/gdk/linux-fb/gdkinputprivate.h
index 1857a34317..5e7d85c261 100644
--- a/gdk/linux-fb/gdkinputprivate.h
+++ b/gdk/linux-fb/gdkinputprivate.h
@@ -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;
diff --git a/gdk/linux-fb/gdkmain-fb.c b/gdk/linux-fb/gdkmain-fb.c
index a34e852e85..9fb98cb81d 100644
--- a/gdk/linux-fb/gdkmain-fb.c
+++ b/gdk/linux-fb/gdkmain-fb.c
@@ -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(evmask & GDK_BUTTON_MOTION_MASK)
+ {
+ evmask |= GDK_BUTTON1_MOTION_MASK|GDK_BUTTON2_MOTION_MASK|GDK_BUTTON3_MOTION_MASK;
+ }
- if(GDK_WINDOW_FBDATA(window)->event_mask & type_masks[type])
+ 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);
}
}
diff --git a/gdk/linux-fb/gdkpango-fb.c b/gdk/linux-fb/gdkpango-fb.c
index 32a1def4e5..296acefc93 100644
--- a/gdk/linux-fb/gdkpango-fb.c
+++ b/gdk/linux-fb/gdkpango-fb.c
@@ -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;
-
- 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));
+ gi = pango_fb_font_get_glyph_info(font, glyph);
+ my_extents = gi->extents;
- 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];
diff --git a/gdk/linux-fb/gdkpixmap-fb.c b/gdk/linux-fb/gdkpixmap-fb.c
index c44089ecfe..7f8a8b5f70 100644
--- a/gdk/linux-fb/gdkpixmap-fb.c
+++ b/gdk/linux-fb/gdkpixmap-fb.c
@@ -49,40 +49,65 @@ typedef struct
gulong pixels[1];
} _GdkPixmapInfo;
+static gpointer parent_class = NULL;
+
+static void
+gdk_pixmap_impl_fb_init (GdkPixmapFBData *impl)
+{
+ GdkDrawableFBData *private = (GdkDrawableFBData *)impl;
+
+ private->window_type = GDK_DRAWABLE_PIXMAP;
+ private->colormap = gdk_colormap_ref(gdk_colormap_get_system());
+ private->mem = NULL;
+ private->width = 1;
+ private->height = 1;
+}
+
static void
-gdk_fb_pixmap_destroy (GdkPixmap *pixmap)
+gdk_pixmap_impl_fb_finalize (GObject *object)
{
- g_free (GDK_DRAWABLE_FBDATA(pixmap)->mem);
- g_free (GDK_DRAWABLE_FBDATA (pixmap));
+ g_free (GDK_DRAWABLE_FBDATA (object)->mem);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
-static GdkDrawable *
-gdk_fb_pixmap_alloc (void)
+static void
+gdk_pixmap_impl_fb_class_init (GdkPixmapFBClass *klass)
{
- GdkDrawable *drawable;
- GdkDrawablePrivate *private;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ // GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
- static GdkDrawableClass klass;
- static gboolean initialized = FALSE;
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = gdk_pixmap_impl_fb_finalize;
+}
- if (!initialized)
+GType
+_gdk_pixmap_impl_get_type (void)
+{
+ static GType object_type = 0;
+
+ if (!object_type)
{
- initialized = TRUE;
+ 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
+ };
- klass = _gdk_fb_drawable_class;
- klass.destroy = gdk_fb_pixmap_destroy;
+ object_type = g_type_register_static (gdk_drawable_impl_fb_get_type(),
+ "GdkPixmapFB",
+ &object_info);
}
-
- 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;
-
- return drawable;
+
+ 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);
-}
diff --git a/gdk/linux-fb/gdkprivate-fb.h b/gdk/linux-fb/gdkprivate-fb.h
index 3ce34f467e..8f5b28cd0e 100644
--- a/gdk/linux-fb/gdkprivate-fb.h
+++ b/gdk/linux-fb/gdkprivate-fb.h
@@ -39,31 +39,63 @@
#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;
gint format;
@@ -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,7 +134,7 @@ typedef struct {
} GdkVisualPrivateFB;
typedef struct {
- GdkColormapPrivate base;
+ GdkColormap base;
GHashTable *hash;
GdkColorInfo *info;
@@ -105,9 +142,14 @@ typedef struct {
} 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 */
diff --git a/gdk/linux-fb/gdkproperty-fb.c b/gdk/linux-fb/gdkproperty-fb.c
index e251e71d3b..c02f9d2164 100644
--- a/gdk/linux-fb/gdkproperty-fb.c
+++ b/gdk/linux-fb/gdkproperty-fb.c
@@ -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));
diff --git a/gdk/linux-fb/gdkwindow-fb.c b/gdk/linux-fb/gdkwindow-fb.c
index 4fe2d05cfa..46e6f7266a 100644
--- a/gdk/linux-fb/gdkwindow-fb.c
+++ b/gdk/linux-fb/gdkwindow-fb.c
@@ -34,7 +34,7 @@
#include <limits.h>
-GdkDrawableClass _gdk_windowing_window_class;
+static gpointer parent_class = NULL;
static void recompute_drawable(GdkDrawable *drawable);
@@ -45,15 +45,12 @@ g_free_2nd(gpointer a, gpointer b, gpointer data)
}
static void
-gdk_fb_window_destroy (GdkDrawable *drawable)
+gdk_window_impl_fb_finalize (GObject *object)
{
- GdkWindowFBData *fbd = GDK_WINDOW_FBDATA(drawable);
+ GdkWindowFBData *fbd = GDK_WINDOW_FBDATA(object);
- if (!GDK_DRAWABLE_DESTROYED (drawable))
- g_warning ("losing last reference to undestroyed window\n");
-
- if(GDK_WINDOW_P(drawable)->mapped)
- gdk_window_hide(drawable);
+ if(GDK_WINDOW_P(fbd->drawable_data.wrapper)->mapped)
+ gdk_window_hide(fbd->drawable_data.wrapper);
if(fbd->cursor)
gdk_cursor_unref(fbd->cursor);
@@ -64,74 +61,90 @@ gdk_fb_window_destroy (GdkDrawable *drawable)
g_hash_table_destroy(fbd->properties);
}
- g_free (GDK_DRAWABLE_FBDATA (drawable));
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
-static GdkWindow *
-gdk_fb_window_alloc (void)
+static void
+gdk_window_impl_fb_class_init (GdkWindowFBClass *klass)
{
- GdkWindow *window;
- GdkWindowPrivate *private;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ // GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
- static gboolean initialized = FALSE;
-
- if (!initialized)
- {
- initialized = TRUE;
+ parent_class = g_type_class_peek_parent (klass);
- _gdk_windowing_window_class = _gdk_fb_drawable_class;
- _gdk_windowing_window_class.destroy = gdk_fb_window_destroy;
- }
+ object_class->finalize = gdk_window_impl_fb_finalize;
+}
- window = _gdk_window_alloc ();
- private = (GdkWindowPrivate *)window;
+static void
+gdk_window_impl_fb_init (GdkWindowFBData *impl)
+{
+ impl->drawable_data.depth = gdk_display->modeinfo.bits_per_pixel;
+ impl->drawable_data.colormap = gdk_colormap_get_system ();
+ impl->event_mask = GDK_STRUCTURE_MASK;
+}
- private->drawable.klass = &_gdk_window_class;
- private->drawable.klass_data = g_new0 (GdkWindowFBData, 1);
- private->drawable.depth = gdk_display->modeinfo.bits_per_pixel;
- private->drawable.colormap = gdk_colormap_get_system ();
- GDK_WINDOW_FBDATA(private)->event_mask = GDK_STRUCTURE_MASK;
+GType
+_gdk_window_impl_get_type (void)
+{
+ static GType object_type = 0;
- return window;
+ if (!object_type)
+ {
+ static const GTypeInfo object_info =
+ {
+ sizeof (GdkWindowFBClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gdk_window_impl_fb_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GdkWindowFBData),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) gdk_window_impl_fb_init,
+ };
+
+ object_type = g_type_register_static (gdk_drawable_impl_fb_get_type(),
+ "GdkWindowFB",
+ &object_info);
+ }
+
+ return object_type;
}
#include "/usr/include/X11/bitmaps/left_ptr"
#include "/usr/include/X11/bitmaps/left_ptrmsk"
void
-gdk_window_init (void)
+_gdk_windowing_window_init (void)
{
+ GdkWindowAttr attr;
+
GdkBitmap *ptr, *mask;
GdkCursor *cursor;
GdkWindowPrivate *private;
- gdk_parent_root = gdk_fb_window_alloc ();
- private = (GdkWindowPrivate *)gdk_parent_root;
-
- private->drawable.window_type = GDK_WINDOW_ROOT;
- private->drawable.width = gdk_screen_width ();
- private->drawable.height = gdk_screen_height ();
- private->mapped = TRUE;
- private->x = 0;
- private->y = 0;
-
- GDK_DRAWABLE_FBDATA(private)->mem = gdk_display->fbmem;
-#if 0
- GDK_DRAWABLE_FBDATA(private)->rowstride = gdk_display->modeinfo.xres * (gdk_display->modeinfo.bits_per_pixel >> 3);
+ ptr = gdk_bitmap_create_from_data(gdk_parent_root, left_ptr_bits, left_ptr_width, left_ptr_height);
+ mask = gdk_bitmap_create_from_data(gdk_parent_root, left_ptrmsk_bits, left_ptrmsk_width, left_ptrmsk_height);
+#if 1
+ cursor = gdk_cursor_new_from_pixmap(ptr, mask, NULL, NULL, left_ptr_x_hot, left_ptr_y_hot);
#else
- GDK_DRAWABLE_FBDATA(private)->rowstride = gdk_display->sinfo.line_length;
+ cursor = gdk_cursor_new(GDK_LEFT_PTR);
#endif
- GDK_DRAWABLE_FBDATA(private)->lim_x = gdk_display->modeinfo.xres;
- GDK_DRAWABLE_FBDATA(private)->lim_y = gdk_display->modeinfo.yres;
- GDK_WINDOW_FBDATA(private)->event_mask = GDK_EXPOSURE_MASK;
- gdk_fb_drawable_clear(gdk_parent_root);
+ attr.width = gdk_screen_width();
+ attr.height = gdk_screen_height();
+ attr.window_type = GDK_WINDOW_ROOT;
+ attr.cursor = cursor;
+ attr.event_mask = GDK_EXPOSURE_MASK;
+ attr.wclass = GDK_INPUT_OUTPUT;
+ gdk_parent_root = gdk_window_new(NULL, &attr, GDK_WA_CURSOR);
+ private = (GdkWindowPrivate *)gdk_parent_root;
- ptr = gdk_bitmap_create_from_data(gdk_parent_root, left_ptr_bits, left_ptr_width, left_ptr_height);
- mask = gdk_bitmap_create_from_data(gdk_parent_root, left_ptrmsk_bits, left_ptrmsk_width, left_ptrmsk_height);
- cursor = gdk_cursor_new_from_pixmap(ptr, mask, NULL, NULL, left_ptr_x_hot, left_ptr_y_hot);
+ private->mapped = TRUE;
- gdk_window_set_cursor(gdk_parent_root, cursor);
+ GDK_DRAWABLE_IMPL_FBDATA(gdk_parent_root)->lim_x = attr.width;
+ GDK_DRAWABLE_IMPL_FBDATA(gdk_parent_root)->lim_y = attr.height;
+ gdk_fb_drawable_clear(gdk_parent_root);
}
GdkWindow*
@@ -143,6 +156,7 @@ gdk_window_new (GdkWindow *parent,
GdkWindowPrivate *private;
GdkWindowPrivate *parent_private;
GdkVisual *visual;
+ GdkWindowFBData *impl;
int x, y, depth;
@@ -152,13 +166,11 @@ gdk_window_new (GdkWindow *parent,
parent = gdk_parent_root;
parent_private = (GdkWindowPrivate*) parent;
- if (GDK_DRAWABLE_DESTROYED (parent))
- return NULL;
- window = gdk_fb_window_alloc ();
- private = (GdkWindowPrivate *)window;
+ window = (GdkWindow *)g_type_create_instance(GDK_TYPE_WINDOW);
+ private = (GdkWindowObject *)window;
- private->parent = parent;
+ private->parent = parent_private;
if (attributes_mask & GDK_WA_X)
x = attributes->x;
@@ -174,41 +186,49 @@ gdk_window_new (GdkWindow *parent,
if (attributes_mask & GDK_WA_VISUAL)
visual = attributes->visual;
+ else
+ visual = gdk_visual_get_system();
+ impl = (GdkWindowFBData *)private->impl;
+ impl->drawable_data.wrapper = window;
private->x = x;
private->y = y;
- private->drawable.width = (attributes->width > 1) ? (attributes->width) : (1);
- private->drawable.height = (attributes->height > 1) ? (attributes->height) : (1);
- private->drawable.window_type = attributes->window_type;
- GDK_DRAWABLE_FBDATA(private)->mem = gdk_display->fbmem;
- GDK_DRAWABLE_FBDATA(private)->rowstride = GDK_DRAWABLE_FBDATA(gdk_parent_root)->rowstride;
+ impl->drawable_data.width = (attributes->width > 1) ? (attributes->width) : (1);
+ impl->drawable_data.height = (attributes->height > 1) ? (attributes->height) : (1);
+ private->window_type = impl->drawable_data.window_type = attributes->window_type;
+ impl->drawable_data.mem = gdk_display->fbmem;
+ impl->drawable_data.rowstride = gdk_display->sinfo.line_length;
gdk_window_move_resize (window, x, y,
- private->drawable.width, private->drawable.height);
+ impl->drawable_data.width, impl->drawable_data.height);
if (attributes->wclass == GDK_INPUT_OUTPUT)
{
depth = visual->depth;
private->input_only = FALSE;
- private->drawable.depth = depth;
+ private->depth = impl->drawable_data.depth;
if ((attributes_mask & GDK_WA_COLORMAP)
&& attributes->colormap)
- private->drawable.colormap = attributes->colormap;
+ impl->drawable_data.colormap = attributes->colormap;
+ else
+ impl->drawable_data.colormap = gdk_colormap_get_system();
- switch (private->drawable.window_type)
+ switch (impl->drawable_data.window_type)
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_CHILD:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
+ default:
break;
case GDK_WINDOW_ROOT:
- g_error ("cannot make windows of type GDK_WINDOW_ROOT");
+ if(gdk_parent_root)
+ g_error ("cannot make windows of type GDK_WINDOW_ROOT");
break;
- case GDK_WINDOW_PIXMAP:
- g_error ("cannot make windows of type GDK_WINDOW_PIXMAP (use gdk_pixmap_new)");
+ case GDK_DRAWABLE_PIXMAP:
+ g_error ("cannot make windows of type GDK_DRAWABLE_PIXMAP (use gdk_pixmap_new)");
break;
}
}
@@ -216,23 +236,25 @@ gdk_window_new (GdkWindow *parent,
{
depth = 0;
private->input_only = TRUE;
- GDK_WINDOW_FBDATA(private)->level = 10000;
- private->drawable.colormap = NULL;
+ impl->level = 10000;
+ impl->drawable_data.colormap = NULL;
}
gdk_drawable_ref (window);
- if (private->drawable.colormap)
- gdk_colormap_ref (private->drawable.colormap);
+ if (impl->drawable_data.colormap)
+ gdk_colormap_ref (impl->drawable_data.colormap);
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
NULL));
if (parent_private)
+ {
parent_private->children = g_list_prepend (parent_private->children, window);
- if(parent_private && parent_private->children->next)
- GDK_WINDOW_FBDATA(private)->level = GDK_WINDOW_FBDATA(parent_private->children->next->data)->level + 1;
+ if(parent_private->children->next)
+ impl->level = GDK_WINDOW_FBDATA(GDK_WINDOW_P(parent_private->children->next->data)->impl)->level + 1;
+ }
return window;
}
@@ -248,6 +270,7 @@ _gdk_windowing_window_destroy(GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy)
{
+#if 0
GdkWindowPrivate *private;
GdkWindowPrivate *temp_private;
GdkWindow *temp_window;
@@ -259,14 +282,14 @@ _gdk_windowing_window_destroy(GdkWindow *window,
private = (GdkWindowPrivate*) window;
- switch (private->drawable.window_type)
+ switch (private->window_type)
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_CHILD:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
case GDK_WINDOW_FOREIGN:
- if (!private->drawable.destroyed)
+ if (!private->destroyed)
{
if (private->parent)
{
@@ -275,12 +298,12 @@ _gdk_windowing_window_destroy(GdkWindow *window,
parent_private->children = g_list_remove (parent_private->children, window);
}
- if (private->bg_pixmap && private->bg_pixmap != GDK_PARENT_RELATIVE_BG)
+ if (private->bg_pixmap && private->bg_pixmap != GDK_PARENT_RELATIVE_BG && private->bg_pixmap != GDK_NO_BG)
{
gdk_pixmap_unref (private->bg_pixmap);
private->bg_pixmap = NULL;
}
-
+
if (GDK_DRAWABLE_TYPE (window) != GDK_WINDOW_FOREIGN)
{
children = tmp = private->children;
@@ -317,7 +340,7 @@ _gdk_windowing_window_destroy(GdkWindow *window,
private->filters = NULL;
}
- if (private->drawable.window_type == GDK_WINDOW_FOREIGN)
+ if (private->window_type == GDK_WINDOW_FOREIGN)
{
if (our_destroy && (private->parent != NULL))
{
@@ -334,8 +357,8 @@ _gdk_windowing_window_destroy(GdkWindow *window,
}
}
- if (private->drawable.colormap)
- gdk_colormap_unref (private->drawable.colormap);
+ if (private->colormap)
+ gdk_colormap_unref (private->colormap);
private->mapped = FALSE;
private->drawable.destroyed = TRUE;
@@ -350,26 +373,11 @@ _gdk_windowing_window_destroy(GdkWindow *window,
g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");
break;
}
+#endif
}
/* This function is called when the XWindow is really gone. */
-void
-gdk_window_destroy_notify (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
-
- if (!GDK_DRAWABLE_DESTROYED (window))
- {
- if (GDK_DRAWABLE_TYPE(window) != GDK_WINDOW_FOREIGN)
- g_warning ("GdkWindow %#x unexpectedly destroyed", GPOINTER_TO_UINT(window));
-
- _gdk_windowing_window_destroy (window, TRUE, TRUE);
- }
-
- gdk_drawable_unref (window);
-}
-
static gboolean all_parents_shown(GdkWindowPrivate *private)
{
while(private->mapped)
@@ -386,11 +394,12 @@ static gboolean all_parents_shown(GdkWindowPrivate *private)
static void
send_map_events(GdkWindowPrivate *private, gboolean is_map)
{
- GdkEvent *event;
GList *l;
- GdkWindow *parent = private->parent;
+ GdkWindow *parent = (GdkWindow *)private->parent;
- if(!private->mapped || GDK_DRAWABLE_DESTROYED(private))
+ g_assert(is_map);
+
+ if(!private->mapped)
return;
if(is_map)
@@ -402,112 +411,159 @@ send_map_events(GdkWindowPrivate *private, gboolean is_map)
if(!parent)
parent = (GdkWindow *)private;
- if(((GDK_DRAWABLE_FBDATA(private)->abs_x > GDK_DRAWABLE_FBDATA(parent)->lim_x)
- || (GDK_DRAWABLE_FBDATA(private)->abs_y > GDK_DRAWABLE_FBDATA(parent)->lim_y)
- || (GDK_DRAWABLE_FBDATA(private)->lim_x < GDK_DRAWABLE_FBDATA(parent)->llim_x)
- || (GDK_DRAWABLE_FBDATA(private)->lim_y < GDK_DRAWABLE_FBDATA(parent)->llim_y)))
+ if(((GDK_DRAWABLE_IMPL_FBDATA(private)->abs_x > GDK_DRAWABLE_IMPL_FBDATA(parent)->lim_x)
+ || (GDK_DRAWABLE_IMPL_FBDATA(private)->abs_y > GDK_DRAWABLE_IMPL_FBDATA(parent)->lim_y)
+ || (GDK_DRAWABLE_IMPL_FBDATA(private)->lim_x < GDK_DRAWABLE_IMPL_FBDATA(parent)->llim_x)
+ || (GDK_DRAWABLE_IMPL_FBDATA(private)->lim_y < GDK_DRAWABLE_IMPL_FBDATA(parent)->llim_y)))
return;
if(is_map)
gdk_window_clear((GdkWindow *)private);
+#if 0
event = gdk_event_new();
event->expose.type = GDK_EXPOSE;
event->expose.window = gdk_window_ref((GdkWindow *)private);
- if(GDK_DRAWABLE_FBDATA(private)->abs_x > GDK_DRAWABLE_FBDATA(parent)->llim_x)
+ if(GDK_DRAWABLE_IMPL_FBDATA(private)->abs_x > GDK_DRAWABLE_IMPL_FBDATA(parent)->llim_x)
event->expose.area.x = 0;
else
- event->expose.area.x = GDK_DRAWABLE_FBDATA(parent)->llim_x - GDK_DRAWABLE_FBDATA(private)->abs_x;
+ event->expose.area.x = GDK_DRAWABLE_IMPL_FBDATA(parent)->llim_x - GDK_DRAWABLE_IMPL_FBDATA(private)->abs_x;
- if(GDK_DRAWABLE_FBDATA(private)->abs_y > GDK_DRAWABLE_FBDATA(parent)->llim_y)
+ if(GDK_DRAWABLE_IMPL_FBDATA(private)->abs_y > GDK_DRAWABLE_IMPL_FBDATA(parent)->llim_y)
event->expose.area.y = 0;
else
- event->expose.area.y = GDK_DRAWABLE_FBDATA(parent)->llim_y - GDK_DRAWABLE_FBDATA(private)->abs_y;
+ event->expose.area.y = GDK_DRAWABLE_IMPL_FBDATA(parent)->llim_y - GDK_DRAWABLE_IMPL_FBDATA(private)->abs_y;
- event->expose.area.width = MIN(private->drawable.width,
- GDK_DRAWABLE_FBDATA(private)->lim_x - GDK_DRAWABLE_FBDATA(private)->abs_x);
- event->expose.area.height = MIN(private->drawable.height,
- GDK_DRAWABLE_FBDATA(private)->lim_y - GDK_DRAWABLE_FBDATA(private)->abs_y);
+ event->expose.area.width = MIN(GDK_DRAWABLE_IMPL_FBDATA(private)->width,
+ GDK_DRAWABLE_IMPL_FBDATA(private)->lim_x - GDK_DRAWABLE_IMPL_FBDATA(private)->abs_x);
+ event->expose.area.height = MIN(GDK_DRAWABLE_IMPL_FBDATA(private)->height,
+ GDK_DRAWABLE_IMPL_FBDATA(private)->lim_y - GDK_DRAWABLE_IMPL_FBDATA(private)->abs_y);
if(event->expose.area.width > 0
&& event->expose.area.height > 0)
{
gdk_event_queue_append(event);
- for(l = private->children; l; l = l->next)
- send_map_events(l->data, is_map);
}
else
gdk_event_free(event);
-
+#endif
+ for(l = private->children; l; l = l->next)
+ send_map_events(l->data, is_map);
}
+/* Cut & paste versions of the stuff in gdkwindow.c, with the addition of clearing the newly exposed region. */
void
-gdk_fb_redraw_all(void)
+gdk_window_invalidate_region_clear(GdkWindow *window, GdkRegion *region)
{
- send_map_events((GdkWindowPrivate *)gdk_parent_root, FALSE);
+ int i;
+ GdkWindowPrivate *private = GDK_WINDOW_P(window);
+
+ if (private->input_only)
+ return;
+
+ if(private->bg_pixmap != GDK_NO_BG)
+ for(i = 0; i < region->numRects; i++)
+ gdk_window_clear_area(window,
+ region->rects[i].x1,
+ region->rects[i].y1,
+ region->rects[i].x2 - region->rects[i].x1,
+ region->rects[i].y2 - region->rects[i].y1);
+
+ gdk_window_invalidate_region(window, region, FALSE);
+
+ {
+ GList *tmp_list;
+ GdkRectangle child_rect;
+ GdkRegion *child_region;
+
+ tmp_list = private->children;
+ while (tmp_list)
+ {
+ GdkWindowObject *child = tmp_list->data;
+ tmp_list = tmp_list->next;
+
+ if (!child->input_only)
+ {
+ gint width, height;
+
+ gdk_drawable_get_size (GDK_DRAWABLE (child),
+ &width, &height);
+
+ child_rect.x = child->x;
+ child_rect.y = child->y;
+ child_rect.width = width;
+ child_rect.height = height;
+
+ child_region = gdk_region_rectangle (&child_rect);
+ gdk_region_intersect (child_region, region);
+
+ if (!gdk_region_empty (child_region))
+ {
+ gdk_region_offset (child_region, - child_rect.x, - child_rect.y);
+ gdk_window_invalidate_region_clear ((GdkWindow *)child, child_region);
+ }
+
+ gdk_region_destroy (child_region);
+ }
+ }
+ }
}
-static
-void gdk_fb_window_visibility_crossing(GdkWindow *window, gboolean is_show)
+void
+gdk_window_invalidate_rect_clear(GdkWindow *window, GdkRectangle *rect)
{
- gint winx, winy;
- GdkModifierType my_mask;
-
- gdk_input_ps2_get_mouseinfo(&winx, &winy, &my_mask);
+ GdkWindowPrivate *private = GDK_WINDOW_P(window);
- if(winx >= GDK_DRAWABLE_FBDATA(window)->llim_x
- && winx < GDK_DRAWABLE_FBDATA(window)->lim_x
- && winy >= GDK_DRAWABLE_FBDATA(window)->llim_y
- && winy < GDK_DRAWABLE_FBDATA(window)->lim_y && 0)
- {
- GdkWindow *oldwin, *newwin, *curwin;
- GdkEvent *event;
+ if (private->input_only)
+ return;
- curwin = gdk_window_get_pointer(NULL, NULL, NULL, NULL);
+ if(GDK_WINDOW_P(window)->bg_pixmap != GDK_NO_BG)
+ gdk_window_clear_area(window, rect->x, rect->y, rect->width, rect->height);
+ gdk_window_invalidate_rect(window, rect, FALSE);
+
+ {
+ GList *tmp_list;
+ GdkRectangle child_rect, new_rect;
+
+ tmp_list = private->children;
+ while (tmp_list)
+ {
+ GdkWindowObject *child = tmp_list->data;
+ tmp_list = tmp_list->next;
+
+ if (!child->input_only)
+ {
+ gint width, height;
+
+ width = GDK_DRAWABLE_IMPL_FBDATA(child)->width;
+ height = GDK_DRAWABLE_IMPL_FBDATA(child)->height;
+
+ child_rect.x = child->x;
+ child_rect.y = child->y;
+ child_rect.width = width;
+ child_rect.height = height;
+
+ if (gdk_rectangle_intersect (rect, &child_rect, &new_rect))
+ {
+ new_rect.x -= child_rect.x;
+ new_rect.y -= child_rect.y;
+
+ gdk_window_invalidate_rect_clear ((GdkWindow *)child, &new_rect);
+ }
+ }
+ }
+ }
- if(is_show)
- {
- /* Window is about to be shown */
- oldwin = curwin;
- newwin = window;
- }
- else
- {
- /* Window is about to be hidden */
- oldwin = window;
- newwin = curwin;
- }
- event = gdk_event_make(oldwin, GDK_LEAVE_NOTIFY, TRUE);
- if(event)
- {
- guint x_int, y_int;
- event->crossing.subwindow = gdk_window_ref(newwin);
- gdk_window_get_root_origin(oldwin, &x_int, &y_int);
- event->crossing.x = winx - x_int;
- event->crossing.y = winy - y_int;
- event->crossing.x_root = winx;
- event->crossing.y_root = winy;
- event->crossing.mode = GDK_CROSSING_NORMAL;
- event->crossing.detail = GDK_NOTIFY_UNKNOWN;
- event->crossing.focus = FALSE;
- event->crossing.state = my_mask;
- }
+}
- event = gdk_event_make(newwin, GDK_ENTER_NOTIFY, TRUE);
- if(event)
- {
- guint x_int, y_int;
- event->crossing.subwindow = gdk_window_ref(oldwin);
- gdk_window_get_root_origin(newwin, &x_int, &y_int);
- event->crossing.x = winx - x_int;
- event->crossing.y = winy - y_int;
- event->crossing.x_root = winx;
- event->crossing.y_root = winy;
- event->crossing.mode = GDK_CROSSING_NORMAL;
- event->crossing.detail = GDK_NOTIFY_UNKNOWN;
- event->crossing.focus = FALSE;
- event->crossing.state = my_mask;
- }
- }
+void
+gdk_fb_redraw_all(void)
+{
+ GdkRectangle r;
+ r.x = r.y = 0;
+ r.width = GDK_DRAWABLE_IMPL_FBDATA(gdk_parent_root)->width;
+ r.height = GDK_DRAWABLE_IMPL_FBDATA(gdk_parent_root)->height;
+ gdk_window_invalidate_rect(gdk_parent_root, &r, TRUE);
+ gdk_window_process_all_updates();
}
void
@@ -519,70 +575,31 @@ gdk_window_show (GdkWindow *window)
private = (GdkWindowPrivate*) window;
- if (!private->drawable.destroyed && !private->mapped)
+ if (!private->destroyed && !private->mapped)
{
private->mapped = TRUE;
if(all_parents_shown((GdkWindowPrivate *)private->parent))
{
+ GdkRectangle rect;
+
recompute_drawable((GdkDrawable *)window);
+
send_map_events(private, TRUE);
private->mapped = FALSE; /* a hack, ayup, to make gdk_window_get_pointer get the other window */
gdk_fb_window_visibility_crossing(window, TRUE);
private->mapped = TRUE;
- }
- }
-}
-
-static gboolean
-rects_overlap(GdkRectangle *r1, GdkRectangle *r2)
-{
- if(r1->x > (r2->x + r2->width))
- return FALSE;
- if(r2->x > (r1->x + r1->width))
- return FALSE;
- if(r1->y > (r2->y + r2->height))
- return FALSE;
- if(r2->y > (r1->y + r1->height))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-gdk_window_on_hide(GdkWindow *window, GdkRectangle *in_rect, GdkWindow *ignore)
-{
- GdkEvent *event;
- GdkRectangle this_rect, test_rect;
-
- if(!GDK_WINDOW_P(window)->mapped || window == ignore || GDK_WINDOW_P(window)->input_only)
- return;
-
- this_rect.x = MAX(GDK_DRAWABLE_FBDATA(window)->llim_x - GDK_DRAWABLE_FBDATA(window)->abs_x, 0);
-
- this_rect.y = MAX(GDK_DRAWABLE_FBDATA(window)->llim_y - GDK_DRAWABLE_FBDATA(window)->abs_y, 0);
-
- this_rect.width = MIN(GDK_DRAWABLE_P(window)->width,
- GDK_DRAWABLE_FBDATA(window)->lim_x - GDK_DRAWABLE_FBDATA(window)->abs_x);
- this_rect.height = MIN(GDK_DRAWABLE_P(window)->height,
- GDK_DRAWABLE_FBDATA(window)->lim_y - GDK_DRAWABLE_FBDATA(window)->abs_y);
-
- test_rect = this_rect;
- test_rect.x += GDK_DRAWABLE_FBDATA(window)->abs_x;
- test_rect.y += GDK_DRAWABLE_FBDATA(window)->abs_y;
- if(this_rect.width > 0
- && this_rect.height > 0
- && rects_overlap(&test_rect, in_rect))
- {
- GList *l;
- event = gdk_event_make(window, GDK_EXPOSE, TRUE);
- if(event)
- event->expose.area = this_rect;
+ if(private->input_only)
+ return;
- for(l = GDK_WINDOW_P(window)->children; l; l = l->next)
- gdk_window_on_hide(l->data, in_rect, ignore);
+ rect.x = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x;
+ rect.y = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y;
+ rect.width = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_x - rect.x;
+ rect.height = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_y - rect.y;
+ gdk_window_invalidate_rect_clear(gdk_parent_root, &rect);
+ }
}
}
@@ -595,26 +612,34 @@ gdk_window_hide (GdkWindow *window)
private = (GdkWindowPrivate*) window;
- if (!private->drawable.destroyed && private->mapped)
+ if (!private->destroyed && private->mapped)
{
GdkEvent *event;
GdkRectangle r;
+ gboolean do_hide;
event = gdk_event_make(window, GDK_UNMAP, TRUE);
- r.x = GDK_DRAWABLE_FBDATA(window)->llim_x;
- r.y = GDK_DRAWABLE_FBDATA(window)->llim_y;
- r.width = GDK_DRAWABLE_FBDATA(window)->lim_x - r.x;
- r.height = GDK_DRAWABLE_FBDATA(window)->lim_y - r.y;
+ r.x = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x;
+ r.y = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y;
+ r.width = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_x - r.x;
+ r.height = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_y - r.y;
private->mapped = FALSE;
- gdk_window_on_hide(private->parent, &r, NULL);
- if(private->parent == gdk_parent_root)
- gdk_fb_drawable_clear((GdkDrawable *)gdk_parent_root);
+ if(private->parent == GDK_WINDOW_P(gdk_parent_root))
+ gdk_fb_drawable_clear(gdk_parent_root);
if(all_parents_shown((GdkWindowPrivate *)private->parent))
gdk_fb_window_visibility_crossing(window, FALSE);
+
+ do_hide = gdk_fb_cursor_need_hide(&r);
+
+ if(do_hide)
+ gdk_fb_cursor_hide();
+ gdk_window_invalidate_rect_clear(gdk_parent_root, &r);
+ if(do_hide)
+ gdk_fb_cursor_unhide();
}
}
@@ -635,7 +660,7 @@ gdk_window_move (GdkWindow *window,
g_return_if_fail (GDK_IS_WINDOW (window));
gdk_window_move_resize (window, x, y,
- private->drawable.width, private->drawable.height);
+ GDK_DRAWABLE_IMPL_FBDATA(private)->width, GDK_DRAWABLE_IMPL_FBDATA(private)->height);
}
void
@@ -667,38 +692,45 @@ recompute_abs_positions(GdkDrawable *drawable, gint parent_x, gint parent_y,
if(GDK_IS_WINDOW(drawable))
{
GdkWindowPrivate *private = GDK_WINDOW_P(drawable);
+ int x, y;
if(!private->mapped)
return;
- GDK_DRAWABLE_FBDATA(private)->abs_x = parent_x + private->x;
- GDK_DRAWABLE_FBDATA(private)->abs_y = parent_y + private->y;
- GDK_DRAWABLE_FBDATA(private)->llim_x = MIN(MAX(parent_llim_x, GDK_DRAWABLE_FBDATA(private)->abs_x),
- parent_lim_x);
- GDK_DRAWABLE_FBDATA(private)->llim_y = MIN(MAX(parent_llim_y, GDK_DRAWABLE_FBDATA(private)->abs_y),
- parent_lim_y);
- GDK_DRAWABLE_FBDATA(private)->lim_x = MAX(MIN(parent_lim_x, GDK_DRAWABLE_FBDATA(private)->abs_x + GDK_DRAWABLE_P(private)->width),
- GDK_DRAWABLE_FBDATA(private)->llim_x);
- GDK_DRAWABLE_FBDATA(private)->lim_y = MAX(MIN(parent_lim_y,
- GDK_DRAWABLE_FBDATA(private)->abs_y + GDK_DRAWABLE_P(private)->height),
- GDK_DRAWABLE_FBDATA(private)->llim_y);
-
- g_assert(GDK_DRAWABLE_FBDATA(private)->llim_x <= GDK_DRAWABLE_FBDATA(private)->lim_x);
- g_assert(GDK_DRAWABLE_FBDATA(private)->llim_y <= GDK_DRAWABLE_FBDATA(private)->lim_y);
+
+ GDK_DRAWABLE_IMPL_FBDATA(private)->abs_x = parent_x + private->x;
+ GDK_DRAWABLE_IMPL_FBDATA(private)->abs_y = parent_y + private->y;
+ x = MAX(parent_llim_x, GDK_DRAWABLE_IMPL_FBDATA(private)->abs_x);
+ x = MIN(x, parent_lim_x);
+ GDK_DRAWABLE_IMPL_FBDATA(private)->llim_x = x;
+ y = MAX(parent_llim_y, GDK_DRAWABLE_IMPL_FBDATA(private)->abs_y);
+ y = MIN(y, parent_lim_y);
+ GDK_DRAWABLE_IMPL_FBDATA(private)->llim_y = y;
+ x = MIN(parent_lim_x,
+ GDK_DRAWABLE_IMPL_FBDATA(private)->abs_x + GDK_DRAWABLE_IMPL_FBDATA(private)->width);
+ x = MAX(x, GDK_DRAWABLE_IMPL_FBDATA(private)->llim_x);
+ GDK_DRAWABLE_IMPL_FBDATA(private)->lim_x = x;
+ y = MIN(parent_lim_y,
+ GDK_DRAWABLE_IMPL_FBDATA(private)->abs_y + GDK_DRAWABLE_IMPL_FBDATA(private)->height);
+ y = MAX(y, GDK_DRAWABLE_IMPL_FBDATA(private)->llim_y);
+ GDK_DRAWABLE_IMPL_FBDATA(private)->lim_y = y;
+
+ g_assert(GDK_DRAWABLE_IMPL_FBDATA(private)->llim_x <= GDK_DRAWABLE_IMPL_FBDATA(private)->lim_x);
+ g_assert(GDK_DRAWABLE_IMPL_FBDATA(private)->llim_y <= GDK_DRAWABLE_IMPL_FBDATA(private)->lim_y);
for(l = private->children; l; l = l->next)
- recompute_abs_positions(l->data, GDK_DRAWABLE_FBDATA(private)->abs_x, GDK_DRAWABLE_FBDATA(private)->abs_y,
- GDK_DRAWABLE_FBDATA(private)->llim_x, GDK_DRAWABLE_FBDATA(private)->llim_y,
- GDK_DRAWABLE_FBDATA(private)->lim_x, GDK_DRAWABLE_FBDATA(private)->lim_y);
+ recompute_abs_positions(l->data, GDK_DRAWABLE_IMPL_FBDATA(private)->abs_x, GDK_DRAWABLE_IMPL_FBDATA(private)->abs_y,
+ GDK_DRAWABLE_IMPL_FBDATA(private)->llim_x, GDK_DRAWABLE_IMPL_FBDATA(private)->llim_y,
+ GDK_DRAWABLE_IMPL_FBDATA(private)->lim_x, GDK_DRAWABLE_IMPL_FBDATA(private)->lim_y);
}
else
{
- GDK_DRAWABLE_FBDATA(drawable)->abs_x = 0;
- GDK_DRAWABLE_FBDATA(drawable)->abs_y = 0;
- GDK_DRAWABLE_FBDATA(drawable)->llim_x = 0;
- GDK_DRAWABLE_FBDATA(drawable)->llim_y = 0;
- GDK_DRAWABLE_FBDATA(drawable)->lim_x = GDK_DRAWABLE_P(drawable)->width;
- GDK_DRAWABLE_FBDATA(drawable)->lim_y = GDK_DRAWABLE_P(drawable)->height;
+ GDK_DRAWABLE_IMPL_FBDATA(drawable)->abs_x = 0;
+ GDK_DRAWABLE_IMPL_FBDATA(drawable)->abs_y = 0;
+ GDK_DRAWABLE_IMPL_FBDATA(drawable)->llim_x = 0;
+ GDK_DRAWABLE_IMPL_FBDATA(drawable)->llim_y = 0;
+ GDK_DRAWABLE_IMPL_FBDATA(drawable)->lim_x = GDK_DRAWABLE_IMPL_FBDATA(drawable)->width;
+ GDK_DRAWABLE_IMPL_FBDATA(drawable)->lim_y = GDK_DRAWABLE_IMPL_FBDATA(drawable)->height;
}
}
@@ -710,30 +742,32 @@ recompute_drawable(GdkDrawable *drawable)
GdkWindowPrivate *private = GDK_WINDOW_P(drawable);
GdkWindow *parent;
- parent = private->parent;
+ parent = (GdkWindow *)private->parent;
if(!parent)
parent = gdk_parent_root;
- recompute_abs_positions(drawable, GDK_DRAWABLE_FBDATA(parent)->abs_x,
- GDK_DRAWABLE_FBDATA(parent)->abs_y,
- GDK_DRAWABLE_FBDATA(parent)->llim_x,
- GDK_DRAWABLE_FBDATA(parent)->llim_y,
- GDK_DRAWABLE_FBDATA(parent)->lim_x,
- GDK_DRAWABLE_FBDATA(parent)->lim_y);
+ recompute_abs_positions(drawable, GDK_DRAWABLE_IMPL_FBDATA(parent)->abs_x,
+ GDK_DRAWABLE_IMPL_FBDATA(parent)->abs_y,
+ GDK_DRAWABLE_IMPL_FBDATA(parent)->llim_x,
+ GDK_DRAWABLE_IMPL_FBDATA(parent)->llim_y,
+ GDK_DRAWABLE_IMPL_FBDATA(parent)->lim_x,
+ GDK_DRAWABLE_IMPL_FBDATA(parent)->lim_y);
}
else
recompute_abs_positions(drawable, 0, 0, 0, 0, INT_MAX, INT_MAX);
}
void
-gdk_window_move_resize (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
+gdk_fb_window_move_resize (GdkWindow *window,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gboolean send_expose_events)
{
GdkWindowPrivate *private;
-
+ gint dx, dy, dw, dh;
+
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -741,34 +775,112 @@ gdk_window_move_resize (GdkWindow *window,
width = 1;
if (height < 1)
height = 1;
-
+
private = (GdkWindowPrivate*) window;
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!private->destroyed)
{
+ GdkRegion *old_region;
+ GdkRectangle old_rect;
+
+ if(private->input_only)
+ send_expose_events = FALSE;
+
+ if(private->mapped && send_expose_events)
+ {
+ old_region = gdk_fb_clip_region(GDK_DRAWABLE_IMPL(window), NULL, TRUE, FALSE);
+
+ old_rect.x = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x;
+ old_rect.y = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y;
+ old_rect.width = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_x - old_rect.x;
+ old_rect.height = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_y - old_rect.y;
+ }
+
+ dx = x - private->x;
+ dy = y - private->y;
+ dw = width - GDK_DRAWABLE_IMPL_FBDATA(private)->width;
+ dh = height - GDK_DRAWABLE_IMPL_FBDATA(private)->height;
+
private->x = x;
private->y = y;
- GDK_DRAWABLE_P(private)->width = width;
- GDK_DRAWABLE_P(private)->height = height;
+ GDK_DRAWABLE_IMPL_FBDATA(private)->width = width;
+ GDK_DRAWABLE_IMPL_FBDATA(private)->height = height;
if(private->mapped)
{
- GdkRectangle r;
+ recompute_drawable((GdkDrawable *)window);
- r.x = GDK_DRAWABLE_FBDATA(window)->llim_x;
- r.y = GDK_DRAWABLE_FBDATA(window)->llim_y;
- r.width = GDK_DRAWABLE_FBDATA(window)->lim_x - r.x;
- r.height = GDK_DRAWABLE_FBDATA(window)->lim_y - r.y;
+ if(send_expose_events)
+ {
+ GdkRectangle new_rect;
+ GdkRegion *new_region, *region;
+ int i;
+ gboolean handle_cursor = FALSE;
- recompute_drawable((GdkDrawable *)window);
- send_map_events(private, FALSE);
+ new_region = gdk_fb_clip_region(GDK_DRAWABLE_IMPL(window), NULL, TRUE, FALSE);
- gdk_window_on_hide(private->parent, &r, window);
+ new_rect.x = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x;
+ new_rect.y = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y;
+ new_rect.width = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_x - new_rect.x;
+ new_rect.height = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_y - new_rect.y;
+
+ region = gdk_region_copy(old_region);
+ gdk_region_offset(region, dx, dy);
+ gdk_region_intersect(region, new_region);
+
+ if(region->numRects)
+ {
+ GdkFBDrawingContext fbdc;
+ GdkRectangle cursor_rect;
+
+ gdk_fb_get_cursor_rect(&cursor_rect);
+
+ if(gdk_fb_cursor_region_need_hide(region))
+ {
+ gdk_fb_cursor_hide();
+ handle_cursor = TRUE;
+ }
+
+ gdk_fb_drawing_context_init(&fbdc, GDK_DRAWABLE_IMPL(gdk_parent_root), NULL, FALSE, FALSE);
+ for(i = 0; i < region->numRects; i++)
+ {
+ gdk_fb_draw_drawable_3(GDK_DRAWABLE_IMPL(gdk_parent_root), NULL, GDK_DRAWABLE_IMPL(gdk_parent_root),
+ &fbdc,
+ (region->rects[i].x1 - dx),
+ (region->rects[i].y1 - dy),
+ (region->rects[i].x1),
+ (region->rects[i].y1),
+ (region->rects[i].x2 - region->rects[i].x1),
+ (region->rects[i].y2 - region->rects[i].y1));
+ }
+ gdk_fb_drawing_context_finalize(&fbdc);
+ }
+
+ gdk_region_union(new_region, old_region);
+ gdk_region_subtract(new_region, region);
+ gdk_region_destroy(region);
+ gdk_window_invalidate_region_clear(gdk_parent_root, new_region);
+ if(handle_cursor)
+ gdk_fb_cursor_unhide();
+
+ gdk_region_destroy(old_region);
+ gdk_region_destroy(new_region);
+ }
}
}
}
void
+gdk_window_move_resize (GdkWindow *window,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ gdk_fb_window_move_resize(window, x, y, width, height, TRUE);
+}
+
+void
gdk_window_reparent (GdkWindow *window,
GdkWindow *new_parent,
gint x,
@@ -790,9 +902,9 @@ gdk_window_reparent (GdkWindow *window,
old_parent_private = (GdkWindowPrivate*)window_private->parent;
parent_private = (GdkWindowPrivate*) new_parent;
- g_assert(window_private->drawable.colormap);
+ g_assert(GDK_DRAWABLE_IMPL_FBDATA(window_private)->colormap);
- window_private->parent = new_parent;
+ window_private->parent = (GdkWindowPrivate *)new_parent;
if (old_parent_private)
old_parent_private->children = g_list_remove (old_parent_private->children, window);
@@ -800,7 +912,26 @@ gdk_window_reparent (GdkWindow *window,
parent_private->children = g_list_prepend (parent_private->children, window);
if(window_private->mapped)
- recompute_drawable((GdkDrawable *)window);
+ {
+ GdkRectangle r;
+ GdkRegion *region;
+
+ r.x = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x;
+ r.y = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y;
+ r.width = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_x - r.x;
+ r.height = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_y - r.y;
+ region = gdk_region_rectangle(&r);
+
+ recompute_drawable((GdkDrawable *)window);
+ r.x = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x;
+ r.y = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y;
+ r.width = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_x - r.x;
+ r.height = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_y - r.y;
+ gdk_region_union_with_rect(region, &r);
+
+ gdk_window_invalidate_region_clear(gdk_parent_root, region);
+ gdk_region_destroy(region);
+ }
}
@@ -814,26 +945,30 @@ _gdk_windowing_window_clear_area (GdkWindow *window,
GdkPixmap *bgpm;
GdkWindow *relto;
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
if(GDK_WINDOW_P(window)->input_only)
return;
bgpm = GDK_WINDOW_P(window)->bg_pixmap;
- for(relto = window; bgpm == GDK_PARENT_RELATIVE_BG && relto; relto = GDK_WINDOW_P(relto)->parent)
+
+#if 0
+ for(relto = window; bgpm == GDK_PARENT_RELATIVE_BG && relto; relto = (GdkWindow *)GDK_WINDOW_P(relto)->parent)
bgpm = GDK_WINDOW_P(relto)->bg_pixmap;
+#endif
if(bgpm && bgpm != GDK_NO_BG)
{
int curx, cury;
int xtrans, ytrans;
int xstep, ystep;
+ GdkFBDrawingContext fbdc;
- return; /* Don't bother doing this - gtk+ will do it itself using GC tiles */
+ return; /* Don't bother doing this - gtk+ will do it itself using GC tiles. If removing this line,
+ then also remove the #if 0 stuff */
- xtrans = GDK_DRAWABLE_FBDATA(relto)->abs_x - GDK_DRAWABLE_FBDATA(window)->abs_x;
- ytrans = GDK_DRAWABLE_FBDATA(relto)->abs_y - GDK_DRAWABLE_FBDATA(window)->abs_y;
+ gdk_fb_drawing_context_init(&fbdc, window, NULL, FALSE, TRUE);
+
+ xtrans = GDK_DRAWABLE_IMPL_FBDATA(relto)->abs_x - GDK_DRAWABLE_IMPL_FBDATA(window)->abs_x;
+ ytrans = GDK_DRAWABLE_IMPL_FBDATA(relto)->abs_y - GDK_DRAWABLE_IMPL_FBDATA(window)->abs_y;
for(cury = y - ytrans; cury < (y - ytrans + height); cury += ystep)
{
@@ -842,17 +977,20 @@ _gdk_windowing_window_clear_area (GdkWindow *window,
for(curx = x - xtrans; curx < (x - xtrans + width); curx += xstep)
{
- int draww = curx % GDK_DRAWABLE_P(bgpm)->width;
- xstep = GDK_DRAWABLE_P(bgpm)->width - draww;
+ int draww = curx % GDK_DRAWABLE_IMPL_FBDATA(bgpm)->width;
+ xstep = GDK_DRAWABLE_IMPL_FBDATA(bgpm)->width - draww;
- gdk_fb_draw_drawable_2(window, NULL, bgpm,
+ gdk_fb_draw_drawable_3(GDK_DRAWABLE_IMPL(window), NULL, GDK_DRAWABLE_IMPL(bgpm),
+ &fbdc,
draww, drawh, curx + xtrans, cury + ytrans,
- xstep, ystep, FALSE, TRUE);
+ xstep, ystep);
}
}
+
+ gdk_fb_drawing_context_finalize(&fbdc);
}
else if(!bgpm)
- gdk_fb_draw_rectangle(window, NULL, TRUE, x, y, width, height);
+ gdk_fb_draw_rectangle(GDK_DRAWABLE_IMPL(window), NULL, TRUE, x, y, width, height);
}
/* What's the diff? */
@@ -869,7 +1007,7 @@ _gdk_windowing_window_clear_area_e (GdkWindow *window,
static gint
compare_window_levels(gconstpointer a, gconstpointer b)
{
- return (GDK_WINDOW_FBDATA(b)->level - GDK_WINDOW_FBDATA(a)->level);
+ return (GDK_WINDOW_IMPL_FBDATA(b)->level - GDK_WINDOW_IMPL_FBDATA(a)->level);
}
/* Child list is sorted bottom-to-top */
@@ -882,7 +1020,9 @@ gdk_window_resort_children(GdkWindow *win)
/* Now the fun part - redraw */
if(GDK_WINDOW_P(win)->parent)
- send_map_events(private, FALSE);
+ {
+ gdk_window_invalidate_rect(win, NULL, TRUE);
+ }
}
void
@@ -891,10 +1031,10 @@ gdk_window_raise (GdkWindow *window)
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- GDK_WINDOW_FBDATA(window)->level++;
+ GDK_WINDOW_IMPL_FBDATA(window)->level++;
if(GDK_WINDOW_P(window)->parent)
- gdk_window_resort_children(GDK_WINDOW_P(window)->parent);
+ gdk_window_resort_children((GdkWindow *)GDK_WINDOW_P(window)->parent);
}
void
@@ -903,10 +1043,10 @@ gdk_window_lower (GdkWindow *window)
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- GDK_WINDOW_FBDATA(window)->level--;
+ GDK_WINDOW_IMPL_FBDATA(window)->level--;
if(GDK_WINDOW_P(window)->parent)
- gdk_window_resort_children(GDK_WINDOW_P(window)->parent);
+ gdk_window_resort_children((GdkWindow *)GDK_WINDOW_P(window)->parent);
}
void
@@ -944,7 +1084,7 @@ void
gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
- GDK_WINDOW_FBDATA(window)->level = GDK_WINDOW_FBDATA(parent)->level + 1;
+ GDK_WINDOW_IMPL_FBDATA(window)->level = GDK_WINDOW_IMPL_FBDATA(parent)->level + 1;
}
void
@@ -1008,12 +1148,22 @@ void
gdk_window_set_cursor (GdkWindow *window,
GdkCursor *cursor)
{
- GdkCursor *old_cursor = GDK_WINDOW_FBDATA(window)->cursor;
+ GdkCursor *old_cursor = GDK_WINDOW_IMPL_FBDATA(window)->cursor;
+ GdkRectangle window_reg;
- GDK_WINDOW_FBDATA(window)->cursor = cursor?gdk_cursor_ref(cursor):NULL;
+ GDK_WINDOW_IMPL_FBDATA(window)->cursor = cursor?gdk_cursor_ref(cursor):NULL;
if(old_cursor)
gdk_cursor_unref(old_cursor);
+
+ window_reg.x = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_x;
+ window_reg.y = GDK_DRAWABLE_IMPL_FBDATA(window)->llim_y;
+ window_reg.width = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_x - window_reg.x;
+ window_reg.height = GDK_DRAWABLE_IMPL_FBDATA(window)->lim_y - window_reg.y;
+ if(gdk_fb_cursor_need_hide(&window_reg))
+ {
+ gdk_fb_cursor_reset();
+ }
}
void
@@ -1031,7 +1181,7 @@ gdk_window_get_geometry (GdkWindow *window,
if (!window)
window = gdk_parent_root;
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!private->destroyed)
{
if (x)
@@ -1039,9 +1189,9 @@ gdk_window_get_geometry (GdkWindow *window,
if (y)
*y = private->y;
if (width)
- *width = GDK_DRAWABLE_P(window)->width;
+ *width = GDK_DRAWABLE_IMPL_FBDATA(window)->width;
if (height)
- *height = GDK_DRAWABLE_P(window)->height;
+ *height = GDK_DRAWABLE_IMPL_FBDATA(window)->height;
if (depth)
*depth = gdk_display->modeinfo.bits_per_pixel;
}
@@ -1055,9 +1205,9 @@ gdk_window_get_origin (GdkWindow *window,
g_return_val_if_fail (window != NULL, 0);
if (x)
- *x = GDK_DRAWABLE_FBDATA(window)->abs_x;
+ *x = GDK_DRAWABLE_IMPL_FBDATA(window)->abs_x;
if (y)
- *y = GDK_DRAWABLE_FBDATA(window)->abs_y;
+ *y = GDK_DRAWABLE_IMPL_FBDATA(window)->abs_y;
return TRUE;
}
@@ -1073,10 +1223,10 @@ gdk_window_get_deskrelative_origin (GdkWindow *window,
g_return_val_if_fail (window != NULL, 0);
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
- tx = GDK_DRAWABLE_FBDATA(window)->abs_x;
- ty = GDK_DRAWABLE_FBDATA(window)->abs_y;
+ tx = GDK_DRAWABLE_IMPL_FBDATA(window)->abs_x;
+ ty = GDK_DRAWABLE_IMPL_FBDATA(window)->abs_y;
return_val = TRUE;
}
@@ -1131,8 +1281,8 @@ gdk_window_get_pointer (GdkWindow *window,
return_val = NULL;
- if((winx >= 0) && (winx < GDK_DRAWABLE_P(window)->width)
- && (winy >= 0) && (winy < GDK_DRAWABLE_P(window)->height))
+ if((winx >= 0) && (winx < GDK_DRAWABLE_IMPL_FBDATA(window)->width)
+ && (winy >= 0) && (winy < GDK_DRAWABLE_IMPL_FBDATA(window)->height))
{
GdkWindowPrivate *private;
GdkWindowPrivate *sub;
@@ -1150,9 +1300,9 @@ gdk_window_get_pointer (GdkWindow *window,
continue;
if(subx >= sub->x
- && (subx < (GDK_DRAWABLE_P(sub)->width + sub->x))
+ && (subx < (GDK_DRAWABLE_IMPL_FBDATA(sub)->width + sub->x))
&& (suby >= sub->y)
- && (suby < (GDK_DRAWABLE_P(sub)->height + sub->y)))
+ && (suby < (GDK_DRAWABLE_IMPL_FBDATA(sub)->height + sub->y)))
{
subx -= sub->x;
suby -= sub->y;
@@ -1195,32 +1345,16 @@ gdk_window_at_pointer (gint *win_x,
return retval;
}
-GList*
-gdk_window_get_children (GdkWindow *window)
-{
- GList *children;
-
- g_return_val_if_fail (window != NULL, NULL);
- g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
-
- if (GDK_DRAWABLE_DESTROYED (window))
- return NULL;
-
- children = NULL;
-
- return ((GdkWindowPrivate *)window)->children; /* Need to copy this list? */
-}
-
GdkEventMask
gdk_window_get_events (GdkWindow *window)
{
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return 0;
else
- return GDK_WINDOW_FBDATA(window)->event_mask;
+ return GDK_WINDOW_IMPL_FBDATA(window)->event_mask;
}
void
@@ -1231,8 +1365,8 @@ gdk_window_set_events (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
- GDK_WINDOW_FBDATA(window)->event_mask = event_mask;
+ if (!GDK_WINDOW_DESTROYED (window))
+ GDK_WINDOW_IMPL_FBDATA(window)->event_mask = event_mask;
}
void
diff --git a/gdk/linux-fb/miarc.c b/gdk/linux-fb/miarc.c
index a3d739513f..191ba81555 100644
--- a/gdk/linux-fb/miarc.c
+++ b/gdk/linux-fb/miarc.c
@@ -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;
diff --git a/gdk/linux-fb/miwideline.c b/gdk/linux-fb/miwideline.c
index d1e46b9468..f0a88b758b 100644
--- a/gdk/linux-fb/miwideline.c
+++ b/gdk/linux-fb/miwideline.c
@@ -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);
}
diff --git a/gdk/linux-fb/mizerline.c b/gdk/linux-fb/mizerline.c
index 4ea91f357c..8b82a219ee 100644
--- a/gdk/linux-fb/mizerline.c
+++ b/gdk/linux-fb/mizerline.c
@@ -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
diff --git a/modules/linux-fb/basic.c b/modules/linux-fb/basic.c
index 880c4139eb..d03a139713 100644
--- a/modules/linux-fb/basic.c
+++ b/modules/linux-fb/basic.c
@@ -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 */