From a3eda784a5175fee1efd07fac407c8c9e27bfb3b Mon Sep 17 00:00:00 2001 From: Jose Carlos Jesus Date: Fri, 16 Sep 2022 16:50:27 +0100 Subject: [PATCH] [COMCTL32] Don't hardcode dwCaretWidth parameter while calling CreateCaret Also replace 0 with NULL for the second argument of the function call. CORE-18151 --- dll/win32/comctl32/edit.c | 8 +++++++- win32ss/user/user32/controls/edit.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dll/win32/comctl32/edit.c b/dll/win32/comctl32/edit.c index a568b060fd9..07277740168 100644 --- a/dll/win32/comctl32/edit.c +++ b/dll/win32/comctl32/edit.c @@ -3696,8 +3696,10 @@ static void EDIT_WM_SetFocus(HTHEME theme, EDITSTATE *es) #ifdef __REACTOS__ SystemParametersInfo(SPI_GETCARETWIDTH, 0, &es->dwCaretWidth, 0); -#endif + CreateCaret(es->hwndSelf, NULL, es->dwCaretWidth, es->line_height); +#else CreateCaret(es->hwndSelf, 0, 1, es->line_height); +#endif EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP); ShowCaret(es->hwndSelf); EDIT_NOTIFY_PARENT(es, EN_SETFOCUS); @@ -3752,7 +3754,11 @@ static void EDIT_WM_SetFont(EDITSTATE *es, HFONT font, BOOL redraw) EDIT_UpdateText(es, NULL, TRUE); if (es->flags & EF_FOCUSED) { DestroyCaret(); +#ifdef __REACTOS__ + CreateCaret(es->hwndSelf, NULL, es->dwCaretWidth, es->line_height); +#else CreateCaret(es->hwndSelf, 0, 1, es->line_height); +#endif EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP); ShowCaret(es->hwndSelf); diff --git a/win32ss/user/user32/controls/edit.c b/win32ss/user/user32/controls/edit.c index bed1ad46fe5..38e17fc12d1 100644 --- a/win32ss/user/user32/controls/edit.c +++ b/win32ss/user/user32/controls/edit.c @@ -3910,8 +3910,10 @@ static void EDIT_WM_SetFocus(EDITSTATE *es) #ifdef __REACTOS__ SystemParametersInfo(SPI_GETCARETWIDTH, 0, &es->dwCaretWidth, 0); -#endif + CreateCaret(es->hwndSelf, NULL, es->dwCaretWidth, es->line_height); +#else CreateCaret(es->hwndSelf, 0, 1, es->line_height); +#endif EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP); ShowCaret(es->hwndSelf); @@ -3962,7 +3964,11 @@ static void EDIT_WM_SetFont(EDITSTATE *es, HFONT font, BOOL redraw) EDIT_UpdateText(es, NULL, TRUE); if (es->flags & EF_FOCUSED) { DestroyCaret(); +#ifdef __REACTOS__ + CreateCaret(es->hwndSelf, NULL, es->dwCaretWidth, es->line_height); +#else CreateCaret(es->hwndSelf, 0, 1, es->line_height); +#endif EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP); ShowCaret(es->hwndSelf);