@@ -134,6 +134,8 @@ class RemoteVstPlugin : public RemotePluginClient
134
134
135
135
void init ( const std::string & _plugin_file );
136
136
void initEditor ();
137
+ void showEditor ();
138
+ void hideEditor ();
137
139
void destroyEditor ();
138
140
139
141
virtual void process ( const sampleFrame * _in, sampleFrame * _out );
@@ -507,27 +509,28 @@ bool RemoteVstPlugin::processMessage( const message & _m )
507
509
switch ( _m.id )
508
510
{
509
511
case IdShowUI:
510
- initEditor ();
512
+ showEditor ();
511
513
return true ;
512
514
513
515
case IdHideUI:
514
- destroyEditor ();
516
+ hideEditor ();
515
517
return true ;
516
518
517
519
case IdToggleUI:
518
- if ( m_window )
520
+ if ( m_window && IsWindowVisible ( m_window ) )
519
521
{
520
- destroyEditor ();
522
+ hideEditor ();
521
523
}
522
524
else
523
525
{
524
- initEditor ();
526
+ showEditor ();
525
527
}
526
528
return true ;
527
529
528
530
case IdIsUIVisible:
531
+ bool visible = m_window && IsWindowVisible ( m_window );
529
532
sendMessage ( message ( IdIsUIVisible )
530
- .addInt ( m_window ? 1 : 0 ) );
533
+ .addInt ( visible ? 1 : 0 ) );
531
534
return true ;
532
535
}
533
536
}
@@ -709,7 +712,7 @@ void RemoteVstPlugin::initEditor()
709
712
dwStyle = WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX;
710
713
}
711
714
712
- m_window = CreateWindowEx ( 0 , " LVSL" , pluginName (),
715
+ m_window = CreateWindowEx ( WS_EX_APPWINDOW , " LVSL" , pluginName (),
713
716
dwStyle,
714
717
0 , 0 , 10 , 10 , NULL , NULL , hInst, NULL );
715
718
if ( m_window == NULL )
@@ -733,7 +736,7 @@ void RemoteVstPlugin::initEditor()
733
736
pluginDispatch ( effEditTop );
734
737
735
738
if (! EMBED) {
736
- ShowWindow ( m_window, SW_SHOWNORMAL );
739
+ showEditor ( );
737
740
}
738
741
739
742
#ifdef LMMS_BUILD_LINUX
@@ -747,6 +750,26 @@ void RemoteVstPlugin::initEditor()
747
750
748
751
749
752
753
+ void RemoteVstPlugin::showEditor () {
754
+ if ( !EMBED && !HEADLESS && m_window )
755
+ {
756
+ ShowWindow ( m_window, SW_SHOWNORMAL );
757
+ }
758
+ }
759
+
760
+
761
+
762
+
763
+ void RemoteVstPlugin::hideEditor () {
764
+ if ( !EMBED && !HEADLESS && m_window )
765
+ {
766
+ ShowWindow ( m_window, SW_HIDE );
767
+ }
768
+ }
769
+
770
+
771
+
772
+
750
773
void RemoteVstPlugin::destroyEditor ()
751
774
{
752
775
if ( m_window == NULL )
@@ -1947,7 +1970,7 @@ LRESULT CALLBACK RemoteVstPlugin::wndProc( HWND hwnd, UINT uMsg,
1947
1970
}
1948
1971
else if ( uMsg == WM_SYSCOMMAND && wParam == SC_CLOSE )
1949
1972
{
1950
- __plugin->destroyEditor ();
1973
+ __plugin->hideEditor ();
1951
1974
return 0 ;
1952
1975
}
1953
1976
0 commit comments