mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-16 00:13:55 +02:00
Track the last window we hovered over, if valid
This commit is contained in:
@@ -207,8 +207,9 @@ void WineXdndProxy::run_xdnd_loop() {
|
|||||||
// it's also blocking the GUI thread. So instead we will periodically poll
|
// it's also blocking the GUI thread. So instead we will periodically poll
|
||||||
// the mouse cursor position, and we will consider the disappearance of
|
// the mouse cursor position, and we will consider the disappearance of
|
||||||
// `tracker_window` to mean that the drag-and-drop operation has ended.
|
// `tracker_window` to mean that the drag-and-drop operation has ended.
|
||||||
uint16_t last_pointer_x = ~0;
|
std::optional<uint16_t> last_pointer_x;
|
||||||
uint16_t last_pointer_y = ~0;
|
std::optional<uint16_t> last_pointer_y;
|
||||||
|
std::optional<xcb_window_t> last_window;
|
||||||
while (IsWindow(tracker_window)) {
|
while (IsWindow(tracker_window)) {
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
|
|
||||||
@@ -238,6 +239,13 @@ void WineXdndProxy::run_xdnd_loop() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
last_pointer_x = query_pointer_reply->root_x;
|
||||||
|
last_pointer_y = query_pointer_reply->root_y;
|
||||||
|
last_window.reset();
|
||||||
|
if (query_pointer_reply->child == XCB_NONE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// We want to ignore all Wine windows (within this prefix), since Wine
|
// We want to ignore all Wine windows (within this prefix), since Wine
|
||||||
// will be able to handle the drag-and-drop better than we can
|
// will be able to handle the drag-and-drop better than we can
|
||||||
POINT windows_pointer_pos;
|
POINT windows_pointer_pos;
|
||||||
@@ -249,9 +257,7 @@ void WineXdndProxy::run_xdnd_loop() {
|
|||||||
|
|
||||||
// TODO: Fetch the window under the mouse cursor, send messages to it
|
// TODO: Fetch the window under the mouse cursor, send messages to it
|
||||||
// according to the XDND protocol
|
// according to the XDND protocol
|
||||||
|
last_window = query_pointer_reply->child;
|
||||||
last_pointer_x = query_pointer_reply->root_x;
|
|
||||||
last_pointer_y = query_pointer_reply->root_y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check if the escape key is pressed to allow cancelling the drop,
|
// TODO: Check if the escape key is pressed to allow cancelling the drop,
|
||||||
|
|||||||
Reference in New Issue
Block a user