From: Rémi Bernon rbernon@codeweavers.com
--- 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 0b9430c5f4d..18001fb9a9a 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) {
From: Rémi Bernon rbernon@codeweavers.com
--- server/queue.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/server/queue.c b/server/queue.c index 18001fb9a9a..91090174ec9 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2221,13 +2221,22 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c struct pointer { struct list entry; + struct timeout_user *timeout; struct desktop *desktop; user_handle_t win; int primary; hw_input_t input; };
-static void queue_pointer_message( struct pointer *pointer ) +static void queue_pointer_message( struct pointer *pointer, int repeated ); + +static void pointer_message_timeout( void *private ) +{ + struct pointer *pointer = private; + queue_pointer_message( pointer, 1 ); +} + +static void queue_pointer_message( struct pointer *pointer, int repeated ) { static const unsigned int messages[][2] = { @@ -2265,7 +2274,13 @@ static void queue_pointer_message( struct pointer *pointer ) queue_hardware_message( desktop, msg, 1 ); }
- if (input->hw.msg == WM_POINTERUP) + if (input->hw.msg != WM_POINTERUP) + { + pointer->input.hw.msg = WM_POINTERUPDATE; + pointer->input.hw.wparam &= ~(POINTER_MESSAGE_FLAG_NEW << 16); + pointer->timeout = add_timeout_user( -160000, pointer_message_timeout, pointer ); + } + else { list_remove( &pointer->entry ); free( pointer ); @@ -2280,6 +2295,7 @@ static struct pointer *find_pointer_from_id( struct desktop *desktop, unsigned i if (LOWORD(pointer->input.hw.wparam) == id) return pointer;
pointer = mem_alloc( sizeof(struct pointer) ); + pointer->timeout = NULL; pointer->desktop = desktop; pointer->primary = list_empty( &desktop->pointers ); list_add_tail( &desktop->pointers, &pointer->entry ); @@ -2321,10 +2337,11 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ if (input->hw.msg == WM_POINTERDOWN || input->hw.msg == WM_POINTERUP || input->hw.msg == WM_POINTERUPDATE) { pointer = find_pointer_from_id( desktop, LOWORD(input->hw.wparam) ); + if (pointer->timeout) remove_timeout_user( pointer->timeout ); pointer->input = *input; pointer->win = win;
- queue_pointer_message( pointer ); + queue_pointer_message( pointer, 0 ); return; }
@@ -2661,6 +2678,7 @@ void free_pointers( struct desktop *desktop ) LIST_FOR_EACH_ENTRY_SAFE( pointer, next, &desktop->pointers, struct pointer, entry ) { list_remove( &pointer->entry ); + if (pointer->timeout) remove_timeout_user( pointer->timeout ); free( pointer ); } }
From: Rémi Bernon rbernon@codeweavers.com
--- server/queue.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/server/queue.c b/server/queue.c index 91090174ec9..cf46db23089 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2274,6 +2274,23 @@ static void queue_pointer_message( struct pointer *pointer, int repeated ) queue_hardware_message( desktop, msg, 1 ); }
+ if (!repeated && pointer->primary && (msg = alloc_hardware_message( 0xff515700, source, time, 0 ))) + { + unsigned int message = WM_MOUSEMOVE; + if (input->hw.msg == WM_POINTERDOWN) message = WM_LBUTTONDOWN; + else if (input->hw.msg == WM_POINTERUP) message = WM_LBUTTONUP; + + msg->win = get_user_full_handle( win ); + msg->msg = message; + msg->wparam = 0; + msg->lparam = 0; + msg->x = x; + msg->y = y; + + if (!send_hook_ll_message( desktop, msg, input, NULL )) + queue_hardware_message( desktop, msg, 0 ); + } + if (input->hw.msg != WM_POINTERUP) { pointer->input.hw.msg = WM_POINTERUPDATE;