From 503470d7ddb5b5a0a42987abbb14b90c5eb705d9 Mon Sep 17 00:00:00 2001 From: Aaron Taylor Date: Thu, 8 Jul 2021 16:35:08 -0700 Subject: [PATCH] Now NEDsim maintains the simulator when the window resizes, only resetting the display portion of the state struct. --- hacks/NEDsim/NEDsim.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hacks/NEDsim/NEDsim.c b/hacks/NEDsim/NEDsim.c index df95105..2b576f0 100644 --- a/hacks/NEDsim/NEDsim.c +++ b/hacks/NEDsim/NEDsim.c @@ -781,8 +781,12 @@ NEDsim_reshape(Display * dpy, Window win, void * closure, unsigned int w, unsign XGetWindowAttributes(nedsim->dpy, nedsim->win, &xgwa); /* Only restart the simulation if the window changed size. */ if (nedsim->dpy_width != xgwa.width || nedsim->dpy_height != xgwa.height) { - NEDsim_free(dpy, win, closure); - closure = NEDsim_init(dpy, win); + struct NEDstate * original_nedstate = nedsim->nedstate; + nedsim->nedstate = NULL; + NEDsim_free(dpy, win, nedsim); + struct NEDsim * new_nedsim = NEDsim_init(dpy, win); + new_nedsim->nedstate = original_nedstate; + closure = new_nedsim; } } -- 2.20.1