From: Aaron Taylor Date: Thu, 8 Jul 2021 23:35:08 +0000 (-0700) Subject: Now NEDsim maintains the simulator when the window resizes, only resetting the displa... X-Git-Url: http://git.subgeniuskitty.com/screensavers/.git/commitdiff_plain/503470d7ddb5b5a0a42987abbb14b90c5eb705d9 Now NEDsim maintains the simulator when the window resizes, only resetting the display portion of the state struct. --- 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; } }