Query: xgrabpointer
OS: hpux
Section: 3x
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
XGrabPointer() XGrabPointer() Name XGrabPointer - grab the pointer. Synopsis int XGrabPointer(display, grab_window, owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time) Display *display; Window grab_window; Bool owner_events; unsigned int event_mask; int pointer_mode, keyboard_mode; Window confine_to; Cursor cursor; Time time; Arguments display Specifies a connection to an X server; returned from XOpenDisplay(). grab_window Specifies the ID of the window that should grab the pointer input independent of pointer location. owner_events Specifies if the pointer events are to be reported normally within this application (pass True) or only to the grab window (pass False). event_mask Specifies the event mask symbols that can be ORed together. Only events selected by this mask will be delivered during the grab. The valid event masks are: ButtonPressMask, ButtonReleaseMask, EnterWindowMask, LeaveWindowMask, PointerMotionMask, PointerMo- tionHintMask, Button1MotionMask, Button2MotionMask, Button3MotionMask, Button4MotionMask, Button5MotionMask, ButtonMotionMask, KeymapStateMask. pointer_mode Controls further processing of pointer events. Pass either GrabModeSync or GrabModeAsync. keyboard_mode Controls further processing of keyboard events. Pass either GrabModeSync or GrabModeAsync. confine_to Specifies the ID of the window to confine the pointer. One option is None, in which case the pointer is not confined to any win- dow. cursor Specifies the ID of the cursor that is displayed with the pointer during the grab. One option is None, which causes the cursor to keep its current pattern. time Specifies the time when the grab request took place. Pass either a timestamp, expressed in milliseconds (from an event), or the constant CurrentTime. Returns GrabSuccess on success. GrabNotViewable, AlreadyGrabbed, GrabInvalidTime, or GrabFrozen on failure. Description XGrabPointer() actively grabs control of the pointer. Further pointer events report only to the grabbing client until XUngrabPointer() is called. XGrabPointer() overrides any active pointer grab by this client. If owner_events is False, all generated pointer events are reported to grab_window, and are only reported if selected by event_mask. If owner_events is True, then if a generated pointer event would normally be reported to this client, it is reported normally; otherwise the event is reported with respect to the grab_window, and is only reported if selected by event_mask. For either value of owner_events, unre- ported events are discarded. pointer_mode controls processing of pointer events during the grab, and keyboard_mode controls further processing of main keyboard events. If the mode is GrabModeAsync, event processing continues normally. If the mode is GrabModeSync, events for the device are queued by the server but not sent to clients until the grabbing client issues a releasing XAllowEvents() request or an XUngrabPointer() request. If a cursor is specified, then it is displayed regardless of which window the pointer is in. If no cursor is specified, then when the pointer is in grab_window or one of its subwindows, the normal cursor for that window is displayed. When the pointer is outside grab_win- dow, the cursor for grab_window is displayed. If a confine_to window is specified, then the pointer will be restricted to that window. The confine_to window need have no relationship to the grab_window. If the pointer is not initially in the confine_to window, then it is warped automatically to the closest edge (and enter/leave events generated normally) just before the grab activates. If the confine_to window is subsequently reconfigured, the pointer will be warped automatically as necessary to keep it contained in the window. The time argument lets you avoid certain circumstances that come up if applications take a long while to respond or if there are long net- work delays. Consider a situation where you have two applications, both of which normally grab the pointer when clicked on. If both applications specify the timestamp from the ButtonPress event, the second application will successfully grab the pointer, while the first will get a return value of AlreadyGrabbed, indicating that the other application grabbed the pointer before its request was processed. This is the desired response because the latest user action is most important in this case. XGrabPointer() generates EnterNotify and LeaveNotify events. If the grab is successful, it returns the constant GrabSuccess. The XGrabPointer() function fails under the following conditions, with the following return values: o If grab_window or confine_to window is not viewable, or if the confine_to window is completely off the screen, GrabNotViewable is returned. o If the pointer is actively grabbed by some other client, the constant AlreadyGrabbed is returned. o If the pointer is frozen by an active grab of another client, GrabFrozen is returned. o If the specified time is earlier than the last-pointer-grab time or later than the current X server time, GrabInvalidTime is returned. (If the call succeeds, the last pointer grab time is set to the specified time, with the constant CurrentTime replaced by the current X server time.) For more information on grabbing, see Volume One, Chapter 9, The Keyboard and Pointer. Errors BadCursor BadValue BadWindow See Also XChangeActivePointerGrab(), XGrabButton(), XGrabKey(), XGrabKeyboard(), XGrabServer(), XUngrabButton(), XUngrabKey(), XUngrabKeyboard(), XUngrabPointer(), XUngrabServer(). Xlib - Grabbing XGrabPointer()