Method
GdkDevicegrab
deprecated: 3.20. since: 3.0
Declaration [src]
GdkGrabStatus
gdk_device_grab (
GdkDevice* device,
GdkWindow* window,
GdkGrabOwnership grab_ownership,
gboolean owner_events,
GdkEventMask event_mask,
GdkCursor* cursor,
guint32 time_
)
Description [src]
Grabs the device so that all events coming from this device are passed to this application until the device is ungrabbed with gdk_device_ungrab(), or the window becomes unviewable. This overrides any previous grab on the device by this client.
Note that device and window need to be on the same display.
Device grabs are used for operations which need complete control over the given device events (either pointer or keyboard). For example in GTK+ this is used for Drag and Drop operations, popup menus and such.
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
TRUE.
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.
Available since: 3.0
Deprecated since: 3.20.
Use gdk_seat_grab() instead.
Parameters
window-
Type:
GdkWindowThe
GdkWindowwhich will own the grab (the grab window).The data is owned by the caller of the method. grab_ownership-
Type:
GdkGrabOwnershipSpecifies the grab ownership.
owner_events-
Type:
gbooleanIf
FALSEthen all device events are reported with respect towindowand are only reported if selected byevent_mask. IfTRUEthen pointer events for this application are reported as normal, but pointer events outside this application are reported with respect towindowand only if selected byevent_mask. In either mode, unreported events are discarded. event_mask-
Type:
GdkEventMaskSpecifies the event mask, which is used in accordance with
owner_events. cursor-
Type:
GdkCursorThe cursor to display while the grab is active if the device is a pointer. If this is
NULLthen the normal cursors are used forwindowand its descendants, and the cursor forwindowis used elsewhere.The argument can be NULL.The data is owned by the caller of the method. time_-
Type:
guint32The timestamp of the event which led to this pointer grab. This usually comes from the
GdkEventstruct, thoughGDK_CURRENT_TIMEcan be used if the time isn’t known.
Return value
Type: GdkGrabStatus
GDK_GRAB_SUCCESS if the grab was successful.