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
This commit is contained in:
Niels De Graef 2019-07-24 07:42:07 +02:00 committed by Carlos Garnacho
parent aae9f3a3e6
commit efe6c13d93
3 changed files with 15 additions and 1 deletions

View File

@ -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),

View File

@ -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',

1
src/meta-marshal.list Normal file
View File

@ -0,0 +1 @@
VOID:FLOAT,FLOAT