From d8b8ac85ebf0d11e64f88dee54bfd506c47d29b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Feb 2024 12:26:54 +0100 Subject: [PATCH] server: Generate WM_POINTERENTER / WM_POINTERLEAVE messages. --- dlls/dinput/tests/device8.c | 30 +++++------------------------- server/queue.c | 28 +++++++++++++++++++--------- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/dlls/dinput/tests/device8.c b/dlls/dinput/tests/device8.c index 8b2a72f5976..7fb0ef538e0 100644 --- a/dlls/dinput/tests/device8.c +++ b/dlls/dinput/tests/device8.c @@ -2004,7 +2004,6 @@ static void test_hid_touch_screen(void) res = msg_wait_for_events( 1, &touchleave_event, 500 ); todo_wine ok( res == 0, "WaitForSingleObject returned %#lx\n", res ); - todo_wine ok( pointer_enter_count == 1, "got pointer_enter_count %u\n", pointer_enter_count ); todo_wine ok( pointer_up_count == 1, "got pointer_up_count %u\n", pointer_up_count ); @@ -2012,13 +2011,10 @@ static void test_hid_touch_screen(void) expect_flags = POINTER_MESSAGE_FLAG_PRIMARY | POINTER_MESSAGE_FLAG_CONFIDENCE | POINTER_MESSAGE_FLAG_FIRSTBUTTON | POINTER_MESSAGE_FLAG_NEW | POINTER_MESSAGE_FLAG_INRANGE | POINTER_MESSAGE_FLAG_INCONTACT; - todo_wine + todo_wine /* missing POINTER_MESSAGE_FLAG_FIRSTBUTTON */ ok( HIWORD( pointer_wparam[0] ) == expect_flags, "got wparam %#Ix\n", pointer_wparam[0] ); - todo_wine ok( LOWORD( pointer_wparam[0] ) > 0, "got wparam %#Ix\n", pointer_wparam[0] ); - todo_wine ok( LOWORD( pointer_lparam[0] ) * 128 / width == 0x08, "got lparam %#Ix\n", pointer_lparam[0] ); - todo_wine ok( HIWORD( pointer_lparam[0] ) * 128 / height == 0x10, "got lparam %#Ix\n", pointer_lparam[0] ); id = LOWORD( pointer_wparam[0] ); @@ -2027,6 +2023,7 @@ static void test_hid_touch_screen(void) ok( HIWORD( pointer_wparam[1] ) == expect_flags || broken(HIWORD( pointer_wparam[1] ) == (expect_flags & ~POINTER_MESSAGE_FLAG_CONFIDENCE)), /* Win8 32bit */ "got wparam %#Ix\n", pointer_wparam[1] ); + todo_wine ok( LOWORD( pointer_wparam[1] ) == id, "got wparam %#Ix\n", pointer_wparam[1] ); todo_wine ok( LOWORD( pointer_lparam[1] ) * 128 / width == 0x08, "got lparam %#Ix\n", pointer_lparam[1] ); @@ -2141,20 +2138,16 @@ static void test_hid_touch_screen(void) ok( res == 0, "WaitForSingleObject returned %#lx\n", res ); res = msg_wait_for_events( 1, &touchleave_event, 10 ); ok( res == WAIT_TIMEOUT, "WaitForSingleObject returned %#lx\n", res ); - todo_wine ok( pointer_enter_count == 1, "got pointer_enter_count %u\n", pointer_enter_count ); ok( pointer_up_count == 0, "got pointer_up_count %u\n", pointer_up_count ); expect_flags = POINTER_MESSAGE_FLAG_PRIMARY | POINTER_MESSAGE_FLAG_CONFIDENCE | POINTER_MESSAGE_FLAG_FIRSTBUTTON | POINTER_MESSAGE_FLAG_NEW | POINTER_MESSAGE_FLAG_INRANGE | POINTER_MESSAGE_FLAG_INCONTACT; - todo_wine + todo_wine /* missing POINTER_MESSAGE_FLAG_FIRSTBUTTON */ ok( HIWORD( pointer_wparam[0] ) == expect_flags, "got wparam %#Ix\n", pointer_wparam[0] ); - todo_wine ok( LOWORD( pointer_wparam[0] ) > 0, "got wparam %#Ix\n", pointer_wparam[0] ); - todo_wine ok( LOWORD( pointer_lparam[0] ) * 128 / width == 0x08, "got lparam %#Ix\n", pointer_lparam[0] ); - todo_wine ok( HIWORD( pointer_lparam[0] ) * 128 / height == 0x10, "got lparam %#Ix\n", pointer_lparam[0] ); ok( pointer_wparam[1] == 0, "got wparam %#Ix\n", pointer_wparam[1] ); ok( pointer_lparam[1] == 0, "got lparam %#Ix\n", pointer_lparam[1] ); @@ -2167,7 +2160,6 @@ static void test_hid_touch_screen(void) bus_send_hid_input( file, &desc, &touch_release, sizeof(touch_release) ); res = msg_wait_for_events( 1, &touchleave_event, 1000 ); - todo_wine ok( res == 0, "WaitForSingleObject returned %#lx\n", res ); res = msg_wait_for_events( 1, &touchdown_event, 10 ); ok( res == WAIT_TIMEOUT, "WaitForSingleObject returned %#lx\n", res ); @@ -2178,7 +2170,6 @@ static void test_hid_touch_screen(void) ok( HIWORD( pointer_wparam[0] ) == expect_flags || broken(HIWORD( pointer_wparam[0] ) == (expect_flags & ~POINTER_MESSAGE_FLAG_CONFIDENCE)), /* Win8 32bit */ "got wparam %#Ix\n", pointer_wparam[0] ); - todo_wine ok( LOWORD( pointer_wparam[0] ) == id, "got wparam %#Ix\n", pointer_wparam[0] ); ok( LOWORD( pointer_lparam[0] ) * 128 / width == 0x08, "got lparam %#Ix\n", pointer_lparam[0] ); ok( HIWORD( pointer_lparam[0] ) * 128 / height == 0x10, "got lparam %#Ix\n", pointer_lparam[0] ); @@ -2197,34 +2188,27 @@ static void test_hid_touch_screen(void) ok( res == 0, "WaitForSingleObject returned %#lx\n", res ); res = msg_wait_for_events( 1, &touchleave_event, 10 ); ok( res == WAIT_TIMEOUT, "WaitForSingleObject returned %#lx\n", res ); - todo_wine ok( pointer_enter_count == 2, "got pointer_enter_count %u\n", pointer_enter_count ); ok( pointer_up_count == 0, "got pointer_up_count %u\n", pointer_up_count ); expect_flags = POINTER_MESSAGE_FLAG_PRIMARY | POINTER_MESSAGE_FLAG_CONFIDENCE | POINTER_MESSAGE_FLAG_FIRSTBUTTON | POINTER_MESSAGE_FLAG_NEW | POINTER_MESSAGE_FLAG_INRANGE | POINTER_MESSAGE_FLAG_INCONTACT; - todo_wine + todo_wine /* missing POINTER_MESSAGE_FLAG_FIRSTBUTTON */ ok( HIWORD( pointer_wparam[0] ) == expect_flags, "got wparam %#Ix\n", pointer_wparam[0] ); - todo_wine ok( LOWORD( pointer_wparam[0] ) > 0, "got wparam %#Ix\n", pointer_wparam[0] ); - todo_wine ok( LOWORD( pointer_lparam[0] ) * 128 / width == 0x08, "got lparam %#Ix\n", pointer_lparam[0] ); - todo_wine ok( HIWORD( pointer_lparam[0] ) * 128 / height == 0x10, "got lparam %#Ix\n", pointer_lparam[0] ); id = LOWORD( pointer_wparam[0] ); expect_flags = POINTER_MESSAGE_FLAG_CONFIDENCE | POINTER_MESSAGE_FLAG_FIRSTBUTTON | POINTER_MESSAGE_FLAG_NEW | POINTER_MESSAGE_FLAG_INRANGE | POINTER_MESSAGE_FLAG_INCONTACT; - todo_wine + todo_wine /* missing POINTER_MESSAGE_FLAG_FIRSTBUTTON */ ok( HIWORD( pointer_wparam[1] ) == expect_flags || broken(HIWORD( pointer_wparam[1] ) == (expect_flags & ~POINTER_MESSAGE_FLAG_CONFIDENCE)), /* Win8 32bit */ "got wparam %#Ix\n", pointer_wparam[1] ); - todo_wine ok( LOWORD( pointer_wparam[1] ) == id + 1, "got wparam %#Ix\n", pointer_wparam[1] ); - todo_wine ok( LOWORD( pointer_lparam[1] ) * 128 / width == 0x18, "got lparam %#Ix\n", pointer_lparam[1] ); - todo_wine ok( HIWORD( pointer_lparam[1] ) * 128 / height == 0x20, "got lparam %#Ix\n", pointer_lparam[1] ); @@ -2234,10 +2218,8 @@ static void test_hid_touch_screen(void) bus_send_hid_input( file, &desc, &touch_release, sizeof(touch_release) ); res = msg_wait_for_events( 1, &touchleave_event, 1000 ); - todo_wine ok( res == 0, "WaitForSingleObject returned %#lx\n", res ); res = msg_wait_for_events( 1, &touchleave_event, 1000 ); - todo_wine ok( res == 0, "WaitForSingleObject returned %#lx\n", res ); res = msg_wait_for_events( 1, &touchdown_event, 10 ); ok( res == WAIT_TIMEOUT, "WaitForSingleObject returned %#lx\n", res ); @@ -2248,7 +2230,6 @@ static void test_hid_touch_screen(void) ok( HIWORD( pointer_wparam[0] ) == expect_flags || broken(HIWORD( pointer_wparam[0] ) == (expect_flags & ~POINTER_MESSAGE_FLAG_CONFIDENCE)), /* Win8 32bit */ "got wparam %#Ix\n", pointer_wparam[0] ); - todo_wine ok( LOWORD( pointer_wparam[0] ) == id, "got wparam %#Ix\n", pointer_wparam[0] ); ok( LOWORD( pointer_lparam[0] ) * 128 / width == 0x08, "got lparam %#Ix\n", pointer_lparam[0] ); ok( HIWORD( pointer_lparam[0] ) * 128 / height == 0x10, "got lparam %#Ix\n", pointer_lparam[0] ); @@ -2257,7 +2238,6 @@ static void test_hid_touch_screen(void) ok( HIWORD( pointer_wparam[1] ) == expect_flags || broken(HIWORD( pointer_wparam[1] ) == (expect_flags & ~POINTER_MESSAGE_FLAG_CONFIDENCE)), /* Win8 32bit */ "got wparam %#Ix\n", pointer_wparam[1] ); - todo_wine ok( LOWORD( pointer_wparam[1] ) == id + 1, "got wparam %#Ix\n", pointer_wparam[1] ); ok( LOWORD( pointer_lparam[1] ) * 128 / width == 0x18, "got lparam %#Ix\n", pointer_lparam[1] ); ok( HIWORD( pointer_lparam[1] ) * 128 / height == 0x20, "got lparam %#Ix\n", pointer_lparam[1] ); diff --git a/server/queue.c b/server/queue.c index 91284f1da17..bc62c5f1b9d 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2229,10 +2229,17 @@ struct pointer static void queue_pointer_message( struct pointer *pointer ) { + static const unsigned int messages[][2] = + { + {WM_POINTERUPDATE, 0}, + {WM_POINTERENTER, WM_POINTERDOWN}, + {WM_POINTERUP, WM_POINTERLEAVE}, + }; struct hw_msg_source source = { IMDT_UNAVAILABLE, IMDT_TOUCH }; struct desktop *desktop = pointer->desktop; const hw_input_t *input = &pointer->input; - unsigned int wparam = input->hw.wparam; + unsigned int i, wparam = input->hw.wparam; + timeout_t time = get_tick_count(); user_handle_t win = pointer->win; rectangle_t top_rect; struct message *msg; @@ -2244,16 +2251,19 @@ static void queue_pointer_message( struct pointer *pointer ) if (pointer->primary) wparam |= POINTER_MESSAGE_FLAG_PRIMARY << 16; - if (!(msg = alloc_hardware_message( 0, source, get_tick_count(), 0 ))) return; + for (i = 0; i < 2 && messages[input->hw.msg - WM_POINTERUPDATE][i]; i++) + { + if (!(msg = alloc_hardware_message( 0, source, time, 0 ))) return; - msg->win = get_user_full_handle( win ); - msg->msg = input->hw.msg; - msg->wparam = wparam; - msg->lparam = MAKELONG(x, y); - msg->x = desktop->cursor.x; - msg->y = desktop->cursor.y; + msg->win = get_user_full_handle( win ); + msg->msg = messages[input->hw.msg - WM_POINTERUPDATE][i]; + msg->wparam = wparam; + msg->lparam = MAKELONG(x, y); + msg->x = desktop->cursor.x; + msg->y = desktop->cursor.y; - queue_hardware_message( desktop, msg, 1 ); + queue_hardware_message( desktop, msg, 1 ); + } if (input->hw.msg == WM_POINTERUP) {