Fix a problem introduced with 9541917a66e9ef59a64bfe19c0d4a6146e3433d3
[emacs.git] / oldXMenu / DelPane.c
blobe7568cff56e319ff5c55334819d1d1e650512392
1 /* Copyright Massachusetts Institute of Technology 1985 */
3 #include "copyright.h"
6 /*
7 * XMenu: MIT Project Athena, X Window system menu package
9 * XMenuDeletePane - Deletes a pane from an XMenu object.
11 * Author: Tony Della Fera, DEC
12 * 20-Nov-85
16 #include "XMenuInt.h"
18 int
19 XMenuDeletePane(display, menu, p_num)
20 register Display *display; /* Previously opened display */
21 register XMenu *menu; /* Menu object to be modified. */
22 register int p_num; /* Pane number to be deleted. */
24 register XMPane *p_ptr; /* Pointer to pane being deleted. */
25 register XMSelect *s_ptr; /* Pointer to selections being deleted. */
26 register XMSelect *s_next; /* Pointer to next selection to be deleted. */
29 * Find the right pane.
31 p_ptr = _XMGetPanePtr(menu, p_num);
32 if (p_ptr == NULL) return(XM_FAILURE);
35 * Remove the pane from the association table.
37 XDeleteAssoc(display, menu->assoc_tab, p_ptr->window);
40 * Remove the pane from the pane list and update
41 * the pane count.
43 emacs_remque(p_ptr);
44 menu->p_count--;
47 * Remove all the selections in the pane from the
48 * association table and free their XMSelect structures.
50 for (
51 s_ptr = p_ptr->s_list->next;
52 s_ptr != p_ptr->s_list;
53 s_ptr = s_next
54 ) {
55 XDeleteAssoc(display, menu->assoc_tab, s_ptr->window);
56 s_next = s_ptr->next;
57 free(s_ptr);
59 free(p_ptr->s_list);
61 if (p_ptr->window) {
63 * Destroy the selection transparencies.
65 XDestroySubwindows(display, p_ptr->window);
68 * Destroy the pane window.
70 XDestroyWindow(display, p_ptr->window);
74 * Free the pane's XMPane structure.
76 free(p_ptr);
79 * Schedule a recompute.
81 menu->recompute = 1;
84 * Return the pane number just deleted.
86 _XMErrorCode = XME_NO_ERROR;
87 return(p_num);
90 /* arch-tag: 32a5bfd4-4bac-4090-bb53-844110f4908e
91 (do not change this comment) */