Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h actions.c areas.c arrange.c borders.c comms.c desktops.c 
        events.c evhandlers.c ewmh.c focus.c iconify.c ipc.c pager.c 
        settings.c setup.c warp.c zoom.c 


Log Message:
Focus code name space cleanup.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -3 -r1.187 -r1.188
--- E.h 21 Jan 2004 22:14:10 -0000      1.187
+++ E.h 21 Jan 2004 23:32:44 -0000      1.188
@@ -453,9 +453,9 @@
 #define FLAG_FIXED_HORIZ        8
 #define FLAG_FIXED_VERT         16
 
-#define FOCUS_POINTER           0
-#define FOCUS_SLOPPY            1
-#define FOCUS_CLICK             2
+#define MODE_FOCUS_POINTER      0
+#define MODE_FOCUS_SLOPPY       1
+#define MODE_FOCUS_CLICK        2
 
 #define DOCK_LEFT               0
 #define DOCK_RIGHT              1
@@ -1852,19 +1852,29 @@
                                  int h, char firstlast);
 void                PropagateShapes(Window win);
 
-void                FlipFocusList(void);
-void                RemoveEwinFromFocusList(EWin * ewin);
-void                AddEwinToFocusList(EWin * ewin);
-void                GetNextFocusEwin(void);
-void                GetPrevFocusEwin(void);
-void                FixFocus(void);
-void                FocusToEWin(EWin * ewin);
-
-#if 0                          /* Clean up if OK -- Remove FocusToNone */
-void                FocusToNone(void);
-#endif
-void                BeginNewDeskFocus(void);
-void                NewDeskFocus(void);
+/* focus.c functions */
+#define FOCUS_SET        0
+#define FOCUS_NONE       1
+#define FOCUS_ENTER      2
+#define FOCUS_LEAVE      3
+#define FOCUS_EWIN_NEW   4
+#define FOCUS_EWIN_GONE  5
+#define FOCUS_DESK_ENTER 6
+#define FOCUS_DESK_LEAVE 7
+#define FOCUS_WARP       8
+#define FOCUS_CLICK      9
+
+void                FocusGetNextEwin(void);
+void                FocusGetPrevEwin(void);
+void                FocusEwinSetGrabs(EWin * ewin);
+void                FocusFix(void);
+void                FocusToEWin(EWin * ewin, int why);
+void                FocusHandleFocusIn(Window win);
+void                FocusHandleFocusOut(Window win);
+void                FocusHandleEnter(XEvent * ev);
+void                FocusHandleClick(Window win);
+void                FocusNewDeskBegin(void);
+void                FocusNewDesk(void);
 
 /* icccm.c functions */
 void                ICCCM_Init(void);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/actions.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -3 -r1.133 -r1.134
--- actions.c   21 Jan 2004 22:14:10 -0000      1.133
+++ actions.c   21 Jan 2004 23:32:44 -0000      1.134
@@ -1712,22 +1712,22 @@
    if (params)
      {
        if (!strcmp("pointer", (char *)params))
-          conf.focus.mode = FOCUS_POINTER;
+          conf.focus.mode = MODE_FOCUS_POINTER;
        else if (!strcmp("sloppy", (char *)params))
-          conf.focus.mode = FOCUS_SLOPPY;
+          conf.focus.mode = MODE_FOCUS_SLOPPY;
        else if (!strcmp("click", (char *)params))
-          conf.focus.mode = FOCUS_CLICK;
+          conf.focus.mode = MODE_FOCUS_CLICK;
      }
    else
      {
-       if (conf.focus.mode == FOCUS_POINTER)
-          conf.focus.mode = FOCUS_SLOPPY;
-       else if (conf.focus.mode == FOCUS_SLOPPY)
-          conf.focus.mode = FOCUS_CLICK;
-       else if (conf.focus.mode == FOCUS_CLICK)
-          conf.focus.mode = FOCUS_POINTER;
+       if (conf.focus.mode == MODE_FOCUS_POINTER)
+          conf.focus.mode = MODE_FOCUS_SLOPPY;
+       else if (conf.focus.mode == MODE_FOCUS_SLOPPY)
+          conf.focus.mode = MODE_FOCUS_CLICK;
+       else if (conf.focus.mode == MODE_FOCUS_CLICK)
+          conf.focus.mode = MODE_FOCUS_POINTER;
      }
-   FixFocus();
+   FocusFix();
    autosave();
    EDBUG_RETURN(0);
 }
@@ -2514,7 +2514,7 @@
 doFocusNext(EWin * edummy, void *params)
 {
    EDBUG(6, "doFocusNext");
-   GetNextFocusEwin();
+   FocusGetNextEwin();
    EDBUG_RETURN(0);
 }
 
@@ -2522,7 +2522,7 @@
 doFocusPrev(EWin * edummy, void *params)
 {
    EDBUG(6, "doFocusPrev");
-   GetPrevFocusEwin();
+   FocusGetPrevEwin();
    EDBUG_RETURN(0);
 }
 
@@ -2544,7 +2544,7 @@
       RaiseEwin(ewin);
    if (conf.focus.warp_on_next_focus)
       XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, ewin->w / 2, ewin->h / 2);
-   FocusToEWin(ewin);
+   FocusToEWin(ewin, FOCUS_SET);
 
    EDBUG_RETURN(0);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/areas.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- areas.c     19 Jan 2004 22:30:27 -0000      1.57
+++ areas.c     21 Jan 2004 23:32:44 -0000      1.58
@@ -275,7 +275,7 @@
 #if 0                          /* Clean up if not causing trouble */
    FocusToEWin(NULL);
 #endif
-   BeginNewDeskFocus();
+   FocusNewDeskBegin();
 
    /* move all the windows around */
    lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
@@ -432,7 +432,7 @@
    ActionsResume();
 
    /* re-focus on a new ewin on that new desktop area */
-   NewDeskFocus();
+   FocusNewDesk();
 
    /* tell the FX api abotu the change */
    FX_DeskChange();
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/arrange.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -3 -r1.61 -r1.62
--- arrange.c   19 Jan 2004 22:30:27 -0000      1.61
+++ arrange.c   21 Jan 2004 23:32:44 -0000      1.62
@@ -805,7 +805,7 @@
    ArrangeEwinCenteredXY(ewin, &ewin->x, &ewin->y);
    MoveEwin(ewin, ewin->x, ewin->y);
    if (focus)
-      FocusToEWin(ewin);
+      FocusToEWin(ewin, FOCUS_SET);
 
    EDBUG_RETURN_;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -3 -r1.126 -r1.127
--- borders.c   21 Jan 2004 22:14:10 -0000      1.126
+++ borders.c   21 Jan 2004 23:32:44 -0000      1.127
@@ -141,7 +141,7 @@
 }
 
 EWin               *
-GetEwinPointerInClient()
+GetEwinPointerInClient(void)
 {
    Window              rt, ch;
    int                 dum, px, py, d, i;
@@ -645,7 +645,7 @@
        RaiseEwin(ewin);
        ShowEwin(ewin);
        StackDesktops();
-       FocusToEWin(ewin);
+       FocusToEWin(ewin, FOCUS_EWIN_NEW);
        GrabThePointer(root.win);
        mode.have_place_grab = 1;
        mode.place = 1;
@@ -709,7 +709,7 @@
    DetermineEwinArea(ewin);
    if (conf.focus.all_new_windows_get_focus)
      {
-       FocusToEWin(ewin);
+       FocusToEWin(ewin, FOCUS_EWIN_NEW);
        if ((ewin->desktop != desks.current) && (!ewin->iconified))
          {
             GotoDesktop(ewin->desktop);
@@ -720,7 +720,7 @@
      {
        if (ewin->client.transient)
          {
-            FocusToEWin(ewin);
+            FocusToEWin(ewin, FOCUS_EWIN_NEW);
             if ((ewin->desktop != desks.current) && (!ewin->iconified))
               {
                  GotoDesktop(ewin->desktop);
@@ -735,7 +735,7 @@
                    LIST_TYPE_EWIN);
        if ((ewin2) && (mode.focuswin == ewin2))
          {
-            FocusToEWin(ewin);
+            FocusToEWin(ewin, FOCUS_EWIN_NEW);
             if ((ewin->desktop != desks.current) && (!ewin->iconified))
               {
                  GotoDesktop(ewin->desktop);
@@ -1381,7 +1381,7 @@
    XChangeWindowAttributes(disp, ewin->win_container,
                           CWEventMask | CWDontPropagate, &att);
    EMapWindow(disp, ewin->win_container);
-   if ((conf.focus.clickraises) || (conf.focus.mode == FOCUS_CLICK))
+   if ((conf.focus.clickraises) || (conf.focus.mode == MODE_FOCUS_CLICK))
       XGrabButton(disp, AnyButton, 0, ewin->win_container, False,
                  ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
    att.event_mask =
@@ -1441,7 +1441,7 @@
 #if 0                          /* Clean up if OK -- Remove FocusToNone */
        FocusToNone();
 #else
-       FocusToEWin(NULL);
+       FocusToEWin(NULL, FOCUS_EWIN_GONE);
 #endif
      }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/comms.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- comms.c     19 Jan 2004 22:30:28 -0000      1.43
+++ comms.c     21 Jan 2004 23:32:44 -0000      1.44
@@ -1478,7 +1478,7 @@
             InitDesktopControls();
             ShowDesktopControls();
          }
-       FixFocus();
+       FocusFix();
 
        GetAreaSize(&ax, &ay);
        GetCurrentArea(&a, &b);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -3 -r1.56 -r1.57
--- desktops.c  19 Jan 2004 22:30:29 -0000      1.56
+++ desktops.c  21 Jan 2004 23:32:44 -0000      1.57
@@ -1253,8 +1253,8 @@
 
    ActionsSuspend();
 
-   FocusToEWin(NULL);
-   BeginNewDeskFocus();
+   FocusToEWin(NULL, FOCUS_DESK_LEAVE);
+   FocusNewDeskBegin();
 
    if (mode.mode == MODE_NONE)
       mode.mode = MODE_DESKSWITCH;
@@ -1321,7 +1321,7 @@
    if (mode.mode == MODE_DESKSWITCH)
       mode.mode = MODE_NONE;
 
-   NewDeskFocus();
+   FocusNewDesk();
    RedrawPagersForDesktop(pdesk, 0);
    RedrawPagersForDesktop(num, 3);
    ForceUpdatePagersForDesktop(num);
@@ -1448,7 +1448,7 @@
    if ((num < 0) || (num >= conf.desks.numdesktops))
       EDBUG_RETURN_;
 
-   BeginNewDeskFocus();
+   FocusNewDeskBegin();
    CloneDesktop(deskorder[0]);
    desks.desk[num].viewable = 1;
    RefreshDesktop(num);
@@ -1464,7 +1464,7 @@
    StackDesktops();
    desks.current = num;
    MoveStickyWindowsToCurrentDesk();
-   NewDeskFocus();
+   FocusNewDesk();
    FX_DeskChange();
    RemoveClones();
    RedrawPagersForDesktop(num, 3);
@@ -1487,7 +1487,7 @@
    if ((num <= 0) || (num >= conf.desks.numdesktops))
       EDBUG_RETURN_;
 
-   BeginNewDeskFocus();
+   FocusNewDeskBegin();
    CloneDesktop(num);
    MoveToDeskBottom(num);
    UncoverDesktop(deskorder[0]);
@@ -1495,7 +1495,7 @@
    StackDesktops();
    desks.current = deskorder[0];
    MoveStickyWindowsToCurrentDesk();
-   NewDeskFocus();
+   FocusNewDesk();
    FX_DeskChange();
    RemoveClones();
    RedrawPagersForDesktop(deskorder[0], 3);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- events.c    19 Jan 2004 22:30:29 -0000      1.46
+++ events.c    21 Jan 2004 23:32:44 -0000      1.47
@@ -228,7 +228,7 @@
         */
        if (ev->xany.window == root.win)
          {
-            if (!mode.focuswin || FOCUS_POINTER == conf.focus.mode)
+            if (!mode.focuswin || conf.focus.mode == MODE_FOCUS_POINTER)
                HandleFocusWindow(root.focuswin);
          }
        else
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -3 -r1.142 -r1.143
--- evhandlers.c        19 Jan 2004 22:30:29 -0000      1.142
+++ evhandlers.c        21 Jan 2004 23:32:44 -0000      1.143
@@ -128,7 +128,7 @@
          {
             mode.focuswin->active = 0;
             DrawEwin(mode.focuswin);
-            if (conf.focus.mode == FOCUS_CLICK)
+            if (conf.focus.mode == MODE_FOCUS_CLICK)
                XGrabButton(disp, AnyButton, AnyModifier,
                            mode.focuswin->win_container, False,
                            ButtonPressMask, GrabModeSync, GrabModeAsync, None,
@@ -145,7 +145,7 @@
          {
             mode.focuswin->active = 1;
             DrawEwin(mode.focuswin);
-            if (conf.focus.mode == FOCUS_CLICK)
+            if (conf.focus.mode == MODE_FOCUS_CLICK)
               {
                  XUngrabButton(disp, AnyButton, AnyModifier,
                                mode.focuswin->win_container);
@@ -163,27 +163,27 @@
 
    EDBUG(5, "HandleFocusWindow");
    if (root.focuswin == win)
-      FocusToEWin(NULL);
+      FocusToEWin(NULL, FOCUS_SET);
    else
      {
        found_ewin = FindEwinByChildren(win);
        if (!found_ewin)
           found_ewin = FindEwinByBase(win);
-       if (conf.focus.mode == FOCUS_CLICK)
+       if (conf.focus.mode == MODE_FOCUS_CLICK)
           mode.mouse_over_win = found_ewin;
-       else if (conf.focus.mode == FOCUS_SLOPPY)
+       else if (conf.focus.mode == MODE_FOCUS_SLOPPY)
          {
             if (!found_ewin)
                ICCCM_Cmap(NULL);
             else if (!(found_ewin->focusclick))
-               FocusToEWin(found_ewin);
+               FocusToEWin(found_ewin, FOCUS_SET);
             mode.mouse_over_win = found_ewin;
          }
-       else if (conf.focus.mode == FOCUS_POINTER)
+       else if (conf.focus.mode == MODE_FOCUS_POINTER)
          {
             if (!found_ewin)
                found_ewin = GetEwinPointerInClient();
-            FocusToEWin(found_ewin);
+            FocusToEWin(found_ewin, FOCUS_SET);
             mode.mouse_over_win = found_ewin;
          }
      }
@@ -670,7 +670,7 @@
           SlideoutsHide();
 
        if (ewin == mode.focuswin)
-          FocusToEWin(NULL);
+          FocusToEWin(NULL, FOCUS_SET);
        if (ewin == mode.mouse_over_win)
           mode.mouse_over_win = NULL;
 
@@ -846,13 +846,13 @@
    if (MenusEventMouseDown(ev))
       goto exit;
 
-   if ((conf.focus.clickraises) || (conf.focus.mode == FOCUS_CLICK))
+   if ((conf.focus.clickraises) || (conf.focus.mode == MODE_FOCUS_CLICK))
      {
        ewin = FindEwinByChildren(win);
        if (!ewin)
           ewin = FindEwinByBase(win);
        if (ewin)
-          FocusToEWin(ewin);
+          FocusToEWin(ewin, FOCUS_CLICK);
        if (ewin)
           RaiseEwin(ewin);
        /* allow click to pass thorugh */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewmh.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- ewmh.c      19 Jan 2004 22:30:30 -0000      1.33
+++ ewmh.c      21 Jan 2004 23:32:44 -0000      1.34
@@ -723,7 +723,7 @@
        RaiseEwin(ewin);
        if (ewin->shaded)
           UnShadeEwin(ewin);
-       FocusToEWin(ewin);
+       FocusToEWin(ewin, FOCUS_SET);
      }
    else if (event->message_type == _NET_CLOSE_WINDOW)
      {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/focus.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- focus.c     19 Jan 2004 22:30:30 -0000      1.40
+++ focus.c     21 Jan 2004 23:32:44 -0000      1.41
@@ -22,9 +22,6 @@
  */
 #include "E.h"
 
-static void         ReverseTimeout(int val, void *data);
-static void         AutoraiseTimeout(int val, void *data);
-
 static int          new_desk_focus_nesting = 0;
 
 /* Mostly stolen from the temporary 'ToolTipTimeout' */
@@ -33,7 +30,7 @@
 {
    EWin               *found_ewin;
 
-   if (conf.focus.mode == FOCUS_CLICK)
+   if (conf.focus.mode == MODE_FOCUS_CLICK)
       return;
    found_ewin = FindItem("", val, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    if (found_ewin)
@@ -53,151 +50,86 @@
    data = NULL;
 }
 
-void
-GetNextFocusEwin(void)
+static void
+FocusCycle(int inc)
 {
    EWin              **lst0, **lst, *ewin;
    int                 i, num0, num, ax, ay;
 
-   EDBUG(5, "GetNextFocusEwin");
+   EDBUG(5, "FocusCycle");
+
    if (conf.warplist.enable)
      {
-       WarpFocus(1);
+       WarpFocus(inc);
        EDBUG_RETURN_;
      }
+
+   /* On previous only ? */
+   RemoveTimerEvent("REVERSE_FOCUS_TIMEOUT");
+   DoIn("REVERSE_FOCUS_TIMEOUT", 1.0, ReverseTimeout, 0, NULL);
+
+   GetCurrentArea(&ax, &ay);
+
    lst0 = (EWin **) ListItemType(&num0, LIST_TYPE_EWIN);
+   if (lst0 == NULL)
+      EDBUG_RETURN_;
+
    num = 0;
    lst = NULL;
-   GetCurrentArea(&ax, &ay);
-   if (lst0)
+   for (i = 0; i < num0; i++)
      {
-       for (i = 0; i < num0; i++)
+       ewin = lst0[i];
+       DetermineEwinArea(ewin);        // ???
+       if (((ewin->sticky) || (ewin->desktop == desks.current)) &&
+           ((ewin->area_x == ax) && (ewin->area_y == ay)) &&
+           (!ewin->skipfocus) && (!ewin->neverfocus) &&
+           (!ewin->shaded) && (!ewin->iconified) &&
+           (!ewin->menu) && (!ewin->pager) && (!ewin->ibox))
          {
-            ewin = lst0[i];
-            if (((ewin->sticky) || (ewin->desktop == desks.current)) && 
((ewin->area_x == ax) && (ewin->area_y == ay)) && (!ewin->skipfocus) && 
(!ewin->neverfocus) && (!ewin->iconified) && (!ewin->menu) && (!ewin->pager) && 
(!ewin->ibox) && (!ewin->iconified)    /*&& (ewin->client.mwm_decor_title) &&
-                                                                                      
                                                                                       
                                                                                       
    * * * * (ewin->client.mwm_decor_border) */
-               )
-              {
-                 num++;
-                 lst = Erealloc(lst, sizeof(EWin *) * num);
-                 lst[num - 1] = lst0[i];
-              }
+            num++;
+            lst = Erealloc(lst, sizeof(EWin *) * num);
+            lst[num - 1] = lst0[i];
          }
-       Efree(lst0);
      }
-   ewin = NULL;
-   if (lst)
+   Efree(lst0);
+
+   if (lst == NULL)
+      EDBUG_RETURN_;
+
+   for (i = 0; i < num; i++)
      {
-       for (i = 0; i < num; i++)
-         {
-            if (mode.focuswin == lst[i])
-              {
-                 if (i < num - 1)
-                    ewin = lst[i + 1];
-                 else
-                    ewin = lst[0];
-                 Efree(lst);
-                 if (conf.focus.raise_on_next_focus)
-                    RaiseEwin(ewin);
-                 if (conf.focus.warp_on_next_focus)
-                    XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0,
-                                 ewin->w / 2, ewin->h / 2);
-                 FocusToEWin(ewin);
-                 EDBUG_RETURN_;
-              }
-         }
-       ewin = lst[0];
-       Efree(lst);
-       if (conf.focus.raise_on_next_focus)
-          RaiseEwin(ewin);
-       if (conf.focus.warp_on_next_focus)
-          XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, ewin->w / 2,
-                       ewin->h / 2);
-       FocusToEWin(ewin);
+       if (mode.focuswin == lst[i])
+          break;
      }
+   i += inc + num;
+   i %= num;
+   ewin = lst[i];
+   Efree(lst);
+
+   FocusToEWin(ewin, FOCUS_SET);
+
    EDBUG_RETURN_;
 }
 
 void
-GetPrevFocusEwin(void)
+FocusGetNextEwin(void)
 {
-   EWin              **lst0, **lst, *ewin;
-   int                 i, num0, num, ax, ay;
+   FocusCycle(1);
+}
 
-   EDBUG(5, "GetPrevFocusEwin");
-   if (conf.warplist.enable)
-     {
-       WarpFocus(-1);
-       EDBUG_RETURN_;
-     }
-   RemoveTimerEvent("REVERSE_FOCUS_TIMEOUT");
-   DoIn("REVERSE_FOCUS_TIMEOUT", 1.0, ReverseTimeout, 0, NULL);
-   lst0 = (EWin **) ListItemType(&num0, LIST_TYPE_EWIN);
-   num = 0;
-   lst = NULL;
-   GetCurrentArea(&ax, &ay);
-   if (lst0)
-     {
-       for (i = 0; i < num0; i++)
-         {
-            ewin = lst0[i];
-            DetermineEwinArea(ewin);
-            if (((ewin->sticky) || (ewin->desktop == desks.current))
-                && ((ewin->area_x == ax) && (ewin->area_y == ay))
-                && (!ewin->skipfocus) && (!ewin->neverfocus) && (!ewin->shaded)
-                && (!ewin->menu) && (!ewin->pager) && (!ewin->ibox)
-                && (!ewin->iconified)
-                /* && (ewin->client.mwm_decor_title) &&
-                 *    (ewin->client.mwm_decor_border) */
-               )
-              {
-                 num++;
-                 lst = Erealloc(lst, sizeof(EWin *) * num);
-                 lst[num - 1] = lst0[i];
-              }
-         }
-       Efree(lst0);
-     }
-   ewin = NULL;
-   if (lst)
-     {
-       for (i = 0; i < num; i++)
-         {
-            if (mode.focuswin == lst[i])
-              {
-                 if (i == 0)
-                    ewin = lst[num - 1];
-                 else
-                    ewin = lst[i - 1];
-                 Efree(lst);
-                 if (conf.focus.raise_on_next_focus)
-                    RaiseEwin(ewin);
-                 if (conf.focus.warp_on_next_focus)
-                    XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0,
-                                 ewin->w / 2, ewin->h / 2);
-                 FocusToEWin(ewin);
-                 EDBUG_RETURN_;
-              }
-         }
-       ewin = lst[0];
-       Efree(lst);
-       if (conf.focus.raise_on_next_focus)
-          RaiseEwin(ewin);
-       if (conf.focus.warp_on_next_focus)
-          XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, ewin->w / 2,
-                       ewin->h / 2);
-       FocusToEWin(ewin);
-     }
-   EDBUG_RETURN_;
+void
+FocusGetPrevEwin(void)
+{
+   FocusCycle(-1);
 }
 
 void
-FixFocus(void)
+FocusFix(void)
 {
    EWin              **lst, *ewin;
    int                 i, num;
 
-   EDBUG(5, "FixFocus");
+   EDBUG(5, "FocusFix");
    num = 0;
    lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
    if (lst)
@@ -205,7 +137,7 @@
        for (i = 0; i < num; i++)
          {
             ewin = lst[i];
-            if (conf.focus.mode == FOCUS_CLICK)
+            if (conf.focus.mode == MODE_FOCUS_CLICK)
               {
                  if (!(ewin->active))
                     XGrabButton(disp, AnyButton, AnyModifier,
@@ -224,7 +156,7 @@
 }
 
 void
-FocusToEWin(EWin * ewin)
+FocusToEWin(EWin * ewin, int why)
 {
    int                 ax, ay;
 
@@ -237,10 +169,10 @@
       EDBUG_RETURN_;
 
    ICCCM_Cmap(ewin);
-   if ((!ewin) && (conf.focus.mode != FOCUS_POINTER))
+   if ((!ewin) && (conf.focus.mode != MODE_FOCUS_POINTER))
      {
        ewin = FindItem("", 0, LIST_FINDBY_NONE, LIST_TYPE_EWIN);
-       if (conf.focus.mode == FOCUS_CLICK)
+       if (conf.focus.mode == MODE_FOCUS_CLICK)
          {
             if ((mode.focuswin) && (ewin))
               {
@@ -289,7 +221,7 @@
        /* losing the focus may cause the titlebar to be resized */
        CalcEwinSizes(mode.focuswin);
        DrawEwin(mode.focuswin);
-       if ((conf.focus.clickraises) || (conf.focus.mode == FOCUS_CLICK))
+       if ((conf.focus.clickraises) || (conf.focus.mode == MODE_FOCUS_CLICK))
           XGrabButton(disp, AnyButton, AnyModifier,
                       mode.focuswin->win_container, False, ButtonPressMask,
                       GrabModeSync, GrabModeAsync, None, None);
@@ -312,7 +244,7 @@
        mode.focuswin->active = 1;
      }
    /* gaining the focus may cause the titlebar to be resized */
-   if ((conf.focus.mode == FOCUS_CLICK) && (mode.focuswin))
+   if ((conf.focus.mode == MODE_FOCUS_CLICK) && (mode.focuswin))
      {
        XUngrabButton(disp, AnyButton, AnyModifier,
                      mode.focuswin->win_container);
@@ -327,10 +259,10 @@
      }
 /*   ReZoom(mode.focuswin); */
    if ((conf.autoraise) && (mode.focuswin) && (!mode.focuswin->menu)
-       && (conf.focus.mode != FOCUS_CLICK))
+       && (conf.focus.mode != MODE_FOCUS_CLICK))
       DoIn("AUTORAISE_TIMEOUT", conf.autoraisetime, AutoraiseTimeout,
           mode.focuswin->client.win, NULL);
-   if (conf.focus.mode == FOCUS_CLICK)
+   if (conf.focus.mode == MODE_FOCUS_CLICK)
      {
        if (ewin)
          {
@@ -360,7 +292,7 @@
 }
 
 void
-BeginNewDeskFocus(void)
+FocusNewDeskBegin(void)
 {
    EWin               *ewin, **lst;
    int                 i, j, num;
@@ -422,12 +354,12 @@
 }
 
 void
-NewDeskFocus(void)
+FocusNewDesk(void)
 {
    EWin               *ewin, **lst;
    int                 i, j, num;
 
-   EDBUG(4, "NewDeskFocus");
+   EDBUG(4, "FocusNewDesk");
 
    if (--new_desk_focus_nesting)
       return;
@@ -491,13 +423,11 @@
                   SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
                   PointerMotionMask);
 
-   if ((conf.focus.mode == FOCUS_POINTER) || (conf.focus.mode == FOCUS_SLOPPY))
+   if ((conf.focus.mode == MODE_FOCUS_POINTER) ||
+       (conf.focus.mode == MODE_FOCUS_SLOPPY))
      {
        ewin = GetEwinPointerInClient();
-       if (ewin)
-          ICCCM_Focus(ewin);
-       else
-          ICCCM_Focus(NULL);
+       ICCCM_Focus(ewin);
      }
    else
      {
@@ -510,11 +440,9 @@
             for (i = 0; i < num; i++)
               {
                  ewin = lst[i];
-                 if ((ewin->sticky)
-                     ||
-                     ((((ewin->area_x
-                         == ax) && (ewin->area_y == ay)) || (ewin->fixedpos))
-                      && (ewin->desktop == desks.current)))
+                 if ((ewin->sticky) ||
+                     ((((ewin->area_x == ax) && (ewin->area_y == ay)) ||
+                       (ewin->fixedpos)) && (ewin->desktop == desks.current)))
                    {
                       ICCCM_Focus(ewin);
                       break;
@@ -545,7 +473,7 @@
        /* losing the focus may cause the titlebar to be resized */
        CalcEwinSizes(mode.focuswin);
        DrawEwin(mode.focuswin);
-       if (conf.focus.mode == FOCUS_CLICK)
+       if (conf.focus.mode == MODE_FOCUS_CLICK)
           XGrabButton(disp, AnyButton, AnyModifier,
                       mode.focuswin->win_container, False, ButtonPressMask,
                       GrabModeSync, GrabModeAsync, None, None);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -3 -r1.83 -r1.84
--- iconify.c   19 Jan 2004 22:30:31 -0000      1.83
+++ iconify.c   21 Jan 2004 23:32:44 -0000      1.84
@@ -218,6 +218,7 @@
      {
        was_shaded = ewin->shaded;
        SoundPlay("SOUND_ICONIFY");
+
        if (ib)
          {
             if (ib->animate)
@@ -235,7 +236,7 @@
 
             prev_warp = conf.warplist.enable;
             conf.warplist.enable = 0;
-            GetPrevFocusEwin();
+            FocusGetPrevEwin();
             conf.warplist.enable = prev_warp;
          }
        if (ewin->has_transients)
@@ -253,7 +254,7 @@
                            HideEwin(lst[i]);
                            lst[i]->iconified = 4;
                            if (lst[i] == mode.focuswin)
-                              FocusToEWin(NULL);
+                              FocusToEWin(NULL, FOCUS_EWIN_GONE);
                         }
                    }
                  HintsSetClientList();
@@ -320,7 +321,7 @@
        RaiseEwin(ewin);
        ShowEwin(ewin);
        ICCCM_DeIconify(ewin);
-       FocusToEWin(ewin);
+       FocusToEWin(ewin, FOCUS_EWIN_NEW);
        if (ewin->has_transients)
          {
             EWin              **lst, *e;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -3 -r1.132 -r1.133
--- ipc.c       19 Jan 2004 22:30:31 -0000      1.132
+++ ipc.c       21 Jan 2004 23:32:44 -0000      1.133
@@ -2233,21 +2233,20 @@
 static void
 IPC_SetFocus(char *params, Client * c)
 {
+   EWin               *ewin;
    char                buf[FILEPATH_LEN_MAX];
 
    buf[0] = 0;
 
    if (params)
      {
-       EWin               *my_focused_win;
-
        if (!strcmp(params, "?"))
          {
-            my_focused_win = GetFocusEwin();
-            if (my_focused_win)
+            ewin = GetFocusEwin();
+            if (ewin)
               {
-                 Esnprintf(buf, sizeof(buf), "focused: %8x",
-                           (unsigned)my_focused_win->client.win);
+                 Esnprintf(buf, sizeof(buf), "focused: %#lx",
+                           ewin->client.win);
               }
             else
               {
@@ -2259,9 +2258,9 @@
             unsigned int        win;
 
             sscanf(params, "%x", &win);
-            my_focused_win = FindEwinByChildren(win);
-            if (my_focused_win)
-               FocusToEWin(my_focused_win);
+            ewin = FindEwinByChildren(win);
+            if (ewin)
+               FocusToEWin(ewin, FOCUS_SET);
          }
      }
    else
@@ -4050,7 +4049,7 @@
          }
        else
          {
-            FocusToEWin(ewin);
+            FocusToEWin(ewin, FOCUS_SET);
          }
      }
    else
@@ -4133,26 +4132,26 @@
      {
        if (!strcmp(params, "click"))
          {
-            conf.focus.mode = 2;
+            conf.focus.mode = MODE_FOCUS_CLICK;
             mode.click_focus_grabbed = 1;
          }
        else if (!strcmp(params, "pointer"))
          {
-            conf.focus.mode = 0;
+            conf.focus.mode = MODE_FOCUS_POINTER;
          }
        else if (!strcmp(params, "sloppy"))
          {
-            conf.focus.mode = 1;
+            conf.focus.mode = MODE_FOCUS_SLOPPY;
          }
        else if (!strcmp(params, "clicknograb"))
          {
-            conf.focus.mode = 2;
+            conf.focus.mode = MODE_FOCUS_CLICK;
             mode.click_focus_grabbed = 0;
          }
        else if (!strcmp(params, "?"))
          {
             Esnprintf(buf, sizeof(buf), "Focus Mode: ");
-            if (conf.focus.mode == 2)
+            if (conf.focus.mode == MODE_FOCUS_CLICK)
               {
                  if (mode.click_focus_grabbed)
                    {
@@ -4163,11 +4162,11 @@
                       strcat(buf, "clicknograb");
                    }
               }
-            else if (conf.focus.mode == 1)
+            else if (conf.focus.mode == MODE_FOCUS_SLOPPY)
               {
                  strcat(buf, "sloppy");
               }
-            else if (conf.focus.mode == 0)
+            else if (conf.focus.mode == MODE_FOCUS_POINTER)
               {
                  strcat(buf, "pointer");
               }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- pager.c     21 Jan 2004 22:14:11 -0000      1.59
+++ pager.c     21 Jan 2004 23:32:44 -0000      1.60
@@ -1906,7 +1906,7 @@
             if (ewin)
               {
                  RaiseEwin(ewin);
-                 FocusToEWin(ewin);
+                 FocusToEWin(ewin, FOCUS_SET);
               }
          }
        if (p->hi_ewin)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/settings.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -3 -r1.87 -r1.88
--- settings.c  19 Jan 2004 22:30:33 -0000      1.87
+++ settings.c  21 Jan 2004 23:32:44 -0000      1.88
@@ -377,7 +377,7 @@
        conf.warplist.warpfocused = tmp_warpfocused;
 #endif /* WITH_TARTY_WARP */
        conf.focus.clickraises = tmp_clickalways;
-       FixFocus();
+       FocusFix();
      }
    autosave();
    data = NULL;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -3 -r1.104 -r1.105
--- setup.c     19 Jan 2004 22:30:33 -0000      1.104
+++ setup.c     21 Jan 2004 23:32:45 -0000      1.105
@@ -298,12 +298,14 @@
    root.w = DisplayWidth(disp, root.scr);
    root.h = DisplayHeight(disp, root.scr);
    root.focuswin = ECreateFocusWindow(root.win, -100, -100, 5, 5);
+
    /* just in case - set them up again */
    /* set up an error handler for then E would normally have fatal X errors */
    XSetErrorHandler((XErrorHandler) EHandleXError);
    /* set up a handler for when the X Connection goes down */
    XSetIOErrorHandler((XIOErrorHandler) HandleXIOError);
-   /* slect all the root window events to start managing */
+
+   /* select all the root window events to start managing */
    mode.xselect = 1;
    XSelectInput(disp, root.win,
                ButtonPressMask | ButtonReleaseMask | EnterWindowMask |
@@ -397,7 +399,7 @@
    conf.dock.dirmode = DOCK_DOWN;
    conf.dock.startx = 0;
    conf.dock.starty = 0;
-   conf.focus.mode = FOCUS_SLOPPY;
+   conf.focus.mode = MODE_FOCUS_SLOPPY;
    conf.focus.clickraises = 0;
    conf.focus.transientsfollowleader = 1;
    conf.focus.switchfortransientmap = 1;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/warp.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- warp.c      19 Jan 2004 22:30:35 -0000      1.30
+++ warp.c      21 Jan 2004 23:32:45 -0000      1.31
@@ -136,10 +136,10 @@
             if (conf.focus.warp_on_next_focus && !ewin->iconified)
                XWarpPointer(disp, None, ewin->win, 0, 0, 0, 0, ewin->w / 2,
                             ewin->h / 2);
-            /* if (conf.focus.mode == FOCUS_CLICK) */
+            /* if (conf.focus.mode == MODE_FOCUS_CLICK) */
             /* FocusToEWin(ewin); */
             if (conf.warplist.warpfocused && !ewin->iconified)
-               FocusToEWin(ewin);
+               FocusToEWin(ewin, FOCUS_WARP);
          }
        WarpFocusShowTitle(ewin);
        Efree(lst);
@@ -168,7 +168,7 @@
          {
             if (conf.warplist.warpiconified && ewin->iconified)
                DeIconifyEwin(ewin);
-            FocusToEWin(ewin);
+            FocusToEWin(ewin, FOCUS_SET);
             if (conf.focus.warp_after_next_focus
                 || conf.focus.warp_on_next_focus)
               {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/zoom.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- zoom.c      19 Jan 2004 22:30:35 -0000      1.18
+++ zoom.c      21 Jan 2004 23:32:45 -0000      1.19
@@ -249,7 +249,7 @@
        MoveEwin(ewin, -ewin->border->border.left + x1,
                 -ewin->border->border.top + y1);
        ICCCM_Configure(ewin);
-       FocusToEWin(ewin);
+       FocusToEWin(ewin, FOCUS_SET);
        XWarpPointer(disp, None, ewin->client.win, 0, 0, 0, 0,
                     ewin->client.w / 2, ewin->client.h / 2);
 #if 0




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to