byte[] cdeName   = Converter.wcsToMbcs (null, "DTWM_IS_RUNNING", true);
byte[] cdeName   = Converter.wcsToMbcs (null, "_DT_SM_PREFERENCES", true);
static int getDesktop( Display display ) {	if (display == null) return DESKTOP_UNKNOWN;		// If the desktop type for this display is already known, return it.	Integer desktopValue = (Integer) display.getData( desktopData );	if (desktopValue != null) {		return desktopValue.intValue();	}		// Obtain the atoms for the various window manager signature properties.	int desktop = DESKTOP_UNKNOWN;	int xDisplay = display.xDisplay;	/* Use the character encoding for the default locale */	byte[] gnomeName = Converter.wcsToMbcs (null, "GNOME_NAME_SERVER", true);	byte[] cdeName   = Converter.wcsToMbcs (null, "DTWM_IS_RUNNING", true);	byte[] kdeName   = Converter.wcsToMbcs (null, "KWIN_RUNNING", true);	int gnome = OS.XInternAtom( xDisplay, gnomeName, true );	int cde   = OS.XInternAtom( xDisplay, cdeName, true );	int kde   = OS.XInternAtom( xDisplay, kdeName, true );		// Get the list of properties on the root window.	int   rootWindow = OS.XDefaultRootWindow( xDisplay );	int[] numProp = new int[1];	int   propList = OS.XListProperties( xDisplay, rootWindow, numProp );	if (propList == 0) return DESKTOP_UNKNOWN;	int[] property = new int[ numProp[0] ];	OS.memmove( property, propList, (property.length * 4) );	OS.XFree( propList );		// A given WM (desktop) is active if the property exists on the root window.	for (int index = 0; desktop == DESKTOP_UNKNOWN && index < property.length; index++) {		if (property[ index ] == OS.None) continue; // do not match atoms that do not exist		if (property[ index ] == gnome) {			if (gnome_init()) desktop = DESKTOP_GNOME;				}		if (property[ index ] == cde) {			if (cde_init( display )) desktop = DESKTOP_CDE;		}			if (property[ index ] == kde) {			if (kde_init()) desktop = DESKTOP_KDE;		}		}		// Save the desktop type on the display itself.	display.setData( desktopData, new Integer(desktop) );	return desktop;}