Add custom va_marshallers in some places

This is a slight performance optimization in the common case.
This commit is contained in:
Alexander Larsson 2012-03-05 12:39:09 +01:00
parent 8367be0630
commit 2422c44f8e
5 changed files with 93 additions and 2 deletions

View File

@ -1001,13 +1001,13 @@ BUILT_SOURCES = $(gtk_built_sources) stamp-icons
gtkmarshalers.h: stamp-gtkmarshalers.h
@true
stamp-gtkmarshalers.h: @REBUILD@ gtkmarshalers.list
$(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_gtk_marshal $(srcdir)/gtkmarshalers.list --header >> xgen-gmlh \
$(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_gtk_marshal $(srcdir)/gtkmarshalers.list --header --valist-marshallers >> xgen-gmlh \
&& (cmp -s xgen-gmlh gtkmarshalers.h || cp xgen-gmlh gtkmarshalers.h) \
&& rm -f xgen-gmlh \
&& echo timestamp > $(@F)
gtkmarshalers.c: @REBUILD@ gtkmarshalers.list
$(AM_V_GEN) (echo "#include \"gtkmarshalers.h\""; \
$(GLIB_GENMARSHAL) --prefix=_gtk_marshal $(srcdir)/gtkmarshalers.list --body) >> xgen-gmlc \
$(GLIB_GENMARSHAL) --prefix=_gtk_marshal $(srcdir)/gtkmarshalers.list --body --valist-marshallers) >> xgen-gmlc \
&& cp xgen-gmlc gtkmarshalers.c \
&& rm -f xgen-gmlc

View File

@ -707,6 +707,8 @@ gtk_cell_area_class_init (GtkCellAreaClass *class)
GTK_TYPE_TREE_ITER,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN);
g_signal_set_va_marshaller (cell_area_signals[SIGNAL_APPLY_ATTRIBUTES], G_TYPE_FROM_CLASS (class),
_gtk_marshal_VOID__OBJECT_BOXED_BOOLEAN_BOOLEANv);
/**
* GtkCellArea::add-editable:

View File

@ -316,6 +316,8 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass)
GTK_TYPE_TEXT_ITER | G_SIGNAL_TYPE_STATIC_SCOPE,
G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
G_TYPE_INT);
g_signal_set_va_marshaller (signals[INSERT_TEXT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_VOID__BOXED_STRING_INTv);
/**
* GtkTextBuffer::insert-pixbuf:

View File

@ -256,6 +256,8 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass)
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_INT);
g_signal_set_va_marshaller (signals[CHANGED], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_VOID__INT_INT_INTv);
signals[ALLOCATE_CHILD] =
g_signal_new (I_("allocate-child"),

View File

@ -830,6 +830,34 @@ gtk_widget_draw_marshaller (GClosure *closure,
cairo_restore (cr);
}
static void
gtk_widget_draw_marshallerv (GClosure *closure,
GValue *return_value,
gpointer instance,
va_list args,
gpointer marshal_data,
int n_params,
GType *param_types)
{
cairo_t *cr;
va_list args_copy;
va_copy (args_copy, args);
cr = va_arg (args_copy, gpointer);
cairo_save (cr);
_gtk_marshal_BOOLEAN__BOXEDv (closure,
return_value,
instance,
args,
marshal_data,
n_params,
param_types);
cairo_restore (cr);
}
static void
gtk_widget_class_init (GtkWidgetClass *klass)
{
@ -1704,6 +1732,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
gtk_widget_draw_marshaller,
G_TYPE_BOOLEAN, 1,
CAIRO_GOBJECT_TYPE_CONTEXT);
g_signal_set_va_marshaller (widget_signals[DRAW], G_TYPE_FROM_CLASS (klass),
gtk_widget_draw_marshallerv);
/**
* GtkWidget::mnemonic-activate:
@ -1816,6 +1846,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::event-after:
@ -1836,6 +1868,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[EVENT_AFTER], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::button-press-event:
@ -1863,6 +1897,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[BUTTON_PRESS_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::button-release-event:
@ -1890,6 +1926,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[BUTTON_RELEASE_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
widget_signals[TOUCH_EVENT] =
g_signal_new (I_("touch-event"),
@ -1900,6 +1938,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[TOUCH_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::scroll-event:
* @widget: the object which received the signal.
@ -1927,6 +1968,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[SCROLL_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::motion-notify-event:
@ -1954,6 +1997,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[MOTION_NOTIFY_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::composited-changed:
@ -1995,6 +2040,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[DELETE_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::destroy-event:
@ -2022,6 +2069,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[DESTROY_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::key-press-event:
@ -2048,6 +2097,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[KEY_PRESS_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::key-release-event:
@ -2073,6 +2124,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[KEY_RELEASE_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::enter-notify-event:
@ -2100,6 +2153,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[ENTER_NOTIFY_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::leave-notify-event:
@ -2127,6 +2182,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[LEAVE_NOTIFY_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::configure-event:
@ -2153,6 +2210,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[CONFIGURE_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::focus-in-event:
@ -2178,6 +2237,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[FOCUS_IN_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::focus-out-event:
@ -2203,6 +2264,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[FOCUS_OUT_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::map-event:
@ -2228,6 +2291,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[MAP_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::unmap-event:
@ -2253,6 +2318,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[UNMAP_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::property-notify-event:
@ -2278,6 +2345,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[PROPERTY_NOTIFY_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::selection-clear-event:
@ -2300,6 +2369,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[SELECTION_CLEAR_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::selection-request-event:
@ -2323,6 +2394,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[SELECTION_REQUEST_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::selection-notify-event:
@ -2340,6 +2413,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[SELECTION_NOTIFY_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::selection-received:
@ -2400,6 +2475,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[PROXIMITY_IN_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::proximity-out-event:
@ -2424,6 +2501,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[PROXIMITY_OUT_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::drag-leave:
@ -2834,6 +2913,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[WINDOW_STATE_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::damage-event:
@ -2858,6 +2939,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[DAMAGE_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::grab-broken-event:
@ -2885,6 +2968,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_set_va_marshaller (widget_signals[GRAB_BROKEN_EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
/**
* GtkWidget::query-tooltip: