Added support for minimized WindowState.

This commit is contained in:
the_fiddler 2008-04-25 21:32:01 +00:00
parent dc327850b6
commit 4bc19be5b1
2 changed files with 27 additions and 21 deletions

View file

@ -609,21 +609,14 @@ namespace OpenTK.Platform.X11
_atom_wm_state, IntPtr.Zero, new IntPtr (256), false, _atom_wm_state, IntPtr.Zero, new IntPtr (256), false,
IntPtr.Zero, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop); IntPtr.Zero, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
Debug.Print("Number of items: {0}", nitems.ToString());
if ((long)nitems > 0 && prop != IntPtr.Zero) if ((long)nitems > 0 && prop != IntPtr.Zero)
{ {
for (int i = 0; i < (long)nitems; i++) for (int i = 0; i < (long)nitems; i++)
{ {
// XXX 64 bit clean?
atom = (IntPtr)Marshal.ReadIntPtr(prop, i * IntPtr.Size); atom = (IntPtr)Marshal.ReadIntPtr(prop, i * IntPtr.Size);
//atom = (IntPtr)Marshal.ReadInt32(prop, i * 4);
if (atom == _atom_wm_state_maximized_horizontal || atom == _atom_wm_state_maximized_vertical) if (atom == _atom_wm_state_maximized_horizontal || atom == _atom_wm_state_maximized_vertical)
{
Debug.WriteLine("maximized++");
maximized++; maximized++;
}
else if (atom == _atom_wm_state_minimized) else if (atom == _atom_wm_state_minimized)
minimized = true; minimized = true;
else if (atom == _atom_wm_state_fullscreen) else if (atom == _atom_wm_state_fullscreen)
@ -633,7 +626,7 @@ namespace OpenTK.Platform.X11
} }
if (minimized) if (minimized)
return OpenTK.WindowState.Minimized; return WindowState.Minimized;
else if (maximized == 2) else if (maximized == 2)
return OpenTK.WindowState.Maximized; return OpenTK.WindowState.Maximized;
else if (fullscreen) else if (fullscreen)
@ -669,7 +662,7 @@ namespace OpenTK.Platform.X11
_atom_wm_state_maximized_horizontal, _atom_wm_state_maximized_horizontal,
_atom_wm_state_maximized_vertical); _atom_wm_state_maximized_vertical);
if (current_state == OpenTK.WindowState.Fullscreen) if (current_state == WindowState.Fullscreen)
WindowBorder = _previous_window_border; WindowBorder = _previous_window_border;
} }
else if (current_state == OpenTK.WindowState.Minimized) else if (current_state == OpenTK.WindowState.Minimized)
@ -681,7 +674,7 @@ namespace OpenTK.Platform.X11
case OpenTK.WindowState.Maximized: case OpenTK.WindowState.Maximized:
case OpenTK.WindowState.Fullscreen: case OpenTK.WindowState.Fullscreen:
if (current_state == OpenTK.WindowState.Minimized) if (current_state == WindowState.Minimized)
Functions.XMapWindow(window.Display, window.WindowHandle); Functions.XMapWindow(window.Display, window.WindowHandle);
Functions.SendNetWMMessage(window, _atom_wm_state, _atom_state_enable, Functions.SendNetWMMessage(window, _atom_wm_state, _atom_state_enable,
@ -691,28 +684,39 @@ namespace OpenTK.Platform.X11
if (this.WindowState == WindowState.Fullscreen) if (this.WindowState == WindowState.Fullscreen)
{ {
_previous_window_border = this.WindowBorder; _previous_window_border = this.WindowBorder;
this.WindowBorder = OpenTK.WindowBorder.Hidden; this.WindowBorder = WindowBorder.Hidden;
} }
Functions.XRaiseWindow(window.Display, window.WindowHandle); Functions.XRaiseWindow(window.Display, window.WindowHandle);
break; break;
case WindowState.Minimized:
if (current_state == WindowState.Maximized || current_state == WindowState.Fullscreen)
Functions.SendNetWMMessage(window, _atom_wm_state, _atom_state_toggle,
_atom_wm_state_maximized_horizontal,
_atom_wm_state_maximized_vertical);
// FIXME multiscreen support
Functions.XIconifyWindow(window.Display, window.WindowHandle, window.Screen);
break;
} }
} }
} }
#endregion #endregion
#region public WindowBorder WindowBorder #region public OpenTK.WindowBorder WindowBorder
public WindowBorder WindowBorder public OpenTK.WindowBorder WindowBorder
{ {
get get
{ {
throw new NotImplementedException(); return _window_border;
} }
set set
{ {
_window_border = value;
//Functions.XChangeProperty(window.Display, window.WindowHandle, //Functions.XChangeProperty(window.Display, window.WindowHandle,
} }
} }

View file

@ -58,6 +58,8 @@ namespace OpenTK.Platform.X11
public IntPtr Display { get { return display; } set { display = value; } } public IntPtr Display { get { return display; } set { display = value; } }
/// <summary>Gets or sets the X11 screen.</summary> /// <summary>Gets or sets the X11 screen.</summary>
public int Screen { get { return screen; } set { screen = value; } } public int Screen { get { return screen; } set { screen = value; } }
//{ get { return Functions.XRRRootToScreen(display, rootWindow); } set { } }
//public int Screen { get { return screen; } set { screen = value; } }
/// <summary>Gets or sets the X11 VisualInfo.</summary> /// <summary>Gets or sets the X11 VisualInfo.</summary>
public XVisualInfo VisualInfo { get { return visualInfo; } set { visualInfo = value; } } public XVisualInfo VisualInfo { get { return visualInfo; } set { visualInfo = value; } }
/// <summary>Gets or sets the X11 EventMask.</summary> /// <summary>Gets or sets the X11 EventMask.</summary>