From f044dc4784fe4de24c9a16c148d3b96b524edf77 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 10 Jul 2021 17:48:22 +0200 Subject: [PATCH] Fetch basic atoms for XDND --- src/wine-host/xdnd-proxy.cpp | 19 +++++++++++++++++-- src/wine-host/xdnd-proxy.h | 8 ++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/wine-host/xdnd-proxy.cpp b/src/wine-host/xdnd-proxy.cpp index 64346be5..631efb53 100644 --- a/src/wine-host/xdnd-proxy.cpp +++ b/src/wine-host/xdnd-proxy.cpp @@ -22,13 +22,20 @@ #include "boost-fix.h" #include +#include "editor.h" /** * The window class name Wine uses for its `DoDragDrop()` tracker window. * * https://github.com/wine-mirror/wine/blob/d10887b8f56792ebcca717ccc28a289f7bcaf107/dlls/ole32/ole2.c#L101-L104 */ -static constexpr char OLEDD_DRAGTRACKERCLASS[] = "WineDragDropTracker32"; +constexpr char OLEDD_DRAGTRACKERCLASS[] = "WineDragDropTracker32"; + +// These are the XDND atom names as described in +// https://www.freedesktop.org/wiki/Specifications/XDND/#atomsandproperties +constexpr char xdnd_selection_name[] = "XdndSelection"; +constexpr char xdnd_aware_property_name[] = "XdndAware"; +constexpr char xdnd_proxy_property_name[] = "XdndProxy"; /** * We're doing a bit of a hybrid between a COM-style reference counted smart @@ -102,7 +109,15 @@ WineXdndProxy::WineXdndProxy() 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS), - UnhookWinEvent) {} + UnhookWinEvent) { + // XDND uses a whole load of atoms for its messages, properties, and + // selections + xcb_xdnd_selection = get_atom_by_name(*x11_connection, xdnd_selection_name); + xcb_xdnd_aware_property = + get_atom_by_name(*x11_connection, xdnd_aware_property_name); + xcb_xdnd_proxy_property = + get_atom_by_name(*x11_connection, xdnd_proxy_property_name); +} WineXdndProxy::Handle::Handle(WineXdndProxy* proxy) : proxy(proxy) {} diff --git a/src/wine-host/xdnd-proxy.h b/src/wine-host/xdnd-proxy.h index 1818d8f9..47197dc7 100644 --- a/src/wine-host/xdnd-proxy.h +++ b/src/wine-host/xdnd-proxy.h @@ -18,6 +18,8 @@ #include +#include "boost-fix.h" + // Use the native version of xcb #pragma push_macro("_WIN32") #undef _WIN32 @@ -159,4 +161,10 @@ class WineXdndProxy { std::decay_t> hook_handle; #pragma GCC diagnostic pop + + // These are the atoms used for the XDND protocol, as described by + // https://www.freedesktop.org/wiki/Specifications/XDND/#atomsandproperties + xcb_atom_t xcb_xdnd_selection; + xcb_atom_t xcb_xdnd_aware_property; + xcb_atom_t xcb_xdnd_proxy_property; };