Grabs the pointer (usually a mouse) so that all events are passed to this
application until the pointer is ungrabbed with
the grab window becomes unviewable.
This overrides any previous pointer grab by this client.
gdkPointerGrab(window, owner.events = FALSE, event.mask = 0, confine.to = NULL, cursor = NULL, time = "GDK_CURRENT_TIME")
GdkWindowwhich will own the grab (the grab window).
FALSEthen all pointer events are reported with respect to
windowand are only reported if selected by
TRUEthen pointer events for this application are reported as normal, but pointer events outside this application are reported with respect to
windowand only if selected by
event.mask. In either mode, unreported events are discarded.
- specifies the event mask, which is used in accordance with
owner.events. Note that only pointer events (i.e. button and motion events) may be selected.
- If non-
NULL, the pointer will be confined to this window during the grab. If the pointer is outside
confine.to, it will automatically be moved to the closest edge of
confine.toand enter and leave events will be generated as necessary.
- the cursor to display while the grab is active. If this is
NULLthen the normal cursors are used for
windowand its descendants, and the cursor for
windowis used for all other windows.
- the timestamp of the event which led to this pointer grab. This usually
comes from a
GDK_CURRENT_TIMEcan be used if the time isn't known.
Pointer grabs are used for operations which need complete control over mouse
events, even if the mouse leaves the application.
For example in GTK+ it is used for Drag and Drop, for dragging the handle in
GtkVPaned widgets, and for resizing columns in
Note that if the event mask of an X window has selected both button press and
button release events, then a button press event will cause an automatic
pointer grab until the button is released.
X does this automatically since most applications expect to receive button
press and release events in pairs.
It is equivalent to a pointer grab on the window with
owner.events set to
If you set up anything at the time you take the grab that needs to be cleaned
up when the grab ends, you should handle the
GdkEventGrabBroken events that
are emitted when the grab ends unvoluntarily.
GDK_GRAB_SUCCESSif the grab was successful.