summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-09-17 03:44:00 +0000
committerDavid Robillard <d@drobilla.net>2013-09-17 03:44:00 +0000
commit7febc273b7f7a3d22558ad68dc934fe036b5a441 (patch)
tree730465ee561d984d4da0d0d92a1d1c0bd6286463
parent6bc70c7785f5c95a32a210ee1f2cddf0e46cb4a5 (diff)
downloadsuil-7febc273b7f7a3d22558ad68dc934fe036b5a441.tar.gz
suil-7febc273b7f7a3d22558ad68dc934fe036b5a441.tar.bz2
suil-7febc273b7f7a3d22558ad68dc934fe036b5a441.zip
Fix crashes and resizing for X11 in Qt (patch from Rui Nuno Capela).
git-svn-id: http://svn.drobilla.net/lad/trunk/suil@5159 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--AUTHORS2
-rw-r--r--NEWS3
-rw-r--r--src/x11_in_qt4.cpp41
3 files changed, 40 insertions, 6 deletions
diff --git a/AUTHORS b/AUTHORS
index 9a3a56b..ab865a1 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -10,3 +10,5 @@ Contributors:
* Idle interface fixes for X11 in Qt4
* Robin Gareus <robin@gareus.org>
* Support for resizing X11 UIs in Gtk
+ * Rui Nuno Capela
+ * Fixes for X11 in Qt4 \ No newline at end of file
diff --git a/NEWS b/NEWS
index 6235c2f..795c096 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,9 @@
suil (0.6.15) unstable;
* Fix suil_instance_extension_data() for UIs with NULL extension_data
+ * Fix crashes and resizing for X11 in Qt (patch from Rui Nuno Capela)
- -- David Robillard <d@drobilla.net> Fri, 09 Aug 2013 20:41:20 -0400
+ -- David Robillard <d@drobilla.net> Mon, 16 Sep 2013 23:41:12 -0400
suil (0.6.14) stable;
diff --git a/src/x11_in_qt4.cpp b/src/x11_in_qt4.cpp
index ee55207..338ae12 100644
--- a/src/x11_in_qt4.cpp
+++ b/src/x11_in_qt4.cpp
@@ -27,6 +27,11 @@ typedef struct _LV2UI_Idle_Interface LV2UI_Idle_Interface;
extern "C" {
+typedef struct {
+ QX11EmbedContainer* host_widget;
+ QX11EmbedWidget* parent;
+} SuilX11InQt4Wrapper;
+
class SuilQX11Container : public QX11EmbedContainer
{
public:
@@ -45,6 +50,7 @@ public:
if (_idle_iface && _ui_timer == 0) {
_ui_timer = this->startTimer(30);
_widget->embedInto(winId());
+ resize(_widget->size());
}
QX11EmbedContainer::showEvent(event);
}
@@ -63,6 +69,22 @@ public:
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)
@@ -73,10 +95,12 @@ wrapper_wrap(SuilWrapper* wrapper,
instance, LV2_UI__idleInterface);
#endif
- QX11EmbedWidget* const w = (QX11EmbedWidget*)wrapper->impl;
- SuilQX11Container* const c = new SuilQX11Container(instance, idle_iface, w);
+ SuilX11InQt4Wrapper* const impl = (SuilX11InQt4Wrapper*)wrapper->impl;
+ QX11EmbedWidget* const ew = impl->parent;
- instance->host_widget = c;
+ impl->host_widget = new SuilQX11Container(instance, idle_iface, ew);
+
+ instance->host_widget = impl->host_widget;
return 0;
}
@@ -97,13 +121,20 @@ suil_wrapper_new(SuilHost* host,
LV2_Feature*** features,
unsigned n_features)
{
+ SuilX11InQt4Wrapper* const impl = (SuilX11InQt4Wrapper*)
+ malloc(sizeof(SuilX11InQt4Wrapper));
+ impl->host_widget = NULL;
+ impl->parent = NULL;
+
SuilWrapper* wrapper = (SuilWrapper*)malloc(sizeof(SuilWrapper));
wrapper->wrap = wrapper_wrap;
- wrapper->free = NULL;
+ wrapper->free = wrapper_free;
QX11EmbedWidget* const ew = new QX11EmbedWidget();
- wrapper->impl = ew;
+ impl->parent = ew;
+
+ wrapper->impl = impl;
wrapper->resize.handle = ew;
wrapper->resize.ui_resize = wrapper_resize;