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.10 2001/06/25 15:19:26 skimo Exp $ (Berkeley) $Date: 2001/06/25 15:19:26 $";
16 #include <sys/types.h>
17 #include <sys/queue.h>
21 #include <X11/Xatom.h>
23 #include <bitstring.h>
26 #include "../common/common.h"
30 #define _TRACE( x ) printf x
37 #define Present (Required+Useful)
43 { "_VUE_SM_WINDOW_INFO", Required
, /* "vue" */ },
44 { "_DT_SM_WINDOW_INFO", Required
, /* "dtwm" */ },
45 { "_SUN_WM_PROTOCOLS", Useful
, /* "olwm" */ },
46 { "_MOTIF_WM_INFO", Useful
, /* "mwm/dtwm" */ },
52 * When running under CDE (or VUE on HPUX) applications should not define
53 * fallback colors (or fonts). The only way to tell is to check the atoms
54 * attached to the server. This routine does that.
56 * PUBLIC: int is_cde __P((Display *));
62 unsigned long nitems
, remaining
;
64 Window root
= DefaultRootWindow( d
);
68 _TRACE( ( "Root window is 0x%x\n", root
) );
70 /* create our atoms */
71 for (i
=0; i
< (sizeof(Atoms
)/sizeof(Atoms
[0])); i
++ ) {
73 atom
= XInternAtom( d
, Atoms
[i
].name
, True
);
75 _TRACE( ( "Atom \"%s\" does not exist\n", Atoms
[i
].name
) );
79 /* what is the value of the atom? */
80 r
= XGetWindowProperty( d
,
85 False
, /* do not delete */
86 AnyPropertyType
, /* request type */
87 &type
, /* actual type */
88 &format
, /* byte size */
89 &nitems
, /* number of items */
90 &remaining
, /* anything left over? */
91 &prop
/* the data itself */
94 _TRACE( ( "Atom \"%s\" cannot be converted to string\n", Atoms
[i
].name
) );
98 retval
+= Atoms
[i
].value
;
102 _TRACE( ( "Atom \"%s\"\n", Atoms
[i
].name
) );
106 _TRACE( ( "\t does not exist on the root window\n", Atoms
[i
].name
) );
109 for (j
=0; j
<nitems
; j
++) {
110 name
= XGetAtomName( d
, ((Atom
*) prop
)[j
] );
111 _TRACE( ( "\t[%d] = \"%s\"\n", j
, name
) );
117 _TRACE( ( "\t is a string\n", Atoms
[i
].name
) );
121 _TRACE( ( "\tunknown type %s\n", XGetAtomName( d
, type
) ) );
127 XFree( (caddr_t
) prop
);
131 _TRACE( ( "retval = %d\n", retval
) );
132 return retval
>= Present
;
138 Display
*d
= XOpenDisplay( 0 );
141 printf ( "Could not open display\n" );
143 printf ( "_vi_is_cde() == %d\n", _vi_is_cde( d
) );