Commit 92205565 authored by Anton Baskanov's avatar Anton Baskanov Committed by Alexandre Julliard

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

parent 5d9d6e49
...@@ -86,7 +86,7 @@ static void CALLBACK CARET_Callback( HWND hwnd, UINT msg, UINT_PTR id, DWORD cti ...@@ -86,7 +86,7 @@ static void CALLBACK CARET_Callback( HWND hwnd, UINT msg, UINT_PTR id, DWORD cti
req->x = 0; req->x = 0;
req->y = 0; req->y = 0;
req->hide = 0; req->hide = 0;
req->state = -1; /* toggle current state */ req->state = CARET_STATE_TOGGLE;
if ((ret = !wine_server_call( req ))) if ((ret = !wine_server_call( req )))
{ {
hwnd = wine_server_ptr_handle( reply->full_handle ); hwnd = wine_server_ptr_handle( reply->full_handle );
...@@ -256,7 +256,7 @@ BOOL WINAPI SetCaretPos( INT x, INT y ) ...@@ -256,7 +256,7 @@ BOOL WINAPI SetCaretPos( INT x, INT y )
req->x = x; req->x = x;
req->y = y; req->y = y;
req->hide = 0; req->hide = 0;
req->state = 1; req->state = CARET_STATE_ON_IF_MOVED;
if ((ret = !wine_server_call_err( req ))) if ((ret = !wine_server_call_err( req )))
{ {
hwnd = wine_server_ptr_handle( reply->full_handle ); hwnd = wine_server_ptr_handle( reply->full_handle );
...@@ -300,7 +300,7 @@ BOOL WINAPI HideCaret( HWND hwnd ) ...@@ -300,7 +300,7 @@ BOOL WINAPI HideCaret( HWND hwnd )
req->x = 0; req->x = 0;
req->y = 0; req->y = 0;
req->hide = 1; req->hide = 1;
req->state = 0; req->state = CARET_STATE_OFF;
if ((ret = !wine_server_call_err( req ))) if ((ret = !wine_server_call_err( req )))
{ {
hwnd = wine_server_ptr_handle( reply->full_handle ); hwnd = wine_server_ptr_handle( reply->full_handle );
...@@ -339,7 +339,7 @@ BOOL WINAPI ShowCaret( HWND hwnd ) ...@@ -339,7 +339,7 @@ BOOL WINAPI ShowCaret( HWND hwnd )
req->x = 0; req->x = 0;
req->y = 0; req->y = 0;
req->hide = -1; req->hide = -1;
req->state = 1; req->state = CARET_STATE_ON;
if ((ret = !wine_server_call_err( req ))) if ((ret = !wine_server_call_err( req )))
{ {
hwnd = wine_server_ptr_handle( reply->full_handle ); hwnd = wine_server_ptr_handle( reply->full_handle );
......
...@@ -4222,6 +4222,13 @@ struct set_caret_info_reply ...@@ -4222,6 +4222,13 @@ struct set_caret_info_reply
#define SET_CARET_POS 0x01 #define SET_CARET_POS 0x01
#define SET_CARET_HIDE 0x02 #define SET_CARET_HIDE 0x02
#define SET_CARET_STATE 0x04 #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 ...@@ -6157,6 +6164,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply; struct terminate_job_reply terminate_job_reply;
}; };
#define SERVER_PROTOCOL_VERSION 500 #define SERVER_PROTOCOL_VERSION 501
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -2968,7 +2968,7 @@ enum coords_relative ...@@ -2968,7 +2968,7 @@ enum coords_relative
int x; /* caret x position */ int x; /* caret x position */
int y; /* caret y position */ int y; /* caret y position */
int hide; /* increment for hide count (can be negative to show it) */ 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 @REPLY
user_handle_t full_handle; /* handle to the current caret window */ user_handle_t full_handle; /* handle to the current caret window */
rectangle_t old_rect; /* previous caret rectangle */ rectangle_t old_rect; /* previous caret rectangle */
...@@ -2978,6 +2978,13 @@ enum coords_relative ...@@ -2978,6 +2978,13 @@ enum coords_relative
#define SET_CARET_POS 0x01 /* set the caret position from x,y */ #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_HIDE 0x02 /* increment the caret hide count */
#define SET_CARET_STATE 0x04 /* set the caret on/off state */ #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 */ /* Set a window hook */
......
...@@ -3039,8 +3039,15 @@ DECL_HANDLER(set_caret_info) ...@@ -3039,8 +3039,15 @@ DECL_HANDLER(set_caret_info)
} }
if (req->flags & SET_CARET_STATE) if (req->flags & SET_CARET_STATE)
{ {
if (req->state == -1) input->caret_state = !input->caret_state; switch (req->state)
else input->caret_state = !!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;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment