mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-27 04:28:52 -05:00
Fixed cursor positioning in fullscreen on Cocoa.
This commit is contained in:
parent
ee66e5fa10
commit
e7c4e77214
|
@ -332,6 +332,8 @@ version of GLFW.</p>
|
||||||
<li>[Cocoa] Bugfix: The OpenGL framework was not retrieved, making glfwGetProcAddress crash</li>
|
<li>[Cocoa] Bugfix: The OpenGL framework was not retrieved, making glfwGetProcAddress crash</li>
|
||||||
<li>[Cocoa] Bugfix: <code>glfwInit</code> changed the current directory for unbundled executables</li>
|
<li>[Cocoa] Bugfix: <code>glfwInit</code> changed the current directory for unbundled executables</li>
|
||||||
<li>[Cocoa] Bugfix: The <code>GLFW_WINDOW_NO_RESIZE</code> window parameter was always zero</li>
|
<li>[Cocoa] Bugfix: The <code>GLFW_WINDOW_NO_RESIZE</code> window parameter was always zero</li>
|
||||||
|
<li>[Cocoa] Bugfix: The cursor position incorrectly rounded during conversion</li>
|
||||||
|
<li>[Cocoa] Bugfix: Cursor positioning led to nonsensical results for fullscreen windows</li>
|
||||||
<li>[X11] Added support for the <code>GLX_EXT_swap_control</code> extension as an alternative to <code>GLX_SGI_swap_control</code></li>
|
<li>[X11] Added support for the <code>GLX_EXT_swap_control</code> extension as an alternative to <code>GLX_SGI_swap_control</code></li>
|
||||||
<li>[X11] Added the POSIX <code>CLOCK_MONOTONIC</code> time source as the preferred method</li>
|
<li>[X11] Added the POSIX <code>CLOCK_MONOTONIC</code> time source as the preferred method</li>
|
||||||
<li>[X11] Added dependency on libm, where present</li>
|
<li>[X11] Added dependency on libm, where present</li>
|
||||||
|
|
|
@ -1158,17 +1158,13 @@ void _glfwPlatformWaitEvents( void )
|
||||||
|
|
||||||
void _glfwPlatformSetCursorPos(_GLFWwindow* window, int x, int y)
|
void _glfwPlatformSetCursorPos(_GLFWwindow* window, int x, int y)
|
||||||
{
|
{
|
||||||
// The library seems to assume that after calling this the cursor won't move,
|
if (window->mode == GLFW_FULLSCREEN)
|
||||||
// but obviously it will, and escape the app's window, and activate other apps,
|
{
|
||||||
// and other badness in pain. I think the API's just silly, but maybe I'm
|
NSPoint globalPoint = NSMakePoint(x, y);
|
||||||
// misunderstanding it...
|
CGDisplayMoveCursorToPoint(CGMainDisplayID(), globalPoint);
|
||||||
|
}
|
||||||
// Also, (x, y) are window coords...
|
else
|
||||||
|
{
|
||||||
// Also, it doesn't seem possible to write this robustly without
|
|
||||||
// calculating the maximum y coordinate of all screens, since Cocoa's
|
|
||||||
// "global coordinates" are upside down from CG's...
|
|
||||||
|
|
||||||
NSPoint localPoint = NSMakePoint(x, window->height - y - 1);
|
NSPoint localPoint = NSMakePoint(x, window->height - y - 1);
|
||||||
NSPoint globalPoint = [window->NS.object convertBaseToScreen:localPoint];
|
NSPoint globalPoint = [window->NS.object convertBaseToScreen:localPoint];
|
||||||
CGPoint mainScreenOrigin = CGDisplayBounds(CGMainDisplayID()).origin;
|
CGPoint mainScreenOrigin = CGDisplayBounds(CGMainDisplayID()).origin;
|
||||||
|
@ -1178,6 +1174,7 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, int x, int y)
|
||||||
mainScreenOrigin.y);
|
mainScreenOrigin.y);
|
||||||
CGDisplayMoveCursorToPoint(CGMainDisplayID(), targetPoint);
|
CGDisplayMoveCursorToPoint(CGMainDisplayID(), targetPoint);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
Loading…
Reference in New Issue
Block a user