Subject: FVWM: Move Gets Stuck at Window Edges

From: Mike Blatchley <[email-masked]>
Date: Thu, 4 Jan 1996 18:26:46 -0700 (MST)

I am using fvwm-2.0.40 on a Sun (Solaris 2.3) and have a problem when
moving a window, usually by clicking the mouse on the _title bar_ and
dragging the window.  When the move cursor hits one of the screen edges,
the move gets frozen/paused at this location for a little while; you can
still move the 4-arrow cursor away from the screen edge with the mouse,
but it takes a while before the actual window starts moving again.  

Turns out that this is related to the EdgeResistance setting (I'm using
1500 50).  I have it set to 1500 because I dislike all the inadvertant
page changes I end up making!  If I reduce this time (to, say, 50), I
don't get this pause on window moves to the screen edge, but I'm always 
changing pages!! 

Has this problem been seen before?  Is there a possible or known fix?  I'm
going to look at the code tonight, but I've never done _any_ X 
programming, so I don't count on finding anything.  But, I'm interested in
learning it!

Thanks for the great window manager!!

Mike Blatchley
======================================================================
      * Mike Blatchley * Maxtor Corporation * (303) 678-2393   *
      * email: [email-masked] -or- [email-masked] *
======================================================================
--
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Jason L Tibbitts III <[email-masked]>
Date: Thu, 04 Jan 1996 19:53:29 -0600

>>>>> "MB" == Mike Blatchley <[email-masked]> writes:

MB> Turns out that this is related to the EdgeResistance setting (I'm using
MB> 1500 50).

Yes, it is.  It sounds like you're only modifying the first parameter,
though.  From the fvwm man page:

       EdgeResistance scrolling moving
              Tells how hard it should be to change the desktop viewport
              by moving the mouse over the edge of the  screen  and  how
              hard  it  should  be to move a window over the edge of the
              screen.

              The first parameter tells  how  milliseconds  the  pointer
              must  spend  on  the screen edge before fvwm will move the
              viewport. This is intended for people who use  "EdgeScroll
              100  100"  but find themselves accidentally flipping pages
              when they don't want to.

              The second parameter tells how many pixels over  the  edge
              of the screen a window's edge must move before it actually
              moves partially off the screen.

Does changing the second parameter do what you want?

 - J<

---

From: Mike Blatchley <[email-masked]>
Date: Thu, 4 Jan 1996 22:52:57 -0700 (MST)

> Does changing the second parameter do what you want?

The second parameter set to 50 already does exactly what I want it to.  This
parameter specifies essentially how hard it is to move the _edge_ of a window
off the screen.  50 pixels allows me to easily position a window right at the
edge of the screen without it going over. 

The first parameter at 1500 also does what I want it to; I have to place 
the pointer at the edge of the screen for 1.5seconds before the pager 
will move me to the next virtual screen.  This applies to the pointer 
at all times; when not moving windows, when moving windows, etc.  But, 
there is this nagging side effect during a window move.

Try this.... Lets say I want to grab a window by the title bar and move it to
the very top of the current virtual screen.  When I get to the top, the
window I'm moving will stop right at the edge of the screen, as it should. 
However, if I am "careless" and I allow the _pointer_ to touch the top row of
pixels (mouse button still depressed, pointer still a cross-hair type), even
if I _immediately_ release the mouse button and move the pointer away from
the screen edge, I have to wait the 1.5seconds before I am out of the move
operation and can do other operations.  During this time, the pointer does
move away from the edge, but it remains the cross-hair type and the title bar
of the window I was moving remains depressed. 

Since the pointer was moved away from the edge of the screen, the scroll 
resistance timer should be immediately canceled and no longer have any 
effect.  However, it seems to be hanging up the move operation for this 
time.

I hope this clears things up.  

Thanks,

Mike Blatchley
[email-masked]

---

From: [email-masked] (Robert Nation 885-9815)
Date: Fri, 5 Jan 96 09:40:02 EST

>though.  From the fvwm man page:

I think MB is right. If you make the first parameter big you *might* expect
that it would still be possible to quickly move windows accross viewports
(provided that the second paramter is small), but changing viewports
just for the sake of changing them would be slow and difficult. Fvwm
does not work this way. If you set the first parameter to 2500, there is a
2.5 second delay when moving windows accross the screen border. Since we
are changing viewports, this behavior is consistent with the description, but
is still unexpected, and possibly undesireable, but I'm not sure.

The second parameter was designed to make it easy to line windows up on the 
screen edge, not to make it difficult to change pages. In fact, the second 
parameter kicks in when the moved-window's edge is on the screen edge,
not when the cursor is on the screen edge.

I think MB wants to have the first edge-resistance parameter ignored when
he's moving windows. I don't know if this is generally desireable or not.

Rob

Note: try using this function in place of all your "Move"s:

AddToFunc MoveFunc	"I" EdgeResistance 0 100
+			"I" Move
+			"I" EdgeResistance 1500 100

Which is kinda neat, and does what you want without re-coding fvwm.

Rob

---

From: Mike Blatchley <[email-masked]>
Date: Fri, 5 Jan 1996 11:59:01 -0700 (MST)

> he's moving windows. I don't know if this is generally desireable or not.

Well, I'm _not_ trying to move into the next virtual screen;  just trying to
move the window right to the edge of the screen I'm on.  So, I _don't_ want
the parameter ignored when moving windows.  The problem is, if the mouse
pointer touches the screen edge during the move (happens easily when quickly
moving a window to the top of the screen by dragging the title bar), then the
ScrollResistance timer (in function HandlePaging in file virtual.c) does not
get canceled if the pointer is immediately RETRACTED from the screen edge. 

It looks to me that the XCheckWindowEvent(dpy,Scr.PanFrameXXXXXX.win,
LeaveWindowMask,&Event) events are never being seen when _moving_ a window
and the pointer Leaves the PanFrame windows (remember folks, yesterday I
said I've _never_ done any X programming, so I hope I don't say anything
stupid!).  This event should be seen and cancel the timer if the pointer
is retracted from the screen edge.  I don't know if the PanFrameXXXXX
windows are just not being seen because the window we are moving is on the
top, or what.  So, I modified the HandlePaging function and added a
mouse pointer location check after all the LeaveWindow checks (I have 
added the -->> symbols here only to point out the new lines): 

  total = 0;
  while(total < Scr.ScrollResistance)
    {
      sleep_a_little(10000);
      total+=10;
-->>  /* should I do the XQueryPointer here???  See below */
      if(XCheckWindowEvent(dpy,Scr.PanFrameTop.win,
                           LeaveWindowMask,&Event))
        {
          StashEventTime(&Event);
          return;
        }
      if(XCheckWindowEvent(dpy,Scr.PanFrameBottom.win,
                           LeaveWindowMask,&Event))
        {
          StashEventTime(&Event);
          return;
        }
      if(XCheckWindowEvent(dpy,Scr.PanFrameLeft.win,
                           LeaveWindowMask,&Event))
        {
          StashEventTime(&Event);
          return;
        }      
      if(XCheckWindowEvent(dpy,Scr.PanFrameRight.win,
                           LeaveWindowMask,&Event))
        {
          StashEventTime(&Event);
          return;
        }
      
-->>  XQueryPointer(dpy, Scr.Root, &JunkRoot, &JunkChild,
-->>            &x, &y, &JunkX, &JunkY, &JunkMask);
-->>  
-->>  if(( x >= SCROLL_REGION)&&( x < Scr.MyDisplayWidth-SCROLL_REGION)&&
-->>     ( y >= SCROLL_REGION)&&( y < Scr.MyDisplayHeight-SCROLL_REGION))
-->>    return;
-->>
    }
  
On my quick check last night, this works and properly aborts the timer if the
pointer is retracted from the screen edges when doing a window move. 
However, what happens if in between the XCheckWindowEvent's and my
XQueryPointer, X does detect one of the LeaveWindow events.  The
XCheckWindowEvent will have missed it, but the XQueryPointer+conditional will
catch it and return.  StashEventTime (I'm not even 100% sure what that does)
would never get called for that event since my conditional check can do
nothing but return. Does it put that event in a queue?  Then what would
happen to it?  Is this even an issue?  If so, would it be safer to put the
XQueryPointer right after the 'total+=10;' statement and leave the
conditional check at the bottom (I think probably so). 

Thanks for the input.

Mike Blatchley
[email-masked]

---

From: [email-masked] (Robert Nation 885-9815)
Date: Tue, 9 Jan 96 08:58:24 EST

>StashEventTime (I'm not even 100% sure what that does)
>nothing but return. Does it put that event in a queue? 

StashEventTime just records the time-stamp of an event for use in future
communications with the x server. Since XQueryPointer doesn't return an event,
you don't need to worry about it.
--
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].