Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h areas.c desktops.c edge.c ewin-ops.c ipc.c moveresize.c 
        x.c 


Log Message:
Fix various edge flipping bugs (window moving, multihead, configuration).
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.338
retrieving revision 1.339
diff -u -3 -r1.338 -r1.339
--- E.h 1 Jan 2005 17:58:44 -0000       1.338
+++ E.h 2 Jan 2005 15:38:50 -0000       1.339
@@ -851,12 +851,6 @@
 {
    struct
    {
-      int                 nx;
-      int                 ny;
-      char                wraparound;
-   } areas;
-   struct
-   {
       char                enable;
       int                 delay;       /* milliseconds */
    } autoraise;
@@ -869,13 +863,16 @@
    struct
    {
       int                 num;
-      char                wraparound;
       int                 dragdir;
       int                 dragbar_width;
       int                 dragbar_ordering;
       int                 dragbar_length;
+      char                desks_wraparound;
       char                slidein;
       int                 slidespeed;
+      int                 areas_nx;
+      int                 areas_ny;
+      char                areas_wraparound;
    } desks;
    struct
    {
@@ -1581,6 +1578,7 @@
 void                ConfigurationShow(const char *params);
 
 /* edge.c */
+void                EdgeCheckMotion(int x, int y);
 void                EdgeWindowsShow(void);
 void                EdgeWindowsHide(void);
 
@@ -2335,7 +2333,7 @@
 int                 WinExists(Window win);
 Window              WindowAtXY_0(Window base, int bx, int by, int x, int y);
 Window              WindowAtXY(int x, int y);
-void                PointerAt(int *x, int *y);
+Bool                PointerAt(int *x, int *y);
 void                EDrawableDumpImage(Drawable draw, const char *txt);
 
 /* zoom.c */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/areas.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -3 -r1.75 -r1.76
--- areas.c     28 Dec 2004 23:46:43 -0000      1.75
+++ areas.c     2 Jan 2005 15:38:51 -0000       1.76
@@ -30,14 +30,14 @@
 {
    if (*ax < 0)
      {
-       if (Conf.areas.wraparound)
+       if (Conf.desks.areas_wraparound)
           *ax = area_w - 1;
        else
           *ax = 0;
      }
    else if (*ax >= area_w)
      {
-       if (Conf.areas.wraparound)
+       if (Conf.desks.areas_wraparound)
           *ax = 0;
        else
           *ax = area_w - 1;
@@ -45,14 +45,14 @@
 
    if (*ay < 0)
      {
-       if (Conf.areas.wraparound)
+       if (Conf.desks.areas_wraparound)
           *ay = area_h - 1;
        else
           *ay = 0;
      }
    else if (*ay >= area_h)
      {
-       if (Conf.areas.wraparound)
+       if (Conf.desks.areas_wraparound)
           *ay = 0;
        else
           *ay = area_h - 1;
@@ -125,8 +125,8 @@
       aw = 1;
    if (ah < 1)
       ah = 1;
-   Conf.areas.nx = area_w = aw;
-   Conf.areas.ny = area_h = ah;
+   Conf.desks.areas_nx = area_w = aw;
+   Conf.desks.areas_ny = area_h = ah;
    HintsSetViewportConfig();
    ModulesSignal(ESIGNAL_AREA_CONFIGURED, NULL);
    EDBUG_RETURN_;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -3 -r1.107 -r1.108
--- desktops.c  1 Jan 2005 17:58:45 -0000       1.107
+++ desktops.c  2 Jan 2005 15:38:51 -0000       1.108
@@ -728,7 +728,7 @@
    static int          pdesk = -1;
    int                 x, y;
 
-   if (Conf.desks.wraparound)
+   if (Conf.desks.desks_wraparound)
      {
        if (desk >= Conf.desks.num)
           desk = 0;
@@ -1438,7 +1438,7 @@
        break;
 
      case ESIGNAL_CONFIGURE:
-       SetAreaSize(Conf.areas.nx, Conf.areas.ny);
+       SetAreaSize(Conf.desks.areas_nx, Conf.desks.areas_ny);
 
        DeskSetViewable(0, 1);
        RefreshDesktop(0);
@@ -1468,7 +1468,7 @@
    if (val < 2)
      {
        ChangeNumberOfDesktops(tmp_desktops);
-       Conf.desks.wraparound = tmp_desktop_wraparound;
+       Conf.desks.desks_wraparound = tmp_desktop_wraparound;
      }
    autosave();
 }
@@ -1560,7 +1560,7 @@
    SoundPlay("SOUND_SETTINGS_DESKTOPS");
 
    tmp_desktops = Conf.desks.num;
-   tmp_desktop_wraparound = Conf.desks.wraparound;
+   tmp_desktop_wraparound = Conf.desks.desks_wraparound;
 
    d = tmp_desk_dialog = DialogCreate("CONFIGURE_DESKTOPS");
    DialogSetTitle(d, _("Multiple Desktop Settings"));
@@ -1666,7 +1666,7 @@
    if (val < 2)
      {
        SetNewAreaSize(tmp_area_x, 9 - tmp_area_y);
-       Conf.areas.wraparound = tmp_area_wraparound;
+       Conf.desks.areas_wraparound = tmp_area_wraparound;
        if (tmp_edge_flip)
          {
             if (tmp_edge_resist < 1)
@@ -1749,7 +1749,7 @@
      }
    SoundPlay("SOUND_SETTINGS_AREA");
 
-   tmp_area_wraparound = Conf.areas.wraparound;
+   tmp_area_wraparound = Conf.desks.areas_wraparound;
    tmp_edge_resist = Conf.edge_flip_resistance;
    if (tmp_edge_resist == 0)
       tmp_edge_flip = 0;
@@ -2062,17 +2062,17 @@
 
 static const CfgItem DesktopsCfgItems[] = {
    CFG_ITEM_INT(Conf.desks, num, 2),
-   CFG_ITEM_BOOL(Conf.desks, wraparound, 0),
    CFG_ITEM_INT(Conf.desks, dragdir, 2),
    CFG_ITEM_INT(Conf.desks, dragbar_width, 16),
    CFG_ITEM_INT(Conf.desks, dragbar_ordering, 1),
    CFG_ITEM_INT(Conf.desks, dragbar_length, 0),
+   CFG_ITEM_BOOL(Conf.desks, desks_wraparound, 0),
    CFG_ITEM_BOOL(Conf.desks, slidein, 1),
    CFG_ITEM_INT(Conf.desks, slidespeed, 6000),
 
-   CFG_ITEM_INT(Conf.areas, nx, 2),
-   CFG_ITEM_INT(Conf.areas, ny, 1),
-   CFG_ITEM_BOOL(Conf.areas, wraparound, 0),
+   CFG_ITEM_INT(Conf.desks, areas_nx, 2),
+   CFG_ITEM_INT(Conf.desks, areas_ny, 1),
+   CFG_ITEM_BOOL(Conf.desks, areas_wraparound, 0),
 };
 #define N_CFG_ITEMS (sizeof(DesktopsCfgItems)/sizeof(CfgItem))
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/edge.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- edge.c      28 Dec 2004 23:46:44 -0000      1.9
+++ edge.c      2 Jan 2005 15:38:51 -0000       1.10
@@ -27,7 +27,7 @@
 static Window       w1 = 0, w2 = 0, w3 = 0, w4 = 0;
 
 static void
-EdgeTimeout(int val, void *data)
+EdgeTimeout(int val, void *data __UNUSED__)
 {
    int                 ax, ay, aw, ah, dx, dy, dax, day;
    EWin               *ewin;
@@ -37,6 +37,11 @@
    if (!Conf.edge_flip_resistance)
       return;
 
+   /* Quit if pointer has left screen */
+   if (!PointerAt(NULL, NULL))
+      return;
+
+   /* Quit if in fullscreen window */
    ewin = GetEwinPointerInClient();
    if (ewin && ewin->st.fullscreen)
       return;
@@ -51,25 +56,25 @@
    switch (val)
      {
      case 0:
-       if (ax == 0 && !Conf.areas.wraparound)
+       if (ax == 0 && !Conf.desks.areas_wraparound)
           return;
        dx = VRoot.w - 2;
        dax = -1;
        break;
      case 1:
-       if (ax == (aw - 1) && !Conf.areas.wraparound)
+       if (ax == (aw - 1) && !Conf.desks.areas_wraparound)
           return;
        dx = -(VRoot.w - 2);
        dax = 1;
        break;
      case 2:
-       if (ay == 0 && !Conf.areas.wraparound)
+       if (ay == 0 && !Conf.desks.areas_wraparound)
           return;
        dy = VRoot.h - 2;
        day = -1;
        break;
      case 3:
-       if (ay == (ah - 1) && !Conf.areas.wraparound)
+       if (ay == (ah - 1) && !Conf.desks.areas_wraparound)
           return;
        dy = -(VRoot.h - 2);
        day = 1;
@@ -85,55 +90,89 @@
    Mode.py = Mode.y;
    Mode.x += dx;
    Mode.y += dy;
-   XWarpPointer(disp, None, None, 0, 0, 0, 0, dx, dy);
+   XWarpPointer(disp, None, VRoot.win, 0, 0, 0, 0, Mode.x, Mode.y);
    Mode.flipp = 1;
    MoveCurrentAreaBy(dax, day);
    Mode.flipp = 0;
    Mode.px = Mode.x;
    Mode.py = Mode.y;
-   data = NULL;
 }
 
 static void
-EdgeHandleEvents(XEvent * ev, void *prm)
+EdgeEvent(int dir)
 {
    static int          lastdir = -1;
+
+#if 0
+   Eprintf("EdgeEvent %d -> %d\n", lastdir, dir);
+#endif
+   if (lastdir == dir || !Conf.edge_flip_resistance)
+      return;
+
+   RemoveTimerEvent("EDGE_TIMEOUT");
+   if (dir >= 0)
+     {
+       DoIn("EDGE_TIMEOUT",
+            ((double)Conf.edge_flip_resistance) / 100.0, EdgeTimeout,
+            dir, NULL);
+     }
+   lastdir = dir;
+}
+
+static void
+EdgeHandleEvents(XEvent * ev, void *prm)
+{
+   static Time         last_time;
    int                 dir;
+   unsigned long       dt;
 
    dir = (int)prm;
-   if (dir < 0 || dir > 3)     /* Should not be possible */
-      return;
 
    switch (ev->type)
      {
      case EnterNotify:
-       DoIn("EDGE_TIMEOUT", ((double)Conf.edge_flip_resistance) / 100.0,
-            EdgeTimeout, dir, NULL);
+       /* Avoid excessive flipping */
+       dt = ev->xcrossing.time - last_time;
+       if (dt < 500)
+          return;
+       last_time = ev->xcrossing.time;
+       EdgeEvent(dir);
        break;
 
      case LeaveNotify:
-       RemoveTimerEvent("EDGE_TIMEOUT");
+       EdgeEvent(-1);
        break;
 
+#if 0
      case MotionNotify:
        if (Mode.mode != MODE_MOVE_PENDING && Mode.mode != MODE_MOVE)
           break;
 
-       if ((lastdir != dir) && (Conf.edge_flip_resistance))
-         {
-            if (dir < 0)
-               RemoveTimerEvent("EDGE_TIMEOUT");
-            else
-               DoIn("EDGE_TIMEOUT",
-                    ((double)Conf.edge_flip_resistance) / 100.0, EdgeTimeout,
-                    dir, NULL);
-            lastdir = dir;
-         }
+       EdgeEvent(dir);
        break;
+#endif
      }
 }
 
 void
+EdgeCheckMotion(int x, int y)
+{
+   int                 dir;
+
+   if (x == 0)
+      dir = 0;
+   else if (x == VRoot.w - 1)
+      dir = 1;
+   else if (y == 0)
+      dir = 2;
+   else if (y == VRoot.h - 1)
+      dir = 3;
+   else
+      dir = -1;
+   EdgeEvent(dir);
+}
+
+void
 EdgeWindowsShow(void)
 {
    int                 ax, ay, cx, cy;
@@ -150,18 +189,10 @@
        w2 = ECreateEventWindow(VRoot.win, VRoot.w - 1, 0, 1, VRoot.h);
        w3 = ECreateEventWindow(VRoot.win, 0, 0, VRoot.w, 1);
        w4 = ECreateEventWindow(VRoot.win, 0, VRoot.h - 1, VRoot.w, 1);
-       XSelectInput(disp, w1,
-                    EnterWindowMask | LeaveWindowMask | PointerMotionMask |
-                    ButtonPressMask | ButtonReleaseMask);
-       XSelectInput(disp, w2,
-                    EnterWindowMask | LeaveWindowMask | PointerMotionMask |
-                    ButtonPressMask | ButtonReleaseMask);
-       XSelectInput(disp, w3,
-                    EnterWindowMask | LeaveWindowMask | PointerMotionMask |
-                    ButtonPressMask | ButtonReleaseMask);
-       XSelectInput(disp, w4,
-                    EnterWindowMask | LeaveWindowMask | PointerMotionMask |
-                    ButtonPressMask | ButtonReleaseMask);
+       XSelectInput(disp, w1, EnterWindowMask | LeaveWindowMask);
+       XSelectInput(disp, w2, EnterWindowMask | LeaveWindowMask);
+       XSelectInput(disp, w3, EnterWindowMask | LeaveWindowMask);
+       XSelectInput(disp, w4, EnterWindowMask | LeaveWindowMask);
        EventCallbackRegister(w1, 0, EdgeHandleEvents, (void *)0);
        EventCallbackRegister(w2, 0, EdgeHandleEvents, (void *)1);
        EventCallbackRegister(w3, 0, EdgeHandleEvents, (void *)2);
@@ -170,19 +201,19 @@
    DeskGetCurrentArea(&cx, &cy);
    GetAreaSize(&ax, &ay);
 
-   if (cx == 0 && !Conf.areas.wraparound)
+   if (cx == 0 && !Conf.desks.areas_wraparound)
       EUnmapWindow(disp, w1);
    else
       EMapRaised(disp, w1);
-   if (cx == (ax - 1) && !Conf.areas.wraparound)
+   if (cx == (ax - 1) && !Conf.desks.areas_wraparound)
       EUnmapWindow(disp, w2);
    else
       EMapRaised(disp, w2);
-   if (cy == 0 && !Conf.areas.wraparound)
+   if (cy == 0 && !Conf.desks.areas_wraparound)
       EUnmapWindow(disp, w3);
    else
       EMapRaised(disp, w3);
-   if (cy == (ay - 1) && !Conf.areas.wraparound)
+   if (cy == (ay - 1) && !Conf.desks.areas_wraparound)
       EUnmapWindow(disp, w4);
    else
       EMapRaised(disp, w4);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewin-ops.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewin-ops.c  31 Dec 2004 16:14:45 -0000      1.3
+++ ewin-ops.c  2 Jan 2005 15:38:51 -0000       1.4
@@ -202,8 +202,8 @@
             DeskGetArea(EoGetDesk(ewin), &ax, &ay);
             x0 = -ax * sw;
             y0 = -ay * sh;
-            sw *= Conf.areas.nx;
-            sh *= Conf.areas.ny;
+            sw *= Conf.desks.areas_nx;
+            sh *= Conf.desks.areas_ny;
          }
        dx = EoGetW(ewin) / 4;
        if (dx > 8)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -3 -r1.187 -r1.188
--- ipc.c       28 Dec 2004 23:46:46 -0000      1.187
+++ ipc.c       2 Jan 2005 15:38:51 -0000       1.188
@@ -827,7 +827,7 @@
          {
             if (!strcmp(param1, "ptr"))
               {
-                 ActionMoveStart(ewin, 0, 0, 0);
+                 ActionMoveStart(ewin, 1, 0, 0);
               }
             else if (!strcmp(param1, "?"))
               {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/moveresize.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- moveresize.c        28 Dec 2004 23:46:46 -0000      1.27
+++ moveresize.c        2 Jan 2005 15:38:51 -0000       1.28
@@ -409,6 +409,8 @@
    if (!ewin)
       return;
 
+   EdgeCheckMotion(Mode.x, Mode.y);
+
    gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_MOVE,
                                      Mode.nogroup || Mode.move.swap, &num);
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -3 -r1.72 -r1.73
--- x.c 28 Dec 2004 23:46:47 -0000      1.72
+++ x.c 2 Jan 2005 15:38:52 -0000       1.73
@@ -1086,14 +1086,18 @@
    EDBUG_RETURN(VRoot.win);
 }
 
-void
+Bool
 PointerAt(int *x, int *y)
 {
    Window              dw;
    int                 dd;
    unsigned int        mm;
 
-   XQueryPointer(disp, VRoot.win, &dw, &dw, &dd, &dd, x, y, &mm);
+   if (!x || !y)
+      x = y = &dd;
+
+   /* Return True if pointer is on "our" screen */
+   return XQueryPointer(disp, VRoot.win, &dw, &dw, &dd, &dd, x, y, &mm);
 }
 
 Display            *




-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to