[CONSRV] Don't blink cursor if the console window is not active (#5601)

Co-authored-by: Stanislav Motylkov <x86corez@gmail.com>
This commit is contained in:
Whindmar Saksit 2024-01-08 13:49:28 +01:00 committed by GitHub
parent 710df1361c
commit 7c2e8c67f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -642,6 +642,7 @@ OnNcCreate(HWND hWnd, LPCREATESTRUCTW Create)
GuiData->hWindow = hWnd;
GuiData->hSysMenu = GetSystemMenu(hWnd, FALSE);
GuiData->IsWindowActive = FALSE;
/* Initialize the fonts */
if (!InitFonts(GuiData,
@ -725,6 +726,8 @@ OnActivate(PGUI_CONSOLE_DATA GuiData, WPARAM wParam)
DPRINT("WM_ACTIVATE - ActivationState = %d\n", ActivationState);
GuiData->IsWindowActive = (ActivationState != WA_INACTIVE);
if ( ActivationState == WA_ACTIVE ||
ActivationState == WA_CLICKACTIVE )
{
@ -1324,8 +1327,11 @@ OnTimer(PGUI_CONSOLE_DATA GuiData)
if (GetType(Buff) == TEXTMODE_BUFFER)
{
/* Repaint the caret */
InvalidateCell(GuiData, Buff->CursorPosition.X, Buff->CursorPosition.Y);
Buff->CursorBlinkOn = !Buff->CursorBlinkOn;
if (GuiData->IsWindowActive || Buff->CursorBlinkOn)
{
InvalidateCell(GuiData, Buff->CursorPosition.X, Buff->CursorPosition.Y);
Buff->CursorBlinkOn = !Buff->CursorBlinkOn;
}
if ((GuiData->OldCursor.x != Buff->CursorPosition.X) ||
(GuiData->OldCursor.y != Buff->CursorPosition.Y))

View file

@ -50,6 +50,7 @@ typedef struct _GUI_CONSOLE_DATA
HDESK Desktop;
BOOLEAN IsWindowVisible;
BOOLEAN IsWindowActive;
POINT OldCursor;