@@ -6,6 +6,7 @@ int cmd_click(context_t *context) {
66 char * cmd = context -> argv [0 ];
77 int ret = 0 ;
88 int clear_modifiers = 0 ;
9+ int after_modifiers = 0 ;
910 charcodemap_t * active_mods = NULL ;
1011 int active_mods_n ;
1112 char * window_arg = NULL ;
@@ -14,11 +15,12 @@ int cmd_click(context_t *context) {
1415
1516 int c ;
1617 enum {
17- opt_unused , opt_help , opt_clearmodifiers , opt_window , opt_delay ,
18+ opt_unused , opt_help , opt_clearmodifiers , opt_aftermodifiers , opt_window , opt_delay ,
1819 opt_repeat
1920 };
2021 static struct option longopts [] = {
2122 { "clearmodifiers" , no_argument , NULL , opt_clearmodifiers },
23+ { "aftermodifiers" , no_argument , NULL , opt_aftermodifiers },
2224 { "help" , no_argument , NULL , opt_help },
2325 { "window" , required_argument , NULL , opt_window },
2426 { "delay" , required_argument , NULL , opt_delay },
@@ -27,7 +29,8 @@ int cmd_click(context_t *context) {
2729 };
2830 static const char * usage =
2931 "Usage: %s [options] <button>\n"
30- "--clearmodifiers - reset active modifiers (alt, etc) while typing\n"
32+ "--clearmodifiers - reset active modifiers (alt, etc) while moving\n"
33+ "--aftermodifiers - wait for modifiers to be released before typing\n"
3134 "--window WINDOW - specify a window to send click to\n"
3235 "--repeat REPEATS - number of times to click. Default is 1\n"
3336 "--delay MILLISECONDS - delay in milliseconds between clicks.\n"
@@ -38,7 +41,7 @@ int cmd_click(context_t *context) {
3841 "right = 3, wheel up = 4, wheel down = 5\n" ;
3942 int option_index ;
4043
41- while ((c = getopt_long_only (context -> argc , context -> argv , "+cw :h" ,
44+ while ((c = getopt_long_only (context -> argc , context -> argv , "+caw :h" ,
4245 longopts , & option_index )) != -1 ) {
4346 switch (c ) {
4447 case 'h' :
@@ -51,6 +54,10 @@ int cmd_click(context_t *context) {
5154 case opt_clearmodifiers :
5255 clear_modifiers = 1 ;
5356 break ;
57+ case 'a' :
58+ case opt_aftermodifiers :
59+ after_modifiers = 1 ;
60+ break ;
5461 case 'w' :
5562 case opt_window :
5663 clear_modifiers = 1 ;
@@ -86,6 +93,9 @@ int cmd_click(context_t *context) {
8693 button = atoi (context -> argv [0 ]);
8794
8895 window_each (context , window_arg , {
96+ if (after_modifiers ) {
97+ xdo_wait_for_modifier_release (context -> xdo );
98+ }
8999 if (clear_modifiers ) {
90100 xdo_get_active_modifiers (context -> xdo , & active_mods , & active_mods_n );
91101 xdo_clear_active_modifiers (context -> xdo , window , active_mods , active_mods_n );
0 commit comments