1 /*
2 * Motif
3 *
4 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
5 *
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
16 * details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
22 */
23 /*
24 * HISTORY
25 */
26 #ifdef REV_INFO
27 #ifndef lint
28 static char rcsid[] = "$XConsortium: wsmDebug.c /main/6 1995/07/14 09:48:58 drk $"
29 #endif
30 #endif
31 #include <stdio.h>
32 #include <Xm/Xm.h>
33
34 #include "wsm.h"
35 #include "wsmStruct.h"
36 #include "wsmDebug.h"
37
38 extern Space *space_list;
39 extern Space *current_space;
40 extern WorkWindow *work_windows;
41
42 void print_space_windows(
43 Space *s
44 );
45
46 /**********************************************************************/
47 /* DEBUG CODE */
48 /**********************************************************************/
49
50
51 void
print_window(WorkWindow * w_window)52 print_window(WorkWindow *w_window)
53 {
54 #ifdef DEBUG2
55 int p;
56 PRINT("\nWINDOW %d = ",w_window->window);
57 for (p = 0; w_window->specifier_qlist[p] != NULLQUARK; p++)
58 PRINT("%s.", XrmQuarkToString(w_window->specifier_qlist[p]));
59 PRINT("\n");
60 if (w_window->mapped) PRINT("mapped\n");
61 else PRINT("unmapped\n");
62
63 #endif
64 }
65
print_all_windows()66 void print_all_windows()
67 {
68 #ifdef DEBUG
69 WorkWindow *w_window = work_windows;
70 while (w_window != NULL)
71 {
72 PRINT("WINDOW 0x%X %s\n", w_window->window,
73 XrmQuarkToString(w_window->specifier_qlist[0]));
74 w_window = w_window->next;
75 }
76 #endif
77 }
78
79 void
print_space_windows(Space * s)80 print_space_windows(Space *s)
81 {
82 #ifdef DEBUG
83 WorkWindowList *w_list;
84 if (s!= NULL)
85 {
86 w_list = s->w_list;
87 while (w_list != NULL)
88 {
89 PRINT("SPACE %s WINDOW 0x%X %s\n", XrmQuarkToString(s->nameq),
90 w_list->work_win->window,
91 XrmQuarkToString(w_list->work_win->specifier_qlist[0]));
92 w_list = w_list->next;
93 }
94 }
95 else PRINT("NULL space\n");
96 #endif
97 }
98
99
100 void
print_all_values(XrmValue ** attr_values,XrmQuarkList attrib_qlist,XrmQuarkList rooms_qlist,int num_attrib)101 print_all_values(XrmValue **attr_values,XrmQuarkList attrib_qlist,XrmQuarkList rooms_qlist, int num_attrib)
102 {
103 #ifdef DEBUG
104 int p,q;
105 for (p = 0; rooms_qlist[p] != NULLQUARK; p++)
106 {
107 for (q = 0; q < num_attrib; q++) {
108 if (attr_values[p][q].size != 0)
109 PRINT("%s %s : %s \n",
110 XrmQuarkToString(rooms_qlist[p]),
111 XrmQuarkToString(attrib_qlist[q]),
112 (char*)attr_values[p][q].addr);
113 else
114 {
115 PRINT("%s %s : NOT FOUND \n",
116 XrmQuarkToString(rooms_qlist[p]),
117 XrmQuarkToString(attrib_qlist[q]));
118 }
119
120 }
121 }
122 #endif
123 }
124
125
126 void
print_values(XrmValue * attr_values,XrmQuarkList attrib_qlist,XrmQuark room,int num_attrib)127 print_values(XrmValue *attr_values,XrmQuarkList attrib_qlist,XrmQuark room, int num_attrib)
128 {
129 #ifdef DEBUG2
130 int q;
131
132 for (q = 0; q < num_attrib; q++)
133 {
134 if (attr_values[q].size != 0)
135 PRINT(" v: %s %s : %s \n",
136 XrmQuarkToString(room),
137 XrmQuarkToString(attrib_qlist[q]),
138 (char*)attr_values[q].addr);
139 else
140 PRINT(" v: %s %s : NOT FOUND \n",
141 XrmQuarkToString(room),
142 XrmQuarkToString(attrib_qlist[q]));
143 }
144 #endif
145 }
146
147
148 void
print_win_data(WSMWinData * xrm_data_list,int num_xrm_data_list)149 print_win_data( WSMWinData *xrm_data_list, int num_xrm_data_list)
150 {
151 int p;
152 #ifdef DEBUG2
153 if (num_xrm_data_list == 0)
154 PRINT("D: no data \n");
155 else
156 {
157 for (p = 0; p < num_xrm_data_list; p++)
158 {
159 PRINT("D: %s %ld\n",
160 XrmQuarkToString(xrm_data_list[p].nameq),
161 xrm_data_list[p].data.value);
162 }
163 }
164 #endif
165 }
166
167
168
169
170
171
172 void
print_internal_win_data(WSMWinData * xrm_data_list,int num_xrm_data_list)173 print_internal_win_data( WSMWinData *xrm_data_list, int num_xrm_data_list)
174 {
175 #ifdef DEBUG
176 int p;
177
178 for (p = 0; p < num_xrm_data_list; p++)
179 {
180 PRINT("I: %s %ld\n",
181 XrmQuarkToString(xrm_data_list[p].nameq),
182 xrm_data_list[p].data.value);
183 }
184 #endif
185 }
186
187
188
189 void
print_request(WSMRequest * request)190 print_request(WSMRequest *request)
191 {
192 #ifdef DEBUG2
193 int p,q,i;
194 Window window;
195 WorkWindow *w_window;
196 PRINT("\nREQUEST:\n");
197 if (request->any.type == WSM_SET_STATE)
198 {
199 PRINT("num_win_info_list = %d\n",request->set_state.num_win_info_list);
200 for (p = 0; p < request->set_state.num_win_info_list; p++)
201 {
202 window = request->set_state.win_info_list[p].window;
203 w_window = GetWorkWindow(window);
204 PRINT(" %d ",window);
205 if ( _WSMGetConfigFormatType(window) == WSM_ICON_FMT)
206 PRINT(" ICON ");
207 else if ( _WSMGetConfigFormatType(window) == WSM_WINDOW_FMT)
208 PRINT(" WINDOW ");
209 else if ( _WSMGetConfigFormatType(window) == WSM_GLOBAL_FMT)
210 PRINT(" GLOBAL ");
211 if (w_window != NULL)
212 {
213 for (i = 0; w_window->specifier_qlist[i] != NULLQUARK; i++)
214 PRINT("%s.", XrmQuarkToString(w_window->specifier_qlist[i]));
215 }
216 PRINT("\n");
217 for (q = 0; q < request->set_state.win_info_list[p].num_data_list; q++)
218 {
219 PRINT(" %s %d\n",
220 XrmQuarkToString(request->set_state.win_info_list[p].data_list[q].nameq),
221 request->set_state.win_info_list[p].data_list[q].data.value);
222 }
223 }
224 }
225 PRINT("\n");
226 #endif
227 }
228
229
230 void
print_reply(WSMReply * reply)231 print_reply(WSMReply *reply)
232 {
233 #ifdef DEBUG2
234 int q;
235 PRINT("\n");
236 if (reply->any.type == WSM_REG_WINDOW)
237 {
238 PRINT("REPLY WSM_REG_WINDOW\n");
239 for (q = 0; q < reply->register_window.num_window_data; q++)
240 {
241 PRINT(" %s %d\n",
242 XrmQuarkToString(reply->register_window.window_data[q].nameq),
243 reply->register_window.window_data[q].data.value);
244 }
245 }
246 #endif
247 }
248
249 void
print_reply_start_state(WSMGetStateReply * get_state)250 print_reply_start_state(WSMGetStateReply *get_state)
251 {
252 #ifdef DEBUG2
253 int i,j,p;
254 Window window;
255 WorkWindow *w_window;
256 PRINT("REPLY WSM_GET_STATE\n");
257 for (i = 0; i < get_state->num_win_info_list; i ++)
258 {
259 window = get_state->win_info_list[i].window;
260 w_window = GetWorkWindow(window);
261 /* PRINT(" 0x%X \n",window);*/
262 PRINT(" %d ",window);
263 if ( _WSMGetConfigFormatType(window) == WSM_ICON_FMT)
264 PRINT(" ICON ");
265 else if ( _WSMGetConfigFormatType(window) == WSM_WINDOW_FMT)
266 PRINT(" WINDOW ");
267 else if ( _WSMGetConfigFormatType(window) == WSM_GLOBAL_FMT)
268 PRINT(" GLOBAL ");
269 if (w_window != NULL)
270 {
271 for (p = 0; w_window->specifier_qlist[p] != NULLQUARK; p++)
272 PRINT("%s.", XrmQuarkToString(w_window->specifier_qlist[p]));
273 }
274 PRINT("\n");
275 for (j = 0; j < get_state->win_info_list[i].num_data_list; j++)
276 PRINT(" %s %ld\n",
277 XrmQuarkToString(get_state->win_info_list[i].data_list[j].nameq),
278 get_state->win_info_list[i].data_list[j].data.value);
279 }
280 #endif
281 }
282
283
284 void
PrintSpace(char * name)285 PrintSpace(char *name)
286 {
287 #ifdef DEBUG
288 Space *s;
289 s = GetSpace(XrmStringToQuark(name));
290 if (s != NULL)
291 print_space_windows(s);
292 #endif
293 }
294
295
PrintAllSpaces()296 void PrintAllSpaces()
297 {
298 #ifdef DEBUG
299 Space *s = space_list;
300
301 while (s != NULL)
302 {
303 PRINT("SPACE: %s\n", s->name);
304 PRINT(" pixmap_name: %s\n", s->pixmap_name);
305 PRINT(" background: %s\n", s->background);
306 print_space_windows(s);
307 s = s->next;
308 }
309 #endif
310 }
311