mirror of
https://github.com/Ryujinx/GLWidget.git
synced 2024-12-22 14:05:38 +00:00
fix context creation on macos when gtk window is a nsview
This commit is contained in:
parent
c35e98f984
commit
88af339c0b
|
@ -365,7 +365,14 @@ namespace OpenTK
|
|||
IWindowInfo InitializeOSX()
|
||||
{
|
||||
IntPtr windowHandle = gdk_quartz_window_get_nswindow(this.Window.Handle);
|
||||
//IntPtr viewHandle = gdk_quartz_window_get_nsview(this.GdkWindow.Handle);
|
||||
|
||||
if (windowHandle == IntPtr.Zero)
|
||||
{
|
||||
IntPtr viewHandle = gdk_quartz_window_get_nsview(this.Window.Handle);
|
||||
|
||||
return Utilities.CreateMacOSWindowInfo(windowHandle, viewHandle);
|
||||
}
|
||||
|
||||
return Utilities.CreateMacOSWindowInfo(windowHandle);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace OpenTK.Platform.MacOS
|
|||
internal sealed class CocoaWindowInfo : IWindowInfo
|
||||
{
|
||||
private static readonly IntPtr selContentView = Selector.Get("contentView");
|
||||
private static readonly IntPtr selWindow = Selector.Get("window");
|
||||
|
||||
private bool disposed = false;
|
||||
|
||||
|
@ -57,6 +58,11 @@ namespace OpenTK.Platform.MacOS
|
|||
/// <param name="nsViewRef">A valid NSView reference.</param>
|
||||
public CocoaWindowInfo(IntPtr nsWindowRef, IntPtr nsViewRef)
|
||||
{
|
||||
if (nsWindowRef == IntPtr.Zero)
|
||||
{
|
||||
nsWindowRef = Cocoa.SendIntPtr(nsViewRef, selWindow);
|
||||
}
|
||||
|
||||
this.Handle = nsWindowRef;
|
||||
this.ViewHandle = nsViewRef;
|
||||
Cocoa.SendVoid(nsWindowRef, Selector.Retain);
|
||||
|
|
Loading…
Reference in a new issue