diff --git a/include/message.h b/include/message.h index ec352755b123d4ea4e1e636ab15bc36a6c6dc222..85ed316837ee275d239bc2e32a9b58778e1340be 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 d77dc46b957e5113bd1e459862c1304efae95a57..687a6ce4f7cd31a2db8ebddc51998eda803a6d41 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 e835df47744bcb990c0be5d1ba63a22a21fe68d8..e6921ce88467f6602a502887c23569fef2f7730a 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 7c57e5168818c3b3c36268e354bacaeb8d868a4f..bd8724b8fef75f6fc7c2ec8146a4f3aaa68aa7a7 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 c1c2f30a28c2706a735015f65f8b200a33419dc2..9320cc194ff301c4278b0634d66a19824c165cb9 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 0814b7798f62c3deb7b519e2720899158f2115b9..8cf2f31f9a37ecabff7cbe2dc785385b2837887c 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 fc22cae0aed83570a7d43b6dbc44db87d1ecab19..087be53b533e9fab202942c8cdc9fdd7ae1879a0 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 d44c171a8dbf853ca0f0dfa01e91483f087c3822..cc7209f5d2c950cc3b40c4807c7b86fcc10ce16a 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 46c25ae3a5bd2c43479af74e3e156487e9c1252a..6ae37313a642c666c93b973345a3e969d4415be1 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 a143d57fd148060a7e4b2bdb862ab112c4588754..ccd9b7720fe751b0647ac57e3a131cb82128256f 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 5076b7e6744d2de98a90ce679fe526fe2c4428f1..96ed420d27278e70faded807959ab12a1341f656 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(); } /***********************************************************************