Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

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


Modified Files:
        Ecore_X.h ecore_x.c ecore_x_window.c 


Log Message:


aaaahmmm.. no.. this.. oops

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -3 -r1.109 -r1.110
--- Ecore_X.h   23 Apr 2005 05:06:18 -0000      1.109
+++ Ecore_X.h   25 Apr 2005 08:40:56 -0000      1.110
@@ -1242,7 +1242,11 @@
                                     int mod, int any_mod);
 EAPI void ecore_x_window_button_ungrab(Ecore_X_Window win, int button,
                                       int mod, int any_mod);
-
+EAPI void ecore_x_window_key_grab(Ecore_X_Window win, char *key,
+                                 int mod, int any_mod);
+EAPI void ecore_x_window_key_ungrab(Ecore_X_Window win, char *key,
+                                   int mod, int any_mod);
+       
 EAPI void ecore_x_focus_reset(void);
 EAPI void ecore_x_events_allow_all(void);
 EAPI void ecore_x_pointer_last_xy_get(int *x, int *y);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -3 -r1.71 -r1.72
--- ecore_x.c   22 Apr 2005 08:46:05 -0000      1.71
+++ ecore_x.c   25 Apr 2005 08:40:57 -0000      1.72
@@ -1395,6 +1395,70 @@
                                 _ecore_window_grabs_num * sizeof(Window));
 }
 
+int      _ecore_key_grabs_num = 0;
+Window  *_ecore_key_grabs = NULL;
+
+void
+ecore_x_window_key_grab(Ecore_X_Window win, char *key, 
+                       int mod, int any_mod)
+{
+   KeyCode             keycode;
+   unsigned int        m;
+   unsigned int        locks[8];
+   int                 i;
+   
+   keycode  = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key));
+   m = mod;
+   if (any_mod) m = AnyModifier;
+   locks[0] = 0;
+   locks[1] = ECORE_X_LOCK_CAPS;
+   locks[2] = ECORE_X_LOCK_NUM;
+   locks[3] = ECORE_X_LOCK_SCROLL;
+   locks[4] = ECORE_X_LOCK_CAPS   | ECORE_X_LOCK_NUM;
+   locks[5] = ECORE_X_LOCK_CAPS   | ECORE_X_LOCK_SCROLL;
+   locks[6] = ECORE_X_LOCK_NUM    | ECORE_X_LOCK_SCROLL;
+   locks[7] = ECORE_X_LOCK_CAPS   | ECORE_X_LOCK_NUM    | ECORE_X_LOCK_SCROLL;
+   for (i = 0; i < 8; i++)
+     XGrabKey(_ecore_x_disp, keycode, m | locks[i],
+             win, False, GrabModeSync, GrabModeAsync);
+   _ecore_key_grabs_num++;
+   _ecore_key_grabs = realloc(_ecore_key_grabs,
+                             _ecore_key_grabs_num * sizeof(Window));
+   _ecore_key_grabs[_ecore_key_grabs_num - 1] = win;
+}
+
+void
+ecore_x_window_key_ungrab(Ecore_X_Window win, char *key,
+                         int mod, int any_mod)
+{
+   KeyCode             keycode;
+   unsigned int        m;
+   unsigned int        locks[8];
+   int                 i, shuffle = 0;
+
+   keycode  = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key));
+   m = mod;
+   if (any_mod) m = AnyModifier;
+   locks[0] = 0;
+   locks[1] = ECORE_X_LOCK_CAPS;
+   locks[2] = ECORE_X_LOCK_NUM;
+   locks[3] = ECORE_X_LOCK_SCROLL;
+   locks[4] = ECORE_X_LOCK_CAPS   | ECORE_X_LOCK_NUM;
+   locks[5] = ECORE_X_LOCK_CAPS   | ECORE_X_LOCK_SCROLL;
+   locks[6] = ECORE_X_LOCK_NUM    | ECORE_X_LOCK_SCROLL;
+   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);
+   for (i = 0; i < _ecore_key_grabs_num - 1; i++)
+     {
+       if (_ecore_key_grabs[i] == win) shuffle = 1;
+       if (shuffle) _ecore_key_grabs[i] = _ecore_key_grabs[i + 1];
+     }
+   _ecore_key_grabs_num--;
+   _ecore_key_grabs = realloc(_ecore_key_grabs, 
+                                _ecore_key_grabs_num * sizeof(Window));
+}
+
 /**
  * Send client message with given type and format 32.
  *
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ecore_x_window.c    25 Apr 2005 08:26:48 -0000      1.37
+++ ecore_x_window.c    25 Apr 2005 08:40:58 -0000      1.38
@@ -37,7 +37,7 @@
    attr.border_pixel          = 0;
    attr.background_pixmap     = None;
    attr.save_under            = False;
-   attr.do_not_propagate_mask = ~NoEventMask;
+   attr.do_not_propagate_mask = NoEventMask;
    attr.event_mask            = KeyPressMask |
                                 KeyReleaseMask |
                                 ButtonPressMask |
@@ -94,7 +94,7 @@
    attr.border_pixel          = 0;
    attr.background_pixmap     = None;
    attr.save_under            = False;
-   attr.do_not_propagate_mask = ~NoEventMask;
+   attr.do_not_propagate_mask = NoEventMask;
    attr.event_mask            = KeyPressMask |
                                 KeyReleaseMask |
                                 ButtonPressMask |
@@ -146,7 +146,7 @@
    
    if (parent == 0) parent = DefaultRootWindow(_ecore_x_disp);
    attr.override_redirect     = True;
-   attr.do_not_propagate_mask = ~NoEventMask;
+   attr.do_not_propagate_mask = NoEventMask;
    attr.event_mask            = KeyPressMask |
                                 KeyReleaseMask |
                                 ButtonPressMask |




-------------------------------------------------------
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