Seat.grab

Grabs the seat so that all events corresponding to the given capabilities are passed to this application until the seat is ungrabbed with gdk.seat.Seat.ungrab, or the window becomes hidden. This overrides any previous grab on the seat by this client.

As a rule of thumb, if a grab is desired over gdk.types.SeatCapabilities.Pointer, all other "pointing" capabilities (eg. gdk.types.SeatCapabilities.Touch) should be grabbed too, so the user is able to interact with all of those while the grab holds, you should thus use gdk.types.SeatCapabilities.AllPointing most commonly.

Grabs are used for operations which need complete control over the events corresponding to the given capabilities. For example in GTK+ this is used for Drag and Drop operations, popup menus and such.

Note that if the event mask of a #GdkWindow has selected both button press and button release events, or touch begin and touch end, then a press event will cause an automatic grab until the button is released, equivalent to a grab on the window with owner_events set to true. This is done because most applications expect to receive paired press and release events.

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.

Parameters

window gdk.window.Window

the #GdkWindow which will own the grab

capabilities gdk.types.SeatCapabilities

capabilities that will be grabbed

ownerEvents bool

if false then all device events are reported with respect to window and are only reported if selected by event_mask. If true then pointer events for this application are reported as normal, but pointer events outside this application are reported with respect to window and only if selected by event_mask. In either mode, unreported events are discarded.

cursor gdk.cursor.Cursor

the cursor to display while the grab is active. If this is null then the normal cursors are used for window and its descendants, and the cursor for window is used elsewhere.

event gdk.event.Event

the event that is triggering the grab, or null if none is available.

prepareFunc gdk.types.SeatGrabPrepareFunc

function to prepare the window to be grabbed, it can be null if window is visible before this call.

Return Value

Type: gdk.types.GrabStatus

gdk.types.GrabStatus.Success if the grab was successful.