Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xtgrabpointer(3) [hpux man page]

XtGrabPointer() 														   XtGrabPointer()

Name
  XtGrabPointer - actively grab the pointer.

Synopsis
  int XtGrabPointer(widget, owner_events, event_mask, pointer_mode, keyboard_mode,
  confine_to, cursor, time)
	   Widget widget;
	   Boolean owner_events;
	   unsigned int event_mask;
	   int pointer_mode, keyboard_mode;
	   Window confine_to;
	   Cursor cursor;
	   Time time;

Inputs
  widget    Specifies the widget for whose window the pointer is to be grabbed.  Must be of class Core or any subclass thereof.

  owner_events
	    Specifies  whether	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 to take effect during the grab.

  pointer_mode
	    Controls processing of pointer events during the grab.  Either GrabModeSync or GrabModeAsync.

  keyboard_mode
	    Controls processing of keyboard events during the grab.  Either GrabModeSync or GrabModeAsync.

  confine_to
	    Specifies the ID of the window to confine the pointer, or None.

  cursor    Specifies the cursor to be displayed during the grab, or None.

  time	    Specifies the time when the grab request took place.  Pass either a timestamp (from an event), or the constant CurrentTime.

Returns
  GrabSuccess or one of the error values described below.

Description
  If the specified widget is realized, XtGrabPointer() establishes an active pointer grab by calling XGrabPointer() with the widget's  window
  as  the grab window and passing the remaining arguments unmodified.  It returns the value returned by XGrabPointer().  If the widget is not
  realized, XGrabPointer() immediately returns GrabNotViewable.  No future automatic ungrab is implied by XtGrabPointer().

  See the "Background" section below for a description of the arguments and an explanation of event processing during an active pointer grab.

Usage
  When the pointer is grabbed, all pointer events will be delivered to the widget you specify or to the rest of your application,  regardless
  of  the  location of the pointer.  Pointer grabs can be used by applications like xmag and window managers which need to use the pointer to
  indicate a point on or a region of the screen, regardless of the applications that are under the pointer.

  Most applications never need to grab the pointer.  Note that XtAddGrab() does not actually grab anything.

  To cancel an active pointer grab, use XtUngrabPointer().

Background
  XGrabPointer() actively grabs control of the pointer and returns GrabSuccess if the  grab  was  successful.	Further  pointer  events  are
  reported only to the grabbing client.  XGrabPointer() overrides any active pointer grab by this client.  If owner_events is False, all gen-
  erated pointer events are reported with respect to grab_window and are reported only if selected by event_mask. If owner_events is True and
  if  a  generated  pointer  event would normally be reported to this client, it is reported as usual.	Otherwise, the event is reported with
  respect to the grab_window and is reported only if selected by event_mask. For either value of owner_events,	unreported  events  are  dis-
  carded.

  If  the pointer_mode is GrabModeAsync, pointer event processing continues as usual.  If the pointer is currently frozen by this client, the
  processing of events for the pointer is resumed.  If the pointer_mode is GrabModeSync, the state of the pointer, as seen by client applica-
  tions,  appears to freeze, and the X server generates no further pointer events until the grabbing client calls XAllowEvents() or until the
  pointer grab is released.  Actual pointer changes are not lost while the pointer is frozen; they are simply queued in the server for	later
  processing.

  If the keyboard_mode is GrabModeAsync, keyboard event processing is unaffected by activation of the grab.  If the keyboard_mode is GrabMod-
  eSync, the state of the keyboard, as seen by client applications, appears to freeze, and the X server generates no further keyboard  events
  until  the  grabbing	client	calls  XAllowEvents()  or until the pointer grab is released.  Actual keyboard changes are not lost while the
  pointer is frozen; they are simply queued in the server for later processing.

  If cursor is specified, it is displayed regardless of what window the pointer is in.	If None is specified, the normal cursor for that win-
  dow is displayed when the pointer is in grab_window or one of its subwindows; otherwise, the cursor for grab_window is displayed.

  If  a confine_to window is specified, the pointer is restricted to stay contained in that window.  The confine_to window need have no rela-
  tionship to the grab_window.	If the pointer is not initially in the confine_to window, it is warped automatically to the closest edge just
  before  the  grab  activates	and  enter/leave  events  are generated as usual.  If the confine_to window is subsequently reconfigured, the
  pointer is warped automatically, as necessary, to keep it contained in the window.

  The time argument allows you to avoid certain circumstances that come up if applications take a long time to respond or if there  are  long
  network  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 event, the second application may wake up faster and successfully grab the pointer  before  the
  first application.  The first application then will get an indication that the other application grabbed the pointer before its request was
  processed.

  XGrabPointer() generates EnterNotify and LeaveNotify events.

  Either if grab_window or confine_to window is not viewable or if the confine_to window lies completely outside the boundaries of  the  root
  window,  XGrabPointer()  fails  and returns GrabNotViewable.	If the pointer is actively grabbed by some other client, it fails and returns
  AlreadyGrabbed.  If the pointer is frozen by an active grab of another client, it fails and returns GrabFrozen.  If the specified  time  is
  earlier  than  the  last-pointer-grab  time  or later than the current X server time, it fails and returns GrabInvalidTime.  Otherwise, the
  last-pointer-grab time is set to the specified time (CurrentTime is replaced by the current X server time).

  XGrabPointer() can generate BadCursor, BadValue, and BadWindow errors.

Structures
  Each of the event types listed in the table below set a single bit in an event mask.	The event_mask argument is formed by combining	these
  symbols  with the bitwise OR operator ( ).  Note that the nonmaskable event types do not appear in this table and cannot be requested in an
  event mask.

NoEventMask		Button1MotionMask      StructureNotifyMask
KeyPressMask		Button2MotionMask      ResizeRedirectMask
KeyReleaseMask		Button3MotionMask      SubstructureNotifyMask
ButtonPressMask 	Button4MotionMask      SubstructureRedirectMask
ButtonReleaseMask	Button5MotionMask      FocusChangeMask
EnterWindowMask 	ButtonMotionMask       PropertyChangeMask
LeaveWindowMask 	KeymapStateMask        ColormapChangeMask
PointerMotionMask	ExposureMask	       OwnerGrabButtonMask
PointerMotionHintMask	VisibilityChangeMask

See Also
  XtAddGrab(1), XtGrabButton(1), XtGrabKey(1), XtGrabKeyboard(1), XtRegisterGrabAction(1), XtUngrabButton(1), XtUngrabKey(1), XtUngrabKey-
  board(1), XtUngrabPointer(1).

Xt - Mouse Handling														   XtGrabPointer()
Man Page