https://bugs.winehq.org/show_bug.cgi?id=57603
--- Comment #9 from PennRobotics irischer.posaunist@gmail.com --- The component for this can be changed to winex11.drv
----- (I'm using a different log file when any numeric value is shown:)
Some background, there are four windows created by yabridge: parent (16012db) wrapper (2200000) wine (2000003) host (1600130)
wrapper_window makes parent_window its parent. wine_window makes wrapper_window its parent.
wrapper_window has WS_EX_TOOLWINDOW and WS_POPUP, it seems, which was what "facilitated" relative coordinates before.
The trace then shows: host_window_re parent 402, window 200192 (604,402)-(1516,1110) host_window_re parent 200192, window 200193 (0,0)-(912,708) root_coords 1 host_window_re parent 200193, window 1600130 (0,0)-(912,708) root_coords 1 host_window_re parent 1600130, window 16012db (0,0)-(644,659) root_coords 1 host_window_re parent 16012db, window 2200000 (0,0)-(805,460) root_coords 1 host_window_re parent 2200000, window 2000003 (0,0)-(1920,1200) root_coords 0
I imagine the larger windows with ids 20019x belong to REAPER (in my case). I have no idea why the coordinates for parent_window(?) are (644,659). These numbers never show up again.
During a failed click, event:call_event_handler 204 reports ButtonPress for 0x20070/2000003 (wine_window) X11DRV_ButtonPress has the correct position 19,16 and then calls: ...cursor:map_event_coords, having event_root 402, x_root 889, y_root 493 Because event_root is root_window, pt becomes (x_root, y_root) when it should be (pt->x, pt->y)
...which causes WM_NCHITTEST to fail when the plugin window is too far away from (0,0)
From above, we know that the event window, 2000003, has bounds (1920,1200). That yabridge is getting the correct coordinate to the X11DRV_Buttonpress, we know the client code (Editor::fix_local_coordinates) is getting the information it needs about the child window offset and sending the correct value to Wine.
The patch other users have been reporting is to delete the check for (event_root == root_window), which also doesn't fix where menus appear, but what are the other avenues for getting to (pt->x, pt->y)?
1. Somehow making window = root_window. I don't believe this is possible, right? 2. Making event_root not root_window.
I don't know where event_root comes from. I only know from the above trace that window 2000003 has some extra note, "root_coords 0" where the others have 1.
Other possibilities:
There are a handful of XCB events that are not handled by yabridge, notably XCB_MAP_NOTIFY and XCB_UNMAP_WINDOW. The former happens twice when the plugin is opened (coincidentally the same number of times a reparent occurs) while the latter seems to eventually follow each mouse click event (whether these clicks land on the plugin window or not).
Whether or not yabridge is missing something or the Wine code does not handle this use case, one solution is to create a flag/argument and then use the original (pt->x, pt->y) coordinates---for both mouse events and showing menus---and yabridge calls yabridge-host.exe with the argument.