diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-12-14 12:53:35 +0530 |
---|---|---|
committer | Pranav Kant <pranavk@collabora.co.uk> | 2017-12-14 14:15:26 +0530 |
commit | 53f8f28c53391ef1cadefaf16c3a9e81e04ac7f5 (patch) | |
tree | fc84676e2228e53f5ec1a40f0443d9ac8fc81ebe /vcl | |
parent | 9f713bd753afd7b0ed8c16a17dc22755b5862d36 (diff) |
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
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/window.cxx | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 1e76d47890a2..8075a6368784 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3231,15 +3231,33 @@ 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); + } +} + 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) @@ -3247,10 +3265,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) @@ -3258,10 +3277,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) |