[PATCH v2 6/9] server: Split cursor position update to update_desktop_cursor_pos.
Rémi Bernon
rbernon at codeweavers.com
Mon Jun 15 05:05:45 CDT 2020
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
server/queue.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/server/queue.c b/server/queue.c
index 94b9d555183..d8b69e77787 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -366,6 +366,20 @@ static struct message *alloc_hardware_message( lparam_t info, struct hw_msg_sour
return msg;
}
+static int update_desktop_cursor_pos( struct desktop *desktop, int x, int y )
+{
+ int updated;
+
+ x = max( min( x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left );
+ y = max( min( y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top );
+ updated = (desktop->cursor.x != x || desktop->cursor.y != y);
+ desktop->cursor.x = x;
+ desktop->cursor.y = y;
+ desktop->cursor.last_change = get_tick_count();
+
+ return updated;
+}
+
/* set the cursor position and queue the corresponding mouse message */
static void set_cursor_pos( struct desktop *desktop, int x, int y )
{
@@ -1500,15 +1514,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
}
else if (msg->msg != WM_INPUT)
{
- if (msg->msg == WM_MOUSEMOVE)
- {
- int x = max( min( msg->x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left );
- int y = max( min( msg->y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top );
- if (desktop->cursor.x != x || desktop->cursor.y != y) always_queue = 1;
- desktop->cursor.x = x;
- desktop->cursor.y = y;
- desktop->cursor.last_change = get_tick_count();
- }
+ if (msg->msg == WM_MOUSEMOVE && update_desktop_cursor_pos( desktop, msg->x, msg->y )) always_queue = 1;
if (desktop->keystate[VK_LBUTTON] & 0x80) msg->wparam |= MK_LBUTTON;
if (desktop->keystate[VK_MBUTTON] & 0x80) msg->wparam |= MK_MBUTTON;
if (desktop->keystate[VK_RBUTTON] & 0x80) msg->wparam |= MK_RBUTTON;
--
2.27.0
More information about the wine-devel
mailing list