]> code.delx.au - gnu-emacs/blob - oldXMenu/DelSel.c
Merged from emacs@sv.gnu.org.
[gnu-emacs] / oldXMenu / DelSel.c
1 #include "copyright.h"
2
3 /* Copyright Massachusetts Institute of Technology 1985 */
4 /* Copyright (C) 2001, 2002, 2003, 2004, 2005,
5 2006 Free Software Foundation, Inc. */
6
7 /*
8 * XMenu: MIT Project Athena, X Window system menu package
9 *
10 * XMenuDeleteSelection - Deletes a selection from an XMenu object.
11 *
12 * Author: Tony Della Fera, DEC
13 * 20-Nov-85
14 *
15 */
16
17 #include "XMenuInt.h"
18
19 int
20 XMenuDeleteSelection(display, menu, p_num, s_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. */
24 register int s_num; /* Selection number to be deleted. */
25 {
26 register XMPane *p_ptr; /* Pointer to pane being deleted. */
27 register XMSelect *s_ptr; /* Pointer to selections being deleted. */
28
29 /*
30 * Find the right pane.
31 */
32 p_ptr = _XMGetPanePtr(menu, p_num);
33 if (p_ptr == NULL) return(XM_FAILURE);
34
35 /*
36 * Find the right selection.
37 */
38 s_ptr = _XMGetSelectionPtr(p_ptr, s_num);
39 if (s_ptr == NULL) return(XM_FAILURE);
40
41 /*
42 * Remove the selection from the association table.
43 */
44 XDeleteAssoc(display, menu->assoc_tab, s_ptr->window);
45
46 /*
47 * Remove the selection from the parent pane's selection
48 * list and update the selection count.
49 */
50 emacs_remque(s_ptr);
51 p_ptr->s_count--;
52
53 /*
54 * Destroy the selection transparency.
55 */
56 if (s_ptr->window) XDestroyWindow(display, s_ptr->window);
57
58 /*
59 * Free the selection's XMSelect structure.
60 */
61 free(s_ptr);
62
63 /*
64 * Schedule a recompute.
65 */
66 menu->recompute = 1;
67
68 /*
69 * Return the selection number just deleted.
70 */
71 _XMErrorCode = XME_NO_ERROR;
72 return(s_num);
73 }
74
75 /* arch-tag: 24ca2bc7-8a37-471a-8095-e6363fc1ed10
76 (do not change this comment) */