diff options
author | David Robillard <d@drobilla.net> | 2017-02-26 12:28:40 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-02-26 12:28:40 +0100 |
commit | 176e3c9146d01d35b871b7a00e3c8c2482b008ec (patch) | |
tree | 4c9113cd7d944208b974613a6c45da85dca0a884 | |
parent | 96d838c1f4af144da1506b4df10f16057417cbab (diff) | |
download | suil-176e3c9146d01d35b871b7a00e3c8c2482b008ec.tar.gz suil-176e3c9146d01d35b871b7a00e3c8c2482b008ec.tar.bz2 suil-176e3c9146d01d35b871b7a00e3c8c2482b008ec.zip |
Add preliminary Qt5 in Gtk2 support
This crashes virtually all of the time in straight Gtk hosts unless
XInitThreads is called before any Gtk functions. A portable solution to this
is needed, but I have no idea what that might be.
-rw-r--r-- | AUTHORS | 5 | ||||
-rw-r--r-- | src/instance.c | 10 | ||||
-rw-r--r-- | src/qt4_in_gtk2.cpp | 16 | ||||
-rw-r--r-- | wscript | 48 |
4 files changed, 59 insertions, 20 deletions
@@ -8,10 +8,13 @@ Contributors: * Fix crash when a broken UI returns a NULL descriptor * Filipe Lopes <falktx@gmail.com> * Idle interface fixes for X11 in Qt4 + * Qt5 in Gtk2 support * Robin Gareus <robin@gareus.org> * Support for resizing X11 UIs in Gtk * Cocoa in Gtk wrapper * Numerous Windows fixes * Rui Nuno Capela * Fixes for X11 in Qt4 - * Qt5 wrappers
\ No newline at end of file + * Qt5 wrappers + * Stefan Westerfeld + * Qt5 in Gtk2 support diff --git a/src/instance.c b/src/instance.c index 29ff3f9..f05cc86 100644 --- a/src/instance.c +++ b/src/instance.c @@ -1,5 +1,5 @@ /* - Copyright 2007-2015 David Robillard <http://drobilla.net> + Copyright 2007-2017 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -44,6 +44,8 @@ suil_ui_supported(const char* container_type_uri, return SUIL_WRAPPING_NATIVE; } else if ((!strcmp(container_type_uri, GTK2_UI_URI) && !strcmp(ui_type_uri, QT4_UI_URI)) + || (!strcmp(container_type_uri, GTK2_UI_URI) + && !strcmp(ui_type_uri, QT5_UI_URI)) || (!strcmp(container_type_uri, QT4_UI_URI) && !strcmp(ui_type_uri, GTK2_UI_URI)) || (!strcmp(container_type_uri, QT5_UI_URI) @@ -92,6 +94,12 @@ open_wrapper(SuilHost* host, module_name = "suil_qt4_in_gtk2"; } #endif +#ifdef SUIL_WITH_QT5_IN_GTK2 + if (!strcmp(container_type_uri, GTK2_UI_URI) + && !strcmp(ui_type_uri, QT5_UI_URI)) { + module_name = "suil_qt5_in_gtk2"; + } +#endif #ifdef SUIL_WITH_X11_IN_GTK2 if (!strcmp(container_type_uri, GTK2_UI_URI) && !strcmp(ui_type_uri, X11_UI_URI)) { diff --git a/src/qt4_in_gtk2.cpp b/src/qt4_in_gtk2.cpp index 423c5bc..443c8f0 100644 --- a/src/qt4_in_gtk2.cpp +++ b/src/qt4_in_gtk2.cpp @@ -1,5 +1,5 @@ /* - Copyright 2011-2015 David Robillard <http://drobilla.net> + Copyright 2011-2017 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -17,8 +17,8 @@ #include <gtk/gtk.h> #include <QApplication> -#include <QX11EmbedWidget> #include <QVBoxLayout> +#include <QX11EmbedWidget> #include "./suil_internal.h" @@ -57,10 +57,9 @@ suil_qt_wrapper_finalize(GObject* gobject) } delete self->qembed; - self->qembed = NULL; - - self->app = NULL; + self->qembed = NULL; + self->app = NULL; self->wrapper->impl = NULL; G_OBJECT_CLASS(suil_qt_wrapper_parent_class)->finalize(gobject); @@ -108,10 +107,8 @@ wrapper_wrap(SuilWrapper* wrapper, qwidget->setParent(wrap->qembed); - g_signal_connect_after(G_OBJECT(wrap), - "realize", - G_CALLBACK(suil_qt_wrapper_realize), - NULL); + g_signal_connect_after(G_OBJECT(wrap), "realize", + G_CALLBACK(suil_qt_wrapper_realize), NULL); instance->host_widget = GTK_WIDGET(wrap); @@ -150,7 +147,6 @@ suil_wrapper_new(SuilHost* host, } wrap->wrapper = NULL; - wrapper->impl = wrap; return wrapper; @@ -50,6 +50,9 @@ def configure(conf): autowaf.set_c99_mode(conf) autowaf.display_header('Suil Configuration') + if conf.check_cxx(cxxflags=["-std=c++0x"]): + conf.env.append_unique('CXXFLAGS', ['-std=c++0x']) # for Qt + conf.env.BUILD_SHARED = not Options.options.no_shared conf.env.BUILD_STATIC = Options.options.static @@ -94,6 +97,8 @@ def configure(conf): if not Options.options.no_qt5: autowaf.check_pkg(conf, 'Qt5Widgets', uselib_store='QT5', atleast_version='5.1.0', mandatory=False) + autowaf.check_pkg(conf, 'Qt5X11Extras', uselib_store='QT5_X11', + atleast_version='5.1.0', mandatory=False) conf.check_cc(define_name = 'HAVE_LIBDL', lib = 'dl', @@ -113,6 +118,9 @@ def configure(conf): if conf.env.HAVE_GTK2 and conf.env.HAVE_QT5: autowaf.define(conf, 'SUIL_WITH_GTK2_IN_QT5', 1) + if conf.env.HAVE_GTK2 and conf.env.HAVE_QT5_X11: + autowaf.define(conf, 'SUIL_WITH_QT5_IN_GTK2', 1) + if conf.env.HAVE_GTK2 and conf.env.HAVE_GTK2_X11: autowaf.define(conf, 'SUIL_WITH_X11_IN_GTK2', 1) @@ -150,16 +158,29 @@ def configure(conf): autowaf.set_lib_env(conf, 'suil', SUIL_VERSION) conf.write_config_header('suil_config.h', remove=False) - autowaf.display_msg(conf, "Gtk2 Support", bool(conf.env.HAVE_GTK2)) if conf.env.HAVE_GTK2: autowaf.display_msg(conf, "Gtk2 Library Name", conf.env.SUIL_GTK2_LIB_NAME) - autowaf.display_msg(conf, "Gtk3 Support", bool(conf.env.HAVE_GTK3)) if conf.env.HAVE_GTK3: autowaf.display_msg(conf, "Gtk3 Library Name", conf.env.SUIL_GTK3_LIB_NAME) - autowaf.display_msg(conf, "Qt4 Support", bool(conf.env.HAVE_QT4)) - autowaf.display_msg(conf, "Qt5 Support", bool(conf.env.HAVE_QT5)) + + # Print summary message for every potentially supported wrapper + wrappers = [('cocoa', 'gtk2'), + ('gtk2', 'qt4'), + ('gtk2', 'qt5'), + ('qt4', 'gtk2'), + ('qt5', 'gtk2'), + ('win', 'gtk2'), + ('x11', 'gtk2'), + ('x11', 'gtk3'), + ('x11', 'qt4'), + ('x11', 'qt5')] + for w in wrappers: + var = 'SUIL_WITH_%s_IN_%s' % (w[0].upper(), w[1].upper()) + autowaf.display_msg(conf, 'Support for %s in %s' % (w[0], w[1]), + bool(conf.env[var])) + print('') def build(bld): @@ -222,7 +243,7 @@ def build(bld): includes = ['.'], defines = ['SUIL_SHARED', 'SUIL_INTERNAL'], install_path = module_dir, - cflags = cflags, + cxxflags = cflags, lib = modlib) autowaf.use_lib(bld, obj, 'GTK2 QT4 LV2') @@ -233,7 +254,7 @@ def build(bld): includes = ['.'], defines = ['SUIL_SHARED', 'SUIL_INTERNAL'], install_path = module_dir, - cflags = cflags, + cxxflags = cflags, lib = modlib) autowaf.use_lib(bld, obj, 'GTK2 QT5 LV2') @@ -244,11 +265,23 @@ def build(bld): includes = ['.'], defines = ['SUIL_SHARED', 'SUIL_INTERNAL'], install_path = module_dir, - cflags = cflags, + cxxflags = cflags, lib = modlib, linkflags = bld.env.NODELETE_FLAGS) autowaf.use_lib(bld, obj, 'GTK2 QT4 LV2') + if bld.env.SUIL_WITH_QT5_IN_GTK2: + obj = bld(features = 'cxx cxxshlib', + source = 'src/qt5_in_gtk2.cpp', + target = 'suil_qt5_in_gtk2', + includes = ['.'], + defines = ['SUIL_SHARED', 'SUIL_INTERNAL'], + install_path = module_dir, + cxxflags = cflags, + lib = modlib + ['X11'], + linkflags = bld.env.NODELETE_FLAGS) + autowaf.use_lib(bld, obj, 'GTK2 QT5 QT5_X11 LV2') + if bld.env.SUIL_WITH_X11_IN_GTK2: obj = bld(features = 'c cshlib', source = 'src/x11_in_gtk2.c', @@ -346,4 +379,3 @@ def posts(ctx): { 'Author' : 'drobilla', 'Tags' : 'Hacking, LAD, LV2, Suil' }, os.path.join(out, 'posts')) - |