Anton Baskanov : user32: Correctly update caret state in the server in SetCaretPos.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jan 25 09:27:58 CST 2016
Module: wine
Branch: master
Commit: 92205565607bdcca256d0dd15cc52dfe01f4eed0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=92205565607bdcca256d0dd15cc52dfe01f4eed0
Author: Anton Baskanov <baskanov at gmail.com>
Date: Thu Dec 31 17:39:02 2015 +0100
user32: Correctly update caret state in the server in SetCaretPos.
Signed-off-by: Anton Baskanov <baskanov at gmail.com>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/caret.c | 8 ++++----
include/wine/server_protocol.h | 9 ++++++++-
server/protocol.def | 9 ++++++++-
server/queue.c | 11 +++++++++--
4 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/dlls/user32/caret.c b/dlls/user32/caret.c
index 53bb5b4..686dade 100644
--- a/dlls/user32/caret.c
+++ b/dlls/user32/caret.c
@@ -86,7 +86,7 @@ static void CALLBACK CARET_Callback( HWND hwnd, UINT msg, UINT_PTR id, DWORD cti
req->x = 0;
req->y = 0;
req->hide = 0;
- req->state = -1; /* toggle current state */
+ req->state = CARET_STATE_TOGGLE;
if ((ret = !wine_server_call( req )))
{
hwnd = wine_server_ptr_handle( reply->full_handle );
@@ -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 = CARET_STATE_ON_IF_MOVED;
if ((ret = !wine_server_call_err( req )))
{
hwnd = wine_server_ptr_handle( reply->full_handle );
@@ -300,7 +300,7 @@ BOOL WINAPI HideCaret( HWND hwnd )
req->x = 0;
req->y = 0;
req->hide = 1;
- req->state = 0;
+ req->state = CARET_STATE_OFF;
if ((ret = !wine_server_call_err( req )))
{
hwnd = wine_server_ptr_handle( reply->full_handle );
@@ -339,7 +339,7 @@ BOOL WINAPI ShowCaret( HWND hwnd )
req->x = 0;
req->y = 0;
req->hide = -1;
- req->state = 1;
+ req->state = CARET_STATE_ON;
if ((ret = !wine_server_call_err( req )))
{
hwnd = wine_server_ptr_handle( reply->full_handle );
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 61e6d3f..a870874 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -4222,6 +4222,13 @@ struct set_caret_info_reply
#define SET_CARET_POS 0x01
#define SET_CARET_HIDE 0x02
#define SET_CARET_STATE 0x04
+enum caret_state
+{
+ CARET_STATE_OFF,
+ CARET_STATE_ON,
+ CARET_STATE_TOGGLE,
+ CARET_STATE_ON_IF_MOVED
+};
@@ -6157,6 +6164,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
-#define SERVER_PROTOCOL_VERSION 500
+#define SERVER_PROTOCOL_VERSION 501
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/protocol.def b/server/protocol.def
index 2819382..cde8f63 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2968,7 +2968,7 @@ 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 (see below) */
@REPLY
user_handle_t full_handle; /* handle to the current caret window */
rectangle_t old_rect; /* previous caret rectangle */
@@ -2978,6 +2978,13 @@ enum coords_relative
#define SET_CARET_POS 0x01 /* set the caret position from x,y */
#define SET_CARET_HIDE 0x02 /* increment the caret hide count */
#define SET_CARET_STATE 0x04 /* set the caret on/off state */
+enum caret_state
+{
+ CARET_STATE_OFF, /* off */
+ CARET_STATE_ON, /* on */
+ CARET_STATE_TOGGLE, /* toggle current state */
+ CARET_STATE_ON_IF_MOVED /* on if the position differs, unchanged otherwise */
+};
/* Set a window hook */
diff --git a/server/queue.c b/server/queue.c
index 3099e12..7fe0d03 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -3039,8 +3039,15 @@ DECL_HANDLER(set_caret_info)
}
if (req->flags & SET_CARET_STATE)
{
- if (req->state == -1) input->caret_state = !input->caret_state;
- else input->caret_state = !!req->state;
+ switch (req->state)
+ {
+ case CARET_STATE_OFF: input->caret_state = 0; break;
+ case CARET_STATE_ON: input->caret_state = 1; break;
+ case CARET_STATE_TOGGLE: input->caret_state = !input->caret_state; break;
+ case CARET_STATE_ON_IF_MOVED:
+ if (req->x != reply->old_rect.left || req->y != reply->old_rect.top) input->caret_state = 1;
+ break;
+ }
}
}
More information about the wine-cvs
mailing list