Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
a81f4ca
Embed VST GUI in subwindow
Jun 17, 2016
878dd94
Embed in a separate window
Oct 2, 2016
ebe63d1
Fixes for Windows builds
Jan 2, 2017
6395cd4
Enable C++11
Jan 3, 2017
e3d3052
Enable C++11 on Windows
Jan 4, 2017
12f6ea5
C++11 is enabled by default now
Jan 24, 2017
f87f363
Use window instead of embedder application
Mar 31, 2017
2d35de4
Debug window ID
Apr 1, 2017
d04fd9f
FluidSynth is currently undistributable
Apr 10, 2017
7a9396d
Let Wine handle the window interface
Apr 10, 2017
47d0e66
Re-enable SF2
tresf Apr 10, 2017
e661d26
Add X11EmbedContainer Qt5 port
lukas-w Apr 1, 2017
adef05f
X11EmbedContainer: Fix XEMBED protocol implementation
lukas-w Apr 8, 2017
f097be6
RemoteVst: Fix flickering when moving window
lukas-w Apr 8, 2017
0e311ff
X11Embed: Remove flag causing embedding to fail
lukas-w Apr 8, 2017
8fdcc6c
Fix compile on Windows
lukas-w Apr 8, 2017
7ce60c2
Travis: Add missing packages
lukas-w Apr 8, 2017
dc4a387
X11EmbedContainer: Don't grab mouse in acceptClient, more debugging msgs
lukas-w Jul 15, 2017
000fe2d
Travis: Fix xcb package name
lukas-w Jul 16, 2017
d9626e9
Move X11EmbedContainer.h to include
lukas-w Jul 19, 2017
def2b7d
Move X11EmbedContainer to submodule
lukas-w Aug 5, 2017
0d3aaf6
.gitmodules: Use https URL
lukas-w Aug 5, 2017
bd33475
Fix x11embed for non qt5+linux
lukas-w Aug 5, 2017
f7dab93
Merge branch 'qt5-vst-2-stable' into fix/qt5-vst
lukas-w Sep 1, 2017
ddab534
Allow switching VST embed method at compile time
lukas-w Sep 1, 2017
e7d0675
Fix Qt4 VST embed option
lukas-w Sep 1, 2017
df37833
Merge branch 'stable-1.2' into fix/qt5-vst
lukas-w Sep 22, 2017
ffa1b63
Fix VST effects embedding
lukas-w Sep 22, 2017
6839746
VstEmbed: Allow selecting method at runtime
lukas-w Nov 6, 2017
415316f
VstEmbed: Remove obsolete CMake flags
lukas-w Nov 6, 2017
134dae8
VstEmbed: Add missing find_package instruction for Qt5X11Extras
lukas-w Nov 6, 2017
472a74d
Minor fixes
lukas-w Nov 6, 2017
e95fdcc
Add missing includes
lukas-w Nov 6, 2017
421a85d
Update qt5-x11embed submodule
lukas-w Nov 6, 2017
e3ba9ba
Update qt5-x11embed submodule for CMake changes
lukas-w Nov 6, 2017
6eb447d
Merge branch 'stable-1.2' into fix/qt5-vst
lukas-w Nov 7, 2017
2b6f366
CMake: Only link qx11embedcontainer on Linux
lukas-w Nov 7, 2017
6fd38fe
Fix qt5-x11embed submodule reference
lukas-w Nov 7, 2017
a8311a7
Vst: Fix widget deletion
lukas-w Nov 10, 2017
f9f4d0c
VstEmbed: Store embed method on plugin start
lukas-w Nov 10, 2017
358a251
VstEmbed: Support changing embed method without restart
lukas-w Nov 10, 2017
df3c07b
Fix Qt4 compatibility
PhysSong Nov 6, 2017
b0f64de
Restrict "qt" embed method to Qt5 only
PhysSong Nov 6, 2017
7da7a70
Add Win32 embedding
PhysSong Nov 7, 2017
463d02e
Move SC_CLOSE handling code
PhysSong Nov 8, 2017
55ce90e
Try to improve embedding method logic
PhysSong Nov 18, 2017
72e882a
Add a fallback logic for VST embedding methods
PhysSong Nov 20, 2017
a8aa3e1
VST: Fix Qt4 compilation
lukas-w Nov 24, 2017
3d47344
Travis: Enable Linux/Qt4 builds
lukas-w Nov 24, 2017
e95e379
Merge pull request #3991 from PhysSong/fix/qt5-vst
lukas-w Nov 24, 2017
23cb385
VstEmbed: Remove obsolete CMake flags
lukas-w Nov 24, 2017
7019cab
Merge branch 'stable-1.2' into fix/qt5-vst
lukas-w Nov 25, 2017
238d6b6
CMake: Fix RemoteVstPlugin build when winebuild is not in PATH
lukas-w Nov 25, 2017
8c02495
Qt4 compat simplified
lukas-w Nov 25, 2017
ae488b8
Fix VstEffect width issue
lukas-w Nov 29, 2017
a446775
VST: Fix Qt-embedded VSTs not always appearing
lukas-w Nov 29, 2017
7ae348e
Vst refactorings
lukas-w Nov 29, 2017
19f4889
VST: Disable plugin reload on embed method change
lukas-w Dec 18, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Let Wine handle the window interface
  • Loading branch information
Javier Serrano Polo authored and lukas-w committed Sep 1, 2017
commit 7a9396d6ea53ff12dc857b06b54bc75256560fdd
10 changes: 10 additions & 0 deletions include/RemotePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ enum RemoteMessageIDs
IdShowUI,
IdHideUI,
IdToggleUI,
IdIsUIVisible,
IdSaveSettingsToString,
IdSaveSettingsToFile,
IdLoadSettingsFromString,
Expand Down Expand Up @@ -816,6 +817,15 @@ class EXPORT RemotePlugin : public QObject, public RemotePluginBase
unlock();
}

int isUIVisible()
{
lock();
sendMessage( IdIsUIVisible );
unlock();
message m = waitForMessage( IdIsUIVisible );
return m.id != IdIsUIVisible ? -1 : m.getInt() ? 1 : 0;
}

inline bool failed() const
{
return m_failed;
Expand Down
28 changes: 27 additions & 1 deletion plugins/VstEffect/VstEffectControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@

VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
EffectControlDialog( _ctl ),
#ifdef LMMS_EMBED_VST
m_pluginWidget( NULL ),
#endif
m_plugin( NULL ),
tbLabel( NULL )
{
Expand All @@ -56,6 +58,7 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
_ctl->m_effect->m_plugin != NULL )
{
m_plugin = _ctl->m_effect->m_plugin;
#ifdef LMMS_EMBED_VST
m_plugin->showEditor( NULL, true );
m_pluginWidget = m_plugin->pluginWidget();

Expand All @@ -66,18 +69,31 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
m_pluginWidget = m_plugin->pluginWidget( false );
}
#endif

#else // LMMS_EMBED_VST
m_plugin->showUI();
#endif
}

#ifdef LMMS_EMBED_VST
if( m_pluginWidget )
#else
if( m_plugin )
#endif
{
setWindowTitle( m_pluginWidget->windowTitle() );
setWindowTitle( m_plugin->name() );
setMinimumWidth( 250 );

QPushButton * btn = new QPushButton( tr( "Show/hide" ) );
#ifdef LMMS_EMBED_VST
btn->setCheckable( true );
connect( btn, SIGNAL( toggled( bool ) ),
SLOT( togglePluginUI( bool ) ) );
emit btn->click();
#else
connect( btn, SIGNAL( clicked( bool ) ),
SLOT( togglePluginUI( bool ) ) );
#endif

btn->setMinimumWidth( 78 );
btn->setMaximumWidth( 78 );
Expand Down Expand Up @@ -206,8 +222,12 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
m_savePresetButton->setMinimumHeight( 21 );
m_savePresetButton->setMaximumHeight( 21 );

#ifdef LMMS_EMBED_VST
int newSize = m_pluginWidget->width() + 20;
newSize = (newSize < 250) ? 250 : newSize;
#else
int newSize = 250;
#endif
QWidget* resize = new QWidget(this);
resize->resize( newSize, 10 );
QWidget* space0 = new QWidget(this);
Expand All @@ -219,8 +239,10 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
l->addItem( new QSpacerItem( newSize - 20, 30, QSizePolicy::Fixed,
QSizePolicy::Fixed ), 1, 0 );
l->addWidget( resize, 2, 0, 1, 1, Qt::AlignCenter );
#ifdef LMMS_EMBED_VST
#if QT_VERSION < 0x050000
l->addWidget( m_pluginWidget, 3, 0, 1, 1, Qt::AlignCenter );
#endif
#endif
l->setRowStretch( 5, 1 );
l->setColumnStretch( 1, 1 );
Expand Down Expand Up @@ -273,6 +295,7 @@ void VstEffectControlDialog::togglePluginUI( bool checked )
{
if( m_plugin )
{
#ifdef LMMS_EMBED_VST
if( checked )
{
m_plugin->showEditor( NULL, true );
Expand All @@ -281,6 +304,9 @@ void VstEffectControlDialog::togglePluginUI( bool checked )
{
m_plugin->hideEditor();
}
#else
m_plugin->toggleUI();
#endif
}
}

2 changes: 2 additions & 0 deletions plugins/VstEffect/VstEffectControlDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class VstEffectControlDialog : public EffectControlDialog
virtual void paintEvent( QPaintEvent * _pe );

private:
#ifdef LMMS_EMBED_VST
QWidget * m_pluginWidget;
#endif

PixmapButton * m_openPresetButton;
PixmapButton * m_rolLPresetButton;
Expand Down
8 changes: 8 additions & 0 deletions plugins/vestige/vestige.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,11 @@ void vestigeInstrument::loadFile( const QString & _file )
return;
}

#ifdef LMMS_EMBED_VST
m_plugin->showEditor( NULL, false );
#else
m_plugin->showUI();
#endif

if( set_ch_name )
{
Expand Down Expand Up @@ -735,7 +739,11 @@ void VestigeInstrumentView::toggleGUI( void )
{
return;
}
#ifdef LMMS_EMBED_VST
m_vi->m_plugin->toggleEditor();
#else
m_vi->m_plugin->toggleUI();
#endif
}


Expand Down
32 changes: 17 additions & 15 deletions plugins/vst_base/RemoteVstPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@
#define USE_WS_PREFIX
#include <windows.h>

#if defined(LMMS_BUILD_WIN32) || defined(LMMS_BUILD_WIN64)
#include "basename.c"
#else
#include <libgen.h>
#endif


#include <vector>
#include <string>

Expand Down Expand Up @@ -100,7 +93,6 @@ struct ERect
#ifndef USE_QT_SHMEM
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
Expand Down Expand Up @@ -341,7 +333,6 @@ RemoteVstPlugin::RemoteVstPlugin( key_t _shm_in, key_t _shm_out ) :
RemoteVstPlugin::RemoteVstPlugin( const char * socketPath ) :
RemotePluginClient( socketPath ),
#endif
m_shortName( "" ),
m_libInst( NULL ),
m_plugin( NULL ),
m_window( NULL ),
Expand Down Expand Up @@ -482,6 +473,11 @@ bool RemoteVstPlugin::processMessage( const message & _m )
}
break;

case IdIsUIVisible:
sendMessage( message( IdIsUIVisible )
.addInt( m_window ? 1 : 0 ) );
break;

case IdVstLoadPlugin:
init( _m.getString() );
break;
Expand Down Expand Up @@ -682,8 +678,12 @@ void RemoteVstPlugin::initEditor()
m_registeredWindowClass = true;
}

m_window = CreateWindowEx( 0, "LVSL", m_shortName.c_str(),
m_window = CreateWindowEx( 0, "LVSL", pluginName(),
#ifdef LMMS_EMBED_VST
WS_POPUP | WS_SYSMENU | WS_BORDER,
#else
WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX,
#endif
0, 0, 10, 10, NULL, NULL, hInst, NULL );
if( m_window == NULL )
{
Expand All @@ -708,7 +708,6 @@ void RemoteVstPlugin::initEditor()
ShowWindow( m_window, SW_SHOWNORMAL );
#ifdef LMMS_BUILD_LINUX
m_windowID = (intptr_t) GetProp( m_window, "__wine_x11_whole_window" );
fprintf(stderr, "m_windowID %x\n", m_windowID);
#else
// 64-bit versions of Windows use 32-bit handles for interoperability
m_windowID = (intptr_t) m_window;
Expand Down Expand Up @@ -746,10 +745,6 @@ bool RemoteVstPlugin::load( const std::string & _plugin_file )
return false;
}

char * tmp = strdup( _plugin_file.c_str() );
m_shortName = basename( tmp );
free( tmp );

typedef AEffect * ( __stdcall * mainEntryPointer )
( audioMasterCallback );
mainEntryPointer mainEntry = (mainEntryPointer)
Expand Down Expand Up @@ -1843,6 +1838,13 @@ DWORD WINAPI RemoteVstPlugin::guiEventLoop( LPVOID _param )
while( quit == false && GetMessage( &msg, NULL, 0, 0 ) )
{
TranslateMessage( &msg );

if( msg.message == WM_SYSCOMMAND && msg.wParam == SC_CLOSE )
{
_this->destroyEditor();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukas-w When I merged this to my local branch(up-to-date stable-1.2) it fails to build. The failure is because of fe98a9a by @DomClark. It seems to work after I change _this to __plugin, but I'm not sure this is the right way...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously _this was passed as an argument to guiEventLoop, but after I moved the window message handling code to messageWndProc, there was no need for it any more so I removed it. Using __plugin is safe here, and has the same value _this would have done, so the change is correct, but this code may well be better off with all the other message handling code in messageWndProc. I have no experience with Linux programming, so I may well be wrong, but on Windows other modal loops can be run, e.g. by modal dialogs or window drag-resizing, in which case the messages are still sent to the WindowProc but will not be picked up by code in the main modal loop. This could lead to your message being missed if it is dispatched while a different loop is currently in control, unless the code is moved over.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DomClark Thanks for explanation. 👍

continue;
}

DispatchMessage( &msg );

if( msg.message == WM_TIMER && _this->isInitialized() )
Expand Down
23 changes: 21 additions & 2 deletions plugins/vst_base/VstPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ void VstPlugin::tryLoad( const QString &remoteVstPluginExecutable )



#ifdef LMMS_EMBED_VST
void VstPlugin::showEditor( QWidget * _parent, bool isEffect )
{
QWidget * w = pluginWidget();
Expand Down Expand Up @@ -237,8 +238,6 @@ void VstPlugin::showEditor( QWidget * _parent, bool isEffect )
}
#else
QWindow * window = QWindow::fromWinId( m_pluginWindowID );
fprintf(stderr, "m_pluginWindowID %x\n", m_pluginWindowID);
fprintf(stderr, "window %p\n", window);
m_pluginWidget = QWidget::createWindowContainer( window, _parent,
Qt::Window );
m_pluginWidget->setFixedSize( m_pluginGeometry );
Expand Down Expand Up @@ -275,12 +274,14 @@ void VstPlugin::toggleEditor()
w->setVisible( !w->isVisible() );
}
}
#endif




void VstPlugin::loadSettings( const QDomElement & _this )
{
#ifdef LMMS_EMBED_VST
if( pluginWidget() != NULL )
{
if( _this.attribute( "guivisible" ).toInt() )
Expand All @@ -292,6 +293,16 @@ void VstPlugin::loadSettings( const QDomElement & _this )
hideEditor();
}
}
#else
if( _this.attribute( "guivisible" ).toInt() )
{
showUI();
}
else
{
hideUI();
}
#endif

const int num_params = _this.attribute( "numparams" ).toInt();
// if it exists try to load settings chunk
Expand Down Expand Up @@ -324,10 +335,18 @@ void VstPlugin::loadSettings( const QDomElement & _this )

void VstPlugin::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
#ifdef LMMS_EMBED_VST
if( pluginWidget() != NULL )
{
_this.setAttribute( "guivisible", pluginWidget()->isVisible() );
}
#else
int visible = isUIVisible();
if ( visible != -1 )
{
_this.setAttribute( "guivisible", visible );
}
#endif

// try to save all settings in a chunk
QByteArray chunk = saveChunk();
Expand Down
2 changes: 2 additions & 0 deletions plugins/vst_base/VstPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ class PLUGIN_EXPORT VstPlugin : public RemotePlugin, public JournallingObject
return m_pluginWindowID != 0;
}

#ifdef LMMS_EMBED_VST
void showEditor( QWidget * _parent = NULL, bool isEffect = false );
void hideEditor();
void toggleEditor();
#endif

inline const QString & name() const
{
Expand Down
Loading