diff --git a/src/callback.c b/src/callback.c index a317f283..e55898d0 100644 --- a/src/callback.c +++ b/src/callback.c @@ -4623,7 +4623,8 @@ int callback(const char *win_path, int event, int mx, int my, KeySym key, int bu int wire_draw_active = (xctx->ui_state & STARTWIRE) || ((xctx->ui_state2 & MENUSTARTWIRE) && (xctx->ui_state & MENUSTART)) || (persistent_command && (xctx->last_command & STARTWIRE)); - + struct stat buf; + /* this fix uses an alternative method for getting mouse coordinates on KeyPress/KeyRelease * events. Some remote connection softwares do not generate the correct coordinates * on such events */ @@ -4660,6 +4661,13 @@ int callback(const char *win_path, int event, int mx, int my, KeySym key, int bu xctx->semaphore++; /* to recognize recursive callback() calls */ + + /* file exists and modification time on disk has changed since file loaded ... */ + if(!xctx->modified && !stat( xctx->sch[xctx->currsch], &buf) && xctx->time_last_modify && + xctx->time_last_modify != buf.st_mtime) { + set_modify(1); + } + c_snap = tclgetdoublevar("cadsnap"); #ifdef __unix__ state &= (1 <<13) -1; /* filter out anything above bit 12 (4096) */ diff --git a/src/draw.c b/src/draw.c index d18d865f..e9594cbe 100644 --- a/src/draw.c +++ b/src/draw.c @@ -5098,7 +5098,6 @@ void draw(void) #endif dbg(1, "draw()\n"); - if(!xctx || xctx->no_draw) return; tk_scaling = atof(tcleval("tk scaling")); cs = tclgetdoublevar("cadsnap"); diff --git a/src/xinit.c b/src/xinit.c index 53982f6f..934189bf 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -1552,7 +1552,6 @@ static int switch_window(int *window_count, const char *win_path, int tcl_ctx) } /* if window was closed then tkwin == 0 --> do nothing */ if(tkwin && n >= 0 && n < MAX_NEW_WINDOWS) { - struct stat buf; if(tcl_ctx) tclvareval("save_ctx ", xctx->current_win_path, NULL); xctx = save_xctx[n]; @@ -1561,12 +1560,7 @@ static int switch_window(int *window_count, const char *win_path, int tcl_ctx) tclvareval("housekeeping_ctx", NULL); } if(tcl_ctx && has_x) tclvareval("reconfigure_layers_button {}", NULL); - if(!stat( xctx->sch[xctx->currsch], &buf) && xctx->time_last_modify && - xctx->time_last_modify != buf.st_mtime) { - set_modify(1); - } else { - set_modify(-1); /* sets window title */ - } + set_modify(-1); /* sets window title */ return 0; } else return 1; } @@ -1603,7 +1597,6 @@ static int switch_tab(int *window_count, const char *win_path, int dr) dbg(1, "new_schematic() switch_tab: %s\n", new_path); /* if no matching tab found --> do nothing */ if(n >= 0 && n < MAX_NEW_WINDOWS) { - struct stat buf; if(xctx->current_win_path) { my_strncpy(previous_win_path, xctx->current_win_path, sizeof(previous_win_path)); } @@ -1615,13 +1608,7 @@ static int switch_tab(int *window_count, const char *win_path, int dr) if(has_x) tclvareval("reconfigure_layers_button {}", NULL); xctx->window = save_xctx[0]->window; if(dr) resetwin(1, 1, 1, 0, 0); - /* file exists and modification time on disk has changed since file loaded ... */ - if(!stat( xctx->sch[xctx->currsch], &buf) && xctx->time_last_modify && - xctx->time_last_modify != buf.st_mtime) { - set_modify(1); - } else { - set_modify(-1); /* sets window title */ - } + set_modify(-1); /* sets window title */ if(dr) draw(); return 0; } else return 1;