Removed glfwSetWindowPos and glfwGetWindowPos

glfwGetWindowPos is superseded by glfwGetWindowParam()
with GLFW_POSITION_X and GLFW_POSITION_Y as parameters.

glfwSetWindowPos can easily lead to bad practices
(moving windows around without the users consent), and
has been replaced with the GLFW_POSITION_X/Y window
hints that allow setting the window position for a
newly created window.
master
m@bitsnbites.eu ago%!(EXTRA string=13 years) committed by m
parent c9f4dedd96
commit 424e7c7b53
  1. 2
      include/GL/glfw3.h
  2. 21
      src/cocoa_window.m
  3. 1
      src/internal.h
  4. 17
      src/win32_window.c
  5. 46
      src/window.c
  6. 10
      src/x11_window.c

@ -538,8 +538,6 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow window);
GLFWAPI void glfwSetWindowTitle(GLFWwindow window, const char* title);
GLFWAPI void glfwGetWindowSize(GLFWwindow window, int* width, int* height);
GLFWAPI void glfwSetWindowSize(GLFWwindow window, int width, int height);
GLFWAPI void glfwGetWindowPos(GLFWwindow window, int* xpos, int* ypos);
GLFWAPI void glfwSetWindowPos(GLFWwindow window, int xpos, int ypos);
GLFWAPI void glfwIconifyWindow(GLFWwindow window);
GLFWAPI void glfwRestoreWindow(GLFWwindow window);
GLFWAPI void glfwShowWindow(GLFWwindow window);

@ -1006,27 +1006,6 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
}
//========================================================================
// Set the window position
//========================================================================
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
{
NSRect contentRect =
[window->NS.object contentRectForFrameRect:[window->NS.object frame]];
// We assume here that the client code wants to position the window within the
// screen the window currently occupies
NSRect screenRect = [[window->NS.object screen] visibleFrame];
contentRect.origin = NSMakePoint(screenRect.origin.x + x,
screenRect.origin.y + screenRect.size.height -
y - contentRect.size.height);
[window->NS.object setFrame:[window->NS.object frameRectForContentRect:contentRect]
display:YES];
}
//========================================================================
// Iconify the window
//========================================================================

@ -294,7 +294,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndcon
void _glfwPlatformDestroyWindow(_GLFWwindow* window);
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title);
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y);
void _glfwPlatformIconifyWindow(_GLFWwindow* window);
void _glfwPlatformRestoreWindow(_GLFWwindow* window);
void _glfwPlatformShowWindow(_GLFWwindow* window);

@ -1058,23 +1058,6 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
}
//========================================================================
// Set the window position
//========================================================================
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
{
RECT rect;
GetClientRect(window->Win32.handle, &rect);
AdjustWindowRectEx(&rect, window->Win32.dwStyle, FALSE, window->Win32.dwExStyle);
SetWindowPos(window->Win32.handle, HWND_TOP,
x + rect.left, y + rect.top, 0, 0,
SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
}
//========================================================================
// Window iconification
//========================================================================

@ -598,52 +598,6 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow handle, int width, int height)
}
//========================================================================
// Get the window position
//========================================================================
GLFWAPI void glfwGetWindowPos(GLFWwindow handle, int* xpos, int* ypos)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return;
}
if (xpos != NULL)
*xpos = window->positionX;
if (ypos != NULL)
*ypos = window->positionY;
}
//========================================================================
// Set the window position
//========================================================================
GLFWAPI void glfwSetWindowPos(GLFWwindow handle, int xpos, int ypos)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return;
}
if (window->mode == GLFW_FULLSCREEN || window->iconified)
{
// TODO: Figure out if this is an error
return;
}
_glfwPlatformSetWindowPos(window, xpos, ypos);
}
//========================================================================
// Window iconification
//========================================================================

@ -1012,16 +1012,6 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
}
//========================================================================
// Set the window position.
//========================================================================
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
{
XMoveWindow(_glfwLibrary.X11.display, window->X11.handle, x, y);
}
//========================================================================
// Window iconification
//========================================================================

Loading…
Cancel
Save