[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>.
This commit is contained in:
Katayama Hirofumi MZ 2024-01-06 19:21:37 +09:00 committed by GitHub
parent afb132a90b
commit bf92fa2386
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 101 additions and 33 deletions

View file

@ -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

View file

@ -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();

View file

@ -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>

View file

@ -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)