https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bf92fa2386e6e271c6cbc…
commit bf92fa2386e6e271c6cbcbe07de64007e571e35f
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Jan 6 19:21:37 2024 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Jan 6 19:21:37 2024 +0900
[MSCTFIME][MSUTB][SDK] Add cicInitUIFLib and cicDoneUIFLib (#6307)
Supporting TIPs...
JIRA issue: CORE-19360
- Implement cicInitUIFLib and cicDoneUIFLib functions.
- Use them in msctfime and msutb.
- Add CUIFSystemInfo class in <cicero/cicuif.h>.
---
dll/ime/msctfime/msctfime.cpp | 16 +------
dll/win32/msutb/msutb.cpp | 20 +-------
dll/win32/msutb/precomp.h | 2 +-
sdk/include/reactos/cicero/cicuif.h | 96 +++++++++++++++++++++++++++++++++++++
4 files changed, 101 insertions(+), 33 deletions(-)
diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp
index 884b01a500b..c1353076be1 100644
--- a/dll/ime/msctfime/msctfime.cpp
+++ b/dll/ime/msctfime/msctfime.cpp
@@ -3646,18 +3646,6 @@ VOID DetachIME(VOID)
UnregisterImeClass();
}
-/// @unimplemented
-VOID InitUIFLib(VOID)
-{
- //FIXME
-}
-
-/// @unimplemented
-VOID DoneUIFLib(VOID)
-{
- //FIXME
-}
-
/// @implemented
BOOL ProcessAttach(HINSTANCE hinstDLL)
{
@@ -3670,7 +3658,7 @@ BOOL ProcessAttach(HINSTANCE hinstDLL)
cicGetOSInfo(&g_uACP, &g_dwOSInfo);
- InitUIFLib();
+ cicInitUIFLib();
if (!TFInitLib())
return FALSE;
@@ -3695,7 +3683,7 @@ VOID ProcessDetach(HINSTANCE hinstDLL)
DeleteCriticalSection(&g_csLock);
TLS::InternalDestroyTLS();
TLS::Uninitialize();
- DoneUIFLib();
+ cicDoneUIFLib();
}
/// @implemented
diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp
index 29ecbe7d330..4ba8f878913 100644
--- a/dll/win32/msutb/msutb.cpp
+++ b/dll/win32/msutb/msutb.cpp
@@ -121,22 +121,6 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return gModule.DllGetClassObject(rclsid, riid, ppv);
}
-/**
- * @unimplemented
- */
-VOID InitUIFLib(VOID)
-{
- //FIXME
-}
-
-/**
- * @unimplemented
- */
-VOID DoneUIFLib(VOID)
-{
- //FIXME
-}
-
/**
* @implemented
*/
@@ -167,7 +151,7 @@ BOOL ProcessAttach(HINSTANCE hinstDLL)
cicGetOSInfo(&g_uACP, &g_dwOSInfo);
TFInitLib(MsUtbCoCreateInstance);
- InitUIFLib();
+ cicInitUIFLib();
//CTrayIconWnd::RegisterClassW(); //FIXME
@@ -184,7 +168,7 @@ BOOL ProcessAttach(HINSTANCE hinstDLL)
*/
VOID ProcessDetach(HINSTANCE hinstDLL)
{
- DoneUIFLib();
+ cicDoneUIFLib();
TFUninitLib();
::DeleteCriticalSection(&g_cs);
gModule.Term();
diff --git a/dll/win32/msutb/precomp.h b/dll/win32/msutb/precomp.h
index 0a77ed7f3ef..d4579a7511b 100644
--- a/dll/win32/msutb/precomp.h
+++ b/dll/win32/msutb/precomp.h
@@ -24,7 +24,7 @@
#include <atlcom.h>
#include <strsafe.h>
#undef STATUS_NO_MEMORY
-#include <cicero/cicbase.h>
+#include <cicero/cicuif.h>
#include <wine/debug.h>
diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h
index 9745484075d..6bc52280640 100644
--- a/sdk/include/reactos/cicero/cicuif.h
+++ b/sdk/include/reactos/cicero/cicuif.h
@@ -9,6 +9,7 @@
#include "cicarray.h"
+class CUIFSystemInfo;
struct CUIFTheme;
class CUIFObject;
class CUIFWindow;
@@ -21,6 +22,27 @@ class CUIFScheme;
/////////////////////////////////////////////////////////////////////////////
+class CUIFSystemInfo : OSVERSIONINFO
+{
+public:
+ static CUIFSystemInfo *s_pSystemInfo;
+ DWORD m_cBitsPixels;
+ BOOL m_bHighContrast1;
+ BOOL m_bHighContrast2;
+
+ CUIFSystemInfo();
+ void GetSystemMetrics();
+ void Initialize();
+};
+
+DECLSPEC_SELECTANY CUIFSystemInfo *CUIFSystemInfo::s_pSystemInfo = NULL;
+
+void cicInitUIFSys(void);
+void cicDoneUIFSys(void);
+void cicUpdateUIFSys(void);
+
+/////////////////////////////////////////////////////////////////////////////
+
#include <uxtheme.h>
// uxtheme.dll
@@ -340,6 +362,80 @@ class CUIFWindow : public CUIFObject
/////////////////////////////////////////////////////////////////////////////
+inline void cicInitUIFLib(void)
+{
+ cicInitUIFSys();
+ cicInitUIFScheme();
+ cicInitUIFUtil();
+}
+
+inline void cicDoneUIFLib(void)
+{
+ cicDoneUIFScheme();
+ cicDoneUIFSys();
+ cicDoneUIFUtil();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+inline CUIFSystemInfo::CUIFSystemInfo()
+{
+ dwMajorVersion = 4;
+ dwMinorVersion = 0;
+ dwBuildNumber = 0;
+ dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
+ m_cBitsPixels = 8;
+ m_bHighContrast1 = m_bHighContrast2 = FALSE;
+}
+
+inline void CUIFSystemInfo::GetSystemMetrics()
+{
+ HDC hDC = ::GetDC(NULL);
+ m_cBitsPixels = ::GetDeviceCaps(hDC, BITSPIXEL);
+ ::ReleaseDC(NULL, hDC);
+
+ HIGHCONTRAST HighContrast = { sizeof(HighContrast) };
+ ::SystemParametersInfo(SPI_GETHIGHCONTRAST, sizeof(HighContrast), &HighContrast,
0);
+ m_bHighContrast1 = !!(HighContrast.dwFlags & HCF_HIGHCONTRASTON);
+ COLORREF rgbBtnText = ::GetSysColor(COLOR_BTNTEXT);
+ COLORREF rgbBtnFace = ::GetSysColor(COLOR_BTNFACE);
+ const COLORREF black = RGB(0, 0, 0), white = RGB(255, 255, 255);
+ m_bHighContrast2 = (m_bHighContrast1 ||
+ (rgbBtnText == black && rgbBtnFace == white) ||
+ (rgbBtnText == white && rgbBtnFace == black));
+}
+
+inline void CUIFSystemInfo::Initialize()
+{
+ dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ ::GetVersionEx(this);
+ GetSystemMetrics();
+}
+
+inline void cicInitUIFSys(void)
+{
+ CUIFSystemInfo::s_pSystemInfo = new(cicNoThrow) CUIFSystemInfo();
+ if (CUIFSystemInfo::s_pSystemInfo)
+ CUIFSystemInfo::s_pSystemInfo->Initialize();
+}
+
+inline void cicDoneUIFSys(void)
+{
+ if (CUIFSystemInfo::s_pSystemInfo)
+ {
+ delete CUIFSystemInfo::s_pSystemInfo;
+ CUIFSystemInfo::s_pSystemInfo = NULL;
+ }
+}
+
+inline void cicUpdateUIFSys(void)
+{
+ if (CUIFSystemInfo::s_pSystemInfo)
+ CUIFSystemInfo::s_pSystemInfo->GetSystemMetrics();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
inline HRESULT CUIFTheme::InternalOpenThemeData(HWND hWnd)
{
if (!hWnd || !m_pszClassList)