mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
win32: implement screen orientation support
This commit is contained in:
parent
46c557f3a5
commit
99f4203abf
@ -80,6 +80,11 @@
|
|||||||
#define DragQueryFileR DragQueryFileW
|
#define DragQueryFileR DragQueryFileW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* For some reason this is missing from mingw winuser.h */
|
||||||
|
#ifndef EDS_ROTATEDMODE
|
||||||
|
#define EDS_ROTATEDMODE 4
|
||||||
|
#endif
|
||||||
|
|
||||||
const GUID GUID_DEVINTERFACE_HID = { 0x4d1e55b2, 0xf16f, 0x11Cf, { 0x88, 0xcb, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } };
|
const GUID GUID_DEVINTERFACE_HID = { 0x4d1e55b2, 0xf16f, 0x11Cf, { 0x88, 0xcb, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } };
|
||||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x501
|
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x501
|
||||||
static HDEVNOTIFY notification_handler;
|
static HDEVNOTIFY notification_handler;
|
||||||
@ -1568,10 +1573,15 @@ bool win32_get_video_output(DEVMODE *dm, int mode, size_t len)
|
|||||||
{
|
{
|
||||||
memset(dm, 0, len);
|
memset(dm, 0, len);
|
||||||
dm->dmSize = len;
|
dm->dmSize = len;
|
||||||
|
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500 /* 2K */
|
||||||
|
if (EnumDisplaySettingsEx(NULL,
|
||||||
|
(mode == -1) ? ENUM_CURRENT_SETTINGS : mode, dm, EDS_ROTATEDMODE) == 0)
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
if (EnumDisplaySettings(NULL,
|
if (EnumDisplaySettings(NULL,
|
||||||
(mode == -1) ? ENUM_CURRENT_SETTINGS : mode, dm) == 0)
|
(mode == -1) ? ENUM_CURRENT_SETTINGS : mode, dm) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,10 @@
|
|||||||
#undef COBJMACROS
|
#undef COBJMACROS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _WIN32_WINNT
|
||||||
|
#define _WIN32_WINNT 0x0601 /* Windows 7 */
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../video_display_server.h"
|
#include "../video_display_server.h"
|
||||||
#include "../common/win32_common.h"
|
#include "../common/win32_common.h"
|
||||||
#include "../../verbosity.h"
|
#include "../../verbosity.h"
|
||||||
@ -346,6 +350,78 @@ void *win32_display_server_get_resolution_list(void *data,
|
|||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _WIN32_WINNT >= 0x0500
|
||||||
|
void win32_display_server_set_screen_orientation(enum rotation rotation)
|
||||||
|
{
|
||||||
|
DEVMODE dm = {0};
|
||||||
|
|
||||||
|
win32_get_video_output(&dm, -1, sizeof(dm));
|
||||||
|
|
||||||
|
switch (rotation)
|
||||||
|
{
|
||||||
|
case ORIENTATION_NORMAL:
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
int width = dm.dmPelsWidth;
|
||||||
|
|
||||||
|
if ((dm.dmDisplayOrientation == DMDO_90 || dm.dmDisplayOrientation == DMDO_270) && width != dm.dmPelsHeight)
|
||||||
|
{
|
||||||
|
/* device is changing orientations, swap the aspect */
|
||||||
|
dm.dmPelsWidth = dm.dmPelsHeight;
|
||||||
|
dm.dmPelsHeight = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
dm.dmDisplayOrientation = DMDO_DEFAULT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ORIENTATION_VERTICAL:
|
||||||
|
{
|
||||||
|
int width = dm.dmPelsWidth;
|
||||||
|
|
||||||
|
if ((dm.dmDisplayOrientation == DMDO_DEFAULT || dm.dmDisplayOrientation == DMDO_180) && width != dm.dmPelsHeight)
|
||||||
|
{
|
||||||
|
/* device is changing orientations, swap the aspect */
|
||||||
|
dm.dmPelsWidth = dm.dmPelsHeight;
|
||||||
|
dm.dmPelsHeight = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
dm.dmDisplayOrientation = DMDO_270;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ORIENTATION_FLIPPED:
|
||||||
|
{
|
||||||
|
int width = dm.dmPelsWidth;
|
||||||
|
|
||||||
|
if ((dm.dmDisplayOrientation == DMDO_90 || dm.dmDisplayOrientation == DMDO_270) && width != dm.dmPelsHeight)
|
||||||
|
{
|
||||||
|
/* device is changing orientations, swap the aspect */
|
||||||
|
dm.dmPelsWidth = dm.dmPelsHeight;
|
||||||
|
dm.dmPelsHeight = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
dm.dmDisplayOrientation = DMDO_180;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ORIENTATION_FLIPPED_ROTATED:
|
||||||
|
{
|
||||||
|
int width = dm.dmPelsWidth;
|
||||||
|
|
||||||
|
if ((dm.dmDisplayOrientation == DMDO_DEFAULT || dm.dmDisplayOrientation == DMDO_180) && width != dm.dmPelsHeight)
|
||||||
|
{
|
||||||
|
/* device is changing orientations, swap the aspect */
|
||||||
|
dm.dmPelsWidth = dm.dmPelsHeight;
|
||||||
|
dm.dmPelsHeight = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
dm.dmDisplayOrientation = DMDO_90;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
win32_change_display_settings(NULL, &dm, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const video_display_server_t dispserv_win32 = {
|
const video_display_server_t dispserv_win32 = {
|
||||||
win32_display_server_init,
|
win32_display_server_init,
|
||||||
win32_display_server_destroy,
|
win32_display_server_destroy,
|
||||||
@ -355,6 +431,10 @@ const video_display_server_t dispserv_win32 = {
|
|||||||
win32_display_server_set_resolution,
|
win32_display_server_set_resolution,
|
||||||
win32_display_server_get_resolution_list,
|
win32_display_server_get_resolution_list,
|
||||||
NULL, /* get_output_options */
|
NULL, /* get_output_options */
|
||||||
NULL, /* set_screen_orientation */
|
#if _WIN32_WINNT >= 0x0500
|
||||||
|
win32_display_server_set_screen_orientation,
|
||||||
|
#else
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
"win32"
|
"win32"
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user