This should not introduce any problems. All functions of the page widget are now
called from the main thread.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>