[PATCH v2 1/3] winex11.drv: Don't remap root_window relative coordinates.

Rémi Bernon rbernon at codeweavers.com
Thu Apr 1 01:47:02 CDT 2021


We already converted coordinates from root to virtual screen, we
shouldn't need to remap them.

Based on a patch from Gabriel Ivăncescu <gabrielopcode at gmail.com>.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46309

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

v2: Remap coordinates for client_window too, if we ever receive events
    on them.

 dlls/winex11.drv/mouse.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 8b39458fd37..e567a03c61c 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -599,15 +599,18 @@ static void map_event_coords( HWND hwnd, Window window, struct x11drv_win_data *
     TRACE( "hwnd %p, window %lx, data %p, input %p\n", hwnd, window, data, input );
 
     if (window == root_window) pt = root_to_virtual_screen( pt.x, pt.y );
-    if (window == data->whole_window)
+    else
     {
-        pt.x += data->whole_rect.left - data->client_rect.left;
-        pt.y += data->whole_rect.top - data->client_rect.top;
-    }
+        if (window == data->whole_window)
+        {
+            pt.x += data->whole_rect.left - data->client_rect.left;
+            pt.y += data->whole_rect.top - data->client_rect.top;
+        }
 
-    if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL)
-        pt.x = data->client_rect.right - data->client_rect.left - 1 - pt.x;
-    MapWindowPoints( hwnd, 0, &pt, 1 );
+        if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL)
+            pt.x = data->client_rect.right - data->client_rect.left - 1 - pt.x;
+        MapWindowPoints( hwnd, 0, &pt, 1 );
+    }
 
     TRACE( "mapped %s to %s\n", wine_dbgstr_point( (POINT *)&input->u.mi.dx ), wine_dbgstr_point( &pt ) );
 
-- 
2.30.2




More information about the wine-devel mailing list