mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Add GLFW_CENTER_CURSOR
Adds a hint for controlling whether the cursor is centered over newly created full screen windows. Fixes #749. Closes #842.
This commit is contained in:
parent
3af0c47c97
commit
72ac5badb0
@ -159,6 +159,7 @@ information on what to include when reporting a bug.
|
||||
- [Cocoa] Bugfix: Windows created after the first were not cascaded (#195)
|
||||
- [EGL] Added support for `EGL_KHR_get_all_proc_addresses` (#871)
|
||||
- [EGL] Bugfix: The test for `EGL_RGB_BUFFER` was invalid
|
||||
- Added 'GLFW_CENTER_CURSOR' window hint for controlling cursor centering
|
||||
|
||||
|
||||
## Contact
|
||||
@ -307,6 +308,7 @@ skills.
|
||||
- Santi Zupancic
|
||||
- Jonas Ådahl
|
||||
- Lasse Öörni
|
||||
- Liam Middlebrook
|
||||
- All the unmentioned and anonymous contributors in the GLFW community, for bug
|
||||
reports, patches, feedback, testing and encouragement
|
||||
|
||||
|
@ -428,6 +428,7 @@ GLFW_FOCUSED | `GLFW_TRUE` | `GLFW_TRUE` or `GL
|
||||
GLFW_AUTO_ICONIFY | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
GLFW_FLOATING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
GLFW_MAXIMIZED | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
GLFW_CENTER_CURSOR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
GLFW_RED_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||
GLFW_GREEN_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||
GLFW_BLUE_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||
@ -1041,6 +1042,10 @@ __GLFW_MAXIMIZED__ indicates whether the specified window is maximized. See
|
||||
__GLFW_VISIBLE__ indicates whether the specified window is visible. See @ref
|
||||
window_hide for details.
|
||||
|
||||
`GLFW_CENTER_CURSOR` indicates whether the cursor should be moved to the center
|
||||
of the full screen window during creation. This is ignored for windowed mode
|
||||
windows.
|
||||
|
||||
@anchor GLFW_RESIZABLE_attrib
|
||||
__GLFW_RESIZABLE__ indicates whether the specified window is resizable _by the
|
||||
user_. This can be set before creation with the
|
||||
|
@ -686,6 +686,7 @@ extern "C" {
|
||||
* [window attribute](@ref GLFW_MAXIMIZED_attrib).
|
||||
*/
|
||||
#define GLFW_MAXIMIZED 0x00020008
|
||||
#define GLFW_CENTER_CURSOR 0x00020009
|
||||
|
||||
/*! @brief Framebuffer bit depth hint.
|
||||
*
|
||||
|
@ -1096,7 +1096,8 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
||||
if (!acquireMonitor(window))
|
||||
return GLFW_FALSE;
|
||||
|
||||
centerCursor(window);
|
||||
if (wndconfig->centerCursor)
|
||||
centerCursor(window);
|
||||
}
|
||||
|
||||
return GLFW_TRUE;
|
||||
|
@ -277,6 +277,7 @@ struct _GLFWwndconfig
|
||||
GLFWbool autoIconify;
|
||||
GLFWbool floating;
|
||||
GLFWbool maximized;
|
||||
GLFWbool centerCursor;
|
||||
struct {
|
||||
GLFWbool retina;
|
||||
GLFWbool frame;
|
||||
|
@ -1037,7 +1037,10 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
||||
if (!acquireMonitor(window))
|
||||
return GLFW_FALSE;
|
||||
|
||||
centerCursor(window);
|
||||
if (wndconfig->centerCursor)
|
||||
{
|
||||
centerCursor(window);
|
||||
}
|
||||
}
|
||||
|
||||
return GLFW_TRUE;
|
||||
|
@ -345,6 +345,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
||||
case GLFW_COCOA_FRAME_AUTOSAVE:
|
||||
_glfw.hints.window.ns.frame = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
break;
|
||||
case GLFW_CENTER_CURSOR:
|
||||
_glfw.hints.window.centerCursor = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
break;
|
||||
case GLFW_CLIENT_API:
|
||||
_glfw.hints.context.client = value;
|
||||
break;
|
||||
|
@ -1597,7 +1597,10 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
||||
if (!acquireMonitor(window))
|
||||
return GLFW_FALSE;
|
||||
|
||||
centerCursor(window);
|
||||
if(wndconfig->centerCursor)
|
||||
{
|
||||
centerCursor(window);
|
||||
}
|
||||
}
|
||||
|
||||
XFlush(_glfw.x11.display);
|
||||
|
Loading…
Reference in New Issue
Block a user