[mutter/wip/nielsdg/cleanup-clutter-marshal: 2/2] clutter: Use va_marshaller for Actor signals



commit d877654f38dea708aad07e00696399c65157ec0b
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Thu Aug 1 08:55:51 2019 +0200

    clutter: Use va_marshaller for Actor signals
    
    If possible, GLib will try to use the va_marshaller to pass the signal
    arguments, rather than unboxing into and out of a `GValue`. This is much
    more performant and especially good for often-thrown signals.
    
    The original bug even mentions Clutter performance issues as a drive to
    implement the va_marshaller in GLib (see
    https://bugzilla.gnome.org/show_bug.cgi?id=661140).
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/700

 clutter/clutter/clutter-actor.c | 42 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index e97887b8c..de17b8954 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -8121,6 +8121,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  G_TYPE_BOOLEAN, 2,
                   CLUTTER_TYPE_ACTOR,
                   CLUTTER_TYPE_PAINT_VOLUME);
+  g_signal_set_va_marshaller (actor_signals[QUEUE_REDRAW],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__OBJECT_BOXEDv);
 
   /**
    * ClutterActor::queue-relayout:
@@ -8172,6 +8175,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  _clutter_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+  g_signal_set_va_marshaller (actor_signals[EVENT],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__BOXEDv);
   /**
    * ClutterActor::button-press-event:
    * @actor: the actor which received the event
@@ -8194,6 +8200,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  _clutter_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+  g_signal_set_va_marshaller (actor_signals[BUTTON_PRESS_EVENT],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__BOXEDv);
   /**
    * ClutterActor::button-release-event:
    * @actor: the actor which received the event
@@ -8216,6 +8225,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  _clutter_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+  g_signal_set_va_marshaller (actor_signals[BUTTON_RELEASE_EVENT],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__BOXEDv);
   /**
    * ClutterActor::scroll-event:
    * @actor: the actor which received the event
@@ -8238,6 +8250,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  _clutter_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+  g_signal_set_va_marshaller (actor_signals[SCROLL_EVENT],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__BOXEDv);
   /**
    * ClutterActor::key-press-event:
    * @actor: the actor which received the event
@@ -8260,6 +8275,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  _clutter_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+  g_signal_set_va_marshaller (actor_signals[KEY_PRESS_EVENT],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__BOXEDv);
   /**
    * ClutterActor::key-release-event:
    * @actor: the actor which received the event
@@ -8283,6 +8301,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  _clutter_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+  g_signal_set_va_marshaller (actor_signals[KEY_RELEASE_EVENT],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__BOXEDv);
   /**
    * ClutterActor::motion-event:
    * @actor: the actor which received the event
@@ -8305,6 +8326,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  _clutter_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+  g_signal_set_va_marshaller (actor_signals[MOTION_EVENT],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__BOXEDv);
 
   /**
    * ClutterActor::key-focus-in:
@@ -8359,6 +8383,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  _clutter_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+  g_signal_set_va_marshaller (actor_signals[ENTER_EVENT],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__BOXEDv);
 
   /**
    * ClutterActor::leave-event:
@@ -8381,6 +8408,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  _clutter_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+  g_signal_set_va_marshaller (actor_signals[LEAVE_EVENT],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__BOXEDv);
 
   /**
    * ClutterActor::captured-event:
@@ -8409,6 +8439,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  _clutter_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+  g_signal_set_va_marshaller (actor_signals[CAPTURED_EVENT],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__BOXEDv);
 
   /**
    * ClutterActor::paint:
@@ -8534,6 +8567,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                   G_TYPE_NONE, 2,
                   CLUTTER_TYPE_ACTOR_BOX | G_SIGNAL_TYPE_STATIC_SCOPE,
                   CLUTTER_TYPE_ALLOCATION_FLAGS);
+  g_signal_set_va_marshaller (actor_signals[ALLOCATION_CHANGED],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_VOID__BOXED_FLAGSv);
 
   /**
    * ClutterActor::transitions-completed:
@@ -8577,6 +8613,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                   G_TYPE_NONE, 2,
                   G_TYPE_STRING,
                   G_TYPE_BOOLEAN);
+  g_signal_set_va_marshaller (actor_signals[TRANSITION_STOPPED],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_VOID__STRING_BOOLEANv);
 
   /**
    * ClutterActor::touch-event:
@@ -8600,6 +8639,9 @@ clutter_actor_class_init (ClutterActorClass *klass)
                  _clutter_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+  g_signal_set_va_marshaller (actor_signals[TOUCH_EVENT],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_BOOLEAN__BOXEDv);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]