mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 00:13:37 +00:00
win32u: Expose and use ProcessEvents from drivers instead of MsgWaitForMultipleObjectsEx.
This commit is contained in:
parent
13a65b849e
commit
a97fd9f29e
|
@ -1449,7 +1449,6 @@ static void update_now( HWND hwnd, UINT rdw_flags )
|
|||
*/
|
||||
BOOL WINAPI NtUserRedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags )
|
||||
{
|
||||
LARGE_INTEGER zero = { .QuadPart = 0 };
|
||||
static const RECT empty;
|
||||
BOOL ret;
|
||||
|
||||
|
@ -1470,7 +1469,7 @@ BOOL WINAPI NtUserRedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT fla
|
|||
}
|
||||
|
||||
/* process pending expose events before painting */
|
||||
if (flags & RDW_UPDATENOW) user_driver->pMsgWaitForMultipleObjectsEx( 0, NULL, &zero, QS_PAINT, 0 );
|
||||
if (flags & RDW_UPDATENOW) user_driver->pProcessEvents( QS_PAINT );
|
||||
|
||||
if (rect && !hrgn)
|
||||
{
|
||||
|
|
|
@ -806,13 +806,9 @@ static void nulldrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rec
|
|||
{
|
||||
}
|
||||
|
||||
static NTSTATUS nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
|
||||
const LARGE_INTEGER *timeout,
|
||||
DWORD mask, DWORD flags )
|
||||
static BOOL nulldrv_ProcessEvents( DWORD mask )
|
||||
{
|
||||
if (!count && timeout && !timeout->QuadPart) return WAIT_TIMEOUT;
|
||||
return NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
|
||||
!!(flags & MWMO_ALERTABLE), timeout );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void nulldrv_ReleaseDC( HWND hwnd, HDC hdc )
|
||||
|
@ -1193,7 +1189,7 @@ static const struct user_driver_funcs lazy_load_driver =
|
|||
nulldrv_DestroyWindow,
|
||||
loaderdrv_FlashWindowEx,
|
||||
loaderdrv_GetDC,
|
||||
nulldrv_MsgWaitForMultipleObjectsEx,
|
||||
nulldrv_ProcessEvents,
|
||||
nulldrv_ReleaseDC,
|
||||
nulldrv_ScrollDC,
|
||||
nulldrv_SetCapture,
|
||||
|
@ -1268,7 +1264,7 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version
|
|||
SET_USER_FUNC(DestroyWindow);
|
||||
SET_USER_FUNC(FlashWindowEx);
|
||||
SET_USER_FUNC(GetDC);
|
||||
SET_USER_FUNC(MsgWaitForMultipleObjectsEx);
|
||||
SET_USER_FUNC(ProcessEvents);
|
||||
SET_USER_FUNC(ReleaseDC);
|
||||
SET_USER_FUNC(ScrollDC);
|
||||
SET_USER_FUNC(SetCapture);
|
||||
|
|
|
@ -750,8 +750,7 @@ BOOL WINAPI NtUserGetCursorInfo( CURSORINFO *info )
|
|||
|
||||
static void check_for_events( UINT flags )
|
||||
{
|
||||
LARGE_INTEGER zero = { .QuadPart = 0 };
|
||||
if (user_driver->pMsgWaitForMultipleObjectsEx( 0, NULL, &zero, flags, 0 ) == WAIT_TIMEOUT)
|
||||
if (!user_driver->pProcessEvents( flags ))
|
||||
flush_window_surfaces( TRUE );
|
||||
}
|
||||
|
||||
|
|
|
@ -2086,9 +2086,8 @@ static inline void check_for_driver_events( UINT msg )
|
|||
{
|
||||
if (get_user_thread_info()->message_count > 200)
|
||||
{
|
||||
LARGE_INTEGER zero = { .QuadPart = 0 };
|
||||
flush_window_surfaces( FALSE );
|
||||
user_driver->pMsgWaitForMultipleObjectsEx( 0, NULL, &zero, QS_ALLINPUT, 0 );
|
||||
user_driver->pProcessEvents( QS_ALLINPUT );
|
||||
}
|
||||
else if (msg == WM_TIMER || msg == WM_SYSTIMER)
|
||||
{
|
||||
|
@ -2117,13 +2116,20 @@ static DWORD wait_message( DWORD count, const HANDLE *handles, DWORD timeout, DW
|
|||
if (enable_thunk_lock)
|
||||
lock = KeUserModeCallback( NtUserThunkLock, NULL, 0, &ret_ptr, &ret_len );
|
||||
|
||||
ret = user_driver->pMsgWaitForMultipleObjectsEx( count, handles, get_nt_timeout( &time, timeout ),
|
||||
mask, flags );
|
||||
if (HIWORD(ret)) /* is it an error code? */
|
||||
if (user_driver->pProcessEvents( mask )) ret = count ? count - 1 : 0;
|
||||
else if (count)
|
||||
{
|
||||
RtlSetLastWin32Error( RtlNtStatusToDosError(ret) );
|
||||
ret = WAIT_FAILED;
|
||||
ret = NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
|
||||
!!(flags & MWMO_ALERTABLE), get_nt_timeout( &time, timeout ));
|
||||
if (ret == count - 1) user_driver->pProcessEvents( mask );
|
||||
else if (HIWORD(ret)) /* is it an error code? */
|
||||
{
|
||||
RtlSetLastWin32Error( RtlNtStatusToDosError(ret) );
|
||||
ret = WAIT_FAILED;
|
||||
}
|
||||
}
|
||||
else ret = WAIT_TIMEOUT;
|
||||
|
||||
if (ret == WAIT_TIMEOUT && !count && !timeout) NtYieldExecution();
|
||||
if ((mask & QS_INPUT) == QS_INPUT) get_user_thread_info()->message_count = 0;
|
||||
|
||||
|
|
|
@ -89,9 +89,7 @@ extern SHORT ANDROID_VkKeyScanEx( WCHAR ch, HKL hkl ) DECLSPEC_HIDDEN;
|
|||
extern void ANDROID_SetCursor( HCURSOR handle ) DECLSPEC_HIDDEN;
|
||||
extern BOOL ANDROID_CreateWindow( HWND hwnd ) DECLSPEC_HIDDEN;
|
||||
extern void ANDROID_DestroyWindow( HWND hwnd ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS ANDROID_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
|
||||
const LARGE_INTEGER *timeout,
|
||||
DWORD mask, DWORD flags ) DECLSPEC_HIDDEN;
|
||||
extern BOOL ANDROID_ProcessEvents( DWORD mask ) DECLSPEC_HIDDEN;
|
||||
extern LRESULT ANDROID_DesktopWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) DECLSPEC_HIDDEN;
|
||||
extern void ANDROID_SetCursor( HCURSOR handle ) DECLSPEC_HIDDEN;
|
||||
extern void ANDROID_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha,
|
||||
|
|
|
@ -352,7 +352,7 @@ static const struct user_driver_funcs android_drv_funcs =
|
|||
.pCreateWindow = ANDROID_CreateWindow,
|
||||
.pDesktopWindowProc = ANDROID_DesktopWindowProc,
|
||||
.pDestroyWindow = ANDROID_DestroyWindow,
|
||||
.pMsgWaitForMultipleObjectsEx = ANDROID_MsgWaitForMultipleObjectsEx,
|
||||
.pProcessEvents = ANDROID_ProcessEvents,
|
||||
.pSetCapture = ANDROID_SetCapture,
|
||||
.pSetLayeredWindowAttributes = ANDROID_SetLayeredWindowAttributes,
|
||||
.pSetParent = ANDROID_SetParent,
|
||||
|
|
|
@ -1200,20 +1200,17 @@ LRESULT ANDROID_DesktopWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
|
|||
|
||||
|
||||
/***********************************************************************
|
||||
* ANDROID_MsgWaitForMultipleObjectsEx
|
||||
* ANDROID_ProcessEvents
|
||||
*/
|
||||
NTSTATUS ANDROID_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
|
||||
const LARGE_INTEGER *timeout,
|
||||
DWORD mask, DWORD flags )
|
||||
BOOL ANDROID_ProcessEvents( DWORD mask )
|
||||
{
|
||||
if (GetCurrentThreadId() == desktop_tid)
|
||||
{
|
||||
/* don't process nested events */
|
||||
if (current_event) mask = 0;
|
||||
if (process_events( mask )) return count - 1;
|
||||
return process_events( mask );
|
||||
}
|
||||
return NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
|
||||
!!(flags & MWMO_ALERTABLE), timeout );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
|
|
@ -510,24 +510,16 @@ static int process_events(macdrv_event_queue queue, macdrv_event_mask mask)
|
|||
|
||||
|
||||
/***********************************************************************
|
||||
* MsgWaitForMultipleObjectsEx (MACDRV.@)
|
||||
* ProcessEvents (MACDRV.@)
|
||||
*/
|
||||
NTSTATUS macdrv_MsgWaitForMultipleObjectsEx(DWORD count, const HANDLE *handles,
|
||||
const LARGE_INTEGER *timeout, DWORD mask, DWORD flags)
|
||||
NTSTATUS macdrv_ProcessEvents(DWORD mask)
|
||||
{
|
||||
DWORD ret;
|
||||
struct macdrv_thread_data *data = macdrv_thread_data();
|
||||
macdrv_event_mask event_mask = get_event_mask(mask);
|
||||
|
||||
TRACE("count %d, handles %p, timeout %p, mask %x, flags %x\n", (unsigned int)count,
|
||||
handles, timeout, (unsigned int)mask, (unsigned int)flags);
|
||||
TRACE("mask %x\n", (unsigned int)mask);
|
||||
|
||||
if (!data)
|
||||
{
|
||||
if (!count && timeout && !timeout->QuadPart) return WAIT_TIMEOUT;
|
||||
return NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
|
||||
!!(flags & MWMO_ALERTABLE), timeout );
|
||||
}
|
||||
if (!data) return FALSE;
|
||||
|
||||
if (data->current_event && data->current_event->type != QUERY_EVENT &&
|
||||
data->current_event->type != QUERY_EVENT_NO_PREEMPT_WAIT &&
|
||||
|
@ -535,14 +527,5 @@ NTSTATUS macdrv_MsgWaitForMultipleObjectsEx(DWORD count, const HANDLE *handles,
|
|||
data->current_event->type != WINDOW_DRAG_BEGIN)
|
||||
event_mask = 0; /* don't process nested events */
|
||||
|
||||
if (process_events(data->queue, event_mask)) ret = count - 1;
|
||||
else if (count || !timeout || timeout->QuadPart)
|
||||
{
|
||||
ret = NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
|
||||
!!(flags & MWMO_ALERTABLE), timeout );
|
||||
if (ret == count - 1) process_events(data->queue, event_mask);
|
||||
}
|
||||
else ret = WAIT_TIMEOUT;
|
||||
|
||||
return ret;
|
||||
return process_events(data->queue, event_mask);
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ static const struct user_driver_funcs macdrv_funcs =
|
|||
.pGetKeyboardLayoutList = macdrv_GetKeyboardLayoutList,
|
||||
.pGetKeyNameText = macdrv_GetKeyNameText,
|
||||
.pMapVirtualKeyEx = macdrv_MapVirtualKeyEx,
|
||||
.pMsgWaitForMultipleObjectsEx = macdrv_MsgWaitForMultipleObjectsEx,
|
||||
.pProcessEvents = macdrv_ProcessEvents,
|
||||
.pRegisterHotKey = macdrv_RegisterHotKey,
|
||||
.pSetCapture = macdrv_SetCapture,
|
||||
.pSetCursor = macdrv_SetCursor,
|
||||
|
|
|
@ -169,9 +169,7 @@ extern INT macdrv_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyStat
|
|||
extern INT macdrv_GetKeyNameText(LONG lparam, LPWSTR buffer, INT size) DECLSPEC_HIDDEN;
|
||||
extern BOOL macdrv_SystemParametersInfo(UINT action, UINT int_param, void *ptr_param,
|
||||
UINT flags) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS macdrv_MsgWaitForMultipleObjectsEx(DWORD count, const HANDLE *handles,
|
||||
const LARGE_INTEGER *timeout, DWORD mask,
|
||||
DWORD flags) DECLSPEC_HIDDEN;
|
||||
extern BOOL macdrv_ProcessEvents(DWORD mask) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_ThreadDetach(void) DECLSPEC_HIDDEN;
|
||||
|
||||
|
||||
|
|
|
@ -472,33 +472,16 @@ static BOOL process_events( Display *display, Bool (*filter)(Display*, XEvent*,X
|
|||
|
||||
|
||||
/***********************************************************************
|
||||
* MsgWaitForMultipleObjectsEx (X11DRV.@)
|
||||
* ProcessEvents (X11DRV.@)
|
||||
*/
|
||||
NTSTATUS X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
|
||||
const LARGE_INTEGER *timeout, DWORD mask, DWORD flags )
|
||||
BOOL X11DRV_ProcessEvents( DWORD mask )
|
||||
{
|
||||
struct x11drv_thread_data *data = x11drv_thread_data();
|
||||
NTSTATUS ret;
|
||||
|
||||
if (!data)
|
||||
{
|
||||
if (!count && timeout && !timeout->QuadPart) return WAIT_TIMEOUT;
|
||||
return NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
|
||||
!!(flags & MWMO_ALERTABLE), timeout );
|
||||
}
|
||||
|
||||
if (!data) return FALSE;
|
||||
if (data->current_event) mask = 0; /* don't process nested events */
|
||||
|
||||
if (process_events( data->display, filter_event, mask )) ret = count - 1;
|
||||
else if (count || !timeout || timeout->QuadPart)
|
||||
{
|
||||
ret = NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
|
||||
!!(flags & MWMO_ALERTABLE), timeout );
|
||||
if (ret == count - 1) process_events( data->display, filter_event, mask );
|
||||
}
|
||||
else ret = WAIT_TIMEOUT;
|
||||
|
||||
return ret;
|
||||
return process_events( data->display, filter_event, mask );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -413,7 +413,7 @@ static const struct user_driver_funcs x11drv_funcs =
|
|||
.pDestroyWindow = X11DRV_DestroyWindow,
|
||||
.pFlashWindowEx = X11DRV_FlashWindowEx,
|
||||
.pGetDC = X11DRV_GetDC,
|
||||
.pMsgWaitForMultipleObjectsEx = X11DRV_MsgWaitForMultipleObjectsEx,
|
||||
.pProcessEvents = X11DRV_ProcessEvents,
|
||||
.pReleaseDC = X11DRV_ReleaseDC,
|
||||
.pScrollDC = X11DRV_ScrollDC,
|
||||
.pSetCapture = X11DRV_SetCapture,
|
||||
|
|
|
@ -691,9 +691,7 @@ extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN;
|
|||
extern BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) DECLSPEC_HIDDEN;
|
||||
extern void move_resize_window( HWND hwnd, int dir ) DECLSPEC_HIDDEN;
|
||||
extern void X11DRV_InitKeyboard( Display *display ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
|
||||
const LARGE_INTEGER *timeout,
|
||||
DWORD mask, DWORD flags ) DECLSPEC_HIDDEN;
|
||||
extern BOOL X11DRV_ProcessEvents( DWORD mask ) DECLSPEC_HIDDEN;
|
||||
extern HWND *build_hwnd_list(void) DECLSPEC_HIDDEN;
|
||||
|
||||
typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void *arg );
|
||||
|
|
|
@ -308,7 +308,7 @@ struct user_driver_funcs
|
|||
void (*pDestroyWindow)(HWND);
|
||||
void (*pFlashWindowEx)(FLASHWINFO*);
|
||||
void (*pGetDC)(HDC,HWND,HWND,const RECT *,const RECT *,DWORD);
|
||||
NTSTATUS (*pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,const LARGE_INTEGER*,DWORD,DWORD);
|
||||
BOOL (*pProcessEvents)(DWORD);
|
||||
void (*pReleaseDC)(HWND,HDC);
|
||||
BOOL (*pScrollDC)(HDC,INT,INT,HRGN);
|
||||
void (*pSetCapture)(HWND,UINT);
|
||||
|
|
Loading…
Reference in a new issue