Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

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


Modified Files:
        ecore_x.c ecore_x_events.c ecore_x_private.h 


Log Message:


remove random lockups in click to focus and sometimes pointer focus - lets
have this tested for a while...

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -3 -r1.90 -r1.91
--- ecore_x.c   12 Jul 2005 13:54:39 -0000      1.90
+++ ecore_x.c   12 Jul 2005 15:27:45 -0000      1.91
@@ -32,6 +32,8 @@
 int      _ecore_x_event_last_root_y = 0;
 int      _ecore_x_xcursor = 0;
 
+Ecore_X_Window _ecore_x_private_win = 0;
+
 /* FIXME - These are duplicates after making ecore atoms public */
 Ecore_X_Atom     ECORE_X_ATOM_FILE_NAME = 0;
 Ecore_X_Atom     ECORE_X_ATOM_STRING = 0;
@@ -418,6 +420,9 @@
    _ecore_x_dnd_init();
    
    _ecore_x_init_count++;
+   
+   _ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456);
+   
    return _ecore_x_init_count;
 }
 
@@ -1420,13 +1425,53 @@
 }
 
 void
+_ecore_x_sync_magic_send(int val, Ecore_X_Window swin)
+{
+   XEvent xev;
+   
+   xev.xclient.type = ClientMessage;
+   xev.xclient.serial = 0;
+   xev.xclient.send_event = True;
+   xev.xclient.display = _ecore_x_disp;
+   xev.xclient.window = _ecore_x_private_win;
+   xev.xclient.format = 32;
+   xev.xclient.message_type = 27777;
+   xev.xclient.data.l[0] = 0x7162534;
+   xev.xclient.data.l[1] = 0x10000000 + val;
+   xev.xclient.data.l[2] = swin;
+   XSendEvent(_ecore_x_disp, _ecore_x_private_win, False, NoEventMask, &xev);
+}
+
+void
+_ecore_x_window_grab_remove(Ecore_X_Window win)
+{
+   int i, shuffle = 0;
+   
+   if (_ecore_window_grabs_num > 0)
+     {
+       for (i = 0; i < _ecore_window_grabs_num; i++)
+         {
+            if (shuffle) _ecore_window_grabs[i - 1] = _ecore_window_grabs[i];
+            if ((!shuffle) && (_ecore_window_grabs[i] == win))
+              shuffle = 1;
+         }
+       if (shuffle)
+         {
+            _ecore_window_grabs_num--;
+            _ecore_window_grabs = realloc(_ecore_window_grabs, 
+                                          _ecore_window_grabs_num * 
sizeof(Window));
+         }
+     }
+}
+
+void
 ecore_x_window_button_ungrab(Ecore_X_Window win, int button, 
                             int mod, int any_mod)
 {
    unsigned int        b;
    unsigned int        m;
    unsigned int        locks[8];
-   int                 i, shuffle = 0;
+   int                 i;
    
    b = button;
    if (b == 0) b = AnyButton;
@@ -1442,21 +1487,7 @@
    locks[7] = ECORE_X_LOCK_CAPS   | ECORE_X_LOCK_NUM    | ECORE_X_LOCK_SCROLL;
    for (i = 0; i < 8; i++)
      XUngrabButton(_ecore_x_disp, b, m | locks[i], win);
-   if (_ecore_window_grabs_num > 0)
-     {
-       for (i = 0; i < (_ecore_window_grabs_num - 1); i++)
-         {
-            if (shuffle) _ecore_window_grabs[i] = _ecore_window_grabs[i + 1];
-            if ((!shuffle) && (_ecore_window_grabs[i] == win))
-              shuffle = 1;
-         }
-       if (shuffle)
-         {
-            _ecore_window_grabs_num--;
-            _ecore_window_grabs = realloc(_ecore_window_grabs, 
-                                          _ecore_window_grabs_num * 
sizeof(Window));
-         }
-     }
+   _ecore_x_sync_magic_send(1, win);
 }
 
 int      _ecore_key_grabs_num = 0;
@@ -1502,6 +1533,28 @@
 }
 
 void
+_ecore_x_key_grab_remove(Ecore_X_Window win)
+{
+   int i, shuffle = 0;
+   
+   if (_ecore_key_grabs_num > 0)
+     {
+       for (i = 0; i < _ecore_key_grabs_num; i++)
+         {
+            if (shuffle) _ecore_key_grabs[i - 1] = _ecore_key_grabs[i];
+            if ((!shuffle) && (_ecore_key_grabs[i] == win))
+              shuffle = 1;
+         }
+       if (shuffle)
+         {
+            _ecore_key_grabs_num--;
+            _ecore_key_grabs = realloc(_ecore_key_grabs, 
+                                       _ecore_key_grabs_num * sizeof(Window));
+         }
+     }
+}
+
+void
 ecore_x_window_key_ungrab(Ecore_X_Window win, char *key,
                          int mod, int any_mod)
 {
@@ -1509,7 +1562,7 @@
    KeySym              keysym;
    unsigned int        m;
    unsigned int        locks[8];
-   int                 i, shuffle = 0;
+   int                 i;
 
    if (!strncmp(key, "Keycode-", 8))
      keycode = atoi(key + 8);
@@ -1533,21 +1586,7 @@
    locks[7] = ECORE_X_LOCK_CAPS   | ECORE_X_LOCK_NUM    | ECORE_X_LOCK_SCROLL;
    for (i = 0; i < 8; i++)
      XUngrabKey(_ecore_x_disp, keycode, m | locks[i], win);
-   if (_ecore_key_grabs_num > 0)
-     {
-       for (i = 0; i < (_ecore_key_grabs_num - 1); i++)
-         {
-            if (shuffle) _ecore_key_grabs[i] = _ecore_key_grabs[i + 1];
-            if ((!shuffle) && (_ecore_key_grabs[i] == win))
-              shuffle = 1;
-         }
-       if (shuffle)
-         {
-            _ecore_key_grabs_num--;
-            _ecore_key_grabs = realloc(_ecore_key_grabs, 
-                                       _ecore_key_grabs_num * sizeof(Window));
-         }
-     }
+   _ecore_x_sync_magic_send(2, win);
 }
 
 /**
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_events.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- ecore_x_events.c    10 Jul 2005 09:42:19 -0000      1.67
+++ ecore_x_events.c    12 Jul 2005 15:27:46 -0000      1.68
@@ -1488,6 +1488,17 @@
 
        ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL);
      }
+   else if ((xevent->xclient.message_type == 27777)
+           && (xevent->xclient.data.l[0] == 0x7162534)
+           && (xevent->xclient.format == 32)
+           && (xevent->xclient.window == _ecore_x_private_win))
+     {
+       /* a grab sync marker */
+       if (xevent->xclient.data.l[1] == 0x10000001)
+         _ecore_x_window_grab_remove(xevent->xclient.data.l[2]);
+       else if (xevent->xclient.data.l[1] == 0x10000002)
+         _ecore_x_key_grab_remove(xevent->xclient.data.l[2]);
+     }
    else
      {
        Ecore_X_Event_Client_Message *e;
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_private.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- ecore_x_private.h   6 Jun 2005 09:40:00 -0000       1.45
+++ ecore_x_private.h   12 Jul 2005 15:27:46 -0000      1.46
@@ -141,6 +141,8 @@
 extern int    (*_ecore_window_grab_replay_func) (void *data, int event_type, 
void *event);
 extern void    *_ecore_window_grab_replay_data;
 
+extern Ecore_X_Window _ecore_x_private_win;
+
 void _ecore_x_error_handler_init(void);
 void _ecore_x_event_handle_key_press(XEvent *xevent);
 void _ecore_x_event_handle_key_release(XEvent *xevent);
@@ -189,6 +191,10 @@
 int   _ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, 
void **data_ret);
 void *_ecore_x_selection_parse(const char *target, unsigned char *data, int 
size);
 
+void _ecore_x_sync_magic_send(int val, Ecore_X_Window swin);
+void _ecore_x_window_grab_remove(Ecore_X_Window win);
+void _ecore_x_key_grab_remove(Ecore_X_Window win);
+
 /* from dnd */
 void _ecore_x_dnd_init(void);
 Ecore_X_DND_Source *_ecore_x_dnd_source_get(void);




-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to