Disable blitting on window position changes

This slightly reduces flickering because redraws are now a bit faster.
This commit is contained in:
Robbert van der Helm
2020-12-27 15:08:01 +01:00
parent 35c7138333
commit fbef37b924
3 changed files with 24 additions and 8 deletions
+3
View File
@@ -36,6 +36,9 @@ TODO: Add an updates screenshot with some fancy VST3-only plugins to the readme
- `libyabridge.so` is now called `libyabridge-vst2.so`. If you're using
yabridgectl then nothing changes here. **To avoid any confusion in the future,
please remove the old `libyabridge.so` file before upgrading.**
- Slightly increased resposniveness when resizing plugin GUIs by preventing
unnecessary blitting. This also reduces flickering with plugins that don't do
double buffering.
- VST2 editor idle events are now handled slightly differently. This should
result in even more responsive GUIs and I have not come across any plugins
where this caused issues, but please let me know if it does break anything for
+15 -2
View File
@@ -97,8 +97,8 @@ WindowClass::~WindowClass() {
Editor::Editor(const Configuration& config,
const std::string& window_class_name,
const size_t parent_window_handle)
: x11_connection(xcb_connect(nullptr, nullptr), xcb_disconnect),
use_xembed(config.editor_xembed),
: use_xembed(config.editor_xembed),
x11_connection(xcb_connect(nullptr, nullptr), xcb_disconnect),
client_area(get_maximum_screen_dimensions(*x11_connection)),
window_class(window_class_name),
// Create a window without any decoratiosn for easy embedding. The
@@ -540,6 +540,19 @@ LRESULT CALLBACK window_proc(HWND handle,
SetWindowLongPtr(handle, GWLP_USERDATA,
reinterpret_cast<size_t>(editor));
} break;
// Setting `SWP_NOCOPYBITS` somewhat reduces flickering on
// `fix_local_coordinates()` calls with plugins that don't do double
// buffering since it speeds up the redrawing process.
case WM_WINDOWPOSCHANGING: {
auto editor = reinterpret_cast<Editor*>(
GetWindowLongPtr(handle, GWLP_USERDATA));
if (!editor || editor->use_xembed) {
break;
}
WINDOWPOS* info = reinterpret_cast<WINDOWPOS*>(lParam);
info->flags |= SWP_NOCOPYBITS | SWP_DEFERERASE;
} break;
// In case the WM does not support the EWMH active window property,
// we'll fall back to grabbing focus when the user clicks on the window
// by listening to the generated `WM_PARENTNOTIFY` messages. Otherwise
+6 -6
View File
@@ -151,6 +151,12 @@ class Editor {
*/
void set_input_focus(bool grab) const;
/**
* Whether to use XEmbed instead of yabridge's normal window embedded. Wine
* with XEmbed tends to cause rendering issues, so it's disabled by default.
*/
const bool use_xembed;
private:
/**
* Returns `true` if the currently active window (as per
@@ -185,12 +191,6 @@ class Editor {
*/
std::unique_ptr<xcb_connection_t, decltype(&xcb_disconnect)> x11_connection;
/**
* Whether to use XEmbed instead of yabridge's normal window embedded. Wine
* with XEmbed tends to cause rendering issues, so it's disabled by default.
*/
const bool use_xembed;
/**
* The Wine window's client area, or the maximum size of that window. This
* will be set to a size that's large enough to be able to enter full screen