mirror of
https://github.com/Ryujinx/GLWidget.git
synced 2025-07-01 21:38:26 +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()
|
IWindowInfo InitializeOSX()
|
||||||
{
|
{
|
||||||
IntPtr windowHandle = gdk_quartz_window_get_nswindow(this.Window.Handle);
|
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);
|
return Utilities.CreateMacOSWindowInfo(windowHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
internal sealed class CocoaWindowInfo : IWindowInfo
|
internal sealed class CocoaWindowInfo : IWindowInfo
|
||||||
{
|
{
|
||||||
private static readonly IntPtr selContentView = Selector.Get("contentView");
|
private static readonly IntPtr selContentView = Selector.Get("contentView");
|
||||||
|
private static readonly IntPtr selWindow = Selector.Get("window");
|
||||||
|
|
||||||
private bool disposed = false;
|
private bool disposed = false;
|
||||||
|
|
||||||
|
@ -57,6 +58,11 @@ namespace OpenTK.Platform.MacOS
|
||||||
/// <param name="nsViewRef">A valid NSView reference.</param>
|
/// <param name="nsViewRef">A valid NSView reference.</param>
|
||||||
public CocoaWindowInfo(IntPtr nsWindowRef, IntPtr nsViewRef)
|
public CocoaWindowInfo(IntPtr nsWindowRef, IntPtr nsViewRef)
|
||||||
{
|
{
|
||||||
|
if (nsWindowRef == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
nsWindowRef = Cocoa.SendIntPtr(nsViewRef, selWindow);
|
||||||
|
}
|
||||||
|
|
||||||
this.Handle = nsWindowRef;
|
this.Handle = nsWindowRef;
|
||||||
this.ViewHandle = nsViewRef;
|
this.ViewHandle = nsViewRef;
|
||||||
Cocoa.SendVoid(nsWindowRef, Selector.Retain);
|
Cocoa.SendVoid(nsWindowRef, Selector.Retain);
|
||||||
|
|
Loading…
Reference in a new issue