better implementation of previous commit

This commit is contained in:
stefan schippers 2025-09-23 02:42:13 +02:00
parent 6ca06347b6
commit aa2d8b1b09
3 changed files with 11 additions and 17 deletions

View File

@ -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) || int wire_draw_active = (xctx->ui_state & STARTWIRE) ||
((xctx->ui_state2 & MENUSTARTWIRE) && (xctx->ui_state & MENUSTART)) || ((xctx->ui_state2 & MENUSTARTWIRE) && (xctx->ui_state & MENUSTART)) ||
(persistent_command && (xctx->last_command & STARTWIRE)); (persistent_command && (xctx->last_command & STARTWIRE));
struct stat buf;
/* this fix uses an alternative method for getting mouse coordinates on KeyPress/KeyRelease /* this fix uses an alternative method for getting mouse coordinates on KeyPress/KeyRelease
* events. Some remote connection softwares do not generate the correct coordinates * events. Some remote connection softwares do not generate the correct coordinates
* on such events */ * 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 */ 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"); c_snap = tclgetdoublevar("cadsnap");
#ifdef __unix__ #ifdef __unix__
state &= (1 <<13) -1; /* filter out anything above bit 12 (4096) */ state &= (1 <<13) -1; /* filter out anything above bit 12 (4096) */

View File

@ -5098,7 +5098,6 @@ void draw(void)
#endif #endif
dbg(1, "draw()\n"); dbg(1, "draw()\n");
if(!xctx || xctx->no_draw) return; if(!xctx || xctx->no_draw) return;
tk_scaling = atof(tcleval("tk scaling")); tk_scaling = atof(tcleval("tk scaling"));
cs = tclgetdoublevar("cadsnap"); cs = tclgetdoublevar("cadsnap");

View File

@ -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 window was closed then tkwin == 0 --> do nothing */
if(tkwin && n >= 0 && n < MAX_NEW_WINDOWS) { if(tkwin && n >= 0 && n < MAX_NEW_WINDOWS) {
struct stat buf;
if(tcl_ctx) tclvareval("save_ctx ", xctx->current_win_path, NULL); if(tcl_ctx) tclvareval("save_ctx ", xctx->current_win_path, NULL);
xctx = save_xctx[n]; 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); tclvareval("housekeeping_ctx", NULL);
} }
if(tcl_ctx && has_x) tclvareval("reconfigure_layers_button {}", NULL); if(tcl_ctx && has_x) tclvareval("reconfigure_layers_button {}", NULL);
if(!stat( xctx->sch[xctx->currsch], &buf) && xctx->time_last_modify && set_modify(-1); /* sets window title */
xctx->time_last_modify != buf.st_mtime) {
set_modify(1);
} else {
set_modify(-1); /* sets window title */
}
return 0; return 0;
} else return 1; } 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); dbg(1, "new_schematic() switch_tab: %s\n", new_path);
/* if no matching tab found --> do nothing */ /* if no matching tab found --> do nothing */
if(n >= 0 && n < MAX_NEW_WINDOWS) { if(n >= 0 && n < MAX_NEW_WINDOWS) {
struct stat buf;
if(xctx->current_win_path) { if(xctx->current_win_path) {
my_strncpy(previous_win_path, xctx->current_win_path, sizeof(previous_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); if(has_x) tclvareval("reconfigure_layers_button {}", NULL);
xctx->window = save_xctx[0]->window; xctx->window = save_xctx[0]->window;
if(dr) resetwin(1, 1, 1, 0, 0); if(dr) resetwin(1, 1, 1, 0, 0);
/* file exists and modification time on disk has changed since file loaded ... */ set_modify(-1); /* sets window title */
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 */
}
if(dr) draw(); if(dr) draw();
return 0; return 0;
} else return 1; } else return 1;