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

int xdo_clear_active_modifiers ( const xdo_t xdo,
Window  window,
xdo_active_mods_t active_mods 
)

Send any events necesary to clear the the active modifiers. For example, if you are holding 'alt' when xdo_get_active_modifiers is called, then this method will send a key-up for 'alt'

Definition at line 1535 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, False, NULL, DEFAULT_DELAY);

  if (active_mods->input_state & Button1MotionMask)
    ret = xdo_mouseup(xdo, window, 1);
  if (!ret && active_mods->input_state & Button2MotionMask)
    ret = xdo_mouseup(xdo, window, 2);
  if (!ret && active_mods->input_state & Button3MotionMask)
    ret = xdo_mouseup(xdo, window, 3);
  if (!ret && active_mods->input_state & Button4MotionMask)
    ret = xdo_mouseup(xdo, window, 4);
  if (!ret && active_mods->input_state & Button5MotionMask)
    ret = xdo_mouseup(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