Merge branch 'qt5-vst-2-stable' into fix/qt5-vst

# Conflicts:
#	plugins/vst_base/RemoteVstPlugin.cpp
#	plugins/vst_base/VstPlugin.cpp
This commit is contained in:
Lukas W
2017-09-01 14:18:26 +02:00
12 changed files with 91 additions and 59 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "src/3rdparty/qt5-x11embed"]
path = src/3rdparty/qt5-x11embed
url = https://github.com/Lukas-W/qt5-x11embed.git

View File

@@ -2,11 +2,13 @@
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"

View File

@@ -796,19 +796,6 @@ public:
unlock();
}
void showUI()
{
lock();
sendMessage( IdShowUI );
unlock();
}
void hideUI()
{
lock();
sendMessage( IdHideUI );
unlock();
}
void toggleUI()
{
@@ -841,6 +828,9 @@ public:
m_commMutex.unlock();
}
public slots:
void showUI();
void hideUI();
protected:
inline void setSplittedChannels( bool _on )

View File

@@ -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)

View File

@@ -454,6 +454,15 @@ bool RemoteVstPlugin::processMessage( const message & _m )
{
switch( _m.id )
{
#ifdef LMMS_EMBED_VST_X11
case IdShowUI:
ShowWindow( m_window, SW_SHOWNORMAL );
UpdateWindow( m_window );
break;
#endif
#ifndef LMMS_EMBED_VST
case IdShowUI:
initEditor();
break;
@@ -477,6 +486,7 @@ bool RemoteVstPlugin::processMessage( const message & _m )
sendMessage( message( IdIsUIVisible )
.addInt( m_window ? 1 : 0 ) );
break;
#endif
case IdVstLoadPlugin:
init( _m.getString() );
@@ -667,7 +677,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";
@@ -705,7 +715,10 @@ void RemoteVstPlugin::initEditor()
SWP_NOMOVE | SWP_NOZORDER );
pluginDispatch( effEditTop );
#ifndef LMMS_EMBED_VST_X11
ShowWindow( m_window, SW_SHOWNORMAL );
#endif
#ifdef LMMS_BUILD_LINUX
m_windowID = (intptr_t) GetProp( m_window, "__wine_x11_whole_window" );
#else

View File

@@ -36,6 +36,7 @@
#include <QX11EmbedContainer>
#include <QX11Info>
#else
#include "X11EmbedContainer.h"
#include <QWindow>
#endif
#else
@@ -55,8 +56,7 @@
#include "templates.h"
#include "FileDialog.h"
#if QT_VERSION < 0x050000
#ifdef LMMS_EMBED_VST
class vstSubWin : public QMdiSubWindow
{
public:
@@ -175,8 +175,6 @@ void VstPlugin::tryLoad( const QString &remoteVstPluginExecutable )
}
#ifdef LMMS_EMBED_VST
void VstPlugin::showEditor( QWidget * _parent, bool isEffect )
{
@@ -206,49 +204,47 @@ void VstPlugin::showEditor( QWidget * _parent, bool isEffect )
return;
}
#if QT_VERSION < 0x050000
m_pluginWidget = new QWidget( _parent );
m_pluginWidget->setFixedSize( m_pluginGeometry );
m_pluginWidget->setWindowTitle( name() );
if( _parent == NULL )
{
vstSubWin * sw = new vstSubWin(
gui->mainWindow()->workspace() );
if( isEffect )
{
sw->setAttribute( Qt::WA_TranslucentBackground );
sw->setWindowFlags( Qt::FramelessWindowHint );
sw->setWidget( m_pluginWidget );
QX11EmbedContainer * xe = new QX11EmbedContainer( sw );
xe->embedClient( m_pluginWindowID );
xe->setFixedSize( m_pluginGeometry );
xe->show();
}
else
{
sw->setWindowFlags( Qt::WindowCloseButtonHint );
sw->setWidget( m_pluginWidget );
vstSubWin * sw = new vstSubWin( gui->mainWindow()->workspace() );
//auto sw = new SubWindow();
QX11EmbedContainer * xe = new QX11EmbedContainer( sw );
xe->embedClient( m_pluginWindowID );
xe->setFixedSize( m_pluginGeometry );
xe->move( 4, 24 );
xe->show();
}
}
#ifdef LMMS_EMBED_VST_X11
QX11EmbedContainer * container = new QX11EmbedContainer( sw );
connect(container, SIGNAL(clientIsEmbedded()), this, SLOT(showUI()));
container->embedClient( m_pluginWindowID );
#else
QWindow * window = QWindow::fromWinId( m_pluginWindowID );
m_pluginWidget = QWidget::createWindowContainer( window, _parent,
Qt::Window );
m_pluginWidget->setFixedSize( m_pluginGeometry );
m_pluginWidget->setWindowTitle( name() );
QWindow* vw = QWindow::fromWinId(m_pluginWindowID);
QWidget* container = QWidget::createWindowContainer(vw, sw );
// TODO: Synchronize show
// Tell remote that it is embedded
// Wait for remote reply
#endif
container->setFixedSize( m_pluginGeometry );
container->setWindowTitle( name() );
if( _parent == NULL )
{
m_pluginWidget = container;
sw->setWidget(container);
if( isEffect )
{
sw->setAttribute( Qt::WA_TranslucentBackground );
sw->setWindowFlags( Qt::FramelessWindowHint );
}
else
{
sw->setWindowFlags( Qt::WindowCloseButtonHint );
}
};
#ifdef LMMS_EMBED_VST_X11
#endif
container->setFixedSize( m_pluginGeometry );
#endif
m_pluginWidget->show();
//m_pluginWidget->show();
}
@@ -268,7 +264,7 @@ void VstPlugin::hideEditor()
void VstPlugin::toggleEditor()
{
QWidget * w = m_pluginWidget;
QWidget * w = pluginWidget();
if( w )
{
w->setVisible( !w->isVisible() );

View File

@@ -96,7 +96,7 @@ public:
inline QWidget * pluginWidget( bool _top_widget = true )
{
#if QT_VERSION < 0x050000
#ifdef LMMS_EMBED_VST
if( _top_widget && m_pluginWidget )
{
if( m_pluginWidget->parentWidget() )

8
src/3rdparty/CMakeLists.txt vendored Normal file
View File

@@ -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()

1
src/3rdparty/qt5-x11embed vendored Submodule

View File

@@ -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)
@@ -132,7 +133,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}

View File

@@ -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();
}

View File

@@ -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() );