[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp MotifDecorations.cs,NONE,1.1 M
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp MotifDecorations.cs,NONE,1.1 MotifFunctions.cs,NONE,1.1 MotifInputType.cs,NONE,1.1 Display.cs,1.1,1.2 TopLevelWindow.cs,1.2,1.3 Widget.cs,1.2,1.3 Xlib.cs.in,1.2,1.3 |
Date: |
Fri, 06 Jun 2003 08:59:46 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv32393/Xsharp
Modified Files:
Display.cs TopLevelWindow.cs Widget.cs Xlib.cs.in
Added Files:
MotifDecorations.cs MotifFunctions.cs MotifInputType.cs
Log Message:
Implement "Raise", "Lower", and Motif window manager hints.
--- NEW FILE ---
/*
* MotifDecorations.cs - Motif window manager decoration flags.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace Xsharp
{
using System;
/// <summary>
/// <para>The <see cref="T:Xsharp.MotifDecorations"/> enumeration specifies
/// flags for the window manager, to indicate which window decorations
/// are desired by the application.</para>
/// </para>
/// </summary>
///
/// <remarks>
/// <para>If <c>All</c> is specified, then it indicates all decorations
/// except those explicitly listed. If <c>All</c> is not specified,
/// then it indicates only those decorations that are explicitly listed.</para>
/// </remarks>
public enum MotifDecorations
{
All = (1 << 0),
Border = (1 << 1),
ResizeHandles = (1 << 2),
Title = (1 << 3),
Menu = (1 << 4),
Minimize = (1 << 5),
Maximize = (1 << 6),
} // enum MotifDecorations
} // namespace Xsharp
--- NEW FILE ---
/*
* MotifFunctions.cs - Motif window manager function flags.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace Xsharp
{
using System;
/// <summary>
/// <para>The <see cref="T:Xsharp.MotifFunctions"/> enumeration specifies
/// flags for the window manager, to indicate which window functions
/// are desired by the application.</para>
/// </para>
/// </summary>
///
/// <remarks>
/// <para>If <c>All</c> is specified, then it indicates all functions
/// except those explicitly listed. If <c>All</c> is not specified,
/// then it indicates only those functions that are explicitly listed.</para>
/// </remarks>
public enum MotifFunctions
{
All = (1 << 0),
Resize = (1 << 1),
Move = (1 << 2),
Minimize = (1 << 3),
Maximize = (1 << 4),
Close = (1 << 5),
} // enum MotifFunctions
} // namespace Xsharp
--- NEW FILE ---
/*
* MotifInputType.cs - Motif window manager input types.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace Xsharp
{
using System;
/// <summary>
/// <para>The <see cref="T:Xsharp.MotifInputType"/> enumeration specifies
/// the type of a top-level window (modal, modeless, etc).</para>
/// </summary>
public enum MotifInputType
{
Normal = -1,
Modeless = 0,
ApplicationModal = 1,
SystemModal = 2,
FullApplicationModal = 3,
} // enum MotifInputType
} // namespace Xsharp
Index: Display.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Display.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Display.cs 28 May 2003 04:17:53 -0000 1.1
--- Display.cs 6 Jun 2003 12:59:44 -0000 1.2
***************
*** 54,57 ****
--- 54,58 ----
internal Xlib.Atom wmDeleteWindow;
internal Xlib.Atom wmTakeFocus;
+ internal Xlib.Atom wmMwmHints;
internal ButtonName selectButton;
internal ButtonName menuButton;
***************
*** 98,101 ****
--- 99,104 ----
wmTakeFocus = Xlib.XInternAtom
(dpy, "WM_TAKE_FOCUS", Xlib.Bool.False);
+ wmMwmHints = Xlib.XInternAtom
+ (dpy, "_MOTIF_WM_HINTS",
Xlib.Bool.False);
// Which buttons should we use for "Select" and
"Menu"?
Index: TopLevelWindow.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/TopLevelWindow.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** TopLevelWindow.cs 6 Jun 2003 10:46:45 -0000 1.2
--- TopLevelWindow.cs 6 Jun 2003 12:59:44 -0000 1.3
***************
*** 40,43 ****
--- 40,47 ----
private InputOnlyWidget focusWidget;
private InputOnlyWidget defaultFocus;
+ private MotifDecorations decorations;
+ private MotifFunctions functions;
+ private MotifInputType inputType;
+ private TopLevelWindow transientFor;
/// <summary>
***************
*** 115,118 ****
--- 119,126 ----
this.focusWidget = this;
this.defaultFocus = null;
+ this.decorations = MotifDecorations.All;
+ this.functions = MotifFunctions.All;
+ this.inputType = MotifInputType.Normal;
+ this.transientFor = null;
// Set the initial WM properties.
***************
*** 364,367 ****
--- 372,545 ----
}
+ // Update the Motif hint information in the X server.
+ private void UpdateMotifHints()
+ {
+ // Build the Motif hint structure.
+ Xlib.Xlong[] hint = new Xlib.Xlong [5];
+ int flags = 0;
+ if(functions != MotifFunctions.All)
+ {
+ hint[1] = (Xlib.Xlong)(int)functions;
+ flags |= 1;
+ }
+ else
+ {
+ hint[1] = (Xlib.Xlong)(-1);
+ }
+ if(decorations != MotifDecorations.All)
+ {
+ hint[2] = (Xlib.Xlong)(int)decorations;
+ flags |= 2;
+ }
+ else
+ {
+ hint[2] = (Xlib.Xlong)(-1);
+ }
+ if(inputType != MotifInputType.Normal)
+ {
+ hint[3] = (Xlib.Xlong)(int)inputType;
+ flags |= 4;
+ }
+ else
+ {
+ hint[3] = (Xlib.Xlong)(-1);
+ }
+ hint[4] = (Xlib.Xlong)(-1);
+ hint[0] = (Xlib.Xlong)flags;
+
+ // Set the Motif hint structure on the window.
+ try
+ {
+ IntPtr display = dpy.Lock();
+ Xlib.Window handle = GetWidgetHandle();
+ Xlib.XChangeProperty
+ (display, handle,
dpy.wmMwmHints, dpy.wmMwmHints,
+ 32, 0 /* PropModeReplace */,
hint, 4);
+ }
+ finally
+ {
+ dpy.Unlock();
+ }
+ }
+
+ /// <summary>
+ /// <para>Get or set the decorations to display on the window's
+ /// border.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>The value of this property is the set of decorations
+ /// that the window desires from the window manager. The window
+ /// manager might ignore this information.</para>
+ /// </value>
+ public MotifDecorations Decorations
+ {
+ get
+ {
+ return decorations;
+ }
+ set
+ {
+ if(decorations != value)
+ {
+ decorations = value;
+ UpdateMotifHints();
+ }
+ }
+ }
+
+ /// <summary>
+ /// <para>Get or set the functions to display on the window's
+ /// context menu.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>The value of this property is the set of functions
+ /// that the window desires from the window manager. The window
+ /// manager might ignore this information.</para>
+ /// </value>
+ public MotifFunctions Functions
+ {
+ get
+ {
+ return functions;
+ }
+ set
+ {
+ if(functions != value)
+ {
+ functions = value;
+ UpdateMotifHints();
+ }
+ }
+ }
+
+ /// <summary>
+ /// <para>Get or set the input type for the window.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>The value of this property is the input type. The window
+ /// manager might ignore this information.</para>
+ /// </value>
+ public MotifInputType InputType
+ {
+ get
+ {
+ return inputType;
+ }
+ set
+ {
+ if(inputType != value)
+ {
+ inputType = value;
+ UpdateMotifHints();
+ }
+ }
+ }
+
+ /// <summary>
+ /// <para>Get or set the transient parent window.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>The transient parent window, or <see langword="null"/>
+ /// if there is no transient parent.</para>
+ /// </value>
+ ///
+ /// <remarks>
+ /// <para>Setting this property to <see langword="null"/> or the
+ /// current widget will have no effect.</para>
+ /// </remarks>
+ public TopLevelWindow TransientFor
+ {
+ get
+ {
+ return transientFor;
+ }
+ set
+ {
+ if(value != null && value !=
transientFor && value != this)
+ {
+ // Change the "transient for"
hint information.
+ try
+ {
+ // Lock down the
display and get the handles.
+ IntPtr display =
dpy.Lock();
+ Xlib.Window handle =
GetWidgetHandle();
+ Xlib.Window thandle =
+
transientFor.GetWidgetHandle();
+
+ // Set the "transient
for" hint.
+
Xlib.XSetTransientForHint(display, handle, thandle);
+ }
+ finally
+ {
+ dpy.Unlock();
+ }
+ }
+ }
+ }
+
/// <summary>
/// <para>Get or set the child widget that gets the keyboard focus
***************
*** 423,426 ****
--- 601,652 ----
{
return true;
+ }
+
+ /// <summary>
+ /// <para>Raise this widget to the top of its layer.</para>
+ /// </summary>
+ public override void Raise()
+ {
+ try
+ {
+ // Send a message to the window manager
to restack us.
+ IntPtr display = dpy.Lock();
+ Xlib.Window handle = GetWidgetHandle();
+ XWindowChanges changes = new
XWindowChanges();
+ changes.stack_mode = 0; /*
Above */
+ Xlib.XReconfigureWMWindow
+ (display,
GetWidgetHandle(),
+ Screen.ScreenNumber,
+
(uint)(ConfigureWindowMask.CWStackMode),
+ ref changes);
+ }
+ finally
+ {
+ dpy.Unlock();
+ }
+ }
+
+ /// <summary>
+ /// <para>Lower this widget to the bottom of its layer.</para>
+ /// </summary>
+ public override void Lower()
+ {
+ try
+ {
+ // Send a message to the window manager
to restack us.
+ IntPtr display = dpy.Lock();
+ Xlib.Window handle = GetWidgetHandle();
+ XWindowChanges changes = new
XWindowChanges();
+ changes.stack_mode = 1; /*
Below */
+ Xlib.XReconfigureWMWindow
+ (display,
GetWidgetHandle(),
+ Screen.ScreenNumber,
+
(uint)(ConfigureWindowMask.CWStackMode),
+ ref changes);
+ }
+ finally
+ {
+ dpy.Unlock();
+ }
}
Index: Widget.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Widget.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Widget.cs 6 Jun 2003 10:46:45 -0000 1.2
--- Widget.cs 6 Jun 2003 12:59:44 -0000 1.3
***************
*** 730,733 ****
--- 730,781 ----
/// <summary>
+ /// <para>Raise this widget to the top of its layer.</para>
+ /// </summary>
+ public virtual void Raise()
+ {
+ Widget sibling = nextAbove;
+ Widget last = this;
+ while(sibling != null && sibling.layer == layer)
+ {
+ last = sibling;
+ sibling = sibling.nextAbove;
+ }
+ if(sibling != null)
+ {
+ MoveToBelow(sibling);
+ RepositionBelow(sibling);
+ }
+ else if(last != this)
+ {
+ MoveToAbove(last);
+ RepositionAbove(last);
+ }
+ }
+
+ /// <summary>
+ /// <para>Lower this widget to the bottom of its layer.</para>
+ /// </summary>
+ public virtual void Lower()
+ {
+ Widget sibling = nextBelow;
+ Widget last = this;
+ while(sibling != null && sibling.layer == layer)
+ {
+ last = sibling;
+ sibling = sibling.nextBelow;
+ }
+ if(sibling != null)
+ {
+ MoveToAbove(sibling);
+ RepositionAbove(sibling);
+ }
+ else if(last != this)
+ {
+ MoveToBelow(last);
+ RepositionBelow(last);
+ }
+ }
+
+ /// <summary>
/// <para>Move this widget to a new location relative to its
parent.</para>
/// </summary>
Index: Xlib.cs.in
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Xlib.cs.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Xlib.cs.in 6 Jun 2003 07:47:06 -0000 1.2
--- Xlib.cs.in 6 Jun 2003 12:59:44 -0000 1.3
***************
*** 419,422 ****
--- 419,431 ----
(IntPtr display, Xlib.Window w, Atom[] protocols,
@X_int@ count);
+ [DllImport("X11")]
+ extern public static @X_int@ XReconfigureWMWindow
+ (IntPtr display, Window w, @X_int@ screen_number,
+ @X_uint@ value_mask, ref XWindowChanges changes);
+
+ [DllImport("X11")]
+ extern public static @X_int@ XSetTransientForHint
+ (IntPtr display, Window w, Window prop_window);
+
// Declare color-related external functions.
***************
*** 450,453 ****
--- 459,480 ----
[DllImport("X11")]
extern public static void XFreeFontSet(IntPtr display, IntPtr fontSet);
+
+ // Declare property-related external functions.
+
+ [DllImport("X11")]
+ extern public static @X_int@ XChangeProperty
+ (IntPtr display, Window w, Atom property,
+ Atom type, @X_int@ format, @X_int@ mode,
+ byte[] data, @X_int@ nelements);
+
+ [DllImport("X11")]
+ extern public static @X_int@ XChangeProperty
+ (IntPtr display, Window w, Atom property,
+ Atom type, @X_int@ format, @X_int@ mode,
+ Xlong[] data, @X_int@ nelements);
+
+ [DllImport("X11")]
+ extern public static @X_int@ XDeleteProperty
+ (IntPtr display, Window w, Atom property);
} // class Xlib
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/Xsharp MotifDecorations.cs,NONE,1.1 MotifFunctions.cs,NONE,1.1 MotifInputType.cs,NONE,1.1 Display.cs,1.1,1.2 TopLevelWindow.cs,1.2,1.3 Widget.cs,1.2,1.3 Xlib.cs.in,1.2,1.3,
Rhys Weatherley <address@hidden> <=