mirror of
https://github.com/glfw/glfw.git
synced 2024-11-27 04:22:00 +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)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
DWORD dwStyle, dwExStyle;
|
DWORD dwStyle, dwExStyle;
|
||||||
int fullWidth, fullHeight;
|
int screenX, screenY, fullWidth, fullHeight;
|
||||||
RECT wa;
|
|
||||||
POINT pos;
|
POINT pos;
|
||||||
WCHAR* wideTitle;
|
WCHAR* wideTitle;
|
||||||
|
|
||||||
@ -772,14 +771,23 @@ static int createWindow(_GLFWwindow* window,
|
|||||||
// Adjust window size for frame and title bar
|
// Adjust window size for frame and title bar
|
||||||
getFullWindowSize(window, window->width, window->height, &fullWidth, &fullHeight);
|
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)
|
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
|
else
|
||||||
|
{
|
||||||
|
RECT wa;
|
||||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &wa, 0);
|
SystemParametersInfo(SPI_GETWORKAREA, 0, &wa, 0);
|
||||||
|
|
||||||
|
// Adjust window position to working area
|
||||||
|
screenX = wa.left;
|
||||||
|
screenY = wa.top;
|
||||||
|
}
|
||||||
|
|
||||||
wideTitle = _glfwCreateWideStringFromUTF8(wndconfig->title);
|
wideTitle = _glfwCreateWideStringFromUTF8(wndconfig->title);
|
||||||
if (!wideTitle)
|
if (!wideTitle)
|
||||||
{
|
{
|
||||||
@ -792,7 +800,7 @@ static int createWindow(_GLFWwindow* window,
|
|||||||
_GLFW_WNDCLASSNAME,
|
_GLFW_WNDCLASSNAME,
|
||||||
wideTitle,
|
wideTitle,
|
||||||
window->Win32.dwStyle,
|
window->Win32.dwStyle,
|
||||||
wa.left, wa.top, // Window position
|
screenX, screenY,
|
||||||
fullWidth, // Decorated window width
|
fullWidth, // Decorated window width
|
||||||
fullHeight, // Decorated window height
|
fullHeight, // Decorated window height
|
||||||
NULL, // No parent window
|
NULL, // No parent window
|
||||||
|
@ -98,6 +98,8 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
// Create the actual window
|
// Create the actual window
|
||||||
{
|
{
|
||||||
|
int screenX, screenY;
|
||||||
|
|
||||||
wamask = CWBorderPixel | CWColormap | CWEventMask;
|
wamask = CWBorderPixel | CWColormap | CWEventMask;
|
||||||
|
|
||||||
wa.colormap = window->X11.colormap;
|
wa.colormap = window->X11.colormap;
|
||||||
@ -107,7 +109,12 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
ExposureMask | FocusChangeMask | VisibilityChangeMask |
|
ExposureMask | FocusChangeMask | VisibilityChangeMask |
|
||||||
EnterWindowMask | LeaveWindowMask;
|
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
|
// The /only/ reason for setting the background pixel here is that
|
||||||
// otherwise our window won't get any decorations on systems using
|
// 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,
|
wa.background_pixel = BlackPixel(_glfwLibrary.X11.display,
|
||||||
_glfwLibrary.X11.screen);
|
_glfwLibrary.X11.screen);
|
||||||
wamask |= CWBackPixel;
|
wamask |= CWBackPixel;
|
||||||
|
|
||||||
|
screenX = 0;
|
||||||
|
screenY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
window->X11.handle = XCreateWindow(_glfwLibrary.X11.display,
|
window->X11.handle = XCreateWindow(_glfwLibrary.X11.display,
|
||||||
_glfwLibrary.X11.root,
|
_glfwLibrary.X11.root,
|
||||||
0, 0, // Position
|
screenX, screenY,
|
||||||
window->width, window->height,
|
window->width, window->height,
|
||||||
0, // Border width
|
0, // Border width
|
||||||
visual->depth, // Color depth
|
visual->depth, // Color depth
|
||||||
|
Loading…
Reference in New Issue
Block a user