Fix brainos.
[emacs.git] / oldXMenu / DelSel.c
blob78b731131629183945faf7df5cabce9f617f0efd
1 #include "copyright.h"
3 /* Copyright Massachusetts Institute of Technology 1985 */
5 /*
6 * XMenu: MIT Project Athena, X Window system menu package
8 * XMenuDeleteSelection - Deletes a selection from an XMenu object.
10 * Author: Tony Della Fera, DEC
11 * 20-Nov-85
15 #include "XMenuInt.h"
17 int
18 XMenuDeleteSelection(display, menu, p_num, s_num)
19 register Display *display; /* Previously opened display. */
20 register XMenu *menu; /* Menu object to be modified. */
21 register int p_num; /* Pane number to be deleted. */
22 register int s_num; /* Selection number to be deleted. */
24 register XMPane *p_ptr; /* Pointer to pane being deleted. */
25 register XMSelect *s_ptr; /* Pointer to selections being deleted. */
28 * Find the right pane.
30 p_ptr = _XMGetPanePtr(menu, p_num);
31 if (p_ptr == NULL) return(XM_FAILURE);
34 * Find the right selection.
36 s_ptr = _XMGetSelectionPtr(p_ptr, s_num);
37 if (s_ptr == NULL) return(XM_FAILURE);
40 * Remove the selection from the association table.
42 XDeleteAssoc(display, menu->assoc_tab, s_ptr->window);
45 * Remove the selection from the parent pane's selection
46 * list and update the selection count.
48 emacs_remque(s_ptr);
49 p_ptr->s_count--;
52 * Destroy the selection transparency.
54 if (s_ptr->window) XDestroyWindow(display, s_ptr->window);
57 * Free the selection's XMSelect structure.
59 free(s_ptr);
62 * Schedule a recompute.
64 menu->recompute = 1;
67 * Return the selection number just deleted.
69 _XMErrorCode = XME_NO_ERROR;
70 return(s_num);
73 /* arch-tag: 24ca2bc7-8a37-471a-8095-e6363fc1ed10
74 (do not change this comment) */