Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h aclass.c borders.c buttons.c desktops.c events.c ewins.c 
        grabs.c menus.c warp.c 


Log Message:
Action/grab tweaks, cleanups (should fix focus list lockup).
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.458
retrieving revision 1.459
diff -u -3 -r1.458 -r1.459
--- E.h 30 Jun 2005 12:09:33 -0000      1.458
+++ E.h 30 Jun 2005 12:37:24 -0000      1.459
@@ -1078,7 +1078,6 @@
    char                nogroup;
    char                keybinds_changed;
    Window              button_proxy_win;
-   const XEvent       *current_event;
    Time                last_time;
    Window              last_bpress;
    unsigned int        last_button;
@@ -1147,12 +1146,15 @@
 const char         *ActionclassGetTooltipString(ActionClass * ac);
 int                 ActionclassGetActionCount(ActionClass * ac);
 Action             *ActionclassGetAction(ActionClass * ac, int ix);
+int                 ActionclassEvent(ActionClass * ac, XEvent * ev,
+                                    EWin * ewin);
+int                 ActionclassesEvent(XEvent * ev, EWin * ewin);
+
 const char         *ActionGetTooltipString(Action * aa);
 int                 ActionGetAnybutton(Action * aa);
 int                 ActionGetEvent(Action * aa);
 int                 ActionGetButton(Action * aa);
 int                 ActionGetModifiers(Action * aa);
-int                 EventAclass(XEvent * ev, EWin * ewin, ActionClass * a);
 
 void                GrabButtonGrabs(EWin * ewin);
 void                UnGrabButtonGrabs(EWin * ewin);
@@ -1781,7 +1783,8 @@
 #endif
 
 /* grabs.c */
-void                GrabButtonsSet(Window win, unsigned int csr);
+int                 GrabKeyboardSet(Window win);
+int                 GrabKeyboardRelease(void);
 int                 GrabPointerSet(Window win, unsigned int csr, int confine);
 void                GrabPointerRelease(void);
 void                GrabButtonSet(unsigned int button, unsigned int modifiers,
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/aclass.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- aclass.c    9 Jun 2005 18:28:10 -0000       1.14
+++ aclass.c    30 Jun 2005 12:37:25 -0000      1.15
@@ -835,7 +835,7 @@
 }
 
 int
-EventAclass(XEvent * ev, EWin * ewin, ActionClass * ac)
+ActionclassEvent(ActionClass * ac, XEvent * ev, EWin * ewin)
 {
    KeyCode             key;
    int                 i, type, button, modifiers, ok, mouse, mask, val = 0;
@@ -970,6 +970,25 @@
    return val;
 }
 
+int
+ActionclassesEvent(XEvent * ev, EWin * ewin)
+{
+   ActionClass       **lst;
+   int                 i, num, match;
+
+   lst = (ActionClass **) ListItemType(&num, LIST_TYPE_ACLASS_GLOBAL);
+   if (!lst)
+      return 0;
+
+   match = 0;
+   for (i = 0; i < num; i++)
+      match |= ActionclassEvent(lst[i], ev, ewin);
+
+   Efree(lst);
+
+   return match;
+}
+
 static void
 AclassSetupFallback(void)
 {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.264
retrieving revision 1.265
diff -u -3 -r1.264 -r1.265
--- borders.c   12 Jun 2005 13:09:11 -0000      1.264
+++ borders.c   30 Jun 2005 12:37:25 -0000      1.265
@@ -863,7 +863,7 @@
    FocusHandleClick(ewin, wbit->win);
 
    if (ewin->border->part[part].aclass)
-      EventAclass(ev, ewin, ewin->border->part[part].aclass);
+      ActionclassEvent(ewin->border->part[part].aclass, ev, ewin);
 }
 
 static void
@@ -885,7 +885,7 @@
 
    if (wbit->win == Mode.last_bpress && !wbit->left &&
        ewin->border->part[part].aclass)
-      EventAclass(ev, ewin, ewin->border->part[part].aclass);
+      ActionclassEvent(ewin->border->part[part].aclass, ev, ewin);
 
    wbit->left = 0;
 }
@@ -908,7 +908,7 @@
        wbit->state = STATE_HILITED;
        BorderWinpartChange(ewin, part, 0);
        if (ewin->border->part[part].aclass)
-          EventAclass(ev, ewin, ewin->border->part[part].aclass);
+          ActionclassEvent(ewin->border->part[part].aclass, ev, ewin);
      }
 }
 
@@ -928,7 +928,7 @@
        wbit->state = STATE_NORMAL;
        BorderWinpartChange(ewin, part, 0);
        if (ewin->border->part[part].aclass)
-          EventAclass(ev, ewin, ewin->border->part[part].aclass);
+          ActionclassEvent(ewin->border->part[part].aclass, ev, ewin);
      }
 }
 
@@ -942,7 +942,7 @@
      case EnterNotify:
      case LeaveNotify:
        if (ewin->border->aclass)
-          EventAclass(ev, ewin, ewin->border->aclass);
+          ActionclassEvent(ewin->border->aclass, ev, ewin);
        break;
      }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/buttons.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -3 -r1.66 -r1.67
--- buttons.c   12 Jun 2005 07:56:30 -0000      1.66
+++ buttons.c   30 Jun 2005 12:37:25 -0000      1.67
@@ -64,6 +64,7 @@
    Button             *button;
    char                loading_user;
    char                move_pending;
+   char                action_inhibit;
 } Mode_buttons;
 
 static void         ButtonHandleEvents(XEvent * ev, void *btn);
@@ -440,10 +441,11 @@
 void
 ButtonDoAction(Button * b, EWin * ewin, XEvent * ev)
 {
-   if (b->aclass)
-      EventAclass(ev, ewin, b->aclass);
+   if (b->aclass && !Mode_buttons.action_inhibit)
+      ActionclassEvent(b->aclass, ev, ewin);
 }
 
+#if 1                          /* Unused */
 int
 ButtonEmbedWindow(Button * b, Window WindowToEmbed)
 {
@@ -466,6 +468,7 @@
 
    return 0;
 }
+#endif
 
 static void
 ButtonDragStart(Button * b)
@@ -558,12 +561,12 @@
      {
        ac = FindItem("ACTION_BUTTON_DRAG", 0, LIST_FINDBY_NAME,
                      LIST_TYPE_ACLASS);
-       if (ac)
-          EventAclass(ev, NULL, ac);
+       if (ac && !Mode_buttons.action_inhibit)
+          ActionclassEvent(ac, ev, NULL);
      }
 
-   if (b->aclass)
-      EventAclass(ev, NULL, b->aclass);
+   if (b->aclass && !Mode_buttons.action_inhibit)
+      ActionclassEvent(b->aclass, ev, NULL);
 }
 
 static void
@@ -571,7 +574,7 @@
 {
    Window              win = ev->xbutton.window;
 
-   if (b->inside_win && !Mode.action_inhibit)
+   if (b->inside_win && !Mode_buttons.action_inhibit)
      {
        ev->xbutton.window = b->inside_win;
        XSendEvent(disp, b->inside_win, False, ButtonReleaseMask, ev);
@@ -588,8 +591,8 @@
    GrabPointerRelease();
 #endif
 
-   if (b->aclass && !b->left)
-      EventAclass(ev, NULL, b->aclass);
+   if (b->aclass && !b->left && !Mode_buttons.action_inhibit)
+      ActionclassEvent(b->aclass, ev, NULL);
 
    b->left = 0;
 
@@ -600,6 +603,7 @@
 #if 0                          /* FIXME - Move? */
    GrabPointerRelease();
 #endif
+   Mode_buttons.action_inhibit = 0;
 }
 
 static void
@@ -626,7 +630,7 @@
        if ((x > Conf.button_move_resistance) ||
            (y > Conf.button_move_resistance))
           Mode_buttons.move_pending = 0;
-       Mode.action_inhibit = 1;
+       Mode_buttons.action_inhibit = 1;
      }
    if (!Mode_buttons.move_pending)
      {
@@ -653,8 +657,8 @@
      {
        b->state = STATE_HILITED;
        ButtonDraw(b);
-       if (b->aclass)
-          EventAclass(ev, NULL, b->aclass);
+       if (b->aclass && !Mode_buttons.action_inhibit)
+          ActionclassEvent(b->aclass, ev, NULL);
      }
 }
 
@@ -667,8 +671,8 @@
      {
        b->state = STATE_NORMAL;
        ButtonDraw(b);
-       if (b->aclass)
-          EventAclass(ev, NULL, b->aclass);
+       if (b->aclass && !Mode_buttons.action_inhibit)
+          ActionclassEvent(b->aclass, ev, NULL);
      }
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -3 -r1.152 -r1.153
--- desktops.c  16 Jun 2005 20:31:37 -0000      1.152
+++ desktops.c  30 Jun 2005 12:37:25 -0000      1.153
@@ -1399,7 +1399,7 @@
    ac = FindItem("DESKBINDINGS", 0, LIST_FINDBY_NAME, LIST_TYPE_ACLASS);
    if (ac)
      {
-       if (!EventAclass(ev, NULL, ac))
+       if (!ActionclassEvent(ac, ev, NULL))
           ButtonProxySendEvent(ev);
      }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -3 -r1.93 -r1.94
--- events.c    14 Jun 2005 22:52:24 -0000      1.93
+++ events.c    30 Jun 2005 12:37:26 -0000      1.94
@@ -156,14 +156,10 @@
 static void
 HandleEvent(XEvent * ev)
 {
-   void              **lst;
-   int                 i, num;
-
 #if ENABLE_DEBUG_EVENTS
    if (EventDebug(ev->type))
       EventShow(ev);
 #endif
-   Mode.current_event = ev;
 
    switch (ev->type)
      {
@@ -171,6 +167,17 @@
        Mode.last_keycode = ev->xkey.keycode;
      case KeyRelease:
        ModeGetXY(ev->xbutton.root, ev->xkey.x_root, ev->xkey.y_root);
+#if 0                          /* FIXME - Why? */
+       if (ev->xkey.root != VRoot.win)
+         {
+            XSetInputFocus(disp, ev->xkey.root, RevertToPointerRoot,
+                           CurrentTime);
+            ESync();
+            ev->xkey.time = CurrentTime;
+            XSendEvent(disp, ev->xkey.root, False, 0, ev);
+            return;
+         }
+#endif
        goto do_stuff;
      case ButtonPress:
      case ButtonRelease:
@@ -197,28 +204,7 @@
 
       do_stuff:
        TooltipsHandleEvent();  /* TBD */
-
-#if 0                          /* FIXME - Why? */
-       if (((ev->type == KeyPress) || (ev->type == KeyRelease))
-           && (ev->xkey.root != VRoot.win))
-         {
-            XSetInputFocus(disp, ev->xkey.root, RevertToPointerRoot,
-                           CurrentTime);
-            ESync();
-            ev->xkey.time = CurrentTime;
-            XSendEvent(disp, ev->xkey.root, False, 0, ev);
-         }
-       else
-#endif
-         {
-            lst = ListItemType(&num, LIST_TYPE_ACLASS_GLOBAL);
-            if (lst)
-              {
-                 for (i = 0; i < num; i++)
-                    EventAclass(ev, GetFocusEwin(), (ActionClass *) lst[i]);
-                 Efree(lst);
-              }
-         }
+       ActionclassesEvent(ev, GetFocusEwin());
        break;
      }
 
@@ -229,6 +215,7 @@
        /* Unfreeze keyboard in case we got here by keygrab */
        XAllowEvents(disp, AsyncKeyboard, CurrentTime);
        break;
+
      case ButtonPress:         /*  4 */
        SoundPlay("SOUND_BUTTON_CLICK");
 
@@ -245,20 +232,9 @@
        break;
      case ButtonRelease:       /*  5 */
        SoundPlay("SOUND_BUTTON_RAISE");
-
-#if 0                          /* FIXME - TBD */
-       /* DON'T handle clicks whilst moving/resizing things */
-       if ((Mode.mode != MODE_NONE) &&
-           (!((Mode.place) &&
-              (Mode.mode == MODE_MOVE_PENDING || Mode.mode == MODE_MOVE))))
-         {
-            if ((int)Mode.last_button != (int)ev->xbutton.button)
-               return;
-         }
-#endif
-
        ActionsEnd(NULL);
        break;
+
      case MotionNotify:        /*  6 */
        TooltipsHandleEvent();  /* TBD */
 
@@ -267,15 +243,7 @@
        ModeGetXY(ev->xmotion.root, ev->xmotion.x_root, ev->xmotion.y_root);
 
        DesksSetCurrent(DesktopAt(Mode.x, Mode.y));
-#if 0                          /* FIXME - TBD */
-       if ((!(ev->xmotion.state
-              & (Button1Mask | Button2Mask | Button3Mask | Button4Mask |
-                 Button5Mask)) && (!Mode.place)))
-         {
-            if (ActionsEnd(NULL))
-               return;
-         }
-#endif
+
        ActionsHandleMotion();
        break;
      case EnterNotify:         /*  7 */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -3 -r1.78 -r1.79
--- ewins.c     30 Jun 2005 12:09:34 -0000      1.78
+++ ewins.c     30 Jun 2005 12:37:27 -0000      1.79
@@ -1693,7 +1693,7 @@
    else if (ev->type == ButtonRelease)
       GrabPointerRelease();
 
-   return EventAclass(ev, ewin, ac);
+   return ActionclassEvent(ac, ev, ewin);
 }
 
 #define DEBUG_EWIN_EVENTS 0
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/grabs.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- grabs.c     19 Mar 2005 16:40:02 -0000      1.23
+++ grabs.c     30 Jun 2005 12:37:27 -0000      1.24
@@ -23,20 +23,32 @@
  */
 #include "E.h"
 
-#if 0                          /* Unused */
-void
-GrabButtonsSet(Window win, unsigned int csr)
+int
+GrabKeyboardSet(Window win)
 {
-   if (Mode.grabs.pointer_grab_active)
-      return;
+   int                 rc;
 
-   XGrabPointer(disp, win, True, ButtonPressMask | ButtonReleaseMask,
-               GrabModeAsync, GrabModeAsync, None, ECsrGet(csr), CurrentTime);
+   rc = XGrabKeyboard(disp, win, False, GrabModeAsync, GrabModeAsync,
+                     CurrentTime);
 
-   Mode.grabs.pointer_grab_window = win;
-   Mode.grabs.pointer_grab_active = 1;
+#if 0
+   Eprintf("GrabKeyboardSet %#lx %d\n", win, rc);
+#endif
+   return rc;
 }
+
+int
+GrabKeyboardRelease(void)
+{
+   int                 rc;
+
+   rc = XUngrabKeyboard(disp, CurrentTime);
+
+#if 0
+   Eprintf("GrabKeyboardRelease %d\n", rc);
 #endif
+   return rc;
+}
 
 int
 GrabPointerSet(Window win, unsigned int csr, int confine)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -3 -r1.200 -r1.201
--- menus.c     9 Jun 2005 18:28:13 -0000       1.200
+++ menus.c     30 Jun 2005 12:37:27 -0000      1.201
@@ -111,29 +111,6 @@
 static Menu        *active_menu = NULL;
 static MenuItem    *active_item = NULL;
 
-static void
-GrabKeyboard(Window win)
-{
-   int                 rc;
-
-   rc = XGrabKeyboard(disp, win, False, GrabModeAsync, GrabModeAsync,
-                     CurrentTime);
-#if DEBUG_MENU_EVENTS
-   Eprintf("GrabKeyboard %#lx %d\n", win, rc);
-#endif
-}
-
-static void
-UngrabKeyboard(void)
-{
-   int                 rc;
-
-   rc = XUngrabKeyboard(disp, CurrentTime);
-#if DEBUG_MENU_EVENTS
-   Eprintf("UngrabKeyboard %d\n", rc);
-#endif
-}
-
 static Menu        *
 FindMenu(Window win)
 {
@@ -195,7 +172,7 @@
 {
    if ((Menu *) (ewin->data) == active_menu)
      {
-       UngrabKeyboard();
+       GrabKeyboardRelease();
        active_menu = NULL;
        active_item = NULL;
      }
@@ -377,7 +354,7 @@
        MenuShowMasker(m);
 #endif
        TooltipsEnable(0);
-       GrabKeyboard(m->win);
+       GrabKeyboardSet(m->win);
      }
    m->ref_count++;
 }
@@ -948,8 +925,8 @@
        if (active_menu != m)
          {
             active_menu = m;
-            UngrabKeyboard();
-            GrabKeyboard(m->win);
+            GrabKeyboardRelease();
+            GrabKeyboardSet(m->win);
          }
      }
 }
@@ -1140,7 +1117,7 @@
 
 #if 0
    /* If all done properly this shouldn't be necessary... */
-   UngrabKeyboard();
+   GrabKeyboardRelease();
    active_menu = NULL;
    active_item = NULL;
 #endif
@@ -1754,7 +1731,7 @@
      case ButtonRelease:
        break;
      case EnterNotify:
-       GrabKeyboard(m->win);
+       GrabKeyboardSet(m->win);
        break;
      }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/warp.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- warp.c      30 Jun 2005 12:03:38 -0000      1.67
+++ warp.c      30 Jun 2005 12:37:43 -0000      1.68
@@ -143,8 +143,8 @@
         * Grab the keyboard. The grab is automatically released when
         * WarpFocusHide unmaps warpFocusWindow.
         */
-       XGrabKeyboard(disp, warpFocusWindow->win, False, GrabModeAsync,
-                     GrabModeAsync, CurrentTime);
+       GrabKeyboardSet(warpFocusWindow->win);
+       GrabPointerSet(warpFocusWindow->win, None, 0);
      }
 
    for (i = 0; i < warplist_num; i++)




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to