[latexila] synctex: pass correct timestamp for sync_view()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] synctex: pass correct timestamp for sync_view()
- Date: Thu, 1 Jan 2015 11:45:22 +0000 (UTC)
commit 41a7179396c545863fcb66fec8da4cfd3e7c257f
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Jan 1 12:33:36 2015 +0100
synctex: pass correct timestamp for sync_view()
It's important to pass the correct timestamp, because if
GDK_CURRENT_TIME is used, sometimes Evince is not shown directly, but a
notification appears: "Document Viewer [...] is ready", so it was a bit
annoying to click on the notification to show Evince.
Now it should be fixed.
src/document_view.vala | 3 ++-
src/liblatexila/latexila-synctex.c | 14 ++++++++++++--
src/liblatexila/latexila-synctex.h | 3 ++-
src/main_window.vala | 2 +-
4 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/document_view.vala b/src/document_view.vala
index d405967..eb6eeaf 100644
--- a/src/document_view.vala
+++ b/src/document_view.vala
@@ -205,7 +205,8 @@ public class DocumentView : Gtk.SourceView
{
Latexila.Synctex synctex = Latexila.Synctex.get_instance ();
Document doc = this.buffer as Document;
- synctex.forward_search (this.buffer, doc.location, doc.get_main_file ());
+ synctex.forward_search (this.buffer, doc.location, doc.get_main_file (),
+ event.time);
}
// propagate the event further
diff --git a/src/liblatexila/latexila-synctex.c b/src/liblatexila/latexila-synctex.c
index 5c1b0a5..177621a 100644
--- a/src/liblatexila/latexila-synctex.c
+++ b/src/liblatexila/latexila-synctex.c
@@ -51,6 +51,7 @@ typedef struct
GtkTextBuffer *buffer;
GFile *buffer_location;
gchar *pdf_uri;
+ guint timestamp;
} ForwardSearchData;
typedef struct
@@ -532,7 +533,7 @@ connect_evince_window_cb (LatexilaSynctex *synctex,
evince_window_call_sync_view (evince_window,
buffer_path,
get_buffer_position (data->buffer),
- GDK_CURRENT_TIME,
+ data->timestamp,
NULL,
(GAsyncReadyCallback) sync_view_cb,
data);
@@ -609,15 +610,23 @@ pdf_file_query_exists_cb (GFile *pdf_file,
* @buffer: a #GtkTextBuffer.
* @buffer_location: the *.tex file of @buffer.
* @main_tex_file: the main *.tex file of @buffer.
+ * @timestamp: the timestamp of the event.
*
* Does a forward search, i.e. switch from the *.tex file to the PDF file at the
* same position as the cursor position in @buffer.
+ *
+ * A correct @timestamp of the event is important. If %GDK_CURRENT_TIME is used
+ * instead, Evince is sometimes not shown directly, a notification appears
+ * instead saying that the "Document Viewer [...] is ready". It's more
+ * convenient if the Evince window is presented directly, which should work if
+ * the correct @timestamp is provided.
*/
void
latexila_synctex_forward_search (LatexilaSynctex *synctex,
GtkTextBuffer *buffer,
GFile *buffer_location,
- GFile *main_tex_file)
+ GFile *main_tex_file,
+ guint timestamp)
{
ForwardSearchData *data;
GFile *pdf_file;
@@ -639,6 +648,7 @@ latexila_synctex_forward_search (LatexilaSynctex *synctex,
data->buffer = g_object_ref (buffer);
data->buffer_location = g_object_ref (buffer_location);
data->pdf_uri = get_pdf_uri (main_tex_file);
+ data->timestamp = timestamp;
pdf_file = g_file_new_for_uri (data->pdf_uri);
diff --git a/src/liblatexila/latexila-synctex.h b/src/liblatexila/latexila-synctex.h
index f303aa0..a2f6784 100644
--- a/src/liblatexila/latexila-synctex.h
+++ b/src/liblatexila/latexila-synctex.h
@@ -57,7 +57,8 @@ void latexila_synctex_connect_evince_window (LatexilaSynct
void latexila_synctex_forward_search (LatexilaSynctex *synctex,
GtkTextBuffer *buffer,
GFile *buffer_location,
- GFile *main_tex_file);
+ GFile *main_tex_file,
+ guint timestamp);
G_END_DECLS
diff --git a/src/main_window.vala b/src/main_window.vala
index 70a2822..66c1f2a 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -1111,7 +1111,7 @@ public class MainWindow : Window
Latexila.Synctex synctex = Latexila.Synctex.get_instance ();
synctex.forward_search (active_document, active_document.location,
- active_document.get_main_file ());
+ active_document.get_main_file (), Gdk.CURRENT_TIME);
}
/* Projects */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]