Commit Graph

74 Commits

Author SHA1 Message Date
Robbert van der Helm 764eb41da9 Remove fixme about Wine deleting windows twice
This should have been fixed as of yabridge 3.2.0 by adding doing a
reparent with a last second flush. Or at least, I haven't heard any
reports about this still being an issue.
2021-07-14 16:35:51 +02:00
Robbert van der Helm eac9f9433b Clean up X11 client message functions
clang-tidy would warn about all parameters being the same, which is
true, but that's kind of the point here.
2021-07-11 12:15:30 +02:00
Robbert van der Helm 998e222651 Fix definition clashes in unity build 2021-07-10 19:38:24 +02:00
Robbert van der Helm 091ab0f0df Spawn a thread to fake do our XDND polling
We cannot integrate this into our event loop like we planned, because
Wine a) grabs the mouse pointer so we cannot do that, and b) blocks the
GUI thread. So instead we will spawn our own thread and do polling based
XDND. When Wine's tracker window gets destroyed, we know that the left
mouse button has been released.
2021-07-10 19:28:40 +02:00
Robbert van der Helm ddac793e82 Add a function for fetching X11 atoms by name 2021-07-10 17:22:04 +02:00
Robbert van der Helm 2ba2cf1ab7 Free the drag-and-drop proxy after closing editors
Apparently X11 connections are a scarce resource, so it seems like a
good idea to not hang on to them for too long. Now this is sort of a
hybrid between COM-style memory management and a singleton.
2021-07-10 00:15:38 +02:00
Robbert van der Helm efeb8d7348 Rearrange editor functions 2021-06-15 11:00:22 +02:00
Robbert van der Helm a9643577fd Also add noexcept qualifications on the Wine side
See the last few commits.
2021-05-14 18:27:19 +02:00
Robbert van der Helm af299f3c66 Always define NOMINMAX and friends globally
Repeating this every time is worse than defining them in the compiler
command line.
2021-05-11 02:27:43 +02:00
Robbert van der Helm 5577c4bfd8 Fix build on Wine 6.8 #103
Wine dropped `WINE_NOWINSOCK`, so now we sadly have to define this
globally instead.
2021-05-11 02:27:38 +02:00
Robbert van der Helm 0c7dbe8a4a Reparent to the root window before deferring close
We did this before implementing the deferred close in yabridge 3.0.0. It
didn't seem necessary anymore so we got rid of it, but without this
closing an iZotope Rx plugin's editor in Renoise was guaranteed to
trigger an X11 error and crash Renoise. Doing this reparent doesn't seem
to cause any slowdown but it does at least fix the specific combination
of iZotope Rx and Renoise.
2021-04-26 18:47:58 +02:00
Robbert van der Helm 0d53f03b28 Get rid of an incorrect comment
This probably ended up here during a refactor.
2021-04-26 18:32:50 +02:00
Robbert van der Helm 2ca1d5b8ca Greatly increase reliability of deferred closing
It's pretty hard to find a solution that checks all of the boxes. I want
something that:

- Closes instantly when you close the editor, and in REAPER you should
  be able to instantly switch between docked and floating modes
- Where there should not be a delay in user interaction when quickly
  reopening the editor (or doing that switching thing in REAPER since that's
  the same thing)
- Where the window manager should not try to reparent the window during
  the losing process as that can cause some jarring flickering
- And, of course, there should be no weird Wine X11Drv crashes

And it should do all of that in Bitwig, REAPER, Carla, Ardour and
Renoise. Apparently it's quite the task to find an approach that checks
all the boxes there.
2021-01-21 16:47:35 +01:00
Robbert van der Helm 5155863673 Encapsulate the deferred window closing
This makes it a bit easier to tweak the closing behaviour.
2021-01-21 15:56:13 +01:00
Robbert van der Helm e5b1e31aff Reuse window classes
This gets rid of some unnecessary complexity.
2021-01-21 15:40:25 +01:00
Robbert van der Helm 4ec8b01bcc Completely run effEditIdle from a timer
Although it hasn't shown up, this will get rid of the possibility of
off-thread effEditIdle calls causing issues. And since we need some way
to run call this function while the event loop is running anyways, doing
it entirely from a timer similar to how hosts on Windows would do it
seems like the best solution.
2021-01-04 15:50:17 +01:00
Robbert van der Helm 34f8d3b1d2 Update the copyright notices for 2021 2021-01-01 18:54:02 +01:00
Robbert van der Helm 5f8926f8ae Defer Win32 window closing
This gets rid of all potential delays when closing windows.
2020-12-31 14:18:26 +01:00
Robbert van der Helm fa0753f520 Use atomic fetch-and-add for unique window classes 2020-12-31 14:12:14 +01:00
Robbert van der Helm fbef37b924 Disable blitting on window position changes
This slightly reduces flickering because redraws are now a bit faster.
2020-12-27 15:08:39 +01:00
Robbert van der Helm bce3afa5e4 Revert "Mostly fix editor GUIs drifting in negative coords"
I've also tried a lot of other things, but none of the solutions I've
tried work 100% of the time. It sounds like a better idea to have
something that doesn't work consistently than to have something that
inconsistently sort of works. Setting the size in `WM_WINDOWPOSCHANGING`
to (0, 0) fixes the drifting, but the mouse coordinates are still wrong
and `SetWindowPos()` breaks the reparenting.

This reverts commit db2cc5800a.
2020-12-26 18:13:40 +01:00
Robbert van der Helm db2cc5800a Mostly fix editor GUIs drifting in negative coords
I think some rounding in Wine is causing this issue, but then again
we're not supposed to send these ConfigureNotify events to the window
directly anyways.
2020-12-26 16:30:25 +01:00
Robbert van der Helm 448158df8f Update comments in Editor implementation 2020-12-25 22:53:33 +01:00
Robbert van der Helm 80ef1ec394 Add XEmbed support back in
Still very much broken, albeit a bit less broken than a year ago.
2020-12-25 19:49:47 +01:00
Robbert van der Helm 7e34cf69fe Remove Editor::handle_win32_events
This apparently isn't needed anymore.
2020-12-21 18:24:07 +01:00
Robbert van der Helm 0f43e21fc0 Remove old todos 2020-12-21 18:22:40 +01:00
Robbert van der Helm 49fc896d62 Remove Win32 effEditIdle() timer
Now Editor is completely decoupled from VST2.
2020-12-19 23:30:47 +01:00
Robbert van der Helm a724b378fe Move the editor handling back to Vst2Bridge
Since we can have multiple editors in Vst3Bridge.
2020-12-19 19:56:49 +01:00
Robbert van der Helm d485aa296a Fix VST2-only builds 2020-12-07 18:28:17 +01:00
Robbert van der Helm 76ad377522 Don't set __MINGW32__
This took me a few hours of non-stop headaches to figure out. Apparently
deep inside of Wine's headers having __MINGW32__ defined will cause some
GUIDs to be defined slightly differently. This normally wouldn't cause
issues, but when including `shellobj.h` or `objbase.h` this results in
multiple definition linking errors that are basically impossible to
diagnose.
2020-12-07 18:28:16 +01:00
Robbert van der Helm 715a95075b Add required compiler args to the Wine VST3 dep 2020-12-07 18:28:16 +01:00
Robbert van der Helm 41da621e29 Add a todo for decoupling Editor from VST2 2020-12-07 18:28:16 +01:00
Robbert van der Helm e08162fabf Silence warnings on decltype() with Wine 5.22
There were already similar warnings on 32-bit winegcc, but now it also
happens on the 64-bit version. Instead of adding
`-Wno-ignored-attributes` we'll just sprinkle some warning ignores here
and there to prevent any other surprises.
2020-11-30 14:05:48 +01:00
Robbert van der Helm a1e7142f17 Mark max_win32_messages as [[maybe_unused]]
ccls/clangd doesn't know that it's being used elsewhere.
2020-10-25 13:00:50 +01:00
Robbert van der Helm 3facdf532a Fix fake dropdown menus in TDR plugins
These would close immediately when hovering over them with the new focus
grabbing method.
2020-10-19 14:34:52 +02:00
Robbert van der Helm 225d6a000e Add a fallback for non-EWMH compliant WMs
I'm not sure how many people use WMs that don't implement
`_NET_ACTIVE_WINDOW`, but at least this will give those people some way
to grab input focus, even if it's not as good as the new method.
2020-10-09 14:35:43 +02:00
Robbert van der Helm 6ff61b1904 Rewrite how input focus grabbing works #38 2020-10-08 19:34:26 +02:00
Robbert van der Helm e680f2eddd Made the input focus grabbing even more aggressive
This fixes keyboard focus not returning when closing dialogs in Melda
plugins. I'll have to do some more testing to see if this does not
introduce any unwanted side effects.
2020-10-08 15:51:20 +02:00
Robbert van der Helm 8ae9c4d263 Made input focus grabbing more aggressive #38
This fixes keyboard input in REAPER, and I haven't found any downsides
to this approach yet.
2020-09-30 17:30:38 +02:00
Robbert van der Helm becb73928e Add a limit to all Win32 message loops #28
This works around Waves plugins causing an infinite message loop. Since
we run the loop 30 times per second anyways splitting the loop up into
chunks of 20 shouldn't be an issue.
2020-08-14 11:36:55 +02:00
Robbert van der Helm b1dd301a98 Add an optional double editor embedding mode #27
This sounds like it would the simplest way to work around the issue of
E27 calculating its own coordinates based on the parent window's
coordinates. I have not noticed any weird issues with having this
enabled all the time, but less moving parts is always better so it's
still behind an option.
2020-07-23 16:56:10 +02:00
Robbert van der Helm 8202a6b250 Add missing const qualifiers to member functions 2020-06-06 13:44:26 +02:00
Robbert van der Helm 957da62137 Add missing type qualifiers 2020-06-06 13:44:23 +02:00
Robbert van der Helm 00bcdf8fca Add a RAII wrapper around SetTimer() 2020-05-28 15:27:45 +02:00
Robbert van der Helm 276e4ac02f Make the local coordinate fix more robust
Without this fix and when using plugin groups, hovering over an opened
window that has not yet been interacted with shows some weird behavior.
2020-05-27 14:29:31 +02:00
Robbert van der Helm d65281d691 Clarify local coordinate fix function name 2020-05-27 13:50:52 +02:00
Robbert van der Helm ab4d35886e Add a fix for the keyboard focus in Bitwig 3.2 2020-05-26 19:39:51 +02:00
Robbert van der Helm 9a35023990 Split X11 and Win32 event handling
X11 events should always be handled since it's thread safe and they
don't block.
2020-05-26 11:11:34 +02:00
Robbert van der Helm 9c6fc78471 Fix editor window handling in Reaper
And other hosts that embed the parent window into another window.
2020-05-02 18:28:43 +02:00
Robbert van der Helm 8adb944445 Use maximum display resolution for the window size
Instead of it being hardcoded to 1440p.
2020-04-28 11:47:39 +02:00