Removed all EVENT_Synchronize( FALSE ) calls; use a periodic callback

calling XFlush() instead.
This commit is contained in:
Ulrich Weigand 1999-07-10 10:24:31 +00:00 committed by Alexandre Julliard
parent e28224f0ea
commit 203780eb6e
11 changed files with 29 additions and 33 deletions

View file

@ -27,7 +27,7 @@ extern BOOL TIMER_GetTimerMsg( MSG *msg, HWND hwnd,
/* event.c */ /* event.c */
typedef struct tagEVENT_DRIVER { typedef struct tagEVENT_DRIVER {
BOOL (*pInit)(void); BOOL (*pInit)(void);
void (*pSynchronize)(BOOL); void (*pSynchronize)(void);
BOOL (*pCheckFocus)(void); BOOL (*pCheckFocus)(void);
BOOL (*pQueryPointer)(DWORD *, DWORD *, DWORD *); BOOL (*pQueryPointer)(DWORD *, DWORD *, DWORD *);
void (*pUserRepaintDisable)(BOOL); void (*pUserRepaintDisable)(BOOL);
@ -36,7 +36,7 @@ typedef struct tagEVENT_DRIVER {
extern EVENT_DRIVER *EVENT_Driver; extern EVENT_DRIVER *EVENT_Driver;
extern BOOL EVENT_Init( void ); extern BOOL EVENT_Init( void );
extern void EVENT_Synchronize( BOOL bProcessEvents ); extern void EVENT_Synchronize( void );
extern BOOL EVENT_CheckFocus( void ); extern BOOL EVENT_CheckFocus( void );
extern BOOL EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state); extern BOOL EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state);

View file

@ -93,7 +93,7 @@ extern int TTYDRV_DESKTOP_GetScreenDepth(struct tagDESKTOP *pDesktop);
extern struct tagEVENT_DRIVER TTYDRV_EVENT_Driver; extern struct tagEVENT_DRIVER TTYDRV_EVENT_Driver;
extern BOOL TTYDRV_EVENT_Init(void); 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_CheckFocus(void);
extern BOOL TTYDRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state); extern BOOL TTYDRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state);
extern void TTYDRV_EVENT_UserRepaintDisable(BOOL bDisable); extern void TTYDRV_EVENT_UserRepaintDisable(BOOL bDisable);

View file

@ -343,7 +343,7 @@ extern int X11DRV_DESKTOP_GetScreenDepth(struct tagDESKTOP *pDesktop);
extern struct tagEVENT_DRIVER X11DRV_EVENT_Driver; extern struct tagEVENT_DRIVER X11DRV_EVENT_Driver;
extern BOOL X11DRV_EVENT_Init(void); 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_CheckFocus( void );
extern BOOL X11DRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state); extern BOOL X11DRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state);
extern void X11DRV_EVENT_UserRepaintDisable( BOOL bDisable ); extern void X11DRV_EVENT_UserRepaintDisable( BOOL bDisable );

View file

@ -103,20 +103,6 @@ DWORD WINAPI WaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
return WAIT_FAILED; 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->count = count;
req->flags = 0; req->flags = 0;
req->timeout = timeout; req->timeout = timeout;

View file

@ -29,9 +29,9 @@ BOOL EVENT_Init(void)
* *
* Synchronize with the X server. Should not be used too often. * 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();
} }
/********************************************************************** /**********************************************************************

View file

@ -17,7 +17,7 @@ BOOL TTYDRV_EVENT_Init(void)
/*********************************************************************** /***********************************************************************
* TTYDRV_EVENT_Synchronize * TTYDRV_EVENT_Synchronize
*/ */
void TTYDRV_EVENT_Synchronize( BOOL bProcessEvents ) void TTYDRV_EVENT_Synchronize( void )
{ {
} }

View file

@ -2791,7 +2791,7 @@ Pos: /* -----------------------------------------------------------------------
/* ------------------------------------------------------------------------ FINAL */ /* ------------------------------------------------------------------------ FINAL */
if (wndPtr->flags & WIN_NATIVE) 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))) if (!GetCapture() && ((wndPtr->dwStyle & WS_VISIBLE) || (flags & SWP_HIDEWINDOW)))
{ {
@ -2877,7 +2877,7 @@ Pos: /* -----------------------------------------------------------------------
!(winpos.flags & SWP_NOSENDCHANGING)) ) !(winpos.flags & SWP_NOSENDCHANGING)) )
{ {
SendMessageA( winpos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&winpos ); SendMessageA( winpos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&winpos );
if (resync) EVENT_Synchronize ( TRUE ); if (resync) EVENT_Synchronize();
} }
retvalue = TRUE; retvalue = TRUE;

View file

@ -78,6 +78,7 @@ static const char * const event_names[] =
"ClientMessage", "MappingNotify" "ClientMessage", "MappingNotify"
}; };
static void CALLBACK EVENT_Flush( ULONG_PTR arg );
static void CALLBACK EVENT_ProcessAllEvents( ULONG_PTR arg ); static void CALLBACK EVENT_ProcessAllEvents( ULONG_PTR arg );
static void EVENT_ProcessEvent( XEvent *event ); static void EVENT_ProcessEvent( XEvent *event );
@ -117,9 +118,24 @@ BOOL X11DRV_EVENT_Init(void)
SERVICE_AddObject( FILE_DupUnixHandle( ConnectionNumber(display), SERVICE_AddObject( FILE_DupUnixHandle( ConnectionNumber(display),
GENERIC_READ | SYNCHRONIZE ), GENERIC_READ | SYNCHRONIZE ),
EVENT_ProcessAllEvents, 0 ); EVENT_ProcessAllEvents, 0 );
/* Install the XFlush timer callback */
if ( Options.synchronous )
TSXSynchronize( display, True );
else
SERVICE_AddTimer( 200000L, EVENT_Flush, 0 );
return TRUE; return TRUE;
} }
/***********************************************************************
* EVENT_Flush
*/
static void CALLBACK EVENT_Flush( ULONG_PTR arg )
{
TSXFlush( display );
}
/*********************************************************************** /***********************************************************************
* EVENT_ProcessAllEvents * 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. * 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 ); TSXSync( display, False );
EVENT_ProcessAllEvents( 0 );
if ( bProcessEvents )
EVENT_ProcessAllEvents( 0 );
} }
/*********************************************************************** /***********************************************************************

View file

@ -1374,8 +1374,6 @@ BOOL X11DRV_KEYBOARD_GetDIData(
/* FIXME !!! */ /* FIXME !!! */
EVENT_Synchronize( FALSE );
if (entries) if (entries)
xentries = *entries; xentries = *entries;
else else

View file

@ -166,8 +166,6 @@ void X11DRV_MONITOR_Initialize(MONITOR *pMonitor)
else else
pX11Monitor->depth = DefaultDepthOfScreen( pX11Monitor->screen ); pX11Monitor->depth = DefaultDepthOfScreen( pX11Monitor->screen );
if (Options.synchronous) TSXSynchronize( display, True );
if (Options.desktopGeometry) if (Options.desktopGeometry)
X11DRV_MONITOR_CreateDesktop(pMonitor); X11DRV_MONITOR_CreateDesktop(pMonitor);
else else

View file

@ -621,7 +621,7 @@ void X11DRV_WND_SetFocus(WND *wndPtr)
if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE) if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE)
TSXInstallColormap( display, X11DRV_PALETTE_PaletteXColormap ); 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 ); TSXSetGraphicsExposures( display, physDev->gc, False );
if (bUpdate) /* Make sure exposure events have been processed */ if (bUpdate) /* Make sure exposure events have been processed */
EVENT_Synchronize( TRUE ); EVENT_Synchronize();
} }
/*********************************************************************** /***********************************************************************