[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - vcl/source
Pranav Kant
pranavk at collabora.co.uk
Thu Dec 14 12:42:27 UTC 2017
vcl/source/window/window.cxx | 45 +++++++++++++++++++++++++++++++------------
1 file changed, 33 insertions(+), 12 deletions(-)
New commits:
commit ad9ac5cf73808d4e71bb4cf6b8df9c3ded0adbe3
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Thu Dec 14 12:53:35 2017 +0530
lokdialog: Unblock custom window mouse key events
In some cases, the mouse event blocks. Eg: when the mouse event is
responsible for launching a new dialog (cf. Spell dialog -> Options).
We don't want any kind of blocking behavior whatsoever in LOK. Post all
custom window mouse events back the main-loop thread and keep the
current LOK thread free.
Change-Id: I018870fadcb62dbb7b33a7d93f8af3a0000442b5
(cherry picked from commit 53f8f28c53391ef1cadefaf16c3a9e81e04ac7f5)
(cherry picked from commit 266beae6cdc352f942a7ea5935f8a8b21d2d1e01)
Reviewed-on: https://gerrit.libreoffice.org/46438
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 95157d665b1f..48ebe460ba04 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3250,15 +3250,34 @@ VclPtr<vcl::Window> Window::GetParentWithLOKNotifier()
return pWindow;
}
+struct LOKAsyncEvent
+{
+ VclPtr<vcl::Window> mpWindow;
+ SalEvent mnEvent;
+ MouseEvent maMouseEvent;
+};
+
+static void LOKAsyncEventLink( void* pEvent, void* )
+{
+ LOKAsyncEvent* pLOKEv = static_cast<LOKAsyncEvent*>(pEvent);
+ if (!pLOKEv->mpWindow->IsDisposed())
+ {
+ ImplWindowFrameProc(pLOKEv->mpWindow, pLOKEv->mnEvent, &pLOKEv->maMouseEvent);
+ }
+ delete pLOKEv;
+}
+
void Window::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
{
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(comphelper::LibreOfficeKit::isActive());
- if (ImplIsFloatingWindow())
- ImplWindowFrameProc(ImplGetBorderWindow(), SalEvent::ExternalMouseButtonDown, &rMouseEvent);
- else
- ImplWindowFrameProc(this, SalEvent::ExternalMouseButtonDown, &rMouseEvent);
+ LOKAsyncEvent* pEv = new LOKAsyncEvent;
+ pEv->mpWindow = ImplIsFloatingWindow() ? ImplGetBorderWindow() : this;
+ pEv->mnEvent = SalEvent::ExternalMouseButtonDown;
+ pEv->maMouseEvent = rMouseEvent;
+ Application::PostUserEvent( Link<void*, void>(pEv, LOKAsyncEventLink) );
+
}
void Window::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
@@ -3266,10 +3285,11 @@ void Window::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(comphelper::LibreOfficeKit::isActive());
- if (ImplIsFloatingWindow())
- ImplWindowFrameProc(ImplGetBorderWindow(), SalEvent::ExternalMouseButtonUp, &rMouseEvent);
- else
- ImplWindowFrameProc(this, SalEvent::ExternalMouseButtonUp, &rMouseEvent);
+ LOKAsyncEvent* pEv = new LOKAsyncEvent;
+ pEv->mpWindow = ImplIsFloatingWindow() ? ImplGetBorderWindow() : this;
+ pEv->mnEvent = SalEvent::ExternalMouseButtonUp;
+ pEv->maMouseEvent = rMouseEvent;
+ Application::PostUserEvent( Link<void*, void>(pEv, LOKAsyncEventLink) );
}
void Window::LogicMouseMove(const MouseEvent& rMouseEvent)
@@ -3277,10 +3297,11 @@ void Window::LogicMouseMove(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(comphelper::LibreOfficeKit::isActive());
- if (ImplIsFloatingWindow())
- ImplWindowFrameProc(ImplGetBorderWindow(), SalEvent::ExternalMouseMove, &rMouseEvent);
- else
- ImplWindowFrameProc(this, SalEvent::ExternalMouseMove, &rMouseEvent);
+ LOKAsyncEvent* pEv = new LOKAsyncEvent;
+ pEv->mpWindow = ImplIsFloatingWindow() ? ImplGetBorderWindow() : this;
+ pEv->mnEvent = SalEvent::ExternalMouseMove;
+ pEv->maMouseEvent = rMouseEvent;
+ Application::PostUserEvent( Link<void*, void>(pEv, LOKAsyncEventLink) );
}
void Window::LOKKeyInput(const KeyEvent& rKeyEvent)
More information about the Libreoffice-commits
mailing list