Subject: opaque resizing

From: Tony Finch <[email-masked]>
Date: Sat, 11 Sep 1999 01:53:31 +0100

This patch implements opaque resizing using the same condition as
opaque moving (i.e. the window must be less that OpaqueMoveSize
percent of the screen area).

Tony.
-- 
f.a.n.finch    [email-masked]    [email-masked]    e pluribus unix

--- resize.c.old        Sat Sep 11 01:23:37 1999
+++ resize.c    Sat Sep 11 01:39:18 1999
@@ -38,7 +38,8 @@
 extern Window PressedW;
 
 static void DoResize(int x_root, int y_root, FvwmWindow *tmp_win,
-                    geom *drag, geom *orig, int *xmotionp, int *ymotionp);
+                    geom *drag, geom *orig, int *xmotionp, int *ymotionp,
+                    Bool opaque);
 
 /****************************************************************************
  *
@@ -48,7 +49,7 @@
 void resize_window(XEvent *eventp,Window w,FvwmWindow *tmp_win,
                   unsigned long context, char *action,int *Module)
 {
-  Bool finished = FALSE, done = FALSE, abort = FALSE;
+  Bool finished = FALSE, done = FALSE, abort = FALSE, opaque = FALSE;
   int x,y,delta_x,delta_y,stashed_x,stashed_y;
   Window ResizeWindow;
   Bool flags;
@@ -122,9 +123,6 @@
       return;
     }
 
-  MyXGrabServer(dpy);
-
-
   /* handle problems with edge-wrapping while resizing */
   flags = Scr.flags;
   Scr.flags &= ~(EdgeWrapX|EdgeWrapY);
@@ -133,6 +131,12 @@
               &drag->x, &drag->y, (unsigned int *)&drag->width,
               (unsigned int *)&drag->height, &JunkBW,&JunkDepth);
 
+  if(drag->width*drag->height < 
+     (Scr.OpaqueSize*Scr.MyDisplayWidth*Scr.MyDisplayHeight)/100)
+    opaque = True;
+  else
+    MyXGrabServer(dpy);
+
   drag->x += tmp_win->bw;
   drag->y += tmp_win->bw;
   orig->x = drag->x;
@@ -178,15 +182,16 @@
        }
     }
   /* draw the rubber-band window */
-  MoveOutline (Scr.Root, drag->x - tmp_win->bw, drag->y - tmp_win->bw,
-              drag->width - 1 + 2 * tmp_win->bw,
-              drag->height - 1 + 2 * tmp_win->bw);
+  if(!opaque)
+    MoveOutline(Scr.Root, drag->x - tmp_win->bw, drag->y - tmp_win->bw,
+               drag->width - 1 + 2 * tmp_win->bw,
+               drag->height - 1 + 2 * tmp_win->bw);
   /* kick off resizing without requiring any motion if invoked with a key press */
   if (eventp->type == KeyPress)
     {
       XQueryPointer(dpy, Scr.Root, &JunkRoot, &JunkChild,
                     &stashed_x,&stashed_y,&JunkX, &JunkY, &JunkMask);
-      DoResize(stashed_x, stashed_y, tmp_win, drag, orig, &xmotion, &ymotion);
+      DoResize(stashed_x, stashed_y, tmp_win, drag, orig, &xmotion, &ymotion, opaque);
     }
   else
     stashed_x = stashed_y = -1;
@@ -257,7 +262,7 @@
          y = Event.xmotion.y_root;
          /* resize before paging request to prevent resize from lagging
           * mouse - mab */
-         DoResize(x, y, tmp_win, drag, orig, &xmotion, &ymotion);
+         DoResize(x, y, tmp_win, drag, orig, &xmotion, &ymotion, opaque);
          /* need to move the viewport */
          HandlePaging(Scr.EdgeScrollX,Scr.EdgeScrollY,&x,&y,
                       &delta_x,&delta_y,False);
@@ -269,13 +274,13 @@
            drag->x -= delta_x;
            drag->y -= delta_y;
 
-           DoResize(x, y, tmp_win, drag, orig, &xmotion, &ymotion);
+           DoResize(x, y, tmp_win, drag, orig, &xmotion, &ymotion, opaque);
          }
          done = TRUE;
        default:
          break;
        }
-      if(!done)
+      if(!done && !opaque)
        {
          MoveOutline(Scr.Root,0,0,0,0);
          DispatchEvent();
@@ -287,12 +292,13 @@
     }
 
   /* erase the rubber-band */
-  MoveOutline(Scr.Root, 0, 0, 0, 0);
+  if(!opaque)
+    MoveOutline(Scr.Root, 0, 0, 0, 0);
 
   /* pop down the size window */
   XUnmapWindow(dpy, Scr.SizeWindow);
 
-  if(!abort)
+  if(!abort && !opaque)
     {
       /* size will be >= to requested */
       ConstrainSize (tmp_win, &drag->width, &drag->height, True, xmotion,
@@ -302,7 +308,8 @@
     }
   UninstallRootColormap();
   ResizeWindow = None;
-  MyXUngrabServer(dpy);
+  if(!opaque)
+    MyXUngrabServer(dpy);
   UngrabEm();
   xmotion = 0;
   ymotion = 0;
@@ -331,7 +338,8 @@
  *
  ************************************************************************/
 static void DoResize(int x_root, int y_root, FvwmWindow *tmp_win,
-                    geom *drag, geom *orig, int *xmotionp, int *ymotionp)
+                    geom *drag, geom *orig, int *xmotionp, int *ymotionp,
+                    Bool opaque)
 {
   int action=0;
 
@@ -379,9 +387,13 @@
       if (*ymotionp == 1)
        drag->y = orig->y + orig->height - drag->height;
 
-      MoveOutline(Scr.Root, drag->x - tmp_win->bw,drag->y - tmp_win->bw,
-                 drag->width - 1 + 2 * tmp_win->bw,
-                 drag->height - 1 + 2 * tmp_win->bw);
+      if(!opaque)
+       MoveOutline(Scr.Root, drag->x - tmp_win->bw,drag->y - tmp_win->bw,
+                   drag->width - 1 + 2 * tmp_win->bw,
+                   drag->height - 1 + 2 * tmp_win->bw);
+      else
+       SetupFrame(tmp_win, drag->x - tmp_win->bw,
+                  drag->y - tmp_win->bw, drag->width, drag->height, FALSE);
     }
   DisplaySize(tmp_win, drag->width, drag->height,False,False);
 }
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
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: Dominik Vogt <[email-masked]>
Date: Sun, 19 Sep 1999 21:11:06 +0200

> percent of the screen area).

Well, I took a few hours to rewrite that patch for 2.3.x.
There is a new style 'ResizeOpaque' to activate opaque
resizing:

  style * ResizeOpaque

or

  Style xterm ResizeOpaque

Bye

Dominik ^_^

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
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]