| 2621 | } |
| 2622 | |
| 2623 | boolean |
| 2624 | bind_mousebtn(int btn, const char *command) |
| 2625 | { |
| 2626 | struct ext_func_tab *extcmd; |
| 2627 | |
| 2628 | if (btn < 1 || btn > NUM_MOUSE_BUTTONS) { |
| 2629 | config_error_add("Wrong mouse button, valid are 1-%i", |
| 2630 | NUM_MOUSE_BUTTONS); |
| 2631 | return FALSE; |
| 2632 | } |
| 2633 | btn--; |
| 2634 | |
| 2635 | /* special case: "nothing" is reserved for unbinding */ |
| 2636 | if (!strcmpi(command, "nothing")) { |
| 2637 | gc.Cmd.mousebtn[btn] = (struct ext_func_tab *) 0; |
| 2638 | return TRUE; |
| 2639 | } |
| 2640 | |
| 2641 | for (extcmd = extcmdlist; extcmd->ef_txt; extcmd++) { |
| 2642 | if (strcmpi(command, extcmd->ef_txt)) |
| 2643 | continue; |
| 2644 | if (!(extcmd->flags & MOUSECMD)) |
| 2645 | continue; |
| 2646 | gc.Cmd.mousebtn[btn] = extcmd; |
| 2647 | #if 0 /* silently accept key binding for unavailable command (!SHELL,&c) */ |
| 2648 | if ((extcmd->flags & CMD_NOT_AVAILABLE) != 0) { |
| 2649 | char buf[BUFSZ]; |
| 2650 | |
| 2651 | Sprintf(buf, cmdnotavail, extcmd->ef_txt); |
| 2652 | config_error_add("%s", buf); |
| 2653 | } |
| 2654 | #endif |
| 2655 | return TRUE; |
| 2656 | } |
| 2657 | |
| 2658 | return FALSE; |
| 2659 | } |
| 2660 | |
| 2661 | boolean |
| 2662 | bind_key(uchar key, const char *command, boolean user) |
no test coverage detected