summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-11-12 12:11:46 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-11-13 08:01:43 +0100
commit4a63cc1b639e5922425bfc6f82e84ddeaeb2bd0a (patch)
treea6ce04421f453971256147fc4555949a3eed760e
parente8aa0913baa7290f9d62843e2f46148ea3207246 (diff)
Revert "tdf#122920 Send UNO mouse events to parent window listeners as well"
This reverts commit a2fcf51a77f4a37fb1c14f47bab450eea79a0dcb. Change-Id: I427414a8814d055d5cd3c05dc094f4a8b5f17aec Reviewed-on: https://gerrit.libreoffice.org/82505 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r--sw/qa/uitest/writer_tests/xwindow.py10
-rw-r--r--toolkit/source/awt/vclxwindow.cxx84
2 files changed, 40 insertions, 54 deletions
diff --git a/sw/qa/uitest/writer_tests/xwindow.py b/sw/qa/uitest/writer_tests/xwindow.py
index 428dd3723a05..d63df73c69ea 100644
--- a/sw/qa/uitest/writer_tests/xwindow.py
+++ b/sw/qa/uitest/writer_tests/xwindow.py
@@ -43,13 +43,15 @@ class XMouseListenerExtended(unohelper.Base, XMouseListener):
# is invoked when the mouse enters a window.
@classmethod
def mouseEntered(self, xMouseEvent):
- # doesn't work in UI tests
+ global mouseEventsIntercepted
+ mouseEventsIntercepted += 1
return super(XMouseListenerExtended, self).mouseEntered(xMouseEvent)
# is invoked when the mouse exits a window.
@classmethod
def mouseExited(self, xMouseEvent):
- # doesn't work in UI tests
+ global mouseEventsIntercepted
+ mouseEventsIntercepted += 1
return super(XMouseListenerExtended, self).mouseExited(xMouseEvent)
@@ -140,8 +142,8 @@ class XWindow(UITestCase):
self.assertEqual(0, keymouseEventsIntercepted)
global mouseEventsIntercepted
- # mousePressed, mouseReleased and mouseEntered should be triggered
- self.assertEqual(2, mouseEventsIntercepted)
+ # Not expected 3 interceptions
+ self.assertEqual(0, mouseEventsIntercepted)
# close document
self.ui_test.close_doc()
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 31438dfec9e2..6d89c13f3697 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -704,66 +704,50 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
case VclEventId::WindowMouseMove:
{
MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rVclWindowEvent.GetData());
- VclPtr<vcl::Window> pWin = GetWindow();
- while (pWin)
+ if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) )
{
- VCLXWindow* pXWindow = pWin->GetWindowPeer();
- if (!pXWindow || pXWindow->mpImpl->getMouseListeners().getLength() == 0)
- {
- pWin = pWin->GetWindow(GetWindowType::RealParent);
- continue;
- }
- awt::MouseEvent aEvent(VCLUnoHelper::createMouseEvent(*pMouseEvt, *pXWindow));
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
+ bool const isEnter(pMouseEvt->IsEnterWindow());
+ Callback aCallback = [ this, isEnter, aEvent ]()
+ { MouseListenerMultiplexer& rMouseListeners = this->mpImpl->getMouseListeners();
+ isEnter
+ ? rMouseListeners.mouseEntered(aEvent)
+ : rMouseListeners.mouseExited(aEvent); };
- if (pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow())
- {
- bool const isEnter(pMouseEvt->IsEnterWindow());
- Callback aCallback = [pXWindow, isEnter, aEvent]() {
- isEnter ? pXWindow->mpImpl->getMouseListeners().mouseEntered(aEvent)
- : pXWindow->mpImpl->getMouseListeners().mouseExited(aEvent);
- };
- ImplExecuteAsyncWithoutSolarLock(aCallback);
- }
- else
- {
- aEvent.ClickCount = 0;
- MouseMotionListenerMultiplexer& rMouseListeners
- = pXWindow->mpImpl->getMouseMotionListeners();
- if (pMouseEvt->GetMode() & MouseEventModifiers::SIMPLEMOVE)
- rMouseListeners.mouseMoved(aEvent);
- else
- rMouseListeners.mouseDragged(aEvent);
- }
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
+ }
- // Next window (parent)
- pWin = pWin->GetWindow(GetWindowType::RealParent);
+ if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() )
+ {
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
+ aEvent.ClickCount = 0;
+ if ( pMouseEvt->GetMode() & MouseEventModifiers::SIMPLEMOVE )
+ mpImpl->getMouseMotionListeners().mouseMoved( aEvent );
+ else
+ mpImpl->getMouseMotionListeners().mouseDragged( aEvent );
}
}
break;
case VclEventId::WindowMouseButtonDown:
+ {
+ if ( mpImpl->getMouseListeners().getLength() )
+ {
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *static_cast<MouseEvent*>(rVclWindowEvent.GetData()), *this ) );
+ Callback aCallback = [ this, aEvent ]()
+ { this->mpImpl->getMouseListeners().mousePressed( aEvent ); };
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
+ }
+ }
+ break;
case VclEventId::WindowMouseButtonUp:
{
- VclPtr<vcl::Window> pWin = GetWindow();
- while (pWin)
+ if ( mpImpl->getMouseListeners().getLength() )
{
- VCLXWindow* pXWindow = pWin->GetWindowPeer();
- if (!pXWindow || pXWindow->mpImpl->getMouseListeners().getLength() == 0)
- {
- pWin = pWin->GetWindow(GetWindowType::RealParent);
- continue;
- }
- MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rVclWindowEvent.GetData());
- awt::MouseEvent aEvent(VCLUnoHelper::createMouseEvent(*pMouseEvt, *pXWindow));
- VclEventId eventId = rVclWindowEvent.GetId();
- Callback aCallback = [pXWindow, aEvent, eventId]() {
- eventId == VclEventId::WindowMouseButtonDown
- ? pXWindow->mpImpl->getMouseListeners().mousePressed(aEvent)
- : pXWindow->mpImpl->getMouseListeners().mouseReleased(aEvent);
- };
- ImplExecuteAsyncWithoutSolarLock(aCallback);
-
- // Next window (parent)
- pWin = pWin->GetWindow(GetWindowType::RealParent);
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *static_cast<MouseEvent*>(rVclWindowEvent.GetData()), *this ) );
+
+ Callback aCallback = [ this, aEvent ]()
+ { this->mpImpl->getMouseListeners().mouseReleased( aEvent ); };
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
}
break;