ReactOS  0.4.15-dev-1070-ge1a01de
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
unsigned int ULONG
Definition: retypes.h:1
HFONT Font[FONT_MAXNO]
Definition: conwnd.h:85

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:1621
#define CDS_FULLSCREEN
Definition: winuser.h:183
#define ZeroMemory
Definition: winbase.h:1648
#define DM_PELSWIDTH
Definition: wingdi.h:1268
DWORD dmDisplayFixedOutput
Definition: wingdi.h:1636
#define DMDFO_CENTER
Definition: wingdi.h:1223
WORD dmSize
Definition: wingdi.h:1619
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
DWORD dmPelsWidth
Definition: wingdi.h:1647
#define DM_PELSHEIGHT
Definition: wingdi.h:1269
DWORD dmPelsHeight
Definition: wingdi.h:1648

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 }
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)

Referenced by GuiApplyUserSettings(), and GuiConsoleInputThread().

◆ 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
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:36
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 = ConioRectWidth(&GuiData->Selection.srSelection);
36  selHeight = ConioRectHeight(&GuiData->Selection.srSelection);
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:1499
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
CONSOLE_SELECTION_INFO Selection
Definition: conwnd.h:92
SMALL_RECT srSelection
Definition: wincon.h:210
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define FALSE
Definition: types.h:117
#define ConioRectWidth(Rect)
Definition: readwrite.c:24
#define CF_BITMAP
Definition: constants.h:397
HPALETTE WINAPI SelectPalette(_In_ HDC, _In_ HPALETTE, _In_ BOOL)
smooth NULL
Definition: ftsmooth.c:416
#define ConioRectHeight(Rect)
Definition: readwrite.c:22
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
SHORT Left
Definition: blue.h:32
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
SHORT Bottom
Definition: blue.h:35
SHORT Top
Definition: blue.h:33
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:34
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 306 of file text.c.

308 {
309  /*
310  * This function supposes that the system clipboard was opened.
311  */
312 
313  BOOL LineSelection = GuiData->LineSelection;
314 
315  DPRINT("Selection is (%d|%d) to (%d|%d) in %s mode\n",
316  GuiData->Selection.srSelection.Left,
317  GuiData->Selection.srSelection.Top,
318  GuiData->Selection.srSelection.Right,
319  GuiData->Selection.srSelection.Bottom,
320  (LineSelection ? "line" : "block"));
321 
322  if (!LineSelection)
323  {
325  }
326  else
327  {
328  COORD Begin, End;
329 
331  &GuiData->Selection.dwSelectionAnchor,
332  &GuiData->Selection.srSelection);
333 
334  CopyLines(Buffer, &Begin, &End);
335  }
336 }
static VOID CopyLines(PTEXTMODE_SCREEN_BUFFER Buffer, PCOORD Begin, PCOORD End)
Definition: text.c:150
CONSOLE_SELECTION_INFO Selection
Definition: conwnd.h:92
SMALL_RECT srSelection
Definition: wincon.h:210
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:32
SHORT Bottom
Definition: blue.h:35
SHORT Top
Definition: blue.h:33
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:1297
SHORT Right
Definition: blue.h:34

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 = (PCONSRV_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:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define ConioInitLongRect(Rect, Top, Left, Bottom, Right)
Definition: rect.h:12
struct _CONSRV_CONSOLE * PCONSRV_CONSOLE
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:36
CConsole Console
LONG bottom
Definition: windef.h:309
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 433 of file text.c.

437 {
438  PCONSRV_CONSOLE Console = (PCONSRV_CONSOLE)Buffer->Header.Console;
439  ULONG TopLine, BottomLine, LeftColumn, RightColumn;
440  ULONG Line, Char, Start;
441  PCHAR_INFO From;
442  PWCHAR To;
443  WORD LastAttribute, Attribute;
444  HFONT OldFont, NewFont;
445  BOOLEAN IsUnderline;
446 
447  // ASSERT(Console == GuiData->Console);
448 
449  ConioInitLongRect(rcFramebuffer, 0, 0, 0, 0);
450 
451  if (Buffer->Buffer == NULL)
452  return;
453 
455  return;
456 
457  ConioInitLongRect(rcFramebuffer,
458  Buffer->ViewOrigin.Y * GuiData->CharHeight + rcView->top,
459  Buffer->ViewOrigin.X * GuiData->CharWidth + rcView->left,
460  Buffer->ViewOrigin.Y * GuiData->CharHeight + rcView->bottom,
461  Buffer->ViewOrigin.X * GuiData->CharWidth + rcView->right);
462 
463  LeftColumn = rcFramebuffer->left / GuiData->CharWidth;
464  RightColumn = rcFramebuffer->right / GuiData->CharWidth;
465  if (RightColumn >= (ULONG)Buffer->ScreenBufferSize.X)
466  RightColumn = Buffer->ScreenBufferSize.X - 1;
467 
468  TopLine = rcFramebuffer->top / GuiData->CharHeight;
469  BottomLine = rcFramebuffer->bottom / GuiData->CharHeight;
470  if (BottomLine >= (ULONG)Buffer->ScreenBufferSize.Y)
471  BottomLine = Buffer->ScreenBufferSize.Y - 1;
472 
473  LastAttribute = ConioCoordToPointer(Buffer, LeftColumn, TopLine)->Attributes;
474 
477 
478  /* We use the underscore flag as a underline flag */
479  IsUnderline = !!(LastAttribute & COMMON_LVB_UNDERSCORE);
480  /* Select the new font */
481  NewFont = GuiData->Font[IsUnderline ? FONT_BOLD : FONT_NORMAL];
482  OldFont = SelectObject(GuiData->hMemDC, NewFont);
483 
484  if (Console->IsCJK)
485  {
486  for (Line = TopLine; Line <= BottomLine; Line++)
487  {
488  for (Char = LeftColumn; Char <= RightColumn; Char++)
489  {
490  From = ConioCoordToPointer(Buffer, Char, Line);
491  Attribute = From->Attributes;
494 
495  /* Change underline state if needed */
496  if (!!(Attribute & COMMON_LVB_UNDERSCORE) != IsUnderline)
497  {
498  IsUnderline = !!(Attribute & COMMON_LVB_UNDERSCORE);
499 
500  /* Select the new font */
501  NewFont = GuiData->Font[IsUnderline ? FONT_BOLD : FONT_NORMAL];
502  SelectObject(GuiData->hMemDC, NewFont);
503  }
504 
505  if (Attribute & COMMON_LVB_TRAILING_BYTE)
506  continue;
507 
508  TextOutW(GuiData->hMemDC,
509  Char * GuiData->CharWidth,
510  Line * GuiData->CharHeight,
511  &From->Char.UnicodeChar, 1);
512  }
513  }
514  }
515  else
516  {
517  for (Line = TopLine; Line <= BottomLine; Line++)
518  {
519  WCHAR LineBuffer[80]; // Buffer containing a part or all the line to be displayed
520  From = ConioCoordToPointer(Buffer, LeftColumn, Line); // Get the first code of the line
521  Start = LeftColumn;
522  To = LineBuffer;
523 
524  for (Char = LeftColumn; Char <= RightColumn; Char++)
525  {
526  /*
527  * We flush the buffer if the new attribute is different
528  * from the current one, or if the buffer is full.
529  */
530  if (From->Attributes != LastAttribute || (Char - Start == sizeof(LineBuffer) / sizeof(WCHAR)))
531  {
532  TextOutW(GuiData->hMemDC,
533  Start * GuiData->CharWidth,
534  Line * GuiData->CharHeight,
535  LineBuffer,
536  Char - Start);
537  Start = Char;
538  To = LineBuffer;
539  Attribute = From->Attributes;
540  if (Attribute != LastAttribute)
541  {
542  LastAttribute = Attribute;
545 
546  /* Change underline state if needed */
547  if (!!(LastAttribute & COMMON_LVB_UNDERSCORE) != IsUnderline)
548  {
549  IsUnderline = !!(LastAttribute & COMMON_LVB_UNDERSCORE);
550  /* Select the new font */
551  NewFont = GuiData->Font[IsUnderline ? FONT_BOLD : FONT_NORMAL];
552  SelectObject(GuiData->hMemDC, NewFont);
553  }
554  }
555  }
556 
557  *(To++) = (From++)->Char.UnicodeChar;
558  }
559 
560  TextOutW(GuiData->hMemDC,
561  Start * GuiData->CharWidth,
562  Line * GuiData->CharHeight,
563  LineBuffer,
564  RightColumn - Start + 1);
565  }
566  }
567 
568  /* Restore the old font */
569  SelectObject(GuiData->hMemDC, OldFont);
570 
571  /* Draw the caret */
572  GuiPaintCaret(Buffer, GuiData, TopLine, BottomLine, LeftColumn, RightColumn);
573 
575 }
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 VOID GuiPaintCaret(PTEXTMODE_SCREEN_BUFFER Buffer, PGUI_CONSOLE_DATA GuiData, ULONG TopLine, ULONG BottomLine, ULONG LeftColumn, ULONG RightColumn)
Definition: text.c:364
#define TRUE
Definition: types.h:120
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:143
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
uint16_t * PWCHAR
Definition: typedefs.h:56
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define COMMON_LVB_UNDERSCORE
Definition: wincon.h:54
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:977
UINT CharHeight
Definition: conwnd.h:87
#define FONT_NORMAL
Definition: conwnd.h:35
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#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:187
unsigned short WORD
Definition: ntddk_ex.h:93
Definition: partlist.h:33
Definition: ncftp.h:79
struct _CONSRV_CONSOLE * PCONSRV_CONSOLE
#define TextAttribFromAttrib(Attribute)
Definition: settings.h:72
BOOLEAN NTAPI ConDrvValidateConsoleUnsafe(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState, IN BOOLEAN LockConsole)
Definition: console.c:36
UINT CharWidth
Definition: conwnd.h:86
CConsole Console
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
unsigned int ULONG
Definition: retypes.h:1
LONG bottom
Definition: windef.h:309
HFONT Font[FONT_MAXNO]
Definition: conwnd.h:85
COLORREF WINAPI SetTextColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: text.c:888
#define COMMON_LVB_TRAILING_BYTE
Definition: wincon.h:49
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

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:115

Referenced by Paste().

◆ GuiPasteToTextModeBuffer()

VOID GuiPasteToTextModeBuffer ( PTEXTMODE_SCREEN_BUFFER  Buffer,
PGUI_CONSOLE_DATA  GuiData 
)

Definition at line 339 of file text.c.

341 {
342  /*
343  * This function supposes that the system clipboard was opened.
344  */
345 
346  PCONSRV_CONSOLE Console = (PCONSRV_CONSOLE)Buffer->Header.Console;
347 
348  HANDLE hData;
349  LPWSTR pszText;
350 
352  if (hData == NULL) return;
353 
354  pszText = GlobalLock(hData);
355  if (pszText == NULL) return;
356 
357  DPRINT("Got data <%S> from clipboard\n", pszText);
358  PasteText(Console, pszText, wcslen(pszText));
359 
360  GlobalUnlock(hData);
361 }
VOID PasteText(IN PCONSRV_CONSOLE Console, IN PWCHAR Buffer, IN SIZE_T cchSize)
Definition: text.c:238
#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
struct _CONSRV_CONSOLE * PCONSRV_CONSOLE
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 LF_FACESIZE
Definition: dimm.idl:39
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
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
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
BOOL GetFontCellSize(IN HDC hDC OPTIONAL, IN HFONT hFont, OUT PUINT Height, OUT PUINT Width)
Definition: font.c:119
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
HFONT Font[FONT_MAXNO]
Definition: conwnd.h:85
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 238 of file text.c.

242 {
243  USHORT VkKey; // MAKEWORD(low = vkey_code, high = shift_state);
244  INPUT_RECORD er;
245  WCHAR CurChar = 0;
246 
247  /* Do nothing if we have nothing to paste */
248  if (!Buffer || (cchSize <= 0))
249  return;
250 
251  er.EventType = KEY_EVENT;
252  er.Event.KeyEvent.wRepeatCount = 1;
253  while (cchSize--)
254  {
255  /* \r or \n characters. Go to the line only if we get "\r\n" sequence. */
256  if (CurChar == L'\r' && *Buffer == L'\n')
257  {
258  ++Buffer;
259  continue;
260  }
261  CurChar = *Buffer++;
262 
263  /* Get the key code (+ shift state) corresponding to the character */
264  VkKey = VkKeyScanW(CurChar);
265  if (VkKey == 0xFFFF)
266  {
267  DPRINT1("FIXME: TODO: VkKeyScanW failed - Should simulate the key!\n");
268  /*
269  * We don't really need the scan/key code because we actually only
270  * use the UnicodeChar for output purposes. It may pose few problems
271  * later on but it's not of big importance. One trick would be to
272  * convert the character to OEM / multibyte and use MapVirtualKey()
273  * on each byte (simulating an Alt-0xxx OEM keyboard press).
274  */
275  }
276 
277  /* Pressing some control keys */
278 
279  /* Pressing the character key, with the control keys maintained pressed */
281  er.Event.KeyEvent.wVirtualKeyCode = LOBYTE(VkKey);
283  er.Event.KeyEvent.uChar.UnicodeChar = CurChar;
285  if (HIBYTE(VkKey) & 1)
287  if (HIBYTE(VkKey) & 2)
288  er.Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED; // RIGHT_CTRL_PRESSED;
289  if (HIBYTE(VkKey) & 4)
290  er.Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED; // RIGHT_ALT_PRESSED;
291 
293 
294  /* Up all the character and control keys */
297  }
298 }
WCHAR UnicodeChar
Definition: wincon.h:245
union _KEY_EVENT_RECORD::@3234 uChar
WORD wVirtualScanCode
Definition: wincon.h:243
#define LOBYTE(W)
Definition: jmemdos.c:487
#define TRUE
Definition: types.h:120
DWORD dwControlKeyState
Definition: wincon.h:248
#define HIBYTE(W)
Definition: jmemdos.c:486
#define SHIFT_PRESSED
Definition: wincon.h:141
WORD wVirtualKeyCode
Definition: wincon.h:242
WORD wRepeatCount
Definition: wincon.h:241
#define FALSE
Definition: types.h:117
#define KEY_EVENT
Definition: wincon.h:128
Definition: bufpool.h:45
UINT WINAPI MapVirtualKeyW(_In_ UINT, _In_ UINT)
#define LEFT_ALT_PRESSED
Definition: wincon.h:138
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAPVK_VK_TO_VSC
Definition: winuser.h:2330
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
#define LEFT_CTRL_PRESSED
Definition: wincon.h:140
static const WCHAR L[]
Definition: oid.c:1250
union _INPUT_RECORD::@3235 Event
unsigned short USHORT
Definition: pedump.c:61
CConsole Console
WORD EventType
Definition: wincon.h:276
#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:201

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:193
SHORT Left
Definition: wincon.h:191
PCONSOLE_SCREEN_BUFFER ActiveBuffer
Definition: conwnd.h:91
Definition: bufpool.h:45
SHORT Bottom
Definition: wincon.h:194
SHORT Top
Definition: wincon.h:192
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
struct _WINDOWPLACEMENT WINDOWPLACEMENT
#define SC_RESTORE
Definition: winuser.h:2573
#define TRUE
Definition: types.h:120
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 WS_CLIPCHILDREN
Definition: pedump.c:619
BOOL WINAPI SetWindowPlacement(_In_ HWND hWnd, _In_ const WINDOWPLACEMENT *)
#define SetWindowLongPtr
Definition: treelist.c:70
#define FALSE
Definition: types.h:117
#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().