Пример #1
0
/*
 * Get Window (array) property
 *
 * If the property was successfully fetched the number of items stored in
 * val is returned, otherwise -1 is returned.
 * The returned array must be freed with free().
 * Note: Return value 0 means that the property exists but has no elements.
 */
EAPI int
ecore_x_window_prop_window_list_get(Ecore_X_Window   win,
                                    Ecore_X_Atom     atom,
                                    Ecore_X_Window **plist)
{
   return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_WINDOW, plist);
} /* ecore_x_window_prop_window_list_get */
Пример #2
0
/*
 * Get Window (array) property
 *
 * If the property was successfully fetched the number of items stored in
 * val is returned, otherwise -1 is returned.
 * The returned array must be freed with free().
 * Note: Return value 0 means that the property exists but has no elements.
 */
EAPI int
ecore_x_window_prop_window_list_get(Ecore_X_Window win,
                                    Ecore_X_Atom atom,
                                    Ecore_X_Window **plst)
{
   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   return ecore_x_window_prop_xid_list_get(win, atom, XA_WINDOW, plst);
}
Пример #3
0
EAPI int
ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
                                  Ecore_X_Atom   atom,
                                  Ecore_X_Atom **list)
{
   LOGFN(__FILE__, __LINE__, __FUNCTION__);

   return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_ATOM, list);
}
Пример #4
0
/*
 * Get Atom (array) property
 *
 * If the property was successfully fetched the number of items stored in
 * val is returned, otherwise -1 is returned.
 * The returned array must be freed with free().
 * Note: Return value 0 means that the property exists but has no elements.
 */
EAPI int
ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
                                  Ecore_X_Atom atom,
                                  Ecore_X_Atom **plst)
{
   int ret;
   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   ret = ecore_x_window_prop_xid_list_get(win, atom, XA_ATOM, plst);
   return ret;
}
Пример #5
0
/*
 * Remove/add/toggle X ID list item.
 */
EAPI void
ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
                                    Ecore_X_Atom atom,
                                    Ecore_X_Atom type,
                                    Ecore_X_ID item,
                                    int op)
{
   Ecore_X_ID *lst;
   int i, num;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst);
   if (num < 0)
     {
        return; /* Error - assuming invalid window */
     }

   /* Is it there? */
   for (i = 0; i < num; i++)
     {
        if (lst[i] == item)
          break;
     }

   if (i < num)
     {
        /* Was in list */
        if (op == ECORE_X_PROP_LIST_ADD)
          goto done;  /* Remove it */

        num--;
        for (; i < num; i++)
          lst[i] = lst[i + 1];
     }
   else
     {
        /* Was not in list */
        if (op == ECORE_X_PROP_LIST_REMOVE)
          goto done;  /* Add it */

        num++;
        lst = realloc(lst, num * sizeof(Ecore_X_ID));
        lst[i] = item;
     }

   ecore_x_window_prop_xid_set(win, atom, type, lst, num);

done:
   if (lst)
     free(lst);
}
Пример #6
0
EAPI void
ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
                                    Ecore_X_Atom   atom,
                                    Ecore_X_Atom   type,
                                    Ecore_X_ID     item,
                                    int            op)
{
   Ecore_X_ID *lst;
   int i = 0, num = 0;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   CHECK_XCB_CONN;

   num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst);
   if (num < 0) return;

   for (i = 0; i < num; i++)
     {
        if (lst[i] == item) break;
     }

   if (i < num)
     {
        if (op == ECORE_X_PROP_LIST_ADD)
          goto done;
        num--;
        for (; i < num; i++)
          lst[i] = lst[i + 1];
     }
   else
     {
        if (op == ECORE_X_PROP_LIST_REMOVE)
          goto done;
        num++;
        lst = realloc(lst, num * sizeof(Ecore_X_ID));
        lst[i] = item;
     }
   ecore_x_window_prop_xid_set(win, atom, type, lst, num);

done:
   if (lst) free(lst);
}