(best_matching_font): Abort for best == NULL before we start to use it.
[emacs.git] / oldXMenu / DelPane.c
blobe824b539cf1dbf2f58faf7ef69e1ed85d352d000
1 #include "copyright.h"
3 /* Copyright Massachusetts Institute of Technology 1985 */
4 /* Copyright (C) 2002, 2003, 2004, 2005,
5 2006 Free Software Foundation, Inc. */
7 /*
8 * XMenu: MIT Project Athena, X Window system menu package
10 * XMenuDeletePane - Deletes a pane from an XMenu object.
12 * Author: Tony Della Fera, DEC
13 * 20-Nov-85
17 #include "XMenuInt.h"
19 int
20 XMenuDeletePane(display, menu, p_num)
21 register Display *display; /* Previously opened display */
22 register XMenu *menu; /* Menu object to be modified. */
23 register int p_num; /* Pane number to be deleted. */
25 register XMPane *p_ptr; /* Pointer to pane being deleted. */
26 register XMSelect *s_ptr; /* Pointer to selections being deleted. */
27 register XMSelect *s_next; /* Pointer to next selection to be deleted. */
30 * Find the right pane.
32 p_ptr = _XMGetPanePtr(menu, p_num);
33 if (p_ptr == NULL) return(XM_FAILURE);
36 * Remove the pane from the association table.
38 XDeleteAssoc(display, menu->assoc_tab, p_ptr->window);
41 * Remove the pane from the pane list and update
42 * the pane count.
44 emacs_remque(p_ptr);
45 menu->p_count--;
48 * Remove all the selections in the pane from the
49 * association table and free their XMSelect structures.
51 for (
52 s_ptr = p_ptr->s_list->next;
53 s_ptr != p_ptr->s_list;
54 s_ptr = s_next
55 ) {
56 XDeleteAssoc(display, menu->assoc_tab, s_ptr->window);
57 s_next = s_ptr->next;
58 free(s_ptr);
60 free(p_ptr->s_list);
62 if (p_ptr->window) {
64 * Destroy the selection transparencies.
66 XDestroySubwindows(display, p_ptr->window);
69 * Destroy the pane window.
71 XDestroyWindow(display, p_ptr->window);
75 * Free the pane's XMPane structure.
77 free(p_ptr);
80 * Schedule a recompute.
82 menu->recompute = 1;
85 * Return the pane number just deleted.
87 _XMErrorCode = XME_NO_ERROR;
88 return(p_num);
91 /* arch-tag: 32a5bfd4-4bac-4090-bb53-844110f4908e
92 (do not change this comment) */