Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        events.c events.h ewins.c moveresize.c 


Log Message:
Fix more breakage around window movement.

===================================================================
RCS file: /cvs/e/e16/e/src/events.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -3 -r1.144 -r1.145
--- events.c    21 Dec 2007 22:04:54 -0000      1.144
+++ events.c    24 Dec 2007 00:04:55 -0000      1.145
@@ -261,6 +261,18 @@
    EventFdRegister(ConnectionNumber(disp), NULL);
 }
 
+int
+EventsGetXY(int *px, int *py)
+{
+   int                 ss;
+
+   ss = EQueryPointer(NULL, px, py, NULL, NULL);
+   Mode.events.cx = *px;
+   Mode.events.cy = *py;
+
+   return ss;
+}
+
 static void
 ModeGetXY(Window rwin, int rx, int ry)
 {
===================================================================
RCS file: /cvs/e/e16/e/src/events.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- events.h    2 Dec 2007 18:39:17 -0000       1.4
+++ events.h    24 Dec 2007 00:04:55 -0000      1.5
@@ -44,4 +44,6 @@
 EventFdDesc        *EventFdRegister(int fd, EventFdHandler * handler);
 void                EventFdUnregister(EventFdDesc * efd);
 
+int                 EventsGetXY(int *px, int *py);
+
 #endif /* _EVENTS_H_ */
===================================================================
RCS file: /cvs/e/e16/e/src/ewins.c,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -3 -r1.210 -r1.211
--- ewins.c     21 Dec 2007 22:04:54 -0000      1.210
+++ ewins.c     24 Dec 2007 00:04:55 -0000      1.211
@@ -853,35 +853,28 @@
        /* Place the window below the mouse pointer */
        if (Conf.place.manual_mouse_pointer)
          {
-            int                 rx, ry;
-            int                 newWinX = 0, newWinY = 0;
+            int                 cx, cy;
 
             /* if the loser has manual placement on and the app asks to be on 
*/
             /*  a desktop, then send E to that desktop so the user can place */
             /* the window there */
             DeskGoto(dsk);
 
-            EQueryPointer(NULL, &rx, &ry, NULL, NULL);
-            Mode.events.cx = rx;
-            Mode.events.cy = ry;
+            EventsGetXY(&cx, &cy);
 
             /* try to center the window on the mouse pointer */
-            newWinX = rx;
-            newWinY = ry;
-            if (EoGetW(ewin))
-               newWinX -= EoGetW(ewin) / 2;
-            if (EoGetH(ewin))
-               newWinY -= EoGetH(ewin) / 2;
+            cx -= EoGetW(ewin) / 2;
+            cy -= EoGetH(ewin) / 2;
 
             /* keep it all on this screen if possible */
-            newWinX = MIN(newWinX, VRoot.w - EoGetW(ewin));
-            newWinY = MIN(newWinY, VRoot.h - EoGetH(ewin));
-            newWinX = MAX(newWinX, 0);
-            newWinY = MAX(newWinY, 0);
+            cx = MIN(cx, VRoot.w - EoGetW(ewin));
+            cy = MIN(cy, VRoot.h - EoGetH(ewin));
+            cx = MAX(cx, 0);
+            cy = MAX(cy, 0);
 
             /* this works for me... */
-            x = newWinX;
-            y = newWinY;
+            x = cx;
+            y = cy;
          }
        else if (ewin->ewmh.type.b.dialog)
          {
===================================================================
RCS file: /cvs/e/e16/e/src/moveresize.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -3 -r1.84 -r1.85
--- moveresize.c        22 Dec 2007 14:40:20 -0000      1.84
+++ moveresize.c        24 Dec 2007 00:04:55 -0000      1.85
@@ -25,6 +25,7 @@
 #include "cursors.h"
 #include "desktops.h"
 #include "emodule.h"
+#include "events.h"
 #include "ewins.h"
 #include "focus.h"
 #include "grabs.h"
@@ -80,7 +81,7 @@
 ActionMoveStart(EWin * ewin, char constrained, int nogroup)
 {
    EWin              **gwins;
-   int                 i, num;
+   int                 i, num, cx, cy;
 
    if (!ewin || ewin->state.inhibit_move)
       return 0;
@@ -88,6 +89,8 @@
    Mode_mr.ewin = ewin;
    Mode_mr.nogroup = nogroup;
 
+   EventsGetXY(&cx, &cy);
+
    SoundPlay("SOUND_MOVE_START");
 
    GrabPointerSet(EoGetWin(ewin), ECSR_ACT_MOVE, 1);
@@ -95,8 +98,8 @@
    Mode.mode = MODE_MOVE_PENDING;
    Mode.constrained = constrained;
 
-   Mode_mr.start_x = Mode.events.cx;
-   Mode_mr.start_y = Mode.events.cy;
+   Mode_mr.start_x = cx;
+   Mode_mr.start_y = cy;
 
    Mode_mr.win_x = Mode_mr.start_x - (EoGetX(ewin) + EoGetX(EoGetDesk(ewin)));
    Mode_mr.win_y = Mode_mr.start_y - (EoGetY(ewin) + EoGetY(EoGetDesk(ewin)));
@@ -289,7 +292,7 @@
 int
 ActionResizeStart(EWin * ewin, int hv)
 {
-   int                 x, y, w, h, ww, hh;
+   int                 x, y, w, h, ww, hh, cx, cy;
    unsigned int        csr;
 
    if (!ewin || ewin->state.inhibit_resize)
@@ -297,6 +300,8 @@
 
    Mode_mr.ewin = ewin;
 
+   EventsGetXY(&cx, &cy);
+
    SoundPlay("SOUND_RESIZE_START");
 
    if (Conf.movres.mode_resize < 0 || Conf.movres.mode_resize > 4)
@@ -321,8 +326,8 @@
      default:
      case MODE_RESIZE:
        Mode.mode = hv;
-       x = Mode.events.cx - EoGetX(ewin);
-       y = Mode.events.cy - EoGetY(ewin);
+       x = cx - EoGetX(ewin);
+       y = cy - EoGetY(ewin);
        w = EoGetW(ewin) >> 1;
        h = EoGetH(ewin) >> 1;
        ww = EoGetW(ewin) / 6;
@@ -381,7 +386,7 @@
 
      case MODE_RESIZE_H:
        Mode.mode = hv;
-       x = Mode.events.cx - EoGetX(ewin);
+       x = cx - EoGetX(ewin);
        w = EoGetW(ewin) >> 1;
        if (x < w)
           Mode_mr.resize_detail = RD(1, 0);
@@ -392,7 +397,7 @@
 
      case MODE_RESIZE_V:
        Mode.mode = hv;
-       y = Mode.events.cy - EoGetY(ewin);
+       y = cy - EoGetY(ewin);
        h = EoGetH(ewin) >> 1;
        if (y < h)
           Mode_mr.resize_detail = RD(0, 1);
@@ -402,8 +407,8 @@
        break;
      }
 
-   Mode_mr.start_x = Mode.events.cx;
-   Mode_mr.start_y = Mode.events.cy;
+   Mode_mr.start_x = cx;
+   Mode_mr.start_y = cy;
    Mode_mr.win_x = EoGetX(ewin);
    Mode_mr.win_y = EoGetY(ewin);
    Mode_mr.win_w = ewin->client.w;



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to