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
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
January 2024
----- 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
17 participants
181 discussions
Start a n
N
ew thread
[reactos] 01/01: [MSCTFIME][SDK] Implement CicCaret class (#6287)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=35f83286c5e5fad1e307a…
commit 35f83286c5e5fad1e307ac51c05dca5507dc594c Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 3 19:55:14 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Jan 3 19:55:14 2024 +0900 [MSCTFIME][SDK] Implement CicCaret class (#6287) Supporting TIPs... UIComposition class requires a caret class. JIRA issue: CORE-19360 - Add <cicero/ciccaret.h> header. - Add CicCaret class for displaying a caret. --- dll/ime/msctfime/msctfime.h | 1 + sdk/include/reactos/cicero/ciccaret.h | 135 ++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) diff --git a/dll/ime/msctfime/msctfime.h b/dll/ime/msctfime/msctfime.h index 0fe3b49d5d7..4ffbc4195d5 100644 --- a/dll/ime/msctfime/msctfime.h +++ b/dll/ime/msctfime/msctfime.h @@ -27,6 +27,7 @@ #include <cicero/cicarray.h> #include <cicero/cicimc.h> #include <cicero/cictf.h> +#include <cicero/ciccaret.h> #include <wine/debug.h> diff --git a/sdk/include/reactos/cicero/ciccaret.h b/sdk/include/reactos/cicero/ciccaret.h new file mode 100644 index 00000000000..b6d7722d58f --- /dev/null +++ b/sdk/include/reactos/cicero/ciccaret.h @@ -0,0 +1,135 @@ +/* + * PROJECT: ReactOS Cicero + * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later
) + * PURPOSE: Displaying Cicero caret + * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> + */ + +#pragma once + +class CicCaret +{ +protected: + HWND m_hWnd; + UINT m_uCaretBlinkTimerID; + POINT m_pt; + SIZE m_size; + BOOL m_bCaretBlinking; + BOOL m_bCaretVisible; + +public: + enum { TIMER_ID = 0x4F83AF91 }; + CicCaret(); + virtual ~CicCaret(); + + void CreateCaret(HWND hWnd, SIZE size); + void DestroyCaret(); + void HideCaret(); + void InvertCaret(); + void OnTimer(); + void SetCaretPos(POINT pt); + void SetBlinking(BOOL bBlinking); +}; + +/***********************************************************************/ + +/** + * @implemented + */ +inline CicCaret::CicCaret() +{ + m_bCaretBlinking = FALSE; + m_bCaretVisible = FALSE; + m_uCaretBlinkTimerID = 0; + m_pt.x = m_pt.y = 0; + m_size.cx = m_size.cy = 0; +} + +/** + * @implemented + */ +inline CicCaret::~CicCaret() +{ + HideCaret(); + ::KillTimer(m_hWnd, m_uCaretBlinkTimerID); + m_uCaretBlinkTimerID = 0; +} + +/** + * @implemented + */ +inline void CicCaret::CreateCaret(HWND hWnd, SIZE size) +{ + m_hWnd = hWnd; + m_size = size; + if (::IsWindow(hWnd)) + m_uCaretBlinkTimerID = ::SetTimer(m_hWnd, TIMER_ID, ::GetCaretBlinkTime(), NULL); +} + +/** + * @implemented + */ +inline void CicCaret::DestroyCaret() +{ + HideCaret(); + ::KillTimer(m_hWnd, m_uCaretBlinkTimerID); + m_uCaretBlinkTimerID = 0; +} + +/** + * @implemented + */ +inline void CicCaret::HideCaret() +{ + if (m_bCaretVisible) + { + m_bCaretVisible = FALSE; + InvertCaret(); + } + m_bCaretBlinking = FALSE; +} + +/** + * @implemented + */ +inline void CicCaret::InvertCaret() +{ + HDC hDC = ::GetDC(m_hWnd); + ::PatBlt(hDC, m_pt.x, m_pt.y, m_size.cx, m_size.cy, DSTINVERT); + ::ReleaseDC(m_hWnd, hDC); +} + +/** + * @implemented + */ +inline void CicCaret::OnTimer() +{ + if (m_bCaretBlinking) + { + m_bCaretVisible = !m_bCaretVisible; + InvertCaret(); + } +} + +/** + * @implemented + */ +inline void CicCaret::SetCaretPos(POINT pt) +{ + BOOL bCaretVisible = m_bCaretVisible; + if (bCaretVisible) + InvertCaret(); + + m_pt = pt; + + if (bCaretVisible) + InvertCaret(); +} + +/** + * @implemented + */ +inline void CicCaret::SetBlinking(BOOL bBlinking) +{ + m_bCaretBlinking = bBlinking; +}
11 months, 3 weeks
1
0
0
0
[reactos] 01/01: [CTFMON][MSCTFIME][SDK] Define new(cicNoThrow) and use it (#6286)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b48e77e15bce680cc819c…
commit b48e77e15bce680cc819cb45a32e17ae107b8a52 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 3 16:45:23 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Jan 3 16:45:23 2024 +0900 [CTFMON][MSCTFIME][SDK] Define new(cicNoThrow) and use it (#6286) Use new(cicNoThrow) instead of plain operator new. JIRA issue: CORE-19360 - Define CicNoThrow structure and cicNoThrow macro in <cicero/cicbase.h>. - Use new(cicNoThrow) instead of plain operator new. --- base/applications/ctfmon/ctfmon.cpp | 2 +- dll/ime/msctfime/msctfime.cpp | 20 ++++++++++---------- sdk/include/reactos/cicero/cicbase.h | 23 ++++++++++++++++++----- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/base/applications/ctfmon/ctfmon.cpp b/base/applications/ctfmon/ctfmon.cpp index 5ea37a4eb20..6c255f18b2e 100644 --- a/base/applications/ctfmon/ctfmon.cpp +++ b/base/applications/ctfmon/ctfmon.cpp @@ -224,7 +224,7 @@ InitApp( CRegWatcher::Init(); // Create Tipbar loader window - g_pLoaderWnd = new CLoaderWnd(); + g_pLoaderWnd = new(cicNoThrow) CLoaderWnd(); if (!g_pLoaderWnd || !g_pLoaderWnd->Init()) return FALSE; diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index 319c7de72b6..30b0191a34d 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -1598,7 +1598,7 @@ CFunctionProvider::GetFunction( if (IsEqualGUID(guid, GUID_NULL) && IsEqualIID(riid, IID_IAImmFnDocFeed)) { - *func = new CFnDocFeed(); + *func = new(cicNoThrow) CFnDocFeed(); if (*func) return S_OK; } @@ -2147,7 +2147,7 @@ CicProfile::InitProfileInstance(_Inout_ TLS *pTLS) if (!m_pActiveLanguageProfileNotifySink) { CActiveLanguageProfileNotifySink *pSink = - new CActiveLanguageProfileNotifySink( + new(cicNoThrow) CActiveLanguageProfileNotifySink( CicProfile::ActiveLanguageProfileNotifySinkCallback, this); if (!pSink) { @@ -2326,7 +2326,7 @@ CicBridge::CreateInputContext( CicInputContext *pCicIC = imeContext.get().m_pCicIC; if (!pCicIC) { - pCicIC = new CicInputContext(m_cliendId, &m_LibThread, hIMC); + pCicIC = new(cicNoThrow) CicInputContext(m_cliendId, &m_LibThread, hIMC); if (!pCicIC) { imeContext.unlock(); @@ -2531,7 +2531,7 @@ CicBridge::ActivateIMMX( return hr; } - CFunctionProvider *pProvider = new CFunctionProvider(m_cliendId); + CFunctionProvider *pProvider = new(cicNoThrow) CFunctionProvider(m_cliendId); if (!pProvider) { hr = E_FAIL; @@ -2645,7 +2645,7 @@ CicBridge::InitIMMX(_Inout_ TLS *pTLS) if (!m_pThreadMgrEventSink) { m_pThreadMgrEventSink = - new CThreadMgrEventSink(CThreadMgrEventSink::DIMCallback, NULL, NULL); + new(cicNoThrow) CThreadMgrEventSink(CThreadMgrEventSink::DIMCallback, NULL, NULL); if (!m_pThreadMgrEventSink) { UnInitIMMX(pTLS); @@ -2658,7 +2658,7 @@ CicBridge::InitIMMX(_Inout_ TLS *pTLS) if (!pTLS->m_pProfile) { - pTLS->m_pProfile = new CicProfile(); + pTLS->m_pProfile = new(cicNoThrow) CicProfile(); if (!pTLS->m_pProfile) return E_OUTOFMEMORY; @@ -3297,7 +3297,7 @@ CtfImeCreateThreadMgr(VOID) if (!pTLS->m_pBridge) { - pTLS->m_pBridge = new CicBridge(); + pTLS->m_pBridge = new(cicNoThrow) CicBridge(); if (!pTLS->m_pBridge) return E_OUTOFMEMORY; } @@ -3337,7 +3337,7 @@ CtfImeDestroyThreadMgr(VOID) if (pTLS->m_pBridge) { - pTLS->m_pBridge = new CicBridge(); + pTLS->m_pBridge = new(cicNoThrow) CicBridge(); if (!pTLS->m_pBridge) return E_OUTOFMEMORY; } @@ -3604,7 +3604,7 @@ UI::~UI() */ HRESULT UI::_Create() { - m_pComp = new UIComposition(); + m_pComp = new(cicNoThrow) UIComposition(); if (!m_pComp) return E_OUTOFMEMORY; @@ -3630,7 +3630,7 @@ void UI::OnCreate(HWND hWnd) UI *pUI = (UI*)GetWindowLongPtrW(hWnd, UIGWLP_UI); if (pUI) return; - pUI = new UI(hWnd); + pUI = new(cicNoThrow) UI(hWnd); if (pUI) pUI->_Create(); } diff --git a/sdk/include/reactos/cicero/cicbase.h b/sdk/include/reactos/cicero/cicbase.h index 14958780ba3..d1c76a09957 100644 --- a/sdk/include/reactos/cicero/cicbase.h +++ b/sdk/include/reactos/cicero/cicbase.h @@ -34,17 +34,30 @@ static inline void cicMemFree(LPVOID ptr) LocalFree(ptr); } -inline void* __cdecl operator new(size_t size) noexcept +struct CicNoThrow { }; +#define cicNoThrow CicNoThrow{} + +inline void* operator new(size_t size, const CicNoThrow&) noexcept { return cicMemAllocClear(size); } - -inline void __cdecl operator delete(void* ptr) noexcept +inline void* operator new[](size_t size, const CicNoThrow&) noexcept +{ + return cicMemAllocClear(size); +} +inline void operator delete(void* ptr) noexcept { cicMemFree(ptr); } - -inline void __cdecl operator delete(void* ptr, size_t size) noexcept +inline void operator delete[](void* ptr) noexcept +{ + cicMemFree(ptr); +} +inline void operator delete(void* ptr, size_t size) noexcept +{ + cicMemFree(ptr); +} +inline void operator delete[](void* ptr, size_t size) noexcept { cicMemFree(ptr); }
11 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSCTFIME] Half-implement UIWndProc (#6285)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6cde331a8966845662b67…
commit 6cde331a8966845662b673819dc3e11411742489 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 3 13:52:54 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Jan 3 13:52:54 2024 +0900 [MSCTFIME] Half-implement UIWndProc (#6285) Supporting TIPs... JIRA issue: CORE-19360 - Add UIComposition and UI classes. - Add CIMEUIWindowHandler structure. - Half-implement UIWndProc by using them. --- dll/ime/msctfime/msctfime.cpp | 343 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 335 insertions(+), 8 deletions(-) diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index e1c2fd9cd62..319c7de72b6 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -3486,9 +3486,341 @@ CtfImeThreadDetach(VOID) return S_OK; } +/*********************************************************************** + * UIComposition + */ +struct UIComposition +{ + void OnImeStartComposition(CicIMCLock& imcLock, HWND hUIWnd); + void OnImeCompositionUpdate(CicIMCLock& imcLock); + void OnImeEndComposition(); + void OnImeSetContext(CicIMCLock& imcLock, HWND hUIWnd, WPARAM wParam, LPARAM lParam); + void OnPaintTheme(WPARAM wParam); + void OnDestroy(); + + static LRESULT CALLBACK CompWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +}; + +/** + * @unimplemented + */ +void UIComposition::OnImeStartComposition(CicIMCLock& imcLock, HWND hUIWnd) +{ + //FIXME +} + +/** + * @unimplemented + */ +void UIComposition::OnImeCompositionUpdate(CicIMCLock& imcLock) +{ + //FIXME +} + +/** + * @unimplemented + */ +void UIComposition::OnImeEndComposition() +{ + //FIXME +} + +/** + * @unimplemented + */ +void UIComposition::OnImeSetContext(CicIMCLock& imcLock, HWND hUIWnd, WPARAM wParam, LPARAM lParam) +{ + //FIXME +} + +/** + * @unimplemented + */ +void UIComposition::OnPaintTheme(WPARAM wParam) +{ + //FIXME +} + +/** + * @unimplemented + */ +void UIComposition::OnDestroy() +{ + //FIXME +} + +/** + * @unimplemented + */ +LRESULT CALLBACK +UIComposition::CompWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (uMsg == WM_CREATE) + return -1; // FIXME + return 0; +} + +/*********************************************************************** + * UI + */ +struct UI +{ + HWND m_hWnd; + UIComposition *m_pComp; + + UI(HWND hWnd); + virtual ~UI(); + + HRESULT _Create(); + void _Destroy(); + + static void OnCreate(HWND hWnd); + static void OnDestroy(HWND hWnd); + void OnImeSetContext(CicIMCLock& imcLock, WPARAM wParam, LPARAM lParam); +}; + +// For GetWindowLongPtr/SetWindowLongPtr +#define UIGWLP_HIMC 0 +#define UIGWLP_UI sizeof(HIMC) +#define UIGWLP_SIZE (UIGWLP_UI + sizeof(UI*)) + +/** + * @implemented + */ +UI::UI(HWND hWnd) : m_hWnd(hWnd) +{ +} + +/** + * @implemented + */ +UI::~UI() +{ + delete m_pComp; +} + +/** + * @unimplemented + */ +HRESULT UI::_Create() +{ + m_pComp = new UIComposition(); + if (!m_pComp) + return E_OUTOFMEMORY; + + SetWindowLongPtrW(m_hWnd, UIGWLP_UI, (LONG_PTR)this); + //FIXME + return S_OK; +} + +/** + * @implemented + */ +void UI::_Destroy() +{ + m_pComp->OnDestroy(); + SetWindowLongPtrW(m_hWnd, UIGWLP_UI, 0); +} + +/** + * @implemented + */ +void UI::OnCreate(HWND hWnd) +{ + UI *pUI = (UI*)GetWindowLongPtrW(hWnd, UIGWLP_UI); + if (pUI) + return; + pUI = new UI(hWnd); + if (pUI) + pUI->_Create(); +} + +/** + * @implemented + */ +void UI::OnDestroy(HWND hWnd) +{ + UI *pUI = (UI*)GetWindowLongPtrW(hWnd, UIGWLP_UI); + if (!pUI) + return; + + pUI->_Destroy(); + delete pUI; +} + +/** + * @implemented + */ +void UI::OnImeSetContext(CicIMCLock& imcLock, WPARAM wParam, LPARAM lParam) +{ + m_pComp->OnImeSetContext(imcLock, m_hWnd, wParam, lParam); +} + +/*********************************************************************** + * CIMEUIWindowHandler + */ + +struct CIMEUIWindowHandler +{ + static LRESULT CALLBACK ImeUIMsImeHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + static LRESULT CALLBACK ImeUIMsImeMouseHandler(HWND hWnd, WPARAM wParam, LPARAM lParam); + static LRESULT CALLBACK ImeUIMsImeModeBiasHandler(HWND hWnd, WPARAM wParam, LPARAM lParam); + static LRESULT CALLBACK ImeUIMsImeReconvertRequest(HWND hWnd, WPARAM wParam, LPARAM lParam); + static LRESULT CALLBACK ImeUIWndProcWorker(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +}; + +/** + * @unimplemented + */ +LRESULT CALLBACK +CIMEUIWindowHandler::ImeUIMsImeMouseHandler(HWND hWnd, WPARAM wParam, LPARAM lParam) +{ + return 0; //FIXME +} + +/** + * @unimplemented + */ +LRESULT CALLBACK +CIMEUIWindowHandler::ImeUIMsImeModeBiasHandler(HWND hWnd, WPARAM wParam, LPARAM lParam) +{ + return 0; //FIXME +} + +/** + * @unimplemented + */ +LRESULT CALLBACK +CIMEUIWindowHandler::ImeUIMsImeReconvertRequest(HWND hWnd, WPARAM wParam, LPARAM lParam) +{ + return 0; //FIXME +} + +/** + * @implemented + */ +LRESULT CALLBACK +CIMEUIWindowHandler::ImeUIMsImeHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (uMsg == WM_MSIME_MOUSE) + return ImeUIMsImeMouseHandler(hWnd, wParam, lParam); + if (uMsg == WM_MSIME_MODEBIAS) + return ImeUIMsImeModeBiasHandler(hWnd, wParam, lParam); + if (uMsg == WM_MSIME_RECONVERTREQUEST) + return ImeUIMsImeReconvertRequest(hWnd, wParam, lParam); + if (uMsg == WM_MSIME_SERVICE) + { + TLS *pTLS = TLS::GetTLS(); + if (pTLS && pTLS->m_pProfile) + { + LANGID LangID; + pTLS->m_pProfile->GetLangId(&LangID); + if (PRIMARYLANGID(LangID) == LANG_KOREAN) + return FALSE; + } + return TRUE; + } + return 0; +} + /** * @unimplemented */ +LRESULT CALLBACK +CIMEUIWindowHandler::ImeUIWndProcWorker(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + TLS *pTLS = TLS::GetTLS(); + if (pTLS && (pTLS->m_dwSystemInfoFlags & IME_SYSINFO_WINLOGON)) + { + if (uMsg == WM_CREATE) + return -1; + return DefWindowProcW(hWnd, uMsg, wParam, lParam); + } + + switch (uMsg) + { + case WM_CREATE: + { + UI::OnCreate(hWnd); + break; + } + case WM_DESTROY: + case WM_ENDSESSION: + { + UI::OnDestroy(hWnd); + break; + } + case WM_IME_STARTCOMPOSITION: + case WM_IME_COMPOSITION: + case WM_IME_ENDCOMPOSITION: + case WM_IME_SETCONTEXT: + case WM_IME_NOTIFY: + case WM_IME_SELECT: + case WM_TIMER: + { + HIMC hIMC = (HIMC)GetWindowLongPtrW(hWnd, UIGWLP_HIMC); + UI* pUI = (UI*)GetWindowLongPtrW(hWnd, UIGWLP_UI); + CicIMCLock imcLock(hIMC); + switch (uMsg) + { + case WM_IME_STARTCOMPOSITION: + { + pUI->m_pComp->OnImeStartComposition(imcLock, pUI->m_hWnd); + break; + } + case WM_IME_COMPOSITION: + { + if (lParam & GCS_COMPSTR) + { + pUI->m_pComp->OnImeCompositionUpdate(imcLock); + ::SetTimer(hWnd, 0, 10, NULL); + //FIXME + } + break; + } + case WM_IME_ENDCOMPOSITION: + { + ::KillTimer(hWnd, 0); + pUI->m_pComp->OnImeEndComposition(); + break; + } + case WM_IME_SETCONTEXT: + { + pUI->OnImeSetContext(imcLock, wParam, lParam); + ::KillTimer(hWnd, 1); + ::SetTimer(hWnd, 1, 300, NULL); + break; + } + case WM_TIMER: + { + //FIXME + ::KillTimer(hWnd, wParam); + break; + } + case WM_IME_NOTIFY: + case WM_IME_SELECT: + default: + { + pUI->m_pComp->OnPaintTheme(wParam); + break; + } + } + break; + } + default: + { + if (IsMsImeMessage(uMsg)) + return CIMEUIWindowHandler::ImeUIMsImeHandler(hWnd, uMsg, wParam, lParam); + return DefWindowProcW(hWnd, uMsg, wParam, lParam); + } + } + + return 0; +} + +/** + * @implemented + */ EXTERN_C LRESULT CALLBACK UIWndProc( _In_ HWND hWnd, @@ -3496,12 +3828,7 @@ UIWndProc( _In_ WPARAM wParam, _In_ LPARAM lParam) { - if (uMsg == WM_CREATE) - { - FIXME("stub\n"); - return -1; - } - return 0; + return CIMEUIWindowHandler::ImeUIWndProcWorker(hWnd, uMsg, wParam, lParam); } /** @@ -3515,7 +3842,7 @@ BOOL RegisterImeClass(VOID) { ZeroMemory(&wcx, sizeof(wcx)); wcx.cbSize = sizeof(WNDCLASSEXW); - wcx.cbWndExtra = sizeof(DWORD) * 2; + wcx.cbWndExtra = UIGWLP_SIZE; wcx.hIcon = LoadIconW(0, (LPCWSTR)IDC_ARROW); wcx.hInstance = g_hInst; wcx.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); @@ -3537,7 +3864,7 @@ BOOL RegisterImeClass(VOID) wcx.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_IBEAM); wcx.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); wcx.style = CS_IME | CS_HREDRAW | CS_VREDRAW; - //wcx.lpfnWndProc = UIComposition::CompWndProc; // FIXME + wcx.lpfnWndProc = UIComposition::CompWndProc; wcx.lpszClassName = L"MSCTFIME Composition"; if (!RegisterClassExW(&wcx)) return FALSE;
11 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSCTFIME] Implement CTextEventSink::_Advise and _Unadvise (#6284)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0e9939bd42aa9eb6535bf…
commit 0e9939bd42aa9eb6535bf9278f3959164cb522a5 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 3 10:50:48 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Jan 3 10:50:48 2024 +0900 [MSCTFIME] Implement CTextEventSink::_Advise and _Unadvise (#6284) Supporting TIPs... JIRA issue: CORE-19360 --- dll/ime/msctfime/msctfime.cpp | 69 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 10 deletions(-) diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index c9f235937bc..e1c2fd9cd62 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -609,7 +609,11 @@ protected: IUnknown *m_pUnknown; DWORD m_dwEditSinkCookie; DWORD m_dwLayoutSinkCookie; - FN_LAYOUTCHANGE m_fnLayoutChange; + union + { + UINT m_uFlags; + FN_LAYOUTCHANGE m_fnLayoutChange; + }; FN_ENDEDIT m_fnEndEdit; LPVOID m_pCallbackPV; @@ -742,18 +746,63 @@ STDMETHODIMP CTextEventSink::OnLayoutChange( } /** - * @unimplemented + * @implemented */ HRESULT CTextEventSink::_Advise(IUnknown *pUnknown, UINT uFlags) { - return E_NOTIMPL; + m_pUnknown = NULL; + m_uFlags = uFlags; + + ITfSource *pSource = NULL; + HRESULT hr = pUnknown->QueryInterface(IID_ITfSource, (void**)&pSource); + if (SUCCEEDED(hr)) + { + ITfTextEditSink *pSink = static_cast<ITfTextEditSink*>(this); + if (uFlags & 1) + hr = pSource->AdviseSink(IID_ITfTextEditSink, pSink, &m_dwEditSinkCookie); + if (SUCCEEDED(hr) && (uFlags & 2)) + hr = pSource->AdviseSink(IID_ITfTextLayoutSink, pSink, &m_dwLayoutSinkCookie); + + if (SUCCEEDED(hr)) + { + m_pUnknown = pUnknown; + pUnknown->AddRef(); + } + else + { + pSource->UnadviseSink(m_dwEditSinkCookie); + } + } + + if (pSource) + pSource->Release(); + + return hr; } /** - * @unimplemented + * @implemented */ HRESULT CTextEventSink::_Unadvise() { + if (!m_pUnknown) + return E_FAIL; + + ITfSource *pSource = NULL; + HRESULT hr = m_pUnknown->QueryInterface(IID_ITfSource, (void**)&pSource); + if (SUCCEEDED(hr)) + { + if (m_uFlags & 1) + hr = pSource->UnadviseSink(m_dwEditSinkCookie); + if (m_uFlags & 2) + hr = pSource->UnadviseSink(m_dwLayoutSinkCookie); + + pSource->Release(); + } + + m_pUnknown->Release(); + m_pUnknown = NULL; + return E_NOTIMPL; } @@ -772,7 +821,7 @@ public: HIMC m_hIMC; ITfDocumentMgr *m_pDocumentMgr; ITfContext *m_pContext; - IUnknown *m_pUnknown1; + ITfContextOwnerServices *m_pContextOwnerServices; CInputContextOwnerCallBack *m_pICOwnerCallback; CTextEventSink *m_pTextEventSink; CCompartmentEventSink *m_pCompEventSink1; @@ -988,14 +1037,14 @@ CicInputContext::DestroyInputContext() if (m_pCompEventSink2) { - //FIXME: m_pCompEventSink2->_Unadvise(); + m_pCompEventSink2->_Unadvise(); m_pCompEventSink2->Release(); m_pCompEventSink2 = NULL; } if (m_pCompEventSink1) { - //FIXME: m_pCompEventSink1->_Unadvise(); + m_pCompEventSink1->_Unadvise(); m_pCompEventSink1->Release(); m_pCompEventSink1 = NULL; } @@ -1012,10 +1061,10 @@ CicInputContext::DestroyInputContext() m_pContext = NULL; } - if (m_pUnknown1) + if (m_pContextOwnerServices) { - m_pUnknown1->Release(); - m_pUnknown1 = NULL; + m_pContextOwnerServices->Release(); + m_pContextOwnerServices = NULL; } // FIXME: m_pICOwnerCallback
11 months, 3 weeks
1
0
0
0
[reactos] 01/01: [COMCTL32][USER32] ComboBox: Don't close listbox on letter type (#6227)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b59bf8a3f40a12061157c…
commit b59bf8a3f40a12061157c2b9548fc06921358b44 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 3 08:45:24 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Jan 3 08:45:24 2024 +0900 [COMCTL32][USER32] ComboBox: Don't close listbox on letter type (#6227) Based on KRosUser's combo_v3.patch. JIRA issue: CORE-16376 - Set CBF_NOROLLUP flag on (WM_CHAR or WM_IME_CHAR) and CBF_DROPPED state. --- dll/win32/comctl32/combo.c | 4 ++++ win32ss/user/user32/controls/combo.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/dll/win32/comctl32/combo.c b/dll/win32/comctl32/combo.c index 62c2d4138a2..0c67b2ee729 100644 --- a/dll/win32/comctl32/combo.c +++ b/dll/win32/comctl32/combo.c @@ -1918,6 +1918,10 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam { HWND hwndTarget; +#ifdef __REACTOS__ + if (lphc->wState & CBF_DROPPED) + lphc->wState |= CBF_NOROLLUP; +#endif if ( lphc->wState & CBF_EDIT ) hwndTarget = lphc->hWndEdit; else diff --git a/win32ss/user/user32/controls/combo.c b/win32ss/user/user32/controls/combo.c index b29d5a36efb..c118b314233 100644 --- a/win32ss/user/user32/controls/combo.c +++ b/win32ss/user/user32/controls/combo.c @@ -2017,6 +2017,10 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR { HWND hwndTarget; +#ifdef __REACTOS__ + if (lphc->wState & CBF_DROPPED) + lphc->wState |= CBF_NOROLLUP; +#endif if ( lphc->wState & CBF_EDIT ) hwndTarget = lphc->hWndEdit; else
11 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSCTFIME][SDK] Half-implement CTextEventSink (#6274)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=006bdfa234a834e5b0a24…
commit 006bdfa234a834e5b0a2464bdd79f9eeed878156 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Jan 2 19:45:03 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Jan 2 19:45:03 2024 +0900 [MSCTFIME][SDK] Half-implement CTextEventSink (#6274) Supporting TIPs... JIRA issue: CORE-19360 - Add CTextEventSink class. - Add ITfTextLayoutSink interface into "msctf.idl". --- dll/ime/msctfime/msctfime.cpp | 167 +++++++++++++++++++++++++++++++++++++++++- sdk/include/psdk/msctf.idl | 21 ++++++ 2 files changed, 186 insertions(+), 2 deletions(-) diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index d0feb2008da..c9f235937bc 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -597,9 +597,166 @@ HRESULT CCompartmentEventSink::_Unadvise() } class CInputContextOwnerCallBack; -class CTextEventSink; class CInputContextOwner; +typedef INT (CALLBACK *FN_ENDEDIT)(INT, LPVOID, LPVOID); +typedef INT (CALLBACK *FN_LAYOUTCHANGE)(UINT nType, FN_ENDEDIT fnEndEdit, ITfContextView *pView); + +class CTextEventSink : public ITfTextEditSink, ITfTextLayoutSink +{ +protected: + LONG m_cRefs; + IUnknown *m_pUnknown; + DWORD m_dwEditSinkCookie; + DWORD m_dwLayoutSinkCookie; + FN_LAYOUTCHANGE m_fnLayoutChange; + FN_ENDEDIT m_fnEndEdit; + LPVOID m_pCallbackPV; + +public: + CTextEventSink(FN_ENDEDIT fnEndEdit, LPVOID pCallbackPV); + virtual ~CTextEventSink(); + + HRESULT _Advise(IUnknown *pUnknown, UINT uFlags); + HRESULT _Unadvise(); + + // IUnknown interface + STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj) override; + STDMETHODIMP_(ULONG) AddRef() override; + STDMETHODIMP_(ULONG) Release() override; + + // ITfTextEditSink interface + STDMETHODIMP OnEndEdit( + ITfContext *pic, + TfEditCookie ecReadOnly, + ITfEditRecord *pEditRecord) override; + + // ITfTextLayoutSink interface + STDMETHODIMP + OnLayoutChange( + ITfContext *pContext, + TfLayoutCode lcode, + ITfContextView *pContextView) override; +}; + +/** + * @implemented + */ +CTextEventSink::CTextEventSink(FN_ENDEDIT fnEndEdit, LPVOID pCallbackPV) +{ + m_cRefs = 1; + m_pUnknown = NULL; + m_dwEditSinkCookie = (DWORD)-1; + m_dwLayoutSinkCookie = (DWORD)-1; + m_fnLayoutChange = NULL; + m_fnEndEdit = fnEndEdit; + m_pCallbackPV = pCallbackPV; +} + +/** + * @implemented + */ +CTextEventSink::~CTextEventSink() +{ +} + +/** + * @implemented + */ +STDMETHODIMP CTextEventSink::QueryInterface(REFIID riid, LPVOID* ppvObj) +{ + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfTextEditSink)) + { + *ppvObj = this; + AddRef(); + return S_OK; + } + if (IsEqualIID(riid, IID_ITfTextLayoutSink)) + { + *ppvObj = static_cast<ITfTextLayoutSink*>(this); + AddRef(); + return S_OK; + } + return E_NOINTERFACE; +} + +/** + * @implemented + */ +STDMETHODIMP_(ULONG) CTextEventSink::AddRef() +{ + return ::InterlockedIncrement(&m_cRefs); +} + +/** + * @implemented + */ +STDMETHODIMP_(ULONG) CTextEventSink::Release() +{ + if (::InterlockedDecrement(&m_cRefs) == 0) + { + delete this; + return 0; + } + return m_cRefs; +} + +struct TEXT_EVENT_SINK_END_EDIT +{ + TfEditCookie m_ecReadOnly; + ITfEditRecord *m_pEditRecord; + ITfContext *m_pContext; +}; + +/** + * @implemented + */ +STDMETHODIMP CTextEventSink::OnEndEdit( + ITfContext *pic, + TfEditCookie ecReadOnly, + ITfEditRecord *pEditRecord) +{ + TEXT_EVENT_SINK_END_EDIT Data = { ecReadOnly, pEditRecord, pic }; + return m_fnEndEdit(1, m_pCallbackPV, (LPVOID)&Data); +} + +/** + * @implemented + */ +STDMETHODIMP CTextEventSink::OnLayoutChange( + ITfContext *pContext, + TfLayoutCode lcode, + ITfContextView *pContextView) +{ + switch (lcode) + { + case TF_LC_CREATE: + return m_fnLayoutChange(3, m_fnEndEdit, pContextView); + case TF_LC_CHANGE: + return m_fnLayoutChange(2, m_fnEndEdit, pContextView); + case TF_LC_DESTROY: + return m_fnLayoutChange(4, m_fnEndEdit, pContextView); + default: + return E_INVALIDARG; + } +} + +/** + * @unimplemented + */ +HRESULT CTextEventSink::_Advise(IUnknown *pUnknown, UINT uFlags) +{ + return E_NOTIMPL; +} + +/** + * @unimplemented + */ +HRESULT CTextEventSink::_Unadvise() +{ + return E_NOTIMPL; +} + /*********************************************************************** * CicInputContext * @@ -821,7 +978,13 @@ CicInputContext::DestroyInputContext() pSource->UnadviseSingleSink(m_clientId, IID_ITfCleanupContextSink); //FIXME: m_dwUnknown5 - //FIXME: m_pTextEventSink + + if (m_pTextEventSink) + { + m_pTextEventSink->_Unadvise(); + m_pTextEventSink->Release(); + m_pTextEventSink = NULL; + } if (m_pCompEventSink2) { diff --git a/sdk/include/psdk/msctf.idl b/sdk/include/psdk/msctf.idl index e3d642c651c..60219b328e0 100644 --- a/sdk/include/psdk/msctf.idl +++ b/sdk/include/psdk/msctf.idl @@ -109,6 +109,7 @@ interface ITfKeyEventSink; interface ITfPersistentPropertyLoaderACP; interface ITfRangeACP; interface ITfCleanupContextSink; +interface ITfTextLayoutSink; cpp_quote("#if 0") typedef [uuid(4f5d560f-5ab5-4dde-8c4d-404592857ab0)] UINT_PTR HKL; @@ -1919,3 +1920,23 @@ interface ITfTransitoryExtensionSink : IUnknown [in] ITfRange *pCompositionRange, [out] BOOL *pfDeleteResultRange); } + +[ + object, + uuid(2af2d06a-dd5b-4927-a0b4-54f19c91fade), + pointer_default(unique) +] +interface ITfTextLayoutSink : IUnknown +{ + typedef [uuid(603553cf-9edd-4cc1-9ecc-069e4a427734)] enum + { + TF_LC_CREATE = 0, + TF_LC_CHANGE = 1, + TF_LC_DESTROY = 2 + } TfLayoutCode; + + HRESULT OnLayoutChange( + [in] ITfContext *pic, + [in] TfLayoutCode lcode, + [in] ITfContextView *pView); +}
11 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSCTFIME] Strengthen CicInputContext (#6273)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f9489f48760fe3823b8d1…
commit f9489f48760fe3823b8d135087bb63967b97841f Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Jan 2 15:33:37 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Jan 2 15:33:37 2024 +0900 [MSCTFIME] Strengthen CicInputContext (#6273) Supporting Text Input Processors (TIPs)... JIRA issue: CORE-19360 --- dll/ime/msctfime/msctfime.cpp | 112 +++++++++++++++++++++++++++++++++++------- 1 file changed, 93 insertions(+), 19 deletions(-) diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index 28a1c55d4df..d0feb2008da 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -17,7 +17,8 @@ DWORD g_dwOSInfo = 0; BOOL gfTFInitLib = FALSE; CRITICAL_SECTION g_csLock; -DEFINE_GUID(GUID_COMPARTMENT_CTFIME_DIMFLAGS, 0xA94C5FD2, 0xC471, 0x4031, 0x95, 0x46, 0x70, 0x9C, 0x17, 0x30, 0x0C, 0xB9); +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); EXTERN_C void __cxa_pure_virtual(void) { @@ -148,6 +149,14 @@ HRESULT InitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread) return E_NOTIMPL; } +HIMC GetActiveContext(VOID) +{ + HWND hwndFocus = ::GetFocus(); + if (!hwndFocus) + hwndFocus = ::GetActiveWindow(); + return ::ImmGetContext(hwndFocus); +} + /** * @implemented */ @@ -588,6 +597,8 @@ HRESULT CCompartmentEventSink::_Unadvise() } class CInputContextOwnerCallBack; +class CTextEventSink; +class CInputContextOwner; /*********************************************************************** * CicInputContext @@ -600,29 +611,32 @@ class CicInputContext , public ITfCompositionSink { public: - ITfContextOwnerCompositionSink *m_pContextOwnerCompositionSink; - DWORD m_dwUnknown0; LONG m_cRefs; HIMC m_hIMC; ITfDocumentMgr *m_pDocumentMgr; ITfContext *m_pContext; - DWORD m_dwUnknown1; + IUnknown *m_pUnknown1; CInputContextOwnerCallBack *m_pICOwnerCallback; - LPVOID m_pTextEventSink; + CTextEventSink *m_pTextEventSink; CCompartmentEventSink *m_pCompEventSink1; CCompartmentEventSink *m_pCompEventSink2; - DWORD m_dwUnknown3[4]; + CInputContextOwner *m_pInputContextOwner; + DWORD m_dwUnknown3[3]; DWORD m_dwUnknown4[2]; DWORD m_dwQueryPos; DWORD m_dwUnknown5; GUID m_guid; DWORD m_dwUnknown6[11]; BOOL m_bSelecting; - DWORD m_dwUnknown7[7]; + DWORD m_dwUnknown6_5; + LONG m_cCompLocks; + DWORD m_dwUnknown7[5]; WORD m_cGuidAtoms; WORD m_padding; DWORD m_adwGuidAtoms[256]; - DWORD m_dwUnknown8[19]; + DWORD m_dwUnknown8[17]; + TfClientId m_clientId; + DWORD m_dwUnknown9; public: CicInputContext( @@ -672,7 +686,7 @@ CicInputContext::CicInputContext( } /** - * @unimplemented + * @implemented */ STDMETHODIMP CicInputContext::QueryInterface(REFIID riid, LPVOID* ppvObj) { @@ -680,11 +694,11 @@ STDMETHODIMP CicInputContext::QueryInterface(REFIID riid, LPVOID* ppvObj) if (IsEqualIID(riid, IID_ITfContextOwnerCompositionSink)) { - *ppvObj = (ITfContextOwnerCompositionSink*)this; + *ppvObj = static_cast<ITfContextOwnerCompositionSink*>(this); AddRef(); return S_OK; } - if (IsEqualIID(riid, IID_IUnknown)) + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfCleanupContextSink)) { *ppvObj = this; AddRef(); @@ -716,35 +730,45 @@ STDMETHODIMP_(ULONG) CicInputContext::Release() } /** - * @unimplemented + * @implemented */ STDMETHODIMP CicInputContext::OnStartComposition( ITfCompositionView *pComposition, BOOL *pfOk) { - return E_NOTIMPL; + if ((m_cCompLocks <= 0) || m_dwUnknown6_5) + { + *pfOk = TRUE; + ++m_cCompLocks; + } + else + { + *pfOk = FALSE; + } + return S_OK; } /** - * @unimplemented + * @implemented */ STDMETHODIMP CicInputContext::OnUpdateComposition( ITfCompositionView *pComposition, ITfRange *pRangeNew) { - return E_NOTIMPL; + return S_OK; } /** - * @unimplemented + * @implemented */ STDMETHODIMP CicInputContext::OnEndComposition( ITfCompositionView *pComposition) { - return E_NOTIMPL; + --m_cCompLocks; + return S_OK; } /** @@ -791,8 +815,58 @@ CicInputContext::CreateInputContext( HRESULT CicInputContext::DestroyInputContext() { - // FIXME - return E_NOTIMPL; + ITfSourceSingle *pSource = NULL; + + if (m_pContext && m_pContext->QueryInterface(IID_ITfSourceSingle, (void **)&pSource) == S_OK) + pSource->UnadviseSingleSink(m_clientId, IID_ITfCleanupContextSink); + + //FIXME: m_dwUnknown5 + //FIXME: m_pTextEventSink + + if (m_pCompEventSink2) + { + //FIXME: m_pCompEventSink2->_Unadvise(); + m_pCompEventSink2->Release(); + m_pCompEventSink2 = NULL; + } + + if (m_pCompEventSink1) + { + //FIXME: m_pCompEventSink1->_Unadvise(); + m_pCompEventSink1->Release(); + m_pCompEventSink1 = NULL; + } + + //FIXME: m_pInputContextOwner + + if (m_pDocumentMgr) + m_pDocumentMgr->Pop(1); + + if (m_pContext) + { + ClearCompartment(m_clientId, m_pContext, GUID_COMPARTMENT_CTFIME_CICINPUTCONTEXT, 0); + m_pContext->Release(); + m_pContext = NULL; + } + + if (m_pUnknown1) + { + m_pUnknown1->Release(); + m_pUnknown1 = NULL; + } + + // FIXME: m_pICOwnerCallback + + if (m_pDocumentMgr) + { + m_pDocumentMgr->Release(); + m_pDocumentMgr = NULL; + } + + if (pSource) + pSource->Release(); + + return S_OK; } /**
11 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSCTFIME][SDK] Implement CFunctionProvider (#6269)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=88107adc9249bcc7eb691…
commit 88107adc9249bcc7eb691a8b3f97a797bb58d5ab Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Mon Jan 1 16:36:49 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Mon Jan 1 16:36:49 2024 +0900 [MSCTFIME][SDK] Implement CFunctionProvider (#6269) Supporting TIPs... JIRA issue: CORE-19360 Define CFunctionProviderBase class. Define CFunctionProvider class. Strengthen <cicero/cictf.h>. --- dll/ime/msctfime/msctfime.cpp | 233 +++++++++++++++++++++++++++++++++++-- sdk/include/reactos/cicero/cictf.h | 13 +++ 2 files changed, 235 insertions(+), 11 deletions(-) diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index c5bfab1abdb..28a1c55d4df 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -6,6 +6,7 @@ */ #include "msctfime.h" +#include <ndk/ldrfuncs.h> /* for RtlDllShutdownInProgress */ WINE_DEFAULT_DEBUG_CHANNEL(msctfime); @@ -1071,24 +1072,132 @@ HRESULT CThreadMgrEventSink::_Unadvise() return hr; } -/* FIXME */ -class CFunctionProvider : public IUnknown +class CFunctionProviderBase : public ITfFunctionProvider { +protected: + TfClientId m_clientId; + GUID m_guid; + BSTR m_bstr; + LONG m_cRefs; + public: - CFunctionProvider(_In_ TfClientId clientId) - { - } + CFunctionProviderBase(_In_ TfClientId clientId); + virtual ~CFunctionProviderBase(); // IUnknown interface - STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj) override; + STDMETHODIMP QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObj) override; STDMETHODIMP_(ULONG) AddRef() override; STDMETHODIMP_(ULONG) Release() override; + + // ITfFunctionProvider interface + STDMETHODIMP GetType(_Out_ GUID *guid) override; + STDMETHODIMP GetDescription(_Out_ BSTR *desc) override; + //STDMETHODIMP GetFunction(_In_ REFGUID guid, _In_ REFIID riid, _Out_ IUnknown **func) = 0; + + BOOL Init(_In_ REFGUID rguid, _In_ LPCWSTR psz); }; +/** + * @implemented + */ +CFunctionProviderBase::CFunctionProviderBase(_In_ TfClientId clientId) +{ + m_clientId = clientId; + m_guid = GUID_NULL; + m_bstr = NULL; + m_cRefs = 1; +} + +/** + * @implemented + */ +CFunctionProviderBase::~CFunctionProviderBase() +{ + if (!RtlDllShutdownInProgress()) + ::SysFreeString(m_bstr); +} + +/** + * @implemented + */ +BOOL +CFunctionProviderBase::Init( + _In_ REFGUID rguid, + _In_ LPCWSTR psz) +{ + m_bstr = ::SysAllocString(psz); + m_guid = rguid; + return (m_bstr != NULL); +} + +class CFnDocFeed : public IAImmFnDocFeed +{ + LONG m_cRefs; + +public: + CFnDocFeed(); + virtual ~CFnDocFeed(); + + // IUnknown interface + STDMETHODIMP QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObj) override; + STDMETHODIMP_(ULONG) AddRef() override; + STDMETHODIMP_(ULONG) Release() override; + + // IAImmFnDocFeed interface + STDMETHODIMP DocFeed() override; + STDMETHODIMP ClearDocFeedBuffer() override; + STDMETHODIMP StartReconvert() override; + STDMETHODIMP StartUndoCompositionString() override; +}; + +CFnDocFeed::CFnDocFeed() +{ + m_cRefs = 1; +} + +CFnDocFeed::~CFnDocFeed() +{ +} + +/** + * @implemented + */ +STDMETHODIMP CFnDocFeed::QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObj) +{ + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IAImmFnDocFeed)) + { + *ppvObj = this; + AddRef(); + return S_OK; + } + return E_NOINTERFACE; +} + +/** + * @implemented + */ +STDMETHODIMP_(ULONG) CFnDocFeed::AddRef() +{ + return ::InterlockedIncrement(&m_cRefs); +} + +/** + * @implemented + */ +STDMETHODIMP_(ULONG) CFnDocFeed::Release() +{ + if (::InterlockedDecrement(&m_cRefs) == 0) + { + delete this; + return 0; + } + return m_cRefs; +} + /** * @unimplemented */ -STDMETHODIMP CFunctionProvider::QueryInterface(REFIID riid, LPVOID* ppvObj) +STDMETHODIMP CFnDocFeed::DocFeed() { return E_NOTIMPL; } @@ -1096,17 +1205,119 @@ STDMETHODIMP CFunctionProvider::QueryInterface(REFIID riid, LPVOID* ppvObj) /** * @unimplemented */ -STDMETHODIMP_(ULONG) CFunctionProvider::AddRef() +STDMETHODIMP CFnDocFeed::ClearDocFeedBuffer() { - return 1; + return E_NOTIMPL; } /** * @unimplemented */ -STDMETHODIMP_(ULONG) CFunctionProvider::Release() +STDMETHODIMP CFnDocFeed::StartReconvert() { - return 0; + return E_NOTIMPL; +} + +/** + * @unimplemented + */ +STDMETHODIMP CFnDocFeed::StartUndoCompositionString() +{ + return E_NOTIMPL; +} + +/** + * @implemented + */ +STDMETHODIMP +CFunctionProviderBase::QueryInterface( + _In_ REFIID riid, + _Out_ LPVOID* ppvObj) +{ + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfFunctionProvider)) + { + *ppvObj = this; + AddRef(); + return S_OK; + } + return E_NOINTERFACE; +} + +/** + * @implemented + */ +STDMETHODIMP_(ULONG) CFunctionProviderBase::AddRef() +{ + return ::InterlockedIncrement(&m_cRefs); +} + +/** + * @implemented + */ +STDMETHODIMP_(ULONG) CFunctionProviderBase::Release() +{ + if (::InterlockedDecrement(&m_cRefs) == 0) + { + delete this; + return 0; + } + return m_cRefs; +} + +/** + * @implemented + */ +STDMETHODIMP CFunctionProviderBase::GetType(_Out_ GUID *guid) +{ + *guid = m_guid; + return S_OK; +} + +/** + * @implemented + */ +STDMETHODIMP CFunctionProviderBase::GetDescription(_Out_ BSTR *desc) +{ + *desc = ::SysAllocString(m_bstr); + return (*desc ? S_OK : E_OUTOFMEMORY); +} + +class CFunctionProvider : public CFunctionProviderBase +{ +public: + CFunctionProvider(_In_ TfClientId clientId); + + STDMETHODIMP GetFunction(_In_ REFGUID guid, _In_ REFIID riid, _Out_ IUnknown **func) override; +}; + +/** + * @implemented + */ +CFunctionProvider::CFunctionProvider(_In_ TfClientId clientId) : CFunctionProviderBase(clientId) +{ + Init(CLSID_CAImmLayer, L"MSCTFIME::Function Provider"); +} + +/** + * @implemented + */ +STDMETHODIMP +CFunctionProvider::GetFunction( + _In_ REFGUID guid, + _In_ REFIID riid, + _Out_ IUnknown **func) +{ + *func = NULL; + + if (IsEqualGUID(guid, GUID_NULL) && + IsEqualIID(riid, IID_IAImmFnDocFeed)) + { + *func = new CFnDocFeed(); + if (*func) + return S_OK; + } + + return E_NOINTERFACE; } /* FIXME */ diff --git a/sdk/include/reactos/cicero/cictf.h b/sdk/include/reactos/cicero/cictf.h index e11cebc3154..afc96cdfc14 100644 --- a/sdk/include/reactos/cicero/cictf.h +++ b/sdk/include/reactos/cicero/cictf.h @@ -29,3 +29,16 @@ struct ITfThreadMgr_P : ITfThreadMgr }; DEFINE_GUID(IID_ITfKeystrokeMgr_P, 0x53FA1BEC, 0x5BE1, 0x458E, 0xAE, 0x70, 0xA9, 0xF1, 0xDC, 0x84, 0x3E, 0x81); + +// FIXME: ITfKeystrokeMgr_P + +DEFINE_GUID(IID_IAImmFnDocFeed, 0x6E098993, 0x9577, 0x499A, 0xA8, 0x30, 0x52, 0x34, 0x4F, 0x3E, 0x20, 0x0D); +DEFINE_GUID(CLSID_CAImmLayer, 0xB676DB87, 0x64DC, 0x4651, 0x99, 0xEC, 0x91, 0x07, 0x0E, 0xA4, 0x87, 0x90); + +struct IAImmFnDocFeed : IUnknown +{ + STDMETHOD(DocFeed)() = 0; + STDMETHOD(ClearDocFeedBuffer)() = 0; + STDMETHOD(StartReconvert)() = 0; + STDMETHOD(StartUndoCompositionString)() = 0; +};
11 months, 4 weeks
1
0
0
0
[reactos] 01/01: [MSCTFIME][SDK] Improve human readability (#6240)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e5548aa5014adee6e608d…
commit e5548aa5014adee6e608d9fd1d57a912274a283e Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Mon Jan 1 11:05:49 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Mon Jan 1 11:05:49 2024 +0900 [MSCTFIME][SDK] Improve human readability (#6240) Improve code quality. JIRA issue: CORE-19360 - Add some SAL annotations. - Add readable comments more. - Rename some member variables. --- dll/ime/msctfime/msctfime.cpp | 265 ++++++++++++++++++++++-------------- sdk/include/reactos/cicero/cicimc.h | 25 ++-- 2 files changed, 173 insertions(+), 117 deletions(-) diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index 769b56e6502..c5bfab1abdb 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -37,7 +37,7 @@ UINT WM_MSIME_KEYMAP = 0; /** * @implemented */ -BOOL IsMsImeMessage(UINT uMsg) +BOOL IsMsImeMessage(_In_ UINT uMsg) { return (uMsg == WM_MSIME_SERVICE || uMsg == WM_MSIME_UIREADY || @@ -82,6 +82,9 @@ BOOL RegisterMSIMEMessage(VOID) typedef BOOLEAN (WINAPI *FN_DllShutDownInProgress)(VOID); /** + * This function calls ntdll!RtlDllShutdownInProgress. + * It can detect the system is shutting down or not. + * * @implemented */ EXTERN_C BOOLEAN WINAPI @@ -103,6 +106,8 @@ DllShutDownInProgress(VOID) } /** + * This function checks if the current user logon session is interactive. + * * @implemented */ static BOOL @@ -160,9 +165,11 @@ HRESULT UninitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread) } /** + * Gets the charset from a language ID. + * * @implemented */ -BYTE GetCharsetFromLangId(DWORD dwValue) +BYTE GetCharsetFromLangId(_In_ DWORD dwValue) { CHARSETINFO info; if (!::TranslateCharsetInfo((DWORD*)(DWORD_PTR)dwValue, &info, TCI_SRCLOCALE)) @@ -171,10 +178,15 @@ BYTE GetCharsetFromLangId(DWORD dwValue) } /** + * Selects or unselects the input context. + * * @implemented */ HRESULT -InternalSelectEx(HIMC hIMC, BOOL fSelect, LANGID LangID) +InternalSelectEx( + _In_ HIMC hIMC, + _In_ BOOL fSelect, + _In_ LANGID LangID) { CicIMCLock imcLock(hIMC); if (!imcLock) @@ -574,45 +586,49 @@ HRESULT CCompartmentEventSink::_Unadvise() return S_OK; } +class CInputContextOwnerCallBack; + /*********************************************************************** * CicInputContext + * + * The msctfime.ime's input context. */ - -class CInputContextOwnerCallBack; - -/* FIXME */ class CicInputContext : public ITfCleanupContextSink , public ITfContextOwnerCompositionSink , public ITfCompositionSink { public: - DWORD m_dw[2]; + ITfContextOwnerCompositionSink *m_pContextOwnerCompositionSink; + DWORD m_dwUnknown0; LONG m_cRefs; HIMC m_hIMC; ITfDocumentMgr *m_pDocumentMgr; ITfContext *m_pContext; - DWORD m_dw0_0[1]; + DWORD m_dwUnknown1; CInputContextOwnerCallBack *m_pICOwnerCallback; - DWORD m_dw0; + LPVOID m_pTextEventSink; CCompartmentEventSink *m_pCompEventSink1; CCompartmentEventSink *m_pCompEventSink2; - DWORD m_dw0_5[4]; - DWORD m_dw1[2]; + DWORD m_dwUnknown3[4]; + DWORD m_dwUnknown4[2]; DWORD m_dwQueryPos; - DWORD m_dw1_5[1]; + DWORD m_dwUnknown5; GUID m_guid; - DWORD m_dw2[19]; + DWORD m_dwUnknown6[11]; + BOOL m_bSelecting; + DWORD m_dwUnknown7[7]; WORD m_cGuidAtoms; WORD m_padding; DWORD m_adwGuidAtoms[256]; - DWORD m_dw3[19]; + DWORD m_dwUnknown8[19]; public: - CicInputContext(TfClientId cliendId, PCIC_LIBTHREAD pLibThread, HIMC hIMC); - virtual ~CicInputContext() - { - } + CicInputContext( + _In_ TfClientId cliendId, + _Inout_ PCIC_LIBTHREAD pLibThread, + _In_ HIMC hIMC); + virtual ~CicInputContext() { } // IUnknown interface STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj) override; @@ -620,7 +636,7 @@ public: STDMETHODIMP_(ULONG) Release() override; // ITfCleanupContextSink interface - STDMETHODIMP OnCleanupContext(TfEditCookie ecWrite, ITfContext *pic) override; + STDMETHODIMP OnCleanupContext(_In_ TfEditCookie ecWrite, _Inout_ ITfContext *pic) override; // ITfContextOwnerCompositionSink interface STDMETHODIMP OnStartComposition(ITfCompositionView *pComposition, BOOL *pfOk) override; @@ -636,14 +652,17 @@ public: _In_ BYTE iAtom, _Out_opt_ LPDWORD pdwGuidAtom); - HRESULT CreateInputContext(ITfThreadMgr *pThreadMgr, CicIMCLock& imcLock); + HRESULT CreateInputContext(_Inout_ ITfThreadMgr *pThreadMgr, _Inout_ CicIMCLock& imcLock); HRESULT DestroyInputContext(); }; /** * @unimplemented */ -CicInputContext::CicInputContext(TfClientId cliendId, PCIC_LIBTHREAD pLibThread, HIMC hIMC) +CicInputContext::CicInputContext( + _In_ TfClientId cliendId, + _Inout_ PCIC_LIBTHREAD pLibThread, + _In_ HIMC hIMC) { m_hIMC = hIMC; m_guid = GUID_NULL; @@ -757,7 +776,9 @@ CicInputContext::GetGuidAtom( * @unimplemented */ HRESULT -CicInputContext::CreateInputContext(ITfThreadMgr *pThreadMgr, CicIMCLock& imcLock) +CicInputContext::CreateInputContext( + _Inout_ ITfThreadMgr *pThreadMgr, + _Inout_ CicIMCLock& imcLock) { //FIXME return E_NOTIMPL; @@ -783,6 +804,8 @@ CicInputContext::OnCompositionTerminated(TfEditCookie ecWrite, ITfComposition *p } /** + * Retrieves the IME information. + * * @implemented */ HRESULT @@ -872,12 +895,12 @@ protected: public: CThreadMgrEventSink( - FN_INITDOCMGR fnInit, - FN_PUSHPOP fnPushPop = NULL, - LPVOID pvCallbackPV = NULL); + _In_ FN_INITDOCMGR fnInit, + _In_ FN_PUSHPOP fnPushPop = NULL, + _Inout_ LPVOID pvCallbackPV = NULL); virtual ~CThreadMgrEventSink() { } - void SetCallbackPV(LPVOID pv); + void SetCallbackPV(_Inout_ LPVOID pv); HRESULT _Advise(ITfThreadMgr *pThreadMgr); HRESULT _Unadvise(); @@ -904,9 +927,9 @@ public: * @implemented */ CThreadMgrEventSink::CThreadMgrEventSink( - FN_INITDOCMGR fnInit, - FN_PUSHPOP fnPushPop, - LPVOID pvCallbackPV) + _In_ FN_INITDOCMGR fnInit, + _In_ FN_PUSHPOP fnPushPop, + _Inout_ LPVOID pvCallbackPV) { m_fnInit = fnInit; m_fnPushPop = fnPushPop; @@ -996,7 +1019,7 @@ STDMETHODIMP CThreadMgrEventSink::OnPopContext(ITfContext *pic) return m_fnPushPop(4, pic, m_pCallbackPV); } -void CThreadMgrEventSink::SetCallbackPV(LPVOID pv) +void CThreadMgrEventSink::SetCallbackPV(_Inout_ LPVOID pv) { if (!m_pCallbackPV) m_pCallbackPV = pv; @@ -1052,7 +1075,7 @@ HRESULT CThreadMgrEventSink::_Unadvise() class CFunctionProvider : public IUnknown { public: - CFunctionProvider(TfClientId clientId) + CFunctionProvider(_In_ TfClientId clientId) { } @@ -1091,8 +1114,8 @@ class CicBridge : public ITfSysHookSink { protected: LONG m_cRefs; - DWORD m_dwImmxInit; - DWORD m_dw[1]; + BOOL m_bImmxInited; + BOOL m_bUnknown1; BOOL m_bDeactivating; DWORD m_cActivateLocks; ITfKeystrokeMgr *m_pKeystrokeMgr; @@ -1100,7 +1123,7 @@ protected: CThreadMgrEventSink *m_pThreadMgrEventSink; TfClientId m_cliendId; CIC_LIBTHREAD m_LibThread; - DWORD m_dw21; + BOOL m_bUnknown2; static BOOL CALLBACK EnumCreateInputContextCallback(HIMC hIMC, LPARAM lParam); static BOOL CALLBACK EnumDestroyInputContextCallback(HIMC hIMC, LPARAM lParam); @@ -1119,32 +1142,41 @@ public: STDMETHODIMP OnSysKeyboardProc(UINT, LONG) override; STDMETHODIMP OnSysShellProc(INT, UINT, LONG) override; - HRESULT InitIMMX(TLS *pTLS); - BOOL UnInitIMMX(TLS *pTLS); - HRESULT ActivateIMMX(TLS *pTLS, ITfThreadMgr_P *pThreadMgr); - HRESULT DeactivateIMMX(TLS *pTLS, ITfThreadMgr_P *pThreadMgr); + HRESULT InitIMMX(_Inout_ TLS *pTLS); + BOOL UnInitIMMX(_Inout_ TLS *pTLS); + HRESULT ActivateIMMX(_Inout_ TLS *pTLS, _Inout_ ITfThreadMgr_P *pThreadMgr); + HRESULT DeactivateIMMX(_Inout_ TLS *pTLS, _Inout_ ITfThreadMgr_P *pThreadMgr); HRESULT CreateInputContext(TLS *pTLS, HIMC hIMC); HRESULT DestroyInputContext(TLS *pTLS, HIMC hIMC); ITfContext *GetInputContext(CicIMCCLock<CTFIMECONTEXT>& imeContext); HRESULT SelectEx( - TLS *pTLS, - ITfThreadMgr_P *pThreadMgr, - HIMC hIMC, - BOOL fSelect, - HKL hKL); + _Inout_ TLS *pTLS, + _Inout_ ITfThreadMgr_P *pThreadMgr, + _In_ HIMC hIMC, + _In_ BOOL fSelect, + _In_ HKL hKL); HRESULT OnSetOpenStatus( TLS *pTLS, ITfThreadMgr_P *pThreadMgr, CicIMCLock& imcLock, CicInputContext *pCicIC); - void PostTransMsg(HWND hWnd, INT cTransMsgs, LPTRANSMSG pTransMsgs); - void GetDocumentManager(CicIMCCLock<CTFIMECONTEXT>& imeContext); + void PostTransMsg(_In_ HWND hWnd, _In_ INT cTransMsgs, _In_ const TRANSMSG *pTransMsgs); + void GetDocumentManager(_Inout_ CicIMCCLock<CTFIMECONTEXT>& imeContext); - HRESULT ConfigureGeneral(TLS* pTLS, ITfThreadMgr *pThreadMgr, HKL hKL, HWND hWnd); - HRESULT ConfigureRegisterWord(TLS* pTLS, ITfThreadMgr *pThreadMgr, HKL hKL, HWND hWnd, LPVOID lpData); + HRESULT + ConfigureGeneral(_Inout_ TLS* pTLS, + _In_ ITfThreadMgr *pThreadMgr, + _In_ HKL hKL, + _In_ HWND hWnd); + HRESULT ConfigureRegisterWord( + _Inout_ TLS* pTLS, + _In_ ITfThreadMgr *pThreadMgr, + _In_ HKL hKL, + _In_ HWND hWnd, + _Inout_opt_ LPVOID lpData); }; class CActiveLanguageProfileNotifySink : public ITfActiveLanguageProfileNotifySink @@ -1158,7 +1190,7 @@ protected: LPVOID m_pUserData; public: - CActiveLanguageProfileNotifySink(FN_COMPARE fnCompare, void *pUserData); + CActiveLanguageProfileNotifySink(_In_ FN_COMPARE fnCompare, _Inout_opt_ void *pUserData); virtual ~CActiveLanguageProfileNotifySink(); HRESULT _Advise(ITfThreadMgr *pThreadMgr); @@ -1181,8 +1213,8 @@ public: * @implemented */ CActiveLanguageProfileNotifySink::CActiveLanguageProfileNotifySink( - FN_COMPARE fnCompare, - void *pUserData) + _In_ FN_COMPARE fnCompare, + _Inout_opt_ void *pUserData) { m_dwConnection = (DWORD)-1; m_fnCompare = fnCompare; @@ -1322,7 +1354,7 @@ protected: UINT m_nCodePage; LANGID m_LangID2; WORD m_padding2; - DWORD m_dw3[1]; + DWORD m_dwUnknown1; LONG m_cRefs; static INT CALLBACK @@ -1341,11 +1373,15 @@ public: STDMETHODIMP_(ULONG) AddRef() override; STDMETHODIMP_(ULONG) Release() override; - HRESULT GetActiveLanguageProfile(HKL hKL, REFGUID rguid, TF_LANGUAGEPROFILE *pProfile); - HRESULT GetLangId(LANGID *pLangID); - HRESULT GetCodePageA(UINT *puCodePage); - - HRESULT InitProfileInstance(TLS *pTLS); + HRESULT + GetActiveLanguageProfile( + _In_ HKL hKL, + _In_ REFGUID rguid, + _Out_ TF_LANGUAGEPROFILE *pProfile); + HRESULT GetLangId(_Out_ LANGID *pLangID); + HRESULT GetCodePageA(_Out_ UINT *puCodePage); + + HRESULT InitProfileInstance(_Inout_ TLS *pTLS); }; /** @@ -1360,7 +1396,7 @@ CicProfile::CicProfile() m_LangID1 = 0; m_nCodePage = CP_ACP; m_LangID2 = 0; - m_dw3[0] = 0; + m_dwUnknown1 = 0; } /** @@ -1433,7 +1469,7 @@ CicProfile::ActiveLanguageProfileNotifySinkCallback( /** * @implemented */ -HRESULT CicProfile::GetCodePageA(UINT *puCodePage) +HRESULT CicProfile::GetCodePageA(_Out_ UINT *puCodePage) { if (!puCodePage) return E_INVALIDARG; @@ -1466,7 +1502,7 @@ HRESULT CicProfile::GetCodePageA(UINT *puCodePage) /** * @implemented */ -HRESULT CicProfile::GetLangId(LANGID *pLangID) +HRESULT CicProfile::GetLangId(_Out_ LANGID *pLangID) { *pLangID = 0; @@ -1500,7 +1536,8 @@ public: ITfThreadMgr_P *m_pThreadMgr; DWORD m_dwFlags1; DWORD m_dwFlags2; - DWORD m_dwUnknown2[2]; + DWORD m_dwUnknown2; + BOOL m_bDestroyed; DWORD m_dwNowOpening; DWORD m_NonEAComposition; DWORD m_cWnds; @@ -1574,8 +1611,8 @@ TLS* TLS::InternalAllocateTLS() return NULL; } - pTLS->m_dwUnknown2[0] |= 1; - pTLS->m_dwUnknown2[2] |= 1; + pTLS->m_dwFlags1 |= 1; + pTLS->m_dwUnknown2 |= 1; return pTLS; } @@ -1604,7 +1641,7 @@ BOOL TLS::InternalDestroyTLS() * @implemented */ HRESULT -CicProfile::InitProfileInstance(TLS *pTLS) +CicProfile::InitProfileInstance(_Inout_ TLS *pTLS) { HRESULT hr = TF_CreateInputProcessorProfiles(&m_pIPProfiles); if (FAILED(hr)) @@ -1633,7 +1670,10 @@ CicProfile::InitProfileInstance(TLS *pTLS) /** * @implemented */ -STDMETHODIMP CicInputContext::OnCleanupContext(TfEditCookie ecWrite, ITfContext *pic) +STDMETHODIMP +CicInputContext::OnCleanupContext( + _In_ TfEditCookie ecWrite, + _Inout_ ITfContext *pic) { TLS *pTLS = TLS::PeekTLS(); if (!pTLS || !pTLS->m_pProfile) @@ -1686,10 +1726,10 @@ STDMETHODIMP CicInputContext::OnCleanupContext(TfEditCookie ecWrite, ITfContext CicBridge::CicBridge() { - m_dwImmxInit &= ~1; - m_dw[0] &= ~1; + m_bImmxInited = FALSE; + m_bUnknown1 = FALSE; m_bDeactivating = FALSE; - m_dw21 &= ~1; + m_bUnknown2 = FALSE; m_pKeystrokeMgr = NULL; m_pDocMgr = NULL; m_pThreadMgrEventSink = NULL; @@ -1747,7 +1787,7 @@ CicBridge::~CicBridge() UnInitIMMX(pTLS); } -void CicBridge::GetDocumentManager(CicIMCCLock<CTFIMECONTEXT>& imeContext) +void CicBridge::GetDocumentManager(_Inout_ CicIMCCLock<CTFIMECONTEXT>& imeContext) { CicInputContext *pCicIC = imeContext.get().m_pCicIC; if (pCicIC) @@ -1765,7 +1805,10 @@ void CicBridge::GetDocumentManager(CicIMCCLock<CTFIMECONTEXT>& imeContext) /** * @unimplemented */ -HRESULT CicBridge::CreateInputContext(TLS *pTLS, HIMC hIMC) +HRESULT +CicBridge::CreateInputContext( + _Inout_ TLS *pTLS, + _In_ HIMC hIMC) { CicIMCLock imcLock(hIMC); HRESULT hr = imcLock.m_hr; @@ -1888,15 +1931,16 @@ HRESULT CicBridge::OnSetOpenStatus( } /** + * Selects the IME context. * @implemented */ HRESULT CicBridge::SelectEx( - TLS *pTLS, - ITfThreadMgr_P *pThreadMgr, - HIMC hIMC, - BOOL fSelect, - HKL hKL) + _Inout_ TLS *pTLS, + _Inout_ ITfThreadMgr_P *pThreadMgr, + _In_ HIMC hIMC, + _In_ BOOL fSelect, + _In_ HKL hKL) { CicIMCLock imcLock(hIMC); if (FAILED(imcLock.m_hr)) @@ -1910,12 +1954,12 @@ CicBridge::SelectEx( CicInputContext *pCicIC = imeContext.get().m_pCicIC; if (pCicIC) - pCicIC->m_dw2[11] |= 1; + pCicIC->m_bSelecting = TRUE; if (fSelect) { if (pCicIC) - pCicIC->m_dw2[1] &= ~1; + pCicIC->m_dwUnknown6[1] &= ~1; if (imcLock.get().fOpen) OnSetOpenStatus(pTLS, pThreadMgr, imcLock, pCicIC); } @@ -1924,7 +1968,7 @@ CicBridge::SelectEx( ITfContext *pContext = GetInputContext(imeContext); pThreadMgr->RequestPostponedLock(pContext); if (pCicIC) - pCicIC->m_dw2[11] &= ~1; + pCicIC->m_bSelecting = FALSE; if (pContext) pContext->Release(); } @@ -1932,6 +1976,10 @@ CicBridge::SelectEx( return imeContext.m_hr; } +/** + * Used in CicBridge::EnumCreateInputContextCallback and + * CicBridge::EnumDestroyInputContextCallback. + */ typedef struct ENUM_CREATE_DESTROY_IC { TLS *m_pTLS; @@ -1939,6 +1987,7 @@ typedef struct ENUM_CREATE_DESTROY_IC } ENUM_CREATE_DESTROY_IC, *PENUM_CREATE_DESTROY_IC; /** + * Creates input context for the current thread. * @implemented */ BOOL CALLBACK CicBridge::EnumCreateInputContextCallback(HIMC hIMC, LPARAM lParam) @@ -1949,6 +1998,7 @@ BOOL CALLBACK CicBridge::EnumCreateInputContextCallback(HIMC hIMC, LPARAM lParam } /** + * Destroys input context for the current thread. * @implemented */ BOOL CALLBACK CicBridge::EnumDestroyInputContextCallback(HIMC hIMC, LPARAM lParam) @@ -1961,7 +2011,10 @@ BOOL CALLBACK CicBridge::EnumDestroyInputContextCallback(HIMC hIMC, LPARAM lPara /** * @implemented */ -HRESULT CicBridge::ActivateIMMX(TLS *pTLS, ITfThreadMgr_P *pThreadMgr) +HRESULT +CicBridge::ActivateIMMX( + _Inout_ TLS *pTLS, + _Inout_ ITfThreadMgr_P *pThreadMgr) { HRESULT hr = pThreadMgr->ActivateEx(&m_cliendId, 1); if (hr != S_OK) @@ -2006,7 +2059,7 @@ HRESULT CicBridge::ActivateIMMX(TLS *pTLS, ITfThreadMgr_P *pThreadMgr) pThreadMgr->SetSysHookSink(this); hr = S_OK; - if (pTLS->m_dwUnknown2[1] & 1) + if (pTLS->m_bDestroyed) { ENUM_CREATE_DESTROY_IC Data = { pTLS, this }; ImmEnumInputContext(0, CicBridge::EnumCreateInputContextCallback, (LPARAM)&Data); @@ -2023,7 +2076,10 @@ Finish: /** * @implemented */ -HRESULT CicBridge::DeactivateIMMX(TLS *pTLS, ITfThreadMgr_P *pThreadMgr) +HRESULT +CicBridge::DeactivateIMMX( + _Inout_ TLS *pTLS, + _Inout_ ITfThreadMgr_P *pThreadMgr) { if (m_bDeactivating) return TRUE; @@ -2034,7 +2090,7 @@ HRESULT CicBridge::DeactivateIMMX(TLS *pTLS, ITfThreadMgr_P *pThreadMgr) { ENUM_CREATE_DESTROY_IC Data = { pTLS, this }; ImmEnumInputContext(0, CicBridge::EnumDestroyInputContextCallback, (LPARAM)&Data); - pTLS->m_dwUnknown2[1] |= 1; + pTLS->m_bDestroyed = TRUE; ITfSourceSingle *pSource = NULL; if (pThreadMgr->QueryInterface(IID_ITfSourceSingle, (void **)&pSource) == S_OK) @@ -2068,9 +2124,10 @@ HRESULT CicBridge::DeactivateIMMX(TLS *pTLS, ITfThreadMgr_P *pThreadMgr) /** * @implemented */ -HRESULT CicBridge::InitIMMX(TLS *pTLS) +HRESULT +CicBridge::InitIMMX(_Inout_ TLS *pTLS) { - if (m_dwImmxInit & 1) + if (m_bImmxInited) return S_OK; HRESULT hr = S_OK; @@ -2130,14 +2187,14 @@ HRESULT CicBridge::InitIMMX(TLS *pTLS) return E_FAIL; } - m_dwImmxInit |= 1; + m_bImmxInited = TRUE; return S_OK; } /** * @implemented */ -BOOL CicBridge::UnInitIMMX(TLS *pTLS) +BOOL CicBridge::UnInitIMMX(_Inout_ TLS *pTLS) { UninitDisplayAttrbuteLib(&m_LibThread); TFUninitLib_Thread(&m_LibThread); @@ -2167,7 +2224,7 @@ BOOL CicBridge::UnInitIMMX(TLS *pTLS) pTLS->m_pThreadMgr = NULL; } - m_dwImmxInit &= ~1; + m_bImmxInited = FALSE; return TRUE; } @@ -2198,7 +2255,11 @@ STDMETHODIMP CicBridge::OnSysShellProc(INT, UINT, LONG) /** * @implemented */ -void CicBridge::PostTransMsg(HWND hWnd, INT cTransMsgs, LPTRANSMSG pTransMsgs) +void +CicBridge::PostTransMsg( + _In_ HWND hWnd, + _In_ INT cTransMsgs, + _In_ const TRANSMSG *pTransMsgs) { for (INT i = 0; i < cTransMsgs; ++i, ++pTransMsgs) { @@ -2211,10 +2272,10 @@ void CicBridge::PostTransMsg(HWND hWnd, INT cTransMsgs, LPTRANSMSG pTransMsgs) */ HRESULT CicBridge::ConfigureGeneral( - TLS* pTLS, - ITfThreadMgr *pThreadMgr, - HKL hKL, - HWND hWnd) + _Inout_ TLS* pTLS, + _In_ ITfThreadMgr *pThreadMgr, + _In_ HKL hKL, + _In_ HWND hWnd) { CicProfile *pProfile = pTLS->m_pProfile; if (!pProfile) @@ -2250,11 +2311,11 @@ CicBridge::ConfigureGeneral( */ HRESULT CicBridge::ConfigureRegisterWord( - TLS* pTLS, - ITfThreadMgr *pThreadMgr, - HKL hKL, - HWND hWnd, - LPVOID lpData) + _Inout_ TLS* pTLS, + _In_ ITfThreadMgr *pThreadMgr, + _In_ HKL hKL, + _In_ HWND hWnd, + _Inout_opt_ LPVOID lpData) { CicProfile *pProfile = pTLS->m_pProfile; if (!pProfile) @@ -2311,9 +2372,9 @@ CicBridge::ConfigureRegisterWord( */ HRESULT CicProfile::GetActiveLanguageProfile( - HKL hKL, - REFGUID rguid, - TF_LANGUAGEPROFILE *pProfile) + _In_ HKL hKL, + _In_ REFGUID rguid, + _Out_ TF_LANGUAGEPROFILE *pProfile) { return E_NOTIMPL; } @@ -2916,7 +2977,9 @@ CtfImeIsIME( return FALSE; } -/** +/*********************************************************************** + * CtfImeThreadDetach (MSCTFIME.@) + * * @implemented */ EXTERN_C HRESULT WINAPI diff --git a/sdk/include/reactos/cicero/cicimc.h b/sdk/include/reactos/cicero/cicimc.h index dcef56ef687..4f0e6c73e0a 100644 --- a/sdk/include/reactos/cicero/cicimc.h +++ b/sdk/include/reactos/cicero/cicimc.h @@ -184,22 +184,24 @@ protected: } }; +#define CUSTOM_CAND_INFO_SIZE 1964 + inline BOOL CicIMCLock::ClearCand() { HIMCC hNewCandInfo, hCandInfo = m_pIC->hCandInfo; if (hCandInfo) { - hNewCandInfo = ImmReSizeIMCC(hCandInfo, 1964); + hNewCandInfo = ImmReSizeIMCC(hCandInfo, CUSTOM_CAND_INFO_SIZE); if (!hNewCandInfo) { ImmDestroyIMCC(m_pIC->hCandInfo); - m_pIC->hCandInfo = ImmCreateIMCC(1964); + m_pIC->hCandInfo = ImmCreateIMCC(CUSTOM_CAND_INFO_SIZE); return FALSE; } } else { - hNewCandInfo = ImmCreateIMCC(1964u); + hNewCandInfo = ImmCreateIMCC(CUSTOM_CAND_INFO_SIZE); } m_pIC->hCandInfo = hNewCandInfo; @@ -210,24 +212,15 @@ inline BOOL CicIMCLock::ClearCand() if (!candInfo) { ImmDestroyIMCC(m_pIC->hCandInfo); - m_pIC->hCandInfo = ImmCreateIMCC(1964); + m_pIC->hCandInfo = ImmCreateIMCC(CUSTOM_CAND_INFO_SIZE); return FALSE; } - candInfo.get().dwSize = 1964; + candInfo.get().dwSize = CUSTOM_CAND_INFO_SIZE; candInfo.get().dwCount = 0; candInfo.get().dwOffset[0] = sizeof(CANDIDATEINFO); - LPBYTE pb = (LPBYTE)(&candInfo.get()); - pb += sizeof(CANDIDATEINFO); - - LPDWORD pdwUnknown = (LPDWORD)pb; - pdwUnknown[0] = candInfo.get().dwSize - sizeof(CANDIDATEINFO); // +0x0 - pdwUnknown[2] = 0; // +0x08 - pdwUnknown[3] = 0; // +0x0c - pdwUnknown[4] = 0; // +0x10 - pdwUnknown[1] = 1; // +0x04 - pdwUnknown[5] = 9; // +0x14 - pdwUnknown[6] = 1048; // +0x18 + // FIXME: Something is trailing after CANDIDATEINFO... + return TRUE; }
11 months, 4 weeks
1
0
0
0
[reactos] 01/01: [COMCTL32][USER32] RadioButton: Notify BN_CLICKED on WM_SETFOCUS (#6266)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d6c70f08642cfc414009d…
commit d6c70f08642cfc414009d6968d8c722c9b172a8c Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Mon Jan 1 11:01:59 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Mon Jan 1 11:01:59 2024 +0900 [COMCTL32][USER32] RadioButton: Notify BN_CLICKED on WM_SETFOCUS (#6266) Based on KRosUser's button_fixnotif.patch. JIRA issue: CORE-6542, CORE-19384 Notify BN_CLICKED to the parent on WM_SETFOCUS message handling if the button type was either BS_RADIOBUTTON or BS_AUTORADIOBUTTON, and if the button was unchecked. --- dll/win32/comctl32/button.c | 7 +++++++ win32ss/user/user32/controls/button.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/dll/win32/comctl32/button.c b/dll/win32/comctl32/button.c index d187ca4f1f2..9002697d60c 100644 --- a/dll/win32/comctl32/button.c +++ b/dll/win32/comctl32/button.c @@ -1043,6 +1043,13 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L paint_button( infoPtr, btn_type, ODA_FOCUS ); if (style & BS_NOTIFY) BUTTON_NOTIFY_PARENT(hWnd, BN_SETFOCUS); +#ifdef __REACTOS__ + if (((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON)) && + !(infoPtr->state & BST_CHECKED)) + { + BUTTON_NOTIFY_PARENT(hWnd, BN_CLICKED); + } +#endif break; case WM_KILLFOCUS: diff --git a/win32ss/user/user32/controls/button.c b/win32ss/user/user32/controls/button.c index 7f220ed450a..95d98e4e9d7 100644 --- a/win32ss/user/user32/controls/button.c +++ b/win32ss/user/user32/controls/button.c @@ -532,6 +532,13 @@ LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, paint_button( hWnd, btn_type, ODA_FOCUS ); if (style & BS_NOTIFY) BUTTON_NOTIFY_PARENT(hWnd, BN_SETFOCUS); +#ifdef __REACTOS__ + if (((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON)) && + !(get_button_state(hWnd) & BST_CHECKED)) + { + BUTTON_NOTIFY_PARENT(hWnd, BN_CLICKED); + } +#endif break; case WM_KILLFOCUS:
11 months, 4 weeks
1
0
0
0
← Newer
1
...
15
16
17
18
19
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Results per page:
10
25
50
100
200