From 974951e96695376b9d050b279ae951cc6af0a4d2 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 5 Jun 2021 11:32:24 +0200 Subject: [PATCH] Translate mouse coordinates from Wine window Instead of the parent Window. Tracktion Waveform does some weird things with its VST2 editor embedding, so with the old approach this would cause mouse clicks to be offset 27 pixels vertically and one pixel horizontally. --- CHANGELOG.md | 7 +++++++ src/wine-host/editor.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db2aeea0..9e02b430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- Fixed mouse clicks in VST2 editors in **Tracktion Waveform** being offset + vertically because of the way Waveform embeds VST2 editors. + ## [3.3.0] - 2020-06-03 ### Added diff --git a/src/wine-host/editor.cpp b/src/wine-host/editor.cpp index 0b7225dd..e6e3b086 100644 --- a/src/wine-host/editor.cpp +++ b/src/wine-host/editor.cpp @@ -480,9 +480,15 @@ void Editor::fix_local_coordinates() const { // We can't directly use the `event.x` and `event.y` coordinates because the // parent window may also be embedded inside another window. + // HACK: Tracktion Waveform uses client side decorations, and for VST2 + // plugins they forgot to add a separate parent window that's already + // offset correctly. Instead, they'll have the plugin embed itself + // inside directly inside of the dialog, and Waveform then moves the + // window 27 pixels down. That's why we cannot use `parent_window` + // here. xcb_generic_error_t* error; const xcb_translate_coordinates_cookie_t translate_cookie = - xcb_translate_coordinates(x11_connection.get(), parent_window, root, 0, + xcb_translate_coordinates(x11_connection.get(), wine_window, root, 0, 0); xcb_translate_coordinates_reply_t* translated_coordinates = xcb_translate_coordinates_reply(x11_connection.get(), translate_cookie,