Enlightenment CVS committal

Author  : sebastid
Project : e17
Module  : libs/ecore

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


Modified Files:
        Ecore_X.h ecore_x.c ecore_x_icccm.c ecore_x_mwm.c 
        ecore_x_netwm.c ecore_x_window.c ecore_x_window_prop.c 


Log Message:
Make ecore evas use netwm and icccm, not window_prop.
Window_prop is gone, but maybe resurrect some parts of it as a wrapper
around icccm/netwm as convencience functions?

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -3 -r1.135 -r1.136
--- Ecore_X.h   7 Jun 2005 15:34:53 -0000       1.135
+++ Ecore_X.h   10 Jun 2005 04:18:24 -0000      1.136
@@ -773,6 +773,7 @@
 extern EAPI int ECORE_X_EVENT_SYNC_ALARM;
 
 extern EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST;
+/*
 extern EAPI int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE;
 extern EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE;
 extern EAPI int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE;
@@ -781,6 +782,7 @@
 extern EAPI int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE;
 extern EAPI int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE;
 extern EAPI int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE;
+*/
 
 extern EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST;
 extern EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST;
@@ -1003,69 +1005,19 @@
 EAPI void             ecore_x_window_pixel_gravity_set(Ecore_X_Window win,
                                                       Ecore_X_Gravity grav);
        
-EAPI Ecore_X_Atom     ecore_x_window_prop_any_type(void);
-EAPI void             ecore_x_window_prop_property_set(Ecore_X_Window win, 
Ecore_X_Atom type, Ecore_X_Atom format, int size, void *data, int number);
-EAPI int              ecore_x_window_prop_property_get(Ecore_X_Window win, 
Ecore_X_Atom property, Ecore_X_Atom type, int size, unsigned char **data, int 
*num);
 EAPI void             ecore_x_window_prop_card32_set(Ecore_X_Window win, 
Ecore_X_Atom atom,
                                                     unsigned int *val, 
unsigned int num);
 EAPI int              ecore_x_window_prop_card32_get(Ecore_X_Window win, 
Ecore_X_Atom atom,
                                                     unsigned int *val, 
unsigned int len);
+EAPI Ecore_X_Atom     ecore_x_window_prop_any_type(void);
+EAPI void             ecore_x_window_prop_property_set(Ecore_X_Window win, 
Ecore_X_Atom type, Ecore_X_Atom format, int size, void *data, int number);
+EAPI int              ecore_x_window_prop_property_get(Ecore_X_Window win, 
Ecore_X_Atom property, Ecore_X_Atom type, int size, unsigned char **data, int 
*num);
 EAPI void             ecore_x_window_prop_property_del(Ecore_X_Window win, 
Ecore_X_Atom property);
-EAPI void             ecore_x_window_prop_property_notify(Ecore_X_Window win, 
const char *type, long *data);
+EAPI Ecore_X_Atom    *ecore_x_window_prop_list(Ecore_X_Window win, int 
*num_ret);
 EAPI void             ecore_x_window_prop_string_set(Ecore_X_Window win, 
Ecore_X_Atom type, const char *str);
 EAPI char            *ecore_x_window_prop_string_get(Ecore_X_Window win, 
Ecore_X_Atom type);
-EAPI void             ecore_x_window_prop_title_set(Ecore_X_Window win, const 
char *t);
-EAPI char            *ecore_x_window_prop_title_get(Ecore_X_Window win);
-EAPI void             ecore_x_window_prop_command_set(Ecore_X_Window win, int 
argc, char **argv);
-EAPI void             ecore_x_window_prop_command_get(Ecore_X_Window win, int 
*argc, char ***argv);
-EAPI void             ecore_x_window_prop_visible_title_set(Ecore_X_Window 
win, const char *t);
-EAPI char            *ecore_x_window_prop_visible_title_get(Ecore_X_Window 
win);
-EAPI void             ecore_x_window_prop_icon_name_set(Ecore_X_Window win, 
const char *t);
-EAPI char            *ecore_x_window_prop_icon_name_get(Ecore_X_Window win);
-EAPI void             ecore_x_window_prop_visible_icon_name_set(Ecore_X_Window 
win, const char *t);
-EAPI char            *ecore_x_window_prop_visible_icon_name_get(Ecore_X_Window 
win);
-EAPI char            *ecore_x_window_prop_client_machine_get(Ecore_X_Window 
win);
-EAPI pid_t            ecore_x_window_prop_pid_get(Ecore_X_Window win);
-EAPI void             ecore_x_window_prop_name_class_set(Ecore_X_Window win, 
const char *n, const char *c);
-EAPI void             ecore_x_window_prop_name_class_get(Ecore_X_Window win, 
char **n, char **c);
-EAPI void             ecore_x_window_prop_protocol_set(Ecore_X_Window win, 
Ecore_X_WM_Protocol protocol, int on);
 EAPI int              ecore_x_window_prop_protocol_isset(Ecore_X_Window win, 
Ecore_X_WM_Protocol protocol);
 EAPI Ecore_X_WM_Protocol *ecore_x_window_prop_protocol_list_get(Ecore_X_Window 
win, int *num_ret);
-EAPI void             ecore_x_window_prop_sticky_set(Ecore_X_Window win, int 
on);
-EAPI int              ecore_x_window_prop_input_mode_set(Ecore_X_Window win, 
Ecore_X_Window_Input_Mode mode);
-EAPI int              ecore_x_window_prop_initial_state_set(Ecore_X_Window 
win, Ecore_X_Window_State_Hint state);
-EAPI void             ecore_x_window_prop_min_size_set(Ecore_X_Window win, int 
w, int h);
-EAPI void             ecore_x_window_prop_max_size_set(Ecore_X_Window win, int 
w, int h);
-EAPI void             ecore_x_window_prop_base_size_set(Ecore_X_Window win, 
int w, int h);
-EAPI void             ecore_x_window_prop_step_size_set(Ecore_X_Window win, 
int x, int y);
-EAPI void             ecore_x_window_prop_xy_set(Ecore_X_Window win, int x, 
int y);
-EAPI void             ecore_x_window_prop_borderless_set(Ecore_X_Window win, 
int borderless);
-EAPI int              ecore_x_window_prop_borderless_get(Ecore_X_Window win);
-EAPI int              ecore_x_window_prop_layer_set(Ecore_X_Window win, int 
layer);
-EAPI void             ecore_x_window_prop_withdrawn_set(Ecore_X_Window win, 
int withdrawn);
-EAPI void             ecore_x_window_prop_desktop_request(Ecore_X_Window win, 
long desktop);
-EAPI void             ecore_x_window_prop_state_request(Ecore_X_Window win, 
Ecore_X_Window_State state, int action);
-EAPI void             ecore_x_window_prop_desktop_set(Ecore_X_Window win, long 
desktop);
-EAPI long             ecore_x_window_prop_desktop_get(Ecore_X_Window win);
-/* API Change: use enum Ecore_X_Window_Type instead */
-EAPI void             ecore_x_window_prop_window_type_set(Ecore_X_Window win, 
Ecore_X_Window_Type type);
-#if 0
-EAPI void             ecore_x_window_prop_window_type_set(Ecore_X_Window win, 
Ecore_X_Atom type);
-EAPI void             
ecore_x_window_prop_window_type_desktop_set(Ecore_X_Window win);
-EAPI void             ecore_x_window_prop_window_type_dock_set(Ecore_X_Window 
win);
-EAPI void             
ecore_x_window_prop_window_type_toolbar_set(Ecore_X_Window win);
-EAPI void             ecore_x_window_prop_window_type_menu_set(Ecore_X_Window 
win);
-EAPI void             
ecore_x_window_prop_window_type_utility_set(Ecore_X_Window win);
-EAPI void             
ecore_x_window_prop_window_type_splash_set(Ecore_X_Window win);
-EAPI void             
ecore_x_window_prop_window_type_dialog_set(Ecore_X_Window win);
-EAPI void             
ecore_x_window_prop_window_type_normal_set(Ecore_X_Window win);
-#endif
-EAPI void             ecore_x_window_prop_window_opacity_set(Ecore_X_Window 
win, int opacity);
-EAPI int              ecore_x_window_prop_window_opacity_get(Ecore_X_Window 
win);
-EAPI Ecore_X_Atom    *ecore_x_window_prop_list(Ecore_X_Window win, int 
*num_ret);
-EAPI void             ecore_x_window_prop_state_set(Ecore_X_Window win, 
Ecore_X_Window_State s);
-EAPI int              ecore_x_window_prop_state_isset(Ecore_X_Window win, 
Ecore_X_Window_State s);
-EAPI void             ecore_x_window_prop_state_unset(Ecore_X_Window win, 
Ecore_X_Window_State s);
 
 EAPI void               ecore_x_window_shape_mask_set(Ecore_X_Window win, 
Ecore_X_Pixmap mask);
 EAPI void               ecore_x_window_shape_window_set(Ecore_X_Window win, 
Ecore_X_Window shape_win);
@@ -1138,7 +1090,6 @@
                                            int step_x, int step_y,
                                            double min_aspect,
                                            double max_aspect);
-       
 EAPI int   ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
                                            int *request_pos,
                                            Ecore_X_Gravity *gravity,
@@ -1148,6 +1099,10 @@
                                            int *step_x, int *step_y,
                                            double *min_aspect,
                                            double *max_aspect);
+EAPI void  ecore_x_icccm_min_size_set(Ecore_X_Window win, int w, int h);
+EAPI void  ecore_x_icccm_max_size_set(Ecore_X_Window win, int w, int h);
+EAPI void  ecore_x_icccm_base_size_set(Ecore_X_Window win, int w, int h);
+EAPI void  ecore_x_icccm_step_size_set(Ecore_X_Window win, int x, int y);
 EAPI void  ecore_x_icccm_title_set(Ecore_X_Window win, const char *t);
 EAPI char *ecore_x_icccm_title_get(Ecore_X_Window win);
 EAPI void  ecore_x_icccm_protocol_set(Ecore_X_Window win,
@@ -1175,6 +1130,7 @@
 EAPI char *ecore_x_icccm_window_role_get(Ecore_X_Window win);
 EAPI void  ecore_x_icccm_client_leader_set(Ecore_X_Window win, Ecore_X_Window 
l);
 EAPI Ecore_X_Window ecore_x_icccm_client_leader_get(Ecore_X_Window win);
+EAPI void ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window 
root);
 
 
 typedef enum _Ecore_X_MWM_Hint_Func
@@ -1210,6 +1166,7 @@
                               Ecore_X_MWM_Hint_Func *fhint,
                               Ecore_X_MWM_Hint_Decor *dhint,
                               Ecore_X_MWM_Hint_Input *ihint);
+EAPI void ecore_x_mwm_borderless_set(Ecore_X_Window win, int borderless);
        
 /* netwm */
 EAPI void                ecore_x_netwm_init(void);
@@ -1262,8 +1219,11 @@
 EAPI void                ecore_x_netwm_frame_size_set(Ecore_X_Window win, int 
fl, int fr, int ft, int fb);
 EAPI int                 ecore_x_netwm_frame_size_get(Ecore_X_Window win, int 
*fl, int *fr, int *ft, int *fb);
 EAPI int                 ecore_x_netwm_sync_counter_get(Ecore_X_Window win, 
Ecore_X_Sync_Counter *counter);
-EAPI void                ecore_x_netwm_ping(Ecore_X_Window win);
+EAPI void                ecore_x_netwm_ping_send(Ecore_X_Window win);
 EAPI void                ecore_x_netwm_sync_request_send(Ecore_X_Window win, 
unsigned int serial);
+EAPI void                ecore_x_netwm_state_request_send(Ecore_X_Window win, 
Ecore_X_Window root, Ecore_X_Window_State s1, Ecore_X_Window_State s2, int set);
+EAPI void                ecore_x_netwm_desktop_request_send(Ecore_X_Window 
win, Ecore_X_Window root, unsigned int desktop);
+
 
 
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -3 -r1.88 -r1.89
--- ecore_x.c   8 Jun 2005 07:58:28 -0000       1.88
+++ ecore_x.c   10 Jun 2005 04:18:24 -0000      1.89
@@ -120,6 +120,7 @@
 int ECORE_X_EVENT_SYNC_ALARM = 0;
 
 int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0;
+/*
 int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0;
 int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0;
 int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0;
@@ -128,6 +129,7 @@
 int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0;
 int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0;
 int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0;
+*/
 
 int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0;
 int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0;
@@ -291,6 +293,7 @@
        ECORE_X_EVENT_SYNC_ALARM               = ecore_event_type_new();
        
        ECORE_X_EVENT_WINDOW_DELETE_REQUEST                = 
ecore_event_type_new();
+       /*
        ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE             = 
ecore_event_type_new();
        ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE     = 
ecore_event_type_new();
         ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE        = 
ecore_event_type_new();
@@ -299,6 +302,7 @@
        ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE    = 
ecore_event_type_new();
        ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE               = 
ecore_event_type_new();
        ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE               = 
ecore_event_type_new();
+       */
 
        ECORE_X_EVENT_DESKTOP_CHANGE           = ecore_event_type_new();
        ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new();
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_icccm.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- ecore_x_icccm.c     8 Jun 2005 01:45:59 -0000       1.30
+++ ecore_x_icccm.c     10 Jun 2005 04:18:24 -0000      1.31
@@ -288,8 +288,11 @@
                                 int step_x, int step_y,
                                 double min_aspect, double max_aspect)
 {
-   /* FIXME: working here */
-   XSizeHints          hint;
+   XSizeHints  hint;
+   long        mask;
+
+   if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
+     return;
 
    hint.flags = 0;
    if (request_pos)
@@ -339,7 +342,7 @@
 int
 ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
                                 int *request_pos,
-                                Ecore_X_Gravity * gravity,
+                                Ecore_X_Gravity *gravity,
                                 int *min_w, int *min_h,
                                 int *max_w, int *max_h,
                                 int *base_w, int *base_h,
@@ -357,6 +360,7 @@
 
    if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
      return 0;
+
    if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
      {
        if (request_pos)
@@ -510,15 +514,12 @@
                    {
                       t = strdup((char *)xprop.value);
                    }
-                 else if (ret >= Success)
+                 else if ((ret >= Success) && (num > 0))
                    {
-                      if ((num >= 1) && (list))
-                        {
-                           t = strdup(list[0]);
-                        }
-                      if (list)
-                        XFreeStringList(list);
+                      t = strdup(list[0]);
                    }
+                 if (list)
+                   XFreeStringList(list);
               }
             
             if (xprop.value) XFree(xprop.value);
@@ -1044,8 +1045,26 @@
       return 0;
 }
 
-/* FIXME: move these things in here as they are icccm related */
-/* send iconify request */
+void
+ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root)
+{
+   XEvent xev;
+
+   if (!win) return;
+   if (!root) root = DefaultRootWindow(_ecore_x_disp);
+
+   xev.xclient.type = ClientMessage;
+   xev.xclient.serial = 0;
+   xev.xclient.send_event = True;
+   xev.xclient.display = _ecore_x_disp;
+   xev.xclient.window = win;
+   xev.xclient.format = 32;
+   xev.xclient.message_type = ECORE_X_ATOM_WM_CHANGE_STATE;
+   xev.xclient.data.l[0] = IconicState;
+
+   XSendEvent(_ecore_x_disp, root, False,
+              SubstructureNotifyMask | SubstructureRedirectMask, &xev);
+}
 
 /* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */
 /*        hints. each should go in their own file/section so we know which */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_mwm.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ecore_x_mwm.c       4 Dec 2004 10:10:29 -0000       1.3
+++ ecore_x_mwm.c       10 Jun 2005 04:18:24 -0000      1.4
@@ -76,3 +76,18 @@
      }
    return ret;
 }
+
+void
+ecore_x_mwm_borderless_set(Ecore_X_Window win, int borderless)
+{
+   unsigned int data[5] = {0, 0, 0, 0, 0};
+
+   data[0] = 2; /* just set the decorations hint! */
+   data[2] = !borderless;
+   
+   ecore_x_window_prop_property_set(win, 
+                                   ECORE_X_ATOM_MOTIF_WM_HINTS,
+                                   ECORE_X_ATOM_MOTIF_WM_HINTS,
+                                   32, (void *)data, 5);
+}
+
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_netwm.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- ecore_x_netwm.c     7 Jun 2005 15:34:54 -0000       1.35
+++ ecore_x_netwm.c     10 Jun 2005 04:18:24 -0000      1.36
@@ -33,74 +33,6 @@
                    (unsigned char *)p_val, cnt)
 
 /*
- * Convenience functions. Should probably go elsewhere.
- */
-
-/*
- * Set CARD32 (array) property
- */
-void
-ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom,
-                              unsigned int *val, unsigned int num)
-{
-#if SIZEOF_INT == 4
-   _ATOM_SET_CARD32(win, atom, val, num);
-#else
-   CARD32             *c32;
-   unsigned int        i;
-
-   c32 = malloc(num * sizeof(CARD32));
-   if (!c32)
-      return;
-   for (i = 0; i < num; i++)
-      c32[i] = val[i];
-   _ATOM_SET_CARD32(win, atom, c32, num);
-   free(c32);
-#endif
-}
-
-/*
- * Get CARD32 (array) property
- *
- * At most len items are returned in val.
- * If the property was successfully fetched the number of items stored in
- * val is returned, otherwise -1 is returned.
- * Note: Return value 0 means that the property exists but has no elements.
- */
-int
-ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom,
-                              unsigned int *val, unsigned int len)
-{
-   unsigned char      *prop_ret;
-   Atom                type_ret;
-   unsigned long       bytes_after, num_ret;
-   int                 format_ret;
-   unsigned int        i;
-   int                 num;
-
-   prop_ret = NULL;
-   XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
-                     XA_CARDINAL, &type_ret, &format_ret, &num_ret,
-                     &bytes_after, &prop_ret);
-   if (prop_ret && type_ret == XA_CARDINAL && format_ret == 32)
-     {
-       if (num_ret < len)
-          len = num_ret;
-       for (i = 0; i < len; i++)
-          val[i] = ((unsigned long *)prop_ret)[i];
-       num = len;
-     }
-   else
-     {
-       num = -1;
-     }
-   if (prop_ret)
-      XFree(prop_ret);
-
-   return num;
-}
-
-/*
  * Set UTF-8 string property
  */
 static void
@@ -880,7 +812,7 @@
 
    if (!num)
      {
-       XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_NET_WM_STATE);
+       ecore_x_window_prop_property_del(win, ECORE_X_ATOM_NET_WM_STATE);
        return;
      }
 
@@ -1212,7 +1144,7 @@
 }
 
 void
-ecore_x_netwm_ping(Ecore_X_Window win)
+ecore_x_netwm_ping_send(Ecore_X_Window win)
 {
    XEvent xev;
 
@@ -1256,3 +1188,51 @@
 
    XSendEvent(_ecore_x_disp, win, False, 0, &xev);
 }
+
+void
+ecore_x_netwm_state_request_send(Ecore_X_Window win, Ecore_X_Window root,
+                                Ecore_X_Window_State s1, Ecore_X_Window_State 
s2, int set)
+{
+   XEvent xev;
+
+   if (!win) return;
+   if (!root) root = DefaultRootWindow(_ecore_x_disp);
+
+   xev.xclient.type = ClientMessage;
+   xev.xclient.serial = 0;
+   xev.xclient.send_event = True;
+   xev.xclient.display = _ecore_x_disp;
+   xev.xclient.window = win;
+   xev.xclient.format = 32;
+   xev.xclient.message_type = ECORE_X_ATOM_NET_WM_STATE;
+   xev.xclient.data.l[0] = !!set;
+   xev.xclient.data.l[1] = _ecore_x_netwm_state_atom_get(s1);
+   xev.xclient.data.l[2] = _ecore_x_netwm_state_atom_get(s2);
+   /* 1 == normal client, if someone wants to use this
+    * function in a pager, this should be 2 */
+   xev.xclient.data.l[3] = 1;
+   xev.xclient.data.l[4] = 0;
+
+   XSendEvent(_ecore_x_disp, root, False, 0, &xev);
+}
+
+void
+ecore_x_netwm_desktop_request_send(Ecore_X_Window win, Ecore_X_Window root, 
unsigned int desktop)
+{
+   XEvent xev;
+
+   if (!win) return;
+   if (!root) root = DefaultRootWindow(_ecore_x_disp);
+
+   xev.xclient.type = ClientMessage;
+   xev.xclient.serial = 0;
+   xev.xclient.send_event = True;
+   xev.xclient.display = _ecore_x_disp;
+   xev.xclient.window = win;
+   xev.xclient.format = 32;
+   xev.xclient.message_type = ECORE_X_ATOM_NET_WM_DESKTOP;
+   xev.xclient.data.l[0] = desktop;
+
+   XSendEvent(_ecore_x_disp, root, False,
+             SubstructureNotifyMask | SubstructureRedirectMask, &xev);
+}
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- ecore_x_window.c    25 Apr 2005 08:40:58 -0000      1.38
+++ ecore_x_window.c    10 Jun 2005 04:18:24 -0000      1.39
@@ -1,7 +1,6 @@
 /*
  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
  */
-
 #include "Ecore.h"
 #include "ecore_x_private.h"
 #include "Ecore_X.h"
@@ -221,13 +220,12 @@
     * Set _NET_WM_PID
     */
    pid = getpid();
-   ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_PID, XA_CARDINAL,
-                                   32, &pid, 1);
+   ecore_x_netwm_pid_set(win, pid);
 
-   ecore_x_window_prop_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
+   ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
 
    ecore_app_args_get(&argc, &argv);
-   ecore_x_window_prop_command_set(win, argc, argv);
+   ecore_x_icccm_command_set(win, argc, argv);
 }
 
 void
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -3 -r1.70 -r1.71
--- ecore_x_window_prop.c       2 Jun 2005 20:14:13 -0000       1.70
+++ ecore_x_window_prop.c       10 Jun 2005 04:18:24 -0000      1.71
@@ -8,7 +8,73 @@
 #include <inttypes.h>
 #include <limits.h>
 
-static Ecore_X_Atom _ecore_x_window_prop_state_atom_get(Ecore_X_Window_State 
s);
+#define _ATOM_SET_CARD32(win, atom, p_val, cnt) \
+   XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace, 
\
+                   (unsigned char *)p_val, cnt)
+
+/*
+ * Set CARD32 (array) property
+ */
+void
+ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom,
+                              unsigned int *val, unsigned int num)
+{
+#if SIZEOF_INT == 4
+   _ATOM_SET_CARD32(win, atom, val, num);
+#else
+   CARD32             *c32;
+   unsigned int        i;
+
+   c32 = malloc(num * sizeof(CARD32));
+   if (!c32)
+      return;
+   for (i = 0; i < num; i++)
+      c32[i] = val[i];
+   _ATOM_SET_CARD32(win, atom, c32, num);
+   free(c32);
+#endif
+}
+
+/*
+ * Get CARD32 (array) property
+ *
+ * At most len items are returned in val.
+ * If the property was successfully fetched the number of items stored in
+ * val is returned, otherwise -1 is returned.
+ * Note: Return value 0 means that the property exists but has no elements.
+ */
+int
+ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom,
+                              unsigned int *val, unsigned int len)
+{
+   unsigned char      *prop_ret;
+   Atom                type_ret;
+   unsigned long       bytes_after, num_ret;
+   int                 format_ret;
+   unsigned int        i;
+   int                 num;
+
+   prop_ret = NULL;
+   XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
+                     XA_CARDINAL, &type_ret, &format_ret, &num_ret,
+                     &bytes_after, &prop_ret);
+   if (prop_ret && type_ret == XA_CARDINAL && format_ret == 32)
+     {
+       if (num_ret < len)
+          len = num_ret;
+       for (i = 0; i < len; i++)
+          val[i] = ((unsigned long *)prop_ret)[i];
+       num = len;
+     }
+   else
+     {
+       num = -1;
+     }
+   if (prop_ret)
+      XFree(prop_ret);
+
+   return num;
+}
 
 /**
  * To be documented.
@@ -116,44 +182,27 @@
    XDeleteProperty(_ecore_x_disp, win, property);
 }
 
-#if 0
-/*
- * I see no purpose for a ecore_x_window_prop_property_notify().
- * Commenting out for now, suggest to remove it entirely.
- * /Kim
- */
-/**
- * Send a property notify to a window.
- * @param win The window
- * @param type Type of notification
- * @param data The data
- *
- * Send a property notify to a window.
- */
-void
-ecore_x_window_prop_property_notify(Ecore_X_Window win, const char *type, long 
*data)
+Ecore_X_Atom *
+ecore_x_window_prop_list(Ecore_X_Window win, int *num_ret)
 {
-   Ecore_X_Atom        tmp;
-   XClientMessageEvent xev;
+   Ecore_X_Atom *atoms;
+   Atom *atom_ret;
+   int num = 0, i;
+       
+   if (num_ret) *num_ret = 0;
 
-   tmp = XInternAtom(_ecore_x_disp, type, False);
+   atom_ret = XListProperties(_ecore_x_disp, win, &num);
+   if (!atom_ret) return NULL;
 
-   xev.type = PropertyNotify;
-   xev.display = _ecore_x_disp;
-   xev.window = win;
-   xev.message_type = tmp;
-   xev.format = 32;
-   xev.data.l[0] = data[0];
-   xev.data.l[1] = data[1];
-   xev.data.l[2] = data[2];
-   xev.data.l[3] = data[3];
-   xev.data.l[4] = data[4];
-
-   XSendEvent(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp), False,
-             (SubstructureNotifyMask | SubstructureRedirectMask),
-             (XEvent *)&xev);
+   atoms = malloc(num * sizeof(Ecore_X_Atom));
+   if (atoms)
+     {
+       for (i = 0; i < num; i++) atoms[i] = atom_ret[i];
+       if (num_ret) *num_ret = num;
+     }
+   XFree(atom_ret);
+   return atoms;
 }
-#endif
 
 /**
  * Set a window string property.
@@ -196,378 +245,36 @@
        char   **list;
        Status   s;
        
-       if (xtp.format == 8)
+       if (xtp.encoding == ECORE_X_ATOM_UTF8_STRING)
          {
-            s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp, &list, &items);
-            if ((s == Success) && (items > 0))
-              {
-                 /* FIXME convert from xlib encoding to utf8  */
-                 str = strdup(*list);
-                 XFreeStringList(list);
-              }
-            else
-              /* FIXME convert from xlib encoding to utf8  */
-              str = strdup((char *)xtp.value);
+            str = strdup((char *)xtp.value);
          }
        else
-         /* FIXME convert from xlib encoding to utf8  */
-         str = strdup((char *)xtp.value);
-       XFree(xtp.value);
-     }
-   return str;
-}
-
-/**
- * Set a window title.
- * @param win The window
- * @param t The title string
- * 
- * Set a window title
- */
-void
-ecore_x_window_prop_title_set(Ecore_X_Window win, const char *t)
-{
-   char *list[1];
-   XTextProperty xprop;
-   
-   list[0] = (char *) t;
-   
-   /* Xlib may not like the UTF8 String */
-   /* FIXME convert utf8 to whatever encoding xlib prefers */
-   /* ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_NAME, (char *)t); */
-   if (XStringListToTextProperty(list, 1, &xprop))
-     {
-      XSetWMName(_ecore_x_disp, win, &xprop);
-      XFree(xprop.value);
-     }
-            
-   ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_NAME, (char *)t);
-}
-
-/**
- * Get a window title.
- * @param win The window
- * @return The windows title string
- * 
- * Return the title of a window. String must be free'd when done with.
- */
-char *
-ecore_x_window_prop_title_get(Ecore_X_Window win)
-{
-   char *title;
-
-/*   title = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_NAME);*/
-   title = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_NAME);
-   return title;
-}
-
-/**
- * Sets the WM_COMMAND property for @a win.
- * 
- * @param win  The window.
- * @param argc Number of arguments.
- * @param argv Arguments.
- *
- * DEPRECATED. Please use ecore_x_icccm_command_set() instead.
- */
-void
-ecore_x_window_prop_command_set(Ecore_X_Window win, int argc, char **argv)
-{
-   XSetCommand(_ecore_x_disp, win, argv, argc);
-}
-
-/**
- * Get the WM_COMMAND property for @a win.
- *
- * Return the command of a window. String must be free'd when done with.
- *
- * @param win  The window.
- * @param argc Number of arguments.
- * @param argv Arguments.
- *
- * DEPRECATED. Please use ecore_x_icccm_command_get() instead.
- */
-void
-ecore_x_window_prop_command_get(Ecore_X_Window win, int *argc, char ***argv)
-{
-   XGetCommand(_ecore_x_disp, win, argv, argc);
-}
-
-
-
-/**
- * Set a window visible title.
- * @param win The window
- * @param t The visible title string
- * 
- * Set a window visible title
- */
-void
-ecore_x_window_prop_visible_title_set(Ecore_X_Window win, const char *t)
-{
-   ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME,
-                                 (char *)t);
-}
-
-/**
- * Get a window visible title.
- * @param win The window
- * @return The windows visible title string
- * 
- * Return the visible title of a window. String must be free'd when done with.
- */
-char *
-ecore_x_window_prop_visible_title_get(Ecore_X_Window win)
-{
-   char *title;
-
-   title = ecore_x_window_prop_string_get(win, 
ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
-   return title;
-}
-
-/**
- * Set a window icon name.
- * @param win The window
- * @param t The icon name string
- * 
- * Set a window icon name
- * DEPRECATED. Please use ecore_x_icccm_icon_name_set() instead,
- * and ecore_x_netwm_icon_name_set() when it becomes available.
- */
-void
-ecore_x_window_prop_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.
- * DEPRECATED. Please use ecore_x_icccm_icon_name_get() instead.
- */
-char *
-ecore_x_window_prop_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;
-}
-
-/**
- * Set a window visible icon name.
- * @param win The window
- * @param t The visible icon name string
- * 
- * Set a window visible icon name
- */
-void
-ecore_x_window_prop_visible_icon_name_set(Ecore_X_Window win, const char *t)
-{
-   ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
-                                 (char *)t);
-}
-
-/**
- * Get a window visible icon name.
- * @param win The window
- * @return The windows visible icon name string
- * 
- * Return the visible icon name of a window. String must be free'd when done 
with.
- */
-char *
-ecore_x_window_prop_visible_icon_name_get(Ecore_X_Window win)
-{
-   char *name;
-
-   name = ecore_x_window_prop_string_get(win, 
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
-   return name;
-}
-
-/**
- * Get a window client machine string.
- * @param win The window
- * @return The windows client machine string
- * 
- * Return the client machine of a window. String must be free'd when done with.
- * DEPRECATED. Please use ecore_x_icccm_client_machine_get() instead.
- */
-char *
-ecore_x_window_prop_client_machine_get(Ecore_X_Window win)
-{
-   char *name;
-
-   name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE);
-   return name;
-}
-
-/**
- * Get a windows process id
- * @param win The window
- * @return The windows process id
- * 
- * Return the process id of a window.
- */
-pid_t
-ecore_x_window_prop_pid_get(Ecore_X_Window win)
-{
-   int            num = 0;
-   pid_t          pid = 0;
-   unsigned char *tmp = NULL;
-
-   ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_PID, XA_CARDINAL,
-                                   32, &tmp, &num);
-   if ((num) && (tmp))
-     {
-       pid = (pid_t)(*tmp);
-       free(tmp);
-     }
-   return pid;
-}
-
-/**
- * Set a window name & class.
- * @param win The window
- * @param n The name string
- * @param c The class string
- * 
- * Set a window name * class
- * DEPRECATED. Please use ecore_x_icccm_name_class_set() instead.
- */
-void
-ecore_x_window_prop_name_class_set(Ecore_X_Window win, const char *n, const 
char *c)
-{
-   XClassHint *xch;
-   
-   xch = XAllocClassHint();
-   if (!xch) return;
-   xch->res_name = (char *)n;
-   xch->res_class = (char *)c;
-   XSetClassHint(_ecore_x_disp, win, xch);
-   XFree(xch);   
-}
-
-/**
- * Get a window name & class.
- * @param win The window
- * @param n Name string
- * @param c Class string
- * 
- * Get a windows name and class property. strings must be free'd when done 
- * with.
- * DEPRECATED. Please use ecore_x_icccm_name_class_get() instead.
- */
-void
-ecore_x_window_prop_name_class_get(Ecore_X_Window win, char **n, char **c)
-{
-   XClassHint          xch;
-   
-   if (n) *n = NULL;
-   if (c) *c = NULL;
-   if (XGetClassHint(_ecore_x_disp, win, &xch))
-     {
-       if (n)
-         {
-            if (xch.res_name) *n = strdup(xch.res_name);
-         }
-       if (c)
-         {
-            if (xch.res_class) *c = strdup(xch.res_class);
-         }
-       XFree(xch.res_name);
-       XFree(xch.res_class);
-     }
-}
-
-/**
- * Set or unset a wm protocol property.
- * @param win The Window
- * @param protocol The protocol to enable/disable
- * @param on On/Off
- *
- * DEPRECATED. Please use ecore_x_icccm_protocol_set() instead.
- */
-void
-ecore_x_window_prop_protocol_set(Ecore_X_Window win,
-                                 Ecore_X_WM_Protocol protocol, int on)
-{
-   Atom *protos = NULL;
-   Atom  proto;
-   int   protos_count = 0;
-   int   already_set = 0;
-   int   i;
-
-   /* check for invalid values */
-   if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
-       return;
-
-   proto = _ecore_x_atoms_wm_protocols[protocol];
-   
-   if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
-     {
-       protos = NULL;
-       protos_count = 0;
-     }
-   for (i = 0; i < protos_count; i++)
-     {
-       if (protos[i] == proto)
-         {
-            already_set = 1;
-            break;
-         }
-     }
-   if (on)
-     {
-       Atom *new_protos = NULL;
-       
-       if (already_set) goto leave;
-       new_protos = malloc((protos_count + 1) * sizeof(Atom));
-       if (!new_protos) goto leave;
-       for (i = 0; i < protos_count; i++)
-         new_protos[i] = protos[i];
-       new_protos[protos_count] = proto;
-       XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1);
-       free(new_protos);
-     }
-   else
-     {
-       if (!already_set) goto leave;
-       for (i = 0; i < protos_count; i++)
          {
-            if (protos[i] == proto)
+#ifdef X_HAVE_UTF8_STRING
+            s = Xutf8TextPropertyToTextList(_ecore_x_disp, &xtp,
+                                            &list, &items);
+#else
+            s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp,
+                                          &list, &items);
+#endif
+            if ((s == XLocaleNotSupported) ||
+                (s == XNoMemory) || (s == XConverterNotFound))
+              {
+                 str = strdup((char *)xtp.value);
+              }
+            else if ((s >= Success) && (items > 0))
               {
-                 int j;
-                 
-                 for (j = i + 1; j < protos_count; j++)
-                   protos[j - 1] = protos[j];
-                 if (protos_count > 1)
-                   XSetWMProtocols(_ecore_x_disp, win, protos, 
-                                   protos_count - 1);
-                 else
-                   XDeleteProperty(_ecore_x_disp, win, 
-                                   ECORE_X_ATOM_WM_PROTOCOLS);
-                 goto leave;
+                 str = strdup(list[0]);
               }
+            if (list)
+              XFreeStringList(list);
          }
+       XFree(xtp.value);
      }
-   leave:
-   if (protos) XFree(protos);
+   return str;
 }
 
-/**
- * Determines whether a protocol is set for a window.
- * @param win The Window
- * @param protocol The protocol to query
- * @return 1 if the protocol is set, else 0.
- *
- * DEPRECATED. Please use ecore_x_icccm_protocol_isset() instead.
- */
 int
 ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
                                    Ecore_X_WM_Protocol protocol)
@@ -633,783 +340,3 @@
    *num_ret = protos_count;
    return prot_ret;
 }
-
-/**
- * To be documented.
- *
- * FIXME: To be fixed.
- */
-void
-ecore_x_window_prop_min_size_set(Ecore_X_Window win, int w, int h)
-{
-   XSizeHints          hints;
-   long                ret;
-   
-   memset(&hints, 0, sizeof(XSizeHints));
-   XGetWMNormalHints(_ecore_x_disp, win, &hints, &ret);
-   hints.flags |= PMinSize | PSize;
-   hints.min_width = w;
-   hints.min_height = h;
-   XSetWMNormalHints(_ecore_x_disp, win, &hints);
-}
-
-/**
- * To be documented.
- *
- * FIXME: To be fixed.
- */
-void
-ecore_x_window_prop_max_size_set(Ecore_X_Window win, int w, int h)
-{
-   XSizeHints          hints;
-   long                ret;
-   
-   memset(&hints, 0, sizeof(XSizeHints));
-   XGetWMNormalHints(_ecore_x_disp, win, &hints, &ret);
-   hints.flags |= PMaxSize | PSize;
-   hints.max_width = w;
-   hints.max_height = h;
-   XSetWMNormalHints(_ecore_x_disp, win, &hints);
-}
-
-/**
- * To be documented.
- *
- * FIXME: To be fixed.
- */
-void
-ecore_x_window_prop_base_size_set(Ecore_X_Window win, int w, int h)
-{
-   XSizeHints          hints;
-   long                ret;
-   
-   memset(&hints, 0, sizeof(XSizeHints));
-   XGetWMNormalHints(_ecore_x_disp, win, &hints, &ret);
-   hints.flags |= PBaseSize | PSize;
-   hints.base_width = w;
-   hints.base_height = h;
-   XSetWMNormalHints(_ecore_x_disp, win, &hints);
-}
-
-/**
- * To be documented.
- *
- * FIXME: To be fixed.
- */
-void
-ecore_x_window_prop_step_size_set(Ecore_X_Window win, int x, int y)
-{
-   XSizeHints          hints;
-   long                ret;
-   
-   memset(&hints, 0, sizeof(XSizeHints));
-   XGetWMNormalHints(_ecore_x_disp, win, &hints, &ret);
-   hints.flags |= PResizeInc;
-   hints.width_inc = x;
-   hints.height_inc = y;
-   XSetWMNormalHints(_ecore_x_disp, win, &hints);
-}
-
-/**
- * To be documented.
- *
- * FIXME: To be fixed.
- */
-void
-ecore_x_window_prop_xy_set(Ecore_X_Window win, int x, int y)
-{
-   XSizeHints          hints;
-   long                ret;
-   
-   memset(&hints, 0, sizeof(XSizeHints));
-   XGetWMNormalHints(_ecore_x_disp, win, &hints, &ret);
-   hints.flags |= PPosition | USPosition;
-   hints.x = x;
-   hints.y = y;
-   XMoveWindow(_ecore_x_disp, win, x, y);
-   XSetWMNormalHints(_ecore_x_disp, win, &hints);
-}
-
-/**
- * Sets the sticky state for @a win.
- * @param win The window
- * @param on  Boolean representing the sticky state
- */
-void
-ecore_x_window_prop_sticky_set(Ecore_X_Window win, int on)
-{
-   unsigned long val = 0xffffffff;
-   int ret, num = 0;
-   unsigned char *data = NULL;
-
-   if (on) {
-      ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_DESKTOP,
-                                       XA_CARDINAL, 32, &val, 1);
-      ecore_x_window_prop_state_set(win, ECORE_X_WINDOW_STATE_STICKY);
-      return;
-   }
-   
-   ecore_x_window_prop_state_unset(win, ECORE_X_WINDOW_STATE_STICKY);
-   ret = ecore_x_window_prop_property_get(0, ECORE_X_ATOM_NET_CURRENT_DESKTOP,
-                                         XA_CARDINAL, 32, &data, &num);
-   if (!ret || !num)
-          return;
-
-   ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_DESKTOP,
-                                    XA_CARDINAL, 32, data, 1);
-   free(data);
-}
-
-/**
- * Sets the input mode for @a win
- * @param win The Window
- * @param mode The input mode. See the description of
- *             #_Ecore_X_Window_Input_Mode for details.
- * @return 1 if the input mode could be set, else 0
- */
-int
-ecore_x_window_prop_input_mode_set(Ecore_X_Window win, 
Ecore_X_Window_Input_Mode mode)
-{
-   XWMHints *hints;
-
-   if (!(hints = XGetWMHints(_ecore_x_disp, win)))
-      if (!(hints = XAllocWMHints()))
-         return 0;
-       
-   hints->flags |= InputHint;
-   hints->input = (mode == ECORE_X_WINDOW_INPUT_MODE_PASSIVE
-                   || mode == ECORE_X_WINDOW_INPUT_MODE_ACTIVE_LOCAL);
-   XSetWMHints(_ecore_x_disp, win, hints);
-   XFree(hints);
-
-   ecore_x_window_prop_protocol_set(win, ECORE_X_WM_PROTOCOL_TAKE_FOCUS,
-                 (mode == ECORE_X_WINDOW_INPUT_MODE_ACTIVE_LOCAL
-                  || mode == ECORE_X_WINDOW_INPUT_MODE_ACTIVE_GLOBAL));
-
-   return 1;
-}
-
-/**
- * Set the initial state of an Ecore_X_Window.
- *
- * @param win The window whose initial state is set.
- * @param withdrawn The window's new initial state.
- *
- * @return 1 if the input mode could be set, else 0
- *
- */
-int
-ecore_x_window_prop_initial_state_set(Ecore_X_Window win, 
Ecore_X_Window_State_Hint state)
-{
-   XWMHints *hints;
-
-   if (!(hints = XGetWMHints(_ecore_x_disp, win)))
-      if (!(hints = XAllocWMHints()))
-         return 0;
-
-   switch (state) {
-   case ECORE_X_WINDOW_STATE_HINT_NONE:
-      hints->flags &= ~StateHint;
-      break;
-   case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
-      hints->initial_state = WithdrawnState;
-      hints->flags |= StateHint;
-      break;
-   case ECORE_X_WINDOW_STATE_HINT_NORMAL:
-      hints->initial_state = NormalState;
-      hints->flags |= StateHint;
-      break;
-   case ECORE_X_WINDOW_STATE_HINT_ICONIC:
-      hints->initial_state = IconicState;
-      hints->flags |= StateHint;
-      break;
-   }
-
-   XSetWMHints(_ecore_x_disp, win, hints);
-   XFree(hints);
-
-   return 1;
-}
-
-/**
- * To be documented.
- *
- * FIXME: To be fixed.
- */
-void
-ecore_x_window_prop_borderless_set(Ecore_X_Window win, int borderless)
-{
-   unsigned int data[5] = {0, 0, 0, 0, 0};
-
-   data[0] = 2; /* just set the decorations hint! */
-   data[2] = !borderless;
-   
-   ecore_x_window_prop_property_set(win, 
-                                   ECORE_X_ATOM_MOTIF_WM_HINTS,
-                                   ECORE_X_ATOM_MOTIF_WM_HINTS,
-                                   32, (void *)data, 5);
-}
-
-/**
- * To be documented.
- *
- * FIXME: To be fixed.
- */
-int
-ecore_x_window_prop_borderless_get(Ecore_X_Window win)
-{
-   unsigned char *data;
-   int num;
-   int borderless = 0;
-
-   ecore_x_window_prop_property_get(win,
-                                    ECORE_X_ATOM_MOTIF_WM_HINTS,
-                                    ECORE_X_ATOM_MOTIF_WM_HINTS,
-                                    32, &data, &num);
-
-   /* check for valid data. only read the borderless flag if the
-    * decorations data has been set.
-    */
-   if (data)
-     {
-       borderless = ((num > 2) && (data[0] & 2)) ? !data[2] : 0;
-       free(data);
-     }
-   return borderless;
-}
-
-/**
- * Puts @a win in the desired layer. This currently works with
- * windowmanagers that are Gnome-compliant or support NetWM.
- * 
- * Normally you will use this function with one of the predefined
- * layer constants:
- * ECORE_X_WINDOW_LAYER_BELOW  - for windows to be stacked below
- * ECORE_X_WINDOW_LAYER_ABOVE  - for windows to be stacked on top
- * ECORE_X_WINDOW_LAYER_NORMAL - for windows to be put in the default layer
-
- * @param win
- * @param layer If < 3, @a win will be put below all other windows.
- *              If > 5, @a win will be "always-on-top"
- *              If = 4, @a win will be put in the default layer.
- *              Acceptable values range from 1 to 255 (0 reserved for
- *              desktop windows)
- * @return 1 if the state could be set else 0
- */
-int
-ecore_x_window_prop_layer_set(Ecore_X_Window win, int layer)
-{
-   if (layer <= 0 || layer > 255)
-      return 0;
-   
-   if (layer < 3) /* below */
-      ecore_x_window_prop_state_set(win, ECORE_X_WINDOW_STATE_BELOW);
-   else if (layer > 5) /* above */
-      ecore_x_window_prop_state_set(win, ECORE_X_WINDOW_STATE_ABOVE);
-   else if (layer == 4)
-   {
-      ecore_x_window_prop_state_unset(win, ECORE_X_WINDOW_STATE_BELOW);
-      ecore_x_window_prop_state_unset(win, ECORE_X_WINDOW_STATE_ABOVE);
-   }
-
-   /* set the gnome atom */      
-   ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WIN_LAYER,
-                                   XA_CARDINAL, 32, &layer, 1);
-
-   return 1;
-}
-
-/**
- * Set the withdrawn state of an Ecore_X_Window.
- * @param win The window whose withdrawn state is set.
- * @param withdrawn The window's new withdrawn state.
- */
-void
-ecore_x_window_prop_withdrawn_set(Ecore_X_Window win, int withdrawn)
-{
-#if 0
-   XWMHints hints;
-   long     ret;
-   
-   memset(&hints, 0, sizeof(XWMHints));
-   XGetWMNormalHints(_ecore_x_disp, win, (XSizeHints *) &hints, &ret);
-   
-   if (!withdrawn)
-      hints.initial_state &= ~WithdrawnState;
-   else
-      hints.initial_state |= WithdrawnState;
-   
-   hints.flags = WindowGroupHint | StateHint;
-   XSetWMHints(_ecore_x_disp, win, &hints);
-   XSetWMNormalHints(_ecore_x_disp, win, (XSizeHints *) &hints);
-#else
-   if (withdrawn)
-      ecore_x_window_prop_initial_state_set(win, 
ECORE_X_WINDOW_STATE_HINT_WITHDRAWN);
-   else
-      ecore_x_window_prop_initial_state_set(win, 
ECORE_X_WINDOW_STATE_HINT_NONE);
-#endif
-}
-
-/**
- * Request the window manager to change this windows desktop.
- * @param win The Window
- * @param desktop The desktop number.
- */
-void
-ecore_x_window_prop_desktop_request(Ecore_X_Window win, long desktop)
-{
-   XEvent xev;
-
-   memset(&xev, 0, sizeof(XEvent));
-
-   xev.xclient.type = ClientMessage;
-   xev.xclient.display = _ecore_x_disp;
-   xev.xclient.window = win;
-   xev.xclient.message_type = ECORE_X_ATOM_NET_WM_DESKTOP;
-   xev.xclient.format = 32;
-   xev.xclient.data.l[0] = desktop;
-
-   XSendEvent(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp), False,
-             SubstructureNotifyMask | SubstructureRedirectMask, &xev);
-}
-
-/**
- * Request the window manager to change this window's state.
- *
- * Use this function to request the window manager to change the
- * specified window's state after it has been displayed (mapped).
- *
- * @param win     The Window
- * @param state   The requested state
- * @param action  The action to perform: 0 - unset, 1 - set, 2 - toggle
- */
-void
-ecore_x_window_prop_state_request(Ecore_X_Window win, Ecore_X_Window_State 
state, int action)
-{
-   XEvent xev;
-
-   if (action < 0 || action > 2)
-      return;
-
-   xev.xclient.type = ClientMessage;
-   xev.xclient.serial = 0;
-   xev.xclient.send_event = True;
-   xev.xclient.display = _ecore_x_disp;
-   xev.xclient.window = win;
-   xev.xclient.format = 32;
-
-   switch (state) {
-   case ECORE_X_WINDOW_STATE_ICONIFIED:
-      if (action == 0)
-      {
-        XMapWindow(_ecore_x_disp, win);
-        return;
-      }
-      if (action != 1)
-        return;
-      xev.xclient.message_type = ECORE_X_ATOM_WM_CHANGE_STATE;
-      xev.xclient.data.l[0] = IconicState;
-      break;
-   default: /* The _NET_WM_STATE_... hints */
-      xev.xclient.message_type = ECORE_X_ATOM_NET_WM_STATE;
-      xev.xclient.data.l[0] = action;
-      xev.xclient.data.l[1] = _ecore_x_window_prop_state_atom_get(state);
-      break;
-   }
-
-   XSendEvent(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp), False,
-              SubstructureNotifyMask | SubstructureRedirectMask, &xev);
-}
-   
-
-/**
- * Used by the window manager, or client prior mapping, to set window desktop.
- * @param win The Window
- * @param desktop The desktop number.
- *
- * Used by the window manager, or client prior mapping, to set window desktop.
- */
-void
-ecore_x_window_prop_desktop_set(Ecore_X_Window win, long desktop)
-{
-   ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_DESKTOP, 
-                    XA_CARDINAL, 32, &desktop, 1);
-}
-
-/**
- * Get the current desktop of a window
- * @param win The Window
- *
- * Get the current desktop of a window
- */
-long
-ecore_x_window_prop_desktop_get(Ecore_X_Window win)
-{
-   int            num;
-   unsigned char *tmp;
-   long           desktop = -1;
-
-   ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_DESKTOP, 
-                                    XA_CARDINAL, 32, &tmp, &num);
-   if ((tmp) && (num))
-     {
-       desktop = *(long *)tmp;
-       free(tmp);
-     }
-
-   return desktop;
-}
-
-
-static Ecore_X_Atom 
-_ecore_x_window_prop_type_atom_get(Ecore_X_Window_Type type)
-{
-   switch (type)
-   {
-      case ECORE_X_WINDOW_TYPE_DESKTOP:
-         return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
-      case ECORE_X_WINDOW_TYPE_DOCK:
-         return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
-      case ECORE_X_WINDOW_TYPE_TOOLBAR:
-         return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
-      case ECORE_X_WINDOW_TYPE_MENU:
-         return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
-      case ECORE_X_WINDOW_TYPE_UTILITY:
-         return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
-      case ECORE_X_WINDOW_TYPE_SPLASH:
-         return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
-      case ECORE_X_WINDOW_TYPE_DIALOG:
-         return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
-      case ECORE_X_WINDOW_TYPE_NORMAL:
-         return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
-      default:
-         return 0;
-   }
-}
-
-/**
- * Set a window's type.
- * @param win The Window
- * @param type The Type
- *
- * Set a windows type.
- */
-void
-ecore_x_window_prop_window_type_set(Ecore_X_Window win, Ecore_X_Window_Type 
type)
-{
-   Atom a;
-
-   a = _ecore_x_window_prop_type_atom_get(type);
-   if (a)
-      ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
-                                      XA_ATOM, 32, (unsigned char*)&a, 1);
-}
-
-
-#if 0
-/**
- * Change a window's type.
- * @param win The Window
- * @param type The Type
- *
- * Change a windows type.
- */
-void
-ecore_x_window_prop_window_type_set(Ecore_X_Window win, Ecore_X_Atom type)
-{
-       int            num;
-       unsigned char *data = NULL;
-
-       if (ecore_x_window_prop_property_get(win,
-                                            ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
-                                            XA_ATOM, 32, &data, &num))
-          XFree(data);
-
-       data = malloc(sizeof(Ecore_X_Atom));
-       if (data)
-         {
-            ((Atom *)data)[0] = type;
-            ecore_x_window_prop_property_set(win,
-                                             ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
-                                             XA_ATOM, 32, data, 1);
-         }
-       free(data);
-}
-#endif
-
-static Ecore_X_Atom 
-_ecore_x_window_prop_state_atom_get(Ecore_X_Window_State s)
-{
-   switch(s)
-   {
-      case ECORE_X_WINDOW_STATE_MODAL:
-         return ECORE_X_ATOM_NET_WM_STATE_MODAL;
-      case ECORE_X_WINDOW_STATE_STICKY:
-         return ECORE_X_ATOM_NET_WM_STATE_STICKY;
-      case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
-         return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
-      case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
-         return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
-      case ECORE_X_WINDOW_STATE_SHADED:
-         return ECORE_X_ATOM_NET_WM_STATE_SHADED;
-      case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
-         return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
-      case ECORE_X_WINDOW_STATE_SKIP_PAGER:
-         return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
-      case ECORE_X_WINDOW_STATE_HIDDEN:
-         return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
-      case ECORE_X_WINDOW_STATE_FULLSCREEN:
-         return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
-      case ECORE_X_WINDOW_STATE_ABOVE:
-         return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
-      case ECORE_X_WINDOW_STATE_BELOW:
-         return ECORE_X_ATOM_NET_WM_STATE_BELOW;
-      case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION:
-         return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION;
-      default:
-         return 0;
-   }
-}
-
-/**
- * Set a state for a window
- * @param win The Window whose properties will be changed
- * @param s The state to be set for this window
- *
- * Adds the state to the window's properties if not already included.
- */
-void
-ecore_x_window_prop_state_set(Ecore_X_Window win, Ecore_X_Window_State s)
-{
-   int            num = 0, i;
-   unsigned char  *old_data = NULL;
-   unsigned char  *data = NULL;
-   Atom           *oldset = NULL;
-   Atom           *newset = NULL;
-   Ecore_X_Atom   state;
-   
-   state = _ecore_x_window_prop_state_atom_get(s);
-
-   ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_STATE,
-                                    XA_ATOM, 32, &old_data, &num);
-   oldset = (Atom *) old_data;
-   newset = calloc(num + 1, sizeof(Atom));
-   if (!newset) return;
-   data = (unsigned char *) newset;
-   
-   for (i = 0; i < num; ++i)
-   {
-      if (oldset[i] == state)
-      {
-         XFree(old_data);
-         free(data);
-         return;
-      }
-      
-      newset[i] = oldset[i];
-   }
-   
-   newset[num] = state;
-   
-   ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_STATE,
-                                    XA_ATOM, 32, data, num + 1);
-   XFree(old_data);
-   free(data);
-}
-
-/**
- * Check if a state is set for a window.
- * @param win The window to be checked
- * @param s The state whose state will be checked
- * @return 1 if the state has been set for this window, 0 otherwise.
- *
- * This function will look up the window's properties to determine
- * if a particular state is set for that window.
- */
-int
-ecore_x_window_prop_state_isset(Ecore_X_Window win, Ecore_X_Window_State s)
-{
-   int            num, i, ret = 0;
-   unsigned char  *data;
-   Atom           *states;
-   Ecore_X_Atom   state;
-
-   state = _ecore_x_window_prop_state_atom_get(s);
-   if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_STATE,
-                                         XA_ATOM, 32, &data, &num))
-      return ret;
-
-   states = (Atom *) data;
-
-   for (i = 0; i < num; ++i)
-   {
-      if(states[i] == state)
-      {
-         ret = 1;
-         break;
-      }
-   }
-
-   XFree(data);
-   return ret;
-}
-
-/**
- * Remove the specified state from a window.
- * @param win The window whose properties will be changed
- * @param s The state to be deleted from the window's properties
- *
- * Checks if the specified state is set for the window, and if so, deletes
- * that state from the window's properties.
- */
-void
-ecore_x_window_prop_state_unset(Ecore_X_Window win, Ecore_X_Window_State s)
-{
-   int            num = 0, i, j = 0;
-   unsigned char  *old_data = NULL;
-   unsigned char  *data = NULL;
-   Atom           *oldset = NULL;
-   Atom           *newset = NULL;
-   Ecore_X_Atom   state ;
-   
-   state = _ecore_x_window_prop_state_atom_get(s);
-
-   if (!ecore_x_window_prop_state_isset(win, s)) {
-      return;
-   }
-   
-   ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_STATE,
-                                    XA_ATOM, 32, &old_data, &num);
-   oldset = (Atom *) old_data;
-   newset = calloc(num - 1, sizeof(Atom));
-   data = (unsigned char *) newset;
-   for (i = 0; i < num; ++i)
-      if (oldset[i] != state)
-         newset[j++] = oldset[i];
-
-   ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_STATE,
-                                    XA_ATOM, 32, data, j);
-   XFree(oldset);
-   free(newset);
-}
-
-#if 0
-void
-ecore_x_window_prop_window_type_utility_set(Ecore_X_Window win)
-{
-   ecore_x_window_prop_window_type_set(win, 
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY);
-}
-
-/**
- * Set a window as a splash type.
- * @param win The Window
- *
- * Set a window as a splash type.
- */
-void
-ecore_x_window_prop_window_type_splash_set(Ecore_X_Window win)
-{
-   ecore_x_window_prop_window_type_set(win, 
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH);
-}
-
-/**
- * Set a window as a dialog type.
- * @param win The Window
- *
- * Set a window as a dialog type.
- */
-void
-ecore_x_window_prop_window_type_dialog_set(Ecore_X_Window win)
-{
-   ecore_x_window_prop_window_type_set(win, 
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG);
-}
-
-/**
- * Set a window as a normal type.
- * @param win The Window
- *
- * Set a window as a normal type.
- */
-void
-ecore_x_window_prop_window_type_normal_set(Ecore_X_Window win)
-{
-   ecore_x_window_prop_window_type_set(win, 
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL);
-}
-
-#endif
-
-/**
- * Set the requested opacity of the window
- * @param win The window whose opacity will be set
- * @param opacity The opacity value to be applied to the window
- * 
- * This only has an effect if the Composite extension is present and
- * a compositing manager is running. This hint is still pending approval
- * as part of the EWMH specification. The value supplied should be an
- * integer between 0 and 255, with 255 representing full opacity.
- */
-void
-ecore_x_window_prop_window_opacity_set(Ecore_X_Window win, int opacity)
-{
-   unsigned long o_val;
-   double tmp;
-
-   if (opacity < 0)
-      opacity = 0;
-   else if (opacity > 255)
-      opacity = 255;
-
-   tmp = (double) opacity/255. * 4294967295.;
-   o_val = (unsigned long) tmp;
-   ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
-                                    XA_CARDINAL, 32, &o_val, 1);
-}
-
-/**
- * Get the current opacity value of the window
- * @param win The window whose opacity is being requested
- * @return An int between 0 and 255 representing the window's opacity value,
- * or -1 if the property is not found.
- */
-int
-ecore_x_window_prop_window_opacity_get(Ecore_X_Window win)
-{
-   unsigned char  *data = NULL;
-   unsigned long  lval;
-   int            ret_val = -1;
-   int            num;
-
-   if(ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
-                                       XA_CARDINAL, 32, &data, &num))
-   {
-      if (data && num)
-      {
-         lval = *(unsigned long *) data;
-         ret_val = (int) ((double) lval / 4294967295. * 255.);
-      }
-   }
-   
-   return ret_val;
-}
-
-Ecore_X_Atom *
-ecore_x_window_prop_list(Ecore_X_Window win, int *num_ret)
-{
-   Ecore_X_Atom *atoms;
-   Atom *atom_ret;
-   int num = 0, i;
-       
-   if (num_ret) *num_ret = 0;
-
-   atom_ret = XListProperties(_ecore_x_disp, win, &num);
-   if (!atom_ret) return NULL;
-
-   atoms = malloc(num * sizeof(Ecore_X_Atom));
-   if (atoms)
-     {
-       for (i = 0; i < num; i++) atoms[i] = atom_ret[i];
-       if (num_ret) *num_ret = num;
-     }
-   XFree(atom_ret);
-   return atoms;
-}




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to