Commit ee053ddd authored by Alexander Larsson's avatar Alexander Larsson
Browse files

Uh? What happed? My cvs checkin got broken pipe..

parent a92170b6
......@@ -2,6 +2,7 @@
#include "mi.h"
#include <string.h>
#include <pango/pangoft2.h>
#include <freetype/ftglyph.h>
#ifndef g_alloca
......@@ -879,10 +880,6 @@ gdk_fb_drawable_clear (GdkDrawable *d)
_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;
extern void pango_fb_font_set_size(PangoFont *font);
static void
gdk_fb_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
......@@ -891,9 +888,14 @@ gdk_fb_draw_glyphs (GdkDrawable *drawable,
gint y,
PangoGlyphString *glyphs)
{
int i;
int xpos;
GdkFBDrawingContext fbdc;
FT_Bitmap bitmap;
GdkPixmapFBData pixmap;
PangoFT2Subfont subfont_index;
PangoGlyphInfo *gi;
FT_Face face;
FT_UInt glyph_index;
int i, xpos;
g_return_if_fail (font);
......@@ -901,20 +903,39 @@ gdk_fb_draw_glyphs (GdkDrawable *drawable,
/* Fake its existence as a pixmap */
pango_fb_font_set_size (font);
for (i = xpos = 0; i < glyphs->num_glyphs; i++)
pixmap.drawable_data.abs_x = 0;
pixmap.drawable_data.abs_y = 0;
pixmap.drawable_data.depth = 78;
gi = glyphs->glyphs;
for (i = 0, xpos = 0; i < glyphs->num_glyphs; i++, gi++)
{
PangoFBGlyphInfo *pgi;
pgi = pango_fb_font_get_glyph_info (font, glyphs->glyphs[i].glyph);
gdk_fb_draw_drawable_3 (drawable, gc, (GdkPixmap *)&pgi->fbd,
&fbdc,
0, 0,
x + PANGO_PIXELS (xpos) + pgi->left , y - pgi->top + 1,
pgi->fbd.drawable_data.width, pgi->fbd.drawable_data.height);
if (gi->glyph)
{
glyph_index = PANGO_FT2_GLYPH_INDEX (gi->glyph);
subfont_index = PANGO_FT2_GLYPH_SUBFONT (gi->glyph);
face = pango_ft2_get_face (font, subfont_index);
if (face)
{
/* Draw glyph */
FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT);
if (face->glyph->format != ft_glyph_format_bitmap)
FT_Render_Glyph (face->glyph, ft_render_mode_normal);
pixmap.drawable_data.mem = face->glyph->bitmap.buffer;
pixmap.drawable_data.rowstride = face->glyph->bitmap.pitch;
pixmap.drawable_data.width = face->glyph->bitmap.width;
pixmap.drawable_data.height = face->glyph->bitmap.rows;
gdk_fb_draw_drawable_3 (drawable, gc, (GdkPixmap *)&pixmap,
&fbdc,
0, 0,
x + PANGO_PIXELS (xpos) + face->glyph->bitmap_left,
y - face->glyph->bitmap_top + 1,
face->glyph->bitmap.width, face->glyph->bitmap.rows);
}
}
xpos += glyphs->glyphs[i].geometry.width;
}
......
......@@ -22,4 +22,20 @@ extern const char *gdk_progclass;
extern GdkAtom gdk_selection_property;
/* FB specific functions: */
typedef gboolean (*GdkWindowChildChanged) (GdkWindow *window,
gint x, gint y,
gint width, gint height,
gpointer user_data);
typedef void (*GdkWindowChildGetPos) (GdkWindow *window,
gint *x, gint *y,
gpointer user_data);
gboolean _gdk_window_get_decorations (GdkWindow *window,
GdkWMDecoration *decorations);
void _gdk_window_set_child_handler (GdkWindow *window,
GdkWindowChildChanged changed,
GdkWindowChildGetPos get_pos,
gpointer user_data);
#endif /* GDKFB_H */
......@@ -634,8 +634,6 @@ _gdk_windowing_init_check (int argc, char **argv)
if (!gdk_display)
return FALSE;
gdk_fb_font_init ();
if (!gdk_fb_keyboard_open ())
{
g_warning ("Failed to initialize keyboard");
......@@ -1009,8 +1007,6 @@ gdk_windowing_exit (void)
gdk_fb_keyboard_close ();
gdk_fb_font_fini ();
gdk_fb_display_destroy (gdk_display);
gdk_display = NULL;
......
This diff is collapsed.
......@@ -158,9 +158,6 @@ typedef struct {
int size;
} GdkFontPrivateFB;
void gdk_fb_font_init(void);
void gdk_fb_font_fini(void);
typedef struct {
/* Empty */
} GdkImagePrivateFB;
......@@ -267,11 +264,9 @@ void gdk_fb_window_move_resize (GdkWindow *window,
gint height,
gboolean send_expose_events);
GdkWindow *gdk_fb_window_find_focus (void);
GdkGC * _gdk_fb_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
GdkGC * _gdk_fb_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
#define _GDK_FB_GC_DEPTH (1<<31)
void _gdk_fb_gc_calc_state (GdkGC *gc,
......@@ -400,31 +395,6 @@ void gdk_fb_mouse_get_info (gint *x,
GdkModifierType *mask);
#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))
typedef struct _PangoFBFont PangoFBFont;
struct _PangoFBFont
{
PangoFont parent;
FT_Face ftf;
PangoFontDescription desc;
PangoCoverage *coverage;
GHashTable *glyph_info;
};
typedef struct {
PangoRectangle extents[2];
GdkPixmapFBData fbd;
int top, left;
} PangoFBGlyphInfo;
GType pango_fb_font_get_type (void) G_GNUC_CONST;
PangoFBGlyphInfo *pango_fb_font_get_glyph_info (PangoFont *font,
PangoGlyph glyph);
extern void CM(void); /* Check for general mem corruption */
extern void RP(GdkDrawable *drawable); /* Same, for pixmaps */
......
......@@ -40,6 +40,14 @@ static gpointer parent_class = NULL;
static void recompute_drawable (GdkDrawable *drawable);
static void gdk_fb_window_raise (GdkWindow *window);
static GdkRegion* gdk_window_fb_get_visible_region (GdkDrawable *drawable);
typedef struct
{
GdkWindowChildChanged changed;
GdkWindowChildGetPos get_pos;
gpointer user_data;
} GdkWindowChildHandlerData;
static void
g_free_2nd (gpointer a, gpointer b, gpointer data)
......@@ -71,11 +79,15 @@ static void
gdk_window_impl_fb_class_init (GdkWindowFBClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
/* GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); */
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_window_impl_fb_finalize;
/* Visible and clip regions are the same */
drawable_class->get_clip_region = gdk_window_fb_get_visible_region;
drawable_class->get_visible_region = gdk_window_fb_get_visible_region;
}
static void
......@@ -784,6 +796,7 @@ gdk_window_resize (GdkWindow *window,
gint height)
{
GdkWindowObject *private;
gint x, y;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
......@@ -794,7 +807,21 @@ gdk_window_resize (GdkWindow *window,
width = 1;
if (height < 1)
height = 1;
gdk_window_move_resize (window, private->x, private->y, width, height);
x = private->x;
y = private->y;
if (private->parent && (private->parent->window_type != GDK_WINDOW_CHILD))
{
GdkWindowChildHandlerData *data;
data = g_object_get_data (G_OBJECT (private->parent), "gdk-window-child-handler");
if (data)
(*data->get_pos) (window, &x, &y, data->user_data);
}
gdk_window_move_resize (window, x, y, width, height);
}
static void
......@@ -902,6 +929,16 @@ gdk_fb_window_move_resize (GdkWindow *window,
private = (GdkWindowObject*) window;
if (private->parent && (private->parent->window_type != GDK_WINDOW_CHILD))
{
GdkWindowChildHandlerData *data;
data = g_object_get_data (G_OBJECT (private->parent), "gdk-window-child-handler");
if (data && (*data->changed) (window, x, y, width, height, data->user_data))
return;
}
if (!private->destroyed)
{
GdkRegion *old_region = NULL;
......@@ -937,7 +974,7 @@ gdk_fb_window_move_resize (GdkWindow *window,
gdk_region_offset (region, dx, dy);
gdk_region_intersect (region, new_region);
if (region->numRects)
if (region->numRects && ((dx != 0) || (dy != 0)))
{
GdkFBDrawingContext fbdc;
......@@ -1411,6 +1448,28 @@ gdk_window_get_root_origin (GdkWindow *window,
gdk_window_get_deskrelative_origin (window, x, y);
}
static GdkRegion*
gdk_window_fb_get_visible_region (GdkDrawable *drawable)
{
GdkDrawableFBData *priv = GDK_DRAWABLE_FBDATA (drawable);
GdkRectangle result_rect;
GdkRectangle screen_rect;
result_rect.x = 0;
result_rect.y = 0;
result_rect.width = priv->width;
result_rect.height = priv->height;
screen_rect.x = -priv->abs_x;
screen_rect.y = -priv->abs_y;
screen_rect.width = gdk_display->modeinfo.xres;
screen_rect.height = gdk_display->modeinfo.yres;
gdk_rectangle_intersect (&result_rect, &screen_rect, &result_rect);
return gdk_region_rectangle (&result_rect);
}
GdkWindow*
gdk_window_get_pointer (GdkWindow *window,
gint *x,
......@@ -1598,14 +1657,59 @@ gdk_window_set_group (GdkWindow *window,
/* N/A */
}
void
_gdk_window_set_child_handler (GdkWindow *window,
GdkWindowChildChanged changed,
GdkWindowChildGetPos get_pos,
gpointer user_data)
{
GdkWindowChildHandlerData *data;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
data = g_new (GdkWindowChildHandlerData, 1);
data->changed = changed;
data->get_pos = get_pos;
data->user_data = user_data;
g_object_set_data_full (G_OBJECT (window), "gdk-window-child-handler",
data, (GDestroyNotify) g_free);
}
void
gdk_window_set_decorations (GdkWindow *window,
GdkWMDecoration decorations)
{
GdkWMDecoration *dec;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
/* N/A */
dec = g_new (GdkWMDecoration, 1);
*dec = decorations;
g_object_set_data_full (G_OBJECT (window), "gdk-window-decorations",
dec, (GDestroyNotify) g_free);
}
gboolean
_gdk_window_get_decorations(GdkWindow *window,
GdkWMDecoration *decorations)
{
GdkWMDecoration *dec;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
dec = g_object_get_data (G_OBJECT (window), "gdk-window-decorations");
if (dec)
{
*decorations = *dec;
return TRUE;
}
return FALSE;
}
void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment