[Libreoffice-commits] core.git: editeng/source include/editeng include/vcl sd/source vcl/source
Caolán McNamara
caolanm at redhat.com
Tue Oct 7 08:55:35 PDT 2014
editeng/source/editeng/editview.cxx | 5 +++++
editeng/source/editeng/impedit.cxx | 5 +++++
editeng/source/editeng/impedit.hxx | 2 ++
editeng/source/editeng/impedit2.cxx | 5 +++++
editeng/source/outliner/outlvw.cxx | 6 +++++-
include/editeng/editview.hxx | 1 +
include/editeng/outliner.hxx | 1 +
include/vcl/seleng.hxx | 7 +++++++
sd/source/ui/view/drviews4.cxx | 3 +++
vcl/source/window/seleng.cxx | 9 ++++++++-
10 files changed, 42 insertions(+), 2 deletions(-)
New commits:
commit 4b7b013491ddf78b4555e17e89b95f085e2fb34f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 7 16:52:11 2014 +0100
Resolves: fdo#44998 crash when opening context menu of a field
If you right click on a field in an inactive text box, then a mouse down,
context command, mouse up sequence is sent. The mouse up is supposed to be
captured by the context menu here. But it doesn't because the mouse down in
draw sends an artificial mouse down to the editengine which eventually sets up
a MouseCapture window so the context menu doesn't get considered (because it
occurs before the capture window is released) so the mouse up gets send to sd
while the context menu is up and that causes all sorts of havoc.
Change-Id: If3b7c501586f8561be484d0828c630d84644f770
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index f972ad7..d86ee0a 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -365,6 +365,11 @@ bool EditView::MouseButtonUp( const MouseEvent& rMouseEvent )
return pImpEditView->MouseButtonUp( rMouseEvent );
}
+void EditView::ReleaseMouse()
+{
+ return pImpEditView->ReleaseMouse();
+}
+
bool EditView::MouseButtonDown( const MouseEvent& rMouseEvent )
{
return pImpEditView->MouseButtonDown( rMouseEvent );
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 1c7ee7c..5e11287 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1064,6 +1064,11 @@ bool ImpEditView::MouseButtonUp( const MouseEvent& rMouseEvent )
return pEditEngine->pImpEditEngine->MouseButtonUp( rMouseEvent, GetEditViewPtr() );
}
+void ImpEditView::ReleaseMouse()
+{
+ pEditEngine->pImpEditEngine->ReleaseMouse();
+}
+
bool ImpEditView::MouseButtonDown( const MouseEvent& rMouseEvent )
{
pEditEngine->CheckIdleFormatter(); // If fast typing and mouse button downs
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 4e93d93..68ef6ed 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -288,6 +288,7 @@ public:
bool MouseButtonUp( const MouseEvent& rMouseEvent );
bool MouseButtonDown( const MouseEvent& rMouseEvent );
+ void ReleaseMouse();
bool MouseMove( const MouseEvent& rMouseEvent );
void Command( const CommandEvent& rCEvt );
@@ -728,6 +729,7 @@ public:
bool MouseButtonUp( const MouseEvent& rMouseEvent, EditView* pView );
bool MouseButtonDown( const MouseEvent& rMouseEvent, EditView* pView );
+ void ReleaseMouse();
bool MouseMove( const MouseEvent& rMouseEvent, EditView* pView );
void Command( const CommandEvent& rCEvt, EditView* pView );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index fd3f7a0..f1b0fbc 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -586,6 +586,11 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, EditView* pView )
return true;
}
+void ImpEditEngine::ReleaseMouse()
+{
+ GetSelEngine().ReleaseMouse();
+}
+
bool ImpEditEngine::MouseMove( const MouseEvent& rMEvt, EditView* pView )
{
// MouseMove is called directly after ShowQuickHelp()!
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index c0d2d98..bc0aeed 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -51,7 +51,6 @@ using namespace ::com::sun::star;
OutlinerView::OutlinerView( Outliner* pOut, vcl::Window* pWin )
{
-
pOwner = pOut;
pEditView = new EditView( pOut->pEditEngine, pWin );
@@ -363,6 +362,11 @@ bool OutlinerView::MouseButtonUp( const MouseEvent& rMEvt )
return pEditView->MouseButtonUp( rMEvt );
}
+void OutlinerView::ReleaseMouse()
+{
+ pEditView->ReleaseMouse();
+}
+
void OutlinerView::ImpToggleExpand( Paragraph* pPara )
{
sal_Int32 nPara = pOwner->pParaList->GetAbsPos( pPara );
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 176de82..cf26a62 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -140,6 +140,7 @@ public:
bool MouseButtonUp( const MouseEvent& rMouseEvent );
bool MouseButtonDown( const MouseEvent& rMouseEvent );
+ void ReleaseMouse();
bool MouseMove( const MouseEvent& rMouseEvent );
void Command( const CommandEvent& rCEvt );
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index ac5f18b..932cc9f 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -214,6 +214,7 @@ public:
bool PostKeyEvent( const KeyEvent& rKEvt, vcl::Window* pFrameWin = NULL );
bool MouseButtonDown( const MouseEvent& );
bool MouseButtonUp( const MouseEvent& );
+ void ReleaseMouse();
bool MouseMove( const MouseEvent& );
void ShowCursor( bool bGotoCursor = true );
diff --git a/include/vcl/seleng.hxx b/include/vcl/seleng.hxx
index afe30c3..d0da0e8 100644
--- a/include/vcl/seleng.hxx
+++ b/include/vcl/seleng.hxx
@@ -100,6 +100,13 @@ public:
bool SelMouseButtonDown( const MouseEvent& rMEvt );
bool SelMouseButtonUp( const MouseEvent& rMEvt );
bool SelMouseMove( const MouseEvent& rMEvt );
+ //SelMouseButtonDown captures mouse events, SelMouseButtonUp
+ //releases the capture. If you need to release the mouse
+ //capture after SelMouseButtonDown but before
+ //SelMouseButtonUp, e.g. to allow events to go to a
+ //context menu via "Command" which is delivered after
+ //mouse down but before mouse up, then use this
+ void ReleaseMouse();
// Keyboard
void CursorPosChanging( bool bShift, bool bMod1 );
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index dbe9323..e92efea 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -541,6 +541,9 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.nStartPara, aSelection.nStartPos );
}
+ //fdo#44998 if the outliner has captured the mouse events release the lock
+ //so the SdFieldPopup can get them
+ pOLV->ReleaseMouse();
SdFieldPopup aFieldPopup( pFldItem->GetField(), eLanguage );
if ( rCEvt.IsMouseEvent() )
diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx
index 6356928..b9aa184 100644
--- a/vcl/source/window/seleng.cxx
+++ b/vcl/source/window/seleng.cxx
@@ -244,7 +244,7 @@ bool SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt )
if( !rMEvt.IsRight() )
{
- pWin->ReleaseMouse();
+ ReleaseMouse();
}
if( (nFlags & SELENG_WAIT_UPEVT) && !(nFlags & SELENG_CMDEVT) &&
@@ -276,6 +276,13 @@ bool SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt )
return true;
}
+void SelectionEngine::ReleaseMouse()
+{
+ if (!pWin)
+ return;
+ pWin->ReleaseMouse();
+}
+
bool SelectionEngine::SelMouseMove( const MouseEvent& rMEvt )
{
More information about the Libreoffice-commits
mailing list