Subject: FVWM CVS: fvwm domivogt

From: CVS <[email-masked]>
Date: Wed, 9 Dec 1998 20:37:10 -0600 (CST)

CVSROOT:	/home/cvs/fvwm
Module name:	fvwm
Changes by:	domivogt	98/12/09 20:37:10

Modified files:
	modules        : ChangeLog 
	modules/FvwmPager: x_pager.c 

Log message:
fixed bug #49 (this time the right way)

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Richard Lister <[email-masked]>
Date: Thu, 10 Dec 1998 12:12:56 -0500

On Wed, 9 Dec 1998 20:37:10 -0600 (CST)
CVS <[email-masked]> 
> fixed bug #49 (this time the right way)

Cool, that works. But you left out the reciprocal case of negative yoffset
and pager at the top of the screen. Here's a patch to deal with that,
and also adding some more comments. Oh, I'll throw in one for the man
page, too, so that people know why their yoffset is suddenly flipping
sign.

Ric

*** x_pager.c.orig	Thu Dec 10 11:14:43 1998
--- x_pager.c	Thu Dec 10 11:40:33 1998
***************
*** 1951,1972 ****
    XTranslateCoordinates(dpy, view, Scr.Root, x, y,
                          &window_changes.x, &window_changes.y, &dummy);
  
!   if ( window_changes.y + balloon.height >
!        Scr.MyDisplayHeight - (2 * balloon.border) - 2 )
!   {
!     y = -balloon.yoffset - balloon.height - (2 * balloon.border);
!     XTranslateCoordinates(dpy, view, Scr.Root, x, y,
! 			  &window_changes.x, &window_changes.y, &dummy);
!   }
    /* make sure balloon doesn't go off screen
       (actually 2 pixels from edge rather than 0 just to be pretty :-) */
    if ( window_changes.x < 2 )
      window_changes.x = 2;
    else if ( window_changes.x + window_changes.width >
              Scr.MyDisplayWidth - (2 * balloon.border) - 2 )
      window_changes.x = Scr.MyDisplayWidth - window_changes.width -
        (2 * balloon.border) - 2;
  
    XConfigureWindow(dpy, balloon.w, CWX | CWY | CWWidth, &window_changes);
  
    /* if background not set in config make it match pager window */
--- 1951,1987 ----
    XTranslateCoordinates(dpy, view, Scr.Root, x, y,
                          &window_changes.x, &window_changes.y, &dummy);
  
!   
    /* make sure balloon doesn't go off screen
       (actually 2 pixels from edge rather than 0 just to be pretty :-) */
+ 
+   /* too close to left */
    if ( window_changes.x < 2 )
      window_changes.x = 2;
+ 
+   /* too close to right */
    else if ( window_changes.x + window_changes.width >
              Scr.MyDisplayWidth - (2 * balloon.border) - 2 )
      window_changes.x = Scr.MyDisplayWidth - window_changes.width -
        (2 * balloon.border) - 2;
  
+   /* too close to top ... make yoffset +ve */
+   if ( window_changes.y < 2 ) {
+     y = - balloon.yoffset + view_height;
+     XTranslateCoordinates(dpy, view, Scr.Root, x, y,
+ 			  &window_changes.x, &window_changes.y, &dummy);
+   }
+ 
+   /* too close to bottom ... make yoffset -ve */
+   else if ( window_changes.y + balloon.height >
+ 	    Scr.MyDisplayHeight - (2 * balloon.border) - 2 ) {
+     y = - balloon.yoffset - balloon.height - (2 * balloon.border);
+     XTranslateCoordinates(dpy, view, Scr.Root, x, y,
+ 			  &window_changes.x, &window_changes.y, &dummy);
+   }
+ 
+ 
+   /* make changes to window */
    XConfigureWindow(dpy, balloon.w, CWX | CWY | CWWidth, &window_changes);
  
    /* if background not set in config make it match pager window */
*** FvwmPager.1.orig	Thu Dec 10 11:49:03 1998
--- FvwmPager.1	Thu Dec 10 11:51:21 1998
***************
*** 233,239 ****
  pixels above the pager window, positive offsets of \fI+n\fP are placed
  \fIn\fP pixels below. Offsets of 0 are not permitted, as this would permit
  direct transit from pager window to balloon window, causing an event
! loop. Defaults to +2.

  .SH AUTHOR
--- 233,240 ----
  pixels above the pager window, positive offsets of \fI+n\fP are placed
  \fIn\fP pixels below. Offsets of 0 are not permitted, as this would permit
  direct transit from pager window to balloon window, causing an event
! loop. Defaults to +2. The offset will change sign automatically, as needed,
! to keep the balloon on the screen.

  .SH AUTHOR