2004-02-12 18:45:19 +00:00
|
|
|
// Global.custom - customizations to Gdk.Global
|
|
|
|
//
|
|
|
|
// Authors: Mike Kestner <mkestner@ximian.com>
|
2004-04-16 17:31:30 +00:00
|
|
|
// Boyd Timothy <btimothy@novell.com>
|
2004-02-12 18:45:19 +00:00
|
|
|
//
|
|
|
|
// Copyright (c) 2004 Novell, Inc.
|
2004-06-25 18:42:19 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of version 2 of the Lesser GNU General
|
|
|
|
// Public License as published by the Free Software Foundation.
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser 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.
|
2004-02-12 18:45:19 +00:00
|
|
|
|
2011-02-10 05:39:39 +00:00
|
|
|
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
2004-02-12 18:45:19 +00:00
|
|
|
static extern IntPtr gdk_devices_list ();
|
|
|
|
|
|
|
|
public static Device[] DevicesList ()
|
|
|
|
{
|
|
|
|
IntPtr raw_ret = gdk_devices_list ();
|
|
|
|
if (raw_ret == IntPtr.Zero)
|
|
|
|
return new Device [0];
|
|
|
|
GLib.List list = new GLib.List(raw_ret);
|
|
|
|
Device[] result = new Device [list.Count];
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
|
|
result [i] = list [i] as Device;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-02-10 05:39:39 +00:00
|
|
|
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
2004-02-12 18:45:19 +00:00
|
|
|
static extern IntPtr gdk_list_visuals ();
|
|
|
|
|
|
|
|
public static Visual[] ListVisuals ()
|
|
|
|
{
|
|
|
|
IntPtr raw_ret = gdk_list_visuals ();
|
|
|
|
if (raw_ret == IntPtr.Zero)
|
|
|
|
return new Visual [0];
|
|
|
|
GLib.List list = new GLib.List(raw_ret);
|
|
|
|
Visual[] result = new Visual [list.Count];
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
|
|
result [i] = list [i] as Visual;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2004-04-16 17:31:30 +00:00
|
|
|
public static Gdk.Atom[] SupportedWindowManagerHints {
|
|
|
|
get {
|
2009-03-17 18:40:35 +00:00
|
|
|
Gdk.Atom[] atoms;
|
|
|
|
if (!Gdk.Property.Get (Screen.Default.RootWindow, Atom.Intern ("_NET_SUPPORTED", false), false, out atoms))
|
|
|
|
throw new ApplicationException ("Unable to get _NET_SUPPORTED property");
|
2004-04-16 17:31:30 +00:00
|
|
|
|
|
|
|
return atoms;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-31 04:49:15 +00:00
|
|
|
#if FIXME30
|
2004-04-16 17:31:30 +00:00
|
|
|
public static Gdk.Window[] WindowManagerClientWindows {
|
|
|
|
get {
|
2009-03-17 18:40:35 +00:00
|
|
|
Gdk.Window [] windows;
|
|
|
|
if (!Gdk.Property.Get (Screen.Default.RootWindow, Atom.Intern ("_NET_CLIENT_LIST", false), false, out windows))
|
|
|
|
throw new ApplicationException ("Unable to get _NET_CLIENT_LIST property");
|
|
|
|
|
2004-04-16 17:31:30 +00:00
|
|
|
return windows;
|
|
|
|
}
|
|
|
|
}
|
2011-01-31 04:49:15 +00:00
|
|
|
#endif
|
2004-04-16 17:31:30 +00:00
|
|
|
|
|
|
|
public static int NumberOfDesktops {
|
|
|
|
get {
|
2009-03-17 18:40:35 +00:00
|
|
|
int[] data;
|
|
|
|
if (!Gdk.Property.Get (Screen.Default.RootWindow, Atom.Intern ("_NET_NUMBER_OF_DESKTOPS", false), false, out data))
|
|
|
|
throw new ApplicationException ("Unable to get _NET_NUMBER_OF_DESKTOPS property");
|
|
|
|
|
|
|
|
return data [0];
|
2004-04-16 17:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int CurrentDesktop {
|
|
|
|
get {
|
2009-03-17 18:40:35 +00:00
|
|
|
int[] data;
|
|
|
|
if (!Gdk.Property.Get (Screen.Default.RootWindow, Atom.Intern ("_NET_CURRENT_DESKTOP", false), false, out data))
|
|
|
|
throw new ApplicationException ("Unable to get _NET_CURRENT_DESKTOP property");
|
|
|
|
|
|
|
|
return data [0];
|
2004-04-16 17:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-31 04:49:15 +00:00
|
|
|
#if FIXME30
|
2004-04-16 17:31:30 +00:00
|
|
|
public static Gdk.Window ActiveWindow {
|
|
|
|
get {
|
2009-03-17 18:40:35 +00:00
|
|
|
Gdk.Window [] windows;
|
|
|
|
if (!Gdk.Property.Get (Screen.Default.RootWindow, Atom.Intern ("_NET_ACTIVE_WINDOW", false), false, out windows))
|
|
|
|
throw new ApplicationException ("Unable to get _NET_ACTIVE_WINDOW property");
|
|
|
|
|
|
|
|
return windows [0];
|
2004-04-16 17:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-31 04:49:15 +00:00
|
|
|
#endif
|
2004-04-16 17:31:30 +00:00
|
|
|
|
|
|
|
public static Gdk.Rectangle[] DesktopWorkareas {
|
|
|
|
get {
|
2009-03-17 18:40:35 +00:00
|
|
|
Gdk.Rectangle[] workareas;
|
|
|
|
if (!Gdk.Property.Get (Screen.Default.RootWindow, Atom.Intern ("_NET_WORKAREA", false), false, out workareas))
|
|
|
|
throw new ApplicationException ("Unable to get _NET_WORKAREA property");
|
2004-04-16 17:31:30 +00:00
|
|
|
|
|
|
|
return workareas;
|
|
|
|
}
|
|
|
|
}
|
2004-09-14 13:25:49 +00:00
|
|
|
|
2011-02-10 05:39:39 +00:00
|
|
|
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
2004-09-14 13:25:49 +00:00
|
|
|
static extern bool gdk_init_check(ref int argc, ref IntPtr argv);
|
|
|
|
|
|
|
|
public static bool InitCheck (ref string[] argv)
|
|
|
|
{
|
2005-01-11 20:49:50 +00:00
|
|
|
GLib.Argv a = new GLib.Argv (argv, true);
|
|
|
|
IntPtr buf = a.Handle;
|
|
|
|
int argc = argv.Length + 1;
|
|
|
|
|
|
|
|
bool result = gdk_init_check (ref argc, ref buf);
|
|
|
|
argv = a.GetArgs (argc);
|
2004-09-14 13:25:49 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-02-10 05:39:39 +00:00
|
|
|
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
2004-09-14 13:25:49 +00:00
|
|
|
static extern void gdk_parse_args(ref int argc, ref IntPtr argv);
|
|
|
|
|
|
|
|
public static void ParseArgs (ref string[] argv)
|
|
|
|
{
|
2005-01-11 20:49:50 +00:00
|
|
|
GLib.Argv a = new GLib.Argv (argv, true);
|
|
|
|
IntPtr buf = a.Handle;
|
|
|
|
int argc = argv.Length + 1;
|
|
|
|
|
|
|
|
gdk_parse_args (ref argc, ref buf);
|
|
|
|
argv = a.GetArgs (argc);
|
2004-09-14 13:25:49 +00:00
|
|
|
}
|
|
|
|
|
2011-02-10 05:39:39 +00:00
|
|
|
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
2004-09-14 13:25:49 +00:00
|
|
|
static extern void gdk_query_depths (out IntPtr depths, out int n_depths);
|
|
|
|
|
|
|
|
public static int[] QueryDepths ()
|
|
|
|
{
|
|
|
|
IntPtr ptr;
|
|
|
|
int count;
|
|
|
|
gdk_query_depths (out ptr, out count);
|
|
|
|
int[] result = new int [count];
|
|
|
|
Marshal.Copy (ptr, result, 0, count);
|
|
|
|
return result;
|
|
|
|
}
|
2011-02-10 05:39:39 +00:00
|
|
|
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
2004-09-14 13:25:49 +00:00
|
|
|
static extern void gdk_query_visual_types (out IntPtr types, out int n_types);
|
|
|
|
|
|
|
|
public static VisualType[] QueryVisualTypes ()
|
|
|
|
{
|
|
|
|
IntPtr ptr;
|
|
|
|
int count;
|
|
|
|
gdk_query_visual_types (out ptr, out count);
|
|
|
|
int[] tmp = new int [count];
|
|
|
|
Marshal.Copy (ptr, tmp, 0, count);
|
|
|
|
VisualType[] result = new VisualType [count];
|
|
|
|
for (int i = 0; i < count; i++)
|
|
|
|
result [i] = (VisualType) tmp [i];
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2005-04-04 16:27:08 +00:00
|
|
|
public static void AddClientMessageFilter (Gdk.Atom message_type, Gdk.FilterFunc func)
|
|
|
|
{
|
|
|
|
Gdk.Display.Default.AddClientMessageFilter (message_type, func);
|
|
|
|
}
|
|
|
|
|