winemac: Fix implementation of the AllowVerticalSync registry setting.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2019-01-03 11:08:31 -06:00 committed by Alexandre Julliard
parent 14035b6d38
commit 40c5184a90
1 changed files with 11 additions and 8 deletions

View File

@ -1539,8 +1539,7 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share, uns
}
context->major = major;
if (allow_vsync)
InterlockedExchange(&context->update_swap_interval, TRUE);
InterlockedExchange(&context->update_swap_interval, TRUE);
TRACE("created context %p/%p/%p\n", context, context->context, context->cglcontext);
@ -1742,7 +1741,9 @@ static void sync_swap_interval(struct wgl_context *context)
{
int interval;
if (context->draw_hwnd)
if (!allow_vsync)
interval = 0;
else if (context->draw_hwnd)
{
struct macdrv_win_data *data = get_win_data(context->draw_hwnd);
if (data)
@ -3478,7 +3479,7 @@ static int macdrv_wglGetSwapIntervalEXT(void)
release_win_data(data);
if (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE))
set_swap_interval(context, value);
set_swap_interval(context, allow_vsync ? value : 0);
}
else
{
@ -3543,8 +3544,8 @@ static BOOL macdrv_wglMakeContextCurrentARB(HDC draw_hdc, HDC read_hdc, struct w
return FALSE;
}
if (allow_vsync && (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE) || hwnd != context->draw_hwnd))
set_swap_interval(context, data->swap_interval);
if (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE) || hwnd != context->draw_hwnd)
set_swap_interval(context, allow_vsync ? data->swap_interval : 0);
context->draw_hwnd = hwnd;
context->draw_view = data->client_cocoa_view;
@ -3569,8 +3570,7 @@ static BOOL macdrv_wglMakeContextCurrentARB(HDC draw_hdc, HDC read_hdc, struct w
return FALSE;
}
if (allow_vsync &&
(InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE) || pbuffer != context->draw_pbuffer))
if (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE) || pbuffer != context->draw_pbuffer)
set_swap_interval(context, 0);
}
else
@ -4115,6 +4115,9 @@ static BOOL macdrv_wglSwapIntervalEXT(int interval)
else /* pbuffer */
interval = 0;
if (!allow_vsync)
interval = 0;
InterlockedExchange(&context->update_swap_interval, FALSE);
if (!set_swap_interval(context, interval))
{