https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9262df661e9f679c2f73c…
commit 9262df661e9f679c2f73c95404454d1efafda696
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Feb 22 18:43:08 2024 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Feb 22 18:43:08 2024 +0900
[MSCTFIME] Implement CModeBias (#6515)
Supporting TIPs...
JIRA issue: CORE-19360
- Rename compartment.cpp as
misc.cpp.
- Implement CModeBias class.
---
dll/ime/msctfime/CMakeLists.txt | 2 +-
dll/ime/msctfime/{compartment.cpp => misc.cpp} | 49 +++++++++++++++++++++++++-
dll/ime/msctfime/{compartment.h => misc.h} | 14 +++++++-
dll/ime/msctfime/msctfime.h | 7 +++-
4 files changed, 68 insertions(+), 4 deletions(-)
diff --git a/dll/ime/msctfime/CMakeLists.txt b/dll/ime/msctfime/CMakeLists.txt
index 3a48a7cbabb..0e5acc805b0 100644
--- a/dll/ime/msctfime/CMakeLists.txt
+++ b/dll/ime/msctfime/CMakeLists.txt
@@ -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
diff --git a/dll/ime/msctfime/compartment.cpp b/dll/ime/msctfime/misc.cpp
similarity index 76%
rename from dll/ime/msctfime/compartment.cpp
rename to dll/ime/msctfime/misc.cpp
index d92b1b526f4..18e01939ada 100644
--- a/dll/ime/msctfime/compartment.cpp
+++ b/dll/ime/msctfime/misc.cpp
@@ -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(a)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;
+}
diff --git a/dll/ime/msctfime/compartment.h b/dll/ime/msctfime/misc.h
similarity index 74%
rename from dll/ime/msctfime/compartment.h
rename to dll/ime/msctfime/misc.h
index 88805566832..ca96a227f54 100644
--- a/dll/ime/msctfime/compartment.h
+++ b/dll/ime/msctfime/misc.h
@@ -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(a)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);
+};
diff --git a/dll/ime/msctfime/msctfime.h b/dll/ime/msctfime/msctfime.h
index cb482318830..28597863047 100644
--- a/dll/ime/msctfime/msctfime.h
+++ b/dll/ime/msctfime/msctfime.h
@@ -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"