[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/Xsharp/Types XClassHint.cs, NONE, 1.1 XTex
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/Xsharp/Types XClassHint.cs, NONE, 1.1 XTextProperty.cs, NONE, 1.1 |
Date: |
Wed, 03 Dec 2003 02:32:48 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Types
In directory subversions:/tmp/cvs-serv4939/Xsharp/Types
Added Files:
XClassHint.cs XTextProperty.cs
Log Message:
Add some more ICCCM hints like WM_LOCALE, WM_CLIENT_MACHINE, WM_COMMAND,
WM_CLASS, etc; fix the behaviour of the "IconicState" hint; add the window
group hint; make the "-iconic", "-name", and "-synchronous" Xt command-line
options work correctly.
--- NEW FILE: XTextProperty.cs ---
/*
* XTextProperty.cs - Definition of text property blocks.
*
* 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.Types
{
using System;
using System.Runtime.InteropServices;
// Window manager hint structure.
[StructLayout(LayoutKind.Sequential)]
internal struct XTextProperty
{
// Structure fields.
public IntPtr value__;
public Xlib.Atom encoding__;
public Xlib.Xint format__;
public Xlib.Xulong nitems__;
// Set this text property to a particular string.
public bool SetText(String value)
{
if(value == null)
{
value = String.Empty;
}
IntPtr str = Marshal.StringToHGlobalAnsi(value);
if(str == IntPtr.Zero)
{
return false;
}
if(Xlib.XStringListToTextProperty(ref str, 1,
ref this)
== Xlib.Status.Zero)
{
Marshal.FreeHGlobal(str);
return false;
}
Marshal.FreeHGlobal(str);
return true;
}
public bool SetText(String[] value)
{
// Bail out early if we don't have any strings.
if(value == null || value.Length == 0)
{
return SetText("");
}
// Convert the strings into an array of
pointers.
IntPtr[] strings = new IntPtr [value.Length];
int posn;
String str;
for(posn = 0; posn < value.Length; ++posn)
{
str = value[posn];
if(str == null)
{
str = String.Empty;
}
strings[posn] =
Marshal.StringToHGlobalAnsi(str);
}
// Convert the string list into a text property.
bool result = (Xlib.XStringListToTextProperty
(strings, value.Length, ref this) !=
Xlib.Status.Zero);
// Free the strings, which we no longer require.
for(posn = 0; posn < value.Length; ++posn)
{
Marshal.FreeHGlobal(strings[posn]);
}
return result;
}
// Free this text property.
public void Free()
{
if(value__ != IntPtr.Zero)
{
Xlib.XFree(value__);
value__ = IntPtr.Zero;
}
}
} // struct XTextProperty
} // namespace Xsharp.Types
--- NEW FILE: XClassHint.cs ---
/*
* XClassHint.cs - Definition of class hint information.
*
* 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.Types
{
using System;
using System.Runtime.InteropServices;
// Window manager hint structure.
[StructLayout(LayoutKind.Sequential)]
internal struct XClassHint
{
// Structure fields.
public IntPtr res_name__;
public IntPtr res_class__;
// Convert odd fields into types that are useful.
public String res_name
{
get
{
return
Marshal.PtrToStringAnsi(res_name__);
}
set
{
if(res_name__ != IntPtr.Zero)
{
Marshal.FreeHGlobal(res_name__);
}
res_name__ =
Marshal.StringToHGlobalAnsi(value);
}
}
public String res_class
{
get
{
return
Marshal.PtrToStringAnsi(res_class__);
}
set
{
if(res_class__ != IntPtr.Zero)
{
Marshal.FreeHGlobal(res_class__);
}
res_class__ =
Marshal.StringToHGlobalAnsi(value);
}
}
// Free the members of this structure.
public void Free()
{
res_name = null;
res_class = null;
}
} // struct XClassHint
} // namespace Xsharp.Types
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/Xsharp/Types XClassHint.cs, NONE, 1.1 XTextProperty.cs, NONE, 1.1,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] pnet ChangeLog, 1.2816, 1.2817 configure.in, 1.157, 1.158
- Next by Date:
[Dotgnu-pnet-commits] pnetlib ChangeLog,1.1587,1.1588
- Previous by thread:
[Dotgnu-pnet-commits] pnet ChangeLog, 1.2816, 1.2817 configure.in, 1.157, 1.158
- Next by thread:
[Dotgnu-pnet-commits] pnetlib ChangeLog,1.1587,1.1588
- Index(es):