bool KWinKScreenHelperEffect::checkValid() { #ifdef HAVE_XCB if (QX11Info::isPlatformX11()) { QScopedPointer<xcb_list_properties_reply_t, QScopedPointerPodDeleter> propsReply(xcb_list_properties_reply(QX11Info::connection(), xcb_list_properties_unchecked(QX11Info::connection(), QX11Info::appRootWindow()), NULL)); QScopedPointer<xcb_intern_atom_reply_t, QScopedPointerPodDeleter> atomReply(xcb_intern_atom_reply(QX11Info::connection(), xcb_intern_atom_unchecked(QX11Info::connection(), false, 25, "_KDE_KWIN_KSCREEN_SUPPORT"), NULL)); if (propsReply.isNull() || atomReply.isNull()) { return false; } auto *atoms = xcb_list_properties_atoms(propsReply.data()); for (int i = 0; i < propsReply->atoms_len; ++i) { if (atoms[i] == atomReply->atom) { m_atom = atomReply->atom; return true; } } m_atom = 0; return false; } #endif return false; }
/** * To be documented. * @param window The window (Unused). * @param num_ret The number of atoms. * @return The returned atoms. * * FIXME: To be fixed. */ EAPI Ecore_X_Atom * ecore_x_window_prop_list(Ecore_X_Window window __UNUSED__, int *num_ret) { xcb_list_properties_reply_t *reply; Ecore_X_Atom *atoms; if (num_ret) *num_ret = 0; reply = _ecore_xcb_reply_get(); if (!reply) return NULL; atoms = (Ecore_X_Atom *)malloc(reply->atoms_len * sizeof(Ecore_X_Atom)); if (!atoms) return NULL; memcpy(atoms, xcb_list_properties_atoms(reply), reply->atoms_len * sizeof(Ecore_X_Atom)); if(num_ret) *num_ret = reply->atoms_len; return atoms; } /* ecore_x_window_prop_list */
EAPI Ecore_X_Atom * ecore_x_window_prop_list(Ecore_X_Window win, int *num) { xcb_list_properties_cookie_t cookie; xcb_list_properties_reply_t *reply; xcb_atom_t *atm; Ecore_X_Atom *atoms; int i = 0; LOGFN(__FILE__, __LINE__, __FUNCTION__); CHECK_XCB_CONN; if (num) *num = 0; cookie = xcb_list_properties_unchecked(_ecore_xcb_conn, win); reply = xcb_list_properties_reply(_ecore_xcb_conn, cookie, NULL); if (!reply) return NULL; atoms = (Ecore_X_Atom *)malloc(reply->atoms_len * sizeof(Ecore_X_Atom)); if (!atoms) { free(reply); return NULL; } atm = xcb_list_properties_atoms(reply); for (i = 0; i < reply->atoms_len; i++) atoms[i] = atm[i]; if (num) *num = reply->atoms_len; free(reply); return atoms; }