Copy the layout render function from pangox to here, so we can write them

Thu Jun  1 01:54:11 2000  Owen Taylor  <otaylor@redhat.com>

	* Makefile.am gdk/gdkpango.c: Copy the layout render function from
	pangox to here, so we can write them independent of rendering
	system, using GDK primitives.

	* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
	gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
	since we have a rendering-system independent implementation in
	terms of draw_glyphs().

	* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
	function to render a single line.

	* gdk/x11/gdkpango.c: Move the guts of this file mostly
	into ../gdkpango.c, which simplifies things, since we
	don't have to deal with raw X gc's.

Fri May 19 04:28:16 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
	get the logical attributes for a given GtkTextLine.
This commit is contained in:
Owen Taylor
2000-06-01 03:31:37 +00:00
committed by Owen Taylor
parent edb969f196
commit 90841582f3
16 changed files with 224 additions and 194 deletions

View File

@@ -1,3 +1,26 @@
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track

View File

@@ -1,3 +1,26 @@
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track

View File

@@ -1,3 +1,26 @@
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track

View File

@@ -1,3 +1,26 @@
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track

View File

@@ -1,3 +1,26 @@
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track

View File

@@ -1,3 +1,26 @@
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track

View File

@@ -1,3 +1,26 @@
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track

View File

@@ -89,6 +89,7 @@ gdk_c_sources = @STRIP_BEGIN@ \
gdkkeyuni.c \
gdkimage.c \
gdkinternals.h \
gdkpango.c \
gdkrgb.c \
gdkrectangle.c \
gdkwindow.c \

View File

@@ -463,20 +463,3 @@ gdk_draw_glyphs (GdkDrawable *drawable,
((GdkDrawablePrivate *)drawable)->klass->draw_glyphs (drawable, gc, font, x, y, glyphs);
}
void
gdk_draw_layout (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
PangoLayout *layout)
{
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
((GdkDrawablePrivate *)drawable)->klass->draw_layout (drawable, gc, x, y, layout);
}

View File

@@ -114,11 +114,6 @@ struct _GdkDrawableClass
gint x,
gint y,
PangoGlyphString *glyphs);
void (*draw_layout) (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
PangoLayout *layout);
};
/* Manipulation of drawables
@@ -228,18 +223,23 @@ void gdk_draw_lines (GdkDrawable *drawable,
GdkGC *gc,
GdkPoint *points,
gint npoints);
void gdk_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
void gdk_draw_layout (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
PangoLayout *layout);
void gdk_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
void gdk_draw_layout_line (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
PangoLayoutLine *line);
void gdk_draw_layout (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
PangoLayout *layout);
#ifdef __cplusplus
}

View File

@@ -105,11 +105,6 @@ static void gdk_window_draw_glyphs (GdkDrawable *drawable,
gint x,
gint y,
PangoGlyphString *glyphs);
static void gdk_window_draw_layout (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
PangoLayout *layout);
/* All drawing operations on windows are forwarded through the following
* class to enable the automatic-backing-store feature.
@@ -127,7 +122,6 @@ GdkDrawableClass _gdk_window_class = {
gdk_window_draw_segments,
gdk_window_draw_lines,
gdk_window_draw_glyphs,
gdk_window_draw_layout
};
GdkWindow *
@@ -953,29 +947,6 @@ gdk_window_draw_glyphs (GdkDrawable *drawable,
RESTORE_GC (gc);
}
static void
gdk_window_draw_layout (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
PangoLayout *layout)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
OFFSET_GC (gc);
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
gdk_draw_layout (paint->pixmap, gc, x - x_offset, y - y_offset, layout);
}
else
_gdk_windowing_window_class.draw_layout (drawable, gc,
x - x_offset, y - y_offset, layout);
RESTORE_GC (gc);
}
/* Fixme - this is just like gdk_window_paint_init_bg */
static void
gdk_window_clear_backing_rect (GdkWindow *window,

View File

@@ -91,11 +91,6 @@ static void gdk_x11_draw_glyphs (GdkDrawable *drawable,
gint x,
gint y,
PangoGlyphString *glyphs);
static void gdk_x11_draw_layout (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
PangoLayout *layout);
GdkDrawableClass _gdk_x11_drawable_class = {
gdk_x11_drawable_destroy,
@@ -110,7 +105,6 @@ GdkDrawableClass _gdk_x11_drawable_class = {
gdk_x11_draw_segments,
gdk_x11_draw_lines,
gdk_x11_draw_glyphs,
gdk_x11_draw_layout
};
/*****************************************************
@@ -498,16 +492,3 @@ gdk_x11_draw_glyphs (GdkDrawable *drawable,
GDK_GC_GET_XGC (gc),
font, glyphs, x, y);
}
static void
gdk_x11_draw_layout (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
PangoLayout *layout)
{
pango_x_render_layout (GDK_DRAWABLE_XDISPLAY (drawable),
GDK_DRAWABLE_XID (drawable),
GDK_GC_GET_XGC (gc),
layout, x, y);
}

View File

@@ -21,114 +21,8 @@
#include "gdkpango.h"
#include <pango/pangox.h>
#define GDK_INFO_KEY "gdk-info"
typedef struct _GdkPangoXInfo GdkPangoXInfo;
struct _GdkPangoXInfo
{
GdkColormap *colormap;
};
static void
gdk_pango_context_destroy (GdkPangoXInfo *info)
{
gdk_colormap_unref (info->colormap);
g_free (info);
}
GC
duplicate_gc (Display *display,
Drawable drawable,
GC orig)
{
GC result = XCreateGC (display, drawable, 0, NULL);
XCopyGC (display, orig, ~((~1) << GCLastBit), result);
return result;
}
GC
gdk_pango_get_gc_func (PangoContext *context,
PangoAttrColor *fg_color,
GC base_gc)
{
GdkPangoXInfo *info;
GdkColormap *colormap;
GdkColor color;
GC result;
g_return_val_if_fail (context != NULL, NULL);
info = pango_context_get_data (context, GDK_INFO_KEY);
g_return_val_if_fail (info != NULL, NULL);
if (info->colormap)
colormap = info->colormap;
else
colormap = gdk_colormap_get_system();
/* FIXME. FIXME. FIXME. Only works for true color */
color.red = fg_color->red;
color.green = fg_color->green;
color.blue = fg_color->blue;
if (gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE))
{
GC result = duplicate_gc (GDK_DISPLAY (), GDK_ROOT_WINDOW (), base_gc);
XSetForeground (GDK_DISPLAY (), result, color.pixel);
return result;
}
else
return duplicate_gc (GDK_DISPLAY (), GDK_ROOT_WINDOW (), base_gc);
return result;
}
void
gdk_pango_free_gc_func (PangoContext *context,
GC gc)
{
XFreeGC (GDK_DISPLAY (), gc);
}
PangoContext *
gdk_pango_context_get (void)
{
GdkPangoXInfo *info = g_new (GdkPangoXInfo, 1);
PangoContext *result = pango_x_get_context (GDK_DISPLAY ());
pango_context_set_data (result, GDK_INFO_KEY,
info, (GDestroyNotify)gdk_pango_context_destroy);
pango_x_context_set_funcs (result, gdk_pango_get_gc_func, gdk_pango_free_gc_func);
info->colormap = NULL;
return result;
}
void
gdk_pango_context_set_colormap (PangoContext *context,
GdkColormap *colormap)
{
GdkPangoXInfo *info;
g_return_if_fail (context != NULL);
info = pango_context_get_data (context, GDK_INFO_KEY);
g_return_if_fail (info != NULL);
if (info->colormap != colormap)
{
if (info->colormap)
gdk_colormap_unref (info->colormap);
info->colormap = colormap;
if (info->colormap)
gdk_colormap_ref (info->colormap);
}
return pango_x_get_context (GDK_DISPLAY ());
}

View File

@@ -147,12 +147,12 @@ gboolean gtk_text_iter_backward_find_tag_toggle (GtkTextIter *iter,
typedef gboolean (* GtkTextViewCharPredicate) (guint16 ch, gpointer user_data);
gboolean gtk_text_iter_forward_find_char (GtkTextIter *iter,
GtkTextViewCharPredicate pred,
gpointer user_data);
GtkTextViewCharPredicate pred,
gpointer user_data);
gboolean gtk_text_iter_backward_find_char (GtkTextIter *iter,
GtkTextViewCharPredicate pred,
gpointer user_data);
gboolean gtk_text_iter_backward_find_char (GtkTextIter *iter,
GtkTextViewCharPredicate pred,
gpointer user_data);
/*
* Comparisons

View File

@@ -4,6 +4,7 @@
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 2000 Red Hat, Inc.
* Tk->Gtk port by Havoc Pennington
* Pango support by Owen Taylor
*
*
* This software is copyrighted by the Regents of the University of
@@ -63,6 +64,11 @@ static GtkTextLineData *gtk_text_layout_real_wrap (GtkTextLayout *layout,
/* may be NULL */
GtkTextLineData *line_data);
static void gtk_text_layout_real_get_log_attrs (GtkTextLayout *layout,
GtkTextLine *line,
PangoLogAttr **attrs,
gint *n_attrs);
static void gtk_text_layout_invalidated (GtkTextLayout *layout);
static void gtk_text_layout_real_invalidate (GtkTextLayout *layout,
@@ -163,6 +169,7 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass)
object_class->finalize = gtk_text_layout_finalize;
klass->wrap = gtk_text_layout_real_wrap;
klass->get_log_attrs = gtk_text_layout_real_get_log_attrs;
klass->invalidate = gtk_text_layout_real_invalidate;
klass->free_line_data = gtk_text_layout_real_free_line_data;
}
@@ -385,6 +392,16 @@ gtk_text_layout_wrap (GtkTextLayout *layout,
return (* GTK_TEXT_LAYOUT_CLASS (GTK_OBJECT (layout)->klass)->wrap) (layout, line, line_data);
}
void
gtk_text_layout_get_log_attrs (GtkTextLayout *layout,
GtkTextLine *line,
PangoLogAttr **attrs,
gint *n_attrs)
{
(* GTK_TEXT_LAYOUT_CLASS (GTK_OBJECT (layout)->klass)->get_log_attrs)
(layout, line, attrs, n_attrs);
}
GSList*
gtk_text_layout_get_lines (GtkTextLayout *layout,
/* [top_y, bottom_y) */
@@ -733,6 +750,21 @@ gtk_text_layout_real_wrap (GtkTextLayout *layout,
return line_data;
}
static void
gtk_text_layout_real_get_log_attrs (GtkTextLayout *layout,
GtkTextLine *line,
PangoLogAttr **attrs,
gint *n_attrs)
{
GtkTextLineDisplay *display;
g_return_val_if_fail (GTK_IS_TEXT_LAYOUT (layout), NULL);
display = gtk_text_layout_get_line_display (layout, line, TRUE);
pango_layout_get_log_attrs (display->layout, attrs, n_attrs);
gtk_text_layout_free_line_display (layout, display);
}
/*
* Layout utility functions
*/

View File

@@ -84,6 +84,10 @@ struct _GtkTextLayoutClass
/* may be NULL */
GtkTextLineData *line_data);
void (* get_log_attrs) (GtkTextLayout *layout,
GtkTextLine *line,
PangoLogAttr **attrs,
gint *n_attrs);
void (* invalidate) (GtkTextLayout *layout,
const GtkTextIter *start,
const GtkTextIter *end);
@@ -203,7 +207,10 @@ GtkTextLineData *gtk_text_layout_wrap (GtkTextLayout *layout,
GtkTextLine *line,
/* may be NULL */
GtkTextLineData *line_data);
void gtk_text_layout_get_log_attrs (GtkTextLayout *layout,
GtkTextLine *line,
PangoLogAttr **attrs,
gint *n_attrs);
void gtk_text_layout_changed (GtkTextLayout *layout,
gint y,
gint old_height,