Listen for XdndStatus

This commit is contained in:
Robbert van der Helm
2021-07-11 14:12:35 +02:00
parent 2671511dc0
commit 7b5810ae57
2 changed files with 18 additions and 1 deletions
+17 -1
View File
@@ -46,6 +46,7 @@ constexpr char xdnd_selection_name[] = "XdndSelection";
constexpr char xdnd_proxy_property_name[] = "XdndProxy";
constexpr char xdnd_enter_message_name[] = "XdndEnter";
constexpr char xdnd_position_message_name[] = "XdndPosition";
constexpr char xdnd_status_message_name[] = "XdndStatus";
constexpr char xdnd_leave_message_name[] = "XdndLeave";
// XDND actions
@@ -139,6 +140,8 @@ WineXdndProxy::WineXdndProxy()
get_atom_by_name(*x11_connection, xdnd_enter_message_name);
xcb_xdnd_position_message =
get_atom_by_name(*x11_connection, xdnd_position_message_name);
xcb_xdnd_status_message =
get_atom_by_name(*x11_connection, xdnd_status_message_name);
xcb_xdnd_leave_message =
get_atom_by_name(*x11_connection, xdnd_leave_message_name);
@@ -273,7 +276,6 @@ void WineXdndProxy::run_xdnd_loop() {
const uint8_t event_type =
generic_event->response_type & xcb_event_type_mask;
switch (event_type) {
// TODO: Handle client messages
// When the window we're dragging over wants to inspect the
// dragged content, it will call `ConvertSelection()` which
// sends us a `SelelectionRequest`. We should write the data in
@@ -307,6 +309,20 @@ void WineXdndProxy::run_xdnd_loop() {
reinterpret_cast<const char*>(&selection_notify_event));
xcb_flush(x11_connection.get());
} break;
case XCB_CLIENT_MESSAGE: {
const auto event =
reinterpret_cast<xcb_client_message_event_t*>(
generic_event.get());
if (event->type == xcb_xdnd_status_message) {
// At this point
// `static_cast<bool>(event->data.data32[1] & 0b01)`
// indicates whether the window accepts the drop, not
// sure if we actually need to do antyhing with it
} else {
// TODO: Implement the other client messages
}
} break;
}
}
+1
View File
@@ -252,6 +252,7 @@ class WineXdndProxy {
xcb_atom_t xcb_xdnd_proxy_property;
xcb_atom_t xcb_xdnd_enter_message;
xcb_atom_t xcb_xdnd_position_message;
xcb_atom_t xcb_xdnd_status_message;
xcb_atom_t xcb_xdnd_leave_message;
// XDND specifies various actions for drag-and-drop, but since the file is