diff -ur xserver-cygwin-1.13.0-1.orig/hw/xwin/win.h xserver-cygwin-1.13.0-1/hw/xwin/win.h --- xserver-cygwin-1.13.0-1.orig/hw/xwin/win.h 2012-12-10 15:19:42.093750000 +0100 +++ xserver-cygwin-1.13.0-1/hw/xwin/win.h 2012-12-10 15:27:40.031250000 +0100 @@ -595,6 +595,9 @@ UnrealizeFontPtr UnrealizeFont; #endif + /* mouse polling */ + BOOL bMousePollingTimerStoppedWhileMinimized; + } winPrivScreenRec; #ifdef XWIN_MULTIWINDOWEXTWM diff -ur xserver-cygwin-1.13.0-1.orig/hw/xwin/winmultiwindowwndproc.c xserver-cygwin-1.13.0-1/hw/xwin/winmultiwindowwndproc.c --- xserver-cygwin-1.13.0-1.orig/hw/xwin/winmultiwindowwndproc.c 2012-12-10 15:19:42.140625000 +0100 +++ xserver-cygwin-1.13.0-1/hw/xwin/winmultiwindowwndproc.c 2012-12-10 15:26:50.359375000 +0100 @@ -415,6 +415,22 @@ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) XMING_SIGNATURE); + /* + * Initialize variables for mouse polling in s_pScreenPriv. + * Need to initialize s_pSreenPriv first, as WIN_WINDOW_PROP + * was read before we set it in WM_CREATE + */ + if ((pWin = GetProp (hwnd, WIN_WINDOW_PROP)) != NULL) + { + /* Get a pointer to our window privates */ + pWinPriv = winGetWindowPriv(pWin); + + /* Get pointers to our screen privates and screen info */ + s_pScreenPriv = pWinPriv->pScreenPriv; + + s_pScreenPriv->bMousePollingTimerStoppedWhileMinimized = FALSE; + } + return 0; case WM_INIT_SYS_MENU: @@ -1007,6 +1023,27 @@ return 0; case WM_SIZE: + if(wParam == SIZE_MINIMIZED) + { + /* Kill the timer used to poll mouse events, if window gets minimized */ + if (g_uipMousePollingTimerID != 0) + { + KillTimer (s_pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID); + g_uipMousePollingTimerID = 0; + s_pScreenPriv->bMousePollingTimerStoppedWhileMinimized = TRUE; + } + } + else + { + /* If timer was killed on minimize, restart it */ + if(s_pScreenPriv->bMousePollingTimerStoppedWhileMinimized == TRUE) + { + s_pScreenPriv->bMousePollingTimerStoppedWhileMinimized = FALSE; + winStartMousePolling(s_pScreenPriv); + } + } + + /* see dix/window.c */ #if CYGWINDOWING_DEBUG { diff -ur xserver-cygwin-1.13.0-1.orig/hw/xwin/winwndproc.c xserver-cygwin-1.13.0-1/hw/xwin/winwndproc.c --- xserver-cygwin-1.13.0-1.orig/hw/xwin/winwndproc.c 2012-12-10 15:19:42.187500000 +0100 +++ xserver-cygwin-1.13.0-1/hw/xwin/winwndproc.c 2012-12-10 15:20:52.703125000 +0100 @@ -139,6 +139,10 @@ winInitNotifyIcon(s_pScreenPriv); } + + /* initialize variables for mouse polling in s_pScreenPriv */ + s_pScreenPriv->bMousePollingTimerStoppedWhileMinimized = FALSE; + return 0; case WM_DISPLAYCHANGE: