Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

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


Modified Files:
      Tag: SPLIT
        Ecore_X.h ecore_x.c ecore_x_window_prop.c 


Log Message:


flush and sync... delete event/message handling... etc. clean clean

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Attic/Ecore_X.h,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -3 -r1.1.2.10 -r1.1.2.11
--- Ecore_X.h   4 Feb 2003 04:18:55 -0000       1.1.2.10
+++ Ecore_X.h   4 Feb 2003 09:15:51 -0000       1.1.2.11
@@ -332,6 +332,8 @@
 Display *ecore_x_display_get(void);
 void     ecore_x_double_click_time_set(double t);
 double   ecore_x_double_click_time_get(void);
+void     ecore_x_flush(void);
+void     ecore_x_sync(void);
        
 void ecore_x_error_handler_set(void (*func) (void *data), const void *data);
 int  ecore_x_error_request_get(void);
@@ -344,7 +346,8 @@
    
 void ecore_x_window_prop_title_set(Window win, const char *t);
 void ecore_x_window_prop_name_class_set(Window win, const char *n, const char *c);
-   
+void ecore_x_window_prop_delete_request_set(Window win, int on);
+       
 #ifdef __cplusplus
 }
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Attic/ecore_x.c,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -3 -r1.1.2.7 -r1.1.2.8
--- ecore_x.c   3 Feb 2003 12:55:31 -0000       1.1.2.7
+++ ecore_x.c   4 Feb 2003 09:15:51 -0000       1.1.2.8
@@ -152,6 +152,8 @@
        ECORE_EVENT_X_SELECTION_CLEAR          = ecore_event_type_new();
        ECORE_EVENT_X_SELECTION_REQUEST        = ecore_event_type_new();
        ECORE_EVENT_X_WINDOW_SHAPE             = ecore_event_type_new();
+       
+       ECORE_EVENT_X_WINDOW_DELETE_REQUEST    = ecore_event_type_new();
      }
    
    ECORE_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L);
@@ -238,6 +240,28 @@
 ecore_x_double_click_time_get(void)
 {
    return _ecore_x_double_click_time;
+}
+
+/**
+ * Flush the command buffer
+ * 
+ * This flushes the x command buffer
+ */
+void
+ecore_x_flush(void)
+{
+   XFlush(_ecore_x_disp);
+}
+
+/**
+ * Sync with the server
+ * 
+ * This flushes the command buffer and waits for a round trip from the server
+ */
+void
+ecore_x_sync(void)
+{
+   XSync(_ecore_x_disp, False);
 }
 
 static int
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Attic/ecore_x_window_prop.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- ecore_x_window_prop.c       4 Feb 2003 04:18:55 -0000       1.1.2.1
+++ ecore_x_window_prop.c       4 Feb 2003 09:15:52 -0000       1.1.2.2
@@ -35,3 +35,70 @@
    XSetClassHint(_ecore_x_disp, win, xch);
    XFree(xch);   
 }
+
+/**
+ * Set a window property to get message for close
+ * @param win
+ * @param on
+ * 
+ * Set a window porperty to let a window manager send a delete message instead
+ * of just closing (destroying) the window.
+ */
+void
+ecore_x_window_prop_delete_request_set(Window win, int on)
+{
+   Atom *protos = NULL;
+   int   protos_count = 0;
+   int   already_set = 0;
+   int   i;
+   
+   if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
+     {
+       protos = NULL;
+       protos_count = 0;
+     }
+   for (i = 0; i < protos_count; i++)
+     {
+       if (protos[i] == _ecore_x_atom_wm_delete_window)
+         {
+            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] = _ecore_x_atom_wm_delete_window;
+       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] == _ecore_x_atom_wm_delete_window)
+              {
+                 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;
+              }
+         }
+     }
+   leave:
+   if (protos) XFree(protos);
+}




-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to