[MSCTFIME] Implement CModeBias (#6515)

Supporting TIPs...
JIRA issue: CORE-19360
- Rename compartment.cpp as
  misc.cpp.
- Implement CModeBias class.
This commit is contained in:
Katayama Hirofumi MZ 2024-02-22 18:43:08 +09:00 committed by GitHub
parent 7d0b5482f6
commit 9262df661e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 68 additions and 4 deletions

View file

@ -6,9 +6,9 @@ spec2def(msctfime.ime msctfime.spec)
list(APPEND SOURCE
bridge.cpp
compartment.cpp
functions.cpp
inputcontext.cpp
misc.cpp
msctfime.cpp
profile.cpp
sinks.cpp

View file

@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS msctfime.ime
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Supporting compartments
* PURPOSE: Miscellaneous of msctfime.ime
* COPYRIGHT: Copyright 2024 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
@ -161,3 +161,50 @@ ClearCompartment(
return hr;
}
/***********************************************************************/
struct MODEBIAS
{
REFGUID m_guid;
LONG m_bias;
};
static const MODEBIAS g_ModeBiasMap[] =
{
{ GUID_MODEBIAS_FILENAME, 0x00000001 },
{ GUID_MODEBIAS_NUMERIC, 0x00000004 },
{ GUID_MODEBIAS_URLHISTORY, 0x00010000 },
{ GUID_MODEBIAS_DEFAULT, 0x00000000 },
{ GUID_MODEBIAS_NONE, 0x00000000 },
};
void CModeBias::SetModeBias(REFGUID rguid)
{
m_guid = rguid;
}
GUID CModeBias::ConvertModeBias(LONG bias)
{
const GUID *pguid = &GUID_NULL;
for (auto& item : g_ModeBiasMap)
{
if (item.m_bias == bias)
{
pguid = &item.m_guid;
break;
}
}
return *pguid;
}
LONG CModeBias::ConvertModeBias(REFGUID guid)
{
for (auto& item : g_ModeBiasMap)
{
if (IsEqualGUID(guid, item.m_guid))
return item.m_bias;
}
return 0;
}

View file

@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS msctfime.ime
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Supporting compartments
* PURPOSE: Miscellaneous of msctfime.ime
* COPYRIGHT: Copyright 2024 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
@ -42,3 +42,15 @@ ClearCompartment(
IUnknown *pUnknown,
REFGUID rguid,
BOOL bThread);
/***********************************************************************/
class CModeBias
{
public:
GUID m_guid;
GUID ConvertModeBias(LONG bias);
LONG ConvertModeBias(REFGUID guid);
void SetModeBias(REFGUID rguid);
};

View file

@ -50,13 +50,18 @@ static inline HIMC GetActiveContext(VOID)
DEFINE_GUID(GUID_COMPARTMENT_CTFIME_DIMFLAGS, 0xA94C5FD2, 0xC471, 0x4031, 0x95, 0x46, 0x70, 0x9C, 0x17, 0x30, 0x0C, 0xB9);
DEFINE_GUID(GUID_COMPARTMENT_CTFIME_CICINPUTCONTEXT, 0x85A688F7, 0x6DC8, 0x4F17, 0xA8, 0x3A, 0xB1, 0x1C, 0x09, 0xCD, 0xD7, 0xBF);
DEFINE_GUID(GUID_MODEBIAS_FILENAME, 0xD7F707FE, 0x44C6, 0x4FCA, 0x8E, 0x76, 0x86, 0xAB, 0x50, 0xC7, 0x93, 0x1B);
DEFINE_GUID(GUID_MODEBIAS_NUMERIC, 0x4021766C, 0xE872, 0x48FD, 0x9C, 0xEE, 0x4E, 0xC5, 0xC7, 0x5E, 0x16, 0xC3);
DEFINE_GUID(GUID_MODEBIAS_URLHISTORY, 0x8B0E54D9, 0x63F2, 0x4C68, 0x84, 0xD4, 0x79, 0xAE, 0xE7, 0xA5, 0x9F, 0x09);
DEFINE_GUID(GUID_MODEBIAS_DEFAULT, 0xF3DA8BD4, 0x0786, 0x49C2, 0x8C, 0x09, 0x68, 0x39, 0xD8, 0xB8, 0x4F, 0x58);
#define GUID_MODEBIAS_NONE GUID_NULL
#include "resource.h"
#include "bridge.h"
#include "compartment.h"
#include "functions.h"
#include "inputcontext.h"
#include "misc.h"
#include "profile.h"
#include "sinks.h"
#include "tls.h"