[feat]: IME tray icon right click menu
This commit is contained in:
1 parent
b4d4d24d3a
commit
567e3156f8
4 files changed
+47
-7
No files matched your search
@@ -398,6 +398,15 @@ int SendMoveCandidateWndEventToUIProcess()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SendLangbarRightClickEventToUIProcess(const RECT *prcArea)
|
||||
{
|
||||
if (!canUseSharedMemory)
|
||||
{
|
||||
return SendLangbarRightClickEventToUIProcessViaNamedPipe(prcArea);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Named pipe
|
||||
//
|
||||
@@ -716,5 +725,18 @@ int SendMoveCandidateWndEventToUIProcessViaNamedPipe()
|
||||
namedpipeData.event_type = 3;
|
||||
SendToNamedpipe();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SendLangbarRightClickEventToUIProcessViaNamedPipe(const RECT *prcArea)
|
||||
{
|
||||
namedpipeData.event_type = 4;
|
||||
/* 利用其他的字段,把图标的坐标传递过去 */
|
||||
namedpipeData.point[0] = prcArea->left;
|
||||
namedpipeData.point[1] = prcArea->top;
|
||||
namedpipeData.keycode = prcArea->right;
|
||||
namedpipeData.modifiers_down = prcArea->bottom;
|
||||
SendToNamedpipe();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -47,6 +47,7 @@ struct FanyImeSharedMemoryData
|
||||
// 1: FanyHideCandidateWndEvent
|
||||
// 2: FanyShowCandidateWndEvent
|
||||
// 3: FanyMoveCandidateWndEvent
|
||||
// 4: FanyLangbarRightClickEvent
|
||||
//
|
||||
struct FanyImeNamedpipeData
|
||||
{
|
||||
@@ -93,6 +94,7 @@ int SendKeyEventToUIProcess();
|
||||
int SendHideCandidateWndEventToUIProcess();
|
||||
int SendShowCandidateWndEventToUIProcess();
|
||||
int SendMoveCandidateWndEventToUIProcess();
|
||||
int SendLangbarRightClickEventToUIProcess(const RECT *prcArea);
|
||||
|
||||
//
|
||||
// For named pipe
|
||||
@@ -110,6 +112,7 @@ int SendKeyEventToUIProcessViaNamedPipe();
|
||||
int SendHideCandidateWndEventToUIProcessViaNamedPipe();
|
||||
int SendShowCandidateWndEventToUIProcessViaNamedPipe();
|
||||
int SendMoveCandidateWndEventToUIProcessViaNamedPipe();
|
||||
int SendLangbarRightClickEventToUIProcessViaNamedPipe(const RECT *prcArea);
|
||||
void ClearNamedpipeDataIfExists();
|
||||
struct FanyImeNamedpipeDataToTsf *TryReadDataFromServerPipeWithTimeout();
|
||||
struct FanyImeNamedpipeDataToTsf *ReadDataFromServerViaNamedPipe();
|
||||
|
||||
@@ -233,6 +233,8 @@ HRESULT CMetasequoiaIME::_HandleCompositionInputWorker(_In_ CCompositionProcesso
|
||||
readingStr = GlobalIme::word_for_creating_word + readingStr;
|
||||
}
|
||||
}
|
||||
/* 如果想要设置 tsf preedit 为空,可以在这里设置 */
|
||||
// readingStr = L"";
|
||||
curReadingStr.Set(readingStr.c_str(), readingStr.length());
|
||||
|
||||
if (GlobalSettings::getTsfPreeditStyle() == GlobalSettings::TsfPreeditStyle::Pinyin)
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "LanguageBar.h"
|
||||
#include "Globals.h"
|
||||
#include "Compartment.h"
|
||||
#include "Ipc.h"
|
||||
#include "fmt/xchar.h"
|
||||
|
||||
//+---------------------------------------------------------------------------
|
||||
//
|
||||
@@ -105,7 +107,7 @@ CLangBarItemButton::CLangBarItemButton(REFGUID guidLangBar, LPCWSTR description,
|
||||
|
||||
// initialize TF_LANGBARITEMINFO structure.
|
||||
_tfLangBarItemInfo.clsidService = Global::MetasequoiaIMECLSID; // This LangBarItem belongs to this TextService.
|
||||
_tfLangBarItemInfo.guidItem = guidLangBar; // GUID of this LangBarItem.
|
||||
_tfLangBarItemInfo.guidItem = guidLangBar; // GUID of this LangBarItem.
|
||||
_tfLangBarItemInfo.dwStyle = (TF_LBI_STYLE_BTN_BUTTON | TF_LBI_STYLE_SHOWNINTRAY); // This LangBar is a button type.
|
||||
_tfLangBarItemInfo.ulSort = 0; // The position of this LangBar Item is not specified.
|
||||
StringCchCopy(_tfLangBarItemInfo.szDescription, ARRAYSIZE(_tfLangBarItemInfo.szDescription),
|
||||
@@ -370,14 +372,25 @@ STDAPI CLangBarItemButton::GetTooltipString(_Out_ BSTR *pbstrToolTip)
|
||||
|
||||
STDAPI CLangBarItemButton::OnClick(TfLBIClick click, POINT pt, _In_ const RECT *prcArea)
|
||||
{
|
||||
click;
|
||||
pt;
|
||||
prcArea;
|
||||
if (click == TF_LBI_CLK_RIGHT)
|
||||
{
|
||||
#ifdef FANY_DEBUG
|
||||
OutputDebugString(
|
||||
fmt::format(L"\nprcArea: ({}, {}, {}, {})\n", prcArea->left, prcArea->top, prcArea->right, prcArea->bottom)
|
||||
.c_str());
|
||||
OutputDebugString(L"right click of lang bar item\n");
|
||||
#endif
|
||||
SendLangbarRightClickEventToUIProcess(prcArea);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
BOOL isOn = FALSE;
|
||||
if (click == TF_LBI_CLK_LEFT && _pCompartment)
|
||||
{
|
||||
BOOL isOn = FALSE;
|
||||
|
||||
_pCompartment->_GetCompartmentBOOL(isOn);
|
||||
_pCompartment->_SetCompartmentBOOL(isOn ? FALSE : TRUE);
|
||||
_pCompartment->_GetCompartmentBOOL(isOn);
|
||||
_pCompartment->_SetCompartmentBOOL(isOn ? FALSE : TRUE);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user