summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx33
-rw-r--r--vcl/unx/source/app/saldisp.cxx36
2 files changed, 40 insertions, 29 deletions
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 860bf980df19..bae0b1697d1e 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -2145,6 +2145,8 @@ void GtkSalFrame::SetPointer( PointerStyle ePointerStyle )
void GtkSalFrame::grabPointer( BOOL bGrab, BOOL bOwnerEvents )
{
+ static const char* pEnv = getenv( "SAL_NO_MOUSEGRABS" );
+
if( m_pWindow )
{
if( bGrab )
@@ -2167,9 +2169,10 @@ void GtkSalFrame::grabPointer( BOOL bGrab, BOOL bOwnerEvents )
{
const int nMask = ( GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK );
- gdk_pointer_grab( m_pWindow->window, bOwnerEvents,
- (GdkEventMask) nMask, NULL, m_pCurrentCursor,
- GDK_CURRENT_TIME );
+ if( !pEnv || !*pEnv )
+ gdk_pointer_grab( m_pWindow->window, bOwnerEvents,
+ (GdkEventMask) nMask, NULL, m_pCurrentCursor,
+ GDK_CURRENT_TIME );
}
else
{
@@ -2179,23 +2182,25 @@ void GtkSalFrame::grabPointer( BOOL bGrab, BOOL bOwnerEvents )
//
// this is of course a bad hack, especially as we cannot
// set the right cursor this way
- XGrabPointer( getDisplay()->GetDisplay(),
- GDK_WINDOW_XWINDOW( m_pWindow->window),
- bOwnerEvents,
- PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
- GrabModeAsync,
- GrabModeAsync,
- None,
- None,
- CurrentTime
- );
+ if( !pEnv || !*pEnv )
+ XGrabPointer( getDisplay()->GetDisplay(),
+ GDK_WINDOW_XWINDOW( m_pWindow->window),
+ bOwnerEvents,
+ PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
+ GrabModeAsync,
+ GrabModeAsync,
+ None,
+ None,
+ CurrentTime
+ );
}
}
else
{
// Two GdkDisplays may be open
- gdk_display_pointer_ungrab( getGdkDisplay(), GDK_CURRENT_TIME);
+ if( !pEnv || !*pEnv )
+ gdk_display_pointer_ungrab( getGdkDisplay(), GDK_CURRENT_TIME);
}
}
}
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<X11SalFrame*>(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<X11SalFrame*>(pCapture)->GetCursor(),
+ CurrentTime );
+
+ if( ret != GrabSuccess )
+ {
+ DBG_ASSERT( 1, "SalDisplay::CaptureMouse could not grab pointer\n");
+ return -1;
+ }
}
m_pCapture = pCapture;