mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Cleanup
Move global data to library struct. Simplify semantics. Update changelog. Related to #1028.
This commit is contained in:
parent
80e4922b5e
commit
ce5e649d3b
@ -224,6 +224,8 @@ information on what to include when reporting a bug.
|
|||||||
- [Cocoa] Bugfix: Full screen framebuffer was incorrectly sized for some video
|
- [Cocoa] Bugfix: Full screen framebuffer was incorrectly sized for some video
|
||||||
modes (#682)
|
modes (#682)
|
||||||
- [Cocoa] Bugfix: A string object for IME was updated non-idiomatically (#1050)
|
- [Cocoa] Bugfix: A string object for IME was updated non-idiomatically (#1050)
|
||||||
|
- [Cocoa] Bugfix: A hidden or disabled cursor would become visible when a user
|
||||||
|
notification was shown (#971,#1028)
|
||||||
- [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts
|
- [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts
|
||||||
- [WGL] Added support for `WGL_ARB_create_context_no_error`
|
- [WGL] Added support for `WGL_ARB_create_context_no_error`
|
||||||
- [GLX] Added support for `GLX_ARB_create_context_no_error`
|
- [GLX] Added support for `GLX_ARB_create_context_no_error`
|
||||||
|
@ -102,6 +102,7 @@ typedef struct _GLFWlibraryNS
|
|||||||
CGEventSourceRef eventSource;
|
CGEventSourceRef eventSource;
|
||||||
id delegate;
|
id delegate;
|
||||||
id autoreleasePool;
|
id autoreleasePool;
|
||||||
|
GLFWbool cursorHidden;
|
||||||
TISInputSourceRef inputSource;
|
TISInputSourceRef inputSource;
|
||||||
IOHIDManagerRef hidManager;
|
IOHIDManagerRef hidManager;
|
||||||
id unicodeData;
|
id unicodeData;
|
||||||
|
@ -88,18 +88,26 @@ static GLFWbool cursorInClientArea(_GLFWwindow* window)
|
|||||||
return [window->ns.view mouse:pos inRect:[window->ns.view frame]];
|
return [window->ns.view mouse:pos inRect:[window->ns.view frame]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates cursor visibility
|
// Hides the cursor if not already hidden
|
||||||
//
|
//
|
||||||
static void setCursorVisibility(_GLFWwindow* window, BOOL makeVisible)
|
static void hideCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
static BOOL isCursorVisible = YES;
|
if (!_glfw.ns.cursorHidden)
|
||||||
|
{
|
||||||
if (makeVisible && !isCursorVisible)
|
|
||||||
[NSCursor unhide];
|
|
||||||
else if (!makeVisible && isCursorVisible)
|
|
||||||
[NSCursor hide];
|
[NSCursor hide];
|
||||||
|
_glfw.ns.cursorHidden = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isCursorVisible = makeVisible;
|
// Shows the cursor if not already shown
|
||||||
|
//
|
||||||
|
static void showCursor(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (_glfw.ns.cursorHidden)
|
||||||
|
{
|
||||||
|
[NSCursor unhide];
|
||||||
|
_glfw.ns.cursorHidden = GLFW_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates the cursor image according to its cursor mode
|
// Updates the cursor image according to its cursor mode
|
||||||
@ -108,7 +116,7 @@ static void updateCursorImage(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
if (window->cursorMode == GLFW_CURSOR_NORMAL)
|
if (window->cursorMode == GLFW_CURSOR_NORMAL)
|
||||||
{
|
{
|
||||||
setCursorVisibility(window, YES);
|
showCursor(window);
|
||||||
|
|
||||||
if (window->cursor)
|
if (window->cursor)
|
||||||
[(NSCursor*) window->cursor->ns.object set];
|
[(NSCursor*) window->cursor->ns.object set];
|
||||||
@ -116,7 +124,7 @@ static void updateCursorImage(_GLFWwindow* window)
|
|||||||
[[NSCursor arrowCursor] set];
|
[[NSCursor arrowCursor] set];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
setCursorVisibility(window, NO);
|
hideCursor(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transforms the specified y-coordinate between the CG display and NS screen
|
// Transforms the specified y-coordinate between the CG display and NS screen
|
||||||
@ -525,7 +533,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
- (void)mouseExited:(NSEvent *)event
|
- (void)mouseExited:(NSEvent *)event
|
||||||
{
|
{
|
||||||
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
||||||
setCursorVisibility(window, YES);
|
showCursor(window);
|
||||||
|
|
||||||
_glfwInputCursorEnter(window, GLFW_FALSE);
|
_glfwInputCursorEnter(window, GLFW_FALSE);
|
||||||
}
|
}
|
||||||
@ -533,7 +541,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
- (void)mouseEntered:(NSEvent *)event
|
- (void)mouseEntered:(NSEvent *)event
|
||||||
{
|
{
|
||||||
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
||||||
setCursorVisibility(window, NO);
|
hideCursor(window);
|
||||||
|
|
||||||
_glfwInputCursorEnter(window, GLFW_TRUE);
|
_glfwInputCursorEnter(window, GLFW_TRUE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user