3 * Rob Zimmermann. All rights reserved.
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
13 static const char sccsid
[] = "$Id: m_cde.c,v 8.6 1996/12/10 21:04:25 bostic Exp $ (Berkeley) $Date: 1996/12/10 21:04:25 $";
18 #include <X11/Xatom.h>
21 #define TRACE( x ) printf x
28 #define Present (Required+Useful)
34 { "_VUE_SM_WINDOW_INFO", Required
, /* "vue" */ },
35 { "_DT_SM_WINDOW_INFO", Required
, /* "dtwm" */ },
36 { "_SUN_WM_PROTOCOLS", Useful
, /* "olwm" */ },
37 { "_MOTIF_WM_INFO", Useful
, /* "mwm/dtwm" */ },
43 * When running under CDE (or VUE on HPUX) applications should not define
44 * fallback colors (or fonts). The only way to tell is to check the atoms
45 * attached to the server. This routine does that.
47 * PUBLIC: int __vi_is_cde __P((Display *));
54 unsigned long nitems
, remaining
;
56 Window root
= DefaultRootWindow( d
);
60 TRACE( ( "Root window is 0x%x\n", root
) );
62 /* create our atoms */
63 for (i
=0; i
< (sizeof(Atoms
)/sizeof(Atoms
[0])); i
++ ) {
65 atom
= XInternAtom( d
, Atoms
[i
].name
, True
);
67 TRACE( ( "Atom \"%s\" does not exist\n", Atoms
[i
].name
) );
71 /* what is the value of the atom? */
72 r
= XGetWindowProperty( d
,
77 False
, /* do not delete */
78 AnyPropertyType
, /* request type */
79 &type
, /* actual type */
80 &format
, /* byte size */
81 &nitems
, /* number of items */
82 &remaining
, /* anything left over? */
83 &prop
/* the data itself */
86 TRACE( ( "Atom \"%s\" cannot be converted to string\n", Atoms
[i
].name
) );
90 retval
+= Atoms
[i
].value
;
94 TRACE( ( "Atom \"%s\"\n", Atoms
[i
].name
) );
98 TRACE( ( "\t does not exist on the root window\n", Atoms
[i
].name
) );
101 for (j
=0; j
<nitems
; j
++) {
102 name
= XGetAtomName( d
, ((Atom
*) prop
)[j
] );
103 TRACE( ( "\t[%d] = \"%s\"\n", j
, name
) );
109 TRACE( ( "\t is a string\n", Atoms
[i
].name
) );
113 TRACE( ( "\tunknown type %s\n", XGetAtomName( d
, type
) ) );
119 XFree( (caddr_t
) prop
);
123 TRACE( ( "retval = %d\n", retval
) );
124 return retval
>= Present
;
130 Display
*d
= XOpenDisplay( 0 );
133 printf ( "Could not open display\n" );
135 printf ( "_vi_is_cde() == %d\n", _vi_is_cde( d
) );