* Platform/X11/X11GraphicsMode.cs, Platform/X11/X11GLNative.cs,

Platform/X11/Structs.cs, Platform/X11/Functions.cs,
  Platform/X11/API.cs: Working on WindowBorder and WindowState
  support.
This commit is contained in:
the_fiddler 2008-05-03 16:33:00 +00:00
parent cedb2394ff
commit a5455cc4e7
5 changed files with 383 additions and 208 deletions

View file

@ -743,8 +743,6 @@ XF86VidModeGetGammaRampSize(
#region unsafe internal class XExtData
#pragma warning disable 0169
unsafe internal class XExtData
{
int number; /* number returned by XRegisterExtension */
@ -754,7 +752,68 @@ XF86VidModeGetGammaRampSize(
XPointer private_data; /* buffer private to this extension. */
};
#pragma warning restore 0169
#pragma warning restore 0169, 0649
#endregion
#region Motif
[StructLayout(LayoutKind.Sequential)]
internal struct MotifWmHints
{
internal IntPtr flags;
internal IntPtr functions;
internal IntPtr decorations;
internal IntPtr input_mode;
internal IntPtr status;
public override string ToString ()
{
return string.Format("MotifWmHints <flags={0}, functions={1}, decorations={2}, input_mode={3}, status={4}", (MotifFlags) flags.ToInt32 (), (MotifFunctions) functions.ToInt32 (), (MotifDecorations) decorations.ToInt32 (), (MotifInputMode) input_mode.ToInt32 (), status.ToInt32 ());
}
}
[Flags]
internal enum MotifFlags
{
Functions = 1,
Decorations = 2,
InputMode = 4,
Status = 8
}
[Flags]
internal enum MotifFunctions
{
All = 0x01,
Resize = 0x02,
Move = 0x04,
Minimize = 0x08,
Maximize = 0x10,
Close = 0x20
}
[Flags]
internal enum MotifDecorations
{
All = 0x01,
Border = 0x02,
ResizeH = 0x04,
Title = 0x08,
Menu = 0x10,
Minimize = 0x20,
Maximize = 0x40,
}
[Flags]
internal enum MotifInputMode
{
Modeless = 0,
ApplicationModal = 1,
SystemModal = 2,
FullApplicationModal = 3
}
#endregion
@ -1299,7 +1358,7 @@ XF86VidModeGetGammaRampSize(
[DllImport(X11Library)]
internal static extern void XChangeWindowAttributes(Display display, Window w, UIntPtr valuemask, ref XSetWindowAttributes attributes);
internal static void XChangeWindowAttributes(Display display, Window w, ChangeWindowAttributes valuemask, ref XSetWindowAttributes attributes)
internal static void XChangeWindowAttributes(Display display, Window w, SetWindowValuemask valuemask, ref XSetWindowAttributes attributes)
{
XChangeWindowAttributes(display, w, (UIntPtr)valuemask, ref attributes);
}

View file

@ -419,6 +419,14 @@ namespace OpenTK.Platform.X11
[DllImport("libX11")]
public static extern void XUnlockDisplay(Display display);
[DllImport("libX11")]
public static extern Status XGetTransientForHint(Display display, Window w, out Window prop_window_return);
[DllImport("libX11")]
public static extern void XSync(Display display, bool discard);
public static void SendNetWMMessage(X11WindowInfo window, IntPtr message_type, IntPtr l0, IntPtr l1, IntPtr l2)
{
XEvent xev;

View file

@ -1073,63 +1073,6 @@ namespace OpenTK.Platform.X11
NotifyDetailNone = 7
}
[StructLayout(LayoutKind.Sequential)]
public struct MotifWmHints
{
public IntPtr flags;
public IntPtr functions;
public IntPtr decorations;
public IntPtr input_mode;
public IntPtr status;
public override string ToString()
{
return string.Format("MotifWmHints <flags={0}, functions={1}, decorations={2}, input_mode={3}, status={4}", (MotifFlags)flags.ToInt32(), (MotifFunctions)functions.ToInt32(), (MotifDecorations)decorations.ToInt32(), (MotifInputMode)input_mode.ToInt32(), status.ToInt32());
}
}
[Flags]
public enum MotifFlags
{
Functions = 1,
Decorations = 2,
InputMode = 4,
Status = 8
}
[Flags]
public enum MotifFunctions
{
All = 0x01,
Resize = 0x02,
Move = 0x04,
Minimize = 0x08,
Maximize = 0x10,
Close = 0x20
}
[Flags]
public enum MotifDecorations
{
All = 0x01,
Border = 0x02,
ResizeH = 0x04,
Title = 0x08,
Menu = 0x10,
Minimize = 0x20,
Maximize = 0x40,
}
[Flags]
public enum MotifInputMode
{
Modeless = 0,
ApplicationModal = 1,
SystemModal = 2,
FullApplicationModal = 3
}
[Flags]
public enum KeyMasks
{

View file

@ -34,24 +34,40 @@ namespace OpenTK.Platform.X11
#region --- Fields ---
const int _min_width = 30, _min_height = 30;
X11WindowInfo window = new X11WindowInfo();
X11Input driver;
// Window manager hints for fullscreen windows.
// Not used right now (the code is written, but is not 64bit-correct), but could be useful for older WMs which
// are not ICCM compliant, but may support MOTIF hints.
const string MOTIF_WM_ATOM = "_MOTIF_WM_HINTS";
const string KDE_WM_ATOM = "KWM_WIN_DECORATION";
const string KDE_NET_WM_ATOM = "_KDE_NET_WM_WINDOW_TYPE";
const string ICCM_WM_ATOM = "_NET_WM_WINDOW_TYPE";
IntPtr _atom_wm_state;
IntPtr _atom_wm_state_minimized;
IntPtr _atom_wm_state_fullscreen;
IntPtr _atom_wm_state_maximized_horizontal;
IntPtr _atom_wm_state_maximized_vertical;
// The Atom class from Mono might be useful to avoid calling XInternAtom by hand (somewhat error prone).
IntPtr _atom_wm_destroy;
static readonly IntPtr _atom_state_remove = (IntPtr)0;
static readonly IntPtr _atom_state_add = (IntPtr)1;
static readonly IntPtr _atom_state_toggle = (IntPtr)2;
IntPtr _atom_net_wm_state;
IntPtr _atom_net_wm_state_minimized;
IntPtr _atom_net_wm_state_fullscreen;
IntPtr _atom_net_wm_state_maximized_horizontal;
IntPtr _atom_net_wm_state_maximized_vertical;
IntPtr _atom_net_wm_allowed_actions;
IntPtr _atom_net_wm_action_resize;
IntPtr _atom_net_wm_action_maximize_horizontally;
IntPtr _atom_net_wm_action_maximize_vertically;
IntPtr _atom_motif_wm_hints;
IntPtr _atom_kde_wm_hints;
IntPtr _atom_kde_net_wm_hints;
static readonly IntPtr _atom_remove = (IntPtr)0;
static readonly IntPtr _atom_add = (IntPtr)1;
static readonly IntPtr _atom_toggle = (IntPtr)2;
// Number of pending events.
int pending = 0;
@ -77,8 +93,10 @@ namespace OpenTK.Platform.X11
int pre_fullscreen_width, pre_fullscreen_height;
//bool fullscreen = false;
OpenTK.WindowState _window_state, _previous_window_state;
OpenTK.WindowBorder _window_border, _previous_window_border;
bool _decorations_hidden = false;
//OpenTK.WindowState _window_state, _previous_window_state;
//OpenTK.WindowBorder _window_border, _previous_window_border;
#endregion
@ -145,15 +163,25 @@ namespace OpenTK.Platform.X11
private void RegisterAtoms(X11WindowInfo window)
{
Debug.WriteLine("Registering atoms.");
_atom_wm_destroy = Functions.XInternAtom(window.Display, "WM_DELETE_WINDOW", true);
_atom_wm_state = Functions.XInternAtom(window.Display, "_NET_WM_STATE", false);
_atom_wm_state_minimized = Functions.XInternAtom(window.Display, "_NET_WM_STATE_MINIMIZED", false);
_atom_wm_state_fullscreen = Functions.XInternAtom(window.Display, "_NET_WM_STATE_FULLSCREEN", false);
_atom_wm_state_maximized_horizontal =
_atom_net_wm_state = Functions.XInternAtom(window.Display, "_NET_WM_STATE", false);
_atom_net_wm_state_minimized = Functions.XInternAtom(window.Display, "_NET_WM_STATE_MINIMIZED", false);
_atom_net_wm_state_fullscreen = Functions.XInternAtom(window.Display, "_NET_WM_STATE_FULLSCREEN", false);
_atom_net_wm_state_maximized_horizontal =
Functions.XInternAtom(window.Display, "_NET_WM_STATE_MAXIMIZED_HORZ", false);
_atom_wm_state_maximized_vertical =
_atom_net_wm_state_maximized_vertical =
Functions.XInternAtom(window.Display, "_NET_WM_STATE_MAXIMIZED_VERT", false);
_atom_net_wm_allowed_actions =
Functions.XInternAtom(window.Display, "_NET_WM_ALLOWED_ACTIONS", false);
_atom_net_wm_action_resize =
Functions.XInternAtom(window.Display, "_NET_WM_ACTION_RESIZE", false);
_atom_net_wm_action_maximize_horizontally =
Functions.XInternAtom(window.Display, "_NET_WM_ACTION_MAXIMIZE_HORZ", false);
_atom_net_wm_action_maximize_vertically =
Functions.XInternAtom(window.Display, "_NET_WM_ACTION_MAXIMIZE_VERT", false);
// string[] atom_names = new string[]
// {
// //"WM_TITLE",
@ -219,19 +247,20 @@ namespace OpenTK.Platform.X11
context = new GraphicsContext(mode, window);
// Set the window hints
SetWindowMinMax(_min_width, _min_height, -1, -1);
XSizeHints hints = new XSizeHints();
hints.x = 0;
hints.y = 0;
hints.width = width;
hints.height = height;
hints.flags = (IntPtr)(XSizeHintsFlags.USSize | XSizeHintsFlags.USPosition);
hints.flags = (IntPtr)(XSizeHintsFlags.USSize);// | XSizeHintsFlags.USPosition);
lock (API.Lock)
{
Functions.XSetWMNormalHints(window.Display, window.WindowHandle, ref hints);
// Register for window destroy notification
IntPtr wm_destroy_atom = Functions.XInternAtom(window.Display, "WM_DELETE_WINDOW", true);
Functions.XSetWMProtocols(window.Display, window.WindowHandle, new IntPtr[] { wm_destroy_atom }, 1);
Functions.XSetWMProtocols(window.Display, window.WindowHandle, new IntPtr[] { _atom_wm_destroy }, 1);
}
Top = Left = 0;
Right = Width;
@ -255,6 +284,17 @@ namespace OpenTK.Platform.X11
driver = new X11Input(window);
// HACK: This seems to reduce thread issues on Linux, due to race conditions.
// It does *not* solve the root cause, which is unknown at this point.
//
// What I suspect happens, is that either the glXChooseContext or glXCreateContext functions are called
// before the window is ready - or maybe before the window size is set which renders the viewport invalid?
// (can this happen?) or that there are pending events that somehow botch context creation up (seems like
// the fglrx driver is spawning a new thread, or waiting on something?)
// This issue *must* be resolved before the 1.0 release.
// Note that this has the side effect that sometimes, a resize event is missed.
//Functions.XSync(window.Display, true);
Debug.WriteLine("X11GLNative window created successfully!");
Debug.Unindent();
@ -294,7 +334,12 @@ namespace OpenTK.Platform.X11
break;
case XEventName.ClientMessage:
if (e.ClientMessageEvent.ptr1 == _atom_wm_destroy)
this.OnDestroy(EventArgs.Empty);
else
Debug.Print("Niar");
break;
case XEventName.DestroyNotify:
@ -607,21 +652,21 @@ namespace OpenTK.Platform.X11
bool minimized = false;
Functions.XGetWindowProperty(window.Display, window.WindowHandle,
_atom_wm_state, IntPtr.Zero, new IntPtr (256), false,
_atom_net_wm_state, IntPtr.Zero, new IntPtr (256), false,
IntPtr.Zero, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
if ((long)nitems > 0 && prop != IntPtr.Zero)
{
Debug.Print("nitems: {0}", nitems.ToString());
for (int i = 0; i < (long)nitems; i++)
{
atom = (IntPtr)Marshal.ReadIntPtr(prop, i * IntPtr.Size);
if (atom == _atom_wm_state_maximized_horizontal || atom == _atom_wm_state_maximized_vertical)
if (atom == _atom_net_wm_state_maximized_horizontal ||
atom == _atom_net_wm_state_maximized_vertical)
maximized++;
else if (atom == _atom_wm_state_minimized)
else if (atom == _atom_net_wm_state_minimized)
minimized = true;
else if (atom == _atom_wm_state_fullscreen)
else if (atom == _atom_net_wm_state_fullscreen)
fullscreen = true;
}
Functions.XFree(prop);
@ -655,15 +700,15 @@ namespace OpenTK.Platform.X11
Functions.XMapWindow(window.Display, window.WindowHandle);
else if (current_state == OpenTK.WindowState.Fullscreen)
{
WindowBorder = _previous_window_border;
Functions.SendNetWMMessage(window, _atom_wm_state, _atom_state_remove,
_atom_wm_state_fullscreen,
//WindowBorder = _previous_window_border;
Functions.SendNetWMMessage(window, _atom_net_wm_state, _atom_remove,
_atom_net_wm_state_fullscreen,
IntPtr.Zero);
}
else if (current_state == OpenTK.WindowState.Maximized)
Functions.SendNetWMMessage(window, _atom_wm_state, _atom_state_toggle,
_atom_wm_state_maximized_horizontal,
_atom_wm_state_maximized_vertical);
Functions.SendNetWMMessage(window, _atom_net_wm_state, _atom_toggle,
_atom_net_wm_state_maximized_horizontal,
_atom_net_wm_state_maximized_vertical);
switch (value)
{
@ -673,12 +718,23 @@ namespace OpenTK.Platform.X11
break;
case OpenTK.WindowState.Maximized:
Functions.SendNetWMMessage(window, _atom_wm_state, _atom_state_add,
_atom_wm_state_maximized_horizontal,
_atom_wm_state_maximized_vertical);
// We can't resize the window if its border is fixed, so make it resizable first.
bool temporary_resizable = false;
if (WindowBorder == WindowBorder.Fixed)
{
temporary_resizable = true;
WindowBorder = WindowBorder.Resizable;
}
Functions.SendNetWMMessage(window, _atom_net_wm_state, _atom_add,
_atom_net_wm_state_maximized_horizontal,
_atom_net_wm_state_maximized_vertical);
Functions.XRaiseWindow(window.Display, window.WindowHandle);
if (temporary_resizable)
WindowBorder = WindowBorder.Fixed;
break;
case WindowState.Minimized:
@ -688,11 +744,11 @@ namespace OpenTK.Platform.X11
break;
case WindowState.Fullscreen:
_previous_window_border = this.WindowBorder;
this.WindowBorder = WindowBorder.Hidden;
//_previous_window_border = this.WindowBorder;
//this.WindowBorder = WindowBorder.Hidden;
Functions.SendNetWMMessage(window, _atom_wm_state, _atom_state_add,
_atom_wm_state_fullscreen, IntPtr.Zero);
Functions.SendNetWMMessage(window, _atom_net_wm_state, _atom_add,
_atom_net_wm_state_fullscreen, IntPtr.Zero);
break;
}
@ -707,12 +763,93 @@ namespace OpenTK.Platform.X11
{
get
{
return _window_border;
//return _window_border;
IntPtr actual_atom;
int actual_format;
IntPtr nitems;
IntPtr bytes_after;
IntPtr prop = IntPtr.Zero;
IntPtr atom;
XWindowAttributes attributes;
bool resizable = false, hidden = false;
// IntPtr transient; // The window for which X11GLWindow is transient, if any.
//
// Functions.XGetTransientForHint(window.Display, window.WindowHandle, out transient);
// if (transient != IntPtr.Zero)
// return WindowBorder.Hidden;
if (_decorations_hidden)
return WindowBorder.Hidden;
Functions.XGetWindowProperty(window.Display, window.WindowHandle,
_atom_net_wm_allowed_actions, IntPtr.Zero, new IntPtr (256), false,
IntPtr.Zero, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
if ((long)nitems > 0 && prop != IntPtr.Zero)
{
for (int i = 0; i < (long)nitems; i++)
{
atom = (IntPtr)Marshal.ReadIntPtr(prop, i * IntPtr.Size);
if (atom == _atom_net_wm_action_resize)
resizable = true;
//else if (atom
//return WindowBorder.Resizable;
// if (atom == _atom_wm_state_maximized_horizontal || atom == _atom_wm_state_maximized_vertical)
// maximized++;
// else if (atom == _atom_wm_state_minimized)
// minimized = true;
// else if (atom == _atom_wm_state_fullscreen)
// fullscreen = true;
}
Functions.XFree(prop);
}
if (resizable)
return WindowBorder.Resizable;
else
return WindowBorder.Fixed;
}
set
{
_window_border = value;
//Functions.XChangeProperty(window.Display, window.WindowHandle,
if (WindowBorder == value)
return;
if (WindowBorder == WindowBorder.Hidden)
{
EnableWindowDecorations();
// int error = Functions.XSetTransientForHint(window.Display, window.WindowHandle, IntPtr.Zero);
// if (error == 0)
// Debug.Print("Error");
}
switch (value)
{
case WindowBorder.Fixed:
Debug.Print("Making WindowBorder fixed.");
SetWindowMinMax((short)Width, (short)Height, (short)Width, (short)Height);
break;
case WindowBorder.Resizable:
Debug.Print("Making WindowBorder resizable.");
SetWindowMinMax(_min_width, _min_height, -1, -1);
break;
case WindowBorder.Hidden:
Debug.Print("Making WindowBorder hidden.");
DisableWindowDecorations();
//Functions.XSetTransientForHint(window.Display, window.WindowHandle, window.RootWindow);
break;
}
// Functions.SendNetWMMessage(window, _atom_wm_state, _atom_state_add,
// _atom_wm_state_fullscreen, IntPtr.Zero);
}
}
@ -720,6 +857,41 @@ namespace OpenTK.Platform.X11
#endregion
void SetWindowMinMax(short min_width, short min_height, short max_width, short max_height)
{
IntPtr dummy;
XSizeHints hints = new XSizeHints();
Functions.XGetWMNormalHints(window.Display, window.WindowHandle, ref hints, out dummy);
if (min_width > 0 || min_height > 0)
{
hints.flags = (IntPtr)((int)hints.flags | (int)XSizeHintsFlags.PMinSize);
hints.min_width = min_width;
hints.min_height = min_height;
}
else
hints.flags = (IntPtr)((int)hints.flags & ~(int)XSizeHintsFlags.PMinSize);
if (max_width > 0 || max_height > 0)
{
hints.flags = (IntPtr)((int)hints.flags | (int)XSizeHintsFlags.PMaxSize);
hints.max_width = max_width;
hints.max_height = max_height;
}
else
hints.flags = (IntPtr)((int)hints.flags & ~(int)XSizeHintsFlags.PMaxSize);
if (hints.flags != IntPtr.Zero)
{
// The Metacity team has decided that they won't care about this when clicking the maximize
// icon, will maximize the window to fill the screen/parent no matter what.
// http://bugzilla.ximian.com/show_bug.cgi?id=80021
Functions.XSetWMNormalHints(window.Display, window.WindowHandle, ref hints);
}
}
#region --- IResizable Members ---
#region public int Width
@ -869,17 +1041,23 @@ namespace OpenTK.Platform.X11
void DisableWindowDecorations()
{
bool removed = false;
if (DisableMotifDecorations()) { Debug.Print("Removed decorations through motif."); removed = true; }
if (DisableGnomeDecorations()) { Debug.Print("Removed decorations through gnome."); removed = true; }
if (DisableIccmDecorations()) { Debug.Print("Removed decorations through ICCM."); removed = true; }
if (removed)
if (DisableMotifDecorations())
{
Functions.XSetTransientForHint(this.window.Display, this.Handle, this.window.RootWindow);
Functions.XUnmapWindow(this.window.Display, this.Handle);
Functions.XMapWindow(this.window.Display, this.Handle);
Debug.Print("Removed decorations through motif.");
_decorations_hidden = true;
}
//bool removed = false;
//if (DisableMotifDecorations()) { Debug.Print("Removed decorations through motif."); removed = true; }
//if (DisableGnomeDecorations()) { Debug.Print("Removed decorations through gnome."); removed = true; }
//if (DisableIccmDecorations()) { Debug.Print("Removed decorations through ICCM."); removed = true; }
//if (removed)
//{
// Functions.XSetTransientForHint(this.window.Display, this.Handle, this.window.RootWindow);
// Functions.XUnmapWindow(this.window.Display, this.Handle);
// Functions.XMapWindow(this.window.Display, this.Handle);
//}
}
#region bool DisableMotifDecorations()
@ -891,8 +1069,8 @@ namespace OpenTK.Platform.X11
{
MotifWmHints hints = new MotifWmHints();
hints.flags = (IntPtr)MotifFlags.Decorations;
Functions.XChangeProperty(this.window.Display, this.Handle, atom, atom, 32, PropertyMode.Replace, ref hints, 5
/*Marshal.SizeOf(hints) / 4*/);
Functions.XChangeProperty(this.window.Display, this.Handle, atom, atom, 32, PropertyMode.Replace,
ref hints, /*Marshal.SizeOf(hints) / 4*/ 5);
return true;
}
return false;
@ -904,30 +1082,12 @@ namespace OpenTK.Platform.X11
bool DisableGnomeDecorations()
{
// Attempt to cover gnome panels.
//XEvent xev = new XEvent();
//xev.ClientMessageEvent.window = this.window.Handle;
//xev.ClientMessageEvent.type = XEventName.ClientMessage;
//xev.ClientMessageEvent.message_type = Functions.XInternAtom(this.window.Display, Constants.XA_WIN_LAYER, false);
//xev.ClientMessageEvent.format = 32;
//xev.ClientMessageEvent.ptr1 = (IntPtr)WindowLayer.AboveDock;
//Functions.XSendEvent(this.window.Display, this.window.RootWindow, false, (IntPtr)EventMask.SubstructureNotifyMask, ref xev);
//xev = new XEvent();
//xev.ClientMessageEvent.window = this.window.Handle;
//xev.ClientMessageEvent.type = XEventName.ClientMessage;
//xev.ClientMessageEvent.message_type = Functions.XInternAtom(this.window.Display, Constants.XA_WIN_STATE, false);
//xev.ClientMessageEvent.format = 32;
//xev.ClientMessageEvent.ptr1 = (IntPtr)WindowState.;
//xev.ClientMessageEvent.ptr2 = (IntPtr)WindowLayer.AboveDock;
//Functions.XSendEvent(this.window.Display, this.window.RootWindow, false, (IntPtr)EventMask.SubstructureNotifyMask, ref xev);
IntPtr atom = Functions.XInternAtom(this.window.Display, Constants.XA_WIN_HINTS, true);
if (atom != IntPtr.Zero)
{
IntPtr hints = IntPtr.Zero;
Functions.XChangeProperty(this.window.Display, this.Handle, atom, atom, 32, PropertyMode.Replace, ref hints,
/*Marshal.SizeOf(hints) / 4*/ 1);
Functions.XChangeProperty(this.window.Display, this.Handle, atom, atom, 32, PropertyMode.Replace,
ref hints, /*Marshal.SizeOf(hints) / 4*/ 1);
return true;
}
@ -944,8 +1104,8 @@ namespace OpenTK.Platform.X11
if (atom != IntPtr.Zero)
{
IntPtr hints = Functions.XInternAtom(this.window.Display, "_NET_WM_STATE_FULLSCREEN", true);
Functions.XChangeProperty(this.window.Display, this.Handle, atom, atom, 32, PropertyMode.Replace, ref hints, 1
/*Marshal.SizeOf(hints) / 4*/);
Functions.XChangeProperty(this.window.Display, this.Handle, atom, atom, 32, PropertyMode.Replace,
ref hints, /*Marshal.SizeOf(hints) / 4*/ 1);
return true;
}
return false;
@ -959,17 +1119,22 @@ namespace OpenTK.Platform.X11
void EnableWindowDecorations()
{
bool activated = false;
if (EnableMotifDecorations()) { Debug.Print("Activated decorations through motif."); activated = true; }
if (EnableGnomeDecorations()) { Debug.Print("Activated decorations through gnome."); activated = true; }
if (EnableIccmDecorations()) { Debug.Print("Activated decorations through ICCM."); activated = true; }
if (activated)
if (EnableMotifDecorations())
{
Functions.XSetTransientForHint(this.window.Display, this.Handle, this.window.RootWindow);
Functions.XUnmapWindow(this.window.Display, this.Handle);
Functions.XMapWindow(this.window.Display, this.Handle);
Debug.Print("Activated decorations through motif.");
_decorations_hidden = false;
}
//bool activated = false;
//if (EnableMotifDecorations()) { Debug.Print("Activated decorations through motif."); activated = true; }
//if (EnableGnomeDecorations()) { Debug.Print("Activated decorations through gnome."); activated = true; }
//if (EnableIccmDecorations()) { Debug.Print("Activated decorations through ICCM."); activated = true; }
//if (activated)
//{
// Functions.XSetTransientForHint(this.window.Display, this.Handle, this.window.RootWindow);
// Functions.XUnmapWindow(this.window.Display, this.Handle);
// Functions.XMapWindow(this.window.Display, this.Handle);
//}
}
#region bool EnableMotifDecorations()
@ -1022,8 +1187,8 @@ namespace OpenTK.Platform.X11
IntPtr hint = Functions.XInternAtom(this.window.Display, "_NET_WM_WINDOW_TYPE_NORMAL", true);
if (hint != IntPtr.Zero)
{
Functions.XChangeProperty(this.window.Display, this.Handle, hint, /*XA_ATOM*/(IntPtr)4, 32, PropertyMode.Replace,
ref hint, Marshal.SizeOf(hint) / 4);
Functions.XChangeProperty(this.window.Display, this.Handle, hint, /*XA_ATOM*/(IntPtr)4, 32,
PropertyMode.Replace, hint, Marshal.SizeOf(hint) / 4);
}
return true;
}

View file

@ -84,7 +84,7 @@ namespace OpenTK.Platform.X11
try
{
Functions.XLockDisplay(display);
//Functions.XLockDisplay(display);
int screen = Functions.XDefaultScreen(display);
IntPtr root = Functions.XRootWindow(display, screen);
@ -122,7 +122,7 @@ namespace OpenTK.Platform.X11
}
finally
{
Functions.XUnlockDisplay(display);
//Functions.XUnlockDisplay(display);
}
// Prepare Windows.Forms for creating OpenGL drawables.