diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2009-03-16 19:01:31 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2009-03-16 19:01:31 +0000 |
commit | 44e008b01f72c3f02ab3328cdc44f987617f272b (patch) | |
tree | 77a3fd345db6b1965e2af144669343af752452d0 /vcl/unx/source | |
parent | 1c36c112707677fe89e427b3baf93c7c0b78d17d (diff) |
CWS-TOOLING: integrate CWS ooo31gsl4_DEV300
2009-03-11 16:07:53 +0100 gh r269340 : missed compile on bigendian system (OSL_BIGENDIAN defined)
2009-03-11 10:22:27 +0100 pl r269300 : #i100057# one more case
2009-03-10 15:10:01 +0100 pl r269274 : #i100057# filter formatting marks in vcl i18n helper
2009-03-10 13:31:01 +0100 gh r269269 : #i100044#remove BiDi markers before sending to VCLTestTool
2009-03-10 10:16:05 +0100 hdu r269248 : #i100057# fix casefolding::getNextChar() end-of-string behaviour
2009-03-10 09:51:36 +0100 hdu r269245 : #i100044# add TransliterationModules_IGNORE_FORMATTING option
2009-03-09 14:30:00 +0100 pl r269176 : #i99360# workaround XIfEvent never returning
Diffstat (limited to 'vcl/unx/source')
-rw-r--r-- | vcl/unx/source/app/saldisp.cxx | 45 | ||||
-rw-r--r-- | vcl/unx/source/gdi/salgdi2.cxx | 29 |
2 files changed, 50 insertions, 24 deletions
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 95679d77fdfb..b599cf0895eb 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -104,6 +104,7 @@ Status XineramaGetInfo(Display*, int, XRectangle*, unsigned char*, int*); #include <dtint.hxx> #include <osl/socket.h> +#include <poll.h> using namespace rtl; using namespace vcl_sal; @@ -520,7 +521,7 @@ SalDisplay::SalDisplay( Display *display ) : m_pWMAdaptor( NULL ), m_pDtIntegrator( NULL ), m_bUseRandRWrapper( true ), - m_nLastUserEventTime( 0 ) + m_nLastUserEventTime( CurrentTime ) { #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "SalDisplay::SalDisplay()\n" ); @@ -2726,9 +2727,9 @@ extern "C" } } -XLIB_Time SalDisplay::GetLastUserEventTime() const +XLIB_Time SalDisplay::GetLastUserEventTime( bool i_bAlwaysReget ) const { - if( m_nLastUserEventTime == 0 ) + if( m_nLastUserEventTime == CurrentTime || i_bAlwaysReget ) { // get current server time unsigned char c = 0; @@ -2736,12 +2737,48 @@ XLIB_Time SalDisplay::GetLastUserEventTime() const Atom nAtom = getWMAdaptor()->getAtom( WMAdaptor::SAL_GETTIMEEVENT ); XChangeProperty( GetDisplay(), GetDrawable( GetDefaultScreenNumber() ), nAtom, nAtom, 8, PropModeReplace, &c, 1 ); - XIfEvent( GetDisplay(), &aEvent, timestamp_predicate, (XPointer)this ); + XFlush( GetDisplay() ); + + if( ! XIfEventWithTimeout( &aEvent, (XPointer)this, timestamp_predicate ) ) + { + // this should not happen at all; still sometimes it happens + aEvent.xproperty.time = CurrentTime; + } + m_nLastUserEventTime = aEvent.xproperty.time; } return m_nLastUserEventTime; } +bool SalDisplay::XIfEventWithTimeout( XEvent* o_pEvent, XPointer i_pPredicateData, + X_if_predicate i_pPredicate, long i_nTimeout ) const +{ + /* #i99360# ugly workaround an X11 library bug + this replaces the following call: + XIfEvent( GetDisplay(), o_pEvent, i_pPredicate, i_pPredicateData ); + */ + bool bRet = true; + + if( ! XCheckIfEvent( GetDisplay(), o_pEvent, i_pPredicate, i_pPredicateData ) ) + { + // wait for some event to arrive + struct pollfd aFD; + aFD.fd = ConnectionNumber(GetDisplay()); + aFD.events = POLLIN; + aFD.revents = 0; + poll( &aFD, 1, i_nTimeout ); + if( ! XCheckIfEvent( GetDisplay(), o_pEvent, i_pPredicate, i_pPredicateData ) ) + { + poll( &aFD, 1, i_nTimeout ); // try once more for a packet of events from the Xserver + if( ! XCheckIfEvent( GetDisplay(), o_pEvent, i_pPredicate, i_pPredicateData ) ) + { + bRet = false; + } + } + } + return bRet; +} + // -=-= SalVisual -=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= SalVisual::SalVisual() diff --git a/vcl/unx/source/gdi/salgdi2.cxx b/vcl/unx/source/gdi/salgdi2.cxx index 7192a417f96c..5a01b7f13d39 100644 --- a/vcl/unx/source/gdi/salgdi2.cxx +++ b/vcl/unx/source/gdi/salgdi2.cxx @@ -419,9 +419,12 @@ extern "C" } -void X11SalGraphics::YieldGraphicsExpose( Display* pDisplay, SalFrame* pFrame, Drawable aWindow ) +void X11SalGraphics::YieldGraphicsExpose() { // get frame if necessary + SalFrame* pFrame = m_pFrame; + Display* pDisplay = GetXDisplay(); + XLIB_Window aWindow = GetDrawable(); if( ! pFrame ) { const std::list< SalFrame* >& rFrames = GetX11SalData()->GetDisplay()->getFrames(); @@ -444,24 +447,10 @@ void X11SalGraphics::YieldGraphicsExpose( Display* pDisplay, SalFrame* pFrame, D do { - if( ! XCheckIfEvent( pDisplay, &aEvent, GraphicsExposePredicate, (XPointer)aWindow ) ) - { - // wait for some event to arrive - struct pollfd aFD; - aFD.fd = ConnectionNumber(pDisplay); - aFD.events = POLLIN; - aFD.revents = 0; - poll( &aFD, 1, 1000 ); - if( ! XCheckIfEvent( pDisplay, &aEvent, GraphicsExposePredicate, (XPointer)aWindow ) ) - { - poll( &aFD, 1, 1000 ); // try once more for a packet of events from the Xserver - if( ! XCheckIfEvent( pDisplay, &aEvent, GraphicsExposePredicate, (XPointer)aWindow ) ) - { - // this should not happen at all; still sometimes it happens - break; - } - } - } + if( ! GetDisplay()->XIfEventWithTimeout( &aEvent, (XPointer)aWindow, GraphicsExposePredicate ) ) + // this should not happen at all; still sometimes it happens + break; + if( aEvent.type == NoExpose ) break; @@ -581,7 +570,7 @@ void X11SalGraphics::copyBits( const SalTwoRect *pPosAry, if( bNeedGraphicsExposures ) { - YieldGraphicsExpose( GetXDisplay(), m_pFrame, GetDrawable() ); + YieldGraphicsExpose(); if( pCopyGC ) XSetGraphicsExposures( GetXDisplay(), |