handle_button_press(): remove ButtonState[12345] bits from state parameter to allow modifier-button command remapping via replace_key

This commit is contained in:
stefan schippers 2026-02-18 17:46:02 +01:00
parent a8573a1c62
commit 920821445e
2 changed files with 6 additions and 3 deletions

View File

@ -4100,6 +4100,8 @@ static void handle_button_press(int event, int state, int rstate, KeySym key, in
{
int use_cursor_for_sel = tclgetintvar("use_cursor_for_selection");
int excl = xctx->ui_state & (STARTWIRE | STARTRECT | STARTLINE | STARTPOLYGON | STARTARC);
state &= ~(Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ); /* ignore ButtonStates */
if(!tabbed_interface && strcmp(win_path, xctx->current_win_path)) return;
dbg(1, "callback(): ButtonPress ui_state=%d state=%d\n",xctx->ui_state,state);
if(waves_selected(event, key, state, button)) {
@ -4689,7 +4691,7 @@ int callback(const char *win_path, int event, int mx, int my, KeySym key, int bu
update_statusbar(persistent_command, wire_draw_active);
#if 0
#if 1
/* exclude Motion and Expose events */
if(event!=6 /* && event!=12 */) {
dbg(0, "callback(): state=%d event=%d, win_path=%s, current_win_path=%s, old_win_path=%s, semaphore=%d\n",

View File

@ -1147,13 +1147,14 @@ proc key_binding { s d { win_path {.drw} } } {
if { [regexp ButtonPress-5 $d] } { set state [expr {$state +0x1000}] }
# puts "$state $key <${s}>"
if {[regexp ButtonPress- $d]} {
# puts "bind $win_path <${s}> xschem callback %W %T %x %y 0 $key 0 $state"
bind $win_path "<${s}>" "xschem callback %W %T %x %y 0 $key 0 $state"
} else {
if {![string compare $d {} ] } {
# puts "bind .drw <${s}> {}"
# puts "bind $win_path <${s}> {}"
bind $win_path "<${s}>" {}
} else {
# puts "bind .drw <${s}> xschem callback %W %T %x %y $keysym 0 0 $state"
# puts "bind $win_path <${s}> xschem callback %W %T %x %y $keysym 0 0 $state"
bind $win_path "<${s}>" "xschem callback %W %T %x %y $keysym 0 0 $state"
}
}