/* Check if the window manager is NET WM compliant. */ static int fghNetWMSupported(void) { Atom wm_check; Window ** window_ptr_1; int number_of_windows; int net_wm_supported; net_wm_supported = 0; wm_check = fghGetAtom("_NET_SUPPORTING_WM_CHECK"); window_ptr_1 = malloc(sizeof(Window *)); /* * Check that the window manager has set this property on the root window. * The property must be the ID of a child window. */ number_of_windows = fghGetWindowProperty(fgDisplay.RootWindow, wm_check, XA_WINDOW, (unsigned char **) window_ptr_1); if (number_of_windows == 1) { Window ** window_ptr_2; window_ptr_2 = malloc(sizeof(Window *)); /* Check that the window has the same property set to the same value. */ number_of_windows = fghGetWindowProperty(**window_ptr_1, wm_check, XA_WINDOW, (unsigned char **) window_ptr_2); if ((number_of_windows == 1) && (**window_ptr_1 == **window_ptr_2)) { /* NET WM compliant */ net_wm_supported = 1; } XFree(*window_ptr_2); free(window_ptr_2); } XFree(*window_ptr_1); free(window_ptr_1); return net_wm_supported; }
/* Check if "hint" is present in "property" for "window". */ int fgHintPresent(Window window, Atom property, Atom hint) { Atom *atoms; int number_of_atoms; int supported; int i; supported = 0; number_of_atoms = fghGetWindowProperty(window, property, XA_ATOM, (unsigned char **) &atoms); for (i = 0; i < number_of_atoms; i++) { if (atoms[i] == hint) { supported = 1; break; } } XFree(atoms); return supported; }
/* Check if "hint" is present in "property" for "window". */ int fgHintPresent(Window window, Atom property, Atom hint) { Atom ** atoms_ptr; int number_of_atoms; int supported; int i; supported = 0; atoms_ptr = malloc(sizeof(Atom *)); number_of_atoms = fghGetWindowProperty(window, property, XA_ATOM, (unsigned char **) atoms_ptr); for (i = 0; i < number_of_atoms; i++) { if ((*atoms_ptr)[i] == hint) { supported = 1; break; } } return supported; }