Index: trunk/src/actions.c =================================================================== --- trunk/src/actions.c (revision 18700) +++ trunk/src/actions.c (revision 18701) @@ -564,6 +564,35 @@ return -1; } +int pcb_cli_mouse(pcb_bool notify) +{ + fgw_func_t *f; + const pcb_action_t *a; + fgw_arg_t res, args[3]; + + /* no backend: let the original action work */ + if ((conf_core.rc.cli_backend == NULL) || (*conf_core.rc.cli_backend == '\0')) + return -1; + + /* backend: let the backend action handle it */ + a = pcb_find_action(conf_core.rc.cli_backend, &f); + if (!a) + return -1; + + args[0].type = FGW_FUNC; + args[0].val.func = f; + args[1].type = FGW_STR; + args[1].val.str = "/click"; + args[2].type = FGW_INT; + args[2].val.nat_int = notify; + + if (pcb_actionv_(f, &res, 3, args) != 0) + return -1; + fgw_arg_conv(&pcb_fgw, &res, FGW_INT); + return res.val.nat_int; +} + + void pcb_cli_uninit(void) { while(vtp0_len(&cli_stack) > 0) Index: trunk/src/actions.h =================================================================== --- trunk/src/actions.h (revision 18700) +++ trunk/src/actions.h (revision 18701) @@ -85,6 +85,10 @@ (popped from a stack) */ int pcb_cli_leave(void); +/* Mouse event while the command line is open; returns zero if + normal event processing shall be inhibited; notify is true if + called in notify mode, false if called in release mode */ +int pcb_cli_mouse(pcb_bool notify); /* Discard the cli mode stack */ void pcb_cli_uninit(void); Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 18700) +++ trunk/src/crosshair.h (revision 18701) @@ -86,6 +86,8 @@ long int *drags; int drags_len, drags_current; pcb_coord_t dragx, dragy; /* the point where drag started */ + + unsigned click_cmd_entry_active:1; /* true if the command entry was active during a mosue click while actions are executed */ } pcb_crosshair_t; Index: trunk/src/hid_cfg_input.c =================================================================== --- trunk/src/hid_cfg_input.c (revision 18700) +++ trunk/src/hid_cfg_input.c (revision 18701) @@ -39,6 +39,7 @@ #include "error.h" #include "compat_misc.h" #include "event.h" +#include "crosshair.h" /* split value into a list of '-' separated words; examine each word and set the bitmask of modifiers */ @@ -182,8 +183,10 @@ void hid_cfg_mouse_action(pcb_hid_cfg_mouse_t *mouse, pcb_hid_cfg_mod_t button_and_mask, pcb_bool cmd_entry_active) { + pcb_crosshair.click_cmd_entry_active = cmd_entry_active; pcb_hid_cfg_action(find_best_action(mouse, button_and_mask)); pcb_event(PCB_EVENT_USER_INPUT_POST, NULL); + pcb_crosshair.click_cmd_entry_active = 0; } Index: trunk/src/tool.c =================================================================== --- trunk/src/tool.c (revision 18700) +++ trunk/src/tool.c (revision 18701) @@ -396,6 +396,9 @@ /*** old helpers ***/ void pcb_release_mode(void) { + if (pcb_crosshair.click_cmd_entry_active && (pcb_cli_mouse(0) == 0)) + return; + pcb_tool_release_mode(); if (pcb_tool_is_saved) @@ -406,6 +409,9 @@ void pcb_notify_mode(void) { + if (pcb_crosshair.click_cmd_entry_active && (pcb_cli_mouse(1) == 0)) + return; + if (conf_core.temp.rat_warn) pcb_clear_warnings(); pcb_tool_notify_mode();