Merge branch 'wip/chergert/gtk4-remove-textlayout-vtable' into 'master'

textlayout: remove virtual table indirection

See merge request GNOME/gtk!2178
This commit is contained in:
Benjamin Otte 2020-07-01 01:19:12 +00:00
commit 25f670faae
2 changed files with 20 additions and 110 deletions

View File

@ -111,27 +111,13 @@ struct _GtkTextLayoutPrivate
GtkTextLineDisplayCache *cache; GtkTextLineDisplayCache *cache;
}; };
static GtkTextLineData *gtk_text_layout_real_wrap (GtkTextLayout *layout,
GtkTextLine *line,
/* may be NULL */
GtkTextLineData *line_data);
static void gtk_text_layout_invalidated (GtkTextLayout *layout); static void gtk_text_layout_invalidated (GtkTextLayout *layout);
static void gtk_text_layout_real_invalidate (GtkTextLayout *layout,
const GtkTextIter *start,
const GtkTextIter *end);
static void gtk_text_layout_real_invalidate_cursors(GtkTextLayout *layout,
const GtkTextIter *start,
const GtkTextIter *end);
static void gtk_text_layout_invalidate_cache (GtkTextLayout *layout, static void gtk_text_layout_invalidate_cache (GtkTextLayout *layout,
GtkTextLine *line, GtkTextLine *line,
gboolean cursors_only); gboolean cursors_only);
static void gtk_text_layout_invalidate_cursor_line (GtkTextLayout *layout, static void gtk_text_layout_invalidate_cursor_line (GtkTextLayout *layout,
gboolean cursors_only); gboolean cursors_only);
static void gtk_text_layout_real_free_line_data (GtkTextLayout *layout,
GtkTextLine *line,
GtkTextLineData *line_data);
static void gtk_text_layout_emit_changed (GtkTextLayout *layout, static void gtk_text_layout_emit_changed (GtkTextLayout *layout,
gint y, gint y,
gint old_height, gint old_height,
@ -249,16 +235,11 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass)
object_class->dispose = gtk_text_layout_dispose; object_class->dispose = gtk_text_layout_dispose;
object_class->finalize = gtk_text_layout_finalize; object_class->finalize = gtk_text_layout_finalize;
klass->wrap = gtk_text_layout_real_wrap;
klass->invalidate = gtk_text_layout_real_invalidate;
klass->invalidate_cursors = gtk_text_layout_real_invalidate_cursors;
klass->free_line_data = gtk_text_layout_real_free_line_data;
signals[INVALIDATED] = signals[INVALIDATED] =
g_signal_new (I_("invalidated"), g_signal_new (I_("invalidated"),
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTextLayoutClass, invalidated), 0,
NULL, NULL, NULL, NULL,
NULL, NULL,
G_TYPE_NONE, G_TYPE_NONE,
@ -268,7 +249,7 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass)
g_signal_new (I_("changed"), g_signal_new (I_("changed"),
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTextLayoutClass, changed), 0,
NULL, NULL, NULL, NULL,
_gtk_marshal_VOID__INT_INT_INT, _gtk_marshal_VOID__INT_INT_INT,
G_TYPE_NONE, G_TYPE_NONE,
@ -283,7 +264,7 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass)
g_signal_new (I_("allocate-child"), g_signal_new (I_("allocate-child"),
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTextLayoutClass, allocate_child), 0,
NULL, NULL, NULL, NULL,
_gtk_marshal_VOID__OBJECT_INT_INT, _gtk_marshal_VOID__OBJECT_INT_INT,
G_TYPE_NONE, G_TYPE_NONE,
@ -690,39 +671,6 @@ gtk_text_layout_cursors_changed (GtkTextLayout *layout,
gtk_text_layout_emit_changed (layout, y, old_height, new_height); gtk_text_layout_emit_changed (layout, y, old_height, new_height);
} }
void
gtk_text_layout_free_line_data (GtkTextLayout *layout,
GtkTextLine *line,
GtkTextLineData *line_data)
{
GTK_TEXT_LAYOUT_GET_CLASS (layout)->free_line_data (layout, line, line_data);
}
void
gtk_text_layout_invalidate (GtkTextLayout *layout,
const GtkTextIter *start_index,
const GtkTextIter *end_index)
{
GTK_TEXT_LAYOUT_GET_CLASS (layout)->invalidate (layout, start_index, end_index);
}
void
gtk_text_layout_invalidate_cursors (GtkTextLayout *layout,
const GtkTextIter *start_index,
const GtkTextIter *end_index)
{
GTK_TEXT_LAYOUT_GET_CLASS (layout)->invalidate_cursors (layout, start_index, end_index);
}
GtkTextLineData*
gtk_text_layout_wrap (GtkTextLayout *layout,
GtkTextLine *line,
/* may be NULL */
GtkTextLineData *line_data)
{
return GTK_TEXT_LAYOUT_GET_CLASS (layout)->wrap (layout, line, line_data);
}
/* /*
* gtk_text_layout_get_lines: * gtk_text_layout_get_lines:
@ -892,8 +840,8 @@ gtk_text_layout_update_cursor_line (GtkTextLayout *layout)
gtk_text_line_display_cache_set_cursor_line (priv->cache, priv->cursor_line); gtk_text_line_display_cache_set_cursor_line (priv->cache, priv->cursor_line);
} }
static void void
gtk_text_layout_real_invalidate (GtkTextLayout *layout, gtk_text_layout_invalidate (GtkTextLayout *layout,
const GtkTextIter *start, const GtkTextIter *start,
const GtkTextIter *end) const GtkTextIter *end)
{ {
@ -936,8 +884,8 @@ gtk_text_layout_real_invalidate (GtkTextLayout *layout,
gtk_text_layout_invalidated (layout); gtk_text_layout_invalidated (layout);
} }
static void void
gtk_text_layout_real_invalidate_cursors (GtkTextLayout *layout, gtk_text_layout_invalidate_cursors (GtkTextLayout *layout,
const GtkTextIter *start, const GtkTextIter *start,
const GtkTextIter *end) const GtkTextIter *end)
{ {
@ -946,8 +894,8 @@ gtk_text_layout_real_invalidate_cursors (GtkTextLayout *layout,
gtk_text_layout_invalidated (layout); gtk_text_layout_invalidated (layout);
} }
static void void
gtk_text_layout_real_free_line_data (GtkTextLayout *layout, gtk_text_layout_free_line_data (GtkTextLayout *layout,
GtkTextLine *line, GtkTextLine *line,
GtkTextLineData *line_data) GtkTextLineData *line_data)
{ {
@ -1148,8 +1096,8 @@ gtk_text_layout_validate (GtkTextLayout *layout,
} }
} }
static GtkTextLineData* GtkTextLineData *
gtk_text_layout_real_wrap (GtkTextLayout *layout, gtk_text_layout_wrap (GtkTextLayout *layout,
GtkTextLine *line, GtkTextLine *line,
/* may be NULL */ /* may be NULL */
GtkTextLineData *line_data) GtkTextLineData *line_data)

View File

@ -167,44 +167,6 @@ struct _GtkTextLayout
struct _GtkTextLayoutClass struct _GtkTextLayoutClass
{ {
GObjectClass parent_class; GObjectClass parent_class;
/* Some portion of the layout was invalidated
*/
void (*invalidated) (GtkTextLayout *layout);
/* A range of the layout changed appearance and possibly height
*/
void (*changed) (GtkTextLayout *layout,
gint y,
gint old_height,
gint new_height);
GtkTextLineData* (*wrap) (GtkTextLayout *layout,
GtkTextLine *line,
GtkTextLineData *line_data); /* may be NULL */
void (*get_log_attrs) (GtkTextLayout *layout,
GtkTextLine *line,
PangoLogAttr **attrs,
gint *n_attrs);
void (*invalidate) (GtkTextLayout *layout,
const GtkTextIter *start,
const GtkTextIter *end);
void (*free_line_data) (GtkTextLayout *layout,
GtkTextLine *line,
GtkTextLineData *line_data);
void (*allocate_child) (GtkTextLayout *layout,
GtkWidget *child,
gint x,
gint y);
void (*invalidate_cursors) (GtkTextLayout *layout,
const GtkTextIter *start,
const GtkTextIter *end);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
}; };
struct _GtkTextAttrAppearance struct _GtkTextAttrAppearance