From e5eab37d6fa6d49790d44e15b5908f0a735a629a Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Mon, 1 Nov 2010 16:48:32 +0100 Subject: Make envvar SAL_NO_MOUSEGRABS avoid mouse grabs on X11 When debugging UI code, mouse grabs can really get in the way - so just set SAL_NO_MOUSEGRABS=1 and LibO will stop blocking your X11 session, when a gdb breakpoint hits. --- vcl/unx/source/app/saldisp.cxx | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'vcl/unx/source/app') diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 8a209d126a75..0fbfae40aeec 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -2218,10 +2218,13 @@ XLIB_Cursor SalDisplay::GetPointer( int ePointerStyle ) int SalDisplay::CaptureMouse( SalFrame *pCapture ) { + static const char* pEnv = getenv( "SAL_NO_MOUSEGRABS" ); + if( !pCapture ) { m_pCapture = NULL; - XUngrabPointer( GetDisplay(), CurrentTime ); + if( !pEnv || !*pEnv ) + XUngrabPointer( GetDisplay(), CurrentTime ); XFlush( GetDisplay() ); return 0; } @@ -2230,20 +2233,23 @@ int SalDisplay::CaptureMouse( SalFrame *pCapture ) // FIXME: get rid of X11SalFrame const SystemEnvData* pEnvData = pCapture->GetSystemData(); - int ret = XGrabPointer( GetDisplay(), - (XLIB_Window)pEnvData->aWindow, - False, - PointerMotionMask| ButtonPressMask|ButtonReleaseMask, - GrabModeAsync, - GrabModeAsync, - None, - static_cast(pCapture)->GetCursor(), - CurrentTime ); - - if( ret != GrabSuccess ) - { - DBG_ASSERT( 1, "SalDisplay::CaptureMouse could not grab pointer\n"); - return -1; + if( !pEnv || !*pEnv ) + { + int ret = XGrabPointer( GetDisplay(), + (XLIB_Window)pEnvData->aWindow, + False, + PointerMotionMask| ButtonPressMask|ButtonReleaseMask, + GrabModeAsync, + GrabModeAsync, + None, + static_cast(pCapture)->GetCursor(), + CurrentTime ); + + if( ret != GrabSuccess ) + { + DBG_ASSERT( 1, "SalDisplay::CaptureMouse could not grab pointer\n"); + return -1; + } } m_pCapture = pCapture; -- cgit v1.2.3