pub fn grab_buttons(
        &self,
        window: xproto::Window,
        button: xproto::ButtonIndex,
        modifiers: xproto::ModMask,
    ) -> Result<()> {
        let mods: Vec<xproto::ModMask> = vec![
            modifiers,
            modifiers | xproto::ModMask::M2,
            modifiers | xproto::ModMask::LOCK,
        ];
        for m in mods {
            xproto::grab_button(
                &self.conn,
                false,
                window,
                button_event_mask(),
                xproto::GrabMode::ASYNC,
                xproto::GrabMode::ASYNC,
                x11rb::NONE,
                x11rb::NONE,
                button,
                m,
            )?;
        }
        Ok(())
    }
Grabs the button with the modifier for a window.
display-servers/x11rb-display-server/src/xwrap/mouse.rs