summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS6
-rw-r--r--src/gtk2_in_qt4.cpp149
-rw-r--r--src/qt4_in_gtk2.cpp157
-rw-r--r--src/x11_in_qt4.cpp155
-rw-r--r--wscript54
5 files changed, 7 insertions, 514 deletions
diff --git a/NEWS b/NEWS
index a6076b0..5401f46 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+suil (0.10.11) unstable;
+
+ * Remote Qt4 support
+
+ -- David Robillard <d@drobilla.net> Mon, 11 Jan 2021 03:30:34 +0000
+
suil (0.10.10) stable;
* Clean up minor code issues
diff --git a/src/gtk2_in_qt4.cpp b/src/gtk2_in_qt4.cpp
deleted file mode 100644
index 9186273..0000000
--- a/src/gtk2_in_qt4.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- Copyright 2011-2015 David Robillard <d@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
- copyright notice and this permission notice appear in all copies.
-
- THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-#include "dylib.h"
-#include "suil_config.h"
-#include "suil_internal.h"
-
-#include <QX11EmbedContainer>
-
-#undef signals
-
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-
-extern "C" {
-
-using SuilGtk2InQt4Wrapper = _SuilGtk2InQt4Wrapper;
-
-struct _SuilGtk2InQt4Wrapper {
- QX11EmbedContainer* host_widget;
- QWidget* parent;
- GtkWidget* plug;
-};
-
-static void
-on_size_request(GtkWidget* widget,
- GtkRequisition* requisition,
- gpointer user_data)
-{
- QX11EmbedContainer* const wrap = (QX11EmbedContainer*)user_data;
- wrap->setMinimumSize(requisition->width, requisition->height);
-}
-
-static void
-on_size_allocate(GtkWidget* widget,
- GdkRectangle* allocation,
- gpointer user_data)
-{
- QX11EmbedContainer* const wrap = (QX11EmbedContainer*)user_data;
- wrap->resize(allocation->width, allocation->height);
-}
-
-static void
-wrapper_free(SuilWrapper* wrapper)
-{
- SuilGtk2InQt4Wrapper* impl = (SuilGtk2InQt4Wrapper*)wrapper->impl;
-
- if (impl->plug) {
- gtk_widget_destroy(impl->plug);
- }
-
- if (impl->host_widget) {
- delete impl->host_widget;
- }
-
- free(impl);
-}
-
-static int
-wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance)
-{
- SuilGtk2InQt4Wrapper* const impl = (SuilGtk2InQt4Wrapper*)wrapper->impl;
- QWidget* root = static_cast<QWidget*>(impl->parent);
- QX11EmbedContainer* const wrap = new QX11EmbedContainer(root);
- GtkWidget* const plug = gtk_plug_new(wrap->winId());
- GtkWidget* const widget = (GtkWidget*)instance->ui_widget;
-
- gtk_container_add(GTK_CONTAINER(plug), widget);
- gtk_widget_show_all(plug);
-
-#ifdef SUIL_OLD_GTK
- wrap->resize(widget->allocation.width, widget->allocation.height);
-#else
- GtkAllocation alloc;
- gtk_widget_get_allocation(widget, &alloc);
- wrap->resize(alloc.width, alloc.height);
-#endif
-
- g_signal_connect(
- G_OBJECT(plug), "size-request", G_CALLBACK(on_size_request), wrap);
-
- g_signal_connect(
- G_OBJECT(plug), "size-allocate", G_CALLBACK(on_size_allocate), wrap);
-
- impl->host_widget = wrap;
- impl->plug = plug;
- instance->host_widget = wrap;
-
- return 0;
-}
-
-SUIL_LIB_EXPORT
-SuilWrapper*
-suil_wrapper_new(SuilHost* host,
- const char* host_type_uri,
- const char* ui_type_uri,
- LV2_Feature*** features,
- unsigned n_features)
-{
- /* We have to open libgtk here, so Gtk type symbols are present and will be
- found by the introspection stuff. This is required at least to make
- GtkBuilder use in UIs work, otherwise they will cause "Invalid object
- type" errors.
- */
- if (!host->gtk_lib) {
- dylib_error();
- host->gtk_lib = dylib_open(SUIL_GTK2_LIB_NAME, DYLIB_LAZY | DYLIB_GLOBAL);
- if (!host->gtk_lib) {
- SUIL_ERRORF(
- "Failed to open %s (%s)\n", SUIL_GTK2_LIB_NAME, dylib_error());
- return nullptr;
- }
-
- gtk_init(nullptr, nullptr);
- }
-
- /* Create wrapper implementation. */
- SuilGtk2InQt4Wrapper* const impl =
- (SuilGtk2InQt4Wrapper*)calloc(1, sizeof(SuilGtk2InQt4Wrapper));
-
- /* Set parent widget if given. */
- for (unsigned i = 0; i < n_features; ++i) {
- if (!strcmp((*features)[i]->URI, LV2_UI__parent)) {
- impl->parent = static_cast<QWidget*>((*features)[i]->data);
- }
- }
-
- SuilWrapper* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper));
- wrapper->wrap = wrapper_wrap;
- wrapper->free = wrapper_free;
- wrapper->impl = impl;
-
- return wrapper;
-}
-
-} // extern "C"
diff --git a/src/qt4_in_gtk2.cpp b/src/qt4_in_gtk2.cpp
deleted file mode 100644
index 122b642..0000000
--- a/src/qt4_in_gtk2.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- Copyright 2011-2017 David Robillard <d@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
- copyright notice and this permission notice appear in all copies.
-
- THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-#include "suil_internal.h"
-
-#include <QApplication>
-#include <QVBoxLayout>
-#include <QX11EmbedWidget>
-
-#undef signals
-
-#include <gtk/gtk.h>
-
-extern "C" {
-
-#define SUIL_TYPE_QT_WRAPPER (suil_qt_wrapper_get_type())
-#define SUIL_QT_WRAPPER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), SUIL_TYPE_QT_WRAPPER, SuilQtWrapper))
-
-using SuilQtWrapper = _SuilQtWrapper;
-using SuilQtWrapperClass = _SuilQtWrapperClass;
-
-struct _SuilQtWrapper {
- GtkSocket socket;
- QApplication* app;
- QX11EmbedWidget* qembed;
- SuilWrapper* wrapper;
- SuilInstance* instance;
-};
-
-struct _SuilQtWrapperClass {
- GtkSocketClass parent_class;
-};
-
-GType
-suil_qt_wrapper_get_type(void); // Accessor for SUIL_TYPE_QT_WRAPPER
-
-G_DEFINE_TYPE(SuilQtWrapper, suil_qt_wrapper, GTK_TYPE_SOCKET)
-
-static void
-suil_qt_wrapper_finalize(GObject* gobject)
-{
- SuilQtWrapper* const self = SUIL_QT_WRAPPER(gobject);
-
- if (self->instance->handle) {
- self->instance->descriptor->cleanup(self->instance->handle);
- self->instance->handle = nullptr;
- }
-
- delete self->qembed;
-
- self->qembed = nullptr;
- self->app = nullptr;
- self->wrapper->impl = nullptr;
-
- G_OBJECT_CLASS(suil_qt_wrapper_parent_class)->finalize(gobject);
-}
-
-static void
-suil_qt_wrapper_class_init(SuilQtWrapperClass* klass)
-{
- GObjectClass* const gobject_class = G_OBJECT_CLASS(klass);
-
- gobject_class->finalize = suil_qt_wrapper_finalize;
-}
-
-static void
-suil_qt_wrapper_init(SuilQtWrapper* self)
-{
- self->app = nullptr;
- self->qembed = nullptr;
- self->instance = nullptr;
-}
-
-static void
-suil_qt_wrapper_realize(GtkWidget* w, gpointer data)
-{
- SuilQtWrapper* const wrap = SUIL_QT_WRAPPER(w);
- GtkSocket* const s = GTK_SOCKET(w);
-
- gtk_socket_add_id(s, wrap->qembed->winId());
- wrap->qembed->show();
-}
-
-static int
-wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance)
-{
- SuilQtWrapper* const wrap = SUIL_QT_WRAPPER(wrapper->impl);
-
- wrap->qembed = new QX11EmbedWidget();
- wrap->wrapper = wrapper;
- wrap->instance = instance;
-
- QWidget* qwidget = (QWidget*)instance->ui_widget;
- QVBoxLayout* layout = new QVBoxLayout(wrap->qembed);
- layout->addWidget(qwidget);
-
- qwidget->setParent(wrap->qembed);
-
- g_signal_connect_after(
- G_OBJECT(wrap), "realize", G_CALLBACK(suil_qt_wrapper_realize), nullptr);
-
- instance->host_widget = GTK_WIDGET(wrap);
-
- return 0;
-}
-
-static void
-wrapper_free(SuilWrapper* wrapper)
-{
- if (wrapper->impl) {
- SuilQtWrapper* const wrap = SUIL_QT_WRAPPER(wrapper->impl);
- gtk_object_destroy(GTK_OBJECT(wrap));
- }
-}
-
-SUIL_LIB_EXPORT
-SuilWrapper*
-suil_wrapper_new(SuilHost* host,
- const char* host_type_uri,
- const char* ui_type_uri,
- LV2_Feature*** features,
- unsigned n_features)
-{
- SuilWrapper* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper));
- wrapper->wrap = wrapper_wrap;
- wrapper->free = wrapper_free;
-
- SuilQtWrapper* const wrap =
- SUIL_QT_WRAPPER(g_object_new(SUIL_TYPE_QT_WRAPPER, nullptr));
-
- if (qApp) {
- wrap->app = qApp;
- } else {
- wrap->app = new QApplication(host->argc, host->argv, true);
- }
-
- wrap->wrapper = nullptr;
- wrapper->impl = wrap;
-
- return wrapper;
-}
-
-} // extern "C"
diff --git a/src/x11_in_qt4.cpp b/src/x11_in_qt4.cpp
deleted file mode 100644
index a7de272..0000000
--- a/src/x11_in_qt4.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- Copyright 2011-2015 David Robillard <d@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
- copyright notice and this permission notice appear in all copies.
-
- THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-#include "suil_config.h"
-#include "suil_internal.h"
-
-#include <QX11EmbedContainer>
-#include <QtEvents>
-
-#undef signals
-
-extern "C" {
-
-struct SuilX11InQt4Wrapper {
- QX11EmbedContainer* host_widget;
- QX11EmbedWidget* parent;
-};
-
-class SuilQX11Container : public QX11EmbedContainer
-{
-public:
- SuilQX11Container(SuilInstance* instance,
- const LV2UI_Idle_Interface* idle_iface,
- QX11EmbedWidget* widget)
- : QX11EmbedContainer()
- , _instance(instance)
- , _idle_iface(idle_iface)
- , _widget(widget)
- , _ui_timer(0)
- {}
-
-protected:
- void showEvent(QShowEvent* event)
- {
- if (_idle_iface && _ui_timer == 0) {
- _ui_timer = this->startTimer(30);
- _widget->embedInto(winId());
- resize(_widget->size());
- }
- QX11EmbedContainer::showEvent(event);
- }
-
- void timerEvent(QTimerEvent* event)
- {
- if (event->timerId() == _ui_timer && _idle_iface) {
- _idle_iface->idle(_instance->handle);
- }
- QX11EmbedContainer::timerEvent(event);
- }
-
- void closeEvent(QCloseEvent* event)
- {
- if (_ui_timer && _idle_iface) {
- this->killTimer(_ui_timer);
- _ui_timer = 0;
- }
- QX11EmbedContainer::closeEvent(event);
- }
-
-private:
- SuilInstance* const _instance;
- const LV2UI_Idle_Interface* const _idle_iface;
- QX11EmbedWidget* const _widget;
- int _ui_timer;
-};
-
-static void
-wrapper_free(SuilWrapper* wrapper)
-{
- SuilX11InQt4Wrapper* impl = (SuilX11InQt4Wrapper*)wrapper->impl;
-
- if (impl->parent) {
- delete impl->parent;
- }
-
- if (impl->host_widget) {
- delete impl->host_widget;
- }
-
- free(impl);
-}
-
-static int
-wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance)
-{
- const LV2UI_Idle_Interface* idle_iface = nullptr;
- if (instance->descriptor->extension_data) {
- idle_iface =
- (const LV2UI_Idle_Interface*)instance->descriptor->extension_data(
- LV2_UI__idleInterface);
- }
-
- SuilX11InQt4Wrapper* const impl = (SuilX11InQt4Wrapper*)wrapper->impl;
- QX11EmbedWidget* const ew = impl->parent;
-
- impl->host_widget = new SuilQX11Container(instance, idle_iface, ew);
-
- instance->host_widget = impl->host_widget;
-
- return 0;
-}
-
-static int
-wrapper_resize(LV2UI_Feature_Handle handle, int width, int height)
-{
- QX11EmbedWidget* const ew = (QX11EmbedWidget*)handle;
- ew->resize(width, height);
- return 0;
-}
-
-SUIL_LIB_EXPORT
-SuilWrapper*
-suil_wrapper_new(SuilHost* host,
- const char* host_type_uri,
- const char* ui_type_uri,
- LV2_Feature*** features,
- unsigned n_features)
-{
- SuilX11InQt4Wrapper* const impl =
- (SuilX11InQt4Wrapper*)calloc(1, sizeof(SuilX11InQt4Wrapper));
-
- SuilWrapper* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper));
- wrapper->wrap = wrapper_wrap;
- wrapper->free = wrapper_free;
-
- QX11EmbedWidget* const ew = new QX11EmbedWidget();
-
- impl->parent = ew;
-
- wrapper->impl = impl;
- wrapper->resize.handle = ew;
- wrapper->resize.ui_resize = wrapper_resize;
-
- const intptr_t parent_id = (intptr_t)ew->winId();
- suil_add_feature(features, &n_features, LV2_UI__parent, (void*)parent_id);
- suil_add_feature(features, &n_features, LV2_UI__resize, &wrapper->resize);
- suil_add_feature(features, &n_features, LV2_UI__idleInterface, nullptr);
-
- return wrapper;
-}
-
-} // extern "C"
diff --git a/wscript b/wscript
index 8c2cf3c..4de7e3e 100644
--- a/wscript
+++ b/wscript
@@ -4,7 +4,7 @@ from waflib import Build, Logs, Options, TaskGen
from waflib.extras import autowaf
# Semver package/library version
-SUIL_VERSION = '0.10.10'
+SUIL_VERSION = '0.10.11'
SUIL_MAJOR_VERSION = SUIL_VERSION[0:SUIL_VERSION.find('.')]
# Mandatory waf variables
@@ -38,7 +38,6 @@ def options(ctx):
'no-cocoa': 'do not build support for Cocoa/Quartz',
'no-gtk': 'do not build support for Gtk',
'no-qt': 'do not build support for Qt (any version)',
- 'no-qt4': 'do not build support for Qt4',
'no-qt5': 'do not build support for Qt5',
'no-x11': 'do not build support for X11'})
@@ -148,12 +147,6 @@ def configure(conf):
mandatory=False)
if not conf.options.no_qt:
- if not conf.options.no_qt4:
- conf.check_pkg('QtGui >= 4.4.0',
- uselib_store='QT4',
- system=True,
- mandatory=False)
-
if not conf.options.no_qt5:
conf.check_pkg('Qt5Widgets >= 5.1.0',
uselib_store='QT5',
@@ -183,11 +176,6 @@ def configure(conf):
conf.define('SUIL_GTK2_LIB_NAME', conf.options.gtk2_lib_name)
conf.define('SUIL_GTK3_LIB_NAME', conf.options.gtk3_lib_name)
- if conf.env.HAVE_GTK2 and conf.env.HAVE_QT4:
- enable_module('SUIL_WITH_QT4_IN_GTK2')
- if conf.env.HAVE_GTK2_X11:
- enable_module('SUIL_WITH_GTK2_IN_QT4')
-
if conf.env.HAVE_GTK2 and conf.env.HAVE_QT5:
enable_module('SUIL_WITH_GTK2_IN_QT5')
enable_module('SUIL_WITH_QT5_IN_GTK2')
@@ -207,9 +195,6 @@ def configure(conf):
if conf.env.HAVE_GTK2 and conf.env.DEST_OS == 'win32':
enable_module('SUIL_WITH_WIN_IN_GTK2')
- if conf.env.HAVE_QT4:
- enable_module('SUIL_WITH_X11_IN_QT4')
-
if conf.env.HAVE_QT5 and conf.env.HAVE_QT5_X11:
enable_module('SUIL_WITH_X11_IN_QT5')
@@ -238,15 +223,12 @@ def configure(conf):
# 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'),
('qt5', 'gtk3'),
- ('x11', 'qt4'),
('x11', 'qt5'),
('cocoa', 'qt5')]
for w in wrappers:
@@ -309,17 +291,6 @@ def build(bld):
lib = lib,
uselib = 'LV2')
- if bld.env.SUIL_WITH_GTK2_IN_QT4:
- bld(features = 'cxx cxxshlib',
- source = 'src/gtk2_in_qt4.cpp',
- target = 'suil_gtk2_in_qt4',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cxxflags = cflags,
- lib = modlib,
- uselib = 'GTK2 QT4 LV2')
-
if bld.env.SUIL_WITH_GTK2_IN_QT5:
bld(features = 'cxx cxxshlib',
source = 'src/gtk2_in_qt5.cpp',
@@ -331,18 +302,6 @@ def build(bld):
lib = modlib,
uselib = 'GTK2 QT5 LV2')
- if bld.env.SUIL_WITH_QT4_IN_GTK2:
- bld(features = 'cxx cxxshlib',
- source = 'src/qt4_in_gtk2.cpp',
- target = 'suil_qt4_in_gtk2',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cxxflags = cflags,
- lib = modlib,
- uselib = 'GTK2 QT4 LV2',
- linkflags = bld.env.NODELETE_FLAGS)
-
if bld.env.SUIL_WITH_QT5_IN_GTK2:
bld(features = 'cxx cxxshlib',
source = 'src/qt5_in_gtk.cpp',
@@ -415,17 +374,6 @@ def build(bld):
uselib = 'GTK2 LV2',
linkflags = bld.env.NODELETE_FLAGS)
- if bld.env.SUIL_WITH_X11_IN_QT4:
- bld(features = 'cxx cxxshlib',
- source = 'src/x11_in_qt4.cpp',
- target = 'suil_x11_in_qt4',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'QT4 LV2')
-
if bld.env.SUIL_WITH_X11_IN_QT5:
bld(features = 'cxx cxxshlib',
source = 'src/x11_in_qt5.cpp',