# HG changeset patch # User arpi # Date 998781497 0 # Node ID 7ddc63b84f1f32a5dc921d74f9bba7911a3931bb # Parent 7f85792119247394e308fa208442c8d1d8d42c51 DGA2 ifdefs, new mainloop/timer stuff diff -r 7f8579211924 -r 7ddc63b84f1f Gui/wm/ws.c --- a/Gui/wm/ws.c Sat Aug 25 23:17:13 2001 +0000 +++ b/Gui/wm/ws.c Sat Aug 25 23:18:17 2001 +0000 @@ -149,20 +149,24 @@ fprintf( stderr,"[ws] sorry, your system is not supported X shared memory extension.\n" ); wsUseXShm=0; } -// if ( !XDGAQueryExtension( wsDisplay,&eventbase,&errorbase ) ) +#ifdef HAVE_DGA2 + if ( !XDGAQueryExtension( wsDisplay,&eventbase,&errorbase ) ) { fprintf( stderr,"[ws] sorry, your system is not supported DGA extension.\n" ); wsUseDGA=0; } - #ifdef HAVE_XSHAPE +#else + wsUseDGA=0; +#endif +#ifdef HAVE_XSHAPE if ( !XShapeQueryExtension( wsDisplay,&eventbase,&errorbase ) ) { fprintf( stderr,"[ws] sorry, your system is not supported XShape extension.\n" ); wsUseXShape=0; } - #else +#else wsUseXShape=0; - #endif +#endif XSynchronize( wsDisplay,True ); @@ -172,7 +176,7 @@ wsMaxY=DisplayHeight( wsDisplay,wsScreen ); wsGetDepthOnScreen(); - #ifdef DEBUG +#ifdef DEBUG { int minor,major,shp; fprintf( stderr,"[ws] Screen depth: %d\n",wsDepthOnScreen ); @@ -184,11 +188,11 @@ XShmQueryVersion( wsDisplay,&major,&minor,&shp ); fprintf( stderr,"[ws] XShm version is %d.%d\n",major,minor ); } - if ( wsUseDGA ) - { +// if ( wsUseDGA ) +// { // XDGAQueryVersion( wsDisplay,&major,&minor ); // fprintf( stderr,"[ws] DGA version is %d.%d\n",major,minor ); - } +// } #ifdef HAVE_XSHAPE if ( wsUseXShape ) { @@ -197,7 +201,7 @@ } #endif } - #endif +#endif initConverter(); wsOutMask=wsGetOutMask(); switch ( wsOutMask ) @@ -629,15 +633,36 @@ void wsMainLoop( void ) { + int delay=20; fprintf( stderr,"[ws] init threads: %d\n",XInitThreads() ); XSynchronize( wsDisplay,False ); XLockDisplay( wsDisplay ); // XIfEvent( wsDisplay,&wsEvent,wsEvents,NULL ); + +#if 1 + +while(wsTrue){ + // handle pending events + while ( XPending(wsDisplay) ){ + XNextEvent( wsDisplay,&wsEvent ); + printf("### X event: %d [%d]\n",wsEvent.type,delay); + wsEvents( wsDisplay,&wsEvent,NULL ); + delay=20; + } + mplTimerHandler(0); // handle timer event + usleep(delay*1000); // FIXME! + if(delay<8*20) delay+=20; // pump up delay up to 0.16 sec (low activity) +} + +#else + while( wsTrue ) { XIfEvent( wsDisplay,&wsEvent,wsDummyEvents,NULL ); wsEvents( wsDisplay,&wsEvent,NULL ); } +#endif + XUnlockDisplay( wsDisplay ); }