ReactOS  0.4.14-dev-1332-g6db3d88
settings.h File Reference
#include "concfg/settings.h"
Include dependency graph for settings.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RGBFromAttrib(Console, Attribute)   ((Console)->Colors[(Attribute) & 0xF])
 
#define TextAttribFromAttrib(Attribute)   ( !((Attribute) & COMMON_LVB_REVERSE_VIDEO) ? (Attribute) & 0xF : ((Attribute) >> 4) & 0xF )
 
#define BkgdAttribFromAttrib(Attribute)   ( !((Attribute) & COMMON_LVB_REVERSE_VIDEO) ? ((Attribute) >> 4) & 0xF : (Attribute) & 0xF )
 
#define MakeAttrib(TextAttrib, BkgdAttrib)   (USHORT)((((BkgdAttrib) & 0xF) << 4) | ((TextAttrib) & 0xF))
 

Functions

VOID ConSrvApplyUserSettings (IN PCONSOLE Console, IN PCONSOLE_STATE_INFO ConsoleInfo)
 

Macro Definition Documentation

◆ BkgdAttribFromAttrib

#define BkgdAttribFromAttrib (   Attribute)    ( !((Attribute) & COMMON_LVB_REVERSE_VIDEO) ? ((Attribute) >> 4) & 0xF : (Attribute) & 0xF )

Definition at line 24 of file settings.h.

◆ MakeAttrib

#define MakeAttrib (   TextAttrib,
  BkgdAttrib 
)    (USHORT)((((BkgdAttrib) & 0xF) << 4) | ((TextAttrib) & 0xF))

Definition at line 25 of file settings.h.

◆ RGBFromAttrib

#define RGBFromAttrib (   Console,
  Attribute 
)    ((Console)->Colors[(Attribute) & 0xF])

Definition at line 22 of file settings.h.

◆ TextAttribFromAttrib

#define TextAttribFromAttrib (   Attribute)    ( !((Attribute) & COMMON_LVB_REVERSE_VIDEO) ? (Attribute) & 0xF : ((Attribute) >> 4) & 0xF )

Definition at line 23 of file settings.h.

Function Documentation

◆ ConSrvApplyUserSettings()

VOID ConSrvApplyUserSettings ( IN PCONSOLE  Console,
IN PCONSOLE_STATE_INFO  ConsoleInfo 
)

Console->InputBufferSize = 0;

Definition at line 36 of file settings.c.

38 {
39  PCONSOLE_SCREEN_BUFFER ActiveBuffer = Console->ActiveBuffer;
40 
41  /*
42  * Apply terminal-edition settings:
43  * - QuickEdit and Insert modes,
44  * - History settings.
45  */
46  Console->QuickEdit = !!ConsoleInfo->QuickEdit;
47  Console->InsertMode = !!ConsoleInfo->InsertMode;
50  ConsoleInfo->HistoryBufferSize,
51  ConsoleInfo->NumberOfHistoryBuffers,
52  ConsoleInfo->HistoryNoDup);
53 
54  /* Copy the new console palette */
55  // FIXME: Possible buffer overflow if s_colors is bigger than ConsoleInfo->ColorTable.
56  RtlCopyMemory(Console->Colors, ConsoleInfo->ColorTable, sizeof(s_Colors));
57 
58  /* Apply cursor size */
59  ActiveBuffer->CursorInfo.bVisible = (ConsoleInfo->CursorSize != 0);
60  ActiveBuffer->CursorInfo.dwSize = min(max(ConsoleInfo->CursorSize, 0), 100);
61 
62  /* Update the code page */
63  if ((Console->OutputCodePage != ConsoleInfo->CodePage) &&
64  IsValidCodePage(ConsoleInfo->CodePage))
65  {
66  Console->InputCodePage = Console->OutputCodePage = ConsoleInfo->CodePage;
67  // ConDrvSetConsoleCP(Console, ConsoleInfo->CodePage, TRUE); // Output
68  // ConDrvSetConsoleCP(Console, ConsoleInfo->CodePage, FALSE); // Input
69 
70  Console->IsCJK = IsCJKCodePage(Console->OutputCodePage);
71  }
72 
73  // FIXME: Check ConsoleInfo->WindowSize with respect to
74  // TermGetLargestConsoleWindowSize(...).
75 
76  if (GetType(ActiveBuffer) == TEXTMODE_BUFFER)
77  {
78  /* Resize its active screen-buffer */
80  COORD BufSize = ConsoleInfo->ScreenBufferSize;
81 
82  if (Console->FixedSize)
83  {
84  /*
85  * The console is in fixed-size mode, so we cannot resize anything
86  * at the moment. However, keep those settings somewhere so that
87  * we can try to set them up when we will be allowed to do so.
88  */
89  if (ConsoleInfo->WindowSize.X != ActiveBuffer->OldViewSize.X ||
90  ConsoleInfo->WindowSize.Y != ActiveBuffer->OldViewSize.Y)
91  {
92  ActiveBuffer->OldViewSize = ConsoleInfo->WindowSize;
93  }
94 
95  /* The buffer size is not allowed to be smaller than the view size */
96  if (BufSize.X >= ActiveBuffer->OldViewSize.X && BufSize.Y >= ActiveBuffer->OldViewSize.Y)
97  {
98  if (BufSize.X != ActiveBuffer->OldScreenBufferSize.X ||
99  BufSize.Y != ActiveBuffer->OldScreenBufferSize.Y)
100  {
101  /*
102  * The console is in fixed-size mode, so we cannot resize anything
103  * at the moment. However, keep those settings somewhere so that
104  * we can try to set them up when we will be allowed to do so.
105  */
106  ActiveBuffer->OldScreenBufferSize = BufSize;
107  }
108  }
109  }
110  else
111  {
112  BOOL SizeChanged = FALSE;
113 
114  /* Resize the console */
115  if (ConsoleInfo->WindowSize.X != ActiveBuffer->ViewSize.X ||
116  ConsoleInfo->WindowSize.Y != ActiveBuffer->ViewSize.Y)
117  {
118  ActiveBuffer->ViewSize = ConsoleInfo->WindowSize;
119  SizeChanged = TRUE;
120  }
121 
122  /* Resize the screen-buffer */
123  if (BufSize.X != ActiveBuffer->ScreenBufferSize.X ||
124  BufSize.Y != ActiveBuffer->ScreenBufferSize.Y)
125  {
127  SizeChanged = TRUE;
128  }
129 
130  if (SizeChanged) TermResizeTerminal(Console);
131  }
132 
133  /* Apply foreground and background colors for both screen and popup */
135  Buffer,
136  ConsoleInfo->ScreenAttributes,
137  ConsoleInfo->PopupAttributes);
138  }
139  else // if (GetType(ActiveBuffer) == GRAPHICS_BUFFER)
140  {
141  /*
142  * In any case we do NOT modify the size of the graphics screen-buffer.
143  * We just allow resizing the view only if the new size is smaller
144  * than the older one.
145  */
146  if (Console->FixedSize)
147  {
148  /*
149  * The console is in fixed-size mode, so we cannot resize anything
150  * at the moment. However, keep those settings somewhere so that
151  * we can try to set them up when we will be allowed to do so.
152  */
153  if (ConsoleInfo->WindowSize.X <= ActiveBuffer->ViewSize.X ||
154  ConsoleInfo->WindowSize.Y <= ActiveBuffer->ViewSize.Y)
155  {
156  ActiveBuffer->OldViewSize = ConsoleInfo->WindowSize;
157  }
158  }
159  else
160  {
161  /* Resize the view if its size is bigger than the specified size */
162  if (ConsoleInfo->WindowSize.X <= ActiveBuffer->ViewSize.X ||
163  ConsoleInfo->WindowSize.Y <= ActiveBuffer->ViewSize.Y)
164  {
165  ActiveBuffer->ViewSize = ConsoleInfo->WindowSize;
166  // SizeChanged = TRUE;
167  }
168  }
169  }
170 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
const COLORREF s_Colors[16]
Definition: conwnd.c:98
#define TermResizeTerminal(Console)
Definition: term.h:28
#define TEXTMODE_BUFFER
Definition: pccons.c:21
COORD OldScreenBufferSize
Definition: conio.h:90
#define IsCJKCodePage(CodePage)
Definition: font.h:23
COORD ScreenBufferSize
Definition: conio.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: bufpool.h:45
#define BufSize
Definition: FsRtlTunnel.c:28
ULONG X
Definition: bl.h:1340
VOID HistoryReshapeAllBuffers(IN PCONSRV_CONSOLE Console, IN ULONG HistoryBufferSize, IN ULONG MaxNumberOfHistoryBuffers, IN BOOLEAN HistoryNoDup)
Definition: history.c:371
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI ConDrvChangeScreenBufferAttributes(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN USHORT NewScreenAttrib, IN USHORT NewPopupAttrib)
Definition: text.c:510
INT GetType(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
Definition: gettype.c:129
Definition: bl.h:1338
BOOL WINAPI IsValidCodePage(UINT CodePage)
Definition: nls.c:1479
NTSTATUS ConioResizeBuffer(PCONSOLE Console, PTEXTMODE_SCREEN_BUFFER ScreenBuffer, COORD Size)
Definition: text.c:372
static CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo
Definition: video.c:47
#define min(a, b)
Definition: monoChain.cc:55
CConsole Console
CONSOLE_CURSOR_INFO CursorInfo
Definition: conio.h:100
ULONG Y
Definition: bl.h:1341
struct _TEXTMODE_SCREEN_BUFFER * PTEXTMODE_SCREEN_BUFFER

Referenced by GuiApplyUserSettings().