forked from fxliang/weasel
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2、补上遗失的pinyin_simp方案(五笔拼音依赖项) 3、修复通知消息只通知一次的bug
- Loading branch information
Showing
16 changed files
with
372 additions
and
159 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
module; | ||
#include "stdafx.h" | ||
#include "test.h" | ||
|
||
#ifdef TEST | ||
#define WEASEL_ENABLE_LOGGING | ||
#include "logging.h" | ||
#endif // TEST | ||
module TransitoryExtension; | ||
|
||
com_ptr<ITfDocumentMgr> TransitoryExtension::ToParentDocumentIfExists(ITfDocumentMgr* pDocumentMgr) | ||
{ | ||
if (pDocumentMgr == nullptr) | ||
{ | ||
return nullptr; | ||
} | ||
|
||
com_ptr<ITfContext> pContext; | ||
if (FAILED(pDocumentMgr->GetTop(&pContext)) || pContext == nullptr) | ||
{ | ||
return pDocumentMgr; | ||
} | ||
|
||
TF_STATUS status{}; | ||
if (FAILED(pContext->GetStatus(&status))) | ||
{ | ||
return pDocumentMgr; | ||
} | ||
|
||
if ((status.dwStaticFlags & TF_SS_TRANSITORY) != TF_SS_TRANSITORY) | ||
{ | ||
return pDocumentMgr; | ||
} | ||
|
||
com_ptr<ITfCompartmentMgr> pCompartmentMgr; | ||
if (SUCCEEDED(pDocumentMgr->QueryInterface(&pCompartmentMgr))) | ||
{ | ||
com_ptr<ITfCompartment> pCompartment; | ||
if (SUCCEEDED(pCompartmentMgr->GetCompartment(GUID_COMPARTMENT_TRANSITORYEXTENSION_PARENT, &pCompartment))) | ||
{ | ||
VARIANT var{}; | ||
if (SUCCEEDED(pCompartment->GetValue(&var))) | ||
{ | ||
if (var.vt == VT_UNKNOWN && var.punkVal) | ||
{ | ||
com_ptr<ITfDocumentMgr> pParentDocumentMgr; | ||
auto hr = var.punkVal->QueryInterface(&pParentDocumentMgr); | ||
#ifdef TEST | ||
LOG(INFO) << std::format("From TransitoryExtension::ToParentDocumentIfExists. punkVal = 0x{:X}, hr = 0x{:X}, ret = 0x{:X}", (size_t)var.punkVal, (unsigned)hr); | ||
#endif // TEST | ||
if (pParentDocumentMgr) | ||
{ | ||
#ifdef TEST | ||
LOG(INFO) << std::format("From TransitoryExtension::ToParentDocumentIfExists. ok"); | ||
#endif // TEST | ||
return pParentDocumentMgr; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return pDocumentMgr; | ||
} | ||
|
||
com_ptr<ITfContext> TransitoryExtension::ToParentContextIfExists(ITfContext* pContext) | ||
{ | ||
if (pContext == nullptr) | ||
{ | ||
return nullptr; | ||
} | ||
|
||
com_ptr<ITfDocumentMgr> pDocumentMgr; | ||
if (SUCCEEDED(pContext->GetDocumentMgr(&pDocumentMgr))) | ||
{ | ||
com_ptr<ITfContext> pParentContext; | ||
if (SUCCEEDED(ToParentDocumentIfExists(pDocumentMgr)->GetTop(&pParentContext))) | ||
{ | ||
if (pParentContext) | ||
{ | ||
#ifdef TEST | ||
LOG(INFO) << std::format("From TransitoryExtension::ToParentContextIfExists."); | ||
#endif // TEST | ||
return pParentContext; | ||
} | ||
} | ||
} | ||
|
||
return pContext; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "stdafx.h" | ||
export module TransitoryExtension; | ||
|
||
export | ||
{ | ||
class TransitoryExtension | ||
{ | ||
public: | ||
TransitoryExtension() = delete; | ||
TransitoryExtension(const TransitoryExtension&) = delete; | ||
TransitoryExtension& operator=(const TransitoryExtension&) = delete; | ||
|
||
static com_ptr<ITfDocumentMgr> ToParentDocumentIfExists(ITfDocumentMgr* pDocumentMgr); | ||
static com_ptr<ITfContext> ToParentContextIfExists(ITfContext* pContext); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.