Kaydet (Commit) 7c0efaab authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst 447783a9
...@@ -103,9 +103,6 @@ struct LOKDocView_Impl ...@@ -103,9 +103,6 @@ struct LOKDocView_Impl
bool m_bInDragGraphicHandles[8]; 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(). /// Callback data, allocated in lok_docview_callback_worker(), released in lok_docview_callback().
struct CallbackData struct CallbackData
{ {
...@@ -261,8 +258,8 @@ LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView) ...@@ -261,8 +258,8 @@ LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView)
m_pHandleEnd(0), m_pHandleEnd(0),
m_aHandleEndRect({0, 0, 0, 0}), m_aHandleEndRect({0, 0, 0, 0}),
m_bInDragEndHandle(false), m_bInDragEndHandle(false),
m_pGraphicHandle(0),
m_bTextSelectionAdjusted(false) m_pGraphicHandle(0)
{ {
memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects)); memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects));
memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles)); memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles));
...@@ -454,20 +451,16 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent) ...@@ -454,20 +451,16 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent)
if ((pEvent->time - m_nLastButtonPressTime) < 250) if ((pEvent->time - m_nLastButtonPressTime) < 250)
nCount++; nCount++;
m_nLastButtonPressTime = pEvent->time; m_nLastButtonPressTime = pEvent->time;
m_bTextSelectionAdjusted = false;
m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount); m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount);
break; break;
} }
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:
{ {
if (!m_bTextSelectionAdjusted) int nCount = 1;
{ if ((pEvent->time - m_nLastButtonReleaseTime) < 250)
int nCount = 1; nCount++;
if ((pEvent->time - m_nLastButtonReleaseTime) < 250) m_nLastButtonReleaseTime = pEvent->time;
nCount++; m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount);
m_nLastButtonReleaseTime = pEvent->time;
m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount);
}
break; break;
} }
default: default:
...@@ -548,9 +541,8 @@ gboolean LOKDocView_Impl::signalMotionImpl(GdkEventButton* pEvent) ...@@ -548,9 +541,8 @@ gboolean LOKDocView_Impl::signalMotionImpl(GdkEventButton* pEvent)
return FALSE; return FALSE;
} }
// Otherwise adjust the text selection, as on the desktop. // Otherwise a mouse move, as on the desktop.
m_pDocument->pClass->setTextSelection(m_pDocument, LOK_SETTEXTSELECTION_END, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEMOVE, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), 1);
m_bTextSelectionAdjusted = true;
return FALSE; return FALSE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment