Create win32_monitor_set_fullscreen

This commit is contained in:
twinaphex 2015-11-12 03:01:50 +01:00
parent d2006c43c1
commit 9a82d2a956
4 changed files with 23 additions and 18 deletions

View File

@ -478,6 +478,23 @@ void win32_monitor_init(void)
g_quit = false;
}
bool win32_monitor_set_fullscreen(unsigned width, unsigned height, unsigned refresh, char *dev_name)
{
#ifndef _XBOX
DEVMODE devmode;
memset(&devmode, 0, sizeof(devmode));
devmode.dmSize = sizeof(DEVMODE);
devmode.dmPelsWidth = width;
devmode.dmPelsHeight = height;
devmode.dmDisplayFrequency = refresh;
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
RARCH_LOG("[WGL]: Setting fullscreen to %ux%u @ %uHz on device %s.\n", width, height, refresh, dev_name);
return ChangeDisplaySettingsEx(dev_name, &devmode, NULL, CDS_FULLSCREEN, NULL) == DISP_CHANGE_SUCCESSFUL;
#endif
}
void win32_show_cursor(bool state)
{
#ifndef _XBOX

View File

@ -53,6 +53,9 @@ void create_gl_context(HWND hwnd);
void win32_monitor_init(void);
bool win32_monitor_set_fullscreen(unsigned width,
unsigned height, unsigned refresh, char *dev_name);
bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen);
bool win32_window_create(void *data, unsigned style,

View File

@ -649,7 +649,8 @@ static bool d3d_construct(d3d_video_t *d3d,
{
style = WS_POPUP | WS_VISIBLE;
if (!set_fullscreen(win_width, win_height, refresh, current_mon.szDevice))
if (!win32_monitor_set_fullscreen(win_width, win_height,
refresh, current_mon.szDevice))
{}
/* Display settings might have changed, get new coordinates. */

View File

@ -322,22 +322,6 @@ static bool gfx_ctx_wgl_init(void *data)
return true;
}
static bool set_fullscreen(unsigned width, unsigned height, unsigned refresh, char *dev_name)
{
DEVMODE devmode;
memset(&devmode, 0, sizeof(devmode));
devmode.dmSize = sizeof(DEVMODE);
devmode.dmPelsWidth = width;
devmode.dmPelsHeight = height;
devmode.dmDisplayFrequency = refresh;
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
RARCH_LOG("[WGL]: Setting fullscreen to %ux%u @ %uHz on device %s.\n", width, height, refresh, dev_name);
return ChangeDisplaySettingsEx(dev_name, &devmode, NULL, CDS_FULLSCREEN, NULL) == DISP_CHANGE_SUCCESSFUL;
}
static bool gfx_ctx_wgl_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
@ -382,7 +366,7 @@ static bool gfx_ctx_wgl_set_video_mode(void *data,
{
style = WS_POPUP | WS_VISIBLE;
if (!set_fullscreen(width, height, refresh, current_mon.szDevice))
if (!win32_monitor_set_fullscreen(width, height, refresh, current_mon.szDevice))
goto error;
/* Display settings might have changed, get new coordinates. */