history and bug report:
I just upgraded fvwm and saw an edge bump behavior at the outside
paging border when moving a window.  When a window was moved into the
panning window the poiner and window would be bumped so the pointer
was moved outside the panning window.  This jumping was annoying and
was causing me to drop windows a pixel or two from the border, which I
would have to pickup and move again.

This edge bump was introduced in 2.5.24 in virtual.c
revision 1.187
date: 2007/09/11 18:48:57;  author: domivogt;  state: Exp;  lines: +7 -7
* Fixed jumping windows under some circumstances when releasing the button in
interactive motion while hitting the desktop's edge.

That change moved the check for if the window was paged to be too
early, in my debugging it is never hit.  I moved it to right before xl
and yt are adjusted to be inside the panning windows.  Otherwise xl
and yt are updated, but the pointer isn't moved.  The real problem for
the jumping windows is in __move_loop.  In HandlePaging xl and yt are
pointer locations and __move_loop treats them as window locations.
__move_loop would only transform the result if HandlePaging would
return 1 meaning that the desktop was paged (which in the above commit
disable the non-paging return).

At least in my tests the 'Fake and event to force window reposition.'
in __move_loop isn't required, maybe it was just masking the
pointer to window location problem.  I left it inside #if 0 for
someone else to look at.

Something shorter for the CVS log or stick the above in them.

fvwm/virtual.c
Moved the no paging check after delta is calculated but before xl and
yt are updated so they will be at the current pointer location.

fvwm/move_resize.c
Transform from window to pointer location before calling HandlePaging
and back after the call.  Previously it was only transforming when the
desktop was paged causing the window to jump when it wasn't paged.

-- 
David Fries <da...@fries.net>
http://fries.net/~david/ (PGP encryption key available)

diff --git a/ChangeLog b/ChangeLog
index c44dbbb..4c1efbf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-03-01  David Fries <da...@fries.net>
+       * fvwm/virtual.c (HandlePaging):
+       move no page detect check, it wasn't being hit
+       * fvwm/move_resize.c (__move_loop):
+       transform window position to pointer position and back when calling
+       HandlePaging
+
 2009-02-23  Dominik Vogt  <dominik(dot)vogt(at)gmx(dot)de>
 
        * NEWS:
diff --git a/NEWS b/NEWS
index d46bb5f..b718a3a 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,11 @@ Note, the changes for the last STABLE release start with 
release
 
 Changes in beta release 2.5.28 (not released yet)
 
+* Bug fixes:
+
+  - There was a bump behavior when moving the window with the mouse
+    and the border of the desktop was hit, fixed.
+
 -------------------------------------------------------------------
 
 Changes in beta release 2.5.27 (23-Feb-2009)
diff --git a/fvwm/move_resize.c b/fvwm/move_resize.c
index 06e180e..8a56118 100644
--- a/fvwm/move_resize.c
+++ b/fvwm/move_resize.c
@@ -2404,28 +2404,33 @@ Bool __move_loop(
                        XEvent le;
 
                        fev_get_last_event(&le);
+                       /* from window location to pointer position */
+                       xl -= XOffset;
+                       yt -= YOffset;
                        rc = HandlePaging(
                                &le, dx, dy, &xl, &yt, &delta_x, &delta_y,
                                False, False, True, fw->edge_delay_ms_move);
+                       /* from pointer position to window location */
+                       if (delta_x)
+                       {
+                               x_virtual_offset = 0;
+                       }
+                       xl += XOffset;
+                       if (delta_y)
+                       {
+                               y_virtual_offset = 0;
+                       }
+                       yt += YOffset;
+                       if (do_snap)
+                       {
+                               DoSnapAttract(
+                                       fw, Width, Height, &xl, &yt);
+                               was_snapped = True;
+                       }
+                       #if 0
                        if (rc == 1)
                        {
                                /* Fake an event to force window reposition */
-                               if (delta_x)
-                               {
-                                       x_virtual_offset = 0;
-                               }
-                               xl += XOffset;
-                               if (delta_y)
-                               {
-                                       y_virtual_offset = 0;
-                               }
-                               yt += YOffset;
-                               if (do_snap)
-                               {
-                                       DoSnapAttract(
-                                               fw, Width, Height, &xl, &yt);
-                                       was_snapped = True;
-                               }
                                fev_make_null_event(&e, dpy);
                                e.type = MotionNotify;
                                e.xmotion.time = fev_get_evtime();
@@ -2434,6 +2439,7 @@ Bool __move_loop(
                                e.xmotion.same_screen = True;
                                break;
                        }
+                       #endif
                }
                if (rc == -1)
                {
diff --git a/fvwm/virtual.c b/fvwm/virtual.c
index 9539fcf..382a791 100644
--- a/fvwm/virtual.c
+++ b/fvwm/virtual.c
@@ -621,6 +621,8 @@ static void MapDesk(int desk, Bool grab)
  * Check to see if the pointer is on the edge of the screen, and scroll/page
  * if needed
  *
+ * xl, yt: if set is the pointer location relative to the root window
+ *
  * Returns
  *  0: no paging
  *  1: paging occured
@@ -798,13 +800,6 @@ int HandlePaging(
                *delta_y = 0;
        }
 
-       is_timestamp_valid = False;
-       add_time = 0;
-       if (*delta_x == 0 && *delta_y == 0)
-       {
-               return 0;
-       }
-
        /* Ouch! lots of bounds checking */
        if (Scr.Vx + *delta_x < 0)
        {
@@ -868,6 +863,14 @@ int HandlePaging(
                *yt = y - *delta_y;
        }
 
+       is_timestamp_valid = False;
+       add_time = 0;
+       /* not paging means no warp pointer or xl yt update */
+       if (*delta_x == 0 && *delta_y == 0)
+       {
+               return 0;
+       }
+
        /* make sure the pointer isn't warped into the panframes */
        if (*xl < edge_thickness)
        {

Reply via email to