tags 241469 + patch
thanks

I'm using this patch successfully.  It's all fairly simple.

-zefram

diff -ru3 ./xc/programs/twm/add_window.c 
../build-tree.new/xc/programs/twm/add_window.c
--- ./xc/programs/twm/add_window.c      2002-12-10 22:28:07.000000000 +0000
+++ ../build-tree.new/xc/programs/twm/add_window.c      2004-10-23 
11:38:10.000000000 +0100
@@ -596,6 +596,9 @@
 
            if (event.xbutton.button == Button2) {
                int lastx, lasty;
+               short saveOpaqueResize = Scr->OpaqueResize;
+
+               Scr->OpaqueResize = FALSE;
 
                Scr->SizeStringOffset = width +
                  MyFont_TextWidth(&Scr->SizeFont, ": ", 2);
@@ -645,6 +648,7 @@
                    if (event.type == ButtonRelease)
                    {
                        AddEndResize(tmp_win);
+                       Scr->OpaqueResize = saveOpaqueResize;
                        break;
                    }
 
diff -ru3 ./xc/programs/twm/parse.c ../build-tree.new/xc/programs/twm/parse.c
--- ./xc/programs/twm/parse.c   2002-12-10 22:29:55.000000000 +0000
+++ ../build-tree.new/xc/programs/twm/parse.c   2004-10-23 10:19:15.000000000 
+0100
@@ -368,6 +368,7 @@
 #define kw0_NoCaseSensitive            23
 #define kw0_NoRaiseOnWarp              24
 #define kw0_WarpUnmapped               25
+#define kw0_OpaqueResize               26
 
 #define kws_UsePPosition               1
 #define kws_IconFont                   2
@@ -576,6 +577,7 @@
     { "notitlehighlight",      NO_TITLE_HILITE, 0 },
     { "noversion",             KEYWORD, kw0_NoVersion },
     { "opaquemove",            KEYWORD, kw0_OpaqueMove },
+    { "opaqueresize",          KEYWORD, kw0_OpaqueResize },
     { "pixmaps",               PIXMAPS, 0 },
     { "pointerbackground",     CKEYWORD, kwc_PointerBackground },
     { "pointerforeground",     CKEYWORD, kwc_PointerForeground },
@@ -754,6 +756,10 @@
       case kw0_WarpUnmapped:
        Scr->WarpUnmapped = TRUE;
        return 1;
+
+      case kw0_OpaqueResize:
+       Scr->OpaqueResize = TRUE;
+       return 1;
     }
 
     return 0;
diff -ru3 ./xc/programs/twm/resize.c ../build-tree.new/xc/programs/twm/resize.c
--- ./xc/programs/twm/resize.c  2001-12-14 20:01:09.000000000 +0000
+++ ../build-tree.new/xc/programs/twm/resize.c  2004-10-23 11:29:05.000000000 
+0100
@@ -163,7 +163,8 @@
     unsigned int junkbw, junkDepth;
 
     ResizeWindow = tmp_win->frame;
-    XGrabServer(dpy);
+    if(!Scr->NoGrabServer || !Scr->OpaqueResize)
+       XGrabServer(dpy);
     XGrabPointer(dpy, Scr->Root, True,
         ButtonPressMask | ButtonReleaseMask |
        ButtonMotionMask | PointerMotionHintMask,
@@ -193,10 +194,19 @@
     last_width = 0;
     last_height = 0;
     DisplaySize(tmp_win, origWidth, origHeight);
-    MoveOutline (Scr->Root, dragx - tmp_win->frame_bw,
-                dragy - tmp_win->frame_bw, dragWidth + 2 * tmp_win->frame_bw,
-                dragHeight + 2 * tmp_win->frame_bw,
-                tmp_win->frame_bw, tmp_win->title_height);
+    if(Scr->OpaqueResize)
+    {
+       if (!Scr->NoRaiseResize)
+           XRaiseWindow(dpy, tmp_win->frame);
+    }
+    else
+    {
+       MoveOutline (Scr->Root, dragx - tmp_win->frame_bw,
+                    dragy - tmp_win->frame_bw,
+                    dragWidth + 2 * tmp_win->frame_bw,
+                    dragHeight + 2 * tmp_win->frame_bw,
+                    tmp_win->frame_bw, tmp_win->title_height);
+    }
 }
 
 
@@ -206,7 +216,8 @@
 TwmWindow *tmp_win;
 int x, y, w, h;
 {
-    XGrabServer(dpy);
+    if(!Scr->NoGrabServer || !Scr->OpaqueResize)
+       XGrabServer(dpy);
     XGrabPointer(dpy, Scr->Root, True,
         ButtonPressMask | ButtonMotionMask | PointerMotionMask,
         GrabModeAsync, GrabModeAsync,
@@ -226,11 +237,12 @@
                   Scr->SizeFont.height + SIZE_VINDENT * 2);
     XMapRaised(dpy, Scr->SizeWindow);
     DisplaySize(tmp_win, origWidth, origHeight);
-    MoveOutline (Scr->Root, dragx - tmp_win->frame_bw,
-                dragy - tmp_win->frame_bw, 
-                dragWidth + 2 * tmp_win->frame_bw,
-                dragHeight + 2 * tmp_win->frame_bw,
-                tmp_win->frame_bw, tmp_win->title_height);
+    if(!Scr->OpaqueResize)
+       MoveOutline (Scr->Root, dragx - tmp_win->frame_bw,
+                    dragy - tmp_win->frame_bw, 
+                    dragWidth + 2 * tmp_win->frame_bw,
+                    dragHeight + 2 * tmp_win->frame_bw,
+                    tmp_win->frame_bw, tmp_win->title_height);
 }
 
 /***********************************************************************
@@ -368,12 +380,17 @@
             dragx = origx + origWidth - dragWidth;
         if (clampTop)
             dragy = origy + origHeight - dragHeight;
-        MoveOutline(Scr->Root,
-            dragx - tmp_win->frame_bw,
-            dragy - tmp_win->frame_bw,
-            dragWidth + 2 * tmp_win->frame_bw,
-            dragHeight + 2 * tmp_win->frame_bw,
-           tmp_win->frame_bw, tmp_win->title_height);
+       if(Scr->OpaqueResize)
+           SetupWindow (tmp_win, dragx - tmp_win->frame_bw,
+                        dragy - tmp_win->frame_bw,
+                        dragWidth, dragHeight, -1);
+       else
+           MoveOutline(Scr->Root,
+               dragx - tmp_win->frame_bw,
+               dragy - tmp_win->frame_bw,
+               dragWidth + 2 * tmp_win->frame_bw,
+               dragHeight + 2 * tmp_win->frame_bw,
+               tmp_win->frame_bw, tmp_win->title_height);
     }
 
     DisplaySize(tmp_win, dragWidth, dragHeight);
@@ -491,12 +508,17 @@
             dragx = origx + origWidth - dragWidth;
         if (clampTop)
             dragy = origy + origHeight - dragHeight;
-        MoveOutline(Scr->Root,
-            dragx - tmp_win->frame_bw,
-            dragy - tmp_win->frame_bw,
-            dragWidth + 2 * tmp_win->frame_bw,
-            dragHeight + 2 * tmp_win->frame_bw,
-           tmp_win->frame_bw, tmp_win->title_height);
+       if(Scr->OpaqueResize)
+           SetupWindow (tmp_win, dragx - tmp_win->frame_bw,
+                        dragy - tmp_win->frame_bw,
+                        dragWidth, dragHeight, -1);
+       else
+           MoveOutline(Scr->Root,
+               dragx - tmp_win->frame_bw,
+               dragy - tmp_win->frame_bw,
+               dragWidth + 2 * tmp_win->frame_bw,
+               dragHeight + 2 * tmp_win->frame_bw,
+               tmp_win->frame_bw, tmp_win->title_height);
     }
 
     DisplaySize(tmp_win, dragWidth, dragHeight);
@@ -606,7 +628,7 @@
         PackIconManager(tmp_win->iconmgrp);
     }
 
-    if (!Scr->NoRaiseResize)
+    if (!Scr->OpaqueResize && !Scr->NoRaiseResize)
         XRaiseWindow(dpy, tmp_win->frame);
 
     UninstallRootColormap();
diff -ru3 ./xc/programs/twm/screen.h ../build-tree.new/xc/programs/twm/screen.h
--- ./xc/programs/twm/screen.h  2001-12-14 20:01:10.000000000 +0000
+++ ../build-tree.new/xc/programs/twm/screen.h  2004-10-23 10:19:38.000000000 
+0100
@@ -249,6 +249,7 @@
     short FirstTime;           /* first time we've read .twmrc */
     short CaseSensitive;       /* be case-sensitive when sorting names */
     short WarpUnmapped;                /* allow warping to unmapped windows */
+    short OpaqueResize;                /* resize the window rather than 
outline */
 
     FuncKey FuncKeyRoot;
 } ScreenInfo;
END_OF_PATCH

Reply via email to