Commit Graph

206 Commits

Author SHA1 Message Date
Asahi Lina 9994043306 Use WM_WINDOW_ROLE instead of WM_STATE to detect the host window
Ardour brings up the plugin UI before the host window is visible, and it
is missing some properties. Using WM_WINDOW_ROLE instead of WM_STATE
makes it work.

For reference, these are the properties that are set on the window at
the time of plugin GUI instantiation:

_NET_WM_ICON(CARDINAL) =        Icon (16 x 16):
WM_WINDOW_ROLE(STRING) = "plugin_ui"
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 6294918
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_UTILITY
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x600d85
WM_CLIENT_LEADER(WINDOW): window id # 0x600001
_NET_WM_PID(CARDINAL) = 1604801
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLIENT_MACHINE(STRING) = "homura"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                program specified size: 521 by 46
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "ardour-8.12.0", "Ardour-8.12.0"
WM_ICON_NAME(STRING) = "Audio 1: Melodyne (by Celemony) [VST3]"
_NET_WM_ICON_NAME(UTF8_STRING) = "Audio 1: Melodyne (by Celemony) [VST3]"
WM_NAME(STRING) = "Audio 1: Melodyne (by Celemony) [VST3]"
_NET_WM_NAME(UTF8_STRING) = "Audio 1: Melodyne (by Celemony) [VST3]"
2025-06-01 22:51:47 +02:00
Robbert van der Helm e18d598c7e Remove function to get X11 screen size
This is no longer used.
2025-06-01 22:47:54 +02:00
Robbert van der Helm eb8bf93f24 Resize the Wine window using SetWindowPos
This seems to behave more reliably than resizing the window with
`xcb_configure_window()`, solving some of the client area issues with
Wine 9.21.
2025-06-01 22:47:54 +02:00
Robbert van der Helm 66840d4d16 Remove the editor_coordinate_hack option
I'm not sure if this would still be necessary with the new embedding
approach, but it definitely does cause more problems than it solves.
2025-06-01 22:47:53 +02:00
Robbert van der Helm 51e4d61004 Remove the editor_xembed option 2025-06-01 22:47:38 +02:00
Robbert van der Helm 0f9eea2558 Drop the SWP_NOCOPYBITS on resize hack
This shouldn't be necessary anymore. It can always be added back later
if there is still flickering.
2025-06-01 22:47:13 +02:00
Robbert van der Helm ccf5402c1c Reformat with clang-format 2025-06-01 22:47:13 +02:00
Robbert van der Helm 983a19169b Don't include xcb_icccm.h
We just need this constant, so there's no real need to add the
additional dependency. There's also no real harm in adding it, but it
would result in additional work for every packager.
2025-06-01 22:47:13 +02:00
Rémi Bernon 02fb140b19 Remove now unnecessary fix_local_coordinates workaround. 2025-06-01 22:47:13 +02:00
Rémi Bernon 2c6c21409c Fix window wrapping by implementing a minimal ICCCM window manager. 2025-06-01 22:47:13 +02:00
Robbert van der Helm 49e696e42f Update the copyright headers
Happy new year!
2024-01-09 19:25:38 +01:00
Robbert van der Helm 3af48be58a Revert SWP_NOCOPYBITS removal from 9fd6603ce3
This was added on the request of Aurora FM's developer because they use
thousands of child windows for rendering, but this causes unnecessary
flickering in some situations and it should no longer be as needed now
that `fix_local_coordinates()` is only called once when moving windows
around.
2023-05-07 12:47:20 +02:00
Robbert van der Helm 9005474ded Spool fix_local_coordinates() call until release
This will cause the function to only be called on a `ConfigureNotify`
after all mouse buttons have been released. This prevents flickering
when dragging windows around.
2023-04-28 15:27:02 +02:00
Robbert van der Helm b8a115f655 Clarify X11 error message printing
This simply ignores the error and moves on.
2023-04-28 14:57:25 +02:00
Robbert van der Helm 1e66654c2e Update copyright headers for 2023
Happy new year!
2023-01-01 18:51:35 +01:00
Robbert van der Helm 3bc9316f0d Revert static initialization change from fea6eded4 2022-12-23 19:51:45 +01:00
Robbert van der Helm 9fd6603ce3 Get rid of SWP_NOCOPYBITS 2022-11-20 14:20:33 +01:00
Robbert van der Helm ea3680b8c7 Define yabridge Window class name in header
Apparently this is used in xdnd-proxy.cpp.
2022-11-14 23:31:37 +01:00
Robbert van der Helm 561a75b761 Use explicit nullptr instead of aggregate init
Makes it a bit more obvious that HCURSOR is a pointer.
2022-11-14 15:16:34 +01:00
Robbert van der Helm fea6eded49 Work around static initialization bug in WIne 7.21
As reported here: https://bugs.winehq.org/show_bug.cgi?id=53912
2022-11-14 13:59:18 +01:00
Robbert van der Helm 24e50a3afc Rename get_win32_handle() to win32_handle() 2022-10-09 14:23:29 +02:00
Robbert van der Helm 4df2b389a0 Work around resizing bug in Surge XT/CJE 2022-10-09 14:22:02 +02:00
Robbert van der Helm 1fec4c8860 Change the description in the GPL header 2022-04-16 20:37:10 +02:00
Robbert van der Helm b2a15620f3 Swap Boost.Container's small_vector out for LLVM's
This implementation misses a shrink to fit function, but reassigning the
vector with a fresh one should be equivalent.
2022-04-16 20:37:10 +02:00
Robbert van der Helm 25f298636a Add now missing include 2022-04-16 20:37:10 +02:00
Robbert van der Helm 556b0e38f9 Replace Boost.Asio with standalone Asio library
We had to add an even hackier hack now to get Boost.Process to
interoperate with Asio's IO contexts. This will be replaced later when
we replace Boost.Process.
2022-04-14 23:42:12 +02:00
Robbert van der Helm c528a9ef49 Explicitly handle no and pointer root input focus
This will never happen under normal X11. Apparently Crostini isn't
normal X11.

See #167.
2022-03-05 00:39:01 +01:00
Robbert van der Helm d6260c1d6b Delay editor_force_xdnd until the reparent #160
This fixes the option not working correctly when REAPER reparents the
plugin's window to a new FX window.
2022-01-29 01:46:08 +01:00
Robbert van der Helm 4767b758b8 Delay showing editor the window
This fixes Waves V13 VST3 plugins crashing when opening the editor. They
will likely still crash later on anyways because they're kinda broken.
Amazing.
2022-01-09 00:41:14 +01:00
Robbert van der Helm 0b9a16cf40 Change the naming scheme for class field members
I'm not a fan of Hungarian notation, but C++ kind of needs it with its
implicit `this`. And of all the common options for this, I find
suffixing members with an underscore the least offensive one.
2022-01-01 21:07:17 +01:00
Robbert van der Helm e0ab24e645 Update copyright headers
Happy new year!
2022-01-01 18:32:10 +01:00
Robbert van der Helm 5613248cda Gate the new resizing behavior behind new option
This interferes with resizing plugins using resize handles, and since it
only helps with two buggy plugins this seems like the best solution
here.
2021-08-16 22:39:13 +02:00
Robbert van der Helm b84aa18ecf Only reset coordinates when resizing
This was the original idea. I though that to be extra safe, maybe we can
do this all the time. And while that does work fine, most of the time,
it does cause a lot of other fun issues especially when plugins fully
redraw themselves that way.
2021-08-16 21:31:57 +02:00
Robbert van der Helm cc9226a3fc Remove editor_double_embed
It's no longer needed after the `fix_local_coordinates()` change from a
fa12c64866a8b79e862bc5db4c4b092a4b762689.
2021-08-16 21:21:57 +02:00
Robbert van der Helm 9ac597a6fd Make the resize function not-noexcept
Since technically the string allocations within the logging for
`fix_local_coordinates()` can throw.
2021-08-16 21:21:57 +02:00
Robbert van der Helm d46f7882bd Reposition to (0, 0) while fixing coordinates
The goal is to have the window be at (0, 0), while Wine's X11 event
layer thinks it is at the actual screen coordinates. This is needed to
prevent drawing issues with buggy plugins that rely on absolute screen
coordinates to draw their GUI.
2021-08-16 21:21:57 +02:00
Robbert van der Helm e430c5f015 Directly focus wine_window while holding Shift
This lets you type spaces in Bitwig, and it also allows you to interact
with the settings/license popup dialogs in Voxengo plugins in a normal
way.
2021-07-31 16:31:53 +02:00
Robbert van der Helm bf59e5e8ce Also grab keyboard focus on parent window focus
This allows you to directly focus plugin GUIs that are open in the
background in REAPER.
2021-07-31 16:14:02 +02:00
Robbert van der Helm be6fc786ca Add a function for getting the active modifiers 2021-07-31 15:49:47 +02:00
Robbert van der Helm c98a9519fe Handle X11 events within the Win32 event loop
This unifies event handling and it allows X11 events to still be
processed even when the event loop is blocked.
2021-07-31 15:19:44 +02:00
Robbert van der Helm d053eab35a Filter LeaveNotify based on window under pointer
Instead of ignoring all `NonlinearVirtual` events. This lets us release
focus when instantly moving the mouse from a plugin GUI to something
else. This generates `NonlinearVirtual` event, and previously we ignored
those because that also happens when opening a dropdown menu in a TDR
plugin (which uses popup windows instead of actual dropdowns).
2021-07-27 18:05:47 +02:00
Robbert van der Helm e42448f758 Allow manual position for is_cursor_in_wine_window
We'll need this for the `LeaveNotify` because `GetCursorPos()` updates
only once every 100 ms, which means that it would still point to the old
window we're actually leaving.
2021-07-26 15:08:23 +02:00
Robbert van der Helm e1ed35bfd8 Don't respond to hit tests from the Win32 window
This will let us detect other, non-wrapper windows to the right and to
the bottom of a plugin GUI. Useful for drag-and-drop so we don't end up
overriding Wine's internal drag-and-drop mechanism.
2021-07-26 14:44:23 +02:00
Robbert van der Helm 186a6c01a2 Filter Win32 windows for XDND by class name
Instead of ignoring all windows that have an associated X11 window. That
would otherwise treat standalone applications like yabridge GUI
wrappers.
2021-07-26 14:29:06 +02:00
Robbert van der Helm 85264a759d Move check for cursor within Wine window to editor
We'll reuse this for the LeaveNotify check instead to avoid having to
ignore all `NonVirtual` events.
2021-07-26 14:01:16 +02:00
Robbert van der Helm 0523a06ed7 Move the win32 window class name to a constant 2021-07-26 13:51:40 +02:00
Robbert van der Helm d522e57a8a Add active window to enter/leave/focus tracing 2021-07-26 12:43:32 +02:00
Robbert van der Helm 890c534573 Trace input focus grabbing 2021-07-26 12:38:17 +02:00
Robbert van der Helm 4d2ee96167 Remove old TODO about +editor debug level 2021-07-23 15:22:45 +02:00
Robbert van der Helm 8108e08dbf Keep the old time stamp and sequence number
On second thought this seems like a good idea.
2021-07-22 16:31:03 +02:00