DX12: windows positioning adjustment in twin mode.

This commit is contained in:
Artem Kharytoniuk 2017-12-24 00:54:25 +01:00
parent c326ac6e3b
commit 0aa262a47f

View File

@ -514,26 +514,20 @@ static HWND create_twin_window(int width, int height, int render_api)
} }
// adjust window coordinates if necessary
// so that the window is completely on screen
if ( x < 0 )
x = 0;
if ( y < 0 )
y = 0;
int desktop_width = GetDesktopWidth(); int desktop_width = GetDesktopWidth();
int desktop_height = GetDesktopHeight(); int desktop_height = GetDesktopHeight();
if (w < desktop_width && h < desktop_height) if (x < 0)
{ x = 0;
if ( x + w > desktop_width ) else if (x >= desktop_width - 20)
x = ( desktop_width - w ); x = desktop_width - 20;
if ( y + h > desktop_height )
y = ( desktop_height - h ); if (y < 0)
} y = 0;
else if (y >= desktop_height - 20)
y = desktop_height - 20;
char window_name[1024]; char window_name[1024];
const char* api_name = "invalid-render-api"; const char* api_name = "invalid-render-api";
if (render_api == 0) if (render_api == 0)
api_name = "OpenGL"; api_name = "OpenGL";
@ -541,7 +535,6 @@ static HWND create_twin_window(int width, int height, int render_api)
api_name = "Vulkan"; api_name = "Vulkan";
else if (render_api == 2) else if (render_api == 2)
api_name = "DX12"; api_name = "DX12";
sprintf(window_name, "%s [%s]", MAIN_WINDOW_CLASS_NAME, api_name); sprintf(window_name, "%s [%s]", MAIN_WINDOW_CLASS_NAME, api_name);
HWND hwnd = CreateWindowEx( HWND hwnd = CreateWindowEx(