diff --git a/src/callback.c b/src/callback.c index 2b308c61..1d609a16 100644 --- a/src/callback.c +++ b/src/callback.c @@ -1439,12 +1439,16 @@ int callback(int event, int mx, int my, KeySym key, mx_save = mx; my_save = my; /* 20171218 */ mx_double_save=mousex_snap; my_double_save=mousey_snap; - if(semaphore<2) { /* 20160425 */ + + /* useless code ? 20200905 */ + /* if(semaphore<2) { rebuild_selected_array(); if(lastselected==0) ui_state &=~SELECTION; - } + } */ + select_object(mousex, mousey, 0, 0); rebuild_selected_array(); + if(lastselected==0) ui_state &=~SELECTION; } else if(button==Button2 && (state == 0)) { pan2(BEGIN, mx, my); diff --git a/src/xinit.c b/src/xinit.c index ba2c3600..ebf3b4cb 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -1339,6 +1339,16 @@ int Tcl_AppInit(Tcl_Interp *inter) set_grid(0); /* set default value specified in xschemrc as 'grid' else CADGRID */ } /* if(has_x) */ dbg(1, "Tcl_AppInit(): done X init\n"); + +/* pass to tcl values of Alt, Shift, COntrol key masks so bind Alt-KeyPress events will work for windows */ +#ifndef __unix__ + my_snprintf(tmp, S(tmp), "%d", Mod1Mask); + tclsetvar("Mod1Mask", tmp); + my_snprintf(tmp, S(tmp), "%d", ShiftMask); + tclsetvar("ShiftMask", tmp); + my_snprintf(tmp, S(tmp), "%d", ControlMask); + tclsetvar("ControlMask", tmp); +#endif /* END X INITIALIZATION */ init_done=1; /* 20171008 moved before option processing, otherwise xwin_exit will not be invoked */ diff --git a/src/xschem.tcl b/src/xschem.tcl index a7250dbc..13ea10bf 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -2925,6 +2925,15 @@ proc build_windows {} { } bind .drw {xschem callback %T %x %y 0 %b 0 %s} + + # on Windows Alt key mask is reported as 131072 (1<<17) so build masks manually with values passed from C code + if {$::OS == "Windows" } { + bind .drw {puts xxx; xschem callback %T %x %y %N 0 0 [expr $Mod1Mask]} + bind .drw {xschem callback %T %x %y %N 0 0 [expr $ShiftMask + $Mod1Mask]} + bind .drw {xschem callback %T %x %y %N 0 0 9 [expr $ControlMask + $Mod1Mask]} + } + + bind .drw {xschem callback %T %x %y %N 0 0 %s} bind .drw {xschem callback %T %x %y %N 0 0 %s} bind .drw {xschem callback %T %x %y %N 0 0 %s} ;# 20161118 bind .drw {xschem callback %T %x %y 0 0 0 %s}