From 203780eb6e1358d6d2790311eb31f7751884bf95 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sat, 10 Jul 1999 10:24:31 +0000 Subject: [PATCH] Removed all EVENT_Synchronize( FALSE ) calls; use a periodic callback calling XFlush() instead. --- include/message.h | 4 ++-- include/ttydrv.h | 2 +- include/x11drv.h | 2 +- scheduler/synchro.c | 14 -------------- windows/event.c | 4 ++-- windows/ttydrv/event.c | 2 +- windows/winpos.c | 4 ++-- windows/x11drv/event.c | 22 ++++++++++++++++++---- windows/x11drv/keyboard.c | 2 -- windows/x11drv/monitor.c | 2 -- windows/x11drv/wnd.c | 4 ++-- 11 files changed, 29 insertions(+), 33 deletions(-) diff --git a/include/message.h b/include/message.h index ec352755b12..85ed316837e 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 d77dc46b957..687a6ce4f7c 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 e835df47744..e6921ce8846 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 7c57e516881..bd8724b8fef 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 c1c2f30a28c..9320cc194ff 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 0814b7798f6..8cf2f31f9a3 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 fc22cae0aed..087be53b533 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 d44c171a8db..cc7209f5d2c 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 46c25ae3a5b..6ae37313a64 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 a143d57fd14..ccd9b7720fe 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 5076b7e6744..96ed420d272 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(); } /***********************************************************************