summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Varga <mihai.varga@collabora.com>2016-05-24 13:57:26 +0530
committerPranav Kant <pranavk@collabora.com>2016-05-24 13:57:26 +0530
commit1cc66ffa57dc3b65c7a1a43e99a0cad7007b0474 (patch)
tree09c4b9c0baa1c20c292140c71ef49f0c061ad4bf
parent1151ec8b519be960ca6975accac9be1f6e7959dc (diff)
LOK: added the button type and key modifier to postMouseEvent()
To get a better functionality we need to know the button type (left, right, middle). We also need the key modifier (ctrl, alt, shift) for actions such as ctrl+click (to open a link) or shift+click to select (cherry picked from commit c90c08a65c480a1012182979d5e9218f17a2ba2e) Button type was not cherry-picked earlier in 527a83d77c139427028ad08bef3a6349135716f7 Change-Id: If05326b1d7c82f14808bd2c15f552508b97bc7c1
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx30
1 files changed, 28 insertions, 2 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index cdc7e8016f61..242bfa7dcd3b 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -460,19 +460,45 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent)
case GDK_BUTTON_PRESS:
{
int nCount = 1;
+ int nButtons = MOUSE_LEFT;
+ switch(pEvent->button) {
+ case 1:
+ nButtons = MOUSE_LEFT;
+ break;
+ case 2:
+ nButtons = MOUSE_MIDDLE;
+ break;
+ case 3:
+ nButtons = MOUSE_RIGHT;
+ break;
+ }
+
if ((pEvent->time - m_nLastButtonPressTime) < 250)
nCount++;
m_nLastButtonPressTime = pEvent->time;
- m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount, MOUSE_LEFT, 0);
+ m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount, nButtons, 0);
break;
}
case GDK_BUTTON_RELEASE:
{
int nCount = 1;
+ int nButtons = MOUSE_LEFT;
+ switch(pEvent->button) {
+ case 1:
+ nButtons = MOUSE_LEFT;
+ break;
+ case 2:
+ nButtons = MOUSE_MIDDLE;
+ break;
+ case 3:
+ nButtons = MOUSE_RIGHT;
+ break;
+ }
+
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, MOUSE_LEFT, 0);
+ m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount, nButtons, 0);
break;
}
default: