| 622 | } |
| 623 | |
| 624 | void VstPlugin::createUI( QWidget * parent ) |
| 625 | { |
| 626 | if ( m_pluginWidget ) { |
| 627 | qWarning() << "VstPlugin::createUI called twice"; |
| 628 | m_pluginWidget->setParent( parent ); |
| 629 | return; |
| 630 | } |
| 631 | |
| 632 | if( m_pluginWindowID == 0 ) |
| 633 | { |
| 634 | return; |
| 635 | } |
| 636 | |
| 637 | QWidget* container = nullptr; |
| 638 | |
| 639 | #if QT_VERSION >= 0x050100 |
| 640 | if (m_embedMethod == "qt" ) |
| 641 | { |
| 642 | QWindow* vw = QWindow::fromWinId(m_pluginWindowID); |
| 643 | container = QWidget::createWindowContainer(vw, parent ); |
| 644 | container->installEventFilter(this); |
| 645 | } else |
| 646 | #endif |
| 647 | |
| 648 | #ifdef LMMS_BUILD_WIN32 |
| 649 | if (m_embedMethod == "win32" ) |
| 650 | { |
| 651 | QWidget * helper = new QWidget; |
| 652 | QHBoxLayout * l = new QHBoxLayout( helper ); |
| 653 | QWidget * target = new QWidget( helper ); |
| 654 | l->setSpacing( 0 ); |
| 655 | l->setMargin( 0 ); |
| 656 | l->addWidget( target ); |
| 657 | |
| 658 | // we've to call that for making sure, Qt created the windows |
| 659 | helper->winId(); |
| 660 | HWND targetHandle = (HWND)target->winId(); |
| 661 | HWND pluginHandle = (HWND)(intptr_t)m_pluginWindowID; |
| 662 | |
| 663 | DWORD style = GetWindowLong(pluginHandle, GWL_STYLE); |
| 664 | style = style & ~(WS_POPUP); |
| 665 | style = style | WS_CHILD; |
| 666 | SetWindowLong(pluginHandle, GWL_STYLE, style); |
| 667 | SetParent(pluginHandle, targetHandle); |
| 668 | |
| 669 | DWORD threadId = GetWindowThreadProcessId(pluginHandle, NULL); |
| 670 | DWORD currentThreadId = GetCurrentThreadId(); |
| 671 | AttachThreadInput(currentThreadId, threadId, true); |
| 672 | |
| 673 | container = helper; |
| 674 | RemotePlugin::showUI(); |
| 675 | |
| 676 | } else |
| 677 | #endif |
| 678 | |
| 679 | #ifdef LMMS_BUILD_LINUX |
| 680 | if (m_embedMethod == "xembed" ) |
| 681 | { |
no outgoing calls
no test coverage detected