Added stub for WindowState.

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

View file

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

View file

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

View file

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

View file

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