diff options
author | Thomas Martitz <kugel@rockbox.org> | 2015-12-13 23:01:55 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2015-12-13 23:01:55 +0100 |
commit | f731523ba185e94af6734102332168487c14730f (patch) | |
tree | f1623a8babc45069b0198604bcce248441fe4db2 | |
parent | 312ccef24f7faaff3ba8dae178c915374ab6677f (diff) | |
download | scintilla-mirror-f731523ba185e94af6734102332168487c14730f.tar.gz |
Fix issues raised by review and some more
- remove any notion of deprecation of legacy symbol names
- make sure typelib search path is set for test program
- add separate test target to test/gi/makefile
- improve g-ir-scanner call command line
- fixed gtk2 support of test test/gi/gi-test.py
-rw-r--r-- | gtk/ScintillaGTK.cxx | 6 | ||||
-rw-r--r-- | include/ScintillaWidget.h | 3 | ||||
-rw-r--r-- | test/gi/gi-test.py | 8 | ||||
-rw-r--r-- | test/gi/makefile | 26 |
4 files changed, 28 insertions, 15 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index ad6898072..6a9ff2ac4 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -3058,7 +3058,7 @@ sptr_t ScintillaGTK::DirectFunction( return reinterpret_cast<ScintillaGTK *>(ptr)->WndProc(iMessage, wParam, lParam); } -/* old name for compatibility */ +/* legacy name for scintilla_object_send_message */ sptr_t scintilla_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { ScintillaGTK *psci = static_cast<ScintillaGTK *>(sci->pscin); return psci->WndProc(iMessage, wParam, lParam); @@ -3075,7 +3075,7 @@ static void scintilla_init(ScintillaObject *sci); extern void Platform_Initialise(); extern void Platform_Finalise(); -/* old name for compatibility */ +/* legacy name for scintilla_object_get_type */ GType scintilla_get_type() { static GType scintilla_type = 0; try { @@ -3214,7 +3214,7 @@ static void scintilla_init(ScintillaObject *sci) { } } -/* old name for compatibility */ +/* legacy name for scintilla_object_new */ GtkWidget* scintilla_new() { GtkWidget *widget = GTK_WIDGET(g_object_new(scintilla_get_type(), NULL)); gtk_widget_set_direction(widget, GTK_TEXT_DIR_LTR); diff --git a/include/ScintillaWidget.h b/include/ScintillaWidget.h index 37bb2ecbe..87c70917c 100644 --- a/include/ScintillaWidget.h +++ b/include/ScintillaWidget.h @@ -46,8 +46,7 @@ GtkWidget* scintilla_object_new (void); long scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam); #ifndef G_IR_SCANNING -/* The following declarations are preserved for compatibility reasons. However, they confuse - * the g-ir-scanner program */ +/* The legacy names confuse the g-ir-scanner program */ typedef struct _ScintillaClass ScintillaClass; GType scintilla_get_type (void); diff --git a/test/gi/gi-test.py b/test/gi/gi-test.py index 10cee8bc6..6c775ea0c 100644 --- a/test/gi/gi-test.py +++ b/test/gi/gi-test.py @@ -1,6 +1,12 @@ #!/usr/bin/python -from gi.repository import Gtk +import gi +gi.require_version('Scintilla', '0.1') + +# Scintilla is imported before because it loads Gtk with a specified version +# this avoids a warning when Gtk is imported without version such as below (where +# it is imported without because this script works with gtk2 and gtk3) from gi.repository import Scintilla +from gi.repository import Gtk win = Gtk.Window() win.connect("delete-event", Gtk.main_quit) diff --git a/test/gi/makefile b/test/gi/makefile index 41d200653..44277fbbc 100644 --- a/test/gi/makefile +++ b/test/gi/makefile @@ -1,14 +1,16 @@ all: Scintilla-0.1.typelib ifdef GTK3 -GTKVERSION=gtk+-3.0 +GTKVERSION=3.0 else -GTKVERSION=gtk+-2.0 +GTKVERSION=2.0 endif GI_SCANNER = g-ir-scanner GI_COMPILER = g-ir-compiler -GTK_LIBS = $(shell pkg-config --libs $(GTKVERSION)) +GTK_LIBS = $(shell pkg-config --libs gtk+-$(GTKVERSION)) +GTK_CFLAGS = $(shell pkg-config --cflags gtk+-$(GTKVERSION)) +PWD = $(shell pwd) FORCE: @@ -19,17 +21,23 @@ libscintilla.so: ../../bin/scintilla.a $(CXX) -shared -o $@ -Wl,--whole-archive $^ -Wl,--no-whole-archive $(GTK_LIBS) Scintilla-0.1.gir: libscintilla.so - LDFLAGS=-Wl,-rpath=$(shell pwd) CFLAGS="-include gtk/gtk.h" \ - $(GI_SCANNER) --warn-all -i Gtk-3.0 -DG_IR_SCANNING -DGTK \ + LDFLAGS=-Wl,-rpath=$(shell pwd) \ + $(GI_SCANNER) --warn-all -i Gtk-$(GTKVERSION) -DG_IR_SCANNING -DGTK \ + --cflags-begin $(GTK_CFLAGS) -include gtk/gtk.h --cflags-end \ --c-include Scintilla.h --c-include ScintillaWidget.h \ - -n Scintilla --nsversion 0.1 --library scintilla ../../include/ScintillaWidget.h \ + -n Scintilla --nsversion 0.1 --library scintilla -L$(PWD) ../../include/ScintillaWidget.h \ -o $@ - @echo Verifing Scintilla-0.1.gir file - @diff $@.good $@ || (echo "GIR FILE MISMATCH!"; exit 1) - Scintilla-0.1.typelib: Scintilla-0.1.gir $(GI_COMPILER) $^ -o $@ clean: rm -f libscintilla.so Scintilla-0.1.gir Scintilla-0.1.typelib + $(MAKE) -C ../../gtk clean + +test: Scintilla-0.1.gir + @echo Verifing Scintilla-0.1.gir file + @diff $^.good $^ || (echo "GIR FILE MISMATCH!"; exit 1) + @echo Launching gi-test.py python program + GI_TYPELIB_PATH=$(PWD) LD_LIBRARY_PATH=$(PWD) \ + python $(PWD)/gi-test.py |