public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
* minimize redraw events after resizing/moving windows in multiwindow mode
@ 2011-08-20 22:11 Oliver Schmidt
  2011-09-07 13:16 ` Jon TURNEY
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Schmidt @ 2011-08-20 22:11 UTC (permalink / raw)
  To: cygwin-xfree

[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]

Hi,

in multiwindow mode the modal moving/resizing of windows causes a lot of 
redraw events send to the X clients after the userse 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 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 are considered that 
are send from windows if the modal window resizing/moving begins or 
ends. Only after WM_EXITSIZEMOVE the redraw/resizing is executed. The 
patch is against the sources of xserver-cygwin version 1.10.3-1.

Best regards,
Oliver

[-- Attachment #2: patch04.txt --]
[-- Type: text/plain, Size: 1928 bytes --]

diff --git a/cygwin/hw/xwin/winmultiwindowwndproc.c b/cygwin/hw/xwin/winmultiwindowwndproc.c
index bd84c05..5f536d0 100644
--- a/cygwin/hw/xwin/winmultiwindowwndproc.c
+++ b/cygwin/hw/xwin/winmultiwindowwndproc.c
@@ -321,6 +321,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
   static Bool		s_fTracking = FALSE;
   Bool			needRestack = FALSE;
   LRESULT		ret;
+  static Bool           hasEnteredSizeMove = FALSE;
 
 #if CYGDEBUG
   winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam, lParam);
@@ -871,7 +872,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
 
     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:
@@ -1012,6 +1014,16 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
       */
       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
@@ -1036,9 +1048,13 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
 		(int)(GetTickCount ()));
       }
 #endif
-      /* Adjust the X Window to the moved Windows window */
-      winAdjustXWindow (pWin, hwnd);
-      if (wParam == SIZE_MINIMIZED) winReorderWindowsMultiWindow();
+      if (!hasEnteredSizeMove)
+        {
+          /* Adjust the X Window to the moved Windows window */
+          winAdjustXWindow (pWin, hwnd);
+          if (wParam == SIZE_MINIMIZED) winReorderWindowsMultiWindow();
+        }
+        /* else: wait for WM_EXITSIZEMOVE */
       return 0; /* end of WM_SIZE handler */
 
     case WM_STYLECHANGING:


[-- Attachment #3: Type: text/plain, Size: 223 bytes --]

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: minimize redraw events after resizing/moving windows in multiwindow mode
  2011-08-20 22:11 minimize redraw events after resizing/moving windows in multiwindow mode Oliver Schmidt
@ 2011-09-07 13:16 ` Jon TURNEY
  0 siblings, 0 replies; 2+ messages in thread
From: Jon TURNEY @ 2011-09-07 13:16 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: oschmidt-mailinglists

On 20/08/2011 23:11, Oliver Schmidt wrote:
> in multiwindow mode the modal moving/resizing of windows causes a lot of
> redraw events send to the X clients after the userse 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 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.

Thanks for the patch.

I've applied it to my git tree [1], so it will appear in the next cygwin X 
server release (probably 1.11.0-1)

[1] 
http://cgit.freedesktop.org/~jturney/xserver/commit/?h=cygwin-release-1.11&id=784ef7472904cbac6ea49d8cf0e489820372a90d

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-07 13:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-20 22:11 minimize redraw events after resizing/moving windows in multiwindow mode Oliver Schmidt
2011-09-07 13:16 ` Jon TURNEY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).