From 55ac6bb39663038a3b26384a2281917c644b5900 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sun, 3 Mar 2024 04:21:49 +0100 Subject: [PATCH] further fix previous regression --- src/callback.c | 6 +++--- src/move.c | 1 + src/paste.c | 2 -- src/save.c | 2 -- src/xschem.tcl | 4 ++++ 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/callback.c b/src/callback.c index 8d5dc484..81682235 100644 --- a/src/callback.c +++ b/src/callback.c @@ -1234,6 +1234,7 @@ int rstate; /* (reduced state, without ShiftMask) */ xctx->mouse_inside = 0; break; case EnterNotify: + dbg(2, "callback(): Enter event sel_or_clip=%s, ui_state=%d\n", sel_or_clip, xctx->ui_state); xctx->mouse_inside = 1; if(draw_xhair) tclvareval(xctx->top_path, ".drw configure -cursor none" , NULL); @@ -1242,7 +1243,7 @@ int rstate; /* (reduced state, without ShiftMask) */ /* xschem window *sending* selected objects when the pointer comes back in abort copy operation since it has been done in another xschem xctx->window; STARTCOPY set and selection file does not exist any more */ - if( stat(sel_or_clip, &buf) && (xctx->ui_state & STARTCOPY) ) + if(stat(sel_or_clip, &buf) && (xctx->ui_state & STARTCOPY) ) { copy_objects(ABORT); /* also unlinks sel_or_flip file */ unselect_all(1); @@ -1253,8 +1254,7 @@ int rstate; /* (reduced state, without ShiftMask) */ } /*xschem window *receiving* selected objects * no selected objects and selection file exists --> start merge */ - if(xctx->lastsel == 0 && !stat(sel_or_clip, &buf)) { - dbg(2, "callback(): Enter event\n"); + if(xctx->lastsel == 0 && !stat(sel_or_clip, &buf)) { xctx->mousex_snap = 490; xctx->mousey_snap = -340; merge_file(1, ".sch"); diff --git a/src/move.c b/src/move.c index a4596b9b..06412146 100644 --- a/src/move.c +++ b/src/move.c @@ -939,6 +939,7 @@ void move_objects(int what, int merge, double dx, double dy) { int firsti, firstw; + xunlink(sel_or_clip); if(xctx->connect_by_kissing == 2) xctx->connect_by_kissing = 0; /* no undo push for MERGE ad PLACE and polygon point drag, already done before */ diff --git a/src/paste.c b/src/paste.c index 1e328138..fc3c4101 100644 --- a/src/paste.c +++ b/src/paste.c @@ -330,8 +330,6 @@ void merge_file(int selection_load, const char ext[]) my_snprintf(name, S(name), "%s/.clipboard.sch", user_conf_dir); } - my_snprintf(sel_or_clip, S(sel_or_clip), name); - if(is_generator(name)) generator = 1; if(generator) { diff --git a/src/save.c b/src/save.c index 6c0bf55f..3d2c0adb 100644 --- a/src/save.c +++ b/src/save.c @@ -4888,8 +4888,6 @@ void save_selection(int what) else /* what=2 */ my_snprintf(name, S(name), "%s/%s.sch",user_conf_dir , ".clipboard"); - my_snprintf(sel_or_clip, S(sel_or_clip), name); - if(!(fd=fopen(name,"w"))) { fprintf(errfp, "save_selection(): problems opening file %s \n", name); diff --git a/src/xschem.tcl b/src/xschem.tcl index f7e483d5..4c926e40 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -6227,6 +6227,10 @@ proc context_menu { } { wm geometry .ctxmenu "+$x+$y";# move away from screen edges bind .ctxmenu {if { {%W} eq {.ctxmenu} } {destroy .ctxmenu}} tkwait window .ctxmenu + # when context menu is destroyed an EnterNotify event is generated in the + # main xschem window. We want to process this event before taking + # actions based on $retval. + update return $retval }