// GrabChecked grabs a button with mods on a particular window. It does the // same thing as Grab, but issues a checked request and returns an error // on failure. // Will also grab all combinations of modifiers found in xevent.IgnoreMods // If 'sync' is True, then no further events can be processed until the // grabbing client allows them to be. (Which is done via AllowEvents. Thus, // if sync is True, you *must* make some call to AllowEvents at some // point, or else your client will lock.) func GrabChecked(xu *xgbutil.XUtil, win xproto.Window, mods uint16, button xproto.Button, sync bool) error { var pSync byte = xproto.GrabModeAsync if sync { pSync = xproto.GrabModeSync } var err error for _, m := range xevent.IgnoreMods { err = xproto.GrabButtonChecked(xu.Conn(), true, win, pointerMasks, pSync, xproto.GrabModeAsync, 0, 0, byte(button), mods|m).Check() if err != nil { return err } } return nil }
func MouseGrabChecked(c *xgb.Conn, win xproto.Window, mods uint16, button xproto.Button) error { var err error for _, m := range IgnoreMods { err = xproto.GrabButtonChecked( c, true, win, pointerMasks, xproto.GrabModeAsync, xproto.GrabModeAsync, 0, 0, byte(button), mods|m, ).Check() if err != nil { return err } } return nil }