Subject: Misc patches, trying to fix placing bugs

From: Tim Phipps <[email-masked]>
Date: Mon, 23 Nov 1998 17:34:18 +0000

Dear All,
	I've been trying to fix a bug in placing at geometry +x-0.  I haven't
succeeded but wading through the code has thrown up a few fixes I'd like
to go in.  These are:

1) add_window.c:  sets borderwidth of shaped windows to 0 (try oclock
-geometry -0-0). Sets reparenting window background to none, this is an
ancient bug I've wanted to fix for ages that makes a window flash as it
dies, most noticeable on slow servers.

2) fvwm.h: cleaned up some pan frame stuff

3) virtual.c: made sure appropriate pan frames are visible

Cheers,
Tim

Index: add_window.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/add_window.c,v
retrieving revision 1.11
diff -u -B -b -u -r1.11 add_window.c
--- add_window.c	1998/11/23 10:40:06	1.11
+++ add_window.c	1998/11/23 17:19:35
@@ -91,8 +91,8 @@
   unsigned long valuemask;		/* mask for create windows */
 #if defined(PIXMAP_BUTTONS) && defined(BORDERSTYLE)
   Pixmap TexturePixmap = None, TexturePixmapSave = None;
-  unsigned long valuemask_save = 0;
 #endif
+  unsigned long valuemask_save = 0;
   XSetWindowAttributes attributes;	/* attributes for create windows */
   name_list styles;                     /* area for merged styles */
   int i,width,height;
@@ -217,6 +217,11 @@
 
   SelectDecor(tmp_win,styles.on_flags,styles.border_width,styles.resize_width);
 
+#ifdef SHAPE
+  /* set boundary width to zero for shaped windows */
+  if (tmp_win->wShaped) tmp_win->boundary_width = 0;
+#endif /* SHAPE */
+
   tmp_win->flags |= styles.on_flags & ALL_COMMON_FLAGS;
   /* find a suitable icon pixmap */
   if(styles.on_flags & ICON_FLAG)
@@ -457,6 +462,11 @@
 
   /* Thats not all, we'll double-reparent the window ! */
   attributes.cursor = Scr.FvwmCursors[DEFAULT];
+
+  /* make sure this does not have a BackPixel or BackPixmap so that
+     that when the window dies there is no flash of BackPixel/BackPixmap */
+  valuemask_save = valuemask;
+  valuemask = valuemask & ~CWBackPixel & ~CWBackPixmap;
   tmp_win->Parent =
     XCreateWindow (dpy, tmp_win->frame,
 		   tmp_win->boundary_width,
@@ -465,6 +475,7 @@
 		   (tmp_win->frame_height - 2*tmp_win->boundary_width -
 		    tmp_win->title_height),tmp_win->bw, CopyFromParent,
 		   InputOutput,CopyFromParent, valuemask,&attributes);
+  valuemask = valuemask_save;
 
   attributes.event_mask = (ButtonPressMask|ButtonReleaseMask|ExposureMask|
 			   EnterWindowMask|LeaveWindowMask);
Index: fvwm.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/fvwm.h,v
retrieving revision 1.4
diff -u -B -b -u -r1.4 fvwm.h
--- fvwm.h	1998/11/20 10:18:37	1.4
+++ fvwm.h	1998/11/23 17:20:23
@@ -47,7 +47,7 @@
 
 /* use PanFrames! this replaces the 3 pixel margin with PanFrame windows
 it should not be an option, once it works right. HEDU 2/2/94 */
-#define PAN_FRAME_THICKNESS 2	/* or just 1 ? */
+#define PAN_FRAME_THICKNESS 1
 
 /* the maximum number of mouse buttons fvwm knows about */
 /* don't think that upping this to 5 will make everything
@@ -70,7 +70,7 @@
 # define HEIGHT_EXTRA_TITLE 4	/* Extra height for underlining title */
 # define HEIGHT_SEPARATOR 4	/* Height of separator lines */
 
-#define SCROLL_REGION 2         /* region around screen edge that */
+#define SCROLL_REGION PAN_FRAME_THICKNESS /* region around screen edge that */
                                 /* triggers scrolling */
 
 #ifndef TRUE                    
@@ -338,11 +338,6 @@
 extern Window JunkRoot, JunkChild;
 extern int JunkX, JunkY;
 extern unsigned int JunkWidth, JunkHeight, JunkBW, JunkDepth, JunkMask;
-
-#ifdef PAN_FRAMES
-extern void checkPanFrames();
-extern void raisePanFrames();
-#endif
 
 extern Atom _XA_MIT_PRIORITY_COLORS;
 extern Atom _XA_WM_CHANGE_STATE;
Index: virtual.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/virtual.c,v
retrieving revision 1.9
diff -u -B -b -u -r1.9 virtual.c
--- virtual.c	1998/11/23 10:40:07	1.9
+++ virtual.c	1998/11/23 17:21:03
@@ -158,6 +158,7 @@
   else
     *yt = y - *delta_y;
 
+  /* make sure the pointer isn't warped into the panframes */
   if(*xl <= SCROLL_REGION) *xl = SCROLL_REGION+1;
   if(*yt <= SCROLL_REGION) *yt = SCROLL_REGION+1;
   if(*xl >= Scr.MyDisplayWidth - SCROLL_REGION)
@@ -231,7 +232,7 @@
       XUnmapWindow(dpy,Scr.PanFrameLeft.win);
       Scr.PanFrameLeft.isMapped=False;
     }
-  else if (Scr.Vx > 0 && Scr.PanFrameLeft.isMapped==False)
+  else if ((Scr.Vx > 0 || wrapX) && Scr.PanFrameLeft.isMapped==False)
     {
       XMapRaised(dpy,Scr.PanFrameLeft.win);
       Scr.PanFrameLeft.isMapped=True;
@@ -242,7 +243,7 @@
       XUnmapWindow (dpy,Scr.PanFrameRight.win);
       Scr.PanFrameRight.isMapped=False;
     }
-  else if (Scr.Vx < Scr.VxMax && Scr.PanFrameRight.isMapped==False)
+  else if ((Scr.Vx < Scr.VxMax || wrapX) && Scr.PanFrameRight.isMapped==False)
     {
       XMapRaised(dpy,Scr.PanFrameRight.win);
       Scr.PanFrameRight.isMapped=True;
@@ -253,7 +254,7 @@
       XUnmapWindow(dpy,Scr.PanFrameTop.win);
       Scr.PanFrameTop.isMapped=False;
     }
-  else if (Scr.Vy > 0 && Scr.PanFrameTop.isMapped==False)
+  else if ((Scr.Vy > 0 || wrapY) && Scr.PanFrameTop.isMapped==False)
     {
       XMapRaised(dpy,Scr.PanFrameTop.win);
       Scr.PanFrameTop.isMapped=True;
@@ -264,7 +265,7 @@
       XUnmapWindow (dpy,Scr.PanFrameBottom.win);
       Scr.PanFrameBottom.isMapped=False;
     }
-  else if (Scr.Vy < Scr.VyMax && Scr.PanFrameBottom.isMapped==False)
+  else if ((Scr.Vy < Scr.VyMax || wrapY) && Scr.PanFrameBottom.isMapped==False)
     {
       XMapRaised(dpy,Scr.PanFrameBottom.win);
       Scr.PanFrameBottom.isMapped=True;