winex11.drv: Throttle calls to XResetScreenSaver.

Frequent calls to XResetScreenSaver cause performance problems on some
GPU drivers, see https://bugs.freedesktop.org/show_bug.cgi?id=110659

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Andrew Eikum 2019-09-17 08:09:36 -05:00 committed by Alexandre Julliard
parent f05dd8cba5
commit cb703739e5
1 changed files with 12 additions and 2 deletions

View File

@ -1793,10 +1793,20 @@ static LRESULT CALLBACK desktop_wndproc_wrapper( HWND hwnd, UINT msg, WPARAM wp,
switch (msg)
{
case WM_WINE_NOTIFY_ACTIVITY:
XResetScreenSaver( gdi_display );
XFlush( gdi_display );
{
static ULONGLONG last = 0;
ULONGLONG now = GetTickCount64();
/* calling XResetScreenSaver too often can cause performance
* problems, so throttle it */
if (now > last + 5000)
{
XResetScreenSaver( gdi_display );
XFlush( gdi_display );
last = now;
}
break;
}
}
return desktop_orig_wndproc( hwnd, msg, wp, lp );
}