From efe6c13d93f8a782d351440329e8d6a07ef06377 Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Wed, 24 Jul 2019 07:42:07 +0200 Subject: [PATCH] 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(-) create mode 100644 src/meta-marshal.list 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