7fd59977 |
1 | |
2 | #include <Xw_Extension.h> |
3 | |
4 | /* ifdef then trace on */ |
5 | #ifdef TRACE |
6 | #define TRACE_GET_DISPLAY_VISUAL |
7 | #endif |
8 | |
9 | /* |
10 | Xw_TypeOfVisual Xw_get_display_visual (adisplay,pclass): |
11 | XW_EXT_DISPLAY *adisplay Extended Display structure |
12 | Xw_TypeOfVisual pclass Preferred Visual Class |
13 | |
14 | Returns the X display attributes of a connexion |
15 | |
16 | returns XW_DEFAULT_VISUAL if something is wrong |
17 | returns the best Visual class if Successfull |
18 | |
19 | */ |
20 | |
21 | #ifdef XW_PROTOTYPE |
22 | Xw_TypeOfVisual Xw_get_display_visual (void *adisplay,Xw_TypeOfVisual pclass) |
23 | #else |
24 | Xw_TypeOfVisual Xw_get_display_visual (adisplay,pclass) |
25 | void *adisplay ; |
26 | Xw_TypeOfVisual pclass; |
27 | #endif /*XW_PROTOTYPE*/ |
28 | { |
29 | XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; |
30 | Xw_TypeOfVisual rclass = Xw_TOV_DEFAULT ; |
31 | XVisualInfo *ginfo ; |
32 | |
33 | if( !Xw_isdefine_display(pdisplay) ) { |
34 | /*ERROR*Bad EXT_DISPLAY Address*/ |
35 | Xw_set_error(96,"Xw_get_display_visual",pdisplay) ; |
36 | return (rclass) ; |
37 | } |
38 | |
39 | if( !(ginfo = Xw_get_visual_info(pdisplay,pclass)) ) return (rclass) ; |
40 | |
41 | #if defined(__cplusplus) || defined(c_plusplus) |
42 | rclass = (Xw_TypeOfVisual) ginfo->visual->c_class ; |
43 | #else |
44 | rclass = (Xw_TypeOfVisual) ginfo->visual->class ; |
45 | #endif |
46 | |
47 | XFree((char*)ginfo) ; |
48 | |
49 | |
50 | #ifdef TRACE_GET_DISPLAY_VISUAL |
51 | if( Xw_get_trace() > 1 ) { |
52 | printf (" %d = Xw_get_display_visual(%lx,%d)\n",rclass,(long ) adisplay,pclass) ; |
53 | } |
54 | #endif |
55 | |
56 | return (rclass) ; |
57 | } |