diff options
-rw-r--r-- | src/gtk2_in_qt5.cpp | 15 | ||||
-rw-r--r-- | src/x11_in_qt4.cpp | 10 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/gtk2_in_qt5.cpp b/src/gtk2_in_qt5.cpp index 6ebb8c7..e97f4a0 100644 --- a/src/gtk2_in_qt5.cpp +++ b/src/gtk2_in_qt5.cpp @@ -33,7 +33,7 @@ typedef struct _SuilGtk2InQt5Wrapper SuilGtk2InQt5Wrapper; struct _SuilGtk2InQt5Wrapper { QWidget* host_widget; - QWidget* parent; + QWindow* window; GtkWidget* plug; }; @@ -60,6 +60,11 @@ wrapper_free(SuilWrapper* wrapper) { SuilGtk2InQt5Wrapper* impl = (SuilGtk2InQt5Wrapper*)wrapper->impl; + if (impl->window) { + impl->window->setParent(NULL); + delete impl->window; + } + if (impl->plug) { gtk_widget_destroy(impl->plug); } @@ -107,6 +112,7 @@ wrapper_wrap(SuilWrapper* wrapper, G_OBJECT(plug), "size-allocate", G_CALLBACK(on_size_allocate), wrap); impl->host_widget = wrap; + impl->window = window; impl->plug = plug; instance->host_widget = wrap; @@ -141,13 +147,6 @@ suil_wrapper_new(SuilHost* host, SuilGtk2InQt5Wrapper* const impl = (SuilGtk2InQt5Wrapper*) calloc(1, sizeof(SuilGtk2InQt5Wrapper)); - /* 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; diff --git a/src/x11_in_qt4.cpp b/src/x11_in_qt4.cpp index dd96300..107a4bd 100644 --- a/src/x11_in_qt4.cpp +++ b/src/x11_in_qt4.cpp @@ -41,6 +41,7 @@ public: , _ui_timer(0) {} +protected: void showEvent(QShowEvent* event) { if (_idle_iface && _ui_timer == 0) { _ui_timer = this->startTimer(30); @@ -57,6 +58,15 @@ public: 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; |