diff --git a/Source/OpenTK/Platform/X11/API.cs b/Source/OpenTK/Platform/X11/API.cs index 1f06000b..7220005e 100644 --- a/Source/OpenTK/Platform/X11/API.cs +++ b/Source/OpenTK/Platform/X11/API.cs @@ -739,6 +739,57 @@ XF86VidModeGetGammaRampSize( public const int CWX = 1; public const int InputOutput = 1; public const int InputOnly = 2; + + /* The hints we recognize */ + public const string XA_WIN_PROTOCOLS = "_WIN_PROTOCOLS"; + public const string XA_WIN_ICONS = "_WIN_ICONS"; + public const string XA_WIN_WORKSPACE = "_WIN_WORKSPACE"; + public const string XA_WIN_WORKSPACE_COUNT = "_WIN_WORKSPACE_COUNT"; + public const string XA_WIN_WORKSPACE_NAMES = "_WIN_WORKSPACE_NAMES"; + public const string XA_WIN_LAYER = "_WIN_LAYER"; + public const string XA_WIN_STATE = "_WIN_STATE"; + public const string XA_WIN_HINTS = "_WIN_HINTS"; + public const string XA_WIN_WORKAREA = "_WIN_WORKAREA"; + public const string XA_WIN_CLIENT_LIST = "_WIN_CLIENT_LIST"; + public const string XA_WIN_APP_STATE = "_WIN_APP_STATE"; + public const string XA_WIN_EXPANDED_SIZE = "_WIN_EXPANDED_SIZE"; + public const string XA_WIN_CLIENT_MOVING = "_WIN_CLIENT_MOVING"; + public const string XA_WIN_SUPPORTING_WM_CHECK = "_WIN_SUPPORTING_WM_CHECK"; + } + + public enum WindowLayer + { + Desktop = 0, + Below = 2, + Normal = 4, + OnTop = 6, + Dock = 8, + AboveDock = 10, + Menu = 12, + } + + public enum WindowState + { + Sticky = (1<<0), /* everyone knows sticky */ + Minimized = (1<<1), /* ??? */ + MaximizedVertically = (1<<2), /* window in maximized V state */ + MaximizedHorizontally = (1<<3), /* window in maximized H state */ + Hidden = (1<<4), /* not on taskbar but window visible */ + Shaded = (1<<5), /* shaded (NeXT style), */ + HID_WORKSPACE = (1<<6), /* not on current desktop */ + HID_TRANSIENT = (1<<7), /* owner of transient is hidden */ + FixedPosition = (1<<8), /* window is fixed in position even */ + ArrangeIgnore = (1<<9), /* ignore for auto arranging */ + } + + public enum WindowHints + { + SkipFocus = (1<<0), /* "alt-tab" skips this win */ + SkipWinlist = (1<<1), /* not in win list */ + SkipTaskbar = (1<<2), /* not on taskbar */ + GroupTransient = (1<<3), /* ??????? */ + FocusOnClick = (1<<4), /* app only accepts focus when clicked */ + DoNotCover = (1<<5), /* attempt to not cover this window */ } public enum ErrorCodes : int diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index 4d4ee5c4..7c61ee22 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -38,7 +38,6 @@ namespace OpenTK.Platform.X11 // Window manager hints for fullscreen windows. private const string MOTIF_WM_ATOM = "_MOTIF_WM_HINTS"; - private const string GNOME_WM_ATOM = "_WIN_HINTS"; private const string KDE_WM_ATOM = "KWM_WIN_DECORATION"; private const string KDE_NET_WM_ATOM = "_KDE_NET_WM_WINDOW_TYPE"; private const string ICCM_WM_ATOM = "_NET_WM_WINDOW_TYPE"; @@ -257,8 +256,8 @@ namespace OpenTK.Platform.X11 pre_fullscreen_height = this.Height; pre_fullscreen_width = this.Width; //Functions.XRaiseWindow(this.window.Display, this.Handle); - Functions.XMoveResizeWindow(this.window.Display, this.Handle, 0, 25, this.Width, this.Height); - //DisplayDevice.PrimaryDisplay.Width, DisplayDevice.PrimaryDisplay.Height); + Functions.XMoveResizeWindow(this.window.Display, this.Handle, 0, 0, + DisplayDevice.PrimaryDisplay.Width, DisplayDevice.PrimaryDisplay.Height); Debug.Unindent(); fullscreen = true; } @@ -716,10 +715,6 @@ namespace OpenTK.Platform.X11 Functions.XSetTransientForHint(this.window.Display, this.Handle, this.window.RootWindow); Functions.XUnmapWindow(this.window.Display, this.Handle); Functions.XMapWindow(this.window.Display, this.Handle); - - XSetWindowAttributes attr = new XSetWindowAttributes(); - attr.override_redirect = true; - Functions.XChangeWindowAttributes(this.window.Display, this.Handle, ChangeWindowAttributes.OverrideRedirect, ref attr); } } @@ -745,7 +740,25 @@ namespace OpenTK.Platform.X11 bool DisableGnomeDecorations() { - IntPtr atom = Functions.XInternAtom(this.window.Display, GNOME_WM_ATOM, true); + // 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; @@ -753,6 +766,7 @@ namespace OpenTK.Platform.X11 Marshal.SizeOf(hints) / 4); return true; } + return false; } @@ -788,7 +802,7 @@ namespace OpenTK.Platform.X11 if (activated) { - Functions.XSetTransientForHint(this.window.Display, this.Handle, IntPtr.Zero); + Functions.XSetTransientForHint(this.window.Display, this.Handle, this.window.RootWindow); Functions.XUnmapWindow(this.window.Display, this.Handle); Functions.XMapWindow(this.window.Display, this.Handle); } @@ -813,12 +827,22 @@ namespace OpenTK.Platform.X11 bool EnableGnomeDecorations() { - IntPtr atom = Functions.XInternAtom(this.window.Display, GNOME_WM_ATOM, true); + // Restore window layer. + //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); + + IntPtr atom = Functions.XInternAtom(this.window.Display, Constants.XA_WIN_HINTS, true); if (atom != IntPtr.Zero) { Functions.XDeleteProperty(this.window.Display, this.Handle, atom); return true; } + return false; }