Skip to content

Instantly share code, notes, and snippets.

@nocd5
Created February 11, 2016 15:38
Show Gist options
  • Save nocd5/cf070f76f1e24bb93c57 to your computer and use it in GitHub Desktop.
Save nocd5/cf070f76f1e24bb93c57 to your computer and use it in GitHub Desktop.
[ConEmu] Change cursor color in a state of IME.
diff --git a/src/ConEmu/ConEmu14.vcxproj b/src/ConEmu/ConEmu14.vcxproj
index 84f5052..b4d54fc 100644
--- a/src/ConEmu/ConEmu14.vcxproj
+++ b/src/ConEmu/ConEmu14.vcxproj
@@ -235,7 +235,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;Shlwapi.lib;version.lib;gdiplus.lib;Winmm.lib;Netapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;Shlwapi.lib;version.lib;gdiplus.lib;Winmm.lib;Netapi32.lib;imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
diff --git a/src/ConEmu/VirtualConsole.cpp b/src/ConEmu/VirtualConsole.cpp
index b7b461b..6d82e1b 100644
--- a/src/ConEmu/VirtualConsole.cpp
+++ b/src/ConEmu/VirtualConsole.cpp
@@ -130,7 +130,8 @@ WARNING("Часто после разблокирования компьютер
#define ISBGIMGCOLOR(a) (nBgImageColors & (1 << a))
-#define CURSOR_PAT_COLOR 0xC0C0C0
+#define CURSOR_PAT_COLOR_IME_OFF 0x00FF00
+#define CURSOR_PAT_COLOR_IME_ON 0x0000FF
#define HILIGHT_PAT_COLOR 0xC0C0C0
#ifndef CONSOLE_SELECTION_NOT_EMPTY
@@ -3350,7 +3351,12 @@ void CVirtualConsole::UpdateCursorDraw(HDC hPaintDC, RECT rcClient, COORD pos, U
// Теперь в rect нужно отобразить курсор (XOR'ом попробуем?)
if (bCursorColor)
{
- HBRUSH hBr = CreateSolidBrush(CURSOR_PAT_COLOR);
+ COLORREF crCursor = CURSOR_PAT_COLOR_IME_OFF;
+ if (ImmGetOpenStatus(ImmGetContext(ghWnd)))
+ {
+ crCursor = CURSOR_PAT_COLOR_IME_ON;
+ }
+ HBRUSH hBr = CreateSolidBrush(crCursor);
HBRUSH hOld = (HBRUSH)SelectObject(hPaintDC, hBr);
PatInvertRect(hPaintDC, rect, (HDC)m_DC, (curStyle != cur_Rect));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment