[Libreoffice-commits] core.git: 2 commits - libreofficekit/source sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed May 20 03:38:51 PDT 2015


 libreofficekit/source/gtk/lokdocview.cxx |   26 +++++++++-----------------
 sw/source/uibase/docvw/edtwin.cxx        |    2 +-
 2 files changed, 10 insertions(+), 18 deletions(-)

New commits:
commit cc5f9db22ea7a127507584ab32cf1c2aa1a8979c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed May 20 12:05:50 2015 +0200

    SwEditWin::MouseMove: ignore visual area when tiled rendering
    
    With this, it's possible to do mouse-button-down + move several times +
    mouse-button-up desktop-style selection of Writer text.
    
    Change-Id: If0711c5d397a8342b31c9b5448bf6223990529e4

diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 8ff7f53..c88a0f8 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -3729,7 +3729,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
     }
 
     const Point aOldPt( rSh.VisArea().Pos() );
-    const bool bInsWin = rSh.VisArea().IsInside( aDocPt );
+    const bool bInsWin = rSh.VisArea().IsInside( aDocPt ) || rSh.isTiledRendering();
 
     if( m_pShadCrsr && !bInsWin )
         delete m_pShadCrsr, m_pShadCrsr = 0;
commit 7c0efaab356d082dd95baf8fe40dbfb413b6d506
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed May 20 12:16:56 2015 +0200

    lokdocview: use postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE)
    
    This is much better than using setTextSelection() directly, as that was
    introduced only to adjust an existing selection.
    
    Change-Id: I881c3e4e5b0c97891f29dac0da42c1d3a51361e8

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 47b57a6..2cbd450 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -103,9 +103,6 @@ struct LOKDocView_Impl
     bool m_bInDragGraphicHandles[8];
     ///@}
 
-    /// If text selection is adjusted -> then mouse up event is a NOP.
-    bool m_bTextSelectionAdjusted;
-
     /// Callback data, allocated in lok_docview_callback_worker(), released in lok_docview_callback().
     struct CallbackData
     {
@@ -261,8 +258,8 @@ LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView)
     m_pHandleEnd(0),
     m_aHandleEndRect({0, 0, 0, 0}),
     m_bInDragEndHandle(false),
-    m_pGraphicHandle(0),
-    m_bTextSelectionAdjusted(false)
+
+    m_pGraphicHandle(0)
 {
     memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects));
     memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles));
@@ -454,20 +451,16 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent)
         if ((pEvent->time - m_nLastButtonPressTime) < 250)
             nCount++;
         m_nLastButtonPressTime = pEvent->time;
-        m_bTextSelectionAdjusted = false;
         m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount);
         break;
     }
     case GDK_BUTTON_RELEASE:
     {
-        if (!m_bTextSelectionAdjusted)
-        {
-            int nCount = 1;
-            if ((pEvent->time - m_nLastButtonReleaseTime) < 250)
-                nCount++;
-            m_nLastButtonReleaseTime = pEvent->time;
-            m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount);
-        }
+        int nCount = 1;
+        if ((pEvent->time - m_nLastButtonReleaseTime) < 250)
+            nCount++;
+        m_nLastButtonReleaseTime = pEvent->time;
+        m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount);
         break;
     }
     default:
@@ -548,9 +541,8 @@ gboolean LOKDocView_Impl::signalMotionImpl(GdkEventButton* pEvent)
         return FALSE;
     }
 
-    // Otherwise adjust the text selection, as on the desktop.
-    m_pDocument->pClass->setTextSelection(m_pDocument, LOK_SETTEXTSELECTION_END, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y));
-    m_bTextSelectionAdjusted = true;
+    // Otherwise a mouse move, as on the desktop.
+    m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEMOVE, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), 1);
 
     return FALSE;
 }


More information about the Libreoffice-commits mailing list