ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
October 2023
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
21 participants
140 discussions
Start a n
N
ew thread
[reactos] 01/01: [IMM32][SDK] Add CtfAImmActivate/Deactivate functions (#5835)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b3194e320cfd143fa7f3a…
commit b3194e320cfd143fa7f3ad4183f8b3305a113b07 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Oct 31 22:45:28 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Oct 31 22:45:28 2023 +0900 [IMM32][SDK] Add CtfAImmActivate/Deactivate functions (#5835) - Add dll/win32/imm32/CtfImeTable.h for CTF IME functions. - Implementing Imm32CheckAndApplyAppCompat, Imm32LoadCtfIme, and Imm32EnumCreateCtfICProc helper functions. - Add CtfAImmActivate and CtfAImmDeactivate functions. - s/CI_TFSDISABLED/CI_TSFDISABLED/ CORE-19268 --- dll/win32/imm32/CtfImeTable.h | 18 +++ dll/win32/imm32/ctf.c | 329 +++++++++++++++++++++++++++++++++++--- dll/win32/imm32/imm32.spec | 2 + dll/win32/imm32/precomp.h | 4 +- sdk/include/reactos/imm32_undoc.h | 6 +- win32ss/include/ntuser.h | 6 +- 6 files changed, 334 insertions(+), 31 deletions(-) diff --git a/dll/win32/imm32/CtfImeTable.h b/dll/win32/imm32/CtfImeTable.h new file mode 100644 index 00000000000..14f701b6c46 --- /dev/null +++ b/dll/win32/imm32/CtfImeTable.h @@ -0,0 +1,18 @@ +/* + * PROJECT: ReactOS IMM32 + * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later
) + * PURPOSE: Defining the CTF IME file interface + * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> + */ + +/* The valid CTF IME file contains the following functions: */ + +/* DEFINE_CTF_IME_FN(func_name, ret_type, params) */ +DEFINE_CTF_IME_FN(CtfImeCreateThreadMgr, HRESULT, (VOID)) +DEFINE_CTF_IME_FN(CtfImeDestroyThreadMgr, HRESULT, (VOID)) +DEFINE_CTF_IME_FN(CtfImeCreateInputContext, HRESULT, (HIMC hIMC)) +DEFINE_CTF_IME_FN(CtfImeDestroyInputContext, HRESULT, (HIMC hIMC)) +DEFINE_CTF_IME_FN(CtfImeSetActiveContextAlways, HRESULT, (DWORD dwFIXME1, DWORD dwFIXME2, DWORD dwFIXME3, DWORD dwFIXME4)) +DEFINE_CTF_IME_FN(CtfImeProcessCicHotkey, HRESULT, (DWORD dwFIXME1, DWORD dwFIXME2, DWORD dwFIXME3)) +DEFINE_CTF_IME_FN(CtfImeDispatchDefImeMessage, LRESULT, (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)) +DEFINE_CTF_IME_FN(CtfImeIsIME, BOOL, (HKL hKL)) diff --git a/dll/win32/imm32/ctf.c b/dll/win32/imm32/ctf.c index 8495725ed0f..eeeae62b588 100644 --- a/dll/win32/imm32/ctf.c +++ b/dll/win32/imm32/ctf.c @@ -2,7 +2,7 @@ * PROJECT: ReactOS IMM32 * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later
) * PURPOSE: Implementing the IMM32 Cicero-aware Text Framework (CTF) - * COPYRIGHT: Copyright 2022 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> + * COPYRIGHT: Copyright 2022-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> */ #include "precomp.h" @@ -17,62 +17,326 @@ WINE_DEFAULT_DEBUG_CHANNEL(imm); *
https://googleprojectzero.blogspot.com/2019/08/down-rabbit-hole.html
*/ -// Win: LoadCtfIme -HMODULE APIENTRY Imm32LoadCtfIme(VOID) +/* + * TSF stands for "Text Services Framework". "Cicero" is the code name of TSF. + * CTF stands for "Cicero-aware Text Framework". + * + * Comparing with old-style IMM IME, the combination of CTF IME and TSF provides + * new-style and high-level input method. + * + * The CTF IME file is a DLL file that the software developer distributes. + * The export functions of the CTF IME file are defined in "CtfImeTable.h" of + * this folder. + */ + +/* The instance of the CTF IME file */ +HINSTANCE g_hCtfIme = NULL; + +/* Define the function types (FN_...) for CTF IME functions */ +#undef DEFINE_CTF_IME_FN +#define DEFINE_CTF_IME_FN(func_name, ret_type, params) \ + typedef ret_type (WINAPI *FN_##func_name)params; +#include "CtfImeTable.h" + +/* Define the global variables (g_pfn...) for CTF IME functions */ +#undef DEFINE_CTF_IME_FN +#define DEFINE_CTF_IME_FN(func_name, ret_type, params) \ + FN_##func_name g_pfn##func_name = NULL; +#include "CtfImeTable.h" + +/* The macro that gets the variable name from the CTF IME function name */ +#define CTF_IME_FN(func_name) g_pfn##func_name + +/* The type of ApphelpCheckIME function in apphelp.dll */ +typedef BOOL (WINAPI *FN_ApphelpCheckIME)(_In_z_ LPCWSTR AppName); + +/* FIXME: This is kernel32 function. We have to declare this in some header. */ +BOOL WINAPI +BaseCheckAppcompatCache(_In_z_ LPCWSTR ApplicationName, + _In_ HANDLE FileHandle, + _In_opt_z_ LPCWSTR Environment, + _Out_ PULONG pdwReason); + +/*********************************************************************** + * This function checks whether the app's IME is disabled by application + * compatibility patcher. + */ +BOOL +Imm32CheckAndApplyAppCompat( + _In_ ULONG dwReason, + _In_z_ LPCWSTR pszAppName) { - return NULL; + HINSTANCE hinstApphelp; + FN_ApphelpCheckIME pApphelpCheckIME; + + /* Query the application compatibility patcher */ + if (BaseCheckAppcompatCache(pszAppName, INVALID_HANDLE_VALUE, NULL, &dwReason)) + return TRUE; /* The app's IME is not disabled */ + + /* Load apphelp.dll if necessary */ + hinstApphelp = GetModuleHandleW(L"apphelp.dll"); + if (!hinstApphelp) + { + hinstApphelp = LoadLibraryW(L"apphelp.dll"); + if (!hinstApphelp) + return TRUE; /* There is no apphelp.dll. The app's IME is not disabled */ + } + + /* Is ApphelpCheckIME implemented? */ + pApphelpCheckIME = (FN_ApphelpCheckIME)GetProcAddress(hinstApphelp, "ApphelpCheckIME"); + if (!pApphelpCheckIME) + return TRUE; /* Not implemented. The app's IME is not disabled */ + + /* Is the app's IME disabled or not? */ + return pApphelpCheckIME(pszAppName); } -// Win: Internal_CtfImeDestroyInputContext -HRESULT APIENTRY Imm32CtfImeDestroyInputContext(HIMC hIMC) +/*********************************************************************** + * This function loads the CTF IME file if necessary and establishes + * communication with the CTF IME. + */ +HINSTANCE +Imm32LoadCtfIme(VOID) +{ + BOOL bSuccess = FALSE; + IMEINFOEX ImeInfoEx; + WCHAR szImeFile[MAX_PATH]; + + /* Lock the IME interface */ + RtlEnterCriticalSection(&gcsImeDpi); + + do + { + if (g_hCtfIme) /* Already loaded? */ + { + bSuccess = TRUE; + break; + } + + /* + * NOTE: (HKL)0x04090409 is English US keyboard (default). + * The Cicero keyboard logically uses English US keyboard. + */ + if (!ImmLoadLayout((HKL)ULongToHandle(0x04090409), &ImeInfoEx)) + break; + + /* Build a path string in system32. The installed IME file must be in system32. */ + Imm32GetSystemLibraryPath(szImeFile, _countof(szImeFile), ImeInfoEx.wszImeFile); + + /* Is the CTF IME disabled by app compatibility patcher? */ + if (!Imm32CheckAndApplyAppCompat(0, szImeFile)) + break; /* This IME is disabled */ + + /* Load a CTF IME file */ + g_hCtfIme = LoadLibraryW(szImeFile); + if (!g_hCtfIme) + break; + + /* Assume success */ + bSuccess = TRUE; + + /* Retrieve the CTF IME functions */ +#undef DEFINE_CTF_IME_FN +#define DEFINE_CTF_IME_FN(func_name, ret_type, params) \ + CTF_IME_FN(func_name) = (FN_##func_name)GetProcAddress(g_hCtfIme, #func_name); \ + if (!CTF_IME_FN(func_name)) \ + { \ + bSuccess = FALSE; /* Failed */ \ + break; \ + } +#include "CtfImeTable.h" + } while (0); + + /* Unload the CTF IME if failed */ + if (!bSuccess) + { + /* Set NULL to the function pointers */ +#undef DEFINE_CTF_IME_FN +#define DEFINE_CTF_IME_FN(func_name, ret_type, params) CTF_IME_FN(func_name) = NULL; +#include "CtfImeTable.h" + + if (g_hCtfIme) + { + FreeLibrary(g_hCtfIme); + g_hCtfIme = NULL; + } + } + + /* Unlock the IME interface */ + RtlLeaveCriticalSection(&gcsImeDpi); + + return g_hCtfIme; +} + +/*********************************************************************** + * This function calls the same name function of the CTF IME side. + */ +HRESULT +CtfImeCreateThreadMgr(VOID) { if (!Imm32LoadCtfIme()) return E_FAIL; -#if 1 - FIXME("(%p)\n", hIMC); - return E_NOTIMPL; -#else - return g_pfnCtfImeDestroyInputContext(hIMC); -#endif + return CTF_IME_FN(CtfImeCreateThreadMgr)(); +} + +/*********************************************************************** + * This function calls the same name function of the CTF IME side. + */ +HRESULT +CtfImeDestroyThreadMgr(VOID) +{ + if (!Imm32LoadCtfIme()) + return E_FAIL; + + return CTF_IME_FN(CtfImeDestroyThreadMgr)(); +} + +/*********************************************************************** + * This function calls the same name function of the CTF IME side. + */ +HRESULT +CtfImeCreateInputContext( + _In_ HIMC hIMC) +{ + if (!Imm32LoadCtfIme()) + return E_FAIL; + + return CTF_IME_FN(CtfImeCreateInputContext)(hIMC); +} + +/*********************************************************************** + * This function calls the same name function of the CTF IME side. + */ +HRESULT +CtfImeDestroyInputContext(_In_ HIMC hIMC) +{ + if (!Imm32LoadCtfIme()) + return E_FAIL; + + return CTF_IME_FN(CtfImeDestroyInputContext)(hIMC); +} + +/*********************************************************************** + * The callback function to activate CTF IMEs. Used in CtfAImmActivate. + */ +static BOOL CALLBACK +Imm32EnumCreateCtfICProc( + _In_ HIMC hIMC, + _In_ LPARAM lParam) +{ + UNREFERENCED_PARAMETER(lParam); + CtfImeCreateInputContext(hIMC); + return TRUE; /* Continue */ } -// Win: CtfImmTIMDestroyInputContext -HRESULT APIENTRY CtfImmTIMDestroyInputContext(HIMC hIMC) +/*********************************************************************** + * This function calls CtfImeDestroyInputContext if possible. + */ +HRESULT +CtfImmTIMDestroyInputContext( + _In_ HIMC hIMC) { if (!IS_CICERO_MODE() || (GetWin32ClientInfo()->dwCompatFlags2 & 2)) return E_NOINTERFACE; - return Imm32CtfImeDestroyInputContext(hIMC); + return CtfImeDestroyInputContext(hIMC); } -// Win: CtfImmTIMCreateInputContext -HRESULT APIENTRY CtfImmTIMCreateInputContext(HIMC hIMC) +HRESULT +CtfImmTIMCreateInputContext( + _In_ HIMC hIMC) { TRACE("(%p)\n", hIMC); return E_NOTIMPL; } +/*********************************************************************** + * CtfAImmActivate (IMM32.@) + * + * This function activates "Active IMM" (AIMM) and TSF. + */ +HRESULT WINAPI +CtfAImmActivate( + _Out_opt_ HINSTANCE *phinstCtfIme) +{ + HRESULT hr; + HINSTANCE hinstCtfIme; + + TRACE("(%p)\n", phinstCtfIme); + + /* Load a CTF IME file if necessary */ + hinstCtfIme = Imm32LoadCtfIme(); + + /* Create a thread manager of the CTF IME */ + hr = CtfImeCreateThreadMgr(); + if (hr == S_OK) + { + /* Update CI_... flags of the thread client info */ + GetWin32ClientInfo()->CI_flags |= CI_AIMMACTIVATED; /* Activate AIMM */ + GetWin32ClientInfo()->CI_flags &= ~CI_TSFDISABLED; /* Enable TSF */ + + /* Create the CTF input contexts */ + ImmEnumInputContext(0, Imm32EnumCreateCtfICProc, 0); + } + + if (phinstCtfIme) + *phinstCtfIme = hinstCtfIme; + + return hr; +} + +/*********************************************************************** + * CtfAImmDeactivate (IMM32.@) + * + * This function de-activates "Active IMM" (AIMM) and TSF. + */ +HRESULT WINAPI +CtfAImmDeactivate( + _In_ BOOL bDestroy) +{ + HRESULT hr; + + if (!bDestroy) + return E_FAIL; + + hr = CtfImeDestroyThreadMgr(); + if (hr == S_OK) + { + GetWin32ClientInfo()->CI_flags &= ~CI_AIMMACTIVATED; /* Deactivate AIMM */ + GetWin32ClientInfo()->CI_flags |= CI_TSFDISABLED; /* Disable TSF */ + } + + return hr; +} + /*********************************************************************** * CtfImmIsCiceroEnabled (IMM32.@) + * + * @return TRUE if Cicero is enabled. */ -BOOL WINAPI CtfImmIsCiceroEnabled(VOID) +BOOL WINAPI +CtfImmIsCiceroEnabled(VOID) { return IS_CICERO_MODE(); } /*********************************************************************** * CtfImmIsTextFrameServiceDisabled(IMM32.@) + * + * @return TRUE if TSF is disabled. */ -BOOL WINAPI CtfImmIsTextFrameServiceDisabled(VOID) +BOOL WINAPI +CtfImmIsTextFrameServiceDisabled(VOID) { - return !!(GetWin32ClientInfo()->CI_flags & CI_TFSDISABLED); + return !!(GetWin32ClientInfo()->CI_flags & CI_TSFDISABLED); } /*********************************************************************** * CtfImmTIMActivate(IMM32.@) */ -HRESULT WINAPI CtfImmTIMActivate(HKL hKL) +HRESULT WINAPI +CtfImmTIMActivate(_In_ HKL hKL) { FIXME("(%p)\n", hKL); return E_NOTIMPL; @@ -81,7 +345,8 @@ HRESULT WINAPI CtfImmTIMActivate(HKL hKL) /*********************************************************************** * CtfImmRestoreToolbarWnd(IMM32.@) */ -VOID WINAPI CtfImmRestoreToolbarWnd(DWORD dwStatus) +VOID WINAPI +CtfImmRestoreToolbarWnd(_In_ DWORD dwStatus) { FIXME("(0x%lx)\n", dwStatus); } @@ -89,7 +354,8 @@ VOID WINAPI CtfImmRestoreToolbarWnd(DWORD dwStatus) /*********************************************************************** * CtfImmHideToolbarWnd(IMM32.@) */ -DWORD WINAPI CtfImmHideToolbarWnd(VOID) +DWORD WINAPI +CtfImmHideToolbarWnd(VOID) { FIXME("()\n"); return 0; @@ -98,7 +364,12 @@ DWORD WINAPI CtfImmHideToolbarWnd(VOID) /*********************************************************************** * CtfImmDispatchDefImeMessage(IMM32.@) */ -LRESULT WINAPI CtfImmDispatchDefImeMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +LRESULT WINAPI +CtfImmDispatchDefImeMessage( + _In_ HWND hWnd, + _In_ UINT uMsg, + _In_ WPARAM wParam, + _In_ LPARAM lParam) { /* FIXME("(%p, %u, %p, %p)\n", hWnd, uMsg, wParam, lParam); */ return 0; @@ -107,7 +378,9 @@ LRESULT WINAPI CtfImmDispatchDefImeMessage(HWND hWnd, UINT uMsg, WPARAM wParam, /*********************************************************************** * CtfImmIsGuidMapEnable(IMM32.@) */ -BOOL WINAPI CtfImmIsGuidMapEnable(HIMC hIMC) +BOOL WINAPI +CtfImmIsGuidMapEnable( + _In_ HIMC hIMC) { DWORD dwThreadId; HKL hKL; @@ -138,7 +411,11 @@ BOOL WINAPI CtfImmIsGuidMapEnable(HIMC hIMC) /*********************************************************************** * CtfImmGetGuidAtom(IMM32.@) */ -HRESULT WINAPI CtfImmGetGuidAtom(HIMC hIMC, DWORD dwUnknown, LPDWORD pdwGuidAtom) +HRESULT WINAPI +CtfImmGetGuidAtom( + _In_ HIMC hIMC, + _In_ DWORD dwUnknown, + _Out_ LPDWORD pdwGuidAtom) { HRESULT hr = E_FAIL; PIMEDPI pImeDpi; diff --git a/dll/win32/imm32/imm32.spec b/dll/win32/imm32/imm32.spec index 92ac837fffd..eec7202482a 100644 --- a/dll/win32/imm32/imm32.spec +++ b/dll/win32/imm32/imm32.spec @@ -1,3 +1,5 @@ +@ stdcall CtfAImmActivate(ptr) +@ stdcall CtfAImmDeactivate(long) @ stdcall CtfImmIsCiceroEnabled() @ stdcall CtfImmIsTextFrameServiceDisabled() @ stdcall CtfImmTIMActivate(ptr) diff --git a/dll/win32/imm32/precomp.h b/dll/win32/imm32/precomp.h index 6db1f8d6e4d..6e0512af409 100644 --- a/dll/win32/imm32/precomp.h +++ b/dll/win32/imm32/precomp.h @@ -143,7 +143,6 @@ BOOL WINAPI Imm32IsImcAnsi(HIMC hIMC); #define IS_CROSS_THREAD_HIMC(hIMC) IS_TRUE_UNEXPECTEDLY(Imm32IsCrossThreadAccess(hIMC)) #define IS_CROSS_PROCESS_HWND(hWnd) IS_TRUE_UNEXPECTEDLY(Imm32IsCrossProcessAccess(hWnd)) #define ImeDpi_IsUnicode(pImeDpi) ((pImeDpi)->ImeInfo.fdwProperty & IME_PROP_UNICODE) -#define IS_16BIT_MODE() (GetWin32ClientInfo()->dwTIFlags & TIF_16BIT) DWORD APIENTRY CandidateListWideToAnsi(const CANDIDATELIST *pWideCL, LPCANDIDATELIST pAnsiCL, DWORD dwBufLen, @@ -189,3 +188,6 @@ PTHREADINFO FASTCALL Imm32CurrentPti(VOID); HBITMAP Imm32LoadBitmapFromBytes(const BYTE *pb); BOOL Imm32StoreBitmapToBytes(HBITMAP hbm, LPBYTE pbData, DWORD cbDataMax); + +HRESULT CtfImmTIMCreateInputContext(_In_ HIMC hIMC); +HRESULT CtfImmTIMDestroyInputContext(_In_ HIMC hIMC); diff --git a/sdk/include/reactos/imm32_undoc.h b/sdk/include/reactos/imm32_undoc.h index dadff68b031..49cb047182a 100644 --- a/sdk/include/reactos/imm32_undoc.h +++ b/sdk/include/reactos/imm32_undoc.h @@ -14,14 +14,16 @@ extern "C" { BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey); +BOOL WINAPI ImmLoadLayout(HKL hKL, PIMEINFOEX pImeInfoEx); PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc); VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc); PIMEDPI WINAPI ImmLockImeDpi(HKL hKL); VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi); -HRESULT APIENTRY CtfImmTIMCreateInputContext(HIMC hIMC); -HRESULT APIENTRY CtfImmTIMDestroyInputContext(HIMC hIMC); HRESULT WINAPI CtfImmTIMActivate(HKL hKL); +HRESULT WINAPI CtfAImmActivate(_Out_opt_ HINSTANCE *phinstCtfIme); +HRESULT WINAPI CtfAImmDeactivate(_In_ BOOL bDestroy); + #ifdef __cplusplus } // extern "C" #endif diff --git a/win32ss/include/ntuser.h b/win32ss/include/ntuser.h index e1a3ee9788a..1cb0fb2db4c 100644 --- a/win32ss/include/ntuser.h +++ b/win32ss/include/ntuser.h @@ -302,8 +302,9 @@ typedef struct _CALLBACKWND #define CI_INITTHREAD 0x00000008 #define CI_CURTHPRHOOK 0x00000010 #define CI_CLASSESREGISTERED 0x00000020 -#define CI_IMMACTIVATE 0x00000040 -#define CI_TFSDISABLED 0x00000400 +#define CI_IMMACTIVATE 0x00000040 /* IMM/IME (Asian input) */ +#define CI_TSFDISABLED 0x00000400 /* TSF (Text Services Framework a.k.a. Cicero) */ +#define CI_AIMMACTIVATED 0x00000800 /* Active IMM (AIMM) */ /* * CLIENTINFO structure. @@ -1231,6 +1232,7 @@ typedef enum IMEINFOEXCLASS #define IS_IME_HKL(hkl) ((((ULONG_PTR)(hkl)) & 0xF0000000) == 0xE0000000) #define IS_IMM_MODE() (gpsi && (gpsi->dwSRVIFlags & SRVINFO_IMM32)) #define IS_CICERO_MODE() (gpsi && (gpsi->dwSRVIFlags & SRVINFO_CICERO_ENABLED)) +#define IS_16BIT_MODE() (GetWin32ClientInfo()->dwTIFlags & TIF_16BIT) typedef struct tagIMEUI {
1 year, 2 months
1
0
0
0
[reactos] 01/01: [SETUPLIB][NTUSER] Toggle input language/layout on Alt+Shift / Ctrl+Shift (#5839)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=25b7447818f0fad111607…
commit 25b7447818f0fad1116070598bc88730c90c86b0 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Oct 31 22:37:49 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Oct 31 22:37:49 2023 +0900 [SETUPLIB][NTUSER] Toggle input language/layout on Alt+Shift / Ctrl+Shift (#5839) - Respect the toggle key settings. - Change the hot key settings in base/setup/lib/mui.c. - Revert IntDefWindowProc function about Alt+Shift handling. - Delete some code in co_IntProcessKeyboardMessage for Alt+Shift handling. - Add IntGetNextKL, IntLanguageToggle, and IntCheckLanguageToggle helper functions. - Modify ProcessKeyEvent and UserGetLanguageToggle functions to support [Left Alt]+Shift and Ctrl+Shift. - Improve WM_INPUTLANGCHANGEREQUEST handling. - Message handling shouldn't access kbswitch directly. CORE-10667 --- base/setup/lib/mui.c | 5 +- win32ss/user/ntuser/defwnd.c | 19 ------ win32ss/user/ntuser/input.h | 4 +- win32ss/user/ntuser/keyboard.c | 128 ++++++++++++++++++++++++++++++++++- win32ss/user/ntuser/misc.c | 18 +++-- win32ss/user/ntuser/msgqueue.c | 64 ------------------ win32ss/user/ntuser/ntuser.h | 2 +- win32ss/user/ntuser/sysparams.c | 7 +- win32ss/user/user32/windows/defwnd.c | 27 +++++--- 9 files changed, 164 insertions(+), 110 deletions(-) diff --git a/base/setup/lib/mui.c b/base/setup/lib/mui.c index 8b511cfa56a..cc2bda08eef 100644 --- a/base/setup/lib/mui.c +++ b/base/setup/lib/mui.c @@ -359,10 +359,7 @@ AddKbLayoutsToRegistry( uIndex++; } - if (uIndex > 1) - AddHotkeySettings(L"2", L"2", L"1"); - else - AddHotkeySettings(L"3", L"3", L"3"); + AddHotkeySettings(L"1", L"1", L"2"); NtClose(SubKeyHandle); NtClose(KeyHandle); diff --git a/win32ss/user/ntuser/defwnd.c b/win32ss/user/ntuser/defwnd.c index de4b4e12e18..83050064b8c 100644 --- a/win32ss/user/ntuser/defwnd.c +++ b/win32ss/user/ntuser/defwnd.c @@ -531,7 +531,6 @@ DefWndScreenshot(PWND pWnd) /* Win32k counterpart of User DefWindowProc */ -/* Win: xxxRealDefWindowProc */ LRESULT FASTCALL IntDefWindowProc( PWND Wnd, @@ -946,24 +945,6 @@ IntDefWindowProc( wParamTmp = UserGetKeyState(VK_SHIFT) & 0x8000 ? SC_PREVWINDOW : SC_NEXTWINDOW; co_IntSendMessage( Active, WM_SYSCOMMAND, wParamTmp, wParam ); } - else if (wParam == VK_SHIFT) // Alt+Shift - { - RTL_ATOM ClassAtom = 0; - UNICODE_STRING ustrClass, ustrWindow; - HWND hwndSwitch; - - RtlInitUnicodeString(&ustrClass, L"kbswitcher"); - RtlInitUnicodeString(&ustrWindow, L""); - - IntGetAtomFromStringOrAtom(&ustrClass, &ClassAtom); - - hwndSwitch = IntFindWindow(UserGetDesktopWindow(), NULL, ClassAtom, &ustrWindow); - if (hwndSwitch) - { -#define ID_NEXTLAYOUT 10003 - UserPostMessage(hwndSwitch, WM_COMMAND, ID_NEXTLAYOUT, (LPARAM)UserHMGetHandle(Wnd)); - } - } } else if( wParam == VK_F10 ) { diff --git a/win32ss/user/ntuser/input.h b/win32ss/user/ntuser/input.h index 3cae36048f1..35105947d68 100644 --- a/win32ss/user/ntuser/input.h +++ b/win32ss/user/ntuser/input.h @@ -75,8 +75,10 @@ VOID NTAPI UserProcessKeyboardInput(PKEYBOARD_INPUT_DATA pKeyInput); BOOL NTAPI UserSendKeyboardInput(KEYBDINPUT *pKbdInput, BOOL bInjected); PKL NTAPI UserHklToKbl(HKL hKl); BOOL NTAPI UserSetDefaultInputLang(HKL hKl); -extern int gLanguageToggleKeyState; +extern INT gLanguageToggleKeyState; extern DWORD gdwLanguageToggleKey; +extern INT gLayoutToggleKeyState; +extern DWORD gdwLayoutToggleKey; /* Mouse */ WORD FASTCALL UserGetMouseButtonsState(VOID); diff --git a/win32ss/user/ntuser/keyboard.c b/win32ss/user/ntuser/keyboard.c index 61f59296be0..3d8bed1ad25 100644 --- a/win32ss/user/ntuser/keyboard.c +++ b/win32ss/user/ntuser/keyboard.c @@ -15,8 +15,10 @@ static BYTE gafAsyncKeyStateRecentDown[256 / 8]; // 1 bit per key static PKEYBOARD_INDICATOR_TRANSLATION gpKeyboardIndicatorTrans = NULL; static KEYBOARD_INDICATOR_PARAMETERS gIndicators = {0, 0}; KEYBOARD_ATTRIBUTES gKeyboardInfo; -int gLanguageToggleKeyState = 0; -DWORD gdwLanguageToggleKey = 0; +INT gLanguageToggleKeyState = 0; +DWORD gdwLanguageToggleKey = 1; +INT gLayoutToggleKeyState = 0; +DWORD gdwLayoutToggleKey = 2; /* FUNCTIONS *****************************************************************/ @@ -791,6 +793,92 @@ cleanup: UserReleaseDC(pWnd, hdc, FALSE); } +/* Find the next/previous keyboard layout of the same/different language */ +static PKL FASTCALL +IntGetNextKL( + _In_ PKL pKL, + _In_ BOOL bNext, + _In_ BOOL bSameLang) +{ + PKL pFirstKL = pKL; + LANGID LangID = LOWORD(pKL->hkl); + + do + { + pKL = (bNext ? pKL->pklNext : pKL->pklPrev); + + if (!(pKL->dwKL_Flags & KLF_UNLOAD) && bSameLang == (LangID == LOWORD(pKL->hkl))) + return pKL; + } while (pKL != pFirstKL); + + return pFirstKL; +} + +/* Perform layout toggle by [Left Alt]+Shift or Ctrl+Shift */ +static VOID +IntLanguageToggle( + _In_ PUSER_MESSAGE_QUEUE pFocusQueue, + _In_ BOOL bSameLang, + _In_ INT nKeyState) +{ + PWND pWnd = pFocusQueue->spwndFocus; + HWND hWnd; + WPARAM wParam = 0; + PTHREADINFO pti; + PKL pkl; + + if (!pWnd) + pWnd = pFocusQueue->spwndActive; + if (!pWnd) + return; + + pti = pWnd->head.pti; + pkl = pti->KeyboardLayout; + + if (nKeyState == INPUTLANGCHANGE_FORWARD) + pkl = IntGetNextKL(pkl, TRUE, bSameLang); + else if (nKeyState == INPUTLANGCHANGE_BACKWARD) + pkl = IntGetNextKL(pkl, FALSE, bSameLang); + + if (gSystemFS & pkl->dwFontSigs) + wParam |= INPUTLANGCHANGE_SYSCHARSET; + + hWnd = UserHMGetHandle(pWnd); + UserPostMessage(hWnd, WM_INPUTLANGCHANGEREQUEST, wParam, (LPARAM)pkl->hkl); +} + +/* Check Language Toggle by [Left Alt]+Shift or Ctrl+Shift */ +static BOOL +IntCheckLanguageToggle( + _In_ PUSER_MESSAGE_QUEUE pFocusQueue, + _In_ BOOL bIsDown, + _In_ WORD wVk, + _Inout_ PINT pKeyState) +{ + if (bIsDown) /* Toggle key combination is pressed? */ + { + if (wVk == VK_LSHIFT) + *pKeyState = INPUTLANGCHANGE_FORWARD; + else if (wVk == VK_RSHIFT) + *pKeyState = INPUTLANGCHANGE_BACKWARD; + else if (!wVk && IS_KEY_DOWN(gafAsyncKeyState, VK_LSHIFT)) + *pKeyState = INPUTLANGCHANGE_FORWARD; + else if (!wVk && IS_KEY_DOWN(gafAsyncKeyState, VK_RSHIFT)) + *pKeyState = INPUTLANGCHANGE_BACKWARD; + else + return FALSE; + } + else + { + if (*pKeyState == 0) + return FALSE; + + IntLanguageToggle(pFocusQueue, (pKeyState == &gLayoutToggleKeyState), *pKeyState); + *pKeyState = 0; + } + return TRUE; +} + /* * UserSendKeyboardInput * @@ -808,6 +896,7 @@ ProcessKeyEvent(WORD wVk, WORD wScanCode, DWORD dwFlags, BOOL bInjected, DWORD d BOOL bWasSimpleDown = FALSE, bPostMsg = TRUE, bIsSimpleDown; MSG Msg; static BOOL bMenuDownRecently = FALSE; + BOOL bLangToggled = FALSE; /* Get virtual key without shifts (VK_(L|R)* -> VK_*) */ wSimpleVk = IntSimplifyVk(wVk); @@ -906,6 +995,41 @@ ProcessKeyEvent(WORD wVk, WORD wScanCode, DWORD dwFlags, BOOL bInjected, DWORD d TRACE("Alt-Tab/Esc Pressed wParam %x\n",wVk); } + /* + * Check Language/Layout Toggle by [Left Alt]+Shift or Ctrl+Shift. + * @see
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-…
+ */ + if (gdwLanguageToggleKey == 1 || gdwLanguageToggleKey == 2) + { + if (wSimpleVk == VK_SHIFT) /* Shift key is pressed or released */ + { + UINT targetKey = ((gdwLanguageToggleKey == 1) ? VK_LMENU : VK_CONTROL); + if (IS_KEY_DOWN(gafAsyncKeyState, targetKey)) + bLangToggled = IntCheckLanguageToggle(pFocusQueue, bIsDown, wVk, &gLanguageToggleKeyState); + } + else if ((wSimpleVk == VK_MENU && gdwLanguageToggleKey == 1) || + (wSimpleVk == VK_CONTROL && gdwLanguageToggleKey == 2)) + { + if (IS_KEY_DOWN(gafAsyncKeyState, VK_SHIFT)) + bLangToggled = IntCheckLanguageToggle(pFocusQueue, bIsDown, 0, &gLanguageToggleKeyState); + } + } + if (!bLangToggled && (gdwLayoutToggleKey == 1 || gdwLayoutToggleKey == 2)) + { + if (wSimpleVk == VK_SHIFT) /* Shift key is pressed or released */ + { + UINT targetKey = ((gdwLayoutToggleKey == 1) ? VK_LMENU : VK_CONTROL); + if (IS_KEY_DOWN(gafAsyncKeyState, targetKey)) + IntCheckLanguageToggle(pFocusQueue, bIsDown, wVk, &gLayoutToggleKeyState); + } + else if ((wSimpleVk == VK_MENU && gdwLayoutToggleKey == 1) || + (wSimpleVk == VK_CONTROL && gdwLayoutToggleKey == 2)) + { + if (IS_KEY_DOWN(gafAsyncKeyState, VK_SHIFT)) + IntCheckLanguageToggle(pFocusQueue, bIsDown, 0, &gLayoutToggleKeyState); + } + } + if (bIsDown && wVk == VK_SNAPSHOT) { if (pFocusQueue && diff --git a/win32ss/user/ntuser/misc.c b/win32ss/user/ntuser/misc.c index ae458de7a42..b5b0f27ac0a 100644 --- a/win32ss/user/ntuser/misc.c +++ b/win32ss/user/ntuser/misc.c @@ -76,19 +76,27 @@ IntTID2PTI(HANDLE id) return pti; } +/** + * @see
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-…
+ */ DWORD FASTCALL -UserGetLanguageToggle(VOID) +UserGetLanguageToggle( + _In_ PCWSTR pszType, + _In_ DWORD dwDefaultValue) { NTSTATUS Status; - DWORD dwValue = 0; + DWORD dwValue = dwDefaultValue; + WCHAR szBuff[4]; - Status = RegReadUserSetting(L"Keyboard Layout\\Toggle", L"Layout Hotkey", REG_SZ, &dwValue, sizeof(dwValue)); + Status = RegReadUserSetting(L"Keyboard Layout\\Toggle", pszType, REG_SZ, szBuff, sizeof(szBuff)); if (NT_SUCCESS(Status)) { - dwValue = atoi((char *)&dwValue); - TRACE("Layout Hotkey %d\n",dwValue); + szBuff[RTL_NUMBER_OF(szBuff) - 1] = UNICODE_NULL; + dwValue = _wtoi(szBuff); } + + TRACE("%ls: %lu\n", pszType, dwValue); return dwValue; } diff --git a/win32ss/user/ntuser/msgqueue.c b/win32ss/user/ntuser/msgqueue.c index 7f308530749..a808073374d 100644 --- a/win32ss/user/ntuser/msgqueue.c +++ b/win32ss/user/ntuser/msgqueue.c @@ -1770,7 +1770,6 @@ BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages) PWND pWnd; UINT ImmRet; BOOL Ret = TRUE; - WPARAM wParam = Msg->wParam; PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); if (Msg->message == VK_PACKET) @@ -1852,69 +1851,6 @@ BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages) } } - if ( *RemoveMessages && (Msg->message == WM_SYSKEYDOWN || Msg->message == WM_KEYDOWN) ) - { - if (gdwLanguageToggleKey < 3) - { - if (IS_KEY_DOWN(gafAsyncKeyState, gdwLanguageToggleKey == 1 ? VK_LMENU : VK_CONTROL)) // L Alt 1 or Ctrl 2 . - { - if ( wParam == VK_LSHIFT ) gLanguageToggleKeyState = INPUTLANGCHANGE_FORWARD; // Left Alt - Left Shift, Next - //// FIXME : It seems to always be VK_LSHIFT. - if ( wParam == VK_RSHIFT ) gLanguageToggleKeyState = INPUTLANGCHANGE_BACKWARD; // Left Alt - Right Shift, Previous - } - } - } - - //// Key Up! Alt Key Ctrl Key - if ( *RemoveMessages && (Msg->message == WM_SYSKEYUP || Msg->message == WM_KEYUP) ) - { - // When initializing win32k: Reading from the registry hotkey combination - // to switch the keyboard layout and store it to global variable. - // Using this combination of hotkeys in this function - - if ( gdwLanguageToggleKey < 3 && - IS_KEY_DOWN(gafAsyncKeyState, gdwLanguageToggleKey == 1 ? VK_LMENU : VK_CONTROL) ) - { - if ( Msg->wParam == VK_SHIFT && !(IS_KEY_DOWN(gafAsyncKeyState, VK_SHIFT))) - { - WPARAM wParamILR; - PKL pkl = pti->KeyboardLayout; - - if (pWnd) UserDerefObjectCo(pWnd); - - //// Seems to override message window. - if (!(pWnd = pti->MessageQueue->spwndFocus)) - { - pWnd = pti->MessageQueue->spwndActive; - } - if (pWnd) UserRefObjectCo(pWnd, &Ref); - - if (pkl != NULL && gLanguageToggleKeyState) - { - TRACE("Posting WM_INPUTLANGCHANGEREQUEST KeyState %d\n", gLanguageToggleKeyState ); - - wParamILR = gLanguageToggleKeyState; - // If system character set and font signature send flag. - if ( gSystemFS & pkl->dwFontSigs ) - { - wParamILR |= INPUTLANGCHANGE_SYSCHARSET; - } - - UserPostMessage( UserHMGetHandle(pWnd), - WM_INPUTLANGCHANGEREQUEST, - wParamILR, - (LPARAM)pkl->hkl ); - - gLanguageToggleKeyState = 0; - //// Keep looping. - Ret = FALSE; - //// Skip the rest. - goto Exit; - } - } - } - } - if (co_HOOK_CallHooks( WH_KEYBOARD, *RemoveMessages ? HC_ACTION : HC_NOREMOVE, LOWORD(Msg->wParam), diff --git a/win32ss/user/ntuser/ntuser.h b/win32ss/user/ntuser/ntuser.h index 01232f9323a..7c878c4f793 100644 --- a/win32ss/user/ntuser/ntuser.h +++ b/win32ss/user/ntuser/ntuser.h @@ -37,7 +37,7 @@ VOID FASTCALL UserEnterExclusive(VOID); VOID FASTCALL UserLeave(VOID); BOOL FASTCALL UserIsEntered(VOID); BOOL FASTCALL UserIsEnteredExclusive(VOID); -DWORD FASTCALL UserGetLanguageToggle(VOID); +DWORD FASTCALL UserGetLanguageToggle(_In_ LPCWSTR pszType, _In_ DWORD dwDefaultValue); _Success_(return != FALSE) BOOL diff --git a/win32ss/user/ntuser/sysparams.c b/win32ss/user/ntuser/sysparams.c index 552a63e1f6a..95bfbe7ca78 100644 --- a/win32ss/user/ntuser/sysparams.c +++ b/win32ss/user/ntuser/sysparams.c @@ -355,7 +355,8 @@ SpiUpdatePerUserSystemParameters(VOID) if (SPITESTPREF(UPM_COMBOBOXANIMATION)) gpsi->PUSIFlags |= PUSIF_COMBOBOXANIMATION; if (SPITESTPREF(UPM_LISTBOXSMOOTHSCROLLING)) gpsi->PUSIFlags |= PUSIF_LISTBOXSMOOTHSCROLLING; } - gdwLanguageToggleKey = UserGetLanguageToggle(); + gdwLanguageToggleKey = UserGetLanguageToggle(L"Language Hotkey", 1); + gdwLayoutToggleKey = UserGetLanguageToggle(L"Layout Hotkey", 2); g_bWindowSnapEnabled = IntIsWindowSnapEnabled(); } @@ -1470,9 +1471,9 @@ SpiGetSet(UINT uiAction, UINT uiParam, PVOID pvParam, FLONG fl) } case SPI_SETLANGTOGGLE: - gdwLanguageToggleKey = UserGetLanguageToggle(); + gdwLayoutToggleKey = UserGetLanguageToggle(L"Layout Hotkey", 2); + gdwLanguageToggleKey = UserGetLanguageToggle(L"Language Hotkey", 1); return gdwLanguageToggleKey; - break; case SPI_GETWINDOWSEXTENSION: ERR("SPI_GETWINDOWSEXTENSION is unimplemented\n"); diff --git a/win32ss/user/user32/windows/defwnd.c b/win32ss/user/user32/windows/defwnd.c index cbb421209dc..dbc5b43e9ff 100644 --- a/win32ss/user/user32/windows/defwnd.c +++ b/win32ss/user/user32/windows/defwnd.c @@ -547,22 +547,27 @@ User32DefWindowProc(HWND hWnd, case WM_INPUTLANGCHANGEREQUEST: { - HKL NewHkl; + HKL hNewKL; + HWND hwndFocus; - if(wParam & INPUTLANGCHANGE_BACKWARD - && wParam & INPUTLANGCHANGE_FORWARD) - { + if ((wParam & INPUTLANGCHANGE_BACKWARD) && (wParam & INPUTLANGCHANGE_FORWARD)) return FALSE; - } - - //FIXME: What to do with INPUTLANGCHANGE_SYSCHARSET ? - if(wParam & INPUTLANGCHANGE_BACKWARD) NewHkl = (HKL) HKL_PREV; - else if(wParam & INPUTLANGCHANGE_FORWARD) NewHkl = (HKL) HKL_NEXT; - else NewHkl = (HKL) lParam; + hwndFocus = GetFocus(); + if (hwndFocus && hwndFocus != hWnd && + GetClassLongPtrW(hWnd, GCW_ATOM) != (ULONG_PTR)WC_DIALOG) + { + return SendMessageW(hwndFocus, Msg, wParam, lParam); + } - NtUserActivateKeyboardLayout(NewHkl, KLF_SETFORPROCESS); + if (wParam & INPUTLANGCHANGE_FORWARD) + hNewKL = (HKL)UlongToHandle(HKL_NEXT); + else if (wParam & INPUTLANGCHANGE_BACKWARD) + hNewKL = (HKL)UlongToHandle(HKL_PREV); + else + hNewKL = (HKL)lParam; + NtUserActivateKeyboardLayout(hNewKL, KLF_SETFORPROCESS); return TRUE; }
1 year, 2 months
1
0
0
0
[reactos] 01/01: [SHELL32][SDK] Implement CopyStreamUI (#5848)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8a049d0b68ac18d4dfdaf…
commit 8a049d0b68ac18d4dfdaf4db3d3a2ef9bce2f607 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Oct 31 22:32:02 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Oct 31 22:32:02 2023 +0900 [SHELL32][SDK] Implement CopyStreamUI (#5848) - Modify shell32.spec. - Add CopyStreamUI prototype to <undocshell.h>. CORE-19278 --- dll/win32/shell32/shell32.spec | 2 +- dll/win32/shell32/stubs.cpp | 11 ---- dll/win32/shell32/utils.cpp | 117 +++++++++++++++++++++++++++++++++++++++ sdk/include/reactos/undocshell.h | 8 +++ 4 files changed, 126 insertions(+), 12 deletions(-) diff --git a/dll/win32/shell32/shell32.spec b/dll/win32/shell32/shell32.spec index dbdbfabd758..eb8685fe3c6 100644 --- a/dll/win32/shell32/shell32.spec +++ b/dll/win32/shell32/shell32.spec @@ -444,7 +444,7 @@ 723 stdcall -noname SHCreateSessionKey(long ptr) 724 stdcall -noname SHIsTempDisplayMode() 725 stdcall -noname GetFileDescriptor(ptr long long wstr) -726 stdcall -noname CopyStreamUI(ptr ptr ptr) +726 stdcall -noname CopyStreamUI(ptr ptr ptr int64) 727 stdcall SHGetImageList(long ptr ptr) 730 stdcall RestartDialogEx(long wstr long long) 731 stdcall -noname -stub SHRegisterDarwinLink(long long long) diff --git a/dll/win32/shell32/stubs.cpp b/dll/win32/shell32/stubs.cpp index b1e153fdb67..91e8ae00beb 100644 --- a/dll/win32/shell32/stubs.cpp +++ b/dll/win32/shell32/stubs.cpp @@ -86,17 +86,6 @@ SHReValidateDarwinCache(VOID) FIXME("SHReValidateDarwinCache() stub\n"); } -/* - * Unimplemented - */ -EXTERN_C HRESULT -WINAPI -CopyStreamUI(IStream *pSrc, IStream *pDst, IProgressDialog *pProgDlg) -{ - FIXME("CopyStreamUI() stub\n"); - return E_FAIL; -} - /* * Unimplemented */ diff --git a/dll/win32/shell32/utils.cpp b/dll/win32/shell32/utils.cpp index 697a4f59cea..1e7cfbe28ac 100644 --- a/dll/win32/shell32/utils.cpp +++ b/dll/win32/shell32/utils.cpp @@ -540,6 +540,123 @@ LargeIntegerToString( pNumberFormat, dwNumberFlags); } +/************************************************************************* + * CopyStreamUI [SHELL32.726] + * + * Copy a stream to another stream with optional progress display. + */ +EXTERN_C +HRESULT WINAPI +CopyStreamUI( + _In_ IStream *pSrc, + _Out_ IStream *pDst, + _Inout_opt_ IProgressDialog *pProgress, + _In_opt_ DWORDLONG dwlSize) +{ + HRESULT hr = E_FAIL; + DWORD cbBuff, cbRead, dwSizeToWrite; + DWORDLONG cbDone; + LPVOID pBuff; + CComHeapPtr<BYTE> pHeapPtr; + STATSTG Stat; + BYTE abBuff[1024]; + + TRACE("(%p, %p, %p, %I64u)\n", pSrc, pDst, pProgress, dwlSize); + + if (dwlSize == 0) // Invalid size? + { + // Get the stream size + ZeroMemory(&Stat, sizeof(Stat)); + if (FAILED(pSrc->Stat(&Stat, STATFLAG_NONAME))) + pProgress = NULL; // No size info. Disable progress + else + dwlSize = Stat.cbSize.QuadPart; + } + + if (!pProgress) // Progress is disabled? + { + ULARGE_INTEGER uliSize; + + if (dwlSize > 0) + uliSize.QuadPart = dwlSize; + else + uliSize.HighPart = uliSize.LowPart = INVALID_FILE_SIZE; + + return pSrc->CopyTo(pDst, uliSize, NULL, NULL); // One punch + } + + // Allocate the buffer if necessary + if (dwlSize > 0 && dwlSize <= sizeof(abBuff)) + { + cbBuff = sizeof(abBuff); + pBuff = abBuff; + } + else + { +#define COPY_STREAM_DEFAULT_BUFFER_SIZE 0x4000 + cbBuff = COPY_STREAM_DEFAULT_BUFFER_SIZE; + if (pHeapPtr.AllocateBytes(cbBuff)) + { + pBuff = pHeapPtr; + } + else // Low memory? + { + cbBuff = sizeof(abBuff); + pBuff = abBuff; + } +#undef COPY_STREAM_DEFAULT_BUFFER_SIZE + } + + // Start reading + LARGE_INTEGER zero; + zero.QuadPart = 0; + pSrc->Seek(zero, 0, NULL); + pDst->Seek(zero, 0, NULL); + cbDone = 0; + pProgress->SetProgress64(cbDone, dwlSize); + + // Repeat reading and writing until goal + for (;;) + { + hr = pSrc->Read(pBuff, cbBuff, &cbRead); + if (FAILED(hr)) + break; + + // Calculate the size to write + if (dwlSize > 0) + dwSizeToWrite = (DWORD)min((DWORDLONG)(dwlSize - cbDone), (DWORDLONG)cbRead); + else + dwSizeToWrite = cbRead; + + if (dwSizeToWrite == 0) // No need to write? + { + hr = S_OK; + break; + } + + hr = pDst->Write(pBuff, dwSizeToWrite, NULL); + if (hr != S_OK) + break; + + cbDone += dwSizeToWrite; + + if (pProgress->HasUserCancelled()) // Cancelled? + { + hr = HRESULT_FROM_WIN32(ERROR_CANCELLED); + break; + } + pProgress->SetProgress64(cbDone, dwlSize); + + if (dwlSize > 0 && cbDone >= dwlSize) // Reached the goal? + { + hr = S_OK; + break; + } + } + + return hr; +} + /************************************************************************* * SHOpenPropSheetA [SHELL32.707] * diff --git a/sdk/include/reactos/undocshell.h b/sdk/include/reactos/undocshell.h index 95cc7b6998b..8fad6faa6a8 100644 --- a/sdk/include/reactos/undocshell.h +++ b/sdk/include/reactos/undocshell.h @@ -817,6 +817,14 @@ LONG WINAPI SHRegQueryValueExW( #define SHRegQueryValueEx SHRegQueryValueExA #endif +EXTERN_C +HRESULT WINAPI +CopyStreamUI( + _In_ IStream *pSrc, + _Out_ IStream *pDst, + _Inout_opt_ IProgressDialog *pProgress, + _In_opt_ DWORDLONG dwlSize); + /***************************************************************************** * INVALID_FILETITLE_CHARACTERS */
1 year, 2 months
1
0
0
0
[reactos] 01/01: [BDASUP][KMIXER][MMIXER][STREAM] Replace meaningless YDEBUG (#5818)
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=60b0afc3af8b05781885c…
commit 60b0afc3af8b05781885c217be2779fb1cfcf1c8 Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com> AuthorDate: Tue Oct 31 13:04:24 2023 +0100 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Oct 31 12:04:24 2023 +0000 [BDASUP][KMIXER][MMIXER][STREAM] Replace meaningless YDEBUG (#5818) bdasup: Addendum to 40c15ec (r46632). kmixer: Addendum to 3e489bf (r42143). mmixer: Addendum to c42d9f2 (r44872). stream: Addendum to 4a0debf (r41662). Serge plans a follow up that will remove all other remaining YDEBUG in the source tree. The ones covered here he considered to be the most trivial ones. --- drivers/multimedia/bdasup/precomp.h | 2 +- drivers/wdm/audio/filters/kmixer/filter.c | 3 +-- drivers/wdm/audio/filters/kmixer/kmixer.c | 4 +--- drivers/wdm/audio/legacy/stream/stream.h | 3 ++- sdk/lib/drivers/sound/mmixer/controls.c | 9 +-------- sdk/lib/drivers/sound/mmixer/filter.c | 2 +- sdk/lib/drivers/sound/mmixer/midi.c | 2 +- sdk/lib/drivers/sound/mmixer/mixer.c | 4 +--- sdk/lib/drivers/sound/mmixer/sup.c | 5 +---- sdk/lib/drivers/sound/mmixer/topology.c | 10 +--------- sdk/lib/drivers/sound/mmixer/wave.c | 8 +------- 11 files changed, 12 insertions(+), 40 deletions(-) diff --git a/drivers/multimedia/bdasup/precomp.h b/drivers/multimedia/bdasup/precomp.h index 45a603ddecd..be258b38783 100644 --- a/drivers/multimedia/bdasup/precomp.h +++ b/drivers/multimedia/bdasup/precomp.h @@ -10,7 +10,7 @@ #include <bdamedia.h> #include <bdasup.h> -#define YDEBUG +// #define NDEBUG #include <debug.h> diff --git a/drivers/wdm/audio/filters/kmixer/filter.c b/drivers/wdm/audio/filters/kmixer/filter.c index 5d84eb2c2d0..f2112b758b1 100644 --- a/drivers/wdm/audio/filters/kmixer/filter.c +++ b/drivers/wdm/audio/filters/kmixer/filter.c @@ -10,7 +10,7 @@ #include <swenum.h> -#define YDEBUG +// #define NDEBUG #include <debug.h> NTSTATUS @@ -199,4 +199,3 @@ KMixAllocateDeviceHeader( CreateItem); return Status; } - diff --git a/drivers/wdm/audio/filters/kmixer/kmixer.c b/drivers/wdm/audio/filters/kmixer/kmixer.c index 978e46565cd..b9ae6e68af9 100644 --- a/drivers/wdm/audio/filters/kmixer/kmixer.c +++ b/drivers/wdm/audio/filters/kmixer/kmixer.c @@ -8,7 +8,7 @@ #include "kmixer.h" -#define YDEBUG +// #define NDEBUG #include <debug.h> NTSTATUS @@ -72,7 +72,6 @@ KMix_AddDevice( /* initialize device extension */ RtlZeroMemory(DeviceExtension, sizeof(KMIXER_DEVICE_EXT)); - Status = KMixAllocateDeviceHeader(DeviceExtension); if (!NT_SUCCESS(Status)) { @@ -98,7 +97,6 @@ cleanup: return Status; } - NTSTATUS NTAPI DriverEntry( diff --git a/drivers/wdm/audio/legacy/stream/stream.h b/drivers/wdm/audio/legacy/stream/stream.h index 5994d91be56..09054368ea0 100644 --- a/drivers/wdm/audio/legacy/stream/stream.h +++ b/drivers/wdm/audio/legacy/stream/stream.h @@ -1,7 +1,8 @@ #pragma once #include <strmini.h> -#define YDEBUG + +// #define NDEBUG #include <debug.h> #define STREAMDEBUG_LEVEL DebugLevelMaximum diff --git a/sdk/lib/drivers/sound/mmixer/controls.c b/sdk/lib/drivers/sound/mmixer/controls.c index 3b5a8036b25..a7521bf4dd3 100644 --- a/sdk/lib/drivers/sound/mmixer/controls.c +++ b/sdk/lib/drivers/sound/mmixer/controls.c @@ -8,7 +8,7 @@ #include "precomp.h" -#define YDEBUG +// #define NDEBUG #include <debug.h> const GUID KSNODETYPE_DESKTOP_MICROPHONE = {0xDFF21BE2, 0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; @@ -56,7 +56,6 @@ MMixerAddMixerControl( return MM_STATUS_NO_MEMORY; } - /* initialize mixer control */ MixerControl->hDevice = hMixer; MixerControl->NodeID = NodeIndex; @@ -263,7 +262,6 @@ MMixerCreateDestinationLine( DestinationLine->Line.dwUser = 0; DestinationLine->Line.fdwLine = MIXERLINE_LINEF_ACTIVE; - if (LineName) { MixerContext->Copy(DestinationLine->Line.szShortName, LineName, (min(MIXER_SHORT_NAME_CHARS, wcslen(LineName)+1)) * sizeof(WCHAR)); @@ -564,7 +562,6 @@ MMixerGetChannelCountEnhanced( Request.Property.Flags = KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_TOPOLOGY; Request.Property.Id = KSPROPERTY_AUDIO_VOLUMELEVEL; - /* get description */ Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Request, sizeof(KSP_NODE), (PVOID)&Description, sizeof(KSPROPERTY_DESCRIPTION), &BytesReturned); if (Status == MM_STATUS_SUCCESS) @@ -772,7 +769,6 @@ MMixerGetComponentAndTargetType( Request.Property.Set = KSPROPSETID_Pin; Request.Property.Id = KSPROPERTY_PIN_CATEGORY; - /* get pin category */ Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Request, sizeof(KSP_PIN), &Guid, sizeof(GUID), &BytesReturned); if (Status != MM_STATUS_SUCCESS) @@ -1163,7 +1159,6 @@ MMixerAddMixerSourceLines( return MM_STATUS_SUCCESS; } - MIXER_STATUS MMixerAddMixerControlsToDestinationLine( IN PMIXER_CONTEXT MixerContext, @@ -1623,7 +1618,6 @@ MMixerInitializeFilter( } } - /* now get the bridge pin which is at the end of node path * For sink pins (wave out) search down stream * For source pins (wave in) search up stream @@ -1829,7 +1823,6 @@ MMixerSetupFilter( return Status; } - MIXER_STATUS MMixerAddEvent( IN PMIXER_CONTEXT MixerContext, diff --git a/sdk/lib/drivers/sound/mmixer/filter.c b/sdk/lib/drivers/sound/mmixer/filter.c index a41bcee7bb7..19033c831ad 100644 --- a/sdk/lib/drivers/sound/mmixer/filter.c +++ b/sdk/lib/drivers/sound/mmixer/filter.c @@ -8,7 +8,7 @@ #include "precomp.h" -#define YDEBUG +// #define NDEBUG #include <debug.h> ULONG diff --git a/sdk/lib/drivers/sound/mmixer/midi.c b/sdk/lib/drivers/sound/mmixer/midi.c index 969f252773a..acca89ca5ad 100644 --- a/sdk/lib/drivers/sound/mmixer/midi.c +++ b/sdk/lib/drivers/sound/mmixer/midi.c @@ -8,7 +8,7 @@ #include "precomp.h" -#define YDEBUG +// #define NDEBUG #include <debug.h> MIXER_STATUS diff --git a/sdk/lib/drivers/sound/mmixer/mixer.c b/sdk/lib/drivers/sound/mmixer/mixer.c index 3b8d900bef6..4b98ed53ae3 100644 --- a/sdk/lib/drivers/sound/mmixer/mixer.c +++ b/sdk/lib/drivers/sound/mmixer/mixer.c @@ -8,7 +8,7 @@ #include "precomp.h" -#define YDEBUG +// #define NDEBUG #include <debug.h> ULONG @@ -106,7 +106,6 @@ MMixerOpen( /* add the event */ Status = MMixerAddEvent(MixerContext, MixerInfo, MixerEventContext, MixerEventRoutine); - /* store result */ *MixerHandle = (HANDLE)MixerInfo; return MM_STATUS_SUCCESS; @@ -687,7 +686,6 @@ MMixerPrintMixers( DPRINT1("WaveOutCount %lu\n", MixerList->WaveOutListCount); DPRINT1("MixerCount %p\n", MixerList->MixerListCount); - for(Index = 0; Index < MixerList->MixerListCount; Index++) { /* get mixer info */ diff --git a/sdk/lib/drivers/sound/mmixer/sup.c b/sdk/lib/drivers/sound/mmixer/sup.c index 4fa8c080309..cfd5ab8b0b1 100644 --- a/sdk/lib/drivers/sound/mmixer/sup.c +++ b/sdk/lib/drivers/sound/mmixer/sup.c @@ -8,7 +8,7 @@ #include "precomp.h" -#define YDEBUG +// #define NDEBUG #include <debug.h> const GUID KSNODETYPE_SUM = {0xDA441A60L, 0xC556, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; @@ -36,7 +36,6 @@ const GUID KSDATAFORMAT_TYPE_MUSIC = {0xE725D360L, 0x62CC, 0x11CF, {0xA5, 0xD6, const GUID KSDATAFORMAT_SUBTYPE_MIDI = {0x1D262760L, 0xE957, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}; const GUID KSDATAFORMAT_SPECIFIER_NONE = {0x0F6417D6L, 0xC318, 0x11D0, {0xA4, 0x3F, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; - MIXER_STATUS MMixerVerifyContext( IN PMIXER_CONTEXT MixerContext) @@ -125,7 +124,6 @@ MMixerFreeMixerInfo( MixerContext->Free((PVOID)MixerInfo); } - LPMIXER_DATA MMixerGetMixerDataByDeviceHandle( IN PMIXER_CONTEXT MixerContext, @@ -156,7 +154,6 @@ MMixerGetMixerDataByDeviceHandle( return NULL; } - LPMIXER_INFO MMixerGetMixerInfoByIndex( IN PMIXER_CONTEXT MixerContext, diff --git a/sdk/lib/drivers/sound/mmixer/topology.c b/sdk/lib/drivers/sound/mmixer/topology.c index 136dc61dee1..29b1237436b 100644 --- a/sdk/lib/drivers/sound/mmixer/topology.c +++ b/sdk/lib/drivers/sound/mmixer/topology.c @@ -8,7 +8,7 @@ #include "precomp.h" -#define YDEBUG +// #define NDEBUG #include <debug.h> VOID @@ -37,11 +37,8 @@ MMixerPrintTopology( Topology->TopologyNodes[Index].NodeConnectedFromCount, Topology->TopologyNodes[Index].NodeConnectedToCount, Topology->TopologyNodes[Index].Visited, Topology->TopologyNodes[Index].PinConnectedFromCount, Topology->TopologyNodes[Index].PinConnectedToCount); } - - } - MIXER_STATUS MMixerAllocateTopology( IN PMIXER_CONTEXT MixerContext, @@ -708,7 +705,6 @@ MMixerGetNodeIndexFromGuid( return MAXULONG; } - VOID MMixerGetAllUpOrDownstreamPinsFromNodeIndex( IN PMIXER_CONTEXT MixerContext, @@ -848,7 +844,6 @@ MMixerGetAllUpOrDownstreamPinsFromPinIndex( TopologyPinsCount = Pin->PinConnectedToCount; } - /* reset visited status */ MMixerResetTopologyVisitStatus(Topology); @@ -906,7 +901,6 @@ MMixerGetAllUpOrDownstreamNodesFromPinIndex( TopologyNodesCount = Pin->NodesConnectedToCount; } - /* reset visited status */ MMixerResetTopologyVisitStatus(Topology); @@ -924,7 +918,6 @@ MMixerGetAllUpOrDownstreamNodesFromPinIndex( } } - VOID MMixerGetNextNodesFromPinIndex( IN PMIXER_CONTEXT MixerContext, @@ -1248,7 +1241,6 @@ MMixerIsTopologyNodeReserved( *bReserved = Topology->TopologyNodes[NodeIndex].Reserved; } - MIXER_STATUS MMixerCreateTopology( IN PMIXER_CONTEXT MixerContext, diff --git a/sdk/lib/drivers/sound/mmixer/wave.c b/sdk/lib/drivers/sound/mmixer/wave.c index 6326e3227d7..e049ca485bd 100644 --- a/sdk/lib/drivers/sound/mmixer/wave.c +++ b/sdk/lib/drivers/sound/mmixer/wave.c @@ -8,7 +8,7 @@ #include "precomp.h" -#define YDEBUG +// #define NDEBUG #include <debug.h> const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}; @@ -111,9 +111,6 @@ MMixerGetWaveInfoByIndexAndType( return MM_STATUS_INVALID_PARAMETER; } - - - VOID MMixerInitializeDataFormat( IN PKSDATAFORMAT_WAVEFORMATEX DataFormat, @@ -137,7 +134,6 @@ MMixerInitializeDataFormat( DataFormat->DataFormat.SampleSize = 4; } - MIXER_STATUS MMixerGetAudioPinDataRanges( IN PMIXER_CONTEXT MixerContext, @@ -307,7 +303,6 @@ MMixerCheckFormat( /* check if pin supports the sample rate in 16-Bit Mono */ Result |= TestRange[Index].Bit16Mono; - if (DataRangeAudio->MaximumChannels > 1) { /* check if pin supports the sample rate in 16-Bit Stereo */ @@ -317,7 +312,6 @@ MMixerCheckFormat( } } - if (bInput) WaveInfo->u.InCaps.dwFormats = Result; else
1 year, 2 months
1
0
0
0
[reactos] 01/01: [MSPAINT] Delete needless ImageModel::ResetToPrevious
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6d7aaaade0a4735165e83…
commit 6d7aaaade0a4735165e8307d0d7dec3eaedf8156 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Oct 31 11:13:54 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Tue Oct 31 11:13:54 2023 +0900 [MSPAINT] Delete needless ImageModel::ResetToPrevious CORE-19094 --- base/applications/mspaint/history.cpp | 12 ------------ base/applications/mspaint/history.h | 1 - 2 files changed, 13 deletions(-) diff --git a/base/applications/mspaint/history.cpp b/base/applications/mspaint/history.cpp index 283b5f0c083..22aaf6835f4 100644 --- a/base/applications/mspaint/history.cpp +++ b/base/applications/mspaint/history.cpp @@ -89,18 +89,6 @@ void ImageModel::Redo() NotifyImageChanged(); } -void ImageModel::ResetToPrevious() -{ - ATLTRACE("%s: %d\n", __FUNCTION__, m_currInd); - - // Revert current item with previous item - ::DeleteObject(m_hBms[m_currInd]); - m_hBms[m_currInd] = CopyDIBImage(m_hBms[(m_currInd + HISTORYSIZE - 1) % HISTORYSIZE]); - ::SelectObject(m_hDrawingDC, m_hBms[m_currInd]); - - NotifyImageChanged(); -} - void ImageModel::ClearHistory() { for (int i = 0; i < HISTORYSIZE; ++i) diff --git a/base/applications/mspaint/history.h b/base/applications/mspaint/history.h index 093dd1c34dd..716db560a8e 100644 --- a/base/applications/mspaint/history.h +++ b/base/applications/mspaint/history.h @@ -21,7 +21,6 @@ public: BOOL CanRedo() const { return m_redoSteps > 0; } void PushImageForUndo(); void PushImageForUndo(HBITMAP hbm); - void ResetToPrevious(void); void Undo(BOOL bClearRedo = FALSE); void Redo(void); void ClearHistory(void);
1 year, 2 months
1
0
0
0
[reactos] 01/01: [NTUSER] Disable SC_MOVE if WS_MAXIMIZE or WS_MINIMIZE (#5855)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ad12c6cdea05e2164396e…
commit ad12c6cdea05e2164396e3794e9bee7b821cc709 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Oct 31 06:50:00 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Oct 31 06:50:00 2023 +0900 [NTUSER] Disable SC_MOVE if WS_MAXIMIZE or WS_MINIMIZE (#5855) Based on KRosUser's scmove.patch. - Check also WS_MINIMIZE window style to determine to disable SC_MOVE system command. CORE-19272 --- win32ss/user/ntuser/menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32ss/user/ntuser/menu.c b/win32ss/user/ntuser/menu.c index 6b2f242cc25..a5273ea2096 100644 --- a/win32ss/user/ntuser/menu.c +++ b/win32ss/user/ntuser/menu.c @@ -1366,7 +1366,7 @@ void FASTCALL MENU_InitSysMenuPopup(PMENU menu, DWORD style, DWORD clsStyle, LON gray = !(style & WS_THICKFRAME) || (style & (WS_MAXIMIZE | WS_MINIMIZE)); IntEnableMenuItem( menu, SC_SIZE, (gray ? MF_GRAYED : MF_ENABLED) ); - gray = ((style & WS_MAXIMIZE) != 0); + gray = ((style & (WS_MAXIMIZE | WS_MINIMIZE)) != 0); IntEnableMenuItem( menu, SC_MOVE, (gray ? MF_GRAYED : MF_ENABLED) ); gray = !(style & WS_MINIMIZEBOX) || (style & WS_MINIMIZE); IntEnableMenuItem( menu, SC_MINIMIZE, (gray ? MF_GRAYED : MF_ENABLED) );
1 year, 2 months
1
0
0
0
[reactos] 01/01: [SHELL32] Improve file properties dialog (#5852)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=00f192fa94068d9ad3ce8…
commit 00f192fa94068d9ad3ce8397864850a04227bea1 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Mon Oct 30 15:34:03 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Mon Oct 30 15:34:03 2023 +0900 [SHELL32] Improve file properties dialog (#5852) Based on KRosUser's patches. - Add missing version strings "Comments" and "LegalTrademarks". - Add version strings "PrivateBuild" and "SpecialBuild" if necessary. - Trim the version string for pretty display. CORE-19270, CORE-19114, CORE-19275 --- dll/win32/shell32/dialogs/filedefext.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dll/win32/shell32/dialogs/filedefext.cpp b/dll/win32/shell32/dialogs/filedefext.cpp index d9f0c0e6aee..03890b20a83 100644 --- a/dll/win32/shell32/dialogs/filedefext.cpp +++ b/dll/win32/shell32/dialogs/filedefext.cpp @@ -852,6 +852,14 @@ CFileDefExt::InitVersionPage(HWND hwndDlg) AddVersionString(hwndDlg, L"OriginalFilename"); AddVersionString(hwndDlg, L"FileVersion"); AddVersionString(hwndDlg, L"ProductVersion"); + AddVersionString(hwndDlg, L"Comments"); + AddVersionString(hwndDlg, L"LegalTrademarks"); + + if (pInfo && (pInfo->dwFileFlags & VS_FF_PRIVATEBUILD)) + AddVersionString(hwndDlg, L"PrivateBuild"); + + if (pInfo && (pInfo->dwFileFlags & VS_FF_SPECIALBUILD)) + AddVersionString(hwndDlg, L"SpecialBuild"); /* Attach file version to dialog window */ SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)this); @@ -957,8 +965,11 @@ CFileDefExt::VersionPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (pwszData == NULL) break; - TRACE("hDlgCtrl %x string %s\n", hDlgCtrl, debugstr_w(pwszData)); - SetDlgItemTextW(hwndDlg, 14010, pwszData); + CString str(pwszData); + str.Trim(); + + TRACE("hDlgCtrl %x string %s\n", hDlgCtrl, debugstr_w(str)); + SetDlgItemTextW(hwndDlg, 14010, str); return TRUE; }
1 year, 2 months
1
0
0
0
[reactos] 01/01: [KBSWITCH] Update layout list on WM_NOTIFYICONMSG
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=87f94aa10ca4b0c47469d…
commit 87f94aa10ca4b0c47469de280419d2aa28a5c54e Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Mon Oct 30 10:40:27 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Mon Oct 30 10:40:27 2023 +0900 [KBSWITCH] Update layout list on WM_NOTIFYICONMSG The layout list was not updated correctly. CORE-10667 --- base/applications/kbswitch/kbswitch.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/base/applications/kbswitch/kbswitch.c b/base/applications/kbswitch/kbswitch.c index bc9e698774a..72b517384a7 100644 --- a/base/applications/kbswitch/kbswitch.c +++ b/base/applications/kbswitch/kbswitch.c @@ -145,16 +145,9 @@ static VOID UpdateLayoutList(HKL hKL OPTIONAL) if (!hKL) { - if (0 <= (g_nCurrentLayoutNum - 1) && (g_nCurrentLayoutNum - 1) < g_cKLs) - { - hKL = g_ahKLs[g_nCurrentLayoutNum - 1]; - } - else - { - HWND hwndTarget = (g_hwndLastActive ? g_hwndLastActive : GetForegroundWindow()); - DWORD dwTID = GetWindowThreadProcessId(hwndTarget, NULL); - hKL = GetKeyboardLayout(dwTID); - } + HWND hwndTarget = (g_hwndLastActive ? g_hwndLastActive : GetForegroundWindow()); + DWORD dwTID = GetWindowThreadProcessId(hwndTarget, NULL); + hKL = GetKeyboardLayout(dwTID); } g_cKLs = GetKeyboardLayoutList(ARRAYSIZE(g_ahKLs), g_ahKLs); @@ -737,6 +730,8 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) case WM_RBUTTONUP: case WM_LBUTTONUP: { + UpdateLayoutList(NULL); + GetCursorPos(&pt); SetForegroundWindow(hwnd);
1 year, 2 months
1
0
0
0
[reactos] 01/01: [MSPAINT] Fix ImageModel::PushImageForUndo bug
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aed376e00f65c496524f2…
commit aed376e00f65c496524f2e413ba2f1182b730361 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Mon Oct 30 07:41:57 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Mon Oct 30 07:41:57 2023 +0900 [MSPAINT] Fix ImageModel::PushImageForUndo bug CORE-19274 --- base/applications/mspaint/history.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/applications/mspaint/history.cpp b/base/applications/mspaint/history.cpp index 003d0ab5877..283b5f0c083 100644 --- a/base/applications/mspaint/history.cpp +++ b/base/applications/mspaint/history.cpp @@ -119,7 +119,7 @@ void ImageModel::ClearHistory() void ImageModel::PushImageForUndo() { HBITMAP hbm = CopyBitmap(); - if (hbm) + if (hbm == NULL) { ShowOutOfMemory(); return;
1 year, 2 months
1
0
0
0
[reactos] 03/03: [SHLWAPI_APITEST] Fix MSVC compilation warning C4309
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bdae8cf96695fe1e7302d…
commit bdae8cf96695fe1e7302da46227052d0faf822ef Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sat Oct 28 18:17:46 2023 +0200 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Sat Oct 28 18:19:04 2023 +0200 [SHLWAPI_APITEST] Fix MSVC compilation warning C4309 SHPropertyBag.cpp(161): warning C4309: 'initializing': truncation of constant value See
https://stackoverflow.com/questions/33333448/warning-c4309-what-does-it-mea…
for some details. --- modules/rostests/apitests/shlwapi/SHPropertyBag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/rostests/apitests/shlwapi/SHPropertyBag.cpp b/modules/rostests/apitests/shlwapi/SHPropertyBag.cpp index c155693e214..b767d4a4e6d 100644 --- a/modules/rostests/apitests/shlwapi/SHPropertyBag.cpp +++ b/modules/rostests/apitests/shlwapi/SHPropertyBag.cpp @@ -158,7 +158,7 @@ static void SHPropertyBag_ReadTest(void) HRESULT hr; CDummyPropertyBag dummy; BOOL bValue = 0xDEADFACE; - SHORT sValue = 0xDEAD; + SHORT sValue = 0xDEADu; LONG lValue = 0xDEADDEAD; DWORD dwValue = 0xFEEDF00D; BSTR bstr = NULL;
1 year, 2 months
1
0
0
0
← Newer
1
2
3
4
...
14
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Results per page:
10
25
50
100
200