From 0aa262a47f693e6b4905da9ce7b40c82dde3f9a8 Mon Sep 17 00:00:00 2001 From: Artem Kharytoniuk Date: Sun, 24 Dec 2017 00:54:25 +0100 Subject: [PATCH] DX12: windows positioning adjustment in twin mode. --- src/engine/platform/win_glimp.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/engine/platform/win_glimp.c b/src/engine/platform/win_glimp.c index 3846cf3..c27a4ef 100644 --- a/src/engine/platform/win_glimp.c +++ b/src/engine/platform/win_glimp.c @@ -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(); - if (w < desktop_width && h < desktop_height) - { - if ( x + w > desktop_width ) - x = ( desktop_width - w ); - if ( y + h > desktop_height ) - y = ( desktop_height - h ); - } - - char window_name[1024]; + if (x < 0) + x = 0; + else if (x >= desktop_width - 20) + x = desktop_width - 20; + if (y < 0) + y = 0; + else if (y >= desktop_height - 20) + y = desktop_height - 20; + + char window_name[1024]; const char* api_name = "invalid-render-api"; if (render_api == 0) api_name = "OpenGL"; @@ -541,8 +535,7 @@ static HWND create_twin_window(int width, int height, int render_api) api_name = "Vulkan"; else if (render_api == 2) 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( 0,