ReactOS  0.4.14-dev-57-g333b8f1
guiterm.h File Reference
#include "guisettings.h"
#include "conwnd.h"
Include dependency graph for guiterm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

FORCEINLINE VOID GetScreenBufferSizeUnits (IN PCONSOLE_SCREEN_BUFFER Buffer, IN PGUI_CONSOLE_DATA GuiData, OUT PUINT WidthUnit, OUT PUINT HeightUnit)
 
FORCEINLINE VOID SmallRectToRect (PGUI_CONSOLE_DATA GuiData, PRECT Rect, PSMALL_RECT SmallRect)
 
VOID GuiConsoleMoveWindow (PGUI_CONSOLE_DATA GuiData)
 
BOOL InitFonts (PGUI_CONSOLE_DATA GuiData, LPWSTR FaceName, ULONG FontFamily, COORD FontSize, ULONG FontWeight)
 
VOID DeleteFonts (PGUI_CONSOLE_DATA GuiData)
 
BOOL EnterFullScreen (PGUI_CONSOLE_DATA GuiData)
 
VOID LeaveFullScreen (PGUI_CONSOLE_DATA GuiData)
 
VOID SwitchFullScreen (PGUI_CONSOLE_DATA GuiData, BOOL FullScreen)
 
VOID GuiConsoleSwitchFullScreen (PGUI_CONSOLE_DATA GuiData)
 
VOID GuiCopyFromGraphicsBuffer (PGRAPHICS_SCREEN_BUFFER Buffer, PGUI_CONSOLE_DATA GuiData)
 
VOID GuiPasteToGraphicsBuffer (PGRAPHICS_SCREEN_BUFFER Buffer, PGUI_CONSOLE_DATA GuiData)
 
VOID GuiPaintGraphicsBuffer (PGRAPHICS_SCREEN_BUFFER Buffer, PGUI_CONSOLE_DATA GuiData, PRECT rcView, PRECT rcFramebuffer)
 
VOID PasteText (IN PCONSRV_CONSOLE Console, IN PWCHAR Buffer, IN SIZE_T cchSize)
 
VOID GuiCopyFromTextModeBuffer (PTEXTMODE_SCREEN_BUFFER Buffer, PGUI_CONSOLE_DATA GuiData)
 
VOID GuiPasteToTextModeBuffer (PTEXTMODE_SCREEN_BUFFER Buffer, PGUI_CONSOLE_DATA GuiData)
 
VOID GuiPaintTextModeBuffer (PTEXTMODE_SCREEN_BUFFER Buffer, PGUI_CONSOLE_DATA GuiData, PRECT rcView, PRECT rcFramebuffer)
 

Function Documentation

◆ DeleteFonts()

VOID DeleteFonts ( PGUI_CONSOLE_DATA  GuiData)

Definition at line 470 of file conwnd.c.

471 {
472  ULONG i;
473  for (i = 0; i < ARRAYSIZE(GuiData->Font); ++i)
474  {
475  if (GuiData->Font[i] != NULL) DeleteObject(GuiData->Font[i]);
476  GuiData->Font[i] = NULL;
477  }
478 }
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
HFONT Font[FONT_MAXNO]
Definition: conwnd.h:85
unsigned int ULONG
Definition: retypes.h:1

Referenced by InitFonts(), and OnNcDestroy().

◆ EnterFullScreen()

BOOL EnterFullScreen ( PGUI_CONSOLE_DATA  GuiData)

Definition at line 21 of file fullscreen.c.

22 {
23  DEVMODEW DevMode;
24 
25  ZeroMemory(&DevMode, sizeof(DevMode));
26  DevMode.dmSize = sizeof(DevMode);
27 
28  DevMode.dmDisplayFixedOutput = DMDFO_CENTER; // DMDFO_STRETCH // DMDFO_DEFAULT
29  // DevMode.dmDisplayFlags = DMDISPLAYFLAGS_TEXTMODE;
30  DevMode.dmPelsWidth = 640; // GuiData->ActiveBuffer->ViewSize.X * GuiData->CharWidth;
31  DevMode.dmPelsHeight = 480; // GuiData->ActiveBuffer->ViewSize.Y * GuiData->CharHeight;
32  // DevMode.dmBitsPerPel = 32;
33  DevMode.dmFields = DM_DISPLAYFIXEDOUTPUT | /* DM_DISPLAYFLAGS | DM_BITSPERPEL | */ DM_PELSWIDTH | DM_PELSHEIGHT;
34 
36 }
LONG WINAPI ChangeDisplaySettingsW(LPDEVMODEW lpDevMode, DWORD dwflags)
Definition: display.c:612
DWORD dmFields
Definition: wingdi.h:1617
#define CDS_FULLSCREEN
Definition: winuser.h:183
#define ZeroMemory
Definition: winbase.h:1635
#define DM_PELSWIDTH
Definition: wingdi.h:1268
DWORD dmDisplayFixedOutput
Definition: wingdi.h:1632
#define DMDFO_CENTER
Definition: wingdi.h:1223
WORD dmSize
Definition: wingdi.h:1615
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
DWORD dmPelsWidth
Definition: wingdi.h:1643
#define DM_PELSHEIGHT
Definition: wingdi.h:1269
DWORD dmPelsHeight
Definition: wingdi.h:1644

Referenced by OnActivate(), and SwitchFullScreen().

◆ GetScreenBufferSizeUnits()

FORCEINLINE VOID GetScreenBufferSizeUnits ( IN PCONSOLE_SCREEN_BUFFER  Buffer,
IN PGUI_CONSOLE_DATA  GuiData,
OUT PUINT  WidthUnit,
OUT PUINT  HeightUnit 
)

Definition at line 22 of file guiterm.h.

26 {
27  ASSERT(Buffer && GuiData && WidthUnit && HeightUnit);
28 
30  {
31  *WidthUnit = GuiData->CharWidth ;
32  *HeightUnit = GuiData->CharHeight;
33  }
34  else /* if (GetType(Buffer) == GRAPHICS_BUFFER) */
35  {
36  *WidthUnit = 1;
37  *HeightUnit = 1;
38  }
39 }
#define TEXTMODE_BUFFER
Definition: pccons.c:21
Definition: bufpool.h:45
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
INT GetType(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
Definition: gettype.c:129

Referenced by ConWndProc(), GuiGetLargestConsoleWindowSize(), OnGetMinMaxInfo(), OnScroll(), OnSize(), PointToCoord(), and SmallRectToRect().

◆ GuiConsoleMoveWindow()

VOID GuiConsoleMoveWindow ( PGUI_CONSOLE_DATA  GuiData)

Definition at line 61 of file guiterm.c.

62 {
63  /* Move the window if needed (not positioned by the system) */
64  if (!GuiData->GuiInfo.AutoPosition)
65  {
66  SetWindowPos(GuiData->hWindow,
67  NULL,
68  GuiData->GuiInfo.WindowOrigin.x,
69  GuiData->GuiInfo.WindowOrigin.y,
70  0, 0,
72  }
73 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define SWP_NOZORDER
Definition: winuser.h:1232
smooth NULL
Definition: ftsmooth.c:416
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define SWP_NOSIZE
Definition: winuser.h:1230
GUI_CONSOLE_INFO GuiInfo
Definition: conwnd.h:96
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)

◆ GuiConsoleSwitchFullScreen()

VOID GuiConsoleSwitchFullScreen ( PGUI_CONSOLE_DATA  GuiData)

Definition at line 175 of file fullscreen.c.

176 {
177  PCONSRV_CONSOLE Console = GuiData->Console;
178  BOOL FullScreen;
179 
181 
182  /* Switch to full-screen or to windowed mode */
183  FullScreen = !GuiData->GuiInfo.FullScreen;
184  DPRINT("GuiConsoleSwitchFullScreen - Switch to %s ...\n",
185  (FullScreen ? "full-screen" : "windowed mode"));
186 
187  SwitchFullScreen(GuiData, FullScreen);
188 
190 }
#define TRUE
Definition: types.h:120
#define PCONSRV_CONSOLE
Definition: conio.h:27
unsigned int BOOL
Definition: ntddk_ex.h:94
void DPRINT(...)
Definition: polytest.cpp:61
VOID SwitchFullScreen(PGUI_CONSOLE_DATA GuiData, BOOL FullScreen)
Definition: fullscreen.c:49
BOOLEAN NTAPI ConDrvValidateConsoleUnsafe(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState, IN BOOLEAN LockConsole)
Definition: console.c:120
CConsole Console
GUI_CONSOLE_INFO GuiInfo
Definition: conwnd.h:96
PCONSRV_CONSOLE Console
Definition: conwnd.h:90
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by ConWndProc().

◆ GuiCopyFromGraphicsBuffer()

VOID GuiCopyFromGraphicsBuffer ( PGRAPHICS_SCREEN_BUFFER  Buffer,
PGUI_CONSOLE_DATA  GuiData 
)

Definition at line 21 of file graphics.c.

23 {
24  /*
25  * This function supposes that the system clipboard was opened.
26  */
27 
28  HDC hMemDC;
29  HBITMAP hBitmapTarget, hBitmapOld;
30  HPALETTE hPalette, hPaletteOld;
31  ULONG selWidth, selHeight;
32 
33  if (Buffer->BitMap == NULL) return;
34 
35  selWidth = GuiData->Selection.srSelection.Right - GuiData->Selection.srSelection.Left + 1;
36  selHeight = GuiData->Selection.srSelection.Bottom - GuiData->Selection.srSelection.Top + 1;
37  DPRINT("Selection is (%d|%d) to (%d|%d)\n",
38  GuiData->Selection.srSelection.Left,
39  GuiData->Selection.srSelection.Top,
40  GuiData->Selection.srSelection.Right,
41  GuiData->Selection.srSelection.Bottom);
42 
43  hMemDC = CreateCompatibleDC(GuiData->hMemDC);
44  if (hMemDC == NULL) return;
45 
46  /* Allocate a bitmap to be given to the clipboard, so it will not be freed here */
47  hBitmapTarget = CreateCompatibleBitmap(GuiData->hMemDC, selWidth, selHeight);
48  if (hBitmapTarget == NULL)
49  {
50  DeleteDC(hMemDC);
51  return;
52  }
53 
54  /* Select the new bitmap */
55  hBitmapOld = SelectObject(hMemDC, hBitmapTarget);
56 
57  /* Change the palette in hMemDC if the current palette does exist */
58  if (Buffer->PaletteHandle == NULL)
59  hPalette = GuiData->hSysPalette;
60  else
61  hPalette = Buffer->PaletteHandle;
62 
63  if (hPalette) hPaletteOld = SelectPalette(hMemDC, hPalette, FALSE);
64 
65  /* Grab the mutex */
67 
68  // The equivalent of a SetDIBitsToDevice call...
69  // It seems to be broken: it does not copy the tail of the bitmap.
70  // http://wiki.allegro.cc/index.php?title=StretchDIBits
71 #if 0
72  StretchDIBits(hMemDC,
73  0, 0,
74  selWidth, selHeight,
75  GuiData->Selection.srSelection.Left,
76  GuiData->Selection.srSelection.Top,
77  selWidth, selHeight,
78  Buffer->BitMap,
79  Buffer->BitMapInfo,
80  Buffer->BitMapUsage,
81  SRCCOPY);
82 #else
83  SetDIBitsToDevice(hMemDC,
84  /* Coordinates / size of the repainted rectangle, in the framebuffer's frame */
85  0, 0,
86  selWidth, selHeight,
87  /* Coordinates / size of the corresponding image portion, in the graphics screen-buffer's frame */
88  GuiData->Selection.srSelection.Left,
89  GuiData->Selection.srSelection.Top,
90  0,
91  Buffer->ScreenBufferSize.Y, // == Buffer->BitMapInfo->bmiHeader.biHeight
92  Buffer->BitMap,
93  Buffer->BitMapInfo,
94  Buffer->BitMapUsage);
95 #endif
96 
97  /* Release the mutex */
98  NtReleaseMutant(Buffer->Mutex, NULL);
99 
100  /* Restore the palette and the old bitmap */
101  if (hPalette) SelectPalette(hMemDC, hPaletteOld, FALSE);
102  SelectObject(hMemDC, hBitmapOld);
103 
104  EmptyClipboard();
105  SetClipboardData(CF_BITMAP, hBitmapTarget);
106 
107  DeleteDC(hMemDC);
108 }
int WINAPI StretchDIBits(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ const VOID *, _In_ const BITMAPINFO *, _In_ UINT, _In_ DWORD)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
CONSOLE_SELECTION_INFO Selection
Definition: conwnd.h:92
SMALL_RECT srSelection
Definition: wincon.h:195
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define CF_BITMAP
Definition: constants.h:397
HPALETTE WINAPI SelectPalette(_In_ HDC, _In_ HPALETTE, _In_ BOOL)
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
SHORT Left
Definition: blue.h:25
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
SHORT Bottom
Definition: blue.h:28
SHORT Top
Definition: blue.h:26
int WINAPI SetDIBitsToDevice(_In_ HDC, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ int, _In_ int, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
BOOL WINAPI DeleteDC(_In_ HDC)
HPALETTE hSysPalette
Definition: conwnd.h:64
unsigned int ULONG
Definition: retypes.h:1
static HBITMAP
Definition: button.c:44
SHORT Right
Definition: blue.h:27
NTSTATUS NTAPI NtReleaseMutant(IN HANDLE MutantHandle, IN PLONG PreviousCount OPTIONAL)
Definition: mutant.c:299
#define SRCCOPY
Definition: wingdi.h:332
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)

Referenced by Copy().

◆ GuiCopyFromTextModeBuffer()

VOID GuiCopyFromTextModeBuffer ( PTEXTMODE_SCREEN_BUFFER  Buffer,
PGUI_CONSOLE_DATA  GuiData 
)

Definition at line 297 of file text.c.

299 {
300  /*
301  * This function supposes that the system clipboard was opened.
302  */
303 
304  BOOL LineSelection = GuiData->LineSelection;
305 
306  DPRINT("Selection is (%d|%d) to (%d|%d) in %s mode\n",
307  GuiData->Selection.srSelection.Left,
308  GuiData->Selection.srSelection.Top,
309  GuiData->Selection.srSelection.Right,
310  GuiData->Selection.srSelection.Bottom,
311  (LineSelection ? "line" : "block"));
312 
313  if (!LineSelection)
314  {
316  }
317  else
318  {
319  COORD Begin, End;
320 
322  &GuiData->Selection.dwSelectionAnchor,
323  &GuiData->Selection.srSelection);
324 
325  CopyLines(Buffer, &Begin, &End);
326  }
327 }
static VOID CopyLines(PTEXTMODE_SCREEN_BUFFER Buffer, PCOORD Begin, PCOORD End)
Definition: text.c:146
CONSOLE_SELECTION_INFO Selection
Definition: conwnd.h:92
SMALL_RECT srSelection
Definition: wincon.h:195
VOID GetSelectionBeginEnd(PCOORD Begin, PCOORD End, PCOORD SelectionAnchor, PSMALL_RECT SmallRect)
Definition: conwnd.c:721
unsigned int BOOL
Definition: ntddk_ex.h:94
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
static VOID CopyBlock(PTEXTMODE_SCREEN_BUFFER Buffer, PSMALL_RECT Selection)
Definition: text.c:40
BOOL LineSelection
Definition: conwnd.h:94
SHORT Left
Definition: blue.h:25
SHORT Bottom
Definition: blue.h:28
SHORT Top
Definition: blue.h:26
Definition: bl.h:1338
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 const char BOOLEAN Begin
Definition: acpixf.h:1287
SHORT Right
Definition: blue.h:27

Referenced by Copy().

◆ GuiPaintGraphicsBuffer()

VOID GuiPaintGraphicsBuffer ( PGRAPHICS_SCREEN_BUFFER  Buffer,
PGUI_CONSOLE_DATA  GuiData,
PRECT  rcView,
PRECT  rcFramebuffer 
)

Definition at line 124 of file graphics.c.

128 {
129  PCONSRV_CONSOLE Console = Buffer->Header.Console;
130  // ASSERT(Console == GuiData->Console);
131 
132  ConioInitLongRect(rcFramebuffer, 0, 0, 0, 0);
133 
134  if (Buffer->BitMap == NULL)
135  return;
136 
138  return;
139 
140  ConioInitLongRect(rcFramebuffer,
141  Buffer->ViewOrigin.Y * 1 + rcView->top,
142  Buffer->ViewOrigin.X * 1 + rcView->left,
143  Buffer->ViewOrigin.Y * 1 + rcView->bottom,
144  Buffer->ViewOrigin.X * 1 + rcView->right);
145 
146  /* Grab the mutex */
148 
149  /*
150  * The seventh parameter (YSrc) of SetDIBitsToDevice always designates
151  * the Y-coordinate of the "lower-left corner" of the image, be the DIB
152  * in bottom-up or top-down mode.
153  */
154  SetDIBitsToDevice(GuiData->hMemDC,
155  /* Coordinates / size of the repainted rectangle, in the framebuffer's frame */
156  rcFramebuffer->left,
157  rcFramebuffer->top,
158  rcFramebuffer->right - rcFramebuffer->left,
159  rcFramebuffer->bottom - rcFramebuffer->top,
160  /* Coordinates / size of the corresponding image portion, in the graphics screen-buffer's frame */
161  rcFramebuffer->left,
162  rcFramebuffer->top,
163  0,
164  Buffer->ScreenBufferSize.Y, // == Buffer->BitMapInfo->bmiHeader.biHeight
165  Buffer->BitMap,
166  Buffer->BitMapInfo,
167  Buffer->BitMapUsage);
168 
169  /* Release the mutex */
170  NtReleaseMutant(Buffer->Mutex, NULL);
171 
173 }
#define TRUE
Definition: types.h:120
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
#define PCONSRV_CONSOLE
Definition: conio.h:27
LONG right
Definition: windef.h:293
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define ConioInitLongRect(Rect, Top, Left, Bottom, Right)
Definition: rect.h:12
int WINAPI SetDIBitsToDevice(_In_ HDC, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ int, _In_ int, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
BOOLEAN NTAPI ConDrvValidateConsoleUnsafe(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState, IN BOOLEAN LockConsole)
Definition: console.c:120
CConsole Console
LONG bottom
Definition: windef.h:294
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
NTSTATUS NTAPI NtReleaseMutant(IN HANDLE MutantHandle, IN PLONG PreviousCount OPTIONAL)
Definition: mutant.c:299
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)

Referenced by OnPaint().

◆ GuiPaintTextModeBuffer()

VOID GuiPaintTextModeBuffer ( PTEXTMODE_SCREEN_BUFFER  Buffer,
PGUI_CONSOLE_DATA  GuiData,
PRECT  rcView,
PRECT  rcFramebuffer 
)

Definition at line 355 of file text.c.

359 {
360  PCONSRV_CONSOLE Console = Buffer->Header.Console;
361  ULONG TopLine, BottomLine, LeftColumn, RightColumn;
362  ULONG Line, Char, Start;
363  PCHAR_INFO From;
364  PWCHAR To;
365  WORD LastAttribute, Attribute;
366  ULONG CursorX, CursorY, CursorHeight;
367  HBRUSH CursorBrush, OldBrush;
368  HFONT OldFont, NewFont;
369  BOOLEAN IsUnderline;
370 
371  // ASSERT(Console == GuiData->Console);
372 
373  ConioInitLongRect(rcFramebuffer, 0, 0, 0, 0);
374 
375  if (Buffer->Buffer == NULL)
376  return;
377 
379  return;
380 
381  ConioInitLongRect(rcFramebuffer,
382  Buffer->ViewOrigin.Y * GuiData->CharHeight + rcView->top,
383  Buffer->ViewOrigin.X * GuiData->CharWidth + rcView->left,
384  Buffer->ViewOrigin.Y * GuiData->CharHeight + rcView->bottom,
385  Buffer->ViewOrigin.X * GuiData->CharWidth + rcView->right);
386 
387  LeftColumn = rcFramebuffer->left / GuiData->CharWidth;
388  RightColumn = rcFramebuffer->right / GuiData->CharWidth;
389  if (RightColumn >= (ULONG)Buffer->ScreenBufferSize.X)
390  RightColumn = Buffer->ScreenBufferSize.X - 1;
391 
392  TopLine = rcFramebuffer->top / GuiData->CharHeight;
393  BottomLine = rcFramebuffer->bottom / GuiData->CharHeight;
394  if (BottomLine >= (ULONG)Buffer->ScreenBufferSize.Y)
395  BottomLine = Buffer->ScreenBufferSize.Y - 1;
396 
397  LastAttribute = ConioCoordToPointer(Buffer, LeftColumn, TopLine)->Attributes;
398 
401 
402  /* We use the underscore flag as a underline flag */
403  IsUnderline = !!(LastAttribute & COMMON_LVB_UNDERSCORE);
404  /* Select the new font */
405  NewFont = GuiData->Font[IsUnderline ? FONT_BOLD : FONT_NORMAL];
406  OldFont = SelectObject(GuiData->hMemDC, NewFont);
407 
408  for (Line = TopLine; Line <= BottomLine; Line++)
409  {
410  WCHAR LineBuffer[80]; // Buffer containing a part or all the line to be displayed
411  From = ConioCoordToPointer(Buffer, LeftColumn, Line); // Get the first code of the line
412  Start = LeftColumn;
413  To = LineBuffer;
414 
415  for (Char = LeftColumn; Char <= RightColumn; Char++)
416  {
417  /*
418  * We flush the buffer if the new attribute is different
419  * from the current one, or if the buffer is full.
420  */
421  if (From->Attributes != LastAttribute || (Char - Start == sizeof(LineBuffer) / sizeof(WCHAR)))
422  {
423  TextOutW(GuiData->hMemDC,
424  Start * GuiData->CharWidth,
425  Line * GuiData->CharHeight,
426  LineBuffer,
427  Char - Start);
428  Start = Char;
429  To = LineBuffer;
430  Attribute = From->Attributes;
431  if (Attribute != LastAttribute)
432  {
433  LastAttribute = Attribute;
436 
437  /* Change underline state if needed */
438  if (!!(LastAttribute & COMMON_LVB_UNDERSCORE) != IsUnderline)
439  {
440  IsUnderline = !!(LastAttribute & COMMON_LVB_UNDERSCORE);
441  /* Select the new font */
442  NewFont = GuiData->Font[IsUnderline ? FONT_BOLD : FONT_NORMAL];
443  /* OldFont = */ SelectObject(GuiData->hMemDC, NewFont);
444  }
445  }
446  }
447 
448  *(To++) = (From++)->Char.UnicodeChar;
449  }
450 
451  TextOutW(GuiData->hMemDC,
452  Start * GuiData->CharWidth,
453  Line * GuiData->CharHeight,
454  LineBuffer,
455  RightColumn - Start + 1);
456  }
457 
458  /* Restore the old font */
459  SelectObject(GuiData->hMemDC, OldFont);
460 
461  /*
462  * Draw the caret
463  */
464  if (Buffer->CursorInfo.bVisible &&
465  Buffer->CursorBlinkOn &&
466  !Buffer->ForceCursorOff)
467  {
468  CursorX = Buffer->CursorPosition.X;
469  CursorY = Buffer->CursorPosition.Y;
470  if (LeftColumn <= CursorX && CursorX <= RightColumn &&
471  TopLine <= CursorY && CursorY <= BottomLine)
472  {
473  CursorHeight = ConioEffectiveCursorSize(Console, GuiData->CharHeight);
474 
475  Attribute = ConioCoordToPointer(Buffer, Buffer->CursorPosition.X, Buffer->CursorPosition.Y)->Attributes;
476  if (Attribute == DEFAULT_SCREEN_ATTRIB)
477  Attribute = Buffer->ScreenDefaultAttrib;
478 
480  OldBrush = SelectObject(GuiData->hMemDC, CursorBrush);
481 
482  PatBlt(GuiData->hMemDC,
483  CursorX * GuiData->CharWidth,
484  CursorY * GuiData->CharHeight + (GuiData->CharHeight - CursorHeight),
485  GuiData->CharWidth,
486  CursorHeight,
487  PATCOPY);
488 
489  SelectObject(GuiData->hMemDC, OldBrush);
490  DeleteObject(CursorBrush);
491  }
492  }
493 
495 }
#define DEFAULT_SCREEN_ATTRIB
Definition: settings.c:29
#define TRUE
Definition: types.h:120
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ INT nXStart, _In_ INT nYStart, _In_reads_(cchString) LPCWSTR lpString, _In_ INT cchString)
Definition: text.c:66
static COLORREF PaletteRGBFromAttrib(PCONSRV_CONSOLE Console, WORD Attribute)
Definition: text.c:28
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
Definition: text.c:140
static ULONG CursorY
Definition: display.c:137
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
uint16_t * PWCHAR
Definition: typedefs.h:54
LONG left
Definition: windef.h:291
#define PCONSRV_CONSOLE
Definition: conio.h:27
LONG right
Definition: windef.h:293
#define COMMON_LVB_UNDERSCORE
Definition: wincon.h:54
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
UINT CharHeight
Definition: conwnd.h:87
#define FONT_NORMAL
Definition: conwnd.h:35
char Char
Definition: bzip2.c:161
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
HFONT Font[FONT_MAXNO]
Definition: conwnd.h:85
#define BkgdAttribFromAttrib(Attribute)
Definition: settings.h:73
#define ConioInitLongRect(Rect, Top, Left, Bottom, Right)
Definition: rect.h:12
__wchar_t WCHAR
Definition: xmlstorage.h:180
WORD Attributes
Definition: wincon.h:172
unsigned short WORD
Definition: ntddk_ex.h:93
Definition: partlist.h:33
Definition: ncftp.h:79
static ULONG CursorX
Definition: display.c:136
#define TextAttribFromAttrib(Attribute)
Definition: settings.h:72
#define PATCOPY
Definition: wingdi.h:334
BOOLEAN NTAPI ConDrvValidateConsoleUnsafe(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState, IN BOOLEAN LockConsole)
Definition: console.c:120
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
UINT CharWidth
Definition: conwnd.h:86
DWORD FASTCALL ConioEffectiveCursorSize(PCONSOLE Console, DWORD Scale)
Definition: text.c:303
CConsole Console
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
unsigned int ULONG
Definition: retypes.h:1
LONG bottom
Definition: windef.h:294
COLORREF WINAPI SetTextColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: text.c:888
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
struct Line Line

Referenced by OnPaint().

◆ GuiPasteToGraphicsBuffer()

VOID GuiPasteToGraphicsBuffer ( PGRAPHICS_SCREEN_BUFFER  Buffer,
PGUI_CONSOLE_DATA  GuiData 
)

Definition at line 111 of file graphics.c.

113 {
114  /*
115  * This function supposes that the system clipboard was opened.
116  */
117 
118  // PCONSRV_CONSOLE Console = Buffer->Header.Console;
119 
121 }
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by Paste().

◆ GuiPasteToTextModeBuffer()

VOID GuiPasteToTextModeBuffer ( PTEXTMODE_SCREEN_BUFFER  Buffer,
PGUI_CONSOLE_DATA  GuiData 
)

Definition at line 330 of file text.c.

332 {
333  /*
334  * This function supposes that the system clipboard was opened.
335  */
336 
337  PCONSRV_CONSOLE Console = Buffer->Header.Console;
338 
339  HANDLE hData;
340  LPWSTR pszText;
341 
343  if (hData == NULL) return;
344 
345  pszText = GlobalLock(hData);
346  if (pszText == NULL) return;
347 
348  DPRINT("Got data <%S> from clipboard\n", pszText);
349  PasteText(Console, pszText, wcslen(pszText));
350 
351  GlobalUnlock(hData);
352 }
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID PasteText(IN PCONSRV_CONSOLE Console, IN PWCHAR Buffer, IN SIZE_T cchSize)
Definition: text.c:229
#define CF_UNICODETEXT
Definition: constants.h:408
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HANDLE WINAPI GetClipboardData(_In_ UINT)
CConsole Console
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by Paste().

◆ InitFonts()

BOOL InitFonts ( PGUI_CONSOLE_DATA  GuiData,
LPWSTR  FaceName,
ULONG  FontFamily,
COORD  FontSize,
ULONG  FontWeight 
)

Definition at line 510 of file conwnd.c.

515 {
516  HDC hDC;
517  HFONT hFont;
518 
519  /*
520  * Initialize a new NORMAL font and get its character cell size.
521  */
522  /* NOTE: FontSize is always in cell height/width units (pixels) */
523  hFont = CreateConsoleFontEx((LONG)(ULONG)FontSize.Y,
524  (LONG)(ULONG)FontSize.X,
525  FaceName,
526  FontFamily,
527  FontWeight,
528  GuiData->Console->OutputCodePage);
529  if (hFont == NULL)
530  {
531  DPRINT1("InitFonts: CreateConsoleFontEx failed\n");
532  return FALSE;
533  }
534 
535  hDC = GetDC(GuiData->hWindow);
536  if (!GetFontCellSize(hDC, hFont, &GuiData->CharHeight, &GuiData->CharWidth))
537  {
538  DPRINT1("InitFonts: GetFontCellSize failed\n");
539  ReleaseDC(GuiData->hWindow, hDC);
541  return FALSE;
542  }
543  ReleaseDC(GuiData->hWindow, hDC);
544 
545  /*
546  * Initialization succeeded.
547  */
548  // Delete all the old fonts first.
549  DeleteFonts(GuiData);
550  GuiData->Font[FONT_NORMAL] = hFont;
551 
552  /*
553  * Now build the other fonts (bold, underlined, mixed).
554  */
555  GuiData->Font[FONT_BOLD] =
557  FontWeight < FW_BOLD ? FW_BOLD : FontWeight,
558  FALSE,
559  FALSE);
560  GuiData->Font[FONT_UNDERLINE] =
562  FontWeight,
563  TRUE,
564  FALSE);
565  GuiData->Font[FONT_BOLD | FONT_UNDERLINE] =
567  FontWeight < FW_BOLD ? FW_BOLD : FontWeight,
568  TRUE,
569  FALSE);
570 
571  /*
572  * Save the settings.
573  */
574  if (FaceName != GuiData->GuiInfo.FaceName)
575  {
577  FaceName, LF_FACESIZE);
578  }
579  GuiData->GuiInfo.FontFamily = FontFamily;
580  GuiData->GuiInfo.FontSize = FontSize;
581  GuiData->GuiInfo.FontWeight = FontWeight;
582 
583  return TRUE;
584 }
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
#define TRUE
Definition: types.h:120
#define LF_FACESIZE
Definition: dimm.idl:39
HDC WINAPI GetDC(_In_opt_ HWND)
VOID DeleteFonts(PGUI_CONSOLE_DATA GuiData)
Definition: conwnd.c:470
static HDC
Definition: imagelist.c:92
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HFONT hFont
Definition: main.c:53
UINT CharHeight
Definition: conwnd.h:87
#define FONT_NORMAL
Definition: conwnd.h:35
long LONG
Definition: pedump.c:60
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
HFONT Font[FONT_MAXNO]
Definition: conwnd.h:85
BOOL GetFontCellSize(IN HDC hDC OPTIONAL, IN HFONT hFont, OUT PUINT Height, OUT PUINT Width)
Definition: font.c:113
ULONG X
Definition: bl.h:1340
static HDC hDC
Definition: 3dtext.c:33
#define FW_BOLD
Definition: wingdi.h:377
WCHAR FaceName[LF_FACESIZE]
Definition: guisettings.h:18
HFONT CreateConsoleFontEx(IN LONG Height, IN LONG Width OPTIONAL, IN OUT LPWSTR FaceName, IN ULONG FontFamily, IN ULONG FontWeight, IN UINT CodePage)
Definition: font.c:43
UINT CharWidth
Definition: conwnd.h:86
#define DPRINT1
Definition: precomp.h:8
GUI_CONSOLE_INFO GuiInfo
Definition: conwnd.h:96
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
unsigned int ULONG
Definition: retypes.h:1
PCONSRV_CONSOLE Console
Definition: conwnd.h:90
static HFONT CreateDerivedFont(HFONT OrgFont, ULONG FontWeight, BOOLEAN bUnderline, BOOLEAN bStrikeOut)
Definition: conwnd.c:481
ULONG Y
Definition: bl.h:1341

Referenced by GuiApplyUserSettings(), and OnNcCreate().

◆ LeaveFullScreen()

VOID LeaveFullScreen ( PGUI_CONSOLE_DATA  GuiData)

Definition at line 39 of file fullscreen.c.

40 {
42 }
LONG WINAPI ChangeDisplaySettingsW(LPDEVMODEW lpDevMode, DWORD dwflags)
Definition: display.c:612
#define CDS_RESET
Definition: winuser.h:187
smooth NULL
Definition: ftsmooth.c:416

Referenced by OnActivate(), and SwitchFullScreen().

◆ PasteText()

VOID PasteText ( IN PCONSRV_CONSOLE  Console,
IN PWCHAR  Buffer,
IN SIZE_T  cchSize 
)

Definition at line 229 of file text.c.

233 {
234  USHORT VkKey; // MAKEWORD(low = vkey_code, high = shift_state);
235  INPUT_RECORD er;
236  WCHAR CurChar = 0;
237 
238  /* Do nothing if we have nothing to paste */
239  if (!Buffer || (cchSize <= 0))
240  return;
241 
242  er.EventType = KEY_EVENT;
243  er.Event.KeyEvent.wRepeatCount = 1;
244  while (cchSize--)
245  {
246  /* \r or \n characters. Go to the line only if we get "\r\n" sequence. */
247  if (CurChar == L'\r' && *Buffer == L'\n')
248  {
249  ++Buffer;
250  continue;
251  }
252  CurChar = *Buffer++;
253 
254  /* Get the key code (+ shift state) corresponding to the character */
255  VkKey = VkKeyScanW(CurChar);
256  if (VkKey == 0xFFFF)
257  {
258  DPRINT1("FIXME: TODO: VkKeyScanW failed - Should simulate the key!\n");
259  /*
260  * We don't really need the scan/key code because we actually only
261  * use the UnicodeChar for output purposes. It may pose few problems
262  * later on but it's not of big importance. One trick would be to
263  * convert the character to OEM / multibyte and use MapVirtualKey()
264  * on each byte (simulating an Alt-0xxx OEM keyboard press).
265  */
266  }
267 
268  /* Pressing some control keys */
269 
270  /* Pressing the character key, with the control keys maintained pressed */
272  er.Event.KeyEvent.wVirtualKeyCode = LOBYTE(VkKey);
276  if (HIBYTE(VkKey) & 1)
278  if (HIBYTE(VkKey) & 2)
279  er.Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED; // RIGHT_CTRL_PRESSED;
280  if (HIBYTE(VkKey) & 4)
281  er.Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED; // RIGHT_ALT_PRESSED;
282 
284 
285  /* Up all the character and control keys */
288  }
289 }
#define TRUE
Definition: types.h:120
WCHAR UnicodeChar
Definition: wincon.h:230
WORD wVirtualScanCode
Definition: wincon.h:228
#define LOBYTE(W)
Definition: jmemdos.c:487
DWORD dwControlKeyState
Definition: wincon.h:233
#define HIBYTE(W)
Definition: jmemdos.c:486
#define SHIFT_PRESSED
Definition: wincon.h:135
WORD wVirtualKeyCode
Definition: wincon.h:227
union _INPUT_RECORD::@3154 Event
WORD wRepeatCount
Definition: wincon.h:226
#define KEY_EVENT
Definition: wincon.h:122
Definition: bufpool.h:45
UINT WINAPI MapVirtualKeyW(_In_ UINT, _In_ UINT)
#define LEFT_ALT_PRESSED
Definition: wincon.h:132
union _KEY_EVENT_RECORD::@3153 uChar
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAPVK_VK_TO_VSC
Definition: winuser.h:2330
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:263
#define LEFT_CTRL_PRESSED
Definition: wincon.h:134
static const WCHAR L[]
Definition: oid.c:1250
static TCHAR CurChar
Definition: parser.c:52
unsigned short USHORT
Definition: pedump.c:61
CConsole Console
WORD EventType
Definition: wincon.h:261
#define DPRINT1
Definition: precomp.h:8
SHORT WINAPI VkKeyScanW(_In_ WCHAR)
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
NTSTATUS ConioProcessInputEvent(PCONSRV_CONSOLE Console, PINPUT_RECORD InputEvent)
Definition: coninput.c:195

Referenced by GuiPasteToTextModeBuffer(), and OnDropFiles().

◆ SmallRectToRect()

FORCEINLINE VOID SmallRectToRect ( PGUI_CONSOLE_DATA  GuiData,
PRECT  Rect,
PSMALL_RECT  SmallRect 
)

Definition at line 43 of file guiterm.h.

44 {
46  UINT WidthUnit, HeightUnit;
47 
48  GetScreenBufferSizeUnits(Buffer, GuiData, &WidthUnit, &HeightUnit);
49 
50  Rect->left = (SmallRect->Left - Buffer->ViewOrigin.X) * WidthUnit ;
51  Rect->top = (SmallRect->Top - Buffer->ViewOrigin.Y) * HeightUnit;
52  Rect->right = (SmallRect->Right + 1 - Buffer->ViewOrigin.X) * WidthUnit ;
53  Rect->bottom = (SmallRect->Bottom + 1 - Buffer->ViewOrigin.Y) * HeightUnit;
54 }
SHORT Right
Definition: wincon.h:178
SHORT Left
Definition: wincon.h:176
PCONSOLE_SCREEN_BUFFER ActiveBuffer
Definition: conwnd.h:91
Definition: bufpool.h:45
SHORT Bottom
Definition: wincon.h:179
SHORT Top
Definition: wincon.h:177
FORCEINLINE VOID GetScreenBufferSizeUnits(IN PCONSOLE_SCREEN_BUFFER Buffer, IN PGUI_CONSOLE_DATA GuiData, OUT PUINT WidthUnit, OUT PUINT HeightUnit)
Definition: guiterm.h:22
unsigned int UINT
Definition: ndis.h:50

Referenced by CreateSelectionRgn(), and DrawRegion().

◆ SwitchFullScreen()

VOID SwitchFullScreen ( PGUI_CONSOLE_DATA  GuiData,
BOOL  FullScreen 
)

Definition at line 49 of file fullscreen.c.

50 {
51  PCONSRV_CONSOLE Console = GuiData->Console;
52 
53  /*
54  * See:
55  * http://stackoverflow.com/questions/2382464/win32-full-screen-and-hiding-taskbar
56  * http://stackoverflow.com/questions/3549148/fullscreen-management-with-winapi
57  * http://blogs.msdn.com/b/oldnewthing/archive/2010/04/12/9994016.aspx
58  * http://blogs.msdn.com/b/oldnewthing/archive/2005/05/05/414910.aspx
59  * http://stackoverflow.com/questions/1400654/how-do-i-put-my-opengl-app-into-fullscreen-mode
60  * http://nehe.gamedev.net/tutorial/creating_an_opengl_window_win32/13001/
61  * http://www.reocities.com/pcgpe/dibs.html
62  */
63 
64  /* If we are already in the given state, just bail out */
65  if (FullScreen == GuiData->GuiInfo.FullScreen) return;
66 
67  /* Save the current window state if we are not already full-screen */
68  if (!GuiData->GuiInfo.FullScreen)
69  {
70  GuiData->IsWndMax = IsZoomed(GuiData->hWindow);
71  if (GuiData->IsWndMax)
73 
74  /* Save its old position and size and show state */
75  GuiData->WndPl.length = sizeof(WINDOWPLACEMENT);
76  GetWindowPlacement(GuiData->hWindow, &GuiData->WndPl);
77 
78  /* Save the old window styles */
79  GuiData->WndStyle = GetWindowLongPtr(GuiData->hWindow, GWL_STYLE );
80  GuiData->WndStyleEx = GetWindowLongPtr(GuiData->hWindow, GWL_EXSTYLE);
81  }
82 
83  if (FullScreen)
84  {
86 
87  /* Switch to full screen */
88  if (EnterFullScreen(GuiData))
89  {
90  /* Save the new state */
91  Console->FixedSize = TRUE;
92  GuiData->GuiInfo.FullScreen = TRUE;
93 
94  GuiData->ActiveBuffer->OldViewSize = GuiData->ActiveBuffer->ViewSize;
95  // GuiData->ActiveBuffer->OldScreenBufferSize = GuiData->ActiveBuffer->ScreenBufferSize;
96 
97  /* Change the window styles */
102  // SetWindowPos(GuiData->hWindow, NULL, 0, 0, 0, 0,
103  // SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
104  // SWP_FRAMECHANGED | SWP_SHOWWINDOW);
105 
106  /* Reposition the window to the upper-left corner */
107  SetWindowPos(GuiData->hWindow, HWND_TOPMOST, 0, 0, 0, 0,
109 
110  /* Make it the foreground window */
111  SetForegroundWindow(GuiData->hWindow);
112 
113  /* Resize it */
114  // // GuiConsoleResizeWindow(GuiData);
115  // GuiConsoleResize(GuiData, SIZE_RESTORED, MAKELPARAM(640, 480));
116 
118  // SendMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
119  }
120 
122  GuiData->GuiInfo.FullScreen || GuiData->IsWndMax
124  0);
125  // ShowWindowAsync(GuiData->hWindow, SW_RESTORE);
126  }
127  else
128  {
130 
131  /* Restore windowing mode */
132  LeaveFullScreen(GuiData);
133 
134  /* Save the new state */
135  GuiData->GuiInfo.FullScreen = FALSE;
136  Console->FixedSize = FALSE;
137 
138  /*
139  * Restore possible saved dimensions
140  * of the active screen buffer view.
141  */
142  GuiData->ActiveBuffer->ViewSize = GuiData->ActiveBuffer->OldViewSize;
143  // GuiData->ActiveBuffer->ScreenBufferSize = GuiData->ActiveBuffer->OldScreenBufferSize;
144 
145  /* Restore the window styles */
147  GuiData->WndStyle);
149  GuiData->WndStyleEx);
150  SetWindowPos(GuiData->hWindow, NULL, 0, 0, 0, 0,
152  SWP_FRAMECHANGED /*| SWP_SHOWWINDOW*/);
153 
154 
155  /* Restore the window to its original position */
156  SetWindowPlacement(GuiData->hWindow, &GuiData->WndPl);
157 
159  GuiData->IsWndMax ? SC_MAXIMIZE : SC_RESTORE,
160  0);
161  // ShowWindowAsync(GuiData->hWindow, SW_RESTORE);
162 
163  /* Make it the foreground window */
164  SetForegroundWindow(GuiData->hWindow);
165 
166  /* Resize it */
167  // GuiConsoleResizeWindow(GuiData);
168 
169  // PostMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_RESTORE, 0);
170  // // ShowWindowAsync(GuiData->hWindow, SW_RESTORE);
171  }
172 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define TRUE
Definition: types.h:120
struct _WINDOWPLACEMENT WINDOWPLACEMENT
#define SC_RESTORE
Definition: winuser.h:2573
LONG_PTR WndStyle
Definition: conwnd.h:56
#define GWL_EXSTYLE
Definition: winuser.h:845
#define HWND_TOPMOST
Definition: winuser.h:1194
VOID LeaveFullScreen(PGUI_CONSOLE_DATA GuiData)
Definition: fullscreen.c:39
#define SWP_NOZORDER
Definition: winuser.h:1232
#define PCONSRV_CONSOLE
Definition: conio.h:27
#define WS_CLIPCHILDREN
Definition: pedump.c:619
BOOL WINAPI SetWindowPlacement(_In_ HWND hWnd, _In_ const WINDOWPLACEMENT *)
#define SetWindowLongPtr
Definition: treelist.c:70
#define SC_MAXIMIZE
Definition: winuser.h:2563
PCONSOLE_SCREEN_BUFFER ActiveBuffer
Definition: conwnd.h:91
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR WndStyleEx
Definition: conwnd.h:57
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
WINDOWPLACEMENT WndPl
Definition: conwnd.h:59
#define SWP_FRAMECHANGED
Definition: winuser.h:1225
BOOL EnterFullScreen(PGUI_CONSOLE_DATA GuiData)
Definition: fullscreen.c:21
#define SC_MINIMIZE
Definition: winuser.h:2561
#define SWP_NOSIZE
Definition: winuser.h:1230
#define GWL_STYLE
Definition: winuser.h:846
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WS_POPUP
Definition: pedump.c:616
BOOL WINAPI IsZoomed(_In_ HWND)
#define SWP_SHOWWINDOW
Definition: winuser.h:1233
CConsole Console
GUI_CONSOLE_INFO GuiInfo
Definition: conwnd.h:96
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define SWP_NOMOVE
Definition: winuser.h:1229
PCONSRV_CONSOLE Console
Definition: conwnd.h:90
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_SYSCOMMAND
Definition: winuser.h:1723

Referenced by GuiApplyUserSettings(), GuiConsoleInputThread(), GuiConsoleSwitchFullScreen(), and GuiSetDisplayMode().