summaryrefslogtreecommitdiff
path: root/libreofficekit/source
diff options
context:
space:
mode:
authorPranav Kant <pranavk@gnome.org>2015-08-15 18:48:11 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-08-17 11:49:34 +0200
commita9b266aeea80423210618fe4c015e4791ceb1bc2 (patch)
tree6534f8f0380bd585bc170722611d3c7dae240636 /libreofficekit/source
parent6a03b8ba75c2746d0391a3eb7354b36539c0053f (diff)
gtktiledviewer: Jump to cursor position when it changes
Change-Id: If50ac0bd21e59b0e0639aa353513451e88ae2a9f
Diffstat (limited to 'libreofficekit/source')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 8a2e4a2a111e..7f2dc73e08d8 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -117,6 +117,7 @@ enum
PART_CHANGED,
SIZE_CHANGED,
HYPERLINK_CLICKED,
+ CURSOR_CHANGED,
LAST_SIGNAL
};
@@ -518,6 +519,11 @@ callback (gpointer pData)
{
priv->m_aVisibleCursor = payloadToRectangle(pDocView, pCallback->m_aPayload.c_str());
priv->m_bCursorOverlayVisible = true;
+ g_signal_emit(pDocView, doc_view_signals[CURSOR_CHANGED], 0,
+ priv->m_aVisibleCursor.x,
+ priv->m_aVisibleCursor.y,
+ priv->m_aVisibleCursor.width,
+ priv->m_aVisibleCursor.height);
gtk_widget_queue_draw(GTK_WIDGET(pDocView));
}
break;
@@ -1743,6 +1749,25 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1,
G_TYPE_STRING);
+
+ /**
+ * LOKDocView::cursor-changed:
+ * @pDocView: the #LOKDocView on which the signal is emitted
+ * @nX: The new cursor position (X coordinate) in pixels
+ * @nY: The new cursor position (Y coordinate) in pixels
+ * @nWidth: The width of new cursor
+ * @nHeight: The height of new cursor
+ */
+ doc_view_signals[CURSOR_CHANGED] =
+ g_signal_new("cursor-changed",
+ G_TYPE_FROM_CLASS(pGObjectClass),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_generic,
+ G_TYPE_NONE, 4,
+ G_TYPE_INT, G_TYPE_INT,
+ G_TYPE_INT, G_TYPE_INT);
}
/**