[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/Xsharp OtherHints.cs, NONE, 1.1 MotifDecor
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/Xsharp OtherHints.cs, NONE, 1.1 MotifDecorations.cs, 1.1, 1.2 MotifFunctions.cs, 1.1, 1.2 TopLevelWindow.cs, 1.15, 1.16 |
Date: |
Tue, 02 Dec 2003 11:04:20 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv30896/Xsharp
Modified Files:
MotifDecorations.cs MotifFunctions.cs TopLevelWindow.cs
Added Files:
OtherHints.cs
Log Message:
Add some more window hints from the standards at "freedesktop.org".
Index: TopLevelWindow.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/TopLevelWindow.cs,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** TopLevelWindow.cs 2 Dec 2003 07:28:06 -0000 1.15
--- TopLevelWindow.cs 2 Dec 2003 11:04:18 -0000 1.16
***************
*** 23,26 ****
--- 23,27 ----
using System;
+ using System.Text;
using System.Runtime.InteropServices;
using Xsharp.Types;
***************
*** 45,48 ****
--- 46,50 ----
private MotifFunctions functions;
private MotifInputType inputType;
+ private OtherHints otherHints;
private TopLevelWindow transientFor;
private Timer resizeTimer;
***************
*** 144,149 ****
// Set the title bar and icon names.
! Xlib.XStoreName(display, handle, name);
! Xlib.XSetIconName(display, handle,
name);
// Ask for "WM_DELETE_WINDOW" and
"WM_TAKE_FOCUS".
--- 146,150 ----
// Set the title bar and icon names.
! SetWindowName(display, handle,
this.name);
// Ask for "WM_DELETE_WINDOW" and
"WM_TAKE_FOCUS".
***************
*** 192,196 ****
private void SetProtocols(IntPtr display, Xlib.Window handle)
{
! if(hasHelpButton)
{
Xlib.Atom[] protocols = new Xlib.Atom
[3];
--- 193,197 ----
private void SetProtocols(IntPtr display, Xlib.Window handle)
{
! if((otherHints & OtherHints.HelpButton) != 0)
{
Xlib.Atom[] protocols = new Xlib.Atom
[3];
***************
*** 209,212 ****
--- 210,237 ----
}
+ // Set the window name hints.
+ private void SetWindowName(IntPtr display, Xlib.Window handle, String
name)
+ {
+ // Set the ICCCM name hints.
+ Xlib.XStoreName(display, handle, name);
+ Xlib.XSetIconName(display, handle, name);
+
+ // Set the new-style name hints, in UTF-8.
These are more
+ // likely to be rendered properly by newer
window managers.
+ Xlib.Atom utf8String = Xlib.XInternAtom
+ (display, "UTF8_STRING",
Xlib.Bool.False);
+ Xlib.Atom wmName = Xlib.XInternAtom
+ (display, "_NET_WM_NAME",
Xlib.Bool.False);
+ Xlib.Atom wmIconName = Xlib.XInternAtom
+ (display, "_NET_WM_ICON_NAME",
Xlib.Bool.False);
+ byte[] bytes = Encoding.UTF8.GetBytes(name);
+ Xlib.XChangeProperty
+ (display, handle, wmName, utf8String,
+ 8, 0 /* PropModeReplace */, bytes,
bytes.Length);
+ Xlib.XChangeProperty
+ (display, handle, wmIconName,
utf8String,
+ 8, 0 /* PropModeReplace */, bytes,
bytes.Length);
+ }
+
// Construct the XSizeHints structure for this window.
private XSizeHints BuildSizeHints(int x, int y, int width, int height)
***************
*** 543,548 ****
// Set the title bar
and icon names.
!
Xlib.XStoreName(display, handle, name);
!
Xlib.XSetIconName(display, handle, name);
}
finally
--- 568,572 ----
// Set the title bar
and icon names.
! SetWindowName(display,
handle, name);
}
finally
***************
*** 682,710 ****
/// <summary>
! /// <para>Get or set the state of the "help" button in
! /// the window's caption bar.</para>
/// </summary>
///
/// <value>
! /// <para>The value of this property is the help button state. The
window
! /// manager might ignore this information if it does not support the
! /// <c>_NET_WM_CONTEXT_HELP</c> protocol.</para>
/// </value>
! public bool HasHelpButton
{
get
{
! return hasHelpButton;
}
set
{
! if(hasHelpButton != value)
{
! hasHelpButton = value;
try
{
IntPtr display =
dpy.Lock();
Xlib.Window handle =
GetWidgetHandle();
! SetProtocols(display,
handle);
}
finally
--- 706,824 ----
/// <summary>
! /// <para>Get or set the other hints for the window.</para>
/// </summary>
///
/// <value>
! /// <para>The value of this property is the hint flags. The window
! /// manager might ignore this information.</para>
/// </value>
! public OtherHints OtherHints
{
get
{
! return otherHints;
}
set
{
! if(otherHints != value)
{
! OtherHints prev = otherHints;
! otherHints = value;
try
{
IntPtr display =
dpy.Lock();
Xlib.Window handle =
GetWidgetHandle();
!
! // Change the state of
the help button.
! if((prev &
OtherHints.HelpButton) !=
! (value
& OtherHints.HelpButton))
! {
!
SetProtocols(display, handle);
! }
!
! // Set the window type.
! Xlib.Atom type;
! if((value &
OtherHints.ToolWindow) != 0)
! {
! type =
Xlib.XInternAtom
!
(display,
!
"_NET_WM_WINDOW_TYPE_UTILITY",
!
Xlib.Bool.False);
! }
! else if((value &
OtherHints.Dialog) != 0)
! {
! type =
Xlib.XInternAtom
!
(display,
!
"_NET_WM_WINDOW_TYPE_DIALOG",
!
Xlib.Bool.False);
! }
! else
! {
! type =
Xlib.XInternAtom
!
(display,
!
"_NET_WM_WINDOW_TYPE_NORMAL",
!
Xlib.Bool.False);
! }
! Xlib.Atom wmType =
Xlib.XInternAtom
! (display,
"_NET_WM_WINDOW_TYPE",
!
Xlib.Bool.False);
! Xlib.Atom wmAtom =
Xlib.XInternAtom
! (display,
"ATOM", Xlib.Bool.False);
! Xlib.Xlong[] data = new
Xlib.Xlong [2];
! data[0] =
(Xlib.Xlong)type;
! Xlib.XChangeProperty
! (display,
handle, wmType, wmAtom,
! 32, 0 /*
PropModeReplace */, data, 1);
!
! // Set the window
state, which we can only do
! // before it is first
mapped at present.
! if(!firstMapDone)
! {
! data[0] =
Xlib.Xlong.Zero;
! data[1] =
Xlib.Xlong.Zero;
! if((value &
OtherHints.HideFromTaskBar) != 0)
! {
! data[0]
= (Xlib.Xlong)Xlib.XInternAtom
!
(display,
!
"_NET_WM_STATE_SKIP_TASKBAR",
!
Xlib.Bool.False);
! }
! if((value &
OtherHints.TopMost) != 0)
! {
! type =
Xlib.XInternAtom
!
(display,
!
"_NET_WM_STATE_ABOVE",
!
Xlib.Bool.False);
!
if(data[0] == Xlib.Xlong.Zero)
! {
!
data[0] = (Xlib.Xlong)type;
! }
! else
! {
!
data[1] = (Xlib.Xlong)type;
! }
! }
! wmType =
Xlib.XInternAtom
!
(display, "_NET_WM_STATE",
!
Xlib.Bool.False);
! if(data[0] !=
Xlib.Xlong.Zero &&
! data[1] !=
Xlib.Xlong.Zero)
! {
!
Xlib.XChangeProperty
!
(display, handle, wmType, wmAtom,
!
32, 0 /* PropModeReplace */, data, 2);
! }
! else if(data[0]
!= Xlib.Xlong.Zero)
! {
!
Xlib.XChangeProperty
!
(display, handle, wmType, wmAtom,
!
32, 0 /* PropModeReplace */, data, 1);
! }
! else
! {
!
Xlib.XDeleteProperty
!
(display, handle, wmType);
! }
! }
}
finally
Index: MotifDecorations.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/MotifDecorations.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MotifDecorations.cs 6 Jun 2003 12:59:44 -0000 1.1
--- MotifDecorations.cs 2 Dec 2003 11:04:18 -0000 1.2
***************
*** 28,32 ****
/// flags for the window manager, to indicate which window decorations
/// are desired by the application.</para>
- /// </para>
/// </summary>
///
--- 28,31 ----
***************
*** 36,39 ****
--- 35,39 ----
/// then it indicates only those decorations that are explicitly
listed.</para>
/// </remarks>
+ [Flags]
public enum MotifDecorations
{
--- NEW FILE: OtherHints.cs ---
/*
* OtherHints.cs - Other window manager hint 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.OtherHints"/> enumeration specifies
/// hint flags for the window manager, to specify physical styles.</para>
/// </summary>
[Flags]
public enum OtherHints
{
None = 0,
ToolWindow = (1 << 0),
HideFromTaskBar = (1 << 1),
HelpButton = (1 << 2),
Dialog = (1 << 3),
TopMost = (1 << 4),
} // enum OtherHints
} // namespace Xsharp
Index: MotifFunctions.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/MotifFunctions.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MotifFunctions.cs 6 Jun 2003 12:59:44 -0000 1.1
--- MotifFunctions.cs 2 Dec 2003 11:04:18 -0000 1.2
***************
*** 28,32 ****
/// flags for the window manager, to indicate which window functions
/// are desired by the application.</para>
- /// </para>
/// </summary>
///
--- 28,31 ----
***************
*** 36,39 ****
--- 35,39 ----
/// then it indicates only those functions that are explicitly listed.</para>
/// </remarks>
+ [Flags]
public enum MotifFunctions
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/Xsharp OtherHints.cs, NONE, 1.1 MotifDecorations.cs, 1.1, 1.2 MotifFunctions.cs, 1.1, 1.2 TopLevelWindow.cs, 1.15, 1.16,
Rhys Weatherley <address@hidden> <=