Enlightenment CVS committal

Author  : xcomputerman
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_x


Modified Files:
        Ecore_X.h ecore_x_icccm.c ecore_x_window_prop.c 


Log Message:
Add icon name set/get, colormap window set/unset ICCCM functions

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -3 -r1.77 -r1.78
--- Ecore_X.h   26 Nov 2004 06:42:24 -0000      1.77
+++ Ecore_X.h   26 Nov 2004 07:28:51 -0000      1.78
@@ -1012,7 +1012,14 @@
      ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv);
    EAPI void
      ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv);
-   
+   EAPI char *
+     ecore_x_icccm_icon_name_get(Ecore_X_Window win);
+   EAPI void
+     ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t);
+   EAPI void
+     ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window 
subwin);
+   EAPI void
+     ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window 
subwin);
    
    typedef enum _Ecore_X_MWM_Hint_Func
      {
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_icccm.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ecore_x_icccm.c     26 Nov 2004 06:42:24 -0000      1.8
+++ ecore_x_icccm.c     26 Nov 2004 07:28:51 -0000      1.9
@@ -591,16 +591,156 @@
    XGetCommand(_ecore_x_disp, win, argv, argc);
 }
 
+/**
+ * Set a window icon name.
+ * @param win The window
+ * @param t The icon name string
+ * 
+ * Set a window icon name
+ */
+void
+ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t)
+{
+   ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_icon_name, (char *)t);
+   ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_icon_name,
+                                 (char *)t);
+}
 
+/**
+ * Get a window icon name.
+ * @param win The window
+ * @return The windows icon name string
+ * 
+ * Return the icon name of a window. String must be free'd when done with.
+ */
+char *
+ecore_x_icccm_icon_name_get(Ecore_X_Window win)
+{
+   char *name;
+
+   name = ecore_x_window_prop_string_get(win, _ecore_x_atom_net_wm_icon_name);
+   if (!name) name = ecore_x_window_prop_string_get(win, 
_ecore_x_atom_wm_icon_name);
+   return name;
+}
+
+/**
+ * Add a subwindow to the list of windows that need a different colormap 
installed.
+ * @param win The toplevel window
+ * @param subwin The subwindow to be added to the colormap windows list
+ */
+void
+ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
+{
+   int            num = 0, i;
+   unsigned char *old_data = NULL;
+   unsigned char *data = NULL;
+   Window        *oldset = NULL;
+   Window        *newset = NULL;
+   
+   if(!ecore_x_window_prop_property_get(win, 
+                                       _ecore_x_atom_wm_colormap_windows, 
+                                       XA_WINDOW,
+                                       32,
+                                       &old_data,
+                                       &num))
+   {
+      newset = calloc(1, sizeof(Window));
+      if (!newset) return;
+      newset[0] = subwin;
+      num = 1;
+      data = (unsigned char *)newset;
+   }
+   else
+   {
+      newset = calloc(num + 1, sizeof(Window));
+      oldset = (Window *) old_data;
+      if (!newset) return;
+      for (i = 0; i < num; ++i)
+      {
+         if (oldset[i] == subwin)
+         {
+            XFree(old_data);
+            free(newset);
+            return;
+         }
+         
+         newset[i] = oldset[i];
+      }
+
+      newset[num++] = subwin;
+      XFree(old_data);
+      data = (unsigned char *)newset;
+   }
+   
+   ecore_x_window_prop_property_set(win, 
+                                    _ecore_x_atom_wm_colormap_windows,
+                                    XA_WINDOW,
+                                    32,
+                                    data,
+                                    num);
+   free(newset);
+}
+
+/**
+ * Remove a window from the list of colormap windows.
+ * @param win The toplevel window
+ * @param subwin The window to be removed from the colormap window list.
+ */
+void
+ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
+{
+   int            num = 0, i, j, k = 0;
+   unsigned char *old_data = NULL;
+   unsigned char *data = NULL;
+   Window        *oldset = NULL;
+   Window        *newset = NULL;
+
+   if (!ecore_x_window_prop_property_get(win, 
+                                         _ecore_x_atom_wm_colormap_windows,
+                                         XA_WINDOW,
+                                         32,
+                                         &old_data,
+                                         &num))
+      return;
+
+   oldset = (Window *) old_data;
+   for (i = 0; i < num; i++)
+   {
+      if (oldset[i] == subwin)
+      {
+         if (num == 1)
+         {
+            XDeleteProperty(_ecore_x_disp, 
+                            win,
+                            _ecore_x_atom_wm_colormap_windows);
+            XFree(old_data);
+            return;
+         }
+         else
+         {
+            newset = calloc(num - 1, sizeof(Window));
+            data = (unsigned char *)newset;
+            for (j = 0; j < num; ++j)
+               if (oldset[j] != subwin)
+                  newset[k++] = oldset[j];
+            ecore_x_window_prop_property_set(win,
+                                             _ecore_x_atom_wm_colormap_windows,
+                                             XA_WINDOW,
+                                             32,
+                                             data,
+                                             k);
+            XFree(old_data);
+            free(newset);
+            return;
+         }
+      }
+   }
+   
+   XFree(old_data);
+}
 
  
 /* FIXME: move these things in here as they are icccm related */
-/* get/set wm protocols */
-/* get/set name/class */
-/* get/set machine */
-/* get/set command */
-/* get/set icon name */
-/* get/set colormap windows */
 /* get/set window role */
 /* get/set client leader */
 /* get/set transient for */
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -3 -r1.54 -r1.55
--- ecore_x_window_prop.c       26 Nov 2004 06:42:24 -0000      1.54
+++ ecore_x_window_prop.c       26 Nov 2004 07:28:51 -0000      1.55
@@ -324,6 +324,7 @@
  * @param t The icon name string
  * 
  * Set a window icon name
+ * DEPRECATED. Please use ecore_x_icccm_icon_name_set() instead.
  */
 void
 ecore_x_window_prop_icon_name_set(Ecore_X_Window win, const char *t)
@@ -339,6 +340,7 @@
  * @return The windows icon name string
  * 
  * Return the icon name of a window. String must be free'd when done with.
+ * DEPRECATED. Please use ecore_x_icccm_icon_name_get() instead.
  */
 char *
 ecore_x_window_prop_icon_name_get(Ecore_X_Window win)




-------------------------------------------------------
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://productguide.itmanagersjournal.com/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to