user32: Toggle the caret based on the timer ID in DispatchMessage().
Avoid passing a callback to NtUserSetSystemTimer(); it does not support one. Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
33087806a6
commit
95378c56b8
|
@ -27,6 +27,7 @@
|
|||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "ntuser.h"
|
||||
#include "user_private.h"
|
||||
#include "wine/server.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -40,8 +41,6 @@ typedef struct
|
|||
|
||||
static CARET Caret = { 0, 500 };
|
||||
|
||||
#define TIMERID 0xffff /* system timer id for the caret */
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* CARET_DisplayCaret
|
||||
|
@ -67,10 +66,7 @@ static void CARET_DisplayCaret( HWND hwnd, const RECT *r )
|
|||
}
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* CARET_Callback
|
||||
*/
|
||||
static void CALLBACK CARET_Callback( HWND hwnd, UINT msg, UINT_PTR id, DWORD ctime)
|
||||
void CDECL toggle_caret( HWND hwnd )
|
||||
{
|
||||
BOOL ret;
|
||||
RECT r;
|
||||
|
@ -183,7 +179,7 @@ BOOL WINAPI CreateCaret( HWND hwnd, HBITMAP bitmap, INT width, INT height )
|
|||
if (prev && !hidden) /* hide the previous one */
|
||||
{
|
||||
/* FIXME: won't work if prev belongs to a different process */
|
||||
KillSystemTimer( prev, TIMERID );
|
||||
KillSystemTimer( prev, SYSTEM_TIMER_CARET );
|
||||
if (old_state) CARET_DisplayCaret( prev, &r );
|
||||
}
|
||||
|
||||
|
@ -226,7 +222,7 @@ BOOL WINAPI DestroyCaret(void)
|
|||
if (ret && prev && !hidden)
|
||||
{
|
||||
/* FIXME: won't work if prev belongs to a different process */
|
||||
KillSystemTimer( prev, TIMERID );
|
||||
KillSystemTimer( prev, SYSTEM_TIMER_CARET );
|
||||
if (old_state) CARET_DisplayCaret( prev, &r );
|
||||
}
|
||||
if (Caret.hBmp) DeleteObject( Caret.hBmp );
|
||||
|
@ -274,7 +270,7 @@ BOOL WINAPI SetCaretPos( INT x, INT y )
|
|||
r.left = x;
|
||||
r.top = y;
|
||||
CARET_DisplayCaret( hwnd, &r );
|
||||
NtUserSetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback );
|
||||
NtUserSetSystemTimer( hwnd, SYSTEM_TIMER_CARET, Caret.timeout, NULL );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -314,7 +310,7 @@ BOOL WINAPI HideCaret( HWND hwnd )
|
|||
if (ret && !hidden)
|
||||
{
|
||||
if (old_state) CARET_DisplayCaret( hwnd, &r );
|
||||
KillSystemTimer( hwnd, TIMERID );
|
||||
KillSystemTimer( hwnd, SYSTEM_TIMER_CARET );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -352,7 +348,7 @@ BOOL WINAPI ShowCaret( HWND hwnd )
|
|||
if (ret && (hidden == 1)) /* hidden was 1 so it's now 0 */
|
||||
{
|
||||
CARET_DisplayCaret( hwnd, &r );
|
||||
NtUserSetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback );
|
||||
NtUserSetSystemTimer( hwnd, SYSTEM_TIMER_CARET, Caret.timeout, NULL );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -177,6 +177,7 @@ static const struct user_callbacks user_funcs =
|
|||
rawinput_device_get_usages,
|
||||
register_builtin_classes,
|
||||
SCROLL_SetStandardScrollPainted,
|
||||
toggle_caret,
|
||||
unpack_dde_message,
|
||||
register_imm,
|
||||
unregister_imm,
|
||||
|
|
|
@ -99,6 +99,7 @@ extern HBRUSH SYSCOLOR_Get55AABrush(void) DECLSPEC_HIDDEN;
|
|||
extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN;
|
||||
extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN;
|
||||
extern void CDECL toggle_caret( HWND hwnd ) DECLSPEC_HIDDEN;
|
||||
|
||||
typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
|
||||
LRESULT *result, void *arg );
|
||||
|
|
|
@ -2469,6 +2469,17 @@ LRESULT dispatch_message( const MSG *msg, BOOL ansi )
|
|||
__ENDTRY
|
||||
return retval;
|
||||
}
|
||||
if (msg->message == WM_SYSTIMER)
|
||||
{
|
||||
switch (msg->wParam)
|
||||
{
|
||||
case SYSTEM_TIMER_CARET:
|
||||
if (!user_callbacks) break;
|
||||
user_callbacks->toggle_caret( msg->hwnd );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!msg->hwnd) return 0;
|
||||
|
||||
spy_enter_message( SPY_DISPATCHMESSAGE, msg->hwnd, msg->message, msg->wParam, msg->lParam );
|
||||
|
|
|
@ -51,6 +51,7 @@ struct user_callbacks
|
|||
BOOL (CDECL *rawinput_device_get_usages)(HANDLE handle, USHORT *usage_page, USHORT *usage);
|
||||
void (CDECL *register_builtin_classes)(void);
|
||||
void (WINAPI *set_standard_scroll_painted)( HWND hwnd, INT bar, BOOL visible );
|
||||
void (CDECL *toggle_caret)( HWND hwnd );
|
||||
BOOL (CDECL *unpack_dde_message)( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
|
||||
void **buffer, size_t size );
|
||||
BOOL (WINAPI *register_imm)( HWND hwnd );
|
||||
|
@ -60,6 +61,11 @@ struct user_callbacks
|
|||
#define WM_SYSTIMER 0x0118
|
||||
#define WM_POPUPSYSTEMMENU 0x0313
|
||||
|
||||
enum system_timer_id
|
||||
{
|
||||
SYSTEM_TIMER_CARET = 0xffff,
|
||||
};
|
||||
|
||||
struct user_object
|
||||
{
|
||||
HANDLE handle;
|
||||
|
|
Loading…
Reference in New Issue