diff --git a/include/message.h b/include/message.h index ec352755b1..85ed316837 100644 --- a/include/message.h +++ b/include/message.h @@ -27,7 +27,7 @@ extern BOOL TIMER_GetTimerMsg( MSG *msg, HWND hwnd, /* event.c */ typedef struct tagEVENT_DRIVER { BOOL (*pInit)(void); - void (*pSynchronize)(BOOL); + void (*pSynchronize)(void); BOOL (*pCheckFocus)(void); BOOL (*pQueryPointer)(DWORD *, DWORD *, DWORD *); void (*pUserRepaintDisable)(BOOL); @@ -36,7 +36,7 @@ typedef struct tagEVENT_DRIVER { extern EVENT_DRIVER *EVENT_Driver; extern BOOL EVENT_Init( void ); -extern void EVENT_Synchronize( BOOL bProcessEvents ); +extern void EVENT_Synchronize( void ); extern BOOL EVENT_CheckFocus( void ); extern BOOL EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state); diff --git a/include/ttydrv.h b/include/ttydrv.h index d77dc46b95..687a6ce4f7 100644 --- a/include/ttydrv.h +++ b/include/ttydrv.h @@ -93,7 +93,7 @@ extern int TTYDRV_DESKTOP_GetScreenDepth(struct tagDESKTOP *pDesktop); extern struct tagEVENT_DRIVER TTYDRV_EVENT_Driver; extern BOOL TTYDRV_EVENT_Init(void); -extern void TTYDRV_EVENT_Synchronize(BOOL bProcessEvents); +extern void TTYDRV_EVENT_Synchronize(void); extern BOOL TTYDRV_EVENT_CheckFocus(void); extern BOOL TTYDRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state); extern void TTYDRV_EVENT_UserRepaintDisable(BOOL bDisable); diff --git a/include/x11drv.h b/include/x11drv.h index e835df4774..e6921ce884 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -343,7 +343,7 @@ extern int X11DRV_DESKTOP_GetScreenDepth(struct tagDESKTOP *pDesktop); extern struct tagEVENT_DRIVER X11DRV_EVENT_Driver; extern BOOL X11DRV_EVENT_Init(void); -extern void X11DRV_EVENT_Synchronize( BOOL bProcessEvents ); +extern void X11DRV_EVENT_Synchronize( void ); extern BOOL X11DRV_EVENT_CheckFocus( void ); extern BOOL X11DRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state); extern void X11DRV_EVENT_UserRepaintDisable( BOOL bDisable ); diff --git a/scheduler/synchro.c b/scheduler/synchro.c index 7c57e51688..bd8724b8fe 100644 --- a/scheduler/synchro.c +++ b/scheduler/synchro.c @@ -103,20 +103,6 @@ DWORD WINAPI WaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, return WAIT_FAILED; } - /* FIXME: This is extremely ugly, but needed to avoid endless - * recursion due to EVENT_Synchronize itself using - * EnterCriticalSection( &X11DRV_CritSection ) ... - */ - if ( count == 0 || handles[0] != X11DRV_CritSection.LockSemaphore ) - { - /* Before we might possibly block, we need to push outstanding - * graphics output to the X server ... This needs to be done - * here so that it also works with native USER. - */ - if ( timeout != 0 ) - EVENT_Synchronize( FALSE ); - } - req->count = count; req->flags = 0; req->timeout = timeout; diff --git a/windows/event.c b/windows/event.c index c1c2f30a28..9320cc194f 100644 --- a/windows/event.c +++ b/windows/event.c @@ -29,9 +29,9 @@ BOOL EVENT_Init(void) * * Synchronize with the X server. Should not be used too often. */ -void EVENT_Synchronize( BOOL bProcessEvents ) +void EVENT_Synchronize( void ) { - EVENT_Driver->pSynchronize( bProcessEvents ); + EVENT_Driver->pSynchronize(); } /********************************************************************** diff --git a/windows/ttydrv/event.c b/windows/ttydrv/event.c index 0814b7798f..8cf2f31f9a 100644 --- a/windows/ttydrv/event.c +++ b/windows/ttydrv/event.c @@ -17,7 +17,7 @@ BOOL TTYDRV_EVENT_Init(void) /*********************************************************************** * TTYDRV_EVENT_Synchronize */ -void TTYDRV_EVENT_Synchronize( BOOL bProcessEvents ) +void TTYDRV_EVENT_Synchronize( void ) { } diff --git a/windows/winpos.c b/windows/winpos.c index fc22cae0ae..087be53b53 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -2791,7 +2791,7 @@ Pos: /* ----------------------------------------------------------------------- /* ------------------------------------------------------------------------ FINAL */ if (wndPtr->flags & WIN_NATIVE) - EVENT_Synchronize( TRUE ); /* Synchronize with the host window system */ + EVENT_Synchronize(); /* Synchronize with the host window system */ if (!GetCapture() && ((wndPtr->dwStyle & WS_VISIBLE) || (flags & SWP_HIDEWINDOW))) { @@ -2877,7 +2877,7 @@ Pos: /* ----------------------------------------------------------------------- !(winpos.flags & SWP_NOSENDCHANGING)) ) { SendMessageA( winpos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&winpos ); - if (resync) EVENT_Synchronize ( TRUE ); + if (resync) EVENT_Synchronize(); } retvalue = TRUE; diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c index d44c171a8d..cc7209f5d2 100644 --- a/windows/x11drv/event.c +++ b/windows/x11drv/event.c @@ -78,6 +78,7 @@ static const char * const event_names[] = "ClientMessage", "MappingNotify" }; +static void CALLBACK EVENT_Flush( ULONG_PTR arg ); static void CALLBACK EVENT_ProcessAllEvents( ULONG_PTR arg ); static void EVENT_ProcessEvent( XEvent *event ); @@ -117,9 +118,24 @@ BOOL X11DRV_EVENT_Init(void) SERVICE_AddObject( FILE_DupUnixHandle( ConnectionNumber(display), GENERIC_READ | SYNCHRONIZE ), EVENT_ProcessAllEvents, 0 ); + + /* Install the XFlush timer callback */ + if ( Options.synchronous ) + TSXSynchronize( display, True ); + else + SERVICE_AddTimer( 200000L, EVENT_Flush, 0 ); + return TRUE; } +/*********************************************************************** + * EVENT_Flush + */ +static void CALLBACK EVENT_Flush( ULONG_PTR arg ) +{ + TSXFlush( display ); +} + /*********************************************************************** * EVENT_ProcessAllEvents */ @@ -146,12 +162,10 @@ static void CALLBACK EVENT_ProcessAllEvents( ULONG_PTR arg ) * * Synchronize with the X server. Should not be used too often. */ -void X11DRV_EVENT_Synchronize( BOOL bProcessEvents ) +void X11DRV_EVENT_Synchronize( void ) { TSXSync( display, False ); - - if ( bProcessEvents ) - EVENT_ProcessAllEvents( 0 ); + EVENT_ProcessAllEvents( 0 ); } /*********************************************************************** diff --git a/windows/x11drv/keyboard.c b/windows/x11drv/keyboard.c index 46c25ae3a5..6ae37313a6 100644 --- a/windows/x11drv/keyboard.c +++ b/windows/x11drv/keyboard.c @@ -1374,8 +1374,6 @@ BOOL X11DRV_KEYBOARD_GetDIData( /* FIXME !!! */ - EVENT_Synchronize( FALSE ); - if (entries) xentries = *entries; else diff --git a/windows/x11drv/monitor.c b/windows/x11drv/monitor.c index a143d57fd1..ccd9b7720f 100644 --- a/windows/x11drv/monitor.c +++ b/windows/x11drv/monitor.c @@ -166,8 +166,6 @@ void X11DRV_MONITOR_Initialize(MONITOR *pMonitor) else pX11Monitor->depth = DefaultDepthOfScreen( pX11Monitor->screen ); - if (Options.synchronous) TSXSynchronize( display, True ); - if (Options.desktopGeometry) X11DRV_MONITOR_CreateDesktop(pMonitor); else diff --git a/windows/x11drv/wnd.c b/windows/x11drv/wnd.c index 5076b7e674..96ed420d27 100644 --- a/windows/x11drv/wnd.c +++ b/windows/x11drv/wnd.c @@ -621,7 +621,7 @@ void X11DRV_WND_SetFocus(WND *wndPtr) if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE) TSXInstallColormap( display, X11DRV_PALETTE_PaletteXColormap ); - EVENT_Synchronize( TRUE ); + EVENT_Synchronize(); } /***************************************************************** @@ -670,7 +670,7 @@ void X11DRV_WND_SurfaceCopy(WND* wndPtr, DC *dcPtr, INT dx, INT dy, TSXSetGraphicsExposures( display, physDev->gc, False ); if (bUpdate) /* Make sure exposure events have been processed */ - EVENT_Synchronize( TRUE ); + EVENT_Synchronize(); } /***********************************************************************