Commit Graph

58 Commits

Author SHA1 Message Date
Sebastian Ramacher
7b8f5d17cb Implement image-selected event for GTK+3
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-31 14:53:51 +01:00
Sebastian Ramacher
5df5357fb0 Finish moving of the page cache
Add two more signals to ZathuraRenderRequest to notify pages if they are cached
or not. This allows us to move some logic away from
cb_view_vadjutment_value_changed to more appropriate places.

ZathuraPageWidget will now release the surface if
* it gets the signal that the page is no longer cached and the page is
  invisible,
* the page is not cached and the render request is aborted.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-19 17:45:12 +02:00
Sebastian Ramacher
2c9e34fa8a Merge branch 'feature/renderer-take-2' into develop 2013-10-18 16:12:50 +02:00
Sebastian Ramacher
2ad2b9e0c4 Use signals for selected images and text
The page widget shouldn't have to care what should be done with selected images
and text.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-31 13:12:41 +02:00
Marwan Tanager
d09cd5c62c Make the X clipboard buffer configurable
This patch adds a new configuration setting, selection-clipboard, which allows
us to choose between the PRIMARY selection, and the CLIPBOARD selection, for
determining which X clipboard to use for storing mouse-selected data. It has
only two valid values: "primary" and "clipboard", with "clipboard" being set as
the it's default value.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-31 12:30:12 +02:00
Sebastian Ramacher
16fbefa5cf Abort requests if the page becomes invisible
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 18:59:47 +02:00
Sebastian Ramacher
07005886f8 Sort requests based on last view time again
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 17:50:34 +02:00
Sebastian Ramacher
8a9bd7f512 We don't need zathura
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 15:43:43 +02:00
Sebastian Ramacher
e733e032ce Add a callback for the signal
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 12:59:27 +02:00
Sebastian Ramacher
b02d3d4b8f Move recolor state to the renderer
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-24 00:07:32 +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
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
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
1a145c5166 Use the 64-bit variants of g_param_spec_int and g_value_set_int for installing and accessing the last-view property.
This fixes the bug of the page cache acting weird (e.g. the same cache index is
invalidated over and over again) after being used for some time. This is
because when we read the last-view property, we only get the least-significant
32 bits of the last_view private member.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-01 18:18:07 +02:00
Marwan Tanager
cb18fe8603 Replace the periodic page reclaiming code with a LRU caching algorithm.
This patch implements a page cache that is invalidated in a LRU fashion.

Pages are added to the cache as soon as they become visible. When the cache is
full and a new page that isn't in the cache becomes visible, the least recently
viewed page in the cache is evicted from memory and the new one takes it's
place.

The cache size is configurable using the page-cache-size configuration
variable, with a default value of 15 pages. Very large values for the cache
size are not recommended, though, as it will stress the system memory out.

The old periodic page reclaiming code is no longer necessary with this patch,
so I removed it.

Special thanks to Ignas Anikevičius, and Sebastian Ramacher for the
inspirations.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-26 12:45:43 +01:00
Sebastian Ramacher
cd3314b490 Save some string copies
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-25 02:58:37 +01:00
Marwan Tanager
e7cbd25be0 Don't render if the new surface passed to zathura_page_widget_update_surface is NULL.
I don't see any reason for queueing a redraw if the new surface is NULL.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-24 15:42:27 +01:00
Sebastian Ramacher
7ad6c2f422 Don't render same page multiple times
If we have already requested a page to be rendered, we don't have to request it
once again.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-24 03:27:57 +01:00
Sebastian Ramacher
35adeacbf5 Implement colors for 'Loading ...'.
Thanks to oblique for the patch.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-23 17:33:03 +01:00
Sebastian Ramacher
edde1bf00f Restore compatibility with earlier versions of glib
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-09 15:10:00 +01:00
Ignas Anikevicius (gns_ank)
7dd30a42cf Fix some mutex deprecation warnings in page-widget
According to my compiler output and the page on glib deprecated APIs
[1], some of the stuff needed to be removed or changed.

[1] - http://developer.gnome.org/glib/2.31/glib-Deprecated-Thread-APIs.html

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-08 18:03:07 +01:00
Benoît Knecht
8f50bf5ea0 Fix fence post error in page-widget's redraw_rect()
A rectangle whose horizontal coordinates are x1 on the left and x2 on
the right is (x2 + 1) - x1 pixels wide, not x2 - x1.

This error caused the search result highlighting to leave a
one-pixel-wide border behind, on the right and bottom side of the
result.

See issue 242 <http://bugs.pwmt.org/issue242>.

Reported-by: Abdó Roig <abdo.roig@gmail.com>

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-12-14 15:35:54 +01:00
Moritz Lipp
89e7832047 Update style 2012-10-09 01:12:18 +02:00
Moritz Lipp
b24ae033ad Set fullscreen mode and custom button press events 2012-10-05 00:41:05 +02:00
Abdó Roig-Maranges
83b12590a9 Cairo wants colors as doubles between 0 and 1
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-08-18 18:16:43 +02:00
Moritz Lipp
f6c6b4a883 En/Disable syntex support 2012-08-13 18:17:20 +02:00
Abdó Roig-Maranges
9ed64ff606 Solved blinking bug when recoloring with grey background
There was a problem passing colors to cairo_set_source_rgb.
Should be floats between 0 and 1.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-07-31 23:55:23 +02:00
Sebastian Ramacher
49116a0834 Synctex backwards synchronization
Thanks to Roland Schatz for the patch.
2012-07-13 15:39:16 +02:00
Sebastian Ramacher
cfd324fae6 Translate 'Loading...' 2012-06-20 16:57:51 +02:00
Sebastian Ramacher
aa2abd0bc4 more debug output 2012-06-20 16:41:01 +02:00
Moritz Lipp
2acd67c142 Finish surface before calling destroy 2012-06-16 08:51:30 +02:00
Moritz Lipp
bc3791859b Use recolor colors while loading page 2012-06-04 11:46:35 +02:00
Moritz Lipp
365dc9a66e Improve zathura_link_t 2012-05-28 12:43:22 +02:00
Moritz Lipp
122ea70e16 Render last-viewed pages with a higher priority 2012-05-15 07:52:23 +02:00
Moritz Lipp
4c25d68777 Restructure zathura_page_widget_private_s 2012-05-06 23:41:25 +02:00
Moritz Lipp
c69eebd87f Export images and attachments 2012-05-01 11:54:52 +02:00
Moritz Lipp
036dc0cd57 Implement hlsearch/nohlsearch 2012-04-22 19:12:45 +02:00
Moritz Lipp
ef99076a48 Prevent zathura from SIGSEGV if link is a NULL pointer 2012-04-22 10:33:30 +02:00
Moritz Lipp
adc9f41264 Introduce new link types 2012-04-22 10:04:46 +02:00
Sebastian Ramacher
c8c0aa361f Fix typo. 2012-04-03 17:24:56 +02:00
Moritz Lipp
97247f41ca Unhitch zathura_t from document_t/page_t/plugin_manager_t 2012-04-03 09:02:45 +02:00
Moritz Lipp
b458b8c17a Merge branch 'develop' of pwmt.org:zathura into develop 2012-04-02 22:56:49 +02:00
Moritz Lipp
69bb09c43b Compile with GTK3 2012-04-02 22:56:44 +02:00
Sebastian Ramacher
b30d021ca0 Fix index check. 2012-04-02 12:42:55 +02:00
Moritz Lipp
ab4c364e56 Update document information plugin api 2012-03-30 18:24:00 +02:00
Moritz Lipp
334b4fbb95 Introduce and use zathura_document wrapper functions 2012-03-27 21:59:35 +02:00
Moritz Lipp
2826595333 Merge branch 'develop' of pwmt.org:zathura into develop 2012-03-27 11:19:45 +02:00
Moritz Lipp
fa40facc71 Begin to introduce types.h 2012-03-27 11:19:39 +02:00
Sebastian Ramacher
3ae7e5d7b6 Merge branch 'develop' of pwmt.org:zathura into develop 2012-03-27 00:15:51 +02:00