From: Philipp K. <phi...@gm...> - 2012-11-21 11:14:35
|
Hi, The callbacks of type FGCBDestroy take no input argument, and consequently it's impossible from such a callback to determine which window/menu is actually about to be destroyed. (The respective code suggests that the current window may differ from the soon-destroyed one.) Such functionality would be very convenient for programs that need to maintain data about GLUT windows, for example because they allocate per-window resources on their side. As far as I can see, there's currently no way of releasing these resources (or taking other actions) immediately on closing a window using the [x] button. This leads to code that has to work around this issue by calling glutSetWindow() somewhere later to determine (using glutGetWindow()) if that window still exists. Arguably, this is not pretty. Because changing the FGCBDestroy type to take one input argument (the GLUT window ID) is problematic for versioning/compatibility reasons, I propose to add an exported function "glutGetSoonDestroyedWindow" or similar, that's supposed to be called inside any of the functions set by glutCloseFunc, glutWMCloseFunc or glutMenuDestroyFunc. In a way, it would mimic glutGetWindow() for live windows... I'd gladly implement the functionality myself, but I'd like to hear some comments first. --Philipp |