mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 17:43:02 +00:00
Fix screen resolution always tied to the main monitor on win32 platforms. (#15897)
This commit is contained in:
parent
d0a69ffd71
commit
f4f43d9501
@ -2680,16 +2680,20 @@ void win32_get_video_output_next(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500 /* 2K */
|
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500 /* 2K */
|
||||||
#define WIN32_GET_VIDEO_OUTPUT(iModeNum, dm) EnumDisplaySettingsEx(NULL, iModeNum, dm, EDS_ROTATEDMODE)
|
#define WIN32_GET_VIDEO_OUTPUT(devName, iModeNum, dm) EnumDisplaySettingsEx(devName, iModeNum, dm, EDS_ROTATEDMODE)
|
||||||
#else
|
#else
|
||||||
#define WIN32_GET_VIDEO_OUTPUT(iModeNum, dm) EnumDisplaySettings(NULL, iModeNum, dm)
|
#define WIN32_GET_VIDEO_OUTPUT(devName, iModeNum, dm) EnumDisplaySettings(devName, iModeNum, dm)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool win32_get_video_output(DEVMODE *dm, int mode, size_t len)
|
bool win32_get_video_output(DEVMODE *dm, int mode, size_t len)
|
||||||
{
|
{
|
||||||
|
MONITORINFOEX current_mon;
|
||||||
|
HMONITOR hm_to_use = NULL;
|
||||||
|
unsigned mon_id = 0;
|
||||||
memset(dm, 0, len);
|
memset(dm, 0, len);
|
||||||
dm->dmSize = len;
|
dm->dmSize = len;
|
||||||
if (WIN32_GET_VIDEO_OUTPUT((mode == -1)
|
win32_monitor_info(¤t_mon, &hm_to_use, &mon_id);
|
||||||
|
if (WIN32_GET_VIDEO_OUTPUT(¤t_mon.szDevice, (mode == -1)
|
||||||
? ENUM_CURRENT_SETTINGS
|
? ENUM_CURRENT_SETTINGS
|
||||||
: (DWORD)mode,
|
: (DWORD)mode,
|
||||||
dm) == 0)
|
dm) == 0)
|
||||||
|
@ -228,6 +228,9 @@ static bool win32_display_server_set_window_decorations(void *data, bool on)
|
|||||||
static bool win32_display_server_set_resolution(void *data,
|
static bool win32_display_server_set_resolution(void *data,
|
||||||
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index, int xoffset, int padjust)
|
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index, int xoffset, int padjust)
|
||||||
{
|
{
|
||||||
|
MONITORINFOEX current_mon;
|
||||||
|
HMONITOR hm_to_use = NULL;
|
||||||
|
unsigned mon_id = 0;
|
||||||
DEVMODE dm = {0};
|
DEVMODE dm = {0};
|
||||||
LONG res = 0;
|
LONG res = 0;
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
@ -288,12 +291,13 @@ static bool win32_display_server_set_resolution(void *data,
|
|||||||
dm.dmFields |= DM_DISPLAYORIENTATION;
|
dm.dmFields |= DM_DISPLAYORIENTATION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
res = win32_change_display_settings(NULL, &dm, CDS_TEST);
|
win32_monitor_info(¤t_mon, &hm_to_use, &mon_id);
|
||||||
|
res = win32_change_display_settings(¤t_mon.szDevice, &dm, CDS_TEST);
|
||||||
|
|
||||||
switch (res)
|
switch (res)
|
||||||
{
|
{
|
||||||
case DISP_CHANGE_SUCCESSFUL:
|
case DISP_CHANGE_SUCCESSFUL:
|
||||||
res = win32_change_display_settings(NULL, &dm, 0);
|
res = win32_change_display_settings(¤t_mon.szDevice, &dm, 0);
|
||||||
switch (res)
|
switch (res)
|
||||||
{
|
{
|
||||||
case DISP_CHANGE_SUCCESSFUL:
|
case DISP_CHANGE_SUCCESSFUL:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user