Rémi Bernon : winex11.drv: Update INPUT mouse coordinates directly.

Alexandre Julliard julliard at winehq.org
Wed Mar 31 15:55:14 CDT 2021


Module: wine
Branch: master
Commit: 29d56fcb8b450701433a2d2572ec345ffd9633ce
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=29d56fcb8b450701433a2d2572ec345ffd9633ce

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Thu Mar 25 19:00:19 2021 +0100

winex11.drv: Update INPUT mouse coordinates directly.

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>
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winex11.drv/mouse.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 8a379e5a3b7..8b39458fd37 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -592,7 +592,7 @@ static BOOL is_old_motion_event( unsigned long serial )
  *
  * Map the input event coordinates so they're relative to the desktop.
  */
-static POINT map_event_coords( HWND hwnd, Window window, struct x11drv_win_data *data, const INPUT *input )
+static void map_event_coords( HWND hwnd, Window window, struct x11drv_win_data *data, INPUT *input )
 {
     POINT pt = { input->u.mi.dx, input->u.mi.dy };
 
@@ -611,7 +611,8 @@ static POINT map_event_coords( HWND hwnd, Window window, struct x11drv_win_data
 
     TRACE( "mapped %s to %s\n", wine_dbgstr_point( (POINT *)&input->u.mi.dx ), wine_dbgstr_point( &pt ) );
 
-    return pt;
+    input->u.mi.dx = pt.x;
+    input->u.mi.dy = pt.y;
 }
 
 
@@ -623,7 +624,6 @@ static POINT map_event_coords( HWND hwnd, Window window, struct x11drv_win_data
 static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPUT *input )
 {
     struct x11drv_win_data *data;
-    POINT pt;
 
     input->type = INPUT_MOUSE;
 
@@ -647,7 +647,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
     }
 
     if (!(data = get_win_data( hwnd ))) return;
-    pt = map_event_coords( hwnd, window, data, input );
+    map_event_coords( hwnd, window, data, input );
 
     if (InterlockedExchangePointer( (void **)&cursor_window, hwnd ) != hwnd ||
         input->u.mi.time - last_cursor_change > 100)
@@ -670,8 +670,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
         /* ignore event if a button is pressed, since the mouse is then grabbed too */
         !(state & (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask|Button6Mask|Button7Mask)))
     {
-        RECT rect;
-        SetRect( &rect, pt.x, pt.y, pt.x + 1, pt.y + 1 );
+        RECT rect = { input->u.mi.dx, input->u.mi.dy, input->u.mi.dx + 1, input->u.mi.dy + 1 };
 
         SERVER_START_REQ( update_window_zorder )
         {
@@ -685,8 +684,6 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
         SERVER_END_REQ;
     }
 
-    input->u.mi.dx = pt.x;
-    input->u.mi.dy = pt.y;
     __wine_send_input( hwnd, input );
 }
 




More information about the wine-cvs mailing list