[Libreoffice-commits] core.git: desktop/source include/vcl vcl/source

Pranav Kant pranavk at collabora.co.uk
Wed Dec 20 13:14:26 UTC 2017


 desktop/source/lib/init.cxx  |   11 +++---
 include/vcl/window.hxx       |    7 ----
 vcl/source/window/window.cxx |   68 -------------------------------------------
 3 files changed, 6 insertions(+), 80 deletions(-)

New commits:
commit ace646b20ee88fdca2780365039e90cb1542262b
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Dec 20 17:58:05 2017 +0530

    lokdialog: Use Application::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

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 670032a18211..f87caa5b0787 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -73,6 +73,7 @@
 #include <svx/ruler.hxx>
 #include <svx/svxids.hrc>
 #include <svx/ucsubset.hxx>
+#include <vcl/vclevent.hxx>
 #include <vcl/svapp.hxx>
 #include <unotools/resmgr.hxx>
 #include <tools/fract.hxx>
@@ -2269,10 +2270,10 @@ static void doc_postWindowKeyEvent(LibreOfficeKitDocument* /*pThis*/, unsigned n
     switch (nType)
     {
         case LOK_KEYEVENT_KEYINPUT:
-            pWindow->LOKKeyInput(aEvent);
+            Application::PostKeyEvent(VclEventId::WindowKeyInput, pWindow, &aEvent);
             break;
         case LOK_KEYEVENT_KEYUP:
-            pWindow->LOKKeyUp(aEvent);
+            Application::PostKeyEvent(VclEventId::WindowKeyUp, pWindow, &aEvent);
             break;
         default:
             assert(false);
@@ -2449,13 +2450,13 @@ static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned
     switch (nType)
     {
         case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
-            pWindow->LogicMouseButtonDown(aEvent);
+            Application::PostMouseEvent(VclEventId::WindowMouseButtonDown, pWindow, &aEvent);
             break;
         case LOK_MOUSEEVENT_MOUSEBUTTONUP:
-            pWindow->LogicMouseButtonUp(aEvent);
+            Application::PostMouseEvent(VclEventId::WindowMouseButtonUp, pWindow, &aEvent);
             break;
         case LOK_MOUSEEVENT_MOUSEMOVE:
-            pWindow->LogicMouseMove(aEvent);
+            Application::PostMouseEvent(VclEventId::WindowMouseMove, pWindow, &aEvent);
             break;
         default:
             assert(false);
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 0f2bc9024ea3..b7cab1b6dbc9 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1220,13 +1220,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 efe76df74b7c..cb6b48077c80 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3231,74 +3231,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


More information about the Libreoffice-commits mailing list