From 6ac7af38d9be4ad3ba8eb32d931d602d87afc886 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Fri, 5 Oct 2012 04:10:42 +0200 Subject: [PATCH] Began using monitor position for window placement. --- src/win32_window.c | 22 +++++++++++++++------- src/x11_window.c | 14 ++++++++++++-- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index d98978be..f32ba320 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -728,8 +728,7 @@ static int createWindow(_GLFWwindow* window, const _GLFWfbconfig* fbconfig) { DWORD dwStyle, dwExStyle; - int fullWidth, fullHeight; - RECT wa; + int screenX, screenY, fullWidth, fullHeight; POINT pos; WCHAR* wideTitle; @@ -772,14 +771,23 @@ static int createWindow(_GLFWwindow* window, // Adjust window size for frame and title bar getFullWindowSize(window, window->width, window->height, &fullWidth, &fullHeight); - // Adjust window position to working area (e.g. if the task bar is at - // the top of the display). Fullscreen windows are always opened in - // the upper left corner regardless of the desktop working area. if (window->monitor) - wa.left = wa.top = 0; + { + // Fullscreen windows are always opened in the upper left corner + // regardless of the desktop working area + screenX = wndconfig->monitor->screenX; + screenY = wndconfig->monitor->screenY; + } else + { + RECT wa; SystemParametersInfo(SPI_GETWORKAREA, 0, &wa, 0); + // Adjust window position to working area + screenX = wa.left; + screenY = wa.top; + } + wideTitle = _glfwCreateWideStringFromUTF8(wndconfig->title); if (!wideTitle) { @@ -792,7 +800,7 @@ static int createWindow(_GLFWwindow* window, _GLFW_WNDCLASSNAME, wideTitle, window->Win32.dwStyle, - wa.left, wa.top, // Window position + screenX, screenY, fullWidth, // Decorated window width fullHeight, // Decorated window height NULL, // No parent window diff --git a/src/x11_window.c b/src/x11_window.c index fe4ca705..f18a31ab 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -98,6 +98,8 @@ static GLboolean createWindow(_GLFWwindow* window, // Create the actual window { + int screenX, screenY; + wamask = CWBorderPixel | CWColormap | CWEventMask; wa.colormap = window->X11.colormap; @@ -107,7 +109,12 @@ static GLboolean createWindow(_GLFWwindow* window, ExposureMask | FocusChangeMask | VisibilityChangeMask | EnterWindowMask | LeaveWindowMask; - if (!wndconfig->monitor) + if (wndconfig->monitor) + { + screenX = wndconfig->monitor->screenX; + screenY = wndconfig->monitor->screenY; + } + else { // The /only/ reason for setting the background pixel here is that // otherwise our window won't get any decorations on systems using @@ -115,11 +122,14 @@ static GLboolean createWindow(_GLFWwindow* window, wa.background_pixel = BlackPixel(_glfwLibrary.X11.display, _glfwLibrary.X11.screen); wamask |= CWBackPixel; + + screenX = 0; + screenY = 0; } window->X11.handle = XCreateWindow(_glfwLibrary.X11.display, _glfwLibrary.X11.root, - 0, 0, // Position + screenX, screenY, window->width, window->height, 0, // Border width visual->depth, // Color depth