I normally edit 10 to 20 files at the same time and my screen is filled with editor icons. To make things less messy, I edited your source/window.c file so that when I iconify an editor window, the window gets unmapped if there is at least one more window or icon viewable on the screen. To get the unmapped window back, I just select it from the "Windows" menu. Define -DHIDE_ICONS to get these changes compiled in. I have only tested these changes under SGI IRIX 6.1. (Yunliang Yu, yu@math.duke.edu) ---------------------------------------------------------------------- diff -rc ../nedit_source.org/source/window.c ./source/window.c *** ../nedit_source.org/source/window.c Wed Mar 20 16:13:51 1996 --- ./source/window.c Fri May 24 14:01:49 1996 *************** *** 89,94 **** --- 89,130 ---- static void patchedRemoveChild(Widget child); #endif + #ifdef HIDE_ICONS + #define isViewable(w) \ + XGetWindowAttributes(TheDisplay, XtWindow(w), &xwa) &&\ + xwa.map_state == IsViewable + static void StructureNotifyCB(Widget w, XtPointer clientData, + XEvent *event, Boolean *flag) + { + WindowInfo *wi, *window=(WindowInfo *)clientData; + XWindowAttributes xwa; + Boolean lastone=True; /* this is the last viewable window */ + + /* printf("StructureNotifyCB changed\n"); */ + switch(event->xany.type){ + case UnmapNotify: + for (wi=WindowList; wi!=NULL; wi=wi->next) { + if(wi==window) continue; + if(isViewable(wi)){ + lastone=False;break; + } + } + if(!lastone){ + XWithdrawWindow(TheDisplay,XtWindow(w),DefaultScreen(TheDisplay)); + } /* else let WM iconify the window */ + + /* printf("unmap notify\n"); */ + break; + case MapNotify: + /* printf("Map notify\n"); */ + break; + default: + /* XtDispatchEvent(event); Don't do this, infinite loop*/ + break; + } + } + #endif + /* ** Create a new editor window */ *************** *** 157,162 **** --- 193,203 ---- applicationShellWidgetClass, TheDisplay, al, ac); window->shell = appShell; + #ifdef HIDE_ICONS + XtAddEventHandler(appShell, StructureNotifyMask, FALSE, + StructureNotifyCB, (XtPointer)window ); + #endif + #ifdef EDITRES XtAddEventHandler (appShell, (EventMask)0, True, _XEditResCheckMessages, NULL); *************** *** 255,260 **** --- 296,306 ---- */ void CloseWindow(WindowInfo *window) { + #ifdef HIDE_ICONS + WindowInfo *wi; + XWindowAttributes xwa; + #endif + /* if this is the last window, don't close it, make it Untitled */ if (WindowList == window && window->next == NULL) { window->readOnly = FALSE; *************** *** 278,283 **** --- 324,345 ---- updateStatsLine(window); return; } + + #ifdef HIDE_ICONS + /* bring up a hidden window if any */ + if(isViewable(window->shell)){ + for (wi=WindowList; wi!=NULL; wi=wi->next) { + if(wi == window) continue; + if(!(isViewable(wi->shell))){ + XMapRaised(TheDisplay,XtWindow(wi->shell)); + break; + } else { + XRaiseWindow(TheDisplay,XtWindow(wi->shell)); + break; + } + } + } + #endif /* remove the buffer modification callback so the buffer will be deallocated when the last text widget is destroyed */