diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2016-04-26 17:09:25 +0200 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2016-04-26 17:09:25 +0200 |
| commit | 17a38b0f6efc4a0d847ab502773dafa9939999d8 (patch) | |
| tree | 4b0cc8c8e07e9decdc8862a06a6f6fbdeeedcb12 /gtk/ScintillaGTK.cxx | |
| parent | 8d4062a828ec5800b31cac519df11782d2ea4c06 (diff) | |
| download | scintilla-mirror-17a38b0f6efc4a0d847ab502773dafa9939999d8.tar.gz | |
Enable g-ir-scanner to scan ScintillaObject signals
Currently, the ScintillaObject signals can't be used from python code via
gobject-introspection. This is because g-ir-scanner does not properly scan
the signals.
For signals, there is the additional requirement that parameters have are
registered GTypes. For the sci-notify signal, this can be accomplished by
boxing SCNotification.
In addition, g-ir-scanner also runs on Scintilla.h where it picks up
additional structs.
test/gi/ is updated accordingly. The test python script is enhanced
to showcase the signals (some fixes to the makefile are included as well).
Diffstat (limited to 'gtk/ScintillaGTK.cxx')
| -rw-r--r-- | gtk/ScintillaGTK.cxx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 9fc8e4cc4..3caab96a4 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -72,8 +72,6 @@ #include "ExternalLexer.h" #endif -#include "scintilla-marshal.h" - #include "Converter.h" #if defined(__clang__) @@ -3162,9 +3160,6 @@ void ScintillaGTK::ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_ container_class->forall = MainForAll; } -#define SIG_MARSHAL scintilla_marshal_NONE__INT_POINTER -#define MARSHAL_ARGUMENTS G_TYPE_INT, G_TYPE_POINTER - static void scintilla_class_init(ScintillaClass *klass) { try { OBJECT_CLASS *object_class = (OBJECT_CLASS*) klass; @@ -3179,9 +3174,9 @@ static void scintilla_class_init(ScintillaClass *klass) { G_STRUCT_OFFSET(ScintillaClass, command), NULL, //(GSignalAccumulator) NULL, //(gpointer) - SIG_MARSHAL, + NULL, G_TYPE_NONE, - 2, MARSHAL_ARGUMENTS); + 2, G_TYPE_INT, GTK_TYPE_WIDGET); scintilla_signals[NOTIFY_SIGNAL] = g_signal_new( SCINTILLA_NOTIFY, @@ -3190,9 +3185,9 @@ static void scintilla_class_init(ScintillaClass *klass) { G_STRUCT_OFFSET(ScintillaClass, notify), NULL, NULL, - SIG_MARSHAL, + NULL, G_TYPE_NONE, - 2, MARSHAL_ARGUMENTS); + 2, G_TYPE_INT, SCINTILLA_TYPE_NOTIFICATION); klass->command = NULL; klass->notify = NULL; @@ -3233,3 +3228,10 @@ void scintilla_release_resources(void) { } catch (...) { } } + +/* Define a dummy boxed type because g-ir-scanner is unable to + * recognize gpointer-derived types. Note that SCNotificaiton + * is always allocated on stack so copying is not appropriate. */ +static void *copy_(void *src) { return src; } +static void free_(void *doc) { } +G_DEFINE_BOXED_TYPE(SCNotification, scnotification, copy_, free_) |
