Commit Graph

68 Commits

Author SHA1 Message Date
Robbert van der Helm d2d4cf4ea9 Replace most uses of Boost.{Filesystem,Process}
With the `ghc::filesystem` dependency from the previous commit. If we
can replace the rest of the Boost.Filesystem dependency then we can get
rid the one nasty runtime dependency we have, and it will make
implementing the chainloading simpler since can reuse more code without
bringing in Boost.
2022-04-14 23:42:12 +02:00
Robbert van der Helm de470d345a Fix building under Wine 7.2
Which isn't out yet, but this already affects the current master branch.
2022-02-02 13:56:05 +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 d48dbe71da Redundantly limit number of drag-and-drop formats
As reported in #149, the DrumCore 3 plugin would segfault when trying to
drag files from it. This happened because the plugin presumably
underflows somewhere and then reports that it supports 4294967282
different drag-and-drop formats, even though yabridge asked for a
maximum of 16.
2021-12-16 01:52:37 +01:00
Robbert van der Helm ec41ec1c81 Add a warmup phase to the XDND implementation
This fixes short drops being ignored. Bitwig does this, and I've also
seen some Qt applications do this.
2021-08-22 16:43:02 +02:00
Robbert van der Helm 64f0cbcd41 Fix property reply errors being coerced to 0
During a refactor this changed from a boolean to an option, guess I
missed this.
2021-08-22 16:41:40 +02:00
Robbert van der Helm c12c1459bb Fix drag-and-drop skipping the first tick
This check is of course not supposed to be here.
2021-08-22 15:56:23 +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 7a2febfffb Support the older XDND versions 3 and 4
This is needed for Tracktion Waveform and other JUCE based hosts.
2021-07-23 13:19:10 +02:00
Robbert van der Helm 9e84352609 Fix typo in XDND code 2021-07-23 12:45:53 +02:00
Robbert van der Helm 75ab133adb Change ProxyWindow into a more generic X11Window 2021-07-21 14:37:52 +02:00
Robbert van der Helm 28ab46e3c1 Explicitly check for CF_HDROP
We should of course not expect all global memory to be a HDROP, oops.
Apparently REAKTOR sometimes uses the drag-and-drop system for its own
internal data.
2021-07-18 19:20:44 +02:00
Robbert van der Helm 4fc683188b Use std::this_thread::sleep_for instead of usleep
This is a bit cleaner.
2021-07-18 14:14:23 +02:00
Robbert van der Helm 0c816b0046 Only ignore -Wmaybe-uninitialized on GCC
An ifdef sounds like a better approach than ignoring two additional
warnings.
2021-07-14 17:18:44 +02:00
Robbert van der Helm f292158889 Silence some more clangd warnings 2021-07-14 17:11:27 +02:00
Robbert van der Helm d8215e4664 Allow cancelling the drag-and-drop with Escape 2021-07-12 22:58:24 +02:00
Robbert van der Helm 2ebefb1280 Send an escape key press instead of WM_QUIT
This should allow the drag-and-drop operation to quit gracefully.
2021-07-12 21:36:08 +02:00
Robbert van der Helm bbb84cdf2c Remove spurious drag-and-drop tracker WM_QUIT
We don't want to cancel the plugin's own drag-and-drop, oops.
2021-07-12 21:17:12 +02:00
Robbert van der Helm 96fb53be8f Fix the CAS in the XDND check
Oops. We were doing the opposite of what we wanted, which caused the
first drag to always fail.
2021-07-12 14:00:48 +02:00
Robbert van der Helm ad4fb1a0ec Don't define X11 error throwing macro in DND proxy
We didn't need this after all because we don't integrate with the
editor's X11 event loop.
2021-07-12 13:35:10 +02:00
Robbert van der Helm 2f8bb7ef06 Only allow a single XDND operation at a time
MT-PowerDrumkit apparently cancels its drag-and-drop operations and then
immediately starts a new one.
2021-07-12 12:35:07 +02:00
Robbert van der Helm a478436af6 Make sure the Windows dnd operation terminates
I've seen a weird edge case where this doesn't happen once, but i
haven't been able to reproduce it. Hopefully this fixes it.
2021-07-12 12:21:52 +02:00
Robbert van der Helm 11d3ec9010 Also change cursor with the last status message
The idea was that you wouldn't be able to see it anyways, but it feels
better this way.
2021-07-11 21:40:42 +02:00
Robbert van der Helm 4d74963e0a Flush any spooled XDND messages
The last position change message would never reach REAPER under when
using certain plugins because we forgot the flush.
2021-07-11 21:35:39 +02:00
Robbert van der Helm 1b4c4ecfad Remove old warning 2021-07-11 19:43:53 +02:00
Robbert van der Helm c968a357f6 Fall back to HDROP with empty format enumerator
This happens with MeldaProduction plugins.
2021-07-11 19:29:15 +02:00
Robbert van der Helm b1b47ec80d Allow dragging to the right and bottom of plugins 2021-07-11 18:48:32 +02:00
Robbert van der Helm ca5a7b2b96 Continue polling while LMB is held
Instead of while the tracker window is alive. Technically the plugin may
clean up their files after the tracker window is gone, but in practice I
haven't seen it happen.
2021-07-11 18:34:26 +02:00
Robbert van der Helm 312debc447 URL encode paths in XDND text/uri-list
This should fix drag-and-drop in Bitwig.
2021-07-11 17:21:35 +02:00
Robbert van der Helm 64fbabd8ce Canonicalize paths during drag-and-drop
Otherwise we will get a path from somewhere in `$WINEPREFIX/dosdevices`.
2021-07-11 17:03:53 +02:00
Robbert van der Helm bfaac67cbc End every URI with a line feed
Bitwig requires this.
2021-07-11 16:53:38 +02:00
Robbert van der Helm 8d94abb257 Only send the drop once
Oops.
2021-07-11 16:30:28 +02:00
Robbert van der Helm a12215de3c Fix URI list length
Apparently you're _not_ supposed to count the trailing lien feed. This
would cause REAPER to freeze.
2021-07-11 16:30:21 +02:00
Robbert van der Helm 8e29b5edf3 Make sure the drop actually goes through
The whole dropping code was nested in the wrong loop (oops), and we also
forgot to send any last spooled messages. We now also use a pair of
booleans instead of an optional boolean here because it makes the
conditionals a bit more readable.
2021-07-11 15:55:34 +02:00
Robbert van der Helm f6d661cd35 Fix the timeout 2021-07-11 15:28:14 +02:00
Robbert van der Helm 7bac138240 Spool XdndPosition messages
In accordance to the spec.
2021-07-11 15:28:01 +02:00
Robbert van der Helm 0e0b120eda Perform the actual drop after releasing the button 2021-07-11 15:13:32 +02:00
Robbert van der Helm 8fc1097f84 Change cursor depending on XdndStatus 2021-07-11 14:32:48 +02:00
Robbert van der Helm 4e67fa9212 Fetch atoms for the remaining two XDND messages
We're going to need these anyways.
2021-07-11 14:14:02 +02:00
Robbert van der Helm 7b5810ae57 Listen for XdndStatus 2021-07-11 14:12:35 +02:00
Robbert van der Helm 2671511dc0 Handle ConvertSelection for XDND 2021-07-11 14:05:09 +02:00
Robbert van der Helm b6fd0405fb Transform the file list into text/uri-list format 2021-07-11 13:20:36 +02:00
Robbert van der Helm 6f3beca32a Send XdndPosition messages 2021-07-11 12:34:04 +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 e0ff16cd16 Fix XDND transition state when leaving window
Just resetting the last window is of course not enough here. I think
Dolphin/Qt run into the same issue, because their drop seems to stick
when hovering over Emacs (or Emacs is to blame, which could very well be
the case here).
2021-07-11 12:12:02 +02:00
Robbert van der Helm 94125f9eab Announce XdndEnter and XdndLeave 2021-07-10 23:50:39 +02:00
Robbert van der Helm 7d8a252301 Implement the function for sending XDND messages 2021-07-10 23:18:18 +02:00
Robbert van der Helm 2e153304dd Find the first XDND aware window under the cursor 2021-07-10 23:08:37 +02:00
Robbert van der Helm 916b1ed6c0 Track the last window we hovered over, if valid 2021-07-10 20:26:45 +02:00