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]

Re: Problem with Multiwindow Mode and Maximizing


Howdy again,

At 05:42 PM 5/11/2003 -0400, you wrote:
I looked at this and was unable to figure out what the problem is.
You are correct that it is a problem.
The window flashing is something that Windows does to help you visualize that the window is being maximized. It occurs even when we don't do anything in our handling of the maximize message.
It appears that we must resize our own window when the maximize message arrives, but I can't seem to get this to work correctly. Perhaps I will look at it another day.

What's going on is that Windoze sends a WM_MOVE prior to the WM_SIZE when you maximize a window. That WM_MOVE invoked the x-move-window function which then merrily overrides the new window size because the drawable hasn't been updated. Windows then sends the WM_SIZE/SIZE_MAXIMIZED but it sends the LPARAM with the size that the WM_MOVE set, not the maximized sire.

An easy solution that I was able to get into about 10 lines is to just defer
the WM_MOVE when you see the window is maximized, and handle it in the WM_SIZE
routine.  A patch (against my earlier multiscreen file) is attached below
that does just that.  The only problem is that when you restore the window
the position is set to the same as where it was maximized to (0,0 on single
monitor systems).  Any ideas appreciated, but we don't get a SIZE_UNMINIMIZING
indication so it's not just a simple matter of caching and restoring the X/Y
at some later time...

The first part just bails out of the WM_SIZE handler if it's maximized,
and the 2nd one in WM_SIZE takes care of moving the X backing window to
the real X/Y that the Windows window has already moved to. That Client2Screen()
is needed to handle the case where you have >1 monitor, maximized windows
then can be at any X/Y.


-----------8<------------
--- winmultiwindowwindow.c 2003-05-11 17:34:28.000000000 -0700
+++ /tmp/winmultiwindowwindow.c 2003-05-11 17:37:05.000000000 -0700
@@ -1088,14 +1088,6 @@
if (pWinPriv->iX == (short) LOWORD(lParam)
&& pWinPriv->iY == (short) HIWORD(lParam))
break;
- /* Also bail if we're maximizing, we'll do the whole thing in WM_SIZE */
- {
- WINDOWPLACEMENT windPlace;
- windPlace.length = sizeof(WINDOWPLACEMENT);
- GetWindowPlacement(hwnd, &windPlace);
- if (windPlace.showCmd==SW_MAXIMIZE || windPlace.showCmd==SW_SHOWMAXIMIZED)
- break;
- }


       /* Get new position */
       pWinPriv->iX = (short) LOWORD(lParam);
@@ -1233,19 +1225,6 @@
          ErrorF ("\t(%d, %d)\n", pWinPriv->iWidth, pWinPriv->iHeight);
 #endif

- /* If we're maximizing the window has been moved to upper left */
- /* of current screen. Now it is safe for X to know about this. */
- if (wParam==SIZE_MAXIMIZED) {
- POINT home;
- 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));
- }
-
winResizeXWindow (pWin,
LOWORD(lParam),
HIWORD(lParam));
--------------8<-----------------------



-Earle F. Philhower, III earle@ziplabel.com cdrlabel - ZipLabel - FlpLabel http://www.cdrlabel.com


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