user32: Set correct caret state in the server in SetCaretPos (try 3)
Anton Baskanov
baskanov at gmail.com
Tue Dec 22 10:28:40 CST 2015
Signed-off-by: Anton Baskanov <baskanov at gmail.com>
The code in SetCaretPos doesn't change the caret state if it's position is unchanged.
Reflect this at the server side to avoid caret corruption.
try2:
- fixed incorrect if statement in the server
try3:
- fixed multiline comment
---
dlls/user32/caret.c | 2 +-
server/protocol.def | 3 ++-
server/queue.c | 5 +++++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/caret.c b/dlls/user32/caret.c
index 53bb5b4..e34d264 100644
--- a/dlls/user32/caret.c
+++ b/dlls/user32/caret.c
@@ -256,7 +256,7 @@ BOOL WINAPI SetCaretPos( INT x, INT y )
req->x = x;
req->y = y;
req->hide = 0;
- req->state = 1;
+ req->state = -2; /* set to 'on' only if the position has changed */
if ((ret = !wine_server_call_err( req )))
{
hwnd = wine_server_ptr_handle( reply->full_handle );
diff --git a/server/protocol.def b/server/protocol.def
index bfb9089..b62dfc7 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2978,7 +2978,8 @@ enum coords_relative
int x; /* caret x position */
int y; /* caret y position */
int hide; /* increment for hide count (can be negative to show it) */
- int state; /* caret state (1=on, 0=off, -1=toggle current state) */
+ int state; /* caret state (1=on, 0=off, -1=toggle current state, */
+ /* -2=on if the position differs, unchanged otherwise) */
@REPLY
user_handle_t full_handle; /* handle to the current caret window */
rectangle_t old_rect; /* previous caret rectangle */
diff --git a/server/queue.c b/server/queue.c
index 3099e12..0288509 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -3040,6 +3040,11 @@ DECL_HANDLER(set_caret_info)
if (req->flags & SET_CARET_STATE)
{
if (req->state == -1) input->caret_state = !input->caret_state;
+ else if (req->state == -2)
+ {
+ if (req->x != reply->old_rect.left || req->y != reply->old_rect.top)
+ input->caret_state = 1;
+ }
else input->caret_state = !!req->state;
}
}
--
2.1.0
More information about the wine-patches
mailing list