Always check for GUI events during simulation, if any graphs exist.
Previously this check was only made if an iplot window existed. The 100W.sp example displayed frozen windows with X11-based plotting.
This commit is contained in:
parent
312ef68614
commit
fc76d4d63b
|
|
@ -868,7 +868,6 @@ static int iplot(struct plot *pl, struct dbcomm *db)
|
|||
bool changed = FALSE;
|
||||
int id, yt;
|
||||
double xlims[2], ylims[2];
|
||||
static REQUEST reqst = { checkup_option, NULL };
|
||||
int inited = 0;
|
||||
int n_vec_plot = 0;
|
||||
|
||||
|
|
@ -958,16 +957,12 @@ static int iplot(struct plot *pl, struct dbcomm *db)
|
|||
inited = 1;
|
||||
|
||||
} else {
|
||||
/* plot the last points and resize if needed */
|
||||
|
||||
Input(&reqst, NULL);
|
||||
|
||||
/* Window was closed? */
|
||||
|
||||
if (!currentgraph)
|
||||
if (!currentgraph) /* Window was closed? */
|
||||
return 0;
|
||||
|
||||
/* First see if we have to make the screen bigger */
|
||||
/* Plot the latest points and resize if needed.
|
||||
* First see if we have to make the screen bigger.
|
||||
*/
|
||||
|
||||
dy = (isreal(xs) ? xs->v_realdata[len - 1] :
|
||||
realpart(xs->v_compdata[len - 1]));
|
||||
|
|
@ -1194,9 +1189,16 @@ void reset_trace(void)
|
|||
|
||||
void gr_iplot(struct plot *plot)
|
||||
{
|
||||
struct dbcomm *db;
|
||||
int dontpop; /* So we don't pop w/o push. */
|
||||
char buf[30];
|
||||
static REQUEST reqst = { checkup_option, NULL };
|
||||
struct dbcomm *db, *dc;
|
||||
int dontpop; /* So we don't pop w/o push. */
|
||||
char buf[30];
|
||||
|
||||
if (Have_graph) {
|
||||
/* There is at least one graph. Process input on graph windows. */
|
||||
|
||||
Input(&reqst, NULL);
|
||||
}
|
||||
|
||||
hit = 0;
|
||||
for (db = dbs; db; db = db->db_next) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ typedef struct gbucket {
|
|||
|
||||
static GBUCKET GBucket[NUMGBUCKETS];
|
||||
|
||||
/* Global variable to indicate that at least one graph exits. Ugly but fast. */
|
||||
|
||||
bool Have_graph;
|
||||
|
||||
/* note: Zero is not a valid id. This is used in plot() in graf.c. */
|
||||
static int RunningId = 1;
|
||||
|
||||
|
|
@ -81,7 +85,7 @@ GRAPH *NewGraph(void)
|
|||
}
|
||||
|
||||
RunningId++;
|
||||
|
||||
Have_graph = TRUE;
|
||||
return pgraph;
|
||||
} /* end of function NewGraph */
|
||||
|
||||
|
|
@ -108,7 +112,6 @@ GRAPH *FindGraph(int id)
|
|||
} /* end of function FindGraph */
|
||||
|
||||
|
||||
|
||||
GRAPH *CopyGraph(GRAPH *graph)
|
||||
{
|
||||
GRAPH *ret;
|
||||
|
|
@ -235,7 +238,15 @@ int DestroyGraph(int id)
|
|||
lastlist->next = list->next;
|
||||
}
|
||||
else { /* at front */
|
||||
int i;
|
||||
|
||||
GBucket[index].list = list->next;
|
||||
for (i = 0; i < NUMGBUCKETS; ++i) {
|
||||
if (GBucket[i].list)
|
||||
break;
|
||||
}
|
||||
if (i >= NUMGBUCKETS)
|
||||
Have_graph = FALSE;
|
||||
}
|
||||
|
||||
/* Run through and de-allocate dynamically allocated keyed list */
|
||||
|
|
@ -307,6 +318,7 @@ void FreeGraphs(void)
|
|||
txfree(deadl);
|
||||
}
|
||||
}
|
||||
Have_graph = FALSE;
|
||||
} /* end of functdion FreeGraphs */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,4 +12,7 @@ void SetGraphContext(int graphid);
|
|||
void PushGraphContext(GRAPH *graph);
|
||||
void PopGraphContext(void);
|
||||
|
||||
/* Global variable to indicate that at least one graph exits. Ugly but fast. */
|
||||
|
||||
extern bool Have_graph;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue