https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7c2e8c67f1bd4e9aff9df…
commit 7c2e8c67f1bd4e9aff9dfd9e37df21b7a470bbb0
Author: Whindmar Saksit <whindsaks(a)proton.me>
AuthorDate: Mon Jan 8 13:49:28 2024 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Jan 8 13:49:28 2024 +0100
[CONSRV] Don't blink cursor if the console window is not active (#5601)
Co-authored-by: Stanislav Motylkov <x86corez(a)gmail.com>
---
win32ss/user/winsrv/consrv/frontends/gui/conwnd.c | 10 ++++++++--
win32ss/user/winsrv/consrv/frontends/gui/conwnd.h | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c
b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c
index 42a8288073e..a677adfd648 100644
--- a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c
+++ b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c
@@ -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))
diff --git a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h
b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h
index 826f3fa875d..f6c20f2067f 100644
--- a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h
+++ b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h
@@ -50,6 +50,7 @@ typedef struct _GUI_CONSOLE_DATA
HDESK Desktop;
BOOLEAN IsWindowVisible;
+ BOOLEAN IsWindowActive;
POINT OldCursor;