This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for maximize-restore positioning


I thought about it some more and it's not too hard to restore the proper
position of a maximized window, we WILL get a WM_SIZE when it's restored,
we just need to cache a flag saying that for this WM_SIZE event we
need to move the window...

Here's a diff -U3 patch.  We need to change winwindow.h and
winmultiwindow.c...

-----------8<-------------------------
--- winmultiwindowwindow.c      2003-05-12 13:31:05.000000000 -0700
+++ /tmp/x/newwinmultiwindowwindow.c    2003-05-11 17:49:31.000000000 -0700
@@ -126,7 +126,6 @@
   pWinPriv->hWnd = NULL;
   pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen);
   pWinPriv->fXKilled = FALSE;
-  pWinPriv->fNeedRestore = FALSE;

   return fResult;
 }
@@ -1238,31 +1237,14 @@
          /* of current screen.  Now it is save for X to know about this. */
          if (wParam==SIZE_MAXIMIZED) {
            POINT home;
-
-           pWinPriv->fNeedRestore = TRUE;
-           pWinPriv->ptRestore.x = pWinPriv->iX;
-           pWinPriv->ptRestore.y = pWinPriv->iY;
            home.x = 0;
            home.y = 0;
            ClientToScreen(hwnd, &home);
-
            /* Map from screen (-X,-Y) to (0,0) root coords */
            winMoveXWindow (pWin,
                            home.x - wBorderWidth (pWin) - GetSystemMetrics(SM_XVIRTUALSCREEN),
                            home.y  - wBorderWidth (pWin) - GetSystemMetrics(SM_YVIRTUALSCREEN));
-         } else if (wParam==SIZE_RESTORED && pWinPriv->fNeedRestore) {
-           /* If need restore and !maximized then move to cached position */
-            WINDOWPLACEMENT windPlace;
-            windPlace.length = sizeof(WINDOWPLACEMENT);
-            GetWindowPlacement(hwnd, &windPlace);
-            if (windPlace.showCmd!=SW_MAXIMIZE && windPlace.showCmd!=SW_SHOWMAXIMIZED)
-            {
-             pWinPriv->fNeedRestore = FALSE;
-              winMoveXWindow (pWin,
-                              pWinPriv->ptRestore.x  - wBorderWidth (pWin) - GetSystemMetrics(SM_XVIRTUALSCREEN),
-                              pWinPriv->ptRestore.y - wBorderWidth (pWin) - GetSystemMetrics(SM_YVIRTUALSCREEN));
-           }
-         }
+         }

          winResizeXWindow (pWin,
                           LOWORD(lParam),
@@ -1365,8 +1347,6 @@
 }

--------8<----------------------
--- winwindow.h 2003-05-12 11:45:28.000000000 -0700
+++ /tmp/x/winwindow.h  2003-05-01 09:31:04.000000000 -0700
@@ -70,8 +70,6 @@
   int                  iWidth;
   int                  iHeight;
   Bool                 fXKilled;
-  Bool                  fNeedRestore;
-  POINT                 ptRestore;
 } winPrivWinRec, *winPrivWinPtr;

 typedef struct _winWMMessageRec{
------------------8<--------------------
-- 
-Earle F. Philhower, III
 earle@ziplabel.com
 http://www.ziplabel.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]