示例#1
0
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;
}
示例#2
0
/**
 * Gets the reply of the ListProperties request sent by ecore_x_window_prop_list_prefetch().
 */
EAPI void
ecore_x_window_prop_list_fetch(void)
{
   xcb_list_properties_cookie_t cookie;
   xcb_list_properties_reply_t *reply;

   cookie.sequence = _ecore_xcb_cookie_get();
   reply = xcb_list_properties_reply(_ecore_xcb_conn, cookie, NULL);
   _ecore_xcb_reply_cache(reply);
} /* ecore_x_window_prop_list_fetch */
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;
}