diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..a81bc81747b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "src/3rdparty/qt5-x11embed"] + path = src/3rdparty/qt5-x11embed + url = https://github.com/Lukas-W/qt5-x11embed.git diff --git a/.travis/linux..install.sh b/.travis/linux..install.sh index 8abf83c24cb..1d3c05ce254 100755 --- a/.travis/linux..install.sh +++ b/.travis/linux..install.sh @@ -4,11 +4,13 @@ set -e PACKAGES="cmake libsndfile-dev fftw3-dev libvorbis-dev libogg-dev libmp3lame-dev libasound2-dev libjack-dev libsdl-dev libsamplerate0-dev libstk0-dev - libfluidsynth-dev portaudio19-dev wine-dev g++-multilib libfltk1.3-dev + libfluidsynth-dev portaudio19-dev g++-multilib libfltk1.3-dev libgig-dev libsoundio-dev" +VST_PACKAGES="wine-dev libqt5x11extras5-dev qtbase5-private-dev libxcb-util0-dev libxcb-keysyms1-dev" + # Help with unmet dependencies -PACKAGES="$PACKAGES libjack0" +PACKAGES="$PACKAGES $VST_PACKAGES libjack0" if [ "$QT5" ]; then PACKAGES="$PACKAGES qtbase5-dev qttools5-dev-tools qttools5-dev" diff --git a/include/RemotePlugin.h b/include/RemotePlugin.h index d016c5acd21..977f041a50c 100644 --- a/include/RemotePlugin.h +++ b/include/RemotePlugin.h @@ -787,19 +787,6 @@ class EXPORT RemotePlugin : public QObject, public RemotePluginBase unlock(); } - void showUI() - { - lock(); - sendMessage( IdShowUI ); - unlock(); - } - - void hideUI() - { - lock(); - sendMessage( IdHideUI ); - unlock(); - } inline bool failed() const { @@ -816,6 +803,9 @@ class EXPORT RemotePlugin : public QObject, public RemotePluginBase m_commMutex.unlock(); } +public slots: + void showUI(); + void hideUI(); protected: inline void setSplittedChannels( bool _on ) diff --git a/plugins/vst_base/CMakeLists.txt b/plugins/vst_base/CMakeLists.txt index 0bd4fe0e1c5..ef90843600b 100644 --- a/plugins/vst_base/CMakeLists.txt +++ b/plugins/vst_base/CMakeLists.txt @@ -28,6 +28,7 @@ SET(REMOTE_VST_PLUGIN_FILEPATH "RemoteVstPlugin" CACHE STRING "Relative file pat ADD_DEFINITIONS(-DREMOTE_VST_PLUGIN_FILEPATH="${REMOTE_VST_PLUGIN_FILEPATH}") BUILD_PLUGIN(vstbase vst_base.cpp VstPlugin.cpp VstPlugin.h communication.h MOCFILES VstPlugin.h) +TARGET_LINK_LIBRARIES(vstbase qx11embedcontainer) IF(LMMS_BUILD_LINUX AND NOT WANT_VST_NOWINE) diff --git a/plugins/vst_base/RemoteVstPlugin.cpp b/plugins/vst_base/RemoteVstPlugin.cpp index 03e160a8dd7..15be00606c4 100644 --- a/plugins/vst_base/RemoteVstPlugin.cpp +++ b/plugins/vst_base/RemoteVstPlugin.cpp @@ -556,6 +556,11 @@ bool RemoteVstPlugin::processMessage( const message & _m ) break; } + case IdShowUI: + ShowWindow( m_window, SW_SHOWNORMAL ); + UpdateWindow( m_window ); + break; + default: return RemotePluginClient::processMessage( _m ); } @@ -643,7 +648,7 @@ void RemoteVstPlugin::initEditor() wc.hInstance = hInst; wc.hIcon = LoadIcon( NULL, IDI_APPLICATION ); wc.hCursor = LoadCursor( NULL, IDC_ARROW ); - wc.hbrBackground = (HBRUSH) GetStockObject( BLACK_BRUSH ); + wc.hbrBackground = NULL; wc.lpszMenuName = NULL; wc.lpszClassName = "LVSL"; @@ -687,9 +692,6 @@ void RemoteVstPlugin::initEditor() SWP_NOMOVE | SWP_NOZORDER ); pluginDispatch( effEditTop ); - ShowWindow( m_window, SW_SHOWNORMAL ); - UpdateWindow( m_window ); - #ifdef LMMS_BUILD_LINUX m_windowID = (intptr_t) GetProp( m_window, "__wine_x11_whole_window" ); #endif diff --git a/plugins/vst_base/VstPlugin.cpp b/plugins/vst_base/VstPlugin.cpp index 22c9f7c20e6..514146c0982 100644 --- a/plugins/vst_base/VstPlugin.cpp +++ b/plugins/vst_base/VstPlugin.cpp @@ -32,10 +32,7 @@ #include #include #ifdef LMMS_BUILD_LINUX -#if QT_VERSION < 0x050000 -#include -#include -#endif +#include "X11EmbedContainer.h" #else #include #endif @@ -232,39 +229,31 @@ void VstPlugin::showEditor( QWidget * _parent, bool isEffect ) return; } - m_pluginWidget = new QWidget( _parent ); + vstSubWin * sw = new vstSubWin( gui->mainWindow()->workspace() ); + + QX11EmbedContainer * xe = new QX11EmbedContainer(sw); + m_pluginWidget = xe; m_pluginWidget->setFixedSize( m_pluginGeometry ); m_pluginWidget->setWindowTitle( name() ); + + connect(xe, SIGNAL(clientIsEmbedded()), this, SLOT(showUI())); + if( _parent == NULL ) { - vstSubWin * sw = new vstSubWin( - gui->mainWindow()->workspace() ); + sw->setWidget( m_pluginWidget ); + if( isEffect ) { sw->setAttribute( Qt::WA_TranslucentBackground ); sw->setWindowFlags( Qt::FramelessWindowHint ); - sw->setWidget( m_pluginWidget ); -#if QT_VERSION < 0x050000 - QX11EmbedContainer * xe = new QX11EmbedContainer( sw ); - xe->embedClient( m_pluginWindowID ); - xe->setFixedSize( m_pluginGeometry ); - xe->show(); -#endif - } + } else { sw->setWindowFlags( Qt::WindowCloseButtonHint ); - sw->setWidget( m_pluginWidget ); - -#if QT_VERSION < 0x050000 - QX11EmbedContainer * xe = new QX11EmbedContainer( sw ); - xe->embedClient( m_pluginWindowID ); - xe->setFixedSize( m_pluginGeometry ); - xe->move( 4, 24 ); - xe->show(); -#endif } } + xe->embedClient( m_pluginWindowID ); + xe->setFixedSize( m_pluginGeometry ); #endif diff --git a/src/3rdparty/CMakeLists.txt b/src/3rdparty/CMakeLists.txt new file mode 100644 index 00000000000..f1d7a9ba1a5 --- /dev/null +++ b/src/3rdparty/CMakeLists.txt @@ -0,0 +1,8 @@ +include(ExternalProject) + +IF(QT5 AND LMMS_BUILD_LINUX) + set(BUILD_SHARED_LIBS OFF) + add_subdirectory(qt5-x11embed) +ELSE() + add_library(qx11embedcontainer STATIC /dev/null) +ENDIF() diff --git a/src/3rdparty/qt5-x11embed b/src/3rdparty/qt5-x11embed new file mode 160000 index 00000000000..dad35c07cdb --- /dev/null +++ b/src/3rdparty/qt5-x11embed @@ -0,0 +1 @@ +Subproject commit dad35c07cdb704f3e9306e6301f7eb4c098552a2 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3d9093c4b72..e521d8cb5fd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,6 +14,7 @@ IF(LMMS_BUILD_APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") ENDIF() +ADD_SUBDIRECTORY(3rdparty) ADD_SUBDIRECTORY(core) ADD_SUBDIRECTORY(gui) ADD_SUBDIRECTORY(tracks) @@ -129,7 +130,7 @@ IF(LMMS_BUILD_HAIKU) SET(EXTRA_LIBRARIES "-lnetwork") ENDIF() -SET(LMMS_REQUIRED_LIBS +SET(LMMS_REQUIRED_LIBS ${LMMS_REQUIRED_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES} ${ASOUND_LIBRARY} diff --git a/src/core/RemotePlugin.cpp b/src/core/RemotePlugin.cpp index bb7e39c6afd..064d77b2c33 100644 --- a/src/core/RemotePlugin.cpp +++ b/src/core/RemotePlugin.cpp @@ -392,6 +392,20 @@ void RemotePlugin::processMidiEvent( const MidiEvent & _e, unlock(); } +void RemotePlugin::showUI() +{ + lock(); + sendMessage( IdShowUI ); + unlock(); +} + +void RemotePlugin::hideUI() +{ + lock(); + sendMessage( IdHideUI ); + unlock(); +} + diff --git a/src/gui/SubWindow.cpp b/src/gui/SubWindow.cpp index e92c4cbcbc7..284e116d808 100644 --- a/src/gui/SubWindow.cpp +++ b/src/gui/SubWindow.cpp @@ -97,7 +97,10 @@ void SubWindow::paintEvent( QPaintEvent * ) { QPainter p( this ); QRect rect( 0, 0, width(), m_titleBarHeight ); - bool isActive = SubWindow::mdiArea()->activeSubWindow() == this; + + bool isActive = mdiArea() + ? mdiArea()->activeSubWindow() == this + : false; p.fillRect( rect, isActive ? activeColor() : p.pen().brush() );