summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/dndevdis.hxx (renamed from vcl/source/window/dndevdis.hxx)0
-rw-r--r--vcl/inc/vcl/dndlcon.hxx (renamed from vcl/source/window/dndlcon.hxx)0
-rw-r--r--vcl/inc/vcl/ilstbox.hxx2
-rw-r--r--vcl/source/control/lstbox.cxx14
-rw-r--r--vcl/source/window/dndevdis.cxx4
-rw-r--r--vcl/source/window/dndlcon.cxx2
-rw-r--r--vcl/source/window/window.cxx4
-rw-r--r--vcl/source/window/winproc.cxx2
-rw-r--r--vcl/unx/source/dtrans/X11_selection.cxx102
-rw-r--r--vcl/unx/source/gdi/salgdi.cxx4
10 files changed, 112 insertions, 22 deletions
diff --git a/vcl/source/window/dndevdis.hxx b/vcl/inc/vcl/dndevdis.hxx
index 5b91bd0713ec..5b91bd0713ec 100644
--- a/vcl/source/window/dndevdis.hxx
+++ b/vcl/inc/vcl/dndevdis.hxx
diff --git a/vcl/source/window/dndlcon.hxx b/vcl/inc/vcl/dndlcon.hxx
index 5a41a20e4271..5a41a20e4271 100644
--- a/vcl/source/window/dndlcon.hxx
+++ b/vcl/inc/vcl/dndlcon.hxx
diff --git a/vcl/inc/vcl/ilstbox.hxx b/vcl/inc/vcl/ilstbox.hxx
index 33f60a1e8a2f..ac278f76f65b 100644
--- a/vcl/inc/vcl/ilstbox.hxx
+++ b/vcl/inc/vcl/ilstbox.hxx
@@ -396,6 +396,7 @@ private:
mbHScroll : 1, // HScroll an oder aus
mbAutoHScroll : 1; // AutoHScroll an oder aus
Link maScrollHdl; // Weil der vom ImplListBoxWindow selbst benoetigt wird.
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer;
protected:
virtual void GetFocus();
@@ -500,6 +501,7 @@ public:
// pb: #106948# explicit mirroring for calc
inline void EnableMirroring() { maLBWindow.EnableMirroring(); }
+ inline void SetDropTraget(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_xDNDListenerContainer){ mxDNDListenerContainer= i_xDNDListenerContainer; }
};
// -----------------------------
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index eb8c20d1d803..03527bf083a7 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -44,9 +44,10 @@
#include "tools/debug.hxx"
+#include <vcl/dndevdis.hxx>
+#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
-
- // =======================================================================
+// =======================================================================
ListBox::ListBox( WindowType nType ) : Control( nType )
{
@@ -119,6 +120,8 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle )
Control::ImplInit( pParent, nStyle, NULL );
SetBackground();
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener> xDrop = new DNDEventDispatcher(this);
+
if( nStyle & WB_DROPDOWN )
{
sal_Int32 nLeft, nTop, nRight, nBottom;
@@ -145,16 +148,19 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle )
mpFloatWin = new ImplListBoxFloatingWindow( this );
mpFloatWin->SetAutoWidth( TRUE );
mpFloatWin->SetPopupModeEndHdl( LINK( this, ListBox, ImplPopupModeEndHdl ) );
+ mpFloatWin->GetDropTarget()->addDropTargetListener(xDrop);
mpImplWin = new ImplWin( this, (nStyle & (WB_LEFT|WB_RIGHT|WB_CENTER))|WB_NOBORDER );
mpImplWin->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) );
mpImplWin->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) );
mpImplWin->Show();
+ mpImplWin->GetDropTarget()->addDropTargetListener(xDrop);
mpBtn = new ImplBtn( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
ImplInitDropDownButton( mpBtn );
mpBtn->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) );
mpBtn->Show();
+ mpBtn->GetDropTarget()->addDropTargetListener(xDrop);
}
@@ -170,6 +176,9 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle )
mpImplLB->SetPosPixel( Point() );
mpImplLB->Show();
+ mpImplLB->GetDropTarget()->addDropTargetListener(xDrop);
+ mpImplLB->SetDropTraget(xDrop);
+
if ( mpFloatWin )
{
mpFloatWin->SetImplListBox( mpImplLB );
@@ -1612,7 +1621,6 @@ const Wallpaper& ListBox::GetDisplayBackground() const
}
// =======================================================================
-
MultiListBox::MultiListBox( Window* pParent, WinBits nStyle ) :
ListBox( WINDOW_MULTILISTBOX )
{
diff --git a/vcl/source/window/dndevdis.cxx b/vcl/source/window/dndevdis.cxx
index efc49be6fbf8..e4d5a8c4c0eb 100644
--- a/vcl/source/window/dndevdis.cxx
+++ b/vcl/source/window/dndevdis.cxx
@@ -28,8 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <dndevdis.hxx>
-#include <dndlcon.hxx>
+#include <vcl/dndevdis.hxx>
+#include <vcl/dndlcon.hxx>
#include <vcl/window.h>
#include <vos/mutex.hxx>
diff --git a/vcl/source/window/dndlcon.cxx b/vcl/source/window/dndlcon.cxx
index c5d78dd6bae3..07819e76f957 100644
--- a/vcl/source/window/dndlcon.cxx
+++ b/vcl/source/window/dndlcon.cxx
@@ -28,7 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include<dndlcon.hxx>
+#include <vcl/dndlcon.hxx>
using namespace ::cppu;
using namespace ::com::sun::star::uno;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 35641ab8d6f9..adedbde4c0f2 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -88,8 +88,8 @@
#include "vcl/dialog.hxx"
#include "vcl/unowrap.hxx"
-#include "dndlcon.hxx"
-#include "dndevdis.hxx"
+#include "vcl/dndlcon.hxx"
+#include "vcl/dndevdis.hxx"
#include "vcl/impbmpconv.hxx"
#include "unotools/confignode.hxx"
#include "vcl/gdimtf.hxx"
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 7b0512a1320b..c964ad0d739b 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -62,7 +62,7 @@
#include <vcl/salgdi.hxx>
#include <vcl/menu.hxx>
-#include <dndlcon.hxx>
+#include <vcl/dndlcon.hxx>
#include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
#include <com/sun/star/awt/MouseEvent.hpp>
diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx
index 7f205407b21b..403ee9707a94 100644
--- a/vcl/unx/source/dtrans/X11_selection.cxx
+++ b/vcl/unx/source/dtrans/X11_selection.cxx
@@ -28,15 +28,17 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
+#include "saldisp.hxx"
+#include "saldata.hxx"
+
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
+
#include "tools/prex.h"
#include <X11/Xatom.h>
#include <X11/keysym.h>
-#include <X11/Xlib.h>
-#include <X11/X.h>
#include <X11/Xutil.h>
#include "tools/postx.h"
#if defined(LINUX) || defined(NETBSD) || defined (FREEBSD)
@@ -3259,6 +3261,8 @@ void SelectionManager::startDrag(
return;
}
+ SalFrame* pCaptureFrame = NULL;
+
{
ClearableMutexGuard aGuard(m_aMutex);
@@ -3327,6 +3331,32 @@ void SelectionManager::startDrag(
None,
None,
CurrentTime );
+ /* if we could not grab the pointer here, there is a chance
+ that the pointer is grabbed by the other vcl display (the main loop)
+ so let's break that grab an reset it later
+
+ remark: this whole code should really be molten into normal vcl so only
+ one display is used ....
+ */
+ if( nPointerGrabSuccess != GrabSuccess )
+ {
+ vos::IMutex& rSolarMutex( Application::GetSolarMutex() );
+ if( rSolarMutex.tryToAcquire() )
+ {
+ pCaptureFrame = GetX11SalData()->GetDisplay()->GetCaptureFrame();
+ if( pCaptureFrame )
+ {
+ GetX11SalData()->GetDisplay()->CaptureMouse( NULL );
+ nPointerGrabSuccess =
+ XGrabPointer( m_pDisplay, it->second.m_aRootWindow, True,
+ DRAG_EVENT_MASK,
+ GrabModeAsync, GrabModeAsync,
+ None,
+ None,
+ CurrentTime );
+ }
+ }
+ }
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "%d\n", nPointerGrabSuccess );
#endif
@@ -3349,6 +3379,16 @@ void SelectionManager::startDrag(
aGuard.clear();
if( listener.is() )
listener->dragDropEnd( aDragFailedEvent );
+ if( pCaptureFrame )
+ {
+ vos::IMutex& rSolarMutex( Application::GetSolarMutex() );
+ if( rSolarMutex.tryToAcquire() )
+ GetX11SalData()->GetDisplay()->CaptureMouse( pCaptureFrame );
+#if OSL_DEBUG_LEVEL > 0
+ else
+ OSL_ENSURE( 0, "failed to acquire SolarMutex to reset capture frame" );
+#endif
+ }
return;
}
@@ -3428,6 +3468,17 @@ void SelectionManager::startDrag(
XUngrabKeyboard( m_pDisplay, CurrentTime );
XFlush( m_pDisplay );
+ if( pCaptureFrame )
+ {
+ vos::IMutex& rSolarMutex( Application::GetSolarMutex() );
+ if( rSolarMutex.tryToAcquire() )
+ GetX11SalData()->GetDisplay()->CaptureMouse( pCaptureFrame );
+#if OSL_DEBUG_LEVEL > 0
+ else
+ OSL_ENSURE( 0, "failed to acquire SolarMutex to reset capture frame" );
+#endif
+ }
+
m_aDragRunning.reset();
if( listener.is() )
@@ -3915,6 +3966,18 @@ void SelectionManager::deregisterHandler( Atom selection )
// ------------------------------------------------------------------------
+static bool bWasError = false;
+
+extern "C"
+{
+ int local_xerror_handler(Display* , XErrorEvent*)
+ {
+ bWasError = true;
+ return 0;
+ }
+ typedef int(*xerror_hdl_t)(Display*,XErrorEvent*);
+}
+
void SelectionManager::registerDropTarget( XLIB_Window aWindow, DropTarget* pTarget )
{
MutexGuard aGuard(m_aMutex);
@@ -3926,18 +3989,31 @@ void SelectionManager::registerDropTarget( XLIB_Window aWindow, DropTarget* pTar
OSL_ASSERT( "attempt to register window as drop target twice" );
else if( aWindow && m_pDisplay )
{
- XSelectInput( m_pDisplay, aWindow, PropertyChangeMask );
-
- // set XdndAware
- XChangeProperty( m_pDisplay, aWindow, m_nXdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&nXdndProtocolRevision, 1 );
-
DropTargetEntry aEntry( pTarget );
- // get root window of window (in 99.999% of all cases this will be
- // DefaultRootWindow( m_pDisplay )
- int x, y;
- unsigned int w, h, bw, d;
- XGetGeometry( m_pDisplay, aWindow, &aEntry.m_aRootWindow,
- &x, &y, &w, &h, &bw, &d );
+ bWasError=false;
+ /* #i100000# ugly workaround: gtk sets its own XErrorHandler which is not suitable for us
+ unfortunately XErrorHandler is not per display, so this is just and ugly hack
+ Need to remove separate display and integrate clipboard/dnd into vcl's unx code ASAP
+ */
+ xerror_hdl_t pOldHandler = XSetErrorHandler( local_xerror_handler );
+ XSelectInput( m_pDisplay, aWindow, PropertyChangeMask );
+ if( ! bWasError )
+ {
+ // set XdndAware
+ XChangeProperty( m_pDisplay, aWindow, m_nXdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&nXdndProtocolRevision, 1 );
+ if( ! bWasError )
+ {
+ // get root window of window (in 99.999% of all cases this will be
+ // DefaultRootWindow( m_pDisplay )
+ int x, y;
+ unsigned int w, h, bw, d;
+ XGetGeometry( m_pDisplay, aWindow, &aEntry.m_aRootWindow,
+ &x, &y, &w, &h, &bw, &d );
+ }
+ }
+ XSetErrorHandler( pOldHandler );
+ if(bWasError)
+ return;
m_aDropTargets[ aWindow ] = aEntry;
}
else
diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx
index ae21c3aa9f7b..c0658c162489 100644
--- a/vcl/unx/source/gdi/salgdi.cxx
+++ b/vcl/unx/source/gdi/salgdi.cxx
@@ -1127,6 +1127,8 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly
basegfx::B2DTrapezoidVector aB2DTrapVector;
basegfx::tools::trapezoidSubdivide( aB2DTrapVector, aPolyPoly );
const int nTrapCount = aB2DTrapVector.size();
+ if( !nTrapCount )
+ return true;
const bool bDrawn = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency );
return bDrawn;
}
@@ -1239,6 +1241,8 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double
// draw tesselation result
const int nTrapCount = aB2DTrapVector.size();
+ if( !nTrapCount )
+ return true;
const bool bDrawOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency );
// restore the original brush GC