Author: hbelusca
Date: Fri Nov 8 17:59:04 2013
New Revision: 60885
URL:
http://svn.reactos.org/svn/reactos?rev=60885&view=rev
Log:
[CONSRV]: Make changing the console palette for text buffers working properly (needed for
NTVDM).
Modified:
trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c
Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c [iso-8859-1] Fri Nov 8
17:59:04 2013
@@ -21,6 +21,17 @@
/* FUNCTIONS ******************************************************************/
+
+COLORREF RGBFromAttrib2(PCONSOLE Console, WORD Attribute)
+{
+ HPALETTE hPalette = Console->ActiveBuffer->PaletteHandle;
+ PALETTEENTRY pe;
+
+ if (hPalette == NULL) return RGBFromAttrib(Console, Attribute);
+
+ GetPaletteEntries(hPalette, Attribute, 1, &pe);
+ return PALETTERGB(pe.peRed, pe.peGreen, pe.peBlue);
+}
VOID
GuiCopyFromTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer)
@@ -217,8 +228,8 @@
LastAttribute = ConioCoordToPointer(Buffer, LeftChar, TopLine)->Attributes;
- SetTextColor(GuiData->hMemDC, RGBFromAttrib(Console,
TextAttribFromAttrib(LastAttribute)));
- SetBkColor(GuiData->hMemDC, RGBFromAttrib(Console,
BkgdAttribFromAttrib(LastAttribute)));
+ SetTextColor(GuiData->hMemDC, RGBFromAttrib2(Console,
TextAttribFromAttrib(LastAttribute)));
+ SetBkColor(GuiData->hMemDC, RGBFromAttrib2(Console,
BkgdAttribFromAttrib(LastAttribute)));
OldFont = SelectObject(GuiData->hMemDC, GuiData->Font);
@@ -247,8 +258,8 @@
Attribute = From->Attributes;
if (Attribute != LastAttribute)
{
- SetTextColor(GuiData->hMemDC, RGBFromAttrib(Console,
TextAttribFromAttrib(Attribute)));
- SetBkColor(GuiData->hMemDC, RGBFromAttrib(Console,
BkgdAttribFromAttrib(Attribute)));
+ SetTextColor(GuiData->hMemDC, RGBFromAttrib2(Console,
TextAttribFromAttrib(Attribute)));
+ SetBkColor(GuiData->hMemDC, RGBFromAttrib2(Console,
BkgdAttribFromAttrib(Attribute)));
LastAttribute = Attribute;
}
}
@@ -280,7 +291,7 @@
Attribute = ConioCoordToPointer(Buffer, Buffer->CursorPosition.X,
Buffer->CursorPosition.Y)->Attributes;
if (Attribute == DEFAULT_SCREEN_ATTRIB) Attribute =
Buffer->ScreenDefaultAttrib;
- CursorBrush = CreateSolidBrush(RGBFromAttrib(Console, Attribute));
+ CursorBrush = CreateSolidBrush(RGBFromAttrib2(Console,
TextAttribFromAttrib(Attribute)));
OldBrush = SelectObject(GuiData->hMemDC, CursorBrush);
PatBlt(GuiData->hMemDC,