diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-01-20 10:20:24 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-01-26 10:27:37 +0100 |
commit | 8807da1cf87681179f03bcbf413e6830a7d2327e (patch) | |
tree | 2c6de099f4f86d364c0fef3a44bd62d6082b9f85 /libreofficekit | |
parent | 0869d8ef419918ead63363a73a1838f3fe616b2a (diff) |
gtktiledviewer: call postMouseEvent()
Again, no unit conversion yet.
Change-Id: I261febd875bac5a729f449e42558b5af9d7a359b
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 9 | ||||
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.c | 24 |
2 files changed, 22 insertions, 11 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index 085e3e377b25..ea5a2733a55c 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -160,14 +160,6 @@ static void signalKey(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpointer /*pD pLOKDocView->pOffice->pClass->postKeyEvent(pLOKDocView->pOffice, LOK_KEYEVENT_KEYINPUT, nCode); } -/// Receives a button press event. -static void signalButton(GtkWidget* /*pWidget*/, GdkEvent* /*pEvent*/, gpointer /*pData*/) -{ - LOKDocView* pLOKDocView = LOK_DOCVIEW(pDocView); - - lok_docview_set_edit(pLOKDocView, TRUE); -} - // GtkComboBox requires gtk 2.24 or later #if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2 void populatePartSelector() @@ -325,7 +317,6 @@ int main( int argc, char* argv[] ) // Input handling. g_signal_connect(pWindow, "key-press-event", G_CALLBACK(signalKey), NULL); g_signal_connect(pWindow, "key-release-event", G_CALLBACK(signalKey), NULL); - g_signal_connect(pDocView, "button-press-event", G_CALLBACK(signalButton), NULL); gtk_container_add( GTK_CONTAINER(pVBox), pDocView ); diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index b335d8b7f0ab..bf8dd718af03 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -33,6 +33,26 @@ void lcl_onDestroy( LOKDocView* pDocView, gpointer pData ) pDocView->pDocument = NULL; } +/// Receives a button press event. +void lcl_signalButton(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocView* pDocView) +{ + (void) pEventBox; + + lok_docview_set_edit(pDocView, TRUE); + + switch (pEvent->type) + { + case GDK_BUTTON_PRESS: + pDocView->pOffice->pClass->postMouseEvent(pDocView->pOffice, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pEvent->x, pEvent->y); + break; + case GDK_BUTTON_RELEASE: + pDocView->pOffice->pClass->postMouseEvent(pDocView->pOffice, LOK_MOUSEEVENT_MOUSEBUTTONUP, pEvent->x, pEvent->y); + break; + default: + break; + } +} + SAL_DLLPUBLIC_EXPORT guint lok_docview_get_type() { static guint lok_docview_type = 0; @@ -73,8 +93,8 @@ static void lok_docview_init( LOKDocView* pDocView ) gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(pDocView), pDocView->pEventBox ); - // Allow reacting to button press events. - gtk_widget_set_events(pDocView->pEventBox, GDK_BUTTON_PRESS_MASK); + gtk_signal_connect(GTK_OBJECT(pDocView->pEventBox), "button-press-event", GTK_SIGNAL_FUNC(lcl_signalButton), pDocView); + gtk_signal_connect(GTK_OBJECT(pDocView->pEventBox), "button-release-event", GTK_SIGNAL_FUNC(lcl_signalButton), pDocView); gtk_widget_show( pDocView->pEventBox ); |