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);
}
}