ReactOS 0.4.15-dev-8227-g32d615f
fullscreen.c File Reference
#include <consrv.h>
#include <debug.h>
#include "guiterm.h"
Include dependency graph for fullscreen.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

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)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file fullscreen.c.

Function Documentation

◆ 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().

◆ 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
GUI_CONSOLE_INFO GuiInfo
Definition: conwnd.h:97
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().

◆ LeaveFullScreen()

VOID LeaveFullScreen ( PGUI_CONSOLE_DATA  GuiData)

Definition at line 39 of file fullscreen.c.

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

Referenced by OnActivate(), and SwitchFullScreen().

◆ 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}
#define FALSE
Definition: types.h:117
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
PCONSOLE_SCREEN_BUFFER ActiveBuffer
Definition: conwnd.h:92
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
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1244
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define SWP_NOSIZE
Definition: winuser.h:1245
BOOL WINAPI IsZoomed(_In_ HWND)
#define SC_MINIMIZE
Definition: winuser.h:2586
#define SWP_SHOWWINDOW
Definition: winuser.h:1248
#define SWP_NOZORDER
Definition: winuser.h:1247
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().