summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-12-20 17:58:05 +0530
committerJan Holesovsky <kendy@collabora.com>2018-01-02 15:31:20 +0100
commit34372e6e849519c30461f70d94748295412dcb2b (patch)
tree4cd464e93b7661993a95ed1dcd02235e00a03991
parent96b365709ca1c8922cecd1516f895f64b5e380b3 (diff)
lokdialog: Use Post(Mouse,Key)Event() to post to main thread
... instead of custom machinery there to post to main thread. This also now posts window key events to the main thread instead of processing them on the lok thread. Change-Id: Ided1efb3f237a1838fa50bb8d74752be714c3032 (cherry picked from commit 7dab9f9b50d83d2bcadcdd7e852f805739371cd1) Reviewed-on: https://gerrit.libreoffice.org/46858 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--desktop/source/lib/init.cxx11
-rw-r--r--include/vcl/window.hxx7
-rw-r--r--vcl/source/window/window.cxx68
3 files changed, 6 insertions, 80 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2f385341e939..a993a3a30a90 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -74,6 +74,7 @@
#include <svx/ruler.hxx>
#include <svx/svxids.hrc>
#include <svx/ucsubset.hxx>
+#include <vcl/vclevent.hxx>
#include <vcl/svapp.hxx>
#include <tools/resmgr.hxx>
#include <tools/fract.hxx>
@@ -2291,10 +2292,10 @@ static void doc_postWindowKeyEvent(LibreOfficeKitDocument* /*pThis*/, unsigned n
switch (nType)
{
case LOK_KEYEVENT_KEYINPUT:
- pWindow->LOKKeyInput(aEvent);
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pWindow, &aEvent);
break;
case LOK_KEYEVENT_KEYUP:
- pWindow->LOKKeyUp(aEvent);
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pWindow, &aEvent);
break;
default:
assert(false);
@@ -2476,13 +2477,13 @@ static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned
switch (nType)
{
case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
- pWindow->LogicMouseButtonDown(aEvent);
+ Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pWindow, &aEvent);
break;
case LOK_MOUSEEVENT_MOUSEBUTTONUP:
- pWindow->LogicMouseButtonUp(aEvent);
+ Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEBUTTONUP, pWindow, &aEvent);
break;
case LOK_MOUSEEVENT_MOUSEMOVE:
- pWindow->LogicMouseMove(aEvent);
+ Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEMOVE, pWindow, &aEvent);
break;
default:
assert(false);
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 7fbb39df9d0e..a46e7569e74f 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1221,13 +1221,6 @@ public:
/// Dialog / window tunneling related methods.
Size PaintActiveFloatingWindow(VirtualDevice& rDevice) const;
- void LogicMouseButtonDown(const MouseEvent& rMouseEvent);
- void LogicMouseButtonUp(const MouseEvent& rMouseEvent);
- void LogicMouseMove(const MouseEvent& rMouseEvent);
-
- void LOKKeyInput(const KeyEvent& rKeyEvent);
- void LOKKeyUp(const KeyEvent& rKeyEvent);
-
/** @name Accessibility
*/
///@{
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 7c1591c42a06..77f6c28d168e 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3250,74 +3250,6 @@ 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());
-
- 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)
-{
- // When we're not doing tiled rendering, then positions must be passed as pixels.
- assert(comphelper::LibreOfficeKit::isActive());
-
- 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)
-{
- // When we're not doing tiled rendering, then positions must be passed as pixels.
- assert(comphelper::LibreOfficeKit::isActive());
-
- 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)
-{
- assert(comphelper::LibreOfficeKit::isActive());
-
- ImplWindowFrameProc(this, SalEvent::ExternalKeyInput, &rKeyEvent);
-}
-
-void Window::LOKKeyUp(const KeyEvent& rKeyEvent)
-{
- assert(comphelper::LibreOfficeKit::isActive());
-
- ImplWindowFrameProc(this, SalEvent::ExternalKeyUp, &rKeyEvent);
-}
-
void Window::ImplCallDeactivateListeners( vcl::Window *pNew )
{
// no deactivation if the newly activated window is my child