// Peter Bartok pbartok@novell.com
//
//
-// $Revision: 1.16 $
+// $Revision: 1.17 $
// $Modtime: $
// $Log: XplatUI.cs,v $
+// Revision 1.17 2004/08/21 20:23:56 pbartok
+// - Added method to query current grab state
+// - Added argument to allow confining a grab to a window
+//
// Revision 1.16 2004/08/20 20:03:20 pbartok
// - Added method for setting the window background
//
return driver.DispatchMessage(ref msg);
}
- internal static void GrabWindow(IntPtr hWnd) {
- driver.GrabWindow(hWnd);
+ internal static void GrabWindow(IntPtr hWnd, IntPtr ConfineToHwnd) {
+ driver.GrabWindow(hWnd, ConfineToHwnd);
+ }
+
+ internal static void GrabInfo(ref IntPtr hWnd, ref bool GrabConfined, ref Rectangle GrabArea) {
+ driver.GrabInfo(ref hWnd, ref GrabConfined, ref GrabArea);
}
internal static void ReleaseWindow(IntPtr hWnd) {
// Peter Bartok pbartok@novell.com
//
//
-// $Revision: 1.16 $
+// $Revision: 1.17 $
// $Modtime: $
// $Log: XplatUIDriver.cs,v $
+// Revision 1.17 2004/08/21 20:23:56 pbartok
+// - Added method to query current grab state
+// - Added argument to allow confining a grab to a window
+//
// Revision 1.16 2004/08/20 20:03:20 pbartok
// - Added method for setting the window background
//
internal abstract void GetCursorPos(IntPtr handle, out int x, out int y);
internal abstract void ScreenToClient(IntPtr handle, ref int x, ref int y);
- internal abstract void GrabWindow(IntPtr hWnd);
+ internal abstract void GrabWindow(IntPtr hWnd, IntPtr ConfineToHwnd);
+ internal abstract void GrabInfo(ref IntPtr hWnd, ref bool GrabConfined, ref Rectangle GrabArea);
internal abstract void ReleaseWindow(IntPtr hWnd);
internal abstract void SendAsyncMethod (AsyncMethodData method);
// Peter Bartok pbartok@novell.com
//
//
-// $Revision: 1.25 $
+// $Revision: 1.26 $
// $Modtime: $
// $Log: XplatUIWin32.cs,v $
+// Revision 1.26 2004/08/21 20:23:56 pbartok
+// - Added method to query current grab state
+// - Added argument to allow confining a grab to a window
+//
// Revision 1.25 2004/08/21 18:35:38 pbartok
// - Fixed bug with Async message handling
// - Implemented getting the ModifierKeys
internal static MouseButtons mouse_state;
internal static Point mouse_position;
+ internal static bool grab_confined;
+ internal static IntPtr grab_hwnd;
+ internal static Rectangle grab_area;
internal static WndProc wnd_proc;
internal static IntPtr prev_mouse_hwnd;
return Win32GetParent(handle);
}
\r
- internal override void GrabWindow(IntPtr hWnd) {
+ internal override void GrabWindow(IntPtr hWnd, IntPtr ConfineToHwnd) {
+ grab_hwnd = hWnd;
Win32SetCapture(hWnd);
}
+ internal override void GrabInfo(ref IntPtr hWnd, ref bool GrabConfined, ref Rectangle GrabArea) {
+ hWnd = grab_hwnd;
+ GrabConfined = grab_confined;
+ GrabArea = grab_area;
+ }
+
internal override void ReleaseWindow(IntPtr hWnd) {
Win32ReleaseCapture();
+ grab_hwnd = IntPtr.Zero;
}
internal override bool CalculateWindowRect(IntPtr hWnd, ref Rectangle ClientRect, int Style, bool HasMenu, out Rectangle WindowRect) {
internal static Keys key_state;
internal static MouseButtons mouse_state;
internal static Point mouse_position;
+ internal static bool grab_confined; // Is the current grab (if any) confined to grab_area?
+ internal static IntPtr grab_hwnd; // The window that is grabbed
+ internal static Rectangle grab_area; // The area the current grab is confined to
internal static bool is_visible;
private static Hashtable handle_data;
return Parent;
}
\r
- internal override void GrabWindow(IntPtr hWnd) {
+ internal override void GrabWindow(IntPtr hWnd, IntPtr confine_hwnd) {
+ if (confine_hwnd != IntPtr.Zero) {
+ XWindowAttributes attributes = new XWindowAttributes();
+
+ lock (this) {
+ XGetWindowAttributes(DisplayHandle, confine_hwnd, 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;
+ }
+ grab_hwnd = hWnd;
lock (this) {
XGrabPointer(DisplayHandle, hWnd, false,
- EventMask.ButtonPressMask | EventMask.ButtonMotionMask |
- EventMask.ButtonReleaseMask | EventMask.PointerMotionMask,
- GrabMode.GrabModeAsync, GrabMode.GrabModeAsync, IntPtr.Zero, 0, 0);
+ EventMask.ButtonPressMask | EventMask.ButtonMotionMask |
+ EventMask.ButtonReleaseMask | EventMask.PointerMotionMask,
+ GrabMode.GrabModeAsync, GrabMode.GrabModeAsync, confine_hwnd, 0, 0);
}
}
+ internal override void GrabInfo(ref IntPtr hWnd, ref bool GrabConfined, ref Rectangle GrabArea) {
+ hWnd = grab_hwnd;
+ GrabConfined = grab_confined;
+ GrabArea = grab_area;
+ }
+
internal override void ReleaseWindow(IntPtr hWnd) {
lock (this) {
XUngrabPointer(DisplayHandle, 0);
+ grab_hwnd = IntPtr.Zero;
+ grab_confined = false;
}
}