Commit Graph

206 Commits

Author SHA1 Message Date
Robbert van der Helm efeb8d7348 Rearrange editor functions 2021-06-15 11:00:22 +02:00
Robbert van der Helm fe7f6eff96 Make the last commit appear a little less drastic 2021-06-05 11:41:22 +02:00
Robbert van der Helm 974951e966 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.
2021-06-05 11:32:24 +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 49750575bc Fix xcb assertion failures in Ardour for good
Hopefully. Checking mapped state apparently wasn't enough to prevent
spurious assertion failures on `is_child_window_or_same()`. Now we'll
just use exceptions instead of assertions so we catch them and ignore
them.
2021-05-02 20:40:59 +02:00
Robbert van der Helm 2fd453e747 Repeat the window mapped check for Ardour
This is probably a better idea than trying to be efficient. If we get
two events in a row, then it can be that the map status has changed
between the two events.
2021-05-02 18:33:05 +02:00
Robbert van der Helm fd29c7d825 Skip X11 events when the window is not mapped
This fixes potential assertion failures in Ardour when Ardour unmaps
editor windows.
2021-05-01 23:22:59 +02:00
Robbert van der Helm 5a68b8b39d Flush the reparent from 0c7dbe8
This should add a root reparent to prevent that X11 error, but it should
still prevent flickering by doing it just before closing the window.
2021-04-27 03:43:45 +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 f6cf1a7dd2 Use explicit narrowing for SetWindowLongPtr() 2021-04-26 18:32:50 +02:00
Robbert van der Helm 5278c2e2ea Print all errors on the Wine side to STDERR
This one was using STDOUT for some reason
2021-04-12 14:19:31 +02:00
Robbert van der Helm 27370ab54b Remove debug prints 2021-01-30 23:11:25 +01:00
Robbert van der Helm b5dd806b2d Cache VST3 parameter information
This is in some cases needed to get decent performance in REAPER, as
REAPER seems to query this information (which cannot change without the
plugin requesting a restart) four times per second.
2021-01-30 22:24:05 +01:00
Robbert van der Helm 68bf2029b3 Fix type of X11 event mask 2021-01-30 16:38:08 +01:00
Robbert van der Helm fb7531d74b Greatly clean up the input focus grabbing
In commit 9788f21e0e we changed the input
focus grabbing to only grab focus once per event cycle, because
otherwise Bitwig would fight over who was getting focus. This is a bit
hacky, and with this approach you could in theory still have an
unnecessary focus grab 60 times per second (i.e. the default event
polling rate). Now we instead check the current focus target, and only
request focus when it's actually necessary.
2021-01-30 15:40:24 +01: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 dac817323b Add an option to force drag-and-drop under REAPER
This works around a long standing bug in REAPER itself that would
prevent you from dragging files onto any plugin editor window.
2021-01-19 15:11:27 +01:00
Robbert van der Helm 9788f21e0e Fix rare hanging issue on Bitwig related to focus
On Bitwig grabbing input focus this way would trigger many more FocusIn
events, which in certain situations could cause the interface to hang
while everything was being processed.
2021-01-19 00:52:49 +01:00
Robbert van der Helm bf3a4e7296 Allow changing the event loop tick rate
This also changes the refresh rate for most plugins. You can now lower
this setting if your computer is struggling to keep up with rendering a
certain heavy plugin.
2021-01-11 23:38:21 +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 c554b9b4ab Use SW_MINIMIZE instead of SW_HIDE
Before deferring closing the editor. This still gets rid of that issue
in Wine's X11drv that would result in a double destroy, and it also gets
rid of a delay that would still occur in Carla.
2021-01-04 13:54:01 +01:00
Robbert van der Helm 71eadff1ed Fix rare X11 error on editor closing
With the new deferred closing behaviour, closing the editor of Vital's
VST2 version would trigger an X11 error in Wine's X11drv. This doesn't
seem to happen with other plugins (or the VST3 version of Vital) and the
fact that this workaround even works is strange to say the least, but at
least it does work.
2021-01-03 16:49:23 +01:00
Robbert van der Helm 176e7fd1ae Add a comment on why we don't set a background 2021-01-02 19:42:37 +01:00
Robbert van der Helm 4a7b560972 Revert "Add a background brush to the window"
While this does get rid of artifacts, it can also add a brief moment
where the gray background becomes visible when the window reconfigures
which can look jarring.

This reverts commit 35c7138333.
2021-01-02 19:32:28 +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 c3c0f96585 Get rid of CS_HREDRAW and CS_VREDRAW
This causes the window to black out to fully redraw even when the
plugin's editor window can just draw over the new parts.
2020-12-31 13:31:44 +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 35c7138333 Add a background brush to the window
So the background always gets cleared out when the window resizes.
2020-12-27 14:37:43 +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 57e23ee392 Rewrite X11 event mask
A literal like this is much more understandable.
2020-12-26 01:42:55 +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 1aa5d5d8b4 Add note to input focus grabbing
This shouldn't be necessary for VST3, but it is.
2020-12-21 22:46:59 +01:00
Robbert van der Helm d49814d21d Add todo about input focus in VST3 2020-12-21 19:13:14 +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 49fc896d62 Remove Win32 effEditIdle() timer
Now Editor is completely decoupled from VST2.
2020-12-19 23:30:47 +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 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 150845a301 Fix editor_double_embed causing X11 errors
Since the error codes were not before version 1.7.0 we just didn't
notice this, even though everything still appeared to work fine.
2020-10-14 16:36:48 +02:00
Robbert van der Helm 95ad6fc36a Work around reparenting issues in #40
I'm still really curious why this double reparent would be needed
though. Everything works fine on any other i3 config I've tried, and
even the exact same config in a VM works fine for me.
2020-10-12 14:28:29 +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 36d39bfca9 Add missing free() calls for xcb 2020-10-08 17:03:03 +02:00
Robbert van der Helm 60c4e64b9b Add xcb error assertions instead of segfaulting
These things should not fail (and I've never seen one of these thing
error out with yabridge), but in the case they do an assertion is at
least a lot trace down than a segfault.
2020-10-08 16:17:00 +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