user32: Correctly update caret state in the server in SetCaretPos.

Signed-off-by: Anton Baskanov <baskanov@gmail.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Anton Baskanov 2015-12-31 17:39:02 +01:00 committed by Alexandre Julliard
parent 5d9d6e494f
commit 9220556560
4 changed files with 29 additions and 8 deletions

View File

@ -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 );

View File

@ -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 */

View File

@ -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 */

View File

@ -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;
}
}
}