MCPcopy Create free account
hub / github.com/SimHacker/micropolis / Tk_DestroyWindow

Function Tk_DestroyWindow

micropolis-activity/src/tk/tkwindow.c:847–960  ·  view source on GitHub ↗
(tkwin)

Source from the content-addressed store, hash-verified

845 * Results:
846 * None.
847 *
848 * Side effects:
849 * The window is deleted, along with all of its children.
850 * Relevant callback procedures are invoked.
851 *
852 *--------------------------------------------------------------
853 */
854
855void
856Tk_DestroyWindow(tkwin)
857 Tk_Window tkwin; /* Window to destroy. */
858{
859 register TkWindow *winPtr = (TkWindow *) tkwin;
860 XEvent event;
861
862 /*
863 * Recursively destroy children. The TK_RECURSIVE_DESTROY
864 * flags means that the child's window needn't be explicitly
865 * destroyed (the destroy of the parent already did it), nor
866 * does it need to be removed from its parent's child list,
867 * since the parent is being destroyed too.
868 */
869
870 while (winPtr->childList != NULL) {
871 winPtr->childList->flags |= TK_RECURSIVE_DESTROY;
872 Tk_DestroyWindow((Tk_Window) winPtr->childList);
873 }
874
875 /*
876 * Generate a DestroyNotify event. In order for the DestroyNotify
877 * event to be processed correctly, need to make sure the window
878 * exists. This is a bit of a kludge, and may be unnecessarily
879 * expensive, but without it no event handlers will get called for
880 * windows that don't exist yet.
881 */
882
883 if (winPtr->window == None) {
884 Tk_MakeWindowExist(tkwin);
885 }
886 winPtr->flags |= TK_ALREADY_DEAD;
887 event.type = DestroyNotify;
888 event.xdestroywindow.serial =
889 LastKnownRequestProcessed(winPtr->display);
890 event.xdestroywindow.send_event = False;
891 event.xdestroywindow.display = winPtr->display;
892 event.xdestroywindow.event = winPtr->window;
893 event.xdestroywindow.window = winPtr->window;
894 Tk_HandleEvent(&event);
895
896 /*
897 * Cleanup the data structures associated with this window.
898 * No need to destroy windows during recursive destroys, since
899 * that will happen automatically when the parent window is
900 * destroyed (not true for top-level windows: must destroy
901 * them explicitly).
902 */
903
904 if (winPtr->window != None) {

Callers 15

CamCmdFunction · 0.85
GraphViewCmdFunction · 0.85
DateViewCmdFunction · 0.85
TileViewCmdFunction · 0.85
Tk_IntervalCmdFunction · 0.85
Tk_PieMenuCmdFunction · 0.85
Tk_MessageCmdFunction · 0.85
Tk_ButtonCmdFunction · 0.85
Tk_ScrollbarCmdFunction · 0.85
Tk_MenuCmdFunction · 0.85
Tk_DestroyCmdFunction · 0.85
Tk_ListboxCmdFunction · 0.85

Calls 13

Tk_MakeWindowExistFunction · 0.85
panicFunction · 0.85
TkOptionDeadWindowFunction · 0.85
TkSelDeadWindowFunction · 0.85
TkWmDeadWindowFunction · 0.85
TkGrabDeadWindowFunction · 0.85
Tk_DeleteAllBindingsFunction · 0.85
Tcl_DeleteHashEntryFunction · 0.85
Tcl_DeleteHashTableFunction · 0.85
Tk_DeleteBindingTableFunction · 0.85
Tk_HandleEventFunction · 0.70
TkEventDeadWindowFunction · 0.70

Tested by

no test coverage detected