[mutter/wip/nielsdg/cursor-moved-marshal: 12/14] cursor-tracker: Use our own marshal for cursor-moved



commit efe6c13d93f8a782d351440329e8d6a07ef06377
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Wed Jul 24 07:42:07 2019 +0200

    cursor-tracker: Use our own marshal for cursor-moved
    
    By putting `NULL` as the C marshaller in `g_signal_new`, you
    automatically get `g_cclosure_marshaller_generic`, which will try to
    process its arguments and return value with the help of libffi and
    GValue.
    
    Using `glib-genmarshal` and valist_marshallers, we can prevent this so
    that we need less instructions for each signal emission.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/697

 src/backends/meta-cursor-tracker.c | 7 ++++++-
 src/meson.build                    | 8 ++++++++
 src/meta-marshal.list              | 1 +
 3 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c
index 74481dd1c..04f20cf15 100644
--- a/src/backends/meta-cursor-tracker.c
+++ b/src/backends/meta-cursor-tracker.c
@@ -39,6 +39,7 @@
 #include "backends/x11/cm/meta-cursor-sprite-xfixes.h"
 #include "cogl/cogl.h"
 #include "clutter/clutter.h"
+#include "meta-marshal.h"
 #include "meta/main.h"
 #include "meta/meta-x11-errors.h"
 #include "meta/util.h"
@@ -170,10 +171,14 @@ meta_cursor_tracker_class_init (MetaCursorTrackerClass *klass)
                                         G_TYPE_FROM_CLASS (klass),
                                         G_SIGNAL_RUN_LAST,
                                         0,
-                                        NULL, NULL, NULL,
+                                        NULL, NULL,
+                                        meta_marshal_VOID__FLOAT_FLOAT,
                                         G_TYPE_NONE, 2,
                                         G_TYPE_FLOAT,
                                         G_TYPE_FLOAT);
+  g_signal_set_va_marshaller (signals[CURSOR_MOVED],
+                              G_TYPE_FROM_CLASS (klass),
+                              meta_marshal_VOID__FLOAT_FLOATv);
 
   signals[VISIBILITY_CHANGED] = g_signal_new ("visibility-changed",
                                               G_TYPE_FROM_CLASS (klass),
diff --git a/src/meson.build b/src/meson.build
index 515638fe5..e682aa4fd 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -657,6 +657,14 @@ dbus_idle_monitor_built_sources = gnome.gdbus_codegen('meta-dbus-idle-monitor',
   )
 mutter_built_sources += dbus_idle_monitor_built_sources
 
+mutter_marshal = gnome.genmarshal('meta-marshal',
+    sources: ['meta-marshal.list'],
+    prefix: 'meta_marshal',
+    internal: true,
+    valist_marshallers: true,
+  )
+mutter_built_sources += mutter_marshal
+
 if have_profiler
   mutter_sources += [
     'backends/meta-profiler.c',
diff --git a/src/meta-marshal.list b/src/meta-marshal.list
new file mode 100644
index 000000000..e26b60a8e
--- /dev/null
+++ b/src/meta-marshal.list
@@ -0,0 +1 @@
+VOID:FLOAT,FLOAT


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