This source file includes following definitions.
- XMenuDestroy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 #include "XMenuInt.h"
35
36 void
37 XMenuDestroy(Display *display, register XMenu *menu)
38
39
40 {
41 register XMPane *p_ptr;
42 register XMPane *p_next;
43 register XMSelect *s_ptr;
44 register XMSelect *s_next;
45
46
47
48
49
50 for (
51 p_ptr = menu->p_list->next;
52 p_ptr != menu->p_list;
53 p_ptr = p_next
54 ) {
55 for (
56 s_ptr = p_ptr->s_list->next;
57 s_ptr != p_ptr->s_list;
58 s_ptr = s_next
59 ) {
60 s_next = s_ptr->next;
61 free(s_ptr);
62 }
63 if (p_ptr->window) {
64 XDestroySubwindows(display, p_ptr->window);
65 XDestroyWindow(display, p_ptr->window);
66 }
67 p_next = p_ptr->next;
68 free(p_ptr);
69 }
70
71
72
73
74 XDestroyAssocTable(menu->assoc_tab);
75
76
77
78
79 XFreeCursor(display, menu->mouse_cursor);
80
81
82
83
84 XFreeFont(display, menu->p_fnt_info);
85 XFreeFont(display, menu->s_fnt_info);
86
87
88
89
90
91
92
93
94
95 XFreePixmap(display, menu->inact_pixmap);
96
97
98
99
100 if ((menu->p_bdr_color != BlackPixel(display, DefaultScreen(display))) && (menu->p_bdr_color != WhitePixel(display, DefaultScreen(display))))
101 XFreeColors(
102 display,
103 DefaultColormap(display, DefaultScreen(display)),
104 &menu->p_bdr_color,
105 1, 0);
106 if ((menu->s_bdr_color != BlackPixel(display, DefaultScreen(display))) && (menu->s_bdr_color != WhitePixel(display, DefaultScreen(display))))
107 XFreeColors(
108 display,
109 DefaultColormap(display, DefaultScreen(display)),
110 &menu->s_bdr_color,
111 1, 0);
112 if ((menu->p_frg_color != BlackPixel(display, DefaultScreen(display))) && (menu->p_frg_color != WhitePixel(display, DefaultScreen(display))))
113 XFreeColors(
114 display,
115 DefaultColormap(display, DefaultScreen(display)),
116 &menu->p_frg_color,
117 1, 0);
118 if ((menu->s_frg_color != BlackPixel(display, DefaultScreen(display))) && (menu->s_frg_color != WhitePixel(display, DefaultScreen(display))))
119 XFreeColors(
120 display,
121 DefaultColormap(display, DefaultScreen(display)),
122 &menu->s_frg_color,
123 1, 0);
124 if ((menu->bkgnd_color != BlackPixel(display, DefaultScreen(display))) && (menu->bkgnd_color != WhitePixel(display, DefaultScreen(display))))
125 XFreeColors(
126 display,
127 DefaultColormap(display, DefaultScreen(display)),
128 &menu->bkgnd_color,
129 1, 0);
130
131
132
133
134 free(menu);
135 }