diff --git a/RimeWithWeasel/RimeWithWeasel.cpp b/RimeWithWeasel/RimeWithWeasel.cpp index 00ad95135..188a3591c 100644 --- a/RimeWithWeasel/RimeWithWeasel.cpp +++ b/RimeWithWeasel/RimeWithWeasel.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -17,6 +18,7 @@ RimeWithWeaselHandler::RimeWithWeaselHandler(weasel::UI *ui) , m_active_session(0) , m_disabled(true) , _UpdateUICallback(NULL) + , m_vista_greater(IsWindowsVistaOrGreater()) { _Setup(); } @@ -347,7 +349,18 @@ void RimeWithWeaselHandler::_UpdateUI(UINT session_id) m_ui->Update(weasel_context, weasel_status); } - if (_UpdateUICallback) _UpdateUICallback(); + // Dangerous, don't touch + static char app_name[50]; + RimeGetProperty(session_id, "client_app", app_name, sizeof(app_name) - 1); + if (utf8towcs(app_name) == std::wstring(L"explorer.exe") && m_vista_greater) { + boost::thread th([=]() { + ::Sleep(100); + if (_UpdateUICallback) _UpdateUICallback(); + }); + } + else { + if (_UpdateUICallback) _UpdateUICallback(); + } m_message_type.clear(); m_message_value.clear(); diff --git a/RimeWithWeasel/stdafx.h b/RimeWithWeasel/stdafx.h index b539a1a28..e451ea7a0 100644 --- a/RimeWithWeasel/stdafx.h +++ b/RimeWithWeasel/stdafx.h @@ -15,6 +15,7 @@ #include #include #include +#include #pragma warning(default : 4819) #include diff --git a/include/RimeWithWeasel.h b/include/RimeWithWeasel.h index cbf9adc56..1c3cee8ca 100644 --- a/include/RimeWithWeasel.h +++ b/include/RimeWithWeasel.h @@ -49,6 +49,7 @@ class RimeWithWeaselHandler : weasel::UI* m_ui; // reference UINT m_active_session; bool m_disabled; + bool m_vista_greater; std::string m_last_schema_id; weasel::UIStyle m_base_style;