SimpleWindow.grabInput

Grabs exclusive input from the user until you release it with releaseInputGrab.

More...
class SimpleWindow
void
grabInput
(
bool keyboard = true
,
bool mouse = true
,
bool confine = false
)

Parameters

keyboard bool

do you want to grab keyboard input?

mouse bool

grab mouse input?

confine bool

confine the mouse cursor to inside this window?

Detailed Description

Note: it is extremely rude to do this without good reason. Reasons may include doing some kind of mouse drag operation or popping up a temporary menu that should get events and will be dismissed at ease by the user clicking away.

Meta

History

Prior to March 11, 2021, grabbing the keyboard would always also set the X input focus. Now, it only focuses if it is a non-transient window and otherwise manages the input direction internally.

This means spurious focus/blur events will no longer be sent and the application will not steal focus from other applications (which the window manager may have rejected anyway).