obsproject / obs-vst

Use VST plugins in OBS
GNU General Public License v2.0
181 stars 56 forks source link

Fix button states on properties refresh #83

Closed fzwoch closed 2 years ago

fzwoch commented 3 years ago

Properties creation checks whether the current plugin has it's editor window open or not. Depending on if it is or not the states of the open/close editor buttons are set accordingly.

Description

This change adds a function for querying the current plugin's state of its editor window - if it is currently shown or not. Upon properties creation the buttons for opening and closing the editor window are shown and hid according of the return value of that function.

Motivation and Context

Current behavior is a little broken on focus changes(?). At the moment when opening an editor window, the controls are correctly changed to "close" the opened editor window. The new editor window gets the current focus. When returning the focus to the VST OBS property window the properties are getting refreshed and default to their initial state. This indicates the incorrect state of the editor window and one would have to click the "open" button once again to trigger the (noop) editor window again to get the "close" button to correctly appear to close the editor again.

How Has This Been Tested?

Current behavior and fix tested on Linux (current behavior was also verified on Windows, fix untested there, but should be platform independent)

Types of changes

Checklist:

flexiondotorg commented 3 years ago

Thanks for working on this patch :+1:

I've tested on Linux using OBS 27.0.0-rc5 and it provides an improvement but doesn't always present to correct plugin state.

If I add one VST 2.x Plug-in filter, this is what I observe:

Not sure if this is related to: https://github.com/obsproject/obs-vst/issues/66

fzwoch commented 3 years ago

Could be that the actual window creation is done asynchronous and in your case the properties get refreshed before the actual window is created. I'll take another look by chance.

fzwoch commented 3 years ago

Just tried it.. so the potential misbehavior is the 2nd step in your description.

Can it just be that that click just changes focus from the plugin editor back the the OBS plugin preferences? Then I think this is intended behavior - and the button is actually not being clicked.

flexiondotorg commented 3 years ago

Can it just be that that click just changes focus from the plugin editor back the the OBS plugin preferences? Then I think this is intended behavior - and the button is actually not being clicked.

Yes 🤦 You are quite correct.

Just tested again with 27.1.3 and this is indeed working correctly.