mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-28 14:55:32 +00:00
95318a8366
X11 and Windows GLControl and GLNative implementation now use IGLContext interfaces instead of direct X11GLContext and WinGLContext. Decouples the two (good!). Updated all Native, Control, Context classes to use the new interfaces.
120 lines
3.8 KiB
C#
120 lines
3.8 KiB
C#
#region --- License ---
|
|
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
|
* See license.txt for license info
|
|
*/
|
|
#endregion
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace OpenTK.Platform.X11
|
|
{
|
|
/// <summary>
|
|
/// Describes a Windows.Form.Control, Windows.Forms.NativeWindow or OpenTK.GameWindow on the X11 platform.
|
|
/// This class supports OpenTK, and is not intended for use by OpenTK programs.
|
|
/// </summary>
|
|
internal sealed class WindowInfo : IMutableWindowInfo
|
|
{
|
|
private IntPtr rootWindow, handle, topLevelWindow, display;
|
|
private int screen;
|
|
private WindowInfo parent;
|
|
private XVisualInfo visinfo;
|
|
|
|
public WindowInfo()
|
|
{
|
|
visinfo = new XVisualInfo();
|
|
}
|
|
|
|
public WindowInfo(Control control)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public WindowInfo(NativeWindow window)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public WindowInfo(GameWindow window)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public WindowInfo(WindowInfo info)
|
|
{
|
|
this.GetInfoFrom(info);
|
|
}
|
|
|
|
#region --- IWindowInfo Members ---
|
|
|
|
public IntPtr Handle { get { return handle; } internal set { handle = value; } }
|
|
public IWindowInfo Parent { get { return parent; } internal set { parent = value as WindowInfo; } }
|
|
|
|
#endregion
|
|
|
|
#region --- IMutableWindowInfo Members ---
|
|
|
|
public IWindowInfo GetInfoFrom(Control control)
|
|
{
|
|
if (control == null)
|
|
throw new ArgumentException("GameWindow cannot be null.");
|
|
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public IWindowInfo GetInfoFrom(NativeWindow window)
|
|
{
|
|
if (window == null)
|
|
throw new ArgumentException("GameWindow cannot be null.");
|
|
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public IWindowInfo GetInfoFrom(GameWindow window)
|
|
{
|
|
if (window == null)
|
|
throw new ArgumentException("GameWindow cannot be null.");
|
|
|
|
return this.GetInfoFrom(window.WindowInfo as X11.WindowInfo);
|
|
}
|
|
|
|
public IWindowInfo GetInfoFrom(IWindowInfo info)
|
|
{
|
|
if (info == null)
|
|
throw new ArgumentException("WindowInfo cannot be null");
|
|
|
|
return info;
|
|
}
|
|
|
|
public void CopyInfoFrom(IWindowInfo info)
|
|
{
|
|
this.Handle = info.Handle;
|
|
this.Parent = info.Parent;
|
|
|
|
WindowInfo winfo = info as WindowInfo;
|
|
|
|
this.RootWindow = winfo.RootWindow;
|
|
this.TopLevelWindow = winfo.TopLevelWindow;
|
|
this.Display = winfo.Display;
|
|
this.Screen = winfo.Screen;
|
|
this.VisualInfo = winfo.VisualInfo;
|
|
}
|
|
|
|
#endregion
|
|
|
|
public IntPtr RootWindow { get { return rootWindow; } internal set { rootWindow = value; } }
|
|
public IntPtr TopLevelWindow { get { return topLevelWindow; } internal set { topLevelWindow = value; } }
|
|
public IntPtr Display { get { return display; } internal set { display = value; } }
|
|
public int Screen { get { return screen; } internal set { screen = value; } }
|
|
public XVisualInfo VisualInfo { get { return visinfo; } internal set { visinfo = value; } }
|
|
|
|
public override string ToString()
|
|
{
|
|
return String.Format("X11.WindowInfo: Display {0}, Screen {1}, Handle {2}, Parent: ({3})",
|
|
this.Display, this.Screen, this.Handle, this.Parent != null ? this.Parent.ToString() : "null");
|
|
}
|
|
}
|
|
}
|