On Thu, 29 Sep 2005, Dominik Vogt wrote:
On Thu, Sep 29, 2005 at 02:09:49AM -0500, fvwm-workers wrote:
CVSROOT:        /home/cvs/fvwm
Module name:    fvwm
Changes by:     griph   05/09/29 02:09:48

Modified files:
        .              : ChangeLog NEWS
        fvwm           : frame.c move_resize.c

Log message:
fixes for resizing shaded windows, and windows changed by complex functions
as
AddToFunc ResizeShadedOpaque
+ I WindowShade off
+ I Resize
+ I WindowShade on

Can you please post the diffs on frame.c and explain what you
did?  I've been working on some resize-when-shaded issues a
while ago but had to stop because the patch became too
difficult to manage and I wanted to think more about it first.

The diffs is attached. The first two hunks are for the complex function fix. There I simply unset the pressed window part if it has moved, to avoid it being used as a starting point for resizes.

The last hunk is for the resizing of the client area of shaded windows. The only change is that, for shaded windows, the get_client_geometry function (that calculates the client geometry based on the frame and border) is used instead of querying the geometry of the client window. That makes the unshading to resize the client window to the correct size during the unshade, and not to the size it had when the window was first shaded.


Also, latest CVS does not compile without warnings:
[snip]
Ooops. Sorry about that. What was the compiler flags that should be used to disable all ignorable warnings?

(I'll fix that).

thanks

/Viktor
--- frame.c.~1.60.~     2005-09-20 23:15:34.000000000 +0200
+++ frame.c     2005-09-29 08:39:46.000000000 +0200
@@ -45,6 +45,8 @@
 
 /* ---------------------------- imports ------------------------------------ */
 
+extern Window PressedW;
+
 /* ---------------------------- included code files ------------------------ */
 
 /* ---------------------------- local types -------------------------------- */
@@ -290,15 +292,53 @@
                }
                if (diff_g != NULL)
                {
+                       /* Reset PressedW to NULL if the part has moved.
+                        * This prevents strange ref points from being used 
+                        * in resize if the window is unshaded or moved via a
+                        * complex function before a resize. 
+                        * If this isn't desired a flag will be needed to
+                        * indicate that a part has moved. */
                        if (part == PART_BORDER_NE || part == PART_BORDER_E ||
                            part == PART_BORDER_SE)
                        {
                                xwc.x -= diff_g->width;
+                               if (PressedW == FW_W_SIDE(fw,1) ||
+                                   PressedW == FW_W_CORNER(fw, 1) ||
+                                   PressedW == FW_W_CORNER(fw, 3))
+                               {
+                                       PressedW = NULL;
+                               }
                        }
                        if (part == PART_BORDER_SW || part == PART_BORDER_S ||
                            part == PART_BORDER_SE)
                        {
                                xwc.y -= diff_g->height;
+                               if (PressedW == FW_W_SIDE(fw,2)||
+                                   PressedW == FW_W_CORNER(fw, 2) ||
+                                   PressedW == FW_W_CORNER(fw, 3))
+                               {
+                                       PressedW = NULL;
+                               }
+                       }
+                       if (part == PART_BORDER_SW || part == PART_BORDER_W ||
+                           part == PART_BORDER_NW)
+                       {
+                               if (PressedW == FW_W_SIDE(fw,3)||
+                                   PressedW == FW_W_CORNER(fw, 0) ||
+                                   PressedW == FW_W_CORNER(fw, 2))
+                               {
+                                       PressedW = NULL;
+                               }
+                       }
+                       if (part == PART_BORDER_NW || part == PART_BORDER_N ||
+                           part == PART_BORDER_NE)
+                       {
+                               if (PressedW == FW_W_SIDE(fw,0)||
+                                   PressedW == FW_W_CORNER(fw, 0) ||
+                                   PressedW == FW_W_CORNER(fw, 1))
+                               {
+                                       PressedW = NULL;
+                               }
                        }
                }
                XConfigureWindow(dpy, w, CWWidth | CWHeight | CWX | CWY, &xwc);
@@ -1755,20 +1795,31 @@
        mra->w_with_focus = (fw == get_focus_window()) ? FW_W(fw) : None;
 
        /* calculate various geometries */
-       rc = XGetGeometry(
-               dpy, FW_W(fw), &JunkRoot, &mra->client_g.x, &mra->client_g.y,
-               &mra->client_g.width, &mra->client_g.height, &JunkBW,
-               &JunkDepth);
-       if (rc == True)
-       {
-               rc = XTranslateCoordinates(
-                       dpy, FW_W_PARENT(fw), Scr.Root, mra->client_g.x,
-                       mra->client_g.y, &mra->client_g.x, &mra->client_g.y,
-                       &JunkChild);
+       if (!IS_SHADED(fw))
+       {
+               rc = XGetGeometry(
+                       dpy, FW_W(fw), &JunkRoot, &mra->client_g.x,
+                       &mra->client_g.y, &mra->client_g.width,
+                       &mra->client_g.height, &JunkBW, &JunkDepth);
+               if (rc == True)
+               {
+                       rc = XTranslateCoordinates(
+                               dpy, FW_W_PARENT(fw), Scr.Root,
+                               mra->client_g.x, mra->client_g.y,
+                               &mra->client_g.x, &mra->client_g.y,
+                               &JunkChild);
+               }
+               if (rc == False)
+               {
+                       /* Can only happen if the window died */
+                       get_client_geometry(fw, &mra->client_g);
+               }
        }
-       if (rc == False)
+       else
        {
-               /* Can only happen if the window died */
+               /* If the window was reisez while shaded the client window
+                * will not have been resized. Use the frame to get the
+                * geometry */
                get_client_geometry(fw, &mra->client_g);
        }
        get_window_borders(fw, &mra->b_g);

Reply via email to