Subject: FVWM: EdgeResistance and Focus

From: Kai Grossjohann <[email-masked]>
Date: 19 Mar 1996 20:19:25 +0100

Dear all,

I've followed the development of fvwm rather closely, and finally I've
switched to using it.  Of course, I want fvwm to have all features
under the sun, but I think the following are not unreasonable:

  - When the mouse pointer is warped to a window (with Focus, say), it
    is warped to the upper left hand corner.  Is there a way to have
    it warpt to the center instead?

  - When I have "EdgeResistance 100 50", say, I cannot move a window
    N<50 pixels off-screen.  Olwm allowed one to first move a window
    more than 50 pixels off-screen then move back and thereby N<50
    pixels were possible.  Using fvwm, the window snaps back to the
    edge of the screen as soon as it gets to within 50 pixels of the
    edge of the screen.

  - Fvwm doesn't understand "-0" in the X-offset or Y-offset fields of
    a geometry specification.

I'll wait for the Great Style Flag Rewrite for per-window AutoRaise
(and AutoLower, aka FvwmClean).

        kai
--
~/.signature
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
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: tim werner <[email-masked]>
Date: Tue, 19 Mar 1996 14:30:00 -0500

>From: Kai Grossjohann <[email-masked]>
>Date: 19 Mar 1996 20:19:25 +0100

>switched to using it.

And about time!  :-)

>Of course, I want fvwm to have all features

I have just a question for the list, actually, not a response to Kai's
post.  But I am wondering about a phenomenon that I only noticed today
(after more than a year with fvwm).

If I stretch the window horizontally while it's vertically maximized, it
loses track of the fact that it used to be some other vertical size, and
I cannot get back to the original vertical size without an explicit
re-size.  I.e., the title-bar button doesn't work to vertically shrink
the window back.

Is this the current operation?  If so, I wish it weren't.  I think I am
using Fvwm Ver 2.0 pl 32.

best regards,
tw

--
The moon's disc bores into the lake,
but the water shows no scar...
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
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: Dan Espen <[email-masked]>
Date: Tue, 19 Mar 1996 15:10:27 -0500

----------
>     it warpt to the center instead?

My favorite question.

You can't get exactly what you describe, but you can get close:

# Simulate the Warp function from older fvwm
AddToFunc Warp "I" Next [$1] Iconify -1
+	       "I" Next [$1] focus
+              "I" CursorMove 2 2
+              "I" None [$1] Beep
+              "I" None [$1] CursorMove -2 -2

Use it like this:

Key f R N Warp "FvwmIconBox" FvwmIconBox

This  function  moves 2 pixels   down and 2 pixels   right  to get the
pointer  fully into   the window.  It  is also   possible to  write  a
function that takes arguments for how far to  move.  I don't know of a
way to get exactly to the center of any window.

Can't help on your other questions.

--
Dan Espen                                    Phone: (908) 699-5570
[email-masked]
444 Hoes Lane  Room RRC 1C-214
Piscataway, NJ 08854
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
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: "David A. Berson" <[email-masked]>
Date: Tue, 19 Mar 1996 19:10:05 -0500 (EST)

> You can't get exactly what you describe, but you can get close:

[...]

I made a suggestion here a while ago that X and Y percentages be added to the
warp function.  So, "warp 0 0" gives the current behaviour, "warp 0 100"
puts the pointer in the lower left corner, and "warp 50 50" gives the
commonly desired behavior of centering the pointer, all independent of
the window size.

David A. Berson.

---

From: "David A. Berson" <[email-masked]>
Date: Tue, 19 Mar 1996 19:10:05 -0500 (EST)

[...]

David A. Berson.

---

From: Henrique Martins <[email-masked]>
Date: Tue, 19 Mar 1996 23:16:06 -0800

kai>  When the mouse pointer is warped to a window (with Focus, say), it
kai>  is warped to the upper left hand corner.  Is there a way to have
kai>  it warpt to the center instead?

david>  I made a suggestion here a while ago that X and Y percentages be
david>  added to the warp function.  So, "warp 0 0" gives the current
david>  behaviour, "warp 0 100" puts the pointer in the lower left corner,
david>  and "warp 50 50" gives the commonly desired behavior of centering
david>  the pointer, all independent of the window size.

  Without going into the merits of warping to the middle vs the upper left
  corner, the patch below should accomplish what David describes.  

  I made Focus == Focus 0 0, i.e. no parameters equals current behavior.
  Should this patch have no adverse side effects (aka bugs) and be
  integrated in the main version, Focus == Focus 50 50, could be an
  alternative.

  The patch below was minimally tested. It should apply cleanly against
  2.0.41.

  -- Henrique ([email-masked])

*** misc.h.orig	Tue Mar 19 21:44:59 1996
--- misc.h	Tue Mar 19 21:45:05 1996
***************
*** 274,280 ****
  void KeepOnTop(void);
  void show_panner(void);
  void WaitForButtonsUp(void);
! void FocusOn(FvwmWindow *t,int DeIconifyOnly);
  Bool PlaceWindow(FvwmWindow *tmp_win, unsigned long flags,int Desk);
  void free_window_names (FvwmWindow *tmp, Bool nukename, Bool nukeicon);
  
--- 274,280 ----
  void KeepOnTop(void);
  void show_panner(void);
  void WaitForButtonsUp(void);
! void FocusOn(FvwmWindow *t,int DeIconifyOnly,int percentX,int percentY);
  Bool PlaceWindow(FvwmWindow *tmp_win, unsigned long flags,int Desk);
  void free_window_names (FvwmWindow *tmp, Bool nukename, Bool nukeicon);
  
*** builtins.c.orig	Tue Mar 19 21:23:28 1996
--- builtins.c	Tue Mar 19 23:12:58 1996
***************
*** 150,156 ****
   * Moves focus to specified window 
   *
   *************************************************************************/
! void FocusOn(FvwmWindow *t,int DeIconifyOnly)
  {
  #ifndef NON_VIRTUAL
    int dx,dy;
--- 150,156 ----
   * Moves focus to specified window 
   *
   *************************************************************************/
! void FocusOn(FvwmWindow *t,int DeIconifyOnly,int percentX, int percentY)
  {
  #ifndef NON_VIRTUAL
    int dx,dy;
***************
*** 191,198 ****
    }
    else
    {
!     x = t->frame_x;
!     y = t->frame_y;
    }
    if(!(t->flags & ClickToFocus))
      XWarpPointer(dpy, None, Scr.Root, 0, 0, 0, 0, x+2,y+2);
--- 191,200 ----
    }
    else
    {
!     x = t->frame_x + (t->frame_width * percentX) / 100;
!     y = t->frame_y + (t->frame_height * percentY) / 100;
!     if (x == t->frame_x + t->frame_width) x--;
!     if (y == t->frame_y + t->frame_height) y--;
    }
    if(!(t->flags & ClickToFocus))
      XWarpPointer(dpy, None, Scr.Root, 0, 0, 0, 0, x+2,y+2);
***************
*** 705,715 ****
  
    if(val1 != 0)
    {
!     FocusOn((FvwmWindow *)val1,0);
      if (((FvwmWindow *)(val1))->flags & ICONIFIED)
      {
        DeIconify((FvwmWindow *)val1);
!       FocusOn((FvwmWindow *)val1,0);
      }
    }
  }
--- 707,717 ----
  
    if(val1 != 0)
    {
!     FocusOn((FvwmWindow *)val1,0,0,0);
      if (((FvwmWindow *)(val1))->flags & ICONIFIED)
      {
        DeIconify((FvwmWindow *)val1);
!       FocusOn((FvwmWindow *)val1,0,0,0);
      }
    }
  }
***************
*** 718,727 ****
  void focus_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
  		unsigned long context, char *action, int *Module)
  {
    if (DeferExecution(eventp,&w,&tmp_win,&context,SELECT,ButtonRelease))
      return;
  
!   FocusOn(tmp_win,0);
  }

--- 720,738 ----
  void focus_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
  		unsigned long context, char *action, int *Module)
  {
+   int val1, val2, val1_unit, val2_unit, n;
+   
+   n = GetTwoArguments(action, &val1, &val2, &val1_unit, &val2_unit);
+ 
+   if (n != 2 || val1 < 0 || val1 > 100 || val2 < 0 || val2 > 100) {
+     val1 = 0;
+     val2 = 0;
+   }
+ 
    if (DeferExecution(eventp,&w,&tmp_win,&context,SELECT,ButtonRelease))
      return;
  
!   FocusOn(tmp_win,0,val1,val2);
  }

*** icons.c.orig	Tue Mar 19 21:43:11 1996
--- icons.c	Tue Mar 19 21:43:13 1996
***************
*** 730,741 ****
      }
  
    if(tmp_win->flags & ClickToFocus)
!     FocusOn(tmp_win,1);
  
    KeepOnTop();
  
    return;
! }

  /****************************************************************************
--- 730,743 ----
      }
  
    if(tmp_win->flags & ClickToFocus)
!     FocusOn(tmp_win,1,0,0);
  
    KeepOnTop();
  
    return;
! } 
!  
!  

  /****************************************************************************