Commit graph

79 commits

Author SHA1 Message Date
Lingzhu Xiang
f9b4a12208 Make thumbnail maximum size configurable 2014-10-28 18:11:52 -04:00
Lingzhu Xiang
25e88a114a Penalize large render jobs during zooming
All but the last jobs during zooming are aborted, so let smaller
jobs go faster.
2014-10-28 16:32:26 -04:00
Lingzhu Xiang
757f3d8257 Avoid large amount of scaling for pages at low zoom level 2014-10-28 03:46:20 -04:00
Lingzhu Xiang
b0c068f3cb Check memory allocation 2014-10-28 03:44:26 -04:00
Sebastian Ramacher
42c1780aef CS
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-10-26 21:32:20 +01:00
Lingzhu Xiang
4d948fbfb6 Cache thumbnails to support smooth zooming 2014-10-26 16:13:59 -04:00
Sebastian Ramacher
fca4d040a4 Move synctex logic away from ZathuraPage
Also emit the D-Bus signal
2014-08-22 20:42:33 +02:00
Sebastian Ramacher
932351add8 Remove another realpath call
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-08-15 18:34:21 +02:00
Sebastian Ramacher
eabd883e62 Add synctex-editor-command setting
Also, turn on SyncTeX backward synchronization per default and remove -s option.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-07-26 16:14:36 +02:00
Sebastian Ramacher
099246f91f Fix color for 'Loading ...'
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-05-26 22:06:38 +02:00
Sebastian Ramacher
5907300535 Reset mouse cursor if we leave the page
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-05-25 00:52:04 +02:00
Sebastian Ramacher
db9ee77f13 Change cursor if mouse is over link
Thanks to MaximeC for the initial patch.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-05-24 18:04:59 +02:00
Sebastian Ramacher
2d785cc20d Check indices before accessing the list
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-04-07 16:00:19 +02:00
Sebastian Ramacher
693f1d713a GObject references should be unref'd in dispose
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-01-19 20:53:44 +01:00
Sebastian Ramacher
1d398dfaf0 Remove mutex from page widget
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>
2013-12-03 20:30:51 +01:00
Sebastian Ramacher
0ac744c076 I guess this mutex is no longer needed
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-12-03 17:04:58 +01:00
Sebastian Ramacher
43c3ba86f4 Replace some more GdkColors with GdkRGBA
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-12-01 16:04:04 +01:00
Sebastian Ramacher
cff05ac10e Replace some GdkColors with GdkRGBA
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-12-01 15:47:28 +01:00
Sebastian Ramacher
08a72c46d4 Merge branch 'feature/remove-gtk2' into develop 2013-12-01 15:19:10 +01:00
Sebastian Ramacher
2c76fde31f Make sure there are no outstanding requests if the page size gets changed
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-28 14:16:17 +01:00
Sebastian Ramacher
f59a6f539e Remove GTK+2 support
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-25 18:57:59 +01:00
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