Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        ecore-e16.c ecore-e16.h 


Log Message:
Atom code tweaks.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ecore-e16.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ecore-e16.c 13 Feb 2005 09:14:49 -0000      1.5
+++ ecore-e16.c 17 Feb 2005 23:14:12 -0000      1.6
@@ -51,9 +51,9 @@
                    (unsigned char *)p_val, cnt)
 
 /* Window property change actions (must match _NET_WM_STATE_... ones) */
-#define _PROP_CHANGE_REMOVE    0
-#define _PROP_CHANGE_ADD       1
-#define _PROP_CHANGE_TOGGLE    2
+#define ECORE_X_PROP_LIST_REMOVE    0
+#define ECORE_X_PROP_LIST_ADD       1
+#define ECORE_X_PROP_LIST_TOGGLE    2
 
 #ifdef USE_ECORE_X
 
@@ -397,6 +397,55 @@
 }
 
 /*
+ * Remove/add/toggle X ID list item.
+ */
+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;
+
+   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);
+}
+
+/*
  * Set Atom (array) property
  */
 void
@@ -437,52 +486,13 @@
 }
 
 /*
- * Remove/add/toggle (0/1/2) atom list item.
+ * Remove/add/toggle atom list item.
  */
 void
 ecore_x_window_prop_atom_list_change(Ecore_X_Window win, Ecore_X_Atom atom,
                                     Ecore_X_Atom item, int op)
 {
-   Ecore_X_Atom       *alst;
-   int                 i, num;
-
-   num = ecore_x_window_prop_atom_list_get(win, atom, &alst);
-   if (num < 0)
-      return;                  /* Error - assuming invalid window */
-
-   /* Is it there? */
-   for (i = 0; i < num; i++)
-     {
-       if (alst[i] == item)
-          break;
-     }
-
-   if (i < num)
-     {
-       /* Was in list */
-       if (op == _PROP_CHANGE_ADD)
-          goto done;
-       /* Remove it */
-       num--;
-       for (; i < num; i++)
-          alst[i] = alst[i + 1];
-     }
-   else
-     {
-       /* Was not in list */
-       if (op == _PROP_CHANGE_REMOVE)
-          goto done;
-       /* Add it */
-       num++;
-       alst = realloc(alst, num * sizeof(Ecore_X_Atom));
-       alst[i] = item;
-     }
-
-   ecore_x_window_prop_atom_set(win, atom, alst, num);
-
- done:
-   if (alst)
-      free(alst);
+   ecore_x_window_prop_xid_list_change(win, atom, XA_ATOM, item, op);
 }
 
 /*
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ecore-e16.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ecore-e16.h 12 Feb 2005 16:16:29 -0000      1.3
+++ ecore-e16.h 17 Feb 2005 23:14:13 -0000      1.4
@@ -275,6 +275,11 @@
                                                     Ecore_X_Atom atom,
                                                     Ecore_X_Atom type,
                                                     Ecore_X_ID ** plst);
+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);
 void                ecore_x_window_prop_atom_set(Ecore_X_Window win,
                                                 Ecore_X_Atom atom,
                                                 Ecore_X_Atom * val,




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to