mirror of
https://github.com/glfw/glfw.git
synced 2024-11-23 10:35:10 +00:00
Began using monitor position for window placement.
This commit is contained in:
parent
ddeca47117
commit
6ac7af38d9
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user