Added stub for WindowState.

This commit is contained in:
the_fiddler 2008-04-13 21:32:04 +00:00
parent 43b43fc256
commit a90a6c6e3d
5 changed files with 121 additions and 39 deletions

View file

@ -262,7 +262,7 @@ namespace OpenTK
#endregion #endregion
#region --- Public Methods --- #region --- Public Members ---
#region public virtual void Exit() #region public virtual void Exit()
@ -925,6 +925,18 @@ namespace OpenTK
#endregion #endregion
internal WindowState WindowState
{
get
{
return glWindow.WindowState;
}
set
{
glWindow.WindowState = value;
}
}
#endregion #endregion
#region --- GameWindow Timing --- #region --- GameWindow Timing ---

View file

@ -35,6 +35,7 @@ namespace OpenTK.Platform
//IGraphicsContext Context { get; } //IGraphicsContext Context { get; }
IInputDriver InputDriver { get; } IInputDriver InputDriver { get; }
bool Fullscreen { get; set; } bool Fullscreen { get; set; }
WindowState WindowState { get; set; }
event CreateEvent Create; event CreateEvent Create;
event DestroyEvent Destroy; event DestroyEvent Destroy;

View file

@ -455,6 +455,22 @@ namespace OpenTK.Platform.Windows
#endregion #endregion
#region public OpenTK.WindowState WindowState
public OpenTK.WindowState WindowState
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
#endregion
#endregion #endregion
#region --- IResizable Members --- #region --- IResizable Members ---

View file

@ -94,22 +94,22 @@ namespace OpenTK.Platform.X11
//window.Screen = (int)xplatui.GetField("ScreenNo", //window.Screen = (int)xplatui.GetField("ScreenNo",
// System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null); // System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
// Open a display connection to the X server, and obtain the screen and root window. // Open a display connection to the X server, and obtain the screen and root window.
window.Display = API.DefaultDisplay;//Functions.XOpenDisplay(IntPtr.Zero); // IntPtr.Zero == default display window.Display = API.DefaultDisplay;//Functions.XOpenDisplay(IntPtr.Zero); // IntPtr.Zero == default display
if (window.Display == IntPtr.Zero) if (window.Display == IntPtr.Zero)
throw new Exception("Could not open connection to X"); throw new Exception("Could not open connection to X");
try try
{ {
Functions.XLockDisplay(window.Display); Functions.XLockDisplay(window.Display);
window.Screen = Functions.XDefaultScreen(window.Display); //API.DefaultScreen; window.Screen = Functions.XDefaultScreen(window.Display); //API.DefaultScreen;
window.RootWindow = Functions.XRootWindow(window.Display, window.Screen); // API.RootWindow; window.RootWindow = Functions.XRootWindow(window.Display, window.Screen); // API.RootWindow;
}
finally
{
Functions.XUnlockDisplay(window.Display);
} }
finally
{
Functions.XUnlockDisplay(window.Display);
}
Debug.Print("Display: {0}, Screen {1}, Root window: {2}", window.Display, window.Screen, window.RootWindow); Debug.Print("Display: {0}, Screen {1}, Root window: {2}", window.Display, window.Screen, window.RootWindow);
RegisterAtoms(window); RegisterAtoms(window);
@ -154,12 +154,12 @@ namespace OpenTK.Platform.X11
if (width <= 0) throw new ArgumentOutOfRangeException("width", "Must be higher than zero."); if (width <= 0) throw new ArgumentOutOfRangeException("width", "Must be higher than zero.");
if (height <= 0) throw new ArgumentOutOfRangeException("height", "Must be higher than zero."); if (height <= 0) throw new ArgumentOutOfRangeException("height", "Must be higher than zero.");
if (exists) throw new InvalidOperationException("A render window already exists."); if (exists) throw new InvalidOperationException("A render window already exists.");
XVisualInfo info = new XVisualInfo();
Debug.Indent(); XVisualInfo info = new XVisualInfo();
lock (API.Lock) Debug.Indent();
lock (API.Lock)
{ {
info.visualid = mode.Index; info.visualid = mode.Index;
int dummy; int dummy;
@ -193,15 +193,15 @@ namespace OpenTK.Platform.X11
//Glx.CreateContext(window.Display, ref vis, IntPtr.Zero, true); //Glx.CreateContext(window.Display, ref vis, IntPtr.Zero, true);
} }
context = new GraphicsContext(mode, window); context = new GraphicsContext(mode, window);
// Set the window hints // Set the window hints
XSizeHints hints = new XSizeHints(); XSizeHints hints = new XSizeHints();
hints.x = 0; hints.x = 0;
hints.y = 0; hints.y = 0;
hints.width = width; hints.width = width;
hints.height = height; hints.height = height;
hints.flags = (IntPtr)(XSizeHintsFlags.USSize | XSizeHintsFlags.USPosition); hints.flags = (IntPtr)(XSizeHintsFlags.USSize | XSizeHintsFlags.USPosition);
lock (API.Lock) lock (API.Lock)
{ {
Functions.XSetWMNormalHints(window.Display, window.WindowHandle, ref hints); Functions.XSetWMNormalHints(window.Display, window.WindowHandle, ref hints);
@ -220,10 +220,10 @@ namespace OpenTK.Platform.X11
//Functions.XSetWMProperties(display, window, name, name, 0, /*None*/ null, 0, hints); //Functions.XSetWMProperties(display, window, name, name, 0, /*None*/ null, 0, hints);
Debug.Print("done! (id: {0})", window.WindowHandle); Debug.Print("done! (id: {0})", window.WindowHandle);
lock (API.Lock) lock (API.Lock)
{ {
API.MapRaised(window.Display, window.WindowHandle); API.MapRaised(window.Display, window.WindowHandle);
} }
mapped = true; mapped = true;
@ -243,10 +243,10 @@ namespace OpenTK.Platform.X11
public void ProcessEvents() public void ProcessEvents()
{ {
// Process all pending events // Process all pending events
//while (true) //while (true)
while (Functions.XCheckWindowEvent(window.Display, window.WindowHandle, window.EventMask, ref e) || while (Functions.XCheckWindowEvent(window.Display, window.WindowHandle, window.EventMask, ref e) ||
Functions.XCheckTypedWindowEvent(window.Display, window.WindowHandle, XEventName.ClientMessage, ref e)) Functions.XCheckTypedWindowEvent(window.Display, window.WindowHandle, XEventName.ClientMessage, ref e))
{ {
//pending = Functions.XPending(window.Display); //pending = Functions.XPending(window.Display);
//pending = API.Pending(window.Display); //pending = API.Pending(window.Display);
@ -563,6 +563,22 @@ namespace OpenTK.Platform.X11
#endregion #endregion
#region public OpenTK.WindowState WindowState
public OpenTK.WindowState WindowState
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
#endregion
#endregion #endregion
#region --- IResizable Members --- #region --- IResizable Members ---
@ -678,24 +694,24 @@ namespace OpenTK.Platform.X11
private void Dispose(bool manuallyCalled) private void Dispose(bool manuallyCalled)
{ {
if (!disposed) if (!disposed)
{ {
if (window != null && window.WindowHandle != IntPtr.Zero) if (window != null && window.WindowHandle != IntPtr.Zero)
{ {
try try
{ {
Functions.XLockDisplay(window.Display); Functions.XLockDisplay(window.Display);
Functions.XDestroyWindow(window.Display, window.WindowHandle); Functions.XDestroyWindow(window.Display, window.WindowHandle);
} }
finally finally
{ {
Functions.XUnlockDisplay(window.Display); Functions.XUnlockDisplay(window.Display);
} }
window = null; window = null;
} }
if (manuallyCalled) if (manuallyCalled)
{ {
} }
disposed = true; disposed = true;
} }

View file

@ -0,0 +1,37 @@
#region --- License ---
/* Licensed under the MIT/X11 license.
* Copyright (c) 2006-2008 the OpenTK Team.
* This notice may not be removed from any source distribution.
* See license.txt for licensing details.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK
{
/// <summary>
/// Defines the available states for the GameWindow.
/// </summary>
public enum WindowState
{
/// <summary>
/// The GameWindow is minimized to the taskbar (also known as 'iconified').
/// </summary>
Minimized,
/// <summary>
/// The GameWindow is in its normal state.
/// </summary>
Normal,
/// <summary>
/// The GameWindow covers the whole working area, which includes the desktop but not the taskbar and/or panels.
/// </summary>
Maximized,
/// <summary>
/// The GameWindow covers the whole screen, including all taskbars and/or panels.
/// </summary>
Fullscreen
}
}