[ros-diffs] [reactos] 01/02: [WINDOWSX.H] Fix some x64 incompatibilities. (#4768)

2022-10-12 Thread Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6572dd7f489916426dceb01dfb272601a24f5ef9

commit 6572dd7f489916426dceb01dfb272601a24f5ef9
Author: Hermès Bélusca-Maïto 
AuthorDate: Mon Oct 10 22:59:46 2022 +0200
Commit: Hermès Bélusca-Maïto 
CommitDate: Wed Oct 12 16:10:22 2022 +0200

[WINDOWSX.H] Fix some x64 incompatibilities. (#4768)
---
 sdk/include/psdk/windowsx.h | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/sdk/include/psdk/windowsx.h b/sdk/include/psdk/windowsx.h
index 15dc2053bc4..f9df189301e 100644
--- a/sdk/include/psdk/windowsx.h
+++ b/sdk/include/psdk/windowsx.h
@@ -59,7 +59,7 @@
 #define Edit_Enable(hwndCtl,fEnable) EnableWindow((hwndCtl),(fEnable))
 #define Edit_FmtLines(hwndCtl,fAddEOL) 
((BOOL)(DWORD)SendMessage((hwndCtl),EM_FMTLINES,(WPARAM)(BOOL)(fAddEOL),0))
 #define Edit_GetFirstVisibleLine(hwndCtl) 
((int)(DWORD)SendMessage((hwndCtl),EM_GETFIRSTVISIBLELINE,0,0))
-#define Edit_GetHandle(hwndCtl) 
((HLOCAL)(UINT)(DWORD)SendMessage((hwndCtl),EM_GETHANDLE,0,0))
+#define Edit_GetHandle(hwndCtl) 
((HLOCAL)(UINT_PTR)SendMessage((hwndCtl),EM_GETHANDLE,0,0))
 #define Edit_GetLine(hwndCtl,line,lpch,cchMax) ((*((int*)(lpch)) = 
(cchMax)),((int)(DWORD)SendMessage((hwndCtl),EM_GETLINE,(WPARAM)(int)(line),(LPARAM)(LPTSTR)(lpch
 #define Edit_GetLineCount(hwndCtl) 
((int)(DWORD)SendMessage((hwndCtl),EM_GETLINECOUNT,0,0))
 #define Edit_GetModify(hwndCtl) 
((BOOL)(DWORD)SendMessage((hwndCtl),EM_GETMODIFY,0,0))
@@ -76,7 +76,7 @@
 #define Edit_ReplaceSel(hwndCtl,lpszReplace) 
((void)SendMessage((hwndCtl),EM_REPLACESEL,0,(LPARAM)(LPCTSTR)(lpszReplace)))
 #define Edit_Scroll(hwndCtl,dv,dh) 
((void)SendMessage((hwndCtl),EM_LINESCROLL,(WPARAM)(dh),(LPARAM)(dv)))
 #define Edit_ScrollCaret(hwndCtl) 
((BOOL)(DWORD)SendMessage((hwndCtl),EM_SCROLLCARET,0,0))
-#define Edit_SetHandle(hwndCtl,h) 
((void)SendMessage((hwndCtl),EM_SETHANDLE,(WPARAM)(UINT)(HLOCAL)(h),0))
+#define Edit_SetHandle(hwndCtl,h) 
((void)SendMessage((hwndCtl),EM_SETHANDLE,(WPARAM)(UINT_PTR)(HLOCAL)(h),0))
 #define Edit_SetModify(hwndCtl,fModified) 
((void)SendMessage((hwndCtl),EM_SETMODIFY,(WPARAM)(UINT)(fModified),0))
 #define Edit_SetPasswordChar(hwndCtl,ch) 
((void)SendMessage((hwndCtl),EM_SETPASSWORDCHAR,(WPARAM)(UINT)(ch),0))
 #define Edit_SetReadOnly(hwndCtl,fReadOnly) 
((BOOL)(DWORD)SendMessage((hwndCtl),EM_SETREADONLY,(WPARAM)(BOOL)(fReadOnly),0))
@@ -103,13 +103,13 @@
 #define FORWARD_WM_COMPAREITEM(hwnd,lpCompareItem,fn) 
(int)(DWORD)(fn)((hwnd),WM_COMPAREITEM,(WPARAM)(((const 
COMPAREITEMSTRUCT*)(lpCompareItem))->CtlID),(LPARAM)(const 
COMPAREITEMSTRUCT*)(lpCompareItem))
 #define FORWARD_WM_COPY(hwnd,fn) (void)(fn)((hwnd),WM_COPY,0,0)
 #define FORWARD_WM_CREATE(hwnd,lpCreateStruct,fn) 
(BOOL)(DWORD)(fn)((hwnd),WM_CREATE,0,(LPARAM)(LPCREATESTRUCT)(lpCreateStruct))
-#define FORWARD_WM_CTLCOLORBTN(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT)(DWORD)(fn)((hwnd),WM_CTLCOLORBTN,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
-#define FORWARD_WM_CTLCOLORDLG(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT)(DWORD)(fn)((hwnd),WM_CTLCOLORDLG,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
-#define FORWARD_WM_CTLCOLOREDIT(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT)(DWORD)(fn)((hwnd),WM_CTLCOLOREDIT,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
-#define FORWARD_WM_CTLCOLORLISTBOX(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT)(DWORD)(fn)((hwnd),WM_CTLCOLORLISTBOX,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
-#define FORWARD_WM_CTLCOLORMSGBOX(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT)(DWORD)(fn)((hwnd),WM_CTLCOLORMSGBOX,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
-#define FORWARD_WM_CTLCOLORSCROLLBAR(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT)(DWORD)(fn)((hwnd),WM_CTLCOLORSCROLLBAR,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
-#define FORWARD_WM_CTLCOLORSTATIC(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT)(DWORD)(fn)((hwnd),WM_CTLCOLORSTATIC,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
+#define FORWARD_WM_CTLCOLORBTN(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT_PTR)(fn)((hwnd),WM_CTLCOLORBTN,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
+#define FORWARD_WM_CTLCOLORDLG(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT_PTR)(fn)((hwnd),WM_CTLCOLORDLG,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
+#define FORWARD_WM_CTLCOLOREDIT(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT_PTR)(fn)((hwnd),WM_CTLCOLOREDIT,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
+#define FORWARD_WM_CTLCOLORLISTBOX(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT_PTR)(fn)((hwnd),WM_CTLCOLORLISTBOX,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
+#define FORWARD_WM_CTLCOLORMSGBOX(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT_PTR)(fn)((hwnd),WM_CTLCOLORMSGBOX,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
+#define FORWARD_WM_CTLCOLORSCROLLBAR(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT_PTR)(fn)((hwnd),WM_CTLCOLORSCROLLBAR,(WPARAM)(HDC)(hdc),(LPARAM)(HWND)(hwndChild))
+#define FORWARD_WM_CTLCOLORSTATIC(hwnd,hdc,hwndChild,fn) 
(HBRUSH)(UINT_PTR)(fn)((hwnd),WM_CTLCOLORSTATIC,(WPARAM)(HDC)(hdc),(LPARAM

[ros-diffs] [reactos] 02/02: [WINDOWSX.H] Make header compatible with MS PSDK + Add missing original license. (#4768)

2022-10-12 Thread Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0dd6aa6ca5c0f45b37e18e400bb6b05d10d9fd1c

commit 0dd6aa6ca5c0f45b37e18e400bb6b05d10d9fd1c
Author: Hermès Bélusca-Maïto 
AuthorDate: Mon Oct 10 23:12:05 2022 +0200
Commit: Hermès Bélusca-Maïto 
CommitDate: Wed Oct 12 16:10:35 2022 +0200

[WINDOWSX.H] Make header compatible with MS PSDK + Add missing original 
license. (#4768)

To hypothetical future sync'ers: If you ever try to sync this file with
MinGW-w64, please be extremely careful to port all the fixes (including
x64-compatible casting fixes, missing definitions, etc.) that have been
brought to this file along the years by your dear ReactOS colleagues.
---
 sdk/include/psdk/windowsx.h | 239 +---
 1 file changed, 134 insertions(+), 105 deletions(-)

diff --git a/sdk/include/psdk/windowsx.h b/sdk/include/psdk/windowsx.h
index f9df189301e..0d609dfea03 100644
--- a/sdk/include/psdk/windowsx.h
+++ b/sdk/include/psdk/windowsx.h
@@ -1,50 +1,75 @@
-#ifndef _WINDOWSX_H
-#define _WINDOWSX_H
+/*
+windowsx.h - Macro APIs, window message crackers, and control APIs
+
+Written by Anders Norlander 
+
+This file is part of a free library for the Win32 API.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+#ifndef _INC_WINDOWSX
+#define _INC_WINDOWSX
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SNDMSG
+#ifdef __cplusplus
+#define SNDMSG  ::SendMessage
+#else
+#define SNDMSG  SendMessage
+#endif
+#endif /* !SNDMSG */
 
 #define WM_CTLCOLOR 25
 #define Button_Enable(hwndCtl,fEnable) EnableWindow((hwndCtl),(fEnable))
-#define Button_GetCheck(hwndCtl) 
((int)(DWORD)SendMessage((hwndCtl),BM_GETCHECK,0,0))
-#define Button_GetState(hwndCtl) 
((int)(DWORD)SendMessage((hwndCtl),BM_GETSTATE,0,0))
+#define Button_GetCheck(hwndCtl) 
((int)(DWORD)SNDMSG((hwndCtl),BM_GETCHECK,0,0))
+#define Button_GetState(hwndCtl) 
((int)(DWORD)SNDMSG((hwndCtl),BM_GETSTATE,0,0))
 #define Button_GetText(hwndCtl,lpch,cchMax) 
GetWindowText((hwndCtl),(lpch),(cchMax))
 #define Button_GetTextLength(hwndCtl) GetWindowTextLength(hwndCtl)
-#define Button_SetCheck(hwndCtl,check) 
((void)SendMessage((hwndCtl),BM_SETCHECK,(WPARAM)(int)(check),0))
-#define Button_SetState(hwndCtl,state) 
((UINT)(DWORD)SendMessage((hwndCtl),BM_SETSTATE,(WPARAM)(int)(state),0))
-#define Button_SetStyle(hwndCtl,style,fRedraw) 
((void)SendMessage((hwndCtl),BM_SETSTYLE,(WPARAM)LOWORD(style),MAKELPARAM(((fRedraw)
 ? TRUE : FALSE),0)))
+#define Button_SetCheck(hwndCtl,check) 
((void)SNDMSG((hwndCtl),BM_SETCHECK,(WPARAM)(int)(check),0))
+#define Button_SetState(hwndCtl,state) 
((UINT)(DWORD)SNDMSG((hwndCtl),BM_SETSTATE,(WPARAM)(int)(state),0))
+#define Button_SetStyle(hwndCtl,style,fRedraw) 
((void)SNDMSG((hwndCtl),BM_SETSTYLE,(WPARAM)LOWORD(style),MAKELPARAM(((fRedraw) 
? TRUE : FALSE),0)))
 #define Button_SetText(hwndCtl,lpsz) SetWindowText((hwndCtl),(lpsz))
 #define CheckDefDlgRecursion(pfRecursion) if (*(pfRecursion)) {*(pfRecursion) 
= FALSE; return FALSE; }
-#define ComboBox_AddItemData(hwndCtl,data) 
((int)(DWORD)SendMessage((hwndCtl),CB_ADDSTRING,0,(LPARAM)(data)))
-#define ComboBox_AddString(hwndCtl,lpsz) 
((int)(DWORD)SendMessage((hwndCtl),CB_ADDSTRING,0,(LPARAM)(LPCTSTR)(lpsz)))
-#define ComboBox_DeleteString(hwndCtl,index) 
((int)(DWORD)SendMessage((hwndCtl),CB_DELETESTRING,(WPARAM)(int)(index),0))
-#define ComboBox_Dir(hwndCtl,attrs,lpszFileSpec) 
((int)(DWORD)SendMessage((hwndCtl),CB_DIR,(WPARAM)(UINT)(attrs),(LPARAM)(LPCTSTR)(lpszFileSpec)))
+#define ComboBox_AddItemData(hwndCtl,data) 
((int)(DWORD)SNDMSG((hwndCtl),CB_ADDSTRING,0,(LPARAM)(data)))
+#define ComboBox_AddString(hwndCtl,lpsz) 
((int)(DWORD)SNDMSG((hwndCtl),CB_ADDSTRING,0,(LPARAM)(LPCTSTR)(lpsz)))
+#define ComboBox_DeleteString(hwndCtl,index) 
((int)(DWORD)SNDMSG((hwndCtl),CB_DELETESTRING,(WPARAM)(int)(index),0))
+#define ComboBox_Dir(hwndCtl,attrs,lpszFileSpec) 
((int)(DWORD)SNDMSG((hwndCtl),CB_DIR,(WPARAM)(UINT)(attrs),(LPARAM)(LPCTSTR)(lpszFileSpec)))
 #define ComboBox_Enable(hwndCtl,fEnable) EnableWindow((hwndCtl),(fEnable))
-#define ComboBox_FindItemData(hwndCtl,indexStart,data) 
((int)(DWORD)SendMessage((hwndCtl),CB_FINDSTRING,(WPARAM)(int)(indexStart),(LPARAM)(data)))
-#define ComboBox_FindString(hwndCtl,indexStart,lpszFind) 
((int)(DWORD)SendMessage((hwndCtl),CB_FINDSTRING,(WPARAM)(int)(indexStart),(LPARAM)(LPCTSTR)(lpszFind)))
-#define ComboBox_FindStringExact(hwndCtl,indexStart,lpszFind) 
((int)(DWORD)SendMessage((hwndCtl),CB_FINDSTRINGEXACT,(WPARAM)(int)(indexStart),(LPARAM)(LPCTSTR)(lpszFind)))
-#define ComboBox_GetCount(hwndCtl) 
((int)(DWORD)SendMessage((hwndCtl),CB_GETCOUNT,0,0))
-#define ComboBox_GetCurSel(hwndCtl) 
((int)(DWORD)SendMessage((hwndCtl),CB_GETCURSEL,0,0))
-#define ComboBox_GetDroppedControlRect(hwndCtl,lprc) 
((void)Send

[ros-diffs] [reactos] 01/03: [NTUSER] Call SpiSetDWord when processing SPI_SETCARETWIDTH message

2022-10-12 Thread Jose Carlos Jesus
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d794996217d1d0cbd94876f89babf3bc4f36b6a6

commit d794996217d1d0cbd94876f89babf3bc4f36b6a6
Author: Jose Carlos Jesus 
AuthorDate: Fri Sep 2 19:50:11 2022 +0100
Commit: Stanislav Motylkov 
CommitDate: Wed Oct 12 22:12:12 2022 +0300

[NTUSER] Call SpiSetDWord when processing SPI_SETCARETWIDTH message

This corresponds to REG_DWORD type of CaretWidth value.

CORE-18151
---
 win32ss/user/ntuser/sysparams.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/win32ss/user/ntuser/sysparams.c b/win32ss/user/ntuser/sysparams.c
index 0e68f25ced0..7b1f2bf895a 100644
--- a/win32ss/user/ntuser/sysparams.c
+++ b/win32ss/user/ntuser/sysparams.c
@@ -1740,7 +1740,7 @@ SpiGetSet(UINT uiAction, UINT uiParam, PVOID pvParam, 
FLONG fl)
 return SpiGetInt(pvParam, &gspv.dwCaretWidth, fl);
 
 case SPI_SETCARETWIDTH:
-return SpiSetInt(&gspv.dwCaretWidth, uiParam, KEY_MOUSE, L"", fl);
+return SpiSetDWord(&gspv.dwCaretWidth, PtrToUlong(pvParam), 
KEY_DESKTOP, VAL_CARETWIDTH, fl);
 
 case SPI_GETMOUSECLICKLOCKTIME:
 return SpiGetInt(pvParam, &gspv.dwMouseClickLockTime, fl);



[ros-diffs] [reactos] 02/03: [COMCTL32] Read caret width from registry

2022-10-12 Thread Jose Carlos Jesus
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9789e9c409286fe09b50f2a5f55f3a0d3fc7dba9

commit 9789e9c409286fe09b50f2a5f55f3a0d3fc7dba9
Author: Jose Carlos Jesus 
AuthorDate: Fri Sep 16 16:40:01 2022 +0100
Commit: Stanislav Motylkov 
CommitDate: Wed Oct 12 22:12:19 2022 +0300

[COMCTL32] Read caret width from registry

Add caret width value to EDITSTATE structure.
To keep the same behavior as Windows Server 2003,
we need to update dwCaretWidth when EDIT_WM_SetFocus is called.

CORE-18151
---
 dll/win32/comctl32/edit.c   | 6 ++
 win32ss/user/user32/controls/edit.c | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/dll/win32/comctl32/edit.c b/dll/win32/comctl32/edit.c
index a6a04fe330a..a568b060fd9 100644
--- a/dll/win32/comctl32/edit.c
+++ b/dll/win32/comctl32/edit.c
@@ -103,6 +103,9 @@ typedef struct
HFONT font; /* NULL means standard system font */
INT x_offset;   /* scroll offsetfor multi lines 
this is in pixels
for single 
lines it's in characters */
+#ifdef __REACTOS__
+DWORD dwCaretWidth;
+#endif
INT line_height;/* height of a screen line in pixels */
INT char_width; /* average character width in pixels */
DWORD style;/* sane version of wnd->dwStyle */
@@ -3691,6 +3694,9 @@ static void EDIT_WM_SetFocus(HTHEME theme, EDITSTATE *es)
 if (!(es->style & ES_NOHIDESEL))
 EDIT_InvalidateText(es, es->selection_start, es->selection_end);
 
+#ifdef __REACTOS__
+SystemParametersInfo(SPI_GETCARETWIDTH, 0, &es->dwCaretWidth, 0);
+#endif
 CreateCaret(es->hwndSelf, 0, 1, es->line_height);
 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 9fc7d3f0f0d..bed1ad46fe5 100644
--- a/win32ss/user/user32/controls/edit.c
+++ b/win32ss/user/user32/controls/edit.c
@@ -102,6 +102,9 @@ typedef struct
HFONT font; /* NULL means standard system font */
INT x_offset;   /* scroll offsetfor multi lines 
this is in pixels
for single 
lines it's in characters */
+#ifdef __REACTOS__
+DWORD dwCaretWidth;
+#endif
INT line_height;/* height of a screen line in pixels */
INT char_width; /* average character width in pixels */
DWORD style;/* sane version of wnd->dwStyle */
@@ -3905,6 +3908,9 @@ static void EDIT_WM_SetFocus(EDITSTATE *es)
 ReleaseDC(es->hwndSelf, hdc);
 }
 
+#ifdef __REACTOS__
+SystemParametersInfo(SPI_GETCARETWIDTH, 0, &es->dwCaretWidth, 0);
+#endif
CreateCaret(es->hwndSelf, 0, 1, es->line_height);
EDIT_SetCaretPos(es, es->selection_end,
 es->flags & EF_AFTER_WRAP);



[ros-diffs] [reactos] 03/03: [COMCTL32] Don't hardcode dwCaretWidth parameter while calling CreateCaret

2022-10-12 Thread Jose Carlos Jesus
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a3eda784a5175fee1efd07fac407c8c9e27bfb3b

commit a3eda784a5175fee1efd07fac407c8c9e27bfb3b
Author: Jose Carlos Jesus 
AuthorDate: Fri Sep 16 16:50:27 2022 +0100
Commit: Stanislav Motylkov 
CommitDate: Wed Oct 12 22:12:19 2022 +0300

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



[ros-diffs] [reactos] 01/01: [IMM32] Implement Imm32ImeNonImeToggle (#4769)

2022-10-12 Thread Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=31a33c5fcb08b9b7707052afa233ecdbd2ede5d6

commit 31a33c5fcb08b9b7707052afa233ecdbd2ede5d6
Author: Katayama Hirofumi MZ 
AuthorDate: Thu Oct 13 07:14:24 2022 +0900
Commit: GitHub 
CommitDate: Thu Oct 13 07:14:24 2022 +0900

[IMM32] Implement Imm32ImeNonImeToggle (#4769)

- Rename Imm32ImeNonImeToggle as Imm32CImeNonImeToggle (Win: 
CIMENonIMEToggle).
- Add Imm32ImeNonImeToggle (Win: IMENonIMEToggle) function.
- Improve IME hot-key functions.
CORE-11700
---
 dll/win32/imm32/keymsg.c | 91 
 1 file changed, 76 insertions(+), 15 deletions(-)

diff --git a/dll/win32/imm32/keymsg.c b/dll/win32/imm32/keymsg.c
index baea59d0ec8..bff0671da03 100644
--- a/dll/win32/imm32/keymsg.c
+++ b/dll/win32/imm32/keymsg.c
@@ -13,18 +13,68 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(imm);
 
+/* Win: IMENonIMEToggle */
+BOOL APIENTRY Imm32ImeNonImeToggle(HIMC hIMC, HKL hKL, HWND hWnd, BOOL 
bNowIME, LANGID LangID)
+{
+HKL hOldKL, LayoutList[32], hFoundKL = NULL;
+UINT iLayout, nLayoutCount;
+
+/* Get the previous layout */
+hOldKL = (HKL)NtUserGetThreadState(THREADSTATE_OLDKEYBOARDLAYOUT);
+
+/* Get the layout list */
+nLayoutCount = GetKeyboardLayoutList(_countof(LayoutList), LayoutList);
+
+/* Is there hOldKL in the list in the specified language ID? */
+if (hOldKL && (LangID == 0 || LOWORD(hOldKL) == LangID))
+{
+for (iLayout = 0; iLayout < nLayoutCount; ++iLayout)
+{
+if (LayoutList[iLayout] == hOldKL)
+{
+hFoundKL = hOldKL;
+break;
+}
+}
+}
+
+if (hFoundKL == NULL) /* Not found? */
+{
+/* Is there the keyboard layout of another kind in LangID? */
+for (iLayout = 0; iLayout < nLayoutCount; ++iLayout)
+{
+if (bNowIME == ImmIsIME(LayoutList[iLayout])) /* Same kind? */
+continue;
+
+if (LangID == 0 || LangID == LOWORD(LayoutList[iLayout]))
+{
+hFoundKL = LayoutList[iLayout];
+break;
+}
+}
+}
+
+if (hFoundKL && hKL != hFoundKL) /* Found and different layout */
+{
+PostMessageW(hWnd, WM_INPUTLANGCHANGEREQUEST, 1, (LPARAM)hFoundKL);
+}
+
+return ImmIsIME(hFoundKL);
+}
+
+/* Open or close the IME on Chinese or Taiwanese */
 /* Win: CIMENonIMEToggle */
-BOOL APIENTRY Imm32ImeNonImeToggle(HIMC hIMC, HKL hKL, HWND hWnd, LANGID 
LangID)
+BOOL APIENTRY Imm32CImeNonImeToggle(HIMC hIMC, HKL hKL, HWND hWnd, LANGID 
LangID)
 {
 LPINPUTCONTEXT pIC;
 BOOL fOpen;
 
-if (hWnd != NULL)
+if (hWnd == NULL)
 return FALSE;
 
-if (!IS_IME_HKL(hKL) || LOWORD(hKL) != LangID)
+if (LOWORD(hKL) != LangID || !ImmIsIME(hKL))
 {
-FIXME("We have to do something here\n");
+Imm32ImeNonImeToggle(hIMC, hKL, hWnd, FALSE, LangID);
 return TRUE;
 }
 
@@ -35,16 +85,15 @@ BOOL APIENTRY Imm32ImeNonImeToggle(HIMC hIMC, HKL hKL, HWND 
hWnd, LANGID LangID)
 fOpen = pIC->fOpen;
 ImmUnlockIMC(hIMC);
 
-if (!fOpen)
-{
+if (fOpen)
+Imm32ImeNonImeToggle(hIMC, hKL, hWnd, TRUE, 0);
+else
 ImmSetOpenStatus(hIMC, TRUE);
-return TRUE;
-}
 
-FIXME("We have to do something here\n");
 return TRUE;
 }
 
+/* Toggle shape mode on Chinese or Taiwanese */
 /* Win: TShapeToggle */
 BOOL APIENTRY Imm32CShapeToggle(HIMC hIMC, HKL hKL, HWND hWnd)
 {
@@ -52,7 +101,7 @@ BOOL APIENTRY Imm32CShapeToggle(HIMC hIMC, HKL hKL, HWND 
hWnd)
 BOOL fOpen;
 DWORD dwConversion, dwSentence;
 
-if (hWnd == NULL || !IS_IME_HKL(hKL))
+if (hWnd == NULL || !ImmIsIME(hKL))
 return FALSE;
 
 pIC = ImmLockIMC(hIMC);
@@ -83,7 +132,7 @@ BOOL APIENTRY Imm32CSymbolToggle(HIMC hIMC, HKL hKL, HWND 
hWnd)
 BOOL fOpen;
 DWORD dwConversion, dwSentence;
 
-if (hWnd == NULL || !IS_IME_HKL(hKL))
+if (hWnd == NULL || !ImmIsIME(hKL))
 return FALSE;
 
 pIC = ImmLockIMC(hIMC);
@@ -107,19 +156,31 @@ BOOL APIENTRY Imm32CSymbolToggle(HIMC hIMC, HKL hKL, HWND 
hWnd)
 return TRUE;
 }
 
+/* Open or close Japanese IME */
 /* Win: JCloseOpen */
 BOOL APIENTRY Imm32JCloseOpen(HIMC hIMC, HKL hKL, HWND hWnd)
 {
 BOOL fOpen;
+LPINPUTCONTEXTDX pIC;
 
-if (ImmIsIME(hKL) && LOWORD(hKL) == LANGID_JAPANESE)
+if (LOWORD(hKL) == LANGID_JAPANESE && ImmIsIME(hKL)) /* Japanese IME is 
selected */
 {
 fOpen = ImmGetOpenStatus(hIMC);
 ImmSetOpenStatus(hIMC, !fOpen);
 return TRUE;
 }
 
-FIXME("We have to do something here\n");
+/* Japanese IME is not selected. Select now */
+if (Imm32ImeNonImeToggle(hIMC, hKL, hWnd, FALSE, LANGID_JAPANESE))
+{
+pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
+if (pIC)
+{
+pIC->dwChange |= INPUTCONTEXTDX_CHANGE_OPEN; /* Notify open change 
*/

[ros-diffs] [reactos] 01/01: [BROWSEUI] Follow-up of 2e67c18 (#4767); Also check 'MenuText'

2022-10-12 Thread Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=337cbf5888d88f697ff19c830761602bf56eedf7

commit 337cbf5888d88f697ff19c830761602bf56eedf7
Author: Katayama Hirofumi MZ 
AuthorDate: Thu Oct 13 11:07:03 2022 +0900
Commit: Katayama Hirofumi MZ 
CommitDate: Thu Oct 13 11:07:03 2022 +0900

[BROWSEUI] Follow-up of 2e67c18 (#4767); Also check 'MenuText'

CORE-18394
---
 dll/win32/browseui/shellbars/CBandSiteMenu.cpp | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dll/win32/browseui/shellbars/CBandSiteMenu.cpp 
b/dll/win32/browseui/shellbars/CBandSiteMenu.cpp
index 1ea45a47d68..bf227f5e4a4 100644
--- a/dll/win32/browseui/shellbars/CBandSiteMenu.cpp
+++ b/dll/win32/browseui/shellbars/CBandSiteMenu.cpp
@@ -103,8 +103,12 @@ HRESULT CBandSiteMenu::_CreateMenuPart()
 hr = SHLoadRegUIStringW(hKey, L"MenuTextPUI", wszBandName, 
_countof(wszBandName));
 if (FAILED_UNEXPECTEDLY(hr))
 {
-hr = SHLoadRegUIStringW(hKey, NULL, wszBandName, 
_countof(wszBandName));
-FAILED_UNEXPECTEDLY(hr);
+hr = SHLoadRegUIStringW(hKey, L"MenuText", wszBandName, 
_countof(wszBandName));
+if (FAILED_UNEXPECTEDLY(hr))
+{
+hr = SHLoadRegUIStringW(hKey, NULL, wszBandName, 
_countof(wszBandName));
+FAILED_UNEXPECTEDLY(hr);
+}
 }
 RegCloseKey(hKey);
 }



[ros-diffs] [reactos] 01/01: [IMM32] Silence CtfImmDispatchDefImeMessage's fixme

2022-10-12 Thread Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fb86db15bbae396f0a9e40e34ccb2f633f734ec4

commit fb86db15bbae396f0a9e40e34ccb2f633f734ec4
Author: Katayama Hirofumi MZ 
AuthorDate: Thu Oct 13 12:08:02 2022 +0900
Commit: Katayama Hirofumi MZ 
CommitDate: Thu Oct 13 12:08:02 2022 +0900

[IMM32] Silence CtfImmDispatchDefImeMessage's fixme

Too noisy. CORE-11700
---
 dll/win32/imm32/ctf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dll/win32/imm32/ctf.c b/dll/win32/imm32/ctf.c
index 61a36b305ff..711e2d5cadf 100644
--- a/dll/win32/imm32/ctf.c
+++ b/dll/win32/imm32/ctf.c
@@ -100,7 +100,7 @@ DWORD WINAPI CtfImmHideToolbarWnd(VOID)
  */
 LRESULT WINAPI CtfImmDispatchDefImeMessage(HWND hWnd, UINT uMsg, WPARAM 
wParam, LPARAM lParam)
 {
-FIXME("(%p, %u, %p, %p)\n", hWnd, uMsg, wParam, lParam);
+/* FIXME("(%p, %u, %p, %p)\n", hWnd, uMsg, wParam, lParam); */
 return 0;
 }