5 * Rob Zimmermann. All rights reserved.
7 * Keith Bostic. All rights reserved.
9 * See the LICENSE file for redistribution information.
15 static const char sccsid
[] = "Id: m_cde.c,v 8.11 2003/11/05 17:09:58 skimo Exp (Berkeley) Date: 2003/11/05 17:09:58";
18 #include <sys/types.h>
19 #include <sys/queue.h>
23 #include <X11/Xatom.h>
25 #include <bitstring.h>
29 #include "../common/common.h"
33 #define _TRACE( x ) printf x
40 #define Present (Required+Useful)
46 { "_VUE_SM_WINDOW_INFO", Required
, /* "vue" */ },
47 { "_DT_SM_WINDOW_INFO", Required
, /* "dtwm" */ },
48 { "_SUN_WM_PROTOCOLS", Useful
, /* "olwm" */ },
49 { "_MOTIF_WM_INFO", Useful
, /* "mwm/dtwm" */ },
55 * When running under CDE (or VUE on HPUX) applications should not define
56 * fallback colors (or fonts). The only way to tell is to check the atoms
57 * attached to the server. This routine does that.
59 * PUBLIC: int is_cde __P((Display *));
65 unsigned long nitems
, remaining
;
67 Window root
= DefaultRootWindow( d
);
71 _TRACE( ( "Root window is 0x%x\n", root
) );
73 /* create our atoms */
74 for (i
=0; i
< (sizeof(Atoms
)/sizeof(Atoms
[0])); i
++ ) {
76 atom
= XInternAtom( d
, Atoms
[i
].name
, True
);
78 _TRACE( ( "Atom \"%s\" does not exist\n", Atoms
[i
].name
) );
82 /* what is the value of the atom? */
83 r
= XGetWindowProperty( d
,
88 False
, /* do not delete */
89 AnyPropertyType
, /* request type */
90 &type
, /* actual type */
91 &format
, /* byte size */
92 &nitems
, /* number of items */
93 &remaining
, /* anything left over? */
94 &prop
/* the data itself */
97 _TRACE( ( "Atom \"%s\" cannot be converted to string\n", Atoms
[i
].name
) );
101 retval
+= Atoms
[i
].value
;
105 _TRACE( ( "Atom \"%s\"\n", Atoms
[i
].name
) );
109 _TRACE( ( "\t does not exist on the root window\n", Atoms
[i
].name
) );
112 for (j
=0; j
<nitems
; j
++) {
113 name
= XGetAtomName( d
, ((Atom
*) prop
)[j
] );
114 _TRACE( ( "\t[%d] = \"%s\"\n", j
, name
) );
120 _TRACE( ( "\t is a string\n", Atoms
[i
].name
) );
124 _TRACE( ( "\tunknown type %s\n", XGetAtomName( d
, type
) ) );
130 XFree( (caddr_t
) prop
);
134 _TRACE( ( "retval = %d\n", retval
) );
135 return retval
>= Present
;
141 Display
*d
= XOpenDisplay( 0 );
144 printf ( "Could not open display\n" );
146 printf ( "_vi_is_cde() == %d\n", _vi_is_cde( d
) );