Started to add support for multi-monitor.
This commit is contained in:
parent
4eee7a54ad
commit
8c584c29dd
@ -615,21 +615,29 @@ static BOOL sdl_create_windows(SdlContext* sdl)
|
||||
BOOL rc = FALSE;
|
||||
|
||||
// TODO: Multimonitor setup
|
||||
const size_t windowCount = sdl->context()->settings->UseMultimon ? SDL_GetNumVideoDisplays() : 1;
|
||||
|
||||
for (size_t x = 0; x < windowCount; x++)
|
||||
|
||||
UINT32 windowCount = freerdp_settings_get_uint32(sdl->context()->settings, FreeRDP_MonitorCount);
|
||||
|
||||
for (UINT32 x = 0; x < windowCount; x++)
|
||||
{
|
||||
SDL_Rect displaySize;
|
||||
SDL_GetDisplayBounds(x,&displaySize);
|
||||
const UINT32 w = displaySize.w;
|
||||
const UINT32 h = displaySize.h;
|
||||
auto monitor = static_cast<rdpMonitor*>(
|
||||
freerdp_settings_get_pointer_array_writable(sdl->context()->settings, FreeRDP_MonitorDefArray, x));
|
||||
|
||||
Uint32 w = monitor->width;
|
||||
Uint32 h = monitor->height;
|
||||
if (!(sdl->context()->settings->UseMultimon || sdl->context()->settings->Fullscreen) ){
|
||||
w = sdl->context()->settings->DesktopWidth;
|
||||
h = sdl->context()->settings->DesktopHeight;
|
||||
}
|
||||
|
||||
|
||||
sdl_window_t window = {};
|
||||
Uint32 flags = SDL_WINDOW_SHOWN;
|
||||
Uint32 startupX = SDL_WINDOWPOS_UNDEFINED;
|
||||
Uint32 startupY = SDL_WINDOWPOS_UNDEFINED;
|
||||
|
||||
if (sdl->highDpi)
|
||||
if (monitor->highDpi)
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 1)
|
||||
flags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
||||
@ -645,15 +653,19 @@ static BOOL sdl_create_windows(SdlContext* sdl)
|
||||
if (sdl->context()->settings->UseMultimon)
|
||||
{
|
||||
flags |= SDL_WINDOW_BORDERLESS;
|
||||
startupX = displaySize.x;
|
||||
startupY = displaySize.y;
|
||||
startupX = monitor->x;
|
||||
startupY = monitor->y;
|
||||
window.offset_x = 0-startupX;
|
||||
window.offset_y = 0-startupY;
|
||||
}else{
|
||||
window.offset_x = 0;
|
||||
window.offset_y = 0;
|
||||
}
|
||||
|
||||
|
||||
window.window = SDL_CreateWindow(title, startupX, startupY,
|
||||
static_cast<int>(w), static_cast<int>(h), flags);
|
||||
window.offset_x = 0-startupX;
|
||||
window.offset_y = 0-startupY;
|
||||
|
||||
|
||||
if (!window.window)
|
||||
goto fail;
|
||||
|
@ -63,7 +63,7 @@ class SdlContext
|
||||
bool resizeable = false;
|
||||
bool grab_mouse = false;
|
||||
bool grab_kbd = false;
|
||||
bool highDpi = false;
|
||||
//bool highDpi = false;
|
||||
|
||||
std::vector<sdl_window_t> windows;
|
||||
|
||||
|
@ -194,9 +194,9 @@ static BOOL sdl_apply_display_properties(SdlContext* sdl)
|
||||
SDL_GetDisplayBounds(*id, &rect);
|
||||
SDL_GetDisplayDPI(*id, nullptr, &hdpi, &vdpi);
|
||||
|
||||
sdl->highDpi = hdpi > 100;
|
||||
bool highDpi = hdpi > 100;
|
||||
|
||||
if (sdl->highDpi)
|
||||
if (highDpi)
|
||||
{
|
||||
// HighDPI is problematic with SDL: We can only get native resolution by creating a
|
||||
// window. Work around this by checking the supported resolutions (and keep maximum)
|
||||
@ -244,6 +244,7 @@ static BOOL sdl_apply_display_properties(SdlContext* sdl)
|
||||
monitor->y = rect.y;
|
||||
monitor->width = rect.w;
|
||||
monitor->height = rect.h;
|
||||
monitor->highDpi = highDpi;
|
||||
monitor->is_primary = (rect.x == 0) && (rect.y == 0);
|
||||
monitor->attributes.desktopScaleFactor = 100;
|
||||
monitor->attributes.deviceScaleFactor = 100;
|
||||
|
@ -427,6 +427,7 @@ extern "C"
|
||||
INT32 height;
|
||||
UINT32 is_primary;
|
||||
UINT32 orig_screen;
|
||||
BOOL highDpi;
|
||||
MONITOR_ATTRIBUTES attributes;
|
||||
} rdpMonitor;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user