mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
This commit is contained in:
parent
f5f1c89973
commit
869b164ece
@ -4473,16 +4473,14 @@ fi
|
||||
# | * [#35907] Fix caps lock state issues with multiple processes
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/comctl32/tests/listview.c, server/queue.c
|
||||
# | * server/queue.c
|
||||
# |
|
||||
if test "$enable_server_Key_State" -eq 1; then
|
||||
patch_apply server-Key_State/0001-server-Introduce-a-helper-function-to-update-the-thr.patch
|
||||
patch_apply server-Key_State/0002-server-Implement-locking-and-synchronization-of-keys.patch
|
||||
patch_apply server-Key_State/0003-server-Introduce-a-shadow-keystate-array-to-sync-key.patch
|
||||
(
|
||||
echo '+ { "Sebastian Lackner", "server: Introduce a helper function to update the thread_input key state.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "server: Implement locking and synchronization of keystate buffer.", 2 },';
|
||||
echo '+ { "Sebastian Lackner", "server: Introduce a shadow keystate array to sync keystates only on changes.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "server: Implement locking and synchronization of keystate buffer.", 3 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
@ -1,39 +1,28 @@
|
||||
From 8be0b58eb1712de2f8ca04842fbd22cf5faa5f38 Mon Sep 17 00:00:00 2001
|
||||
From 6341882a5acdd20761caaf57b82b9397fd0eca5a Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 10 Jul 2015 16:13:53 +0200
|
||||
Subject: server: Implement locking and synchronization of keystate buffer.
|
||||
(rev 2)
|
||||
(rev 3)
|
||||
|
||||
---
|
||||
dlls/comctl32/tests/listview.c | 1 +
|
||||
server/queue.c | 43 +++++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 43 insertions(+), 1 deletion(-)
|
||||
server/queue.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 57 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
|
||||
index 3edb25a..3ec4181 100644
|
||||
--- a/dlls/comctl32/tests/listview.c
|
||||
+++ b/dlls/comctl32/tests/listview.c
|
||||
@@ -2322,6 +2322,7 @@ static void test_multiselect(void)
|
||||
|
||||
selected_count = (int)SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
|
||||
|
||||
+ todo_wine
|
||||
ok((task.result == -1 ? item_count : task.result) == selected_count, "Failed multiple selection %s. There should be %d selected items (is %d)\n", task.descr, item_count, selected_count);
|
||||
|
||||
/* Set SHIFT key released */
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index e4b2969..ab8bb29 100644
|
||||
index e4b2969..4b4ff5d 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -113,6 +113,7 @@ struct thread_input
|
||||
@@ -113,7 +113,9 @@ struct thread_input
|
||||
user_handle_t cursor; /* current cursor */
|
||||
int cursor_count; /* cursor show count */
|
||||
struct list msg_list; /* list of hardware messages */
|
||||
+ int lock_count; /* lock counter for keystate */
|
||||
unsigned char keystate[256]; /* state of each key */
|
||||
+ unsigned char shadow_keystate[256]; /* shadow copy of keystate */
|
||||
};
|
||||
|
||||
@@ -124,6 +125,7 @@ struct msg_queue
|
||||
struct msg_queue
|
||||
@@ -124,6 +126,7 @@ struct msg_queue
|
||||
unsigned int wake_mask; /* wakeup mask */
|
||||
unsigned int changed_bits; /* changed wakeup bits */
|
||||
unsigned int changed_mask; /* changed wakeup mask */
|
||||
@ -41,7 +30,7 @@ index e4b2969..ab8bb29 100644
|
||||
int paint_count; /* pending paint messages count */
|
||||
int hotkey_count; /* pending hotkey messages count */
|
||||
int quit_message; /* is there a pending quit message? */
|
||||
@@ -251,6 +253,7 @@ static struct thread_input *create_thread_input( struct thread *thread )
|
||||
@@ -251,9 +254,11 @@ static struct thread_input *create_thread_input( struct thread *thread )
|
||||
input->move_size = 0;
|
||||
input->cursor = 0;
|
||||
input->cursor_count = 0;
|
||||
@ -49,7 +38,11 @@ index e4b2969..ab8bb29 100644
|
||||
list_init( &input->msg_list );
|
||||
set_caret_window( input, 0 );
|
||||
memset( input->keystate, 0, sizeof(input->keystate) );
|
||||
@@ -284,6 +287,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
|
||||
+ memset( input->shadow_keystate, 0, sizeof(input->shadow_keystate) );
|
||||
|
||||
if (!(input->desktop = get_thread_desktop( thread, 0 /* FIXME: access rights */ )))
|
||||
{
|
||||
@@ -284,6 +289,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
|
||||
queue->wake_mask = 0;
|
||||
queue->changed_bits = 0;
|
||||
queue->changed_mask = 0;
|
||||
@ -57,7 +50,7 @@ index e4b2969..ab8bb29 100644
|
||||
queue->paint_count = 0;
|
||||
queue->hotkey_count = 0;
|
||||
queue->quit_message = 0;
|
||||
@@ -327,8 +331,10 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_
|
||||
@@ -327,8 +333,10 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_
|
||||
}
|
||||
if (queue->input)
|
||||
{
|
||||
@ -68,7 +61,7 @@ index e4b2969..ab8bb29 100644
|
||||
}
|
||||
queue->input = (struct thread_input *)grab_object( new_input );
|
||||
new_input->cursor_count += queue->cursor_count;
|
||||
@@ -987,6 +993,7 @@ static void msg_queue_destroy( struct object *obj )
|
||||
@@ -987,6 +995,7 @@ static void msg_queue_destroy( struct object *obj )
|
||||
free( timer );
|
||||
}
|
||||
if (queue->timeout) remove_timeout_user( queue->timeout );
|
||||
@ -76,7 +69,20 @@ index e4b2969..ab8bb29 100644
|
||||
queue->input->cursor_count -= queue->cursor_count;
|
||||
release_object( queue->input );
|
||||
if (queue->hooks) release_object( queue->hooks );
|
||||
@@ -1321,9 +1328,22 @@ static void update_key_state( struct desktop *desktop, unsigned char *keystate,
|
||||
@@ -1087,7 +1096,11 @@ int attach_thread_input( struct thread *thread_from, struct thread *thread_to )
|
||||
}
|
||||
|
||||
ret = assign_thread_input( thread_from, input );
|
||||
- if (ret) memset( input->keystate, 0, sizeof(input->keystate) );
|
||||
+ if (ret)
|
||||
+ {
|
||||
+ memset( input->keystate, 0, sizeof(input->keystate) );
|
||||
+ memset( input->shadow_keystate, 0, sizeof(input->shadow_keystate) );
|
||||
+ }
|
||||
release_object( input );
|
||||
return ret;
|
||||
}
|
||||
@@ -1321,9 +1334,30 @@ static void update_key_state( struct desktop *desktop, unsigned char *keystate,
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,10 +91,18 @@ index e4b2969..ab8bb29 100644
|
||||
+{
|
||||
+ if (!input->lock_count)
|
||||
+ {
|
||||
+ unsigned char *shadow_keystate = input->shadow_keystate;
|
||||
+ unsigned char *keystate = input->keystate;
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ for (i = 0; i < 256; i++)
|
||||
+ keystate[i] = input->desktop->keystate[i] & ~0x40;
|
||||
+ {
|
||||
+ if (input->desktop->keystate[i] != shadow_keystate[i])
|
||||
+ {
|
||||
+ keystate[i] = input->desktop->keystate[i] & ~0x40;
|
||||
+ shadow_keystate[i] = input->desktop->keystate[i];
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
@ -99,7 +113,7 @@ index e4b2969..ab8bb29 100644
|
||||
update_key_state( input->desktop, input->keystate, msg );
|
||||
}
|
||||
|
||||
@@ -1532,6 +1552,15 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
|
||||
@@ -1532,6 +1566,15 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
|
||||
else
|
||||
{
|
||||
msg->unique_id = 0; /* will be set once we return it to the app */
|
||||
@ -115,7 +129,7 @@ index e4b2969..ab8bb29 100644
|
||||
list_add_tail( &input->msg_list, &msg->entry );
|
||||
set_queue_bits( thread->queue, get_hardware_msg_bit(msg) );
|
||||
}
|
||||
@@ -2411,6 +2440,13 @@ DECL_HANDLER(get_message)
|
||||
@@ -2411,6 +2454,13 @@ DECL_HANDLER(get_message)
|
||||
queue->last_get_msg = current_time;
|
||||
if (!filter) filter = QS_ALLINPUT;
|
||||
|
||||
@ -129,7 +143,7 @@ index e4b2969..ab8bb29 100644
|
||||
/* first check for sent messages */
|
||||
if ((ptr = list_head( &queue->msg_list[SEND_MESSAGE] )))
|
||||
{
|
||||
@@ -2861,7 +2897,12 @@ DECL_HANDLER(get_key_state)
|
||||
@@ -2861,7 +2911,12 @@ DECL_HANDLER(get_key_state)
|
||||
if (!(thread = get_thread_from_id( req->tid ))) return;
|
||||
if (thread->queue)
|
||||
{
|
||||
@ -144,5 +158,5 @@ index e4b2969..ab8bb29 100644
|
||||
release_object( thread );
|
||||
return;
|
||||
--
|
||||
2.4.5
|
||||
2.5.0
|
||||
|
||||
|
@ -1,79 +0,0 @@
|
||||
From 6cf46edbed0c41632b183064be0332387275c655 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Tue, 2 Jun 2015 19:06:56 +0200
|
||||
Subject: server: Introduce a shadow keystate array to sync keystates only on
|
||||
changes.
|
||||
|
||||
---
|
||||
dlls/comctl32/tests/listview.c | 1 -
|
||||
server/queue.c | 18 ++++++++++++++++--
|
||||
2 files changed, 16 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
|
||||
index 3ec4181..3edb25a 100644
|
||||
--- a/dlls/comctl32/tests/listview.c
|
||||
+++ b/dlls/comctl32/tests/listview.c
|
||||
@@ -2322,7 +2322,6 @@ static void test_multiselect(void)
|
||||
|
||||
selected_count = (int)SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
|
||||
|
||||
- todo_wine
|
||||
ok((task.result == -1 ? item_count : task.result) == selected_count, "Failed multiple selection %s. There should be %d selected items (is %d)\n", task.descr, item_count, selected_count);
|
||||
|
||||
/* Set SHIFT key released */
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index f278861..76fa3e3 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -115,6 +115,7 @@ struct thread_input
|
||||
struct list msg_list; /* list of hardware messages */
|
||||
int lock_count; /* lock counter for keystate */
|
||||
unsigned char keystate[256]; /* state of each key */
|
||||
+ unsigned char shadow_keystate[256]; /* shadow copy of keystate */
|
||||
};
|
||||
|
||||
struct msg_queue
|
||||
@@ -257,6 +258,7 @@ static struct thread_input *create_thread_input( struct thread *thread )
|
||||
list_init( &input->msg_list );
|
||||
set_caret_window( input, 0 );
|
||||
memset( input->keystate, 0, sizeof(input->keystate) );
|
||||
+ memset( input->shadow_keystate, 0, sizeof(input->shadow_keystate) );
|
||||
|
||||
if (!(input->desktop = get_thread_desktop( thread, 0 /* FIXME: access rights */ )))
|
||||
{
|
||||
@@ -1094,7 +1096,11 @@ int attach_thread_input( struct thread *thread_from, struct thread *thread_to )
|
||||
}
|
||||
|
||||
ret = assign_thread_input( thread_from, input );
|
||||
- if (ret) memset( input->keystate, 0, sizeof(input->keystate) );
|
||||
+ if (ret)
|
||||
+ {
|
||||
+ memset( input->keystate, 0, sizeof(input->keystate) );
|
||||
+ memset( input->shadow_keystate, 0, sizeof(input->shadow_keystate) );
|
||||
+ }
|
||||
release_object( input );
|
||||
return ret;
|
||||
}
|
||||
@@ -1333,10 +1339,18 @@ static void synchronize_input_key_state( struct thread_input *input )
|
||||
{
|
||||
if (!input->lock_count)
|
||||
{
|
||||
+ unsigned char *shadow_keystate = input->shadow_keystate;
|
||||
unsigned char *keystate = input->keystate;
|
||||
unsigned int i;
|
||||
+
|
||||
for (i = 0; i < 256; i++)
|
||||
- keystate[i] = input->desktop->keystate[i] & ~0x40;
|
||||
+ {
|
||||
+ if (input->desktop->keystate[i] != shadow_keystate[i])
|
||||
+ {
|
||||
+ keystate[i] = input->desktop->keystate[i] & ~0x40;
|
||||
+ shadow_keystate[i] = input->desktop->keystate[i];
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.4.2
|
||||
|
Loading…
Reference in New Issue
Block a user