hw/xwin: Minimize redraw events after resizing/moving windows in multiwindow mode

In multiwindow mode the modal moving/resizing of windows causes a lot of redraw
events to be sent to the X clients after the user releases the mouse button.
During the moving/resizing client windows are not redrawn as long as the mouse
button is pressed, but all redraw/resizing events are queued and executed step
after step after the moving/resizing ends.

Some clients collect and combine multiple redraw or resizing events, other
clients (e.g. xterm) simply execute each redraw or sizing event.

The enclosed patch minimizes the events for clients to only one event after the
user releases the mouse button to end the moving/resizing. This improves the
user experience and reduces strange screen flickerings, especially on slow
platforms.

The enclosed patch modifies winmultiwindowwndproc.c such that the windows events
WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE that are sent by Windows when the modal
window resizing/moving begins or ends are considered. Only after WM_EXITSIZEMOVE
is the redraw/resizing executed.

Signed-off-by: Oliver Schmidt <oschmidt-mailinglists@gmx.de>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Oliver Schmidt 2011-09-07 14:00:56 +01:00 committed by Jon TURNEY
parent 03e1cc6f25
commit 3b4d472b72

View File

@ -316,6 +316,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
static Bool s_fTracking = FALSE;
Bool needRestack = FALSE;
LRESULT ret;
static Bool hasEnteredSizeMove = FALSE;
#if CYGDEBUG
winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam,
@ -872,7 +873,9 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOVE:
/* Adjust the X Window to the moved Windows window */
winAdjustXWindow(pWin, hwnd);
if (!hasEnteredSizeMove)
winAdjustXWindow(pWin, hwnd);
/* else: Wait for WM_EXITSIZEMOVE */
return 0;
case WM_SHOWWINDOW:
@ -1005,6 +1008,16 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
*/
break;
case WM_ENTERSIZEMOVE:
hasEnteredSizeMove = TRUE;
return 0;
case WM_EXITSIZEMOVE:
/* Adjust the X Window to the moved Windows window */
hasEnteredSizeMove = FALSE;
winAdjustXWindow(pWin, hwnd);
return 0;
case WM_SIZE:
/* see dix/window.c */
#if CYGWINDOWING_DEBUG
@ -1029,8 +1042,11 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
(int) (GetTickCount()));
}
#endif
/* Adjust the X Window to the moved Windows window */
winAdjustXWindow(pWin, hwnd);
if (!hasEnteredSizeMove) {
/* Adjust the X Window to the moved Windows window */
winAdjustXWindow(pWin, hwnd);
}
/* else: wait for WM_EXITSIZEMOVE */
return 0; /* end of WM_SIZE handler */
case WM_STYLECHANGING: