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;
}
Exemple #2
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;
}
Exemple #3
0
/**
 * Sends the ListProperties request.
 * @param window Window whose properties are requested.
 */
EAPI void
ecore_x_window_prop_list_prefetch(Ecore_X_Window window)
{
   xcb_list_properties_cookie_t cookie;

   cookie = xcb_list_properties_unchecked(_ecore_xcb_conn, window);
   _ecore_xcb_cookie_cache(cookie.sequence);
} /* ecore_x_window_prop_list_prefetch */