Reverted to plain NSView.
Fixes #500. Fixes #443. Closes #504. Closes #510.
This commit is contained in:
parent
c7f564e866
commit
8f0fd7ecf5
@ -67,6 +67,8 @@ GLFW bundles a number of dependencies in the `deps/` directory.
|
|||||||
- Bugfix: The cached current context could get out of sync
|
- Bugfix: The cached current context could get out of sync
|
||||||
- [Cocoa] Bugfix: The cached `NSScreen` for a monitor could get out of sync
|
- [Cocoa] Bugfix: The cached `NSScreen` for a monitor could get out of sync
|
||||||
- [Cocoa] Bugfix: The `GLFW_AUTO_ICONIFY` window hint was ignored
|
- [Cocoa] Bugfix: The `GLFW_AUTO_ICONIFY` window hint was ignored
|
||||||
|
- [Cocoa] Bugfix: Resizing a window to its minimum size would segfault
|
||||||
|
- [Cocoa] Bugfix: Creating or showing a window would make its context current
|
||||||
- [X11] Bugfix: `glfwInit` would segfault on systems without RandR
|
- [X11] Bugfix: `glfwInit` would segfault on systems without RandR
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,6 +173,8 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect)
|
|||||||
|
|
||||||
- (void)windowDidResize:(NSNotification *)notification
|
- (void)windowDidResize:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
|
[window->nsgl.context update];
|
||||||
|
|
||||||
if (_glfw.focusedWindow == window &&
|
if (_glfw.focusedWindow == window &&
|
||||||
window->cursorMode == GLFW_CURSOR_DISABLED)
|
window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
{
|
{
|
||||||
@ -189,6 +191,8 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect)
|
|||||||
|
|
||||||
- (void)windowDidMove:(NSNotification *)notification
|
- (void)windowDidMove:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
|
[window->nsgl.context update];
|
||||||
|
|
||||||
if (_glfw.focusedWindow == window &&
|
if (_glfw.focusedWindow == window &&
|
||||||
window->cursorMode == GLFW_CURSOR_DISABLED)
|
window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
{
|
{
|
||||||
@ -302,7 +306,7 @@ static int translateKey(unsigned int key)
|
|||||||
// Content view class for the GLFW window
|
// Content view class for the GLFW window
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
@interface GLFWContentView : NSOpenGLView
|
@interface GLFWContentView : NSView
|
||||||
{
|
{
|
||||||
_GLFWwindow* window;
|
_GLFWwindow* window;
|
||||||
NSTrackingArea* trackingArea;
|
NSTrackingArea* trackingArea;
|
||||||
@ -330,8 +334,7 @@ static int translateKey(unsigned int key)
|
|||||||
|
|
||||||
- (id)initWithGlfwWindow:(_GLFWwindow *)initWindow
|
- (id)initWithGlfwWindow:(_GLFWwindow *)initWindow
|
||||||
{
|
{
|
||||||
self = [super initWithFrame:NSMakeRect(0, 0, 1, 1)
|
self = [super init];
|
||||||
pixelFormat:nil];
|
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
window = initWindow;
|
window = initWindow;
|
||||||
@ -894,9 +897,19 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
[window->ns.object setLevel:NSFloatingWindowLevel];
|
[window->ns.object setLevel:NSFloatingWindowLevel];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
|
||||||
|
|
||||||
|
#if defined(_GLFW_USE_RETINA)
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
|
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
|
||||||
|
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
|
||||||
|
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||||
|
#endif /*_GLFW_USE_RETINA*/
|
||||||
|
|
||||||
[window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]];
|
[window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]];
|
||||||
[window->ns.object setDelegate:window->ns.delegate];
|
[window->ns.object setDelegate:window->ns.delegate];
|
||||||
[window->ns.object setAcceptsMouseMovedEvents:YES];
|
[window->ns.object setAcceptsMouseMovedEvents:YES];
|
||||||
|
[window->ns.object setContentView:window->ns.view];
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
|
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
|
||||||
@ -925,22 +938,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
|
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
|
|
||||||
|
|
||||||
#if defined(_GLFW_USE_RETINA)
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
|
||||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
|
|
||||||
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
|
|
||||||
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
|
||||||
#endif /*_GLFW_USE_RETINA*/
|
|
||||||
|
|
||||||
[window->ns.object setContentView:window->ns.view];
|
|
||||||
// NOTE: If you set the pixel format before the context it creates another
|
|
||||||
// context, only to have it destroyed by the next line
|
|
||||||
// We cannot use the view to create the context because that interface
|
|
||||||
// does not support context resource sharing
|
|
||||||
[window->ns.view setOpenGLContext:window->nsgl.context];
|
|
||||||
[window->ns.view setPixelFormat:window->nsgl.pixelFormat];
|
|
||||||
[window->nsgl.context setView:window->ns.view];
|
[window->nsgl.context setView:window->ns.view];
|
||||||
|
|
||||||
if (wndconfig->monitor)
|
if (wndconfig->monitor)
|
||||||
|
Loading…
Reference in New Issue
Block a user