ReactOS 0.4.15-dev-8119-g4fb2fdb
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 (_Inout_ PGUI_CONSOLE_DATA GuiData, _In_reads_or_z_(LF_FACESIZE) PCWSTR FaceName, _In_ ULONG FontWeight, _In_ ULONG FontFamily, _In_ COORD FontSize, _In_opt_ UINT CodePage, _In_ BOOL UseDefaultFallback)
 
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 481 of file conwnd.c.

482{
483 ULONG i;
484 for (i = 0; i < ARRAYSIZE(GuiData->Font); ++i)
485 {
486 if (GuiData->Font[i] != NULL) DeleteObject(GuiData->Font[i]);
487 GuiData->Font[i] = NULL;
488 }
489}
#define NULL
Definition: types.h:112
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
pKey DeleteObject()
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
HFONT Font[FONT_MAXNO]
Definition: conwnd.h:86
uint32_t ULONG
Definition: typedefs.h:59

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}
DWORD dmDisplayFixedOutput
Definition: wingdi.h:1637
DWORD dmFields
Definition: wingdi.h:1622
DWORD dmPelsWidth
Definition: wingdi.h:1648
DWORD dmPelsHeight
Definition: wingdi.h:1649
WORD dmSize
Definition: wingdi.h:1620
LONG WINAPI ChangeDisplaySettingsW(LPDEVMODEW lpDevMode, DWORD dwflags)
Definition: display.c:612
#define ZeroMemory
Definition: winbase.h:1712
#define DM_PELSWIDTH
Definition: wingdi.h:1269
#define DMDFO_CENTER
Definition: wingdi.h:1224
#define DM_PELSHEIGHT
Definition: wingdi.h:1270
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
#define CDS_FULLSCREEN
Definition: winuser.h:183

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
#define ASSERT(a)
Definition: mode.c:44
#define TEXTMODE_BUFFER
Definition: pccons.c:21
#define GetType(This)
Definition: conio.h:54

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}
GUI_CONSOLE_INFO GuiInfo
Definition: conwnd.h:97
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define SWP_NOACTIVATE
Definition: winuser.h:1242
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOSIZE
Definition: winuser.h:1245
#define SWP_NOZORDER
Definition: winuser.h:1247

Referenced by GuiApplyUserSettings(), and GuiConsoleInputThread().

◆ GuiConsoleSwitchFullScreen()

VOID GuiConsoleSwitchFullScreen ( PGUI_CONSOLE_DATA  GuiData)

Definition at line 175 of file fullscreen.c.

176{
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}
CConsole Console
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID SwitchFullScreen(PGUI_CONSOLE_DATA GuiData, BOOL FullScreen)
Definition: fullscreen.c:49
#define DPRINT
Definition: sndvol32.h:73
PCONSRV_CONSOLE Console
Definition: conwnd.h:91
BOOLEAN NTAPI ConDrvValidateConsoleUnsafe(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState, IN BOOLEAN LockConsole)
Definition: console.c:36
@ CONSOLE_RUNNING
Definition: conio.h:283
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,
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 */
99
100 /* Restore the palette and the old bitmap */
101 if (hPalette) SelectPalette(hMemDC, hPaletteOld, FALSE);
102 SelectObject(hMemDC, hBitmapOld);
103
105 SetClipboardData(CF_BITMAP, hBitmapTarget);
106
107 DeleteDC(hMemDC);
108}
#define CF_BITMAP
Definition: constants.h:397
#define FALSE
Definition: types.h:117
#define ConioRectWidth(Rect)
Definition: readwrite.c:24
#define ConioRectHeight(Rect)
Definition: readwrite.c:22
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
NTSTATUS NTAPI NtReleaseMutant(IN HANDLE MutantHandle, IN PLONG PreviousCount OPTIONAL)
Definition: mutant.c:296
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)
SMALL_RECT srSelection
Definition: wincon.h:210
CONSOLE_SELECTION_INFO Selection
Definition: conwnd.h:93
HPALETTE hSysPalette
Definition: conwnd.h:65
SHORT Top
Definition: tui.c:25
SHORT Right
Definition: tui.c:26
SHORT Left
Definition: tui.c:24
SHORT Bottom
Definition: tui.c:27
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)
HPALETTE WINAPI SelectPalette(_In_ HDC, _In_ HPALETTE, _In_ BOOL)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL WINAPI DeleteDC(_In_ HDC)
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)
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190

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,
320 (LineSelection ? "line" : "block"));
321
322 if (!LineSelection)
323 {
325 }
326 else
327 {
328 COORD Begin, End;
329
332 &GuiData->Selection.srSelection);
333
334 CopyLines(Buffer, &Begin, &End);
335 }
336}
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:1301
Definition: bl.h:1338
BOOL LineSelection
Definition: conwnd.h:95
static VOID CopyBlock(PTEXTMODE_SCREEN_BUFFER Buffer, PSMALL_RECT Selection)
Definition: text.c:40
static VOID CopyLines(PTEXTMODE_SCREEN_BUFFER Buffer, PCOORD Begin, PCOORD End)
Definition: text.c:150
VOID GetSelectionBeginEnd(PCOORD Begin, PCOORD End, PCOORD SelectionAnchor, PSMALL_RECT SmallRect)
Definition: conwnd.c:792

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{
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}
struct _CONSRV_CONSOLE * PCONSRV_CONSOLE
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define ConioInitLongRect(Rect, Top, Left, Bottom, Right)
Definition: rect.h:12

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{
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}
unsigned char BOOLEAN
#define FONT_NORMAL
Definition: conwnd.h:35
#define FONT_BOLD
Definition: conwnd.h:36
unsigned short WORD
Definition: ntddk_ex.h:93
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
Definition: ncftp.h:79
WORD Attributes
Definition: wincon.h:187
UINT CharWidth
Definition: conwnd.h:87
UINT CharHeight
Definition: conwnd.h:88
uint16_t * PWCHAR
Definition: typedefs.h:56
@ Start
Definition: partlist.h:33
#define TextAttribFromAttrib(Attribute)
Definition: settings.h:72
#define BkgdAttribFromAttrib(Attribute)
Definition: settings.h:73
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
Definition: text.c:143
static VOID GuiPaintCaret(PTEXTMODE_SCREEN_BUFFER Buffer, PGUI_CONSOLE_DATA GuiData, ULONG TopLine, ULONG BottomLine, ULONG LeftColumn, ULONG RightColumn)
Definition: text.c:364
static COLORREF PaletteRGBFromAttrib(PCONSRV_CONSOLE Console, WORD Attribute)
Definition: text.c:28
#define COMMON_LVB_TRAILING_BYTE
Definition: wincon.h:49
#define COMMON_LVB_UNDERSCORE
Definition: wincon.h:54
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
__wchar_t WCHAR
Definition: xmlstorage.h:180

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

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
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}
#define CF_UNICODETEXT
Definition: constants.h:408
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
VOID PasteText(IN PCONSRV_CONSOLE Console, IN PWCHAR Buffer, IN SIZE_T cchSize)
Definition: text.c:238
HANDLE WINAPI GetClipboardData(_In_ UINT)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by Paste().

◆ InitFonts()

BOOL InitFonts ( _Inout_ PGUI_CONSOLE_DATA  GuiData,
_In_reads_or_z_(LF_FACESIZE) PCWSTR  FaceName,
_In_ ULONG  FontWeight,
_In_ ULONG  FontFamily,
_In_ COORD  FontSize,
_In_opt_ UINT  CodePage,
_In_ BOOL  UseDefaultFallback 
)

Definition at line 521 of file conwnd.c.

530{
531 HDC hDC;
532 HFONT hFont;
533 FONT_DATA FontData;
534 UINT OldCharWidth = GuiData->CharWidth;
535 UINT OldCharHeight = GuiData->CharHeight;
536 COORD OldFontSize = GuiData->GuiInfo.FontSize;
537 WCHAR NewFaceName[LF_FACESIZE];
538
539 /* Default to current code page if none has been provided */
540 if (!CodePage)
541 CodePage = GuiData->Console->OutputCodePage;
542
543 /*
544 * Initialize a new NORMAL font.
545 */
546
547 /* Copy the requested face name into the local buffer.
548 * It will be modified in output by CreateConsoleFontEx()
549 * to hold a possible fallback font face name. */
550 StringCchCopyNW(NewFaceName, ARRAYSIZE(NewFaceName),
551 FaceName, LF_FACESIZE);
552
553 /* NOTE: FontSize is always in cell height/width units (pixels) */
554 hFont = CreateConsoleFontEx((LONG)(ULONG)FontSize.Y,
555 (LONG)(ULONG)FontSize.X,
556 NewFaceName,
557 FontWeight,
559 CodePage,
560 UseDefaultFallback,
561 &FontData);
562 if (!hFont)
563 {
564 DPRINT1("InitFonts: CreateConsoleFontEx('%S') failed\n", NewFaceName);
565 return FALSE;
566 }
567
568 /* Retrieve its character cell size */
569 hDC = GetDC(GuiData->hWindow);
570 if (!GetFontCellSize(hDC, hFont, &GuiData->CharHeight, &GuiData->CharWidth))
571 {
572 DPRINT1("InitFonts: GetFontCellSize failed\n");
573 ReleaseDC(GuiData->hWindow, hDC);
575 return FALSE;
576 }
577 ReleaseDC(GuiData->hWindow, hDC);
578
579 /*
580 * Initialization succeeded.
581 */
582 // Delete all the old fonts first.
583 DeleteFonts(GuiData);
584 GuiData->Font[FONT_NORMAL] = hFont;
585
586 /*
587 * Now build the optional fonts (bold, underlined, mixed).
588 * Do not error in case they fail to be created.
589 */
590 GuiData->Font[FONT_BOLD] =
591 CreateDerivedFont(GuiData->Font[FONT_NORMAL],
592 max(FW_BOLD, FontData.Weight),
593 FALSE,
594 FALSE);
595 GuiData->Font[FONT_UNDERLINE] =
596 CreateDerivedFont(GuiData->Font[FONT_NORMAL],
597 FontData.Weight,
598 TRUE,
599 FALSE);
600 GuiData->Font[FONT_BOLD | FONT_UNDERLINE] =
601 CreateDerivedFont(GuiData->Font[FONT_NORMAL],
602 max(FW_BOLD, FontData.Weight),
603 TRUE,
604 FALSE);
605
606 /*
607 * Save the new font characteristics.
608 */
609 StringCchCopyNW(GuiData->GuiInfo.FaceName,
610 ARRAYSIZE(GuiData->GuiInfo.FaceName),
611 NewFaceName, ARRAYSIZE(NewFaceName));
612 GuiData->GuiInfo.FontWeight = FontData.Weight;
613 GuiData->GuiInfo.FontFamily = FontData.Family;
614 GuiData->GuiInfo.FontSize = FontData.Size;
615
616 /* Resize the terminal, in case the new font has a different size */
617 if ((OldCharWidth != GuiData->CharWidth) ||
618 (OldCharHeight != GuiData->CharHeight) ||
619 (OldFontSize.X != FontData.Size.X ||
620 OldFontSize.Y != FontData.Size.Y))
621 {
622 TermResizeTerminal(GuiData->Console);
623 }
624
625 return TRUE;
626}
static HDC hDC
Definition: 3dtext.c:33
#define DPRINT1
Definition: precomp.h:8
HFONT hFont
Definition: main.c:53
static HFONT CreateDerivedFont(HFONT OrgFont, ULONG FontWeight, BOOLEAN bUnderline, BOOLEAN bStrikeOut)
Definition: conwnd.c:492
VOID DeleteFonts(PGUI_CONSOLE_DATA GuiData)
Definition: conwnd.c:481
#define FONT_UNDERLINE
Definition: conwnd.h:37
#define LF_FACESIZE
Definition: dimm.idl:39
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
ULONG Y
Definition: bl.h:1340
ULONG X
Definition: bl.h:1339
COORD Size
Definition: font.h:57
ULONG Family
Definition: font.h:56
ULONG Weight
Definition: font.h:55
#define max(a, b)
Definition: svc.c:63
#define TermResizeTerminal(Console)
Definition: term.h:28
HFONT CreateConsoleFontEx(_In_ LONG Height, _In_opt_ LONG Width, _Inout_updates_z_(LF_FACESIZE) PWSTR FaceName, _In_ ULONG FontWeight, _In_ ULONG FontFamily, _In_ UINT CodePage, _In_ BOOL UseDefaultFallback, _Out_ PFONT_DATA FontData)
Validates and creates a suitable console font based on the font characteristics given in input.
Definition: font.c:505
#define FW_BOLD
Definition: wingdi.h:378
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by GuiApplyUserSettings(), GuiSetCodePage(), and OnNcCreate().

◆ LeaveFullScreen()

VOID LeaveFullScreen ( PGUI_CONSOLE_DATA  GuiData)

Definition at line 39 of file fullscreen.c.

40{
42}
#define CDS_RESET
Definition: winuser.h:187

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;
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 */
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}
NTSTATUS ConioProcessInputEvent(PCONSRV_CONSOLE Console, PINPUT_RECORD InputEvent)
Definition: coninput.c:201
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
union _INPUT_RECORD::@3297 Event
WORD EventType
Definition: wincon.h:273
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
WORD wVirtualScanCode
Definition: wincon.h:243
DWORD dwControlKeyState
Definition: wincon.h:248
WORD wVirtualKeyCode
Definition: wincon.h:242
WORD wRepeatCount
Definition: wincon.h:241
union _KEY_EVENT_RECORD::@3296 uChar
WCHAR UnicodeChar
Definition: wincon.h:245
#define LEFT_CTRL_PRESSED
Definition: wincon.h:140
#define SHIFT_PRESSED
Definition: wincon.h:141
#define KEY_EVENT
Definition: wincon.h:128
#define LEFT_ALT_PRESSED
Definition: wincon.h:138
UINT WINAPI MapVirtualKeyW(_In_ UINT, _In_ UINT)
#define MAPVK_VK_TO_VSC
Definition: winuser.h:2355
SHORT WINAPI VkKeyScanW(_In_ WCHAR)

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}
FORCEINLINE VOID GetScreenBufferSizeUnits(IN PCONSOLE_SCREEN_BUFFER Buffer, IN PGUI_CONSOLE_DATA GuiData, OUT PUINT WidthUnit, OUT PUINT HeightUnit)
Definition: guiterm.h:22
PCONSOLE_SCREEN_BUFFER ActiveBuffer
Definition: conwnd.h:92

Referenced by CreateSelectionRgn(), and DrawRegion().

◆ SwitchFullScreen()

VOID SwitchFullScreen ( PGUI_CONSOLE_DATA  GuiData,
BOOL  FullScreen 
)

Definition at line 49 of file fullscreen.c.

50{
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 */
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 */
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}
BOOL EnterFullScreen(PGUI_CONSOLE_DATA GuiData)
Definition: fullscreen.c:21
VOID LeaveFullScreen(PGUI_CONSOLE_DATA GuiData)
Definition: fullscreen.c:39
#define WS_POPUP
Definition: pedump.c:616
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG_PTR WndStyleEx
Definition: conwnd.h:58
WINDOWPLACEMENT WndPl
Definition: conwnd.h:60
LONG_PTR WndStyle
Definition: conwnd.h:57
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define WM_SYSCOMMAND
Definition: winuser.h:1741
#define SWP_FRAMECHANGED
Definition: winuser.h:1240
#define HWND_TOPMOST
Definition: winuser.h:1208
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define SWP_NOMOVE
Definition: winuser.h:1244
BOOL WINAPI SetForegroundWindow(_In_ HWND)
BOOL WINAPI IsZoomed(_In_ HWND)
#define SC_MINIMIZE
Definition: winuser.h:2586
#define SWP_SHOWWINDOW
Definition: winuser.h:1248
struct _WINDOWPLACEMENT WINDOWPLACEMENT
#define GWL_STYLE
Definition: winuser.h:852
BOOL WINAPI SetWindowPlacement(_In_ HWND hWnd, _In_ const WINDOWPLACEMENT *)
#define SC_RESTORE
Definition: winuser.h:2598
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SC_MAXIMIZE
Definition: winuser.h:2588
#define GWL_EXSTYLE
Definition: winuser.h:851

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