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.8 1996/12/11 20:56:42 bostic Exp $ (Berkeley) $Date: 1996/12/11 20:56:42 $";
18 #include <X11/Xatom.h>
23 #define _TRACE( x ) printf x
30 #define Present (Required+Useful)
36 { "_VUE_SM_WINDOW_INFO", Required
, /* "vue" */ },
37 { "_DT_SM_WINDOW_INFO", Required
, /* "dtwm" */ },
38 { "_SUN_WM_PROTOCOLS", Useful
, /* "olwm" */ },
39 { "_MOTIF_WM_INFO", Useful
, /* "mwm/dtwm" */ },
45 * When running under CDE (or VUE on HPUX) applications should not define
46 * fallback colors (or fonts). The only way to tell is to check the atoms
47 * attached to the server. This routine does that.
49 * PUBLIC: int is_cde __P((Display *));
56 unsigned long nitems
, remaining
;
58 Window root
= DefaultRootWindow( d
);
62 _TRACE( ( "Root window is 0x%x\n", root
) );
64 /* create our atoms */
65 for (i
=0; i
< (sizeof(Atoms
)/sizeof(Atoms
[0])); i
++ ) {
67 atom
= XInternAtom( d
, Atoms
[i
].name
, True
);
69 _TRACE( ( "Atom \"%s\" does not exist\n", Atoms
[i
].name
) );
73 /* what is the value of the atom? */
74 r
= XGetWindowProperty( d
,
79 False
, /* do not delete */
80 AnyPropertyType
, /* request type */
81 &type
, /* actual type */
82 &format
, /* byte size */
83 &nitems
, /* number of items */
84 &remaining
, /* anything left over? */
85 &prop
/* the data itself */
88 _TRACE( ( "Atom \"%s\" cannot be converted to string\n", Atoms
[i
].name
) );
92 retval
+= Atoms
[i
].value
;
96 _TRACE( ( "Atom \"%s\"\n", Atoms
[i
].name
) );
100 _TRACE( ( "\t does not exist on the root window\n", Atoms
[i
].name
) );
103 for (j
=0; j
<nitems
; j
++) {
104 name
= XGetAtomName( d
, ((Atom
*) prop
)[j
] );
105 _TRACE( ( "\t[%d] = \"%s\"\n", j
, name
) );
111 _TRACE( ( "\t is a string\n", Atoms
[i
].name
) );
115 _TRACE( ( "\tunknown type %s\n", XGetAtomName( d
, type
) ) );
121 XFree( (caddr_t
) prop
);
125 _TRACE( ( "retval = %d\n", retval
) );
126 return retval
>= Present
;
132 Display
*d
= XOpenDisplay( 0 );
135 printf ( "Could not open display\n" );
137 printf ( "_vi_is_cde() == %d\n", _vi_is_cde( d
) );