Logo Search packages:      
Sourcecode: xdotool version File versions  Download package

int xdo_set_active_modifiers ( const xdo_t xdo,
Window  window,
const xdo_active_mods_t active_mods 

Send any events necessary to make these modifiers active. This is useful if you just cleared the active modifiers and then wish to restore them after.

Definition at line 1562 of file xdo.c.

References xdo_active_mods::input_state, xdo_active_mods::keymods, xdo_active_mods::nkeymods, and xdo::xdpy.

  int ret = 0;
  xdo_keysequence_list_do(xdo, window, active_mods->keymods,
                          active_mods->nkeymods, True, NULL, DEFAULT_DELAY);
  if (active_mods->input_state & Button1MotionMask)
    ret = xdo_mousedown(xdo, window, 1);
  if (!ret && active_mods->input_state & Button2MotionMask)
    ret = xdo_mousedown(xdo, window, 2);
  if (!ret && active_mods->input_state & Button3MotionMask)
    ret = xdo_mousedown(xdo, window, 3);
  if (!ret && active_mods->input_state & Button4MotionMask)
    ret = xdo_mousedown(xdo, window, 4);
  if (!ret && active_mods->input_state & Button5MotionMask)
    ret = xdo_mousedown(xdo, window, 5);
  if (!ret && active_mods->input_state & LockMask) {
    /* explicitly use down+up here since xdo_keysequence alone will track the modifiers
     * incurred by a key (like shift, or caps) and send them on the 'up' sequence.
     * That seems to break things with Caps_Lock only, so let's be explicit here. */
    ret = xdo_keysequence_down(xdo, window, "Caps_Lock", DEFAULT_DELAY);
    ret += xdo_keysequence_up(xdo, window, "Caps_Lock", DEFAULT_DELAY);

  XSync(xdo->xdpy, False);
  return ret;

Generated by  Doxygen 1.6.0   Back to index