Commit graph

1708 commits

Author SHA1 Message Date
Sebastian Ramacher
b460c711a0 Save some forks
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-22 22:26:52 +02:00
Sebastian Ramacher
10115db62f Rewrite render thread as request based system
ZathuraRenderer is a thread pool rendering the pages. Every page widget holds a
ZathuraRenderRequest instance to request its page to be rendered. This object
can also be used to abort the request in case the page is not visible anymore.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-21 18:32:18 +02:00
Moritz Lipp
0afc0e5382 Merge tag '0.2.4' into develop
Version 0.2.4
2013-08-15 00:44:59 +02:00
Moritz Lipp
e5f36e4018 Merge branch 'release/0.2.4' 2013-08-15 00:44:52 +02:00
Moritz Lipp
3978dc30b4 Version 0.2.4 2013-08-15 00:44:50 +02:00
Sebastian Ramacher
eabc306ec8 Run update-po
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-15 00:37:57 +02:00
Sebastian Ramacher
033833c50d Document that workaround
And a remainder that we want to drop this once we don't support GTK+2 anymore.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-14 23:39:34 +02:00
Marawan Tanager
c5e593d3c5 Don't hide the inputbar in case of incremental search
Hiding the inputbar immediately before jumping breaks incremental search, as
Guillaume Duranceau stated in an earlier mail.

This patch makes an exception for the case of incremental search, at the cost
of a slight displacement when jumping back (^o) after ending the incremental
search (pressing the ESC key). The rest of the jump cases are unaffected.

This should makes things usable for now, until we move to GTK3 (link to it by
default) which has a new widget that suits this problem nicely (GtkOverlay), as
demonstrated by an earlier patch by Abdo Roig-Maranges which is now included on
the develop branch in girara repo as commit
70fd1cf354ee1300d4a9bdab9e939d5cc975979e, but is compiled only with GTK3.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-14 23:35:43 +02:00
Sebastian Ramacher
b5237680f2 Don't store surface for invisible and uncached pages
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-27 16:25:20 +02:00
Sebastian Ramacher
f98514d5ed Increase reference in zathura_page_widget_update_surface
and always destroy in render.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-27 01:34:42 +02:00
Guillaume Duranceau
c6140296cd Update page number on mouse scroll
When scrolling a document by holding the middle mouse button, page
number was not updated.
2013-07-27 01:19:25 +02:00
Guillaume Duranceau
12f7b393a6 new window-title-page option
When set to 'true', this option displays the page number in the title of
a zathura window.
2013-07-27 01:18:46 +02:00
Sebastian Ramacher
03ea66c6ff Replace tabs with spaces
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-26 16:13:41 +02:00
Moritz Lipp
d699424cbe Add missing field initializer 2013-07-26 09:10:47 +02:00
Moritz Lipp
71a332ede8 Fix return with no value 2013-07-26 09:04:08 +02:00
Sebastian Ramacher
2ad8571f41 Add missing includes
Also fix other compiler warnings.

Closes: #332

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-25 21:57:39 +02:00
Abdó Roig-Maranges
f3229a6a5a Initialize bisect state when opening document
Otherwise, when opening a document at page 1, and no jumps are added,
bisect does not understand it has to initialize the bisect range, and
does not move from page 1.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-07 17:43:30 +02:00
Moritz Lipp
2b6fa0cfe6 Fix missing else in if condition 2013-07-07 00:40:32 +02:00
Abdo Roig-Maranges
7cdd1e7719 refresh horizontal position in page_set
After page_set cb_view_hadjustment_changed must be called so that when
zoom-center is enabled, the page is recentered.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-07 00:14:56 +02:00
Abdó Roig-Maranges
7f42ccbdad Improve bisect setup
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-07 00:12:45 +02:00
Sebastian Ramacher
65da0ffa50 Decouple bisect from jumplist
Move some bisect state to zathura_t and manipulate the jumplist that much.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-07 00:03:52 +02:00
Marwan Tanager
a0c8f4c4ce Fix a memory leak
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-30 18:36:12 +02:00
Marwan Tanager
486698d9fb Logical error fix and cleanup for zathura_jumplist_reset_current
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-30 18:36:12 +02:00
Sebastian Ramacher
3cf8fba779 Add a note that I want this to go away
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-29 11:45:07 +02:00
Marwan Tanager
99b32ae109 Make the jumplist persistent on a per-file basis
This patch implements two new ZathuraDatabaseInterface functions, save_jumplist
and load_jumplist, for both the plain and sqlite backends (along with some
cleanups).

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-29 11:35:29 +02:00
Marwan Tanager
87a7f2310f Hide the inputbar and completion menu before saving the adjustments ratios into a new jump structure
Since we are now saving the adjustments ratios in the jump structures, we need
to take care of the following scenario:

    - We do an action that results in a new jump structure being added to the
      jumplist while the inputbar is visible (e.g., search, jumping to a
      specific page, jumping to a bookmark, or following a link).

    - Since we are now storing the adjustments ratios in the jump structures,
      all of the above actions would result in the vertical adjustment ratio
      being saved while the inputbar and/or the completion menu is visible.

    - Now we are exactly on the target of the jump (note that the inputbar and
      completion menu now are hidden), so suppose that we want to go back using
      ^o (assuming that we didn't change the adjustments after jumping), then
      the check at sc_jumplist that compares the current adjustments ratios
      with that of the current jump (the jump that has just been added and
      which we are currently on it's position) would fail, because after the
      inputbar (with possibly the completion menu in case of bookmarks) is
      activated it is hidden, which results in the vertical adjustment upper
      bound to change, which in turn results in the vertical adjustment ratio
      returned by zathura_adjustment_get_ratio to become different from what is
      stored in the current jump structure, even though we haven't changed the
      adjustments at all after the jump.  This would always result in taking us
      back to the exact position of the jump (which would be slightly different
      from the current position) when we press ^o.  This can be annoying,
      because it would happen, for example, every time we need to go back
      quickly after jumping to a link target, a search result, or a bookmark.

So, what this patch does is essentially to make the vertical adjustment ratio
reflecting the current vertical adjustment after a jump, to always be the same
as the one stored in the newly added jump structure, since both are calculated
with zathura_adjustment_get_ratio while the inputbar is _not_ visible, so they
should be the same.

I've elaborated just to make things clear, in case the purpose of the patch
isn't obvious.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-29 11:35:13 +02:00
Marwan Tanager
7465ad6871 Jumplist: record the adjustments ratios, rather than their values
This makes jumping works accurately, even if the document is scaled up or down.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-29 11:35:11 +02:00
Marwan Tanager
d9f8750c86 Move calls to zathura_jumplist_add surrounding zathura_link_evaluate to zathura_link_evaluate itself
This is just in case that zathura_link_evaluate returns without evaluating the
link, which would result in a new jump being added for the current position,
but without adding a corresponding jump for the target position (actually a
second one would be added but the check in zathura_jumplist_add would prevent
it from being appended on the linked list since it's position would be the same
as the current one, because the link haven't been evaluated).

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-21 10:56:08 +02:00
Sebastian Ramacher
3e5bfe3d59 Use sqlite3_mprintf for proper escaping
Not that is really needed here since every argument is controlled by us. But
rather safe than sorry.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-21 10:36:52 +02:00
Sebastian Ramacher
12aa509fc2 Remove note about SQLITE_ENABLE_COLUMN_METADATA
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-21 10:30:35 +02:00
Sebastian Ramacher
3171a4f7f6 Add some comments to the code
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-21 10:25:31 +02:00
Marwan Tanager
4c795259fe Eliminate the need for sqlite3_table_column_metadata
This is so that Zathura would compile without errors when enabling sqlite
support on systems that doesn't have sqlite compiled with
SQLITE_ENABLE_COLUMN_METADATA (which are the majority).

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-21 10:16:41 +02:00
Sebastian Ramacher
b4f290d4f9 Create bookmarks table with {v,h}adj_ratio
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-21 10:07:10 +02:00
Marwan Tanager
ae59da30c8 Bookmark the exact position, not just the page number (along with a number of fixes).
This patch adds some enhancements/fixes to the bookmarking feature of Zathura:

    - Bookmark the exact vertical and horizontal adjustments values, along with
      the page number. This is done in a backward-compatible way for both the
      plain and sqlite database backends, so that bookmarks that was taken
      previously (bookmarking only the page number) will still work as expected
      and won't be lost.

    - Fix the issue of not being able to remove bookmarks from the plain
      database; removing a bookmark in plain_remove_bookmark using
      g_key_file_remove_key corrupts the bookmarks file.  This is due to not
      truncating the entire bookmarks file in zathura_db_write_key_file_to_file
      prior to overriding it with a new one not containing the removed line.
      This is why, I guess, plain_remove_bookmark hadn't been implemented as
      expected using g_key_file_remove_key, because apparently, someone thought
      that the problem is caused by this API.

    - Fix not being able to update existing bookmarks persistently; updating a
      bookmark works only during the current session, but after the file is
      closed and reopened, the updated bookmark still has it's old value. This
      is due to changing only the bookmark structure in memory; the proper way
      to do it, is to call zathura_db_remove_bookmark on the old bookmark, then
      follow that by a call to zathura_db_add_bookmark on a bookmark structure
      containing the new position and the same old ID.

    - Make zathura_bookmark_add updates the bookmark if it already exists,
      rather than doing this externally in cmd_bookmark_create. This allows us
      to have all the relevant girara_notify messages in cmd_bookmark_create.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-21 09:45:36 +02:00
Sebastian Ramacher
e6f23fd235 CS
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-20 20:22:07 +02:00
Marwan Tanager
8549abaa95 Fix the segfault that happens when jumping while the jumplist is initially empty.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-20 20:18:07 +02:00
Marwan Tanager
5b7fc5de5f Make jumping with ^o and ^i more compatible with Vim
- Allow the user to always start with the very last (or first) jump on the
      jumplist when pressing ^o (or ^i), while the jumplist iterator is
      pointing to the last (or first) jump, and the document is not currently
      at the position of this pointed-to jump. This is instead of jumping
      directly to the previous/next jump, and skipping the last/first one.

    - Don't jump to the current jump pointed to by the jumplist iterator, if
      there is no more next jumps, and the jump direction is FORWARD.

    - Don't jump to the current jump pointed to by the jumplist iterator, if
      there is no more previous jumps, and the jump direction is BACKWARD.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-20 20:18:04 +02:00
Sebastian Ramacher
14b8399a74 Put %f back.
A missing %f causes more problems than expected.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-19 21:26:21 +02:00
Moritz Lipp
30d5195328 Update documentation 2013-06-18 12:52:01 +02:00
Marwan Tanager
092fe81839 Use jumplist with marks
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-10 14:48:11 +02:00
Marwan Tanager
a0c12d4cdd Save position on the jumplist before and after jumping to a bookmark
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-10 14:48:11 +02:00
Marwan Tanager
afd008f466 Enhancements/Cleanups for the jumplist mechansim
- Don't delete the elements on the right of the current one, when
	  appending a new jump to the jumplist, because this makes no sense at
	  all; the point of the jumplist in the first place is to remember
	  previously jumped-to positions in the document, so there is no need
	  to delete anythings except to trim the oldest entries from the
	  beginning to maintain the maximum size. This also makes us compatible
	  with the Vim way of doing things.

	- Make the jumplist mechanism functional on the same page; if we
	  followed a link to a target on the same page, remember the
	  adjustments before and after following the link. The same holds for
	  navigating search results on the same page.

	- Implement position_set and use it instead of position_set_delayed
	  when following links in order to give zathura_jumplist_save a chance
	  to record the exact adjustments of the link target. Otherwise, it
	  will always record the adjustments after going to the target page,
	  but before going to the exact position within it.

	- Don't consider movements with ^i and ^o as jumps :)

	- Don't use page_set followed by setting the adjustments in
	  sc_jumplist, because this is redundant and causes clutter when using
	  ^i and ^o, as the adjustments is set twice this way (once in page_set
	  and again in position_set_delayed).  It's enough to only update the
	  page number on the statusbar and then set the adjustments.

	- Hide implementation details (zathura_jumplist_save and
	  zathura_jumplist_append), and make things more consistent by
	  exporting and using only zathura_jumplist_add for adding new entries.

The end result: A more slick jumping experience :-)

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-10 14:48:10 +02:00
Marwan Tanager
88bff5dfd2 Include backward-search commands in the history plain database
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-10 14:38:34 +02:00
Marwan Tanager
cc3b9aea18 More Vim-like search behavior
This patch activates the last aborted search when pressing the search shortcuts
('n' or 'N').

To avoid confusion, and to make things more predictable, I've chosen to always
reactivate an aborted search starting from the beginning (or end, in case of
'N' or '?') of the current page, as opposed to Vim which continues from the
next search term each time the search is reactivated.

Searching using '/' or '?' doesn't center the view at the current search term
like when using 'n' or 'N', so we fix this here.

Also, I managed to work around the issue of the thin rectangular margins that
show around the previously-highlighted search terms after the search is aborted
(either explicitly or as a result of following links), by redrawing the page
widget (only if it's visible) instead of redrawing the rectangles covering the
highlighted search terms.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-10 14:35:19 +02:00
Marwan Tanager
463545c3a3 Document the new show-{h, v}-scrollbar settings
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-02 11:45:37 +02:00
Marwan Tanager
2d9ea08729 Use show-v-scrollbar instead of show-scrollbars
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-02 11:45:26 +02:00
Moritz Lipp
df466eeeb2 Fix 2013-05-28 23:39:18 +02:00
Moritz Lipp
cdece59229 Fix previous commit 2013-05-28 18:12:15 +02:00
Moritz Lipp
cf96d52790 Report missing plugin/unsupported file type 2013-05-28 17:00:37 +02:00
Moritz Lipp
b17c05c960 Merge branch 'develop' 2013-05-12 23:28:29 +02:00