diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-05 14:19:35 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-09 08:12:10 +0100 |
commit | 4b707104207e96d4e6666be7ad6e00ac4c6a10bc (patch) | |
tree | 759422d13e608218f242b313fc107ce973aad2e2 /libreofficekit | |
parent | 768dea15b4c5c50367e40af45fc2265478ec154b (diff) |
lok::Document::postMouseEvent(): allow double-click
Change-Id: Idaddd28d906e7508d4d2c5aab916b06fbe021beb
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index d0c5cfba2314..3e791a7b6705 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -50,11 +50,23 @@ void lcl_signalButton(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocView* switch (pEvent->type) { case GDK_BUTTON_PRESS: - pDocView->pDocument->pClass->postMouseEvent(pDocView->pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); + { + int nCount = 1; + if ((pEvent->time - pDocView->m_nLastButtonPressTime) < 250) + nCount++; + pDocView->m_nLastButtonPressTime = pEvent->time; + pDocView->pDocument->pClass->postMouseEvent(pDocView->pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount); break; + } case GDK_BUTTON_RELEASE: - pDocView->pDocument->pClass->postMouseEvent(pDocView->pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); + { + int nCount = 1; + if ((pEvent->time - pDocView->m_nLastButtonReleaseTime) < 250) + nCount++; + pDocView->m_nLastButtonReleaseTime = pEvent->time; + pDocView->pDocument->pClass->postMouseEvent(pDocView->pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount); break; + } default: break; } @@ -116,6 +128,8 @@ static void lok_docview_init( LOKDocView* pDocView ) pDocView->m_bEdit = FALSE; memset(&pDocView->m_aVisibleCursor, 0, sizeof(pDocView->m_aVisibleCursor)); pDocView->m_bCursorVisible = FALSE; + pDocView->m_nLastButtonPressTime = 0; + pDocView->m_nLastButtonReleaseTime = 0; gtk_signal_connect( GTK_OBJECT(pDocView), "destroy", GTK_SIGNAL_FUNC(lcl_onDestroy), NULL ); |