コード例 #1
0
ファイル: XplatUIX11.cs プロジェクト: nlhepler/mono
		internal static int XGetWindowAttributes(IntPtr display, IntPtr window, ref XWindowAttributes attributes)
		{
			DebugHelper.TraceWriteLine ("XGetWindowAttributes");
			return _XGetWindowAttributes(display, window, ref attributes);
		}
コード例 #2
0
ファイル: XplatUIX11.cs プロジェクト: nlhepler/mono
		internal extern static int XGetWindowAttributes(IntPtr display, IntPtr window, ref XWindowAttributes attributes);
コード例 #3
0
ファイル: XplatUIX11.cs プロジェクト: nlhepler/mono
		FormWindowState UpdateWindowState (IntPtr handle) {
			IntPtr			actual_atom;
			int			actual_format;
			IntPtr			nitems;
			IntPtr			bytes_after;
			IntPtr			prop = IntPtr.Zero;
			IntPtr			atom;
			int			maximized;
			bool			minimized;
			XWindowAttributes	attributes;
			Hwnd			hwnd;

			hwnd = Hwnd.ObjectFromHandle(handle);

			maximized = 0;
			minimized = false;
			XGetWindowProperty(DisplayHandle, hwnd.whole_window, _NET_WM_STATE, IntPtr.Zero, new IntPtr (256), false, (IntPtr)Atom.XA_ATOM, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
			if (((long)nitems > 0) && (prop != IntPtr.Zero)) {
				for (int i = 0; i < (long)nitems; i++) {
					atom = (IntPtr)Marshal.ReadInt32(prop, i * 4);
					if ((atom == _NET_WM_STATE_MAXIMIZED_HORZ) || (atom == _NET_WM_STATE_MAXIMIZED_VERT)) {
						maximized++;
					} else if (atom == _NET_WM_STATE_HIDDEN) {
						minimized = true;
					}
				}
				XFree(prop);
			}

			if (minimized) {
				return FormWindowState.Minimized;
			} else if (maximized == 2) {
				return FormWindowState.Maximized;
			}

			attributes = new XWindowAttributes();
			XGetWindowAttributes(DisplayHandle, hwnd.client_window, ref attributes);
			if (attributes.map_state == MapState.IsUnmapped) {
				return (FormWindowState)(-1);
			}


			return FormWindowState.Normal;
		}
コード例 #4
0
ファイル: XplatUIX11.cs プロジェクト: nlhepler/mono
		internal override void GrabWindow(IntPtr handle, IntPtr confine_to_handle)
		{
			Hwnd	hwnd;
			IntPtr	confine_to_window;

			confine_to_window = IntPtr.Zero;

			if (confine_to_handle != IntPtr.Zero) {
				XWindowAttributes	attributes = new XWindowAttributes();

				hwnd = Hwnd.ObjectFromHandle(confine_to_handle);

				lock (XlibLock) {
					XGetWindowAttributes(DisplayHandle, hwnd.client_window, ref attributes);
				}
				Grab.Area.X = attributes.x;
				Grab.Area.Y = attributes.y;
				Grab.Area.Width = attributes.width;
				Grab.Area.Height = attributes.height;
				Grab.Confined = true;
				confine_to_window = hwnd.client_window;
			}

			Grab.Hwnd = handle;

			hwnd = Hwnd.ObjectFromHandle(handle);

			lock (XlibLock) {
				XGrabPointer(DisplayHandle, hwnd.client_window, false, 
					EventMask.ButtonPressMask | EventMask.ButtonMotionMask |
					EventMask.ButtonReleaseMask | EventMask.PointerMotionMask | 
					EventMask.PointerMotionHintMask | EventMask.LeaveWindowMask,
					GrabMode.GrabModeAsync, GrabMode.GrabModeAsync, confine_to_window, IntPtr.Zero, IntPtr.Zero);
			}
		}
コード例 #5
0
ファイル: XplatUIX11.cs プロジェクト: nlhepler/mono
		internal override void GetDisplaySize(out Size size)
		{
			XWindowAttributes	attributes=new XWindowAttributes();

			lock (XlibLock) {
				// FIXME - use _NET_WM messages instead?
				XGetWindowAttributes(DisplayHandle, XRootWindow(DisplayHandle, 0), ref attributes);
			}

			size = new Size(attributes.width, attributes.height);
		}
コード例 #6
0
ファイル: X11Display.cs プロジェクト: BrzVlad/mono
		public void GrabWindow (X11Hwnd hwnd, X11Hwnd confine_to)
		{
			IntPtr	confine_to_window;

			confine_to_window = IntPtr.Zero;

			if (confine_to != null) {
				Console.WriteLine (Environment.StackTrace);

				XWindowAttributes attributes = new XWindowAttributes();

				Xlib.XGetWindowAttributes (display, confine_to.ClientWindow, ref attributes);

				Grab.Area.X = attributes.x;
				Grab.Area.Y = attributes.y;
				Grab.Area.Width = attributes.width;
				Grab.Area.Height = attributes.height;
				Grab.Confined = true;
				confine_to_window = confine_to.ClientWindow;
			}

			Grab.Hwnd = hwnd.ClientWindow;

			Xlib.XGrabPointer (display, hwnd.ClientWindow, false, 
					   EventMask.ButtonPressMask | EventMask.ButtonMotionMask |
					   EventMask.ButtonReleaseMask | EventMask.PointerMotionMask,
					   GrabMode.GrabModeAsync, GrabMode.GrabModeAsync, confine_to_window, IntPtr.Zero, IntPtr.Zero);
		}
コード例 #7
0
ファイル: X11Display.cs プロジェクト: BrzVlad/mono
		public void GetDisplaySize (out Size size)
		{
			XWindowAttributes attributes = new XWindowAttributes();

			// FIXME - use _NET_WM messages instead?
			Xlib.XGetWindowAttributes (display, RootWindow.Handle, ref attributes);

			size = new Size(attributes.width, attributes.height);
		}
コード例 #8
0
ファイル: XplatUIX11GTK.cs プロジェクト: BrzVlad/mono
		internal override FormWindowState GetWindowState (IntPtr handle)
		{
			Atom			actual_atom;
			int			actual_format;
			int			nitems;
			int			bytes_after;
			IntPtr			prop = IntPtr.Zero;
			IntPtr			atom;
			int			maximized;
			bool			minimized;
			XWindowAttributes	attributes;
			Hwnd			hwnd;
			
			hwnd = Hwnd.ObjectFromHandle (handle);
			
			maximized = 0;
			minimized = false;
			XGetWindowProperty (DisplayHandle, hwnd.whole_window, NetAtoms [(int)NA._NET_WM_STATE], 0, 256, false, Atom.XA_ATOM, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
			if ((nitems > 0) && (prop != IntPtr.Zero)) {
				for (int i = 0; i < nitems; i++) {
					atom = (IntPtr)Marshal.ReadInt32 (prop, i * 4);
					if ((atom == (IntPtr)NetAtoms [(int)NA._NET_WM_STATE_MAXIMIZED_HORZ]) || (atom == (IntPtr)NetAtoms [(int)NA._NET_WM_STATE_MAXIMIZED_VERT])) {
						maximized++;
					} else if (atom == (IntPtr)NetAtoms [(int)NA._NET_WM_STATE_HIDDEN]) {
						minimized = true;
					}
				}
				XFree (prop);
			}
			
			if (minimized) {
				return FormWindowState.Minimized;
			} else if (maximized == 2) {
				return FormWindowState.Maximized;
			}
			
			attributes = new XWindowAttributes ();
			XGetWindowAttributes (DisplayHandle, handle, ref attributes);
			if (attributes.map_state == MapState.IsUnmapped) {
				throw new NotSupportedException ("Cannot retrieve the state of an unmapped window");
			}
			
			
			return FormWindowState.Normal;
		}
コード例 #9
0
ファイル: X11Hwnd.cs プロジェクト: KonajuGames/SharpLang
		public FormWindowState GetWindowState ()
		{
			IntPtr			actual_atom;
			int			actual_format;
			IntPtr			nitems;
			IntPtr			bytes_after;
			IntPtr			prop = IntPtr.Zero;
			IntPtr			atom;
			int			maximized;
			bool			minimized;
			XWindowAttributes	attributes;

			maximized = 0;
			minimized = false;
			Xlib.XGetWindowProperty (display.Handle, WholeWindow,
						 display.Atoms._NET_WM_STATE, IntPtr.Zero, new IntPtr (256), false,
						 display.Atoms.XA_ATOM, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);

			if (((long)nitems > 0) && (prop != IntPtr.Zero)) {
				for (int i = 0; i < (long)nitems; i++) {
					// XXX 64 bit clean?
					atom = (IntPtr)Marshal.ReadInt32(prop, i * 4);
					if ((atom == display.Atoms._NET_WM_STATE_MAXIMIZED_HORZ) || (atom == display.Atoms._NET_WM_STATE_MAXIMIZED_VERT))
						maximized++;
					else if (atom == display.Atoms._NET_WM_STATE_HIDDEN)
						minimized = true;
				}
				Xlib.XFree(prop);
			}

			if (minimized)
				return FormWindowState.Minimized;
			else if (maximized == 2)
				return FormWindowState.Maximized;

			attributes = new XWindowAttributes();
			Xlib.XGetWindowAttributes (display.Handle, ClientWindow, ref attributes);
			if (attributes.map_state == MapState.IsUnmapped)
				return (FormWindowState)(-1);

			return FormWindowState.Normal;
		}