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 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | #ifdef HAVE_CONFIG_H1 |
56 | #include <config.h> |
57 | #endif |
58 | #include "Intrinsic.h" |
59 | #include "IntrinsicI.h" |
60 | #include "Core.h" |
61 | #include "CoreP.h" |
62 | #include "ShellP.h" |
63 | #include "StringDefs.h" |
64 | #include "ResConfigP.h" |
65 | #include <X11/Xatom.h> |
66 | #include <stdio.h> |
67 | #include <stdlib.h> |
68 | |
69 | #define MAX_BUFFER512 512 |
70 | |
71 | static void _search_child(Widget, char *, char *, char *, char *, char, char *); |
72 | static void _set_and_search(Widget, char *, char *, char *, char *, char , char *); |
73 | static int _locate_children(Widget, Widget **); |
74 | |
75 | #if defined(sun) && !defined(SVR4) |
76 | # define Strtoul(a,b,c)strtoul(a,b,c) (unsigned long)strtol(a,b,c) |
77 | #else |
78 | # define Strtoul(a,b,c)strtoul(a,b,c) strtoul(a,b,c) |
79 | #endif |
80 | |
81 | |
82 | |
83 | |
84 | |
85 | |
86 | |
87 | |
88 | |
89 | |
90 | |
91 | |
92 | |
93 | |
94 | |
95 | |
96 | |
97 | |
98 | |
99 | |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | static void |
107 | _set_resource_values ( |
108 | Widget w, |
109 | char *resource, |
110 | char *value, |
111 | char *last_part) |
112 | { |
113 | XrmDatabase db = NULL((void*)0); |
114 | char *resource_name = NULL((void*)0); |
115 | char *resource_class = NULL((void*)0); |
116 | char *return_type; |
117 | XrmValue return_value; |
118 | char *resource_value; |
119 | Widget cur = w; |
120 | char *temp; |
121 | XtResourceList resources_return = NULL((void*)0); |
122 | Cardinal num_resources_return = 0; |
123 | Cardinal res_index; |
124 | Boolean found_resource = False0; |
125 | Display *dpy; |
126 | XrmDatabase tmp_db; |
127 | |
128 | if (!XtIsWidget (w)(((Object)(w))->object.widget_class->core_class.class_inited & 0x04)) |
| |
129 | dpy = XtDisplay (w->core.parent)(((w->core.parent)->core.screen)->display); |
130 | else |
131 | dpy = XtDisplay (w)(((w)->core.screen)->display); |
132 | tmp_db = XtDatabase(dpy); |
133 | |
134 | |
135 | |
136 | |
137 | XtGetResourceList (w->core.widget_class, |
138 | &resources_return, &num_resources_return); |
139 | |
140 | |
141 | |
142 | |
143 | |
144 | for (res_index=0; res_index<num_resources_return; res_index++) { |
| 2 | Assuming 'res_index' is < 'num_resources_return' |
|
| 3 | Loop condition is true. Entering loop body |
|
| 5 | Assuming 'res_index' is < 'num_resources_return' |
|
| 6 | Loop condition is true. Entering loop body |
|
| 8 | Assuming 'res_index' is < 'num_resources_return' |
|
| 9 | Loop condition is true. Entering loop body |
|
| 11 | Assuming 'res_index' is < 'num_resources_return' |
|
| 12 | Loop condition is true. Entering loop body |
|
145 | if ((strcmp (last_part, |
| |
| |
| |
| |
146 | resources_return[res_index].resource_name) == 0) || |
147 | (strcmp (last_part, |
148 | resources_return[res_index].resource_class) == 0)) { |
149 | found_resource = True1; |
150 | break; |
| 14 | Execution continues on line 159 |
|
151 | } |
152 | } |
153 | |
154 | |
155 | |
156 | |
157 | |
158 | |
159 | if (!found_resource |
| |
160 | || !resources_return[res_index].resource_name |
161 | || !resources_return[res_index].resource_class) { |
162 | XtFree ((char *) resources_return); |
163 | return; |
164 | } |
165 | |
166 | |
167 | |
168 | |
169 | |
170 | |
171 | |
172 | while (cur != NULL((void*)0)) { |
| 16 | Loop condition is true. Entering loop body |
|
| 20 | Assuming 'cur' is equal to null |
|
| 21 | Loop condition is false. Execution continues on line 222 |
|
173 | |
174 | |
175 | |
176 | if (resource_name) { |
| |
177 | XtAsprintf (&temp, ".%s%s", cur->core.name, resource_name); |
178 | XtFree (resource_name); |
179 | } else if (!XtIsWidget (cur)(((Object)(cur))->object.widget_class->core_class.class_inited & 0x04) || !cur->core.name) { |
| |
180 | cur = XtParent(cur)((cur)->core.parent); |
181 | continue; |
| 19 | Execution continues on line 172 |
|
182 | } else { |
183 | XtAsprintf (&temp, ".%s", cur->core.name); |
184 | } |
185 | resource_name = temp; |
186 | |
187 | |
188 | |
189 | |
190 | if ((XtIsTopLevelShell (cur)(((Object)(cur))->object.widget_class->core_class.class_inited & 0x80)) && (XtParent (cur)((cur)->core.parent) == NULL((void*)0))) { |
191 | ApplicationShellWidget top = |
192 | (ApplicationShellWidget) (cur); |
193 | |
194 | if (resource_class) { |
195 | XtAsprintf (&temp, ".%s%s", |
196 | top->application.class, resource_class); |
197 | } else { |
198 | XtAsprintf (&temp, ".%s", |
199 | top->application.class); |
200 | } |
201 | } else { |
202 | if (resource_class) { |
203 | XtAsprintf (&temp, ".%s%s", |
204 | cur->core.widget_class->core_class.class_name, |
205 | resource_class); |
206 | } else { |
207 | XtAsprintf (&temp, ".%s", |
208 | cur->core.widget_class->core_class.class_name); |
209 | } |
210 | } |
211 | if (resource_class != NULL((void*)0)) |
212 | XtFree (resource_class); |
213 | resource_class = temp; |
214 | |
215 | cur = XtParent(cur)((cur)->core.parent); |
216 | } |
217 | |
218 | |
219 | |
220 | |
221 | XtAsprintf (&temp, "%s.%s", resource_name, |
222 | resources_return[res_index].resource_name); |
223 | if (resource_name != NULL((void*)0)) |
| |
224 | XtFree (resource_name); |
225 | resource_name = temp; |
226 | |
227 | |
228 | |
229 | |
230 | XtAsprintf (&temp, "%s.%s", resource_class, |
231 | resources_return[res_index].resource_class); |
232 | if (resource_class != NULL((void*)0)) |
| |
233 | XtFree (resource_class); |
234 | resource_class = temp; |
235 | |
236 | #ifdef DEBUG |
237 | fprintf (stderrstderr, "resource_name = %s\n", resource_name); |
238 | fprintf (stderrstderr, "resource_class = %s\n", resource_class); |
239 | #endif |
240 | |
241 | |
242 | |
243 | |
244 | |
245 | |
246 | |
247 | |
248 | XrmPutStringResource (&db, resource, value); |
249 | XrmMergeDatabases (db, &tmp_db); |
250 | XrmGetResource (tmp_db, resource_name, resource_class, |
251 | &return_type, &return_value); |
252 | if (return_type) |
| 24 | Assuming 'return_type' is null |
|
| |
253 | resource_value = XtNewString (return_value.addr)((return_value.addr) != ((void*)0) ? (strcpy(XtMalloc((unsigned )strlen(return_value.addr) + 1), return_value.addr)) : ((void *)0)); |
254 | else |
255 | resource_value = XtNewString (value)((value) != ((void*)0) ? (strcpy(XtMalloc((unsigned)strlen(value ) + 1), value)) : ((void*)0)); |
| 26 | Within the expansion of the macro 'XtNewString':
|
a | Assuming 'value' is equal to null |
|
256 | |
257 | #ifdef DEBUG |
258 | fprintf (stderrstderr, |
259 | "Apply:\n\twidget = %s\n\tlast_part = %s\n\tvalue = %s\n", |
260 | (w->core.name == NULL((void*)0)) ? "NULL" : w->core.name, |
261 | resources_return[res_index].resource_name, |
262 | resource_value); |
263 | #endif |
264 | |
265 | |
266 | |
267 | |
268 | |
269 | XtVaSetValues (w, |
270 | XtVaTypedArg"XtVaTypedArg", resources_return[res_index].resource_name, |
271 | XtRString((char*)&XtStrings[1797]), resource_value, |
272 | strlen (resource_value) + 1, |
| 27 | Null pointer passed as an argument to a 'nonnull' parameter |
|
273 | NULL((void*)0)); |
274 | |
275 | XtFree ((char *) resources_return); |
276 | XtFree (resource_name); |
277 | XtFree (resource_class); |
278 | XtFree (resource_value); |
279 | } |
280 | |
281 | |
282 | |
283 | |
284 | |
285 | |
286 | |
287 | |
288 | |
289 | |
290 | |
291 | |
292 | |
293 | |
294 | |
295 | |
296 | |
297 | |
298 | |
299 | |
300 | |
301 | static void |
302 | _apply_values_to_children ( |
303 | Widget w, |
304 | char *remainder, |
305 | char *resource, |
306 | char *value, |
307 | char last_token, |
308 | char *last_part) |
309 | { |
310 | int i; |
311 | int num_children; |
312 | Widget *children; |
313 | |
314 | |
315 | |
316 | |
317 | num_children = _locate_children (w, &children); |
318 | |
319 | for (i=0; i<num_children; i++) { |
320 | |
321 | #ifdef DEBUG |
322 | if (XtIsWidget (children[i])(((Object)(children[i]))->object.widget_class->core_class .class_inited & 0x04) && XtIsWidget (w)(((Object)(w))->object.widget_class->core_class.class_inited & 0x04)) |
323 | fprintf (stderrstderr, "searching child %s of parent %s\n", |
324 | children[i]->core.name, w->core.name); |
325 | else |
326 | fprintf (stderrstderr,"searching child (NULL) of parent %s\n", |
327 | w->core.name); |
328 | if (!XtIsWidget (children[i])(((Object)(children[i]))->object.widget_class->core_class .class_inited & 0x04)) |
329 | fprintf (stderrstderr, "children[%d] is NOT a widget\n", i); |
330 | if (!XtIsWidget (w)(((Object)(w))->object.widget_class->core_class.class_inited & 0x04)) |
331 | fprintf (stderrstderr, "w is NOT a widget\n"); |
332 | #endif |
333 | |
334 | _set_resource_values (children[i], resource, value, last_part); |
335 | _apply_values_to_children (children[i], remainder, |
336 | resource, value, last_token, last_part); |
337 | } |
338 | |
339 | XtFree ((char *)children); |
340 | } |
341 | |
342 | |
343 | |
344 | |
345 | |
346 | |
347 | |
348 | |
349 | |
350 | |
351 | |
352 | |
353 | |
354 | |
355 | |
356 | |
357 | |
358 | |
359 | |
360 | |
361 | static void |
362 | _search_child ( |
363 | Widget w, |
364 | char *indx, |
365 | char *remainder, |
366 | char *resource, |
367 | char *value, |
368 | char last_token, |
369 | char *last_part) |
370 | { |
371 | int i; |
372 | int num_children; |
373 | Widget *children; |
374 | |
375 | |
376 | |
377 | |
378 | num_children = _locate_children (w, &children); |
379 | for (i=0; i<num_children; i++) { |
380 | _set_and_search (children[i], indx, remainder, resource, |
381 | value, last_token, last_part); |
382 | } |
383 | |
384 | XtFree ((char *)children); |
385 | } |
386 | |
387 | |
388 | |
389 | |
390 | |
391 | |
392 | |
393 | |
394 | |
395 | |
396 | |
397 | |
398 | |
399 | |
400 | |
401 | |
402 | |
403 | |
404 | |
405 | |
406 | |
407 | static char |
408 | _get_part ( |
409 | char *remainder, |
410 | char **indx, |
411 | char **part) |
412 | { |
413 | char buffer[MAX_BUFFER512]; |
414 | char *buf_ptr; |
415 | char token = **indx; |
416 | int i = 0; |
417 | |
418 | |
419 | |
420 | |
421 | buf_ptr = buffer; |
422 | (*indx)++; |
423 | while (**indx && (**indx != '.') && (**indx != '*')) { |
424 | *buf_ptr++ = *(*indx)++; |
425 | if (++i >= MAX_BUFFER512 - 1) |
426 | break; |
427 | } |
428 | *buf_ptr = '\0'; |
429 | |
430 | *part = XtNewString (buffer)((buffer) != ((void*)0) ? (strcpy(XtMalloc((unsigned)strlen(buffer ) + 1), buffer)) : ((void*)0)); |
431 | |
432 | if (strcmp (*indx, "") == 0) |
433 | *indx = NULL((void*)0); |
434 | |
435 | return (token); |
436 | } |
437 | |
438 | |
439 | |
440 | |
441 | |
442 | |
443 | |
444 | |
445 | |
446 | |
447 | |
448 | |
449 | |
450 | |
451 | |
452 | |
453 | static Boolean |
454 | _match_resource_to_widget ( |
455 | Widget w, |
456 | char *part) |
457 | { |
458 | |
459 | |
460 | |
461 | if (strcmp (part, "?") == 0) |
462 | return (True1); |
463 | |
464 | |
465 | |
466 | |
467 | |
468 | |
469 | |
470 | if (XtIsWidget (w)(((Object)(w))->object.widget_class->core_class.class_inited & 0x04)) { |
471 | if ((strcmp (w->core.name, part) == 0) || |
472 | (strcmp (w->core.widget_class->core_class.class_name, |
473 | part) == 0)) |
474 | return (True1); |
475 | else |
476 | return (False0); |
477 | } else { |
478 | if ((strcmp (w->core.widget_class->core_class.class_name, |
479 | part) == 0)) |
480 | return (True1); |
481 | else |
482 | return (False0); |
483 | } |
484 | } |
485 | |
486 | |
487 | |
488 | |
489 | |
490 | |
491 | |
492 | |
493 | |
494 | |
495 | |
496 | |
497 | |
498 | |
499 | |
500 | |
501 | |
502 | |
503 | |
504 | |
505 | |
506 | |
507 | |
508 | |
509 | |
510 | |
511 | |
512 | |
513 | |
514 | |
515 | |
516 | |
517 | |
518 | |
519 | |
520 | |
521 | |
522 | |
523 | |
524 | |
525 | |
526 | |
527 | |
528 | |
529 | |
530 | |
531 | |
532 | static void |
533 | _set_and_search ( |
534 | Widget w, |
535 | char *indx, |
536 | char *remainder, |
537 | char *resource, |
538 | char *value, |
539 | char last_token, |
540 | char *last_part) |
541 | { |
542 | char *part; |
543 | char *local_index = indx; |
544 | char token; |
545 | |
546 | |
547 | |
548 | |
549 | token = _get_part (remainder, &local_index, &part); |
550 | |
551 | if (_match_resource_to_widget (w, part)) { |
552 | if (token == '.') { |
553 | if (local_index == NULL((void*)0)) { |
554 | if (last_token == '.') { |
555 | _set_resource_values (w, resource, |
556 | value, last_part); |
557 | } else if (last_token == '*') { |
558 | _set_resource_values (w, resource, |
559 | value, last_part); |
560 | _apply_values_to_children (w, |
561 | remainder, resource, value, |
562 | last_token, last_part); |
563 | } |
564 | } else |
565 | _search_child (w, local_index, remainder, |
566 | resource, value, last_token, last_part); |
567 | return; |
568 | } |
569 | if (token == '*') { |
570 | if (local_index == NULL((void*)0)) { |
571 | if (last_token == '.') { |
572 | _set_resource_values (w, resource, |
573 | value, last_part); |
574 | } else if (last_token == '*') { |
575 | _set_resource_values (w, resource, |
576 | value, last_part); |
577 | _apply_values_to_children ( w, |
578 | remainder, resource, value, |
579 | last_token, last_part); |
580 | } |
581 | } else |
582 | _search_child (w, local_index, remainder, |
583 | resource, value, last_token, last_part); |
584 | } |
585 | } else { |
586 | |
587 | |
588 | if (token == '*') { |
589 | _search_child (w, indx, remainder, resource, value, |
590 | last_token, last_part); |
591 | } |
592 | } |
593 | |
594 | XtFree (part); |
595 | } |
596 | |
597 | |
598 | |
599 | |
600 | |
601 | |
602 | |
603 | |
604 | |
605 | |
606 | |
607 | |
608 | |
609 | |
610 | |
611 | |
612 | |
613 | |
614 | |
615 | |
616 | |
617 | static char |
618 | _get_last_part ( |
619 | char *remainder, |
620 | char **part) |
621 | { |
622 | char *loose, *tight; |
623 | |
624 | loose = strrchr (remainder, '*'); |
625 | tight = strrchr (remainder, '.'); |
626 | |
627 | if ((loose == NULL((void*)0)) && (tight == NULL((void*)0))) { |
628 | *part = XtNewString (remainder)((remainder) != ((void*)0) ? (strcpy(XtMalloc((unsigned)strlen (remainder) + 1), remainder)) : ((void*)0)); |
629 | return ('.'); |
630 | } |
631 | if ((loose == NULL((void*)0)) || (tight && (strcoll (loose, tight) < 0))) { |
632 | *tight++ = '\0'; |
633 | *part = XtNewString (tight)((tight) != ((void*)0) ? (strcpy(XtMalloc((unsigned)strlen(tight ) + 1), tight)) : ((void*)0)); |
634 | return ('.'); |
635 | } |
636 | if ((tight == NULL((void*)0)) || (loose && (strcoll (tight, loose) < 0))) { |
637 | *loose++ = '\0'; |
638 | *part = XtNewString (loose)((loose) != ((void*)0) ? (strcpy(XtMalloc((unsigned)strlen(loose ) + 1), loose)) : ((void*)0)); |
639 | return ('*'); |
640 | } |
641 | *part = NULL((void*)0); |
642 | |
643 | return ('0'); |
644 | } |
645 | |
646 | |
647 | |
648 | |
649 | |
650 | |
651 | |
652 | |
653 | |
654 | |
655 | |
656 | |
657 | |
658 | |
659 | |
660 | |
661 | |
662 | |
663 | |
664 | |
665 | |
666 | |
667 | |
668 | |
669 | |
670 | |
671 | |
672 | |
673 | |
674 | |
675 | static void |
676 | _search_widget_tree ( |
677 | Widget w, |
678 | char *resource, |
679 | char *value) |
680 | { |
681 | Widget parent = w; |
682 | char *last_part; |
683 | char *remainder = NULL((void*)0); |
684 | char last_token; |
685 | char *indx, *copy; |
686 | char *loose, *tight; |
687 | int loose_len, tight_len; |
688 | |
689 | |
690 | |
691 | |
692 | while (XtParent(parent)((parent)->core.parent) != NULL((void*)0)) { |
693 | parent = XtParent(parent)((parent)->core.parent); |
694 | } |
695 | #ifdef DEBUG |
696 | if (XtIsWidget (w)(((Object)(w))->object.widget_class->core_class.class_inited & 0x04) && XtIsWidget (parent)(((Object)(parent))->object.widget_class->core_class.class_inited & 0x04)) |
697 | fprintf (stderrstderr, "widget = %s parent = %s\n", |
698 | w->core.name, parent->core.name); |
699 | else |
700 | fprintf (stderrstderr, "widget = NULL parent = NULL\n"); |
701 | #endif |
702 | |
703 | |
704 | |
705 | |
706 | |
707 | loose = strchr (resource, '*'); |
708 | tight = strchr (resource, '.'); |
709 | if ((loose == NULL((void*)0)) && (tight == NULL((void*)0))) |
710 | return; |
711 | |
712 | loose_len = (loose) ? strlen (loose) : 0; |
713 | tight_len = (tight) ? strlen (tight) : 0; |
714 | |
715 | if ((loose == NULL((void*)0)) || (tight_len > loose_len)) |
716 | remainder = XtNewString (tight)((tight) != ((void*)0) ? (strcpy(XtMalloc((unsigned)strlen(tight ) + 1), tight)) : ((void*)0)); |
717 | else if ((tight == NULL((void*)0)) || (loose_len > tight_len)) |
718 | remainder = XtNewString (loose)((loose) != ((void*)0) ? (strcpy(XtMalloc((unsigned)strlen(loose ) + 1), loose)) : ((void*)0)); |
719 | |
720 | |
721 | |
722 | |
723 | |
724 | last_token = _get_last_part (remainder, &last_part); |
725 | |
726 | |
727 | |
728 | if (remainder[0] == 0) { |
729 | _set_resource_values (w, resource, value, last_part); |
730 | if (last_token == '*') |
731 | _apply_values_to_children (parent, remainder, resource, |
732 | value, last_token, last_part); |
733 | |
734 | |
735 | |
736 | |
737 | } else { |
738 | if (remainder[0] != '*' && remainder[0] != '.') { |
739 | XtAsprintf (©, ".%s", remainder); |
740 | XtFree (remainder); |
741 | remainder = copy; |
742 | } |
743 | indx = remainder; |
744 | _set_and_search (parent, indx, remainder, resource, value, |
745 | last_token, last_part); |
746 | } |
747 | |
748 | XtFree (remainder); |
749 | XtFree (last_part); |
750 | } |
751 | |
752 | |
753 | |
754 | |
755 | |
756 | |
757 | |
758 | |
759 | |
760 | |
761 | |
762 | |
763 | |
764 | |
765 | |
766 | |
767 | |
768 | |
769 | |
770 | static int |
771 | _locate_children ( |
772 | Widget parent, |
773 | Widget **children) |
774 | { |
775 | CompositeWidget comp = (CompositeWidget) parent; |
776 | Cardinal i; |
777 | int num_children = 0; |
778 | int current = 0; |
779 | |
780 | |
781 | |
782 | |
783 | if (XtIsWidget (parent)(((Object)(parent))->object.widget_class->core_class.class_inited & 0x04)) |
784 | num_children += parent->core.num_popups; |
785 | if (XtIsComposite (parent)(((Object)(parent))->object.widget_class->core_class.class_inited & 0x08)) |
786 | num_children += comp->composite.num_children; |
787 | if (num_children == 0) { |
788 | *children = NULL((void*)0); |
789 | return (0); |
790 | } |
791 | |
792 | *children = (Widget *) |
793 | XtMalloc ((Cardinal) sizeof(Widget) * num_children); |
794 | |
795 | if (XtIsComposite (parent)(((Object)(parent))->object.widget_class->core_class.class_inited & 0x08)) { |
796 | for (i=0; i<comp->composite.num_children; i++) { |
797 | (*children)[current] = comp->composite.children[i]; |
798 | current++; |
799 | } |
800 | } |
801 | |
802 | if (XtIsWidget (parent)(((Object)(parent))->object.widget_class->core_class.class_inited & 0x04)) { |
803 | for (i=0; i<parent->core.num_popups; i++) { |
804 | (*children)[current] = comp->core.popup_list[i]; |
805 | current++; |
806 | } |
807 | } |
808 | |
809 | return (num_children); |
810 | } |
811 | |
812 | #ifdef DEBUG |
813 | |
814 | |
815 | |
816 | |
817 | |
818 | |
819 | |
820 | |
821 | |
822 | |
823 | |
824 | |
825 | |
826 | |
827 | static void |
828 | dump_widget_tree ( |
829 | Widget w, |
830 | int indent) |
831 | { |
832 | int i,j; |
833 | int num_children; |
834 | Widget *children; |
835 | |
836 | |
837 | |
838 | |
839 | num_children = _locate_children (w, &children); |
840 | indent += 2; |
841 | for (i=0; i<num_children; i++) { |
842 | if (children[i] != NULL((void*)0)) { |
843 | for (j=0; j<indent; j++) |
844 | fprintf (stderrstderr, " "); |
845 | if (XtIsWidget (children[i])(((Object)(children[i]))->object.widget_class->core_class .class_inited & 0x04)) { |
846 | fprintf (stderrstderr, "(%s)\t",children[i]->core.name); |
847 | fprintf (stderrstderr, "(%s)\n", |
848 | children[i]->core.widget_class->core_class.class_name); |
849 | } else { |
850 | fprintf (stderrstderr, "(NULL)\t"); |
851 | fprintf (stderrstderr, "(%s)\n", |
852 | children[i]->core.widget_class->core_class.class_name); |
853 | } |
854 | } |
855 | dump_widget_tree (children[i], indent); |
856 | } |
857 | |
858 | XtFree ((char *)children); |
859 | } |
860 | #endif |
861 | |
862 | |
863 | |
864 | |
865 | |
866 | |
867 | |
868 | |
869 | |
870 | |
871 | |
872 | |
873 | |
874 | |
875 | |
876 | |
877 | |
878 | |
879 | |
880 | |
881 | |
882 | |
883 | |
884 | |
885 | |
886 | |
887 | |
888 | |
889 | |
890 | |
891 | |
892 | void |
893 | _XtResourceConfigurationEH ( |
894 | Widget w, |
895 | XtPointer client_data, |
896 | XEvent *event) |
897 | { |
898 | Atom actual_type; |
899 | int actual_format; |
900 | unsigned long nitems; |
901 | unsigned long leftover; |
902 | unsigned char *data = NULL((void*)0); |
903 | unsigned long resource_len; |
904 | char *data_ptr; |
905 | char *resource; |
906 | char *value; |
907 | #ifdef DEBUG |
908 | int indent = 0; |
909 | #endif |
910 | XtPerDisplay pd; |
911 | |
912 | #ifdef DEBUG |
913 | fprintf (stderrstderr, "in _XtResourceConfiguationEH atom = %d\n",event->xproperty.atom); |
914 | fprintf (stderrstderr, " window = %x\n", XtWindow (w)((w)->core.window)); |
915 | if (XtIsWidget (w)(((Object)(w))->object.widget_class->core_class.class_inited & 0x04)) |
916 | fprintf (stderrstderr, " widget = %x name = %s\n", w, w->core.name); |
917 | #endif |
918 | |
919 | pd = _XtGetPerDisplay (XtDisplay (w)(((w)->core.screen)->display)); |
920 | |
921 | |
922 | |
923 | |
924 | |
925 | |
926 | |
927 | |
928 | |
929 | |
930 | if (event->xproperty.atom == pd->rcm_init) { |
931 | XDeleteProperty (XtDisplay(w)(((w)->core.screen)->display), XtWindow (w)((w)->core.window), pd->rcm_init); |
932 | |
933 | #ifdef DEBUG |
934 | if (XtIsWidget (w)(((Object)(w))->object.widget_class->core_class.class_inited & 0x04)) |
935 | fprintf (stderrstderr, "%s\n", w->core.name); |
936 | else |
937 | fprintf (stderrstderr, "NULL name\n"); |
938 | dump_widget_tree(w, indent); |
939 | |
940 | fprintf (stderrstderr, "answer ping\n"); |
941 | #endif |
942 | } |
943 | |
944 | |
945 | |
946 | |
947 | |
948 | if (event->xproperty.atom != pd->rcm_data) |
949 | return; |
950 | |
951 | |
952 | |
953 | |
954 | #ifdef DEBUG |
955 | fprintf (stderrstderr, "receiving RCM_DATA property\n"); |
956 | #endif |
957 | if (XGetWindowProperty (XtDisplay(w)(((w)->core.screen)->display), |
958 | XtWindow (w)((w)->core.window), |
959 | pd->rcm_data, 0L, 8192L, |
960 | TRUE1, XA_STRING((Atom) 31), |
961 | &actual_type, &actual_format, &nitems, &leftover, |
962 | &data ) == Success0 && actual_type == XA_STRING((Atom) 31) |
963 | && actual_format == 8) { |
964 | |
965 | |
966 | |
967 | |
968 | |
969 | |
970 | |
971 | |
972 | |
973 | if (data) { |
974 | resource_len = Strtoul ((void *)data, &data_ptr, 10)strtoul((void *)data,&data_ptr,10); |
975 | data_ptr++; |
976 | |
977 | data_ptr[resource_len] = '\0'; |
978 | |
979 | resource = XtNewString (data_ptr)((data_ptr) != ((void*)0) ? (strcpy(XtMalloc((unsigned)strlen (data_ptr) + 1), data_ptr)) : ((void*)0)); |
980 | value = XtNewString (&data_ptr[resource_len + 1])((&data_ptr[resource_len + 1]) != ((void*)0) ? (strcpy(XtMalloc ((unsigned)strlen(&data_ptr[resource_len + 1]) + 1), & data_ptr[resource_len + 1])) : ((void*)0)); |
981 | #ifdef DEBUG |
982 | fprintf (stderrstderr, "resource_len=%d\n",resource_len); |
983 | fprintf (stderrstderr, "resource = %s\t value = %s\n", |
984 | resource, value); |
985 | #endif |
986 | |
987 | |
988 | |
989 | |
990 | _search_widget_tree (w, resource, value); |
991 | |
992 | XtFree (resource); |
993 | XtFree (value); |
994 | } |
995 | } |
996 | |
997 | if (data) |
998 | XFree ((char *)data); |
999 | } |