1
0
mirror of https://gitlab.gnome.org/GNOME/evince synced 2024-06-30 22:54:23 +00:00
Commit Graph

730 Commits

Author SHA1 Message Date
Nelson Benítez León
0e6e8673f2 Revert "ev-view-presentation: Simplify reset_jobs calls"
This reverts commit 6702f26186.

Fixes #2035


(cherry picked from commit 57888a3290)
2024-06-01 18:44:26 +00:00
Nelson Benítez León
64596bd624 Fix crash when annotation window is closed outside of Evince
Under Wayland, when closing an Evince annotation window
directly from the desktop compositor e.g. gnome-shell
then Evince would crash when trying to draw the window
as it haven't noticed it has gone.

Fixed by listening to "delete-event" signal so Evince
notices the closing and acts accordingly.

Fixes #2009
2024-02-13 01:30:27 +00:00
Pablo Correa Gómez
2e78f134fd ev-view: do not define unnecessary function prototype ahead
The function itself is defined before any user
2023-10-14 19:08:57 +00:00
Marek Kasik
7abb0d5b09 libview: Fix transformation of view coordinates
Fix transformation of view coordinates to Evince's
document coordinates for rotated pages.

This fixes placing of annotations on rotated pages.

Fixes #1951
2023-07-18 17:07:44 +02:00
Antia Puentes
7e035cc195 libview: Select caret to doc's start/end relative to the selection
Originally https://bugzilla.gnome.org/show_bug.cgi?id=704631

Fixes #387
2023-06-21 02:59:31 +00:00
Antia Puentes
f789910f51 libview: Move the caret to start/end line relative to the selection
Originally https://bugzilla.gnome.org/show_bug.cgi?id=704631

Fixes #387
2023-06-21 02:59:31 +00:00
Antia Puentes
672f1f950f libview: Move the caret to prev/next line relative to the selection
Originally https://bugzilla.gnome.org/show_bug.cgi?id=704631

Fixes #387
2023-06-21 02:59:31 +00:00
Antia Puentes
db2bd455b9 libview: Move the caret by word relative to the selection's boundaries
Originally https://bugzilla.gnome.org/show_bug.cgi?id=704631

Fixes #387
2023-06-21 02:59:31 +00:00
Antia Puentes
f27678e83f libview: Move the caret to the boundaries of a selection
Move the cursor to one the boundaries of the selection failed
if such selection boundary is not in the current page.

Originally https://bugzilla.gnome.org/show_bug.cgi?id=704631

Fixes #387
2023-06-21 02:59:31 +00:00
Raffaele
c63140a999 libview: Place at the top center "end of presentation" text 2023-06-21 02:54:32 +00:00
Pablo Correa Gómez
6150af1a8a libview: make it possible to get libview icon directory from env var
Together with changes to meson, it allows to have icons while doing
"meson devenv". Icons are expected under the "hicolor" location, so
create a link that points there.
2023-06-18 21:58:25 +00:00
Pablo Correa Gómez
d68515c164 ev-page-accessible: silence maybe-uninitialized warnings
Silence the following warnings, since the compiler does not have the
warranty that start and end might have been set inside get_selection_bounds

../libview/ev-page-accessible.c: In function 'ev_page_accessible_get_selection':
../libview/ev-page-accessible.c:731:74: warning: 'start' may be used uninitialized [-Wmaybe-uninitialized]
  731 |                 if (get_selection_bounds (view, selection, &start, &end) && start != end) {
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../libview/ev-page-accessible.c:726:22: note: 'start' was declared here
  726 |                 gint start, end;
      |                      ^~~~~
../libview/ev-page-accessible.c:731:74: warning: 'end' may be used uninitialized [-Wmaybe-uninitialized]
  731 |                 if (get_selection_bounds (view, selection, &start, &end) && start != end) {
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../libview/ev-page-accessible.c:726:29: note: 'end' was declared here
  726 |                 gint start, end;
      |                             ^~~
}
}
2023-05-20 18:23:20 +00:00
Pablo Correa Gómez
19babb9114 Use G_SOURCE_CONTINUE and G_SOURCE_REMOVE when appropriate
Instead of directly TRUE and FALSE, to improve readability. These are
used in GSourceFunc functions, and represent no change in behavior!
2023-05-20 15:35:48 +00:00
Nelson Benítez León
10f4562e57 ev-view.c: fix crash when hovering links
Small oversight from the refactor in commit 33b251b6
which removed the "set to null" but forgot to
change the g_object_unref() for the g_clear_object()
call.

Bisected by Germán Poo-Caamaño.

Closes #1933
2023-04-29 14:56:20 -04:00
Pablo Correa Gómez
73496af932
ev-view: Remove clear_link_selected private function
This function is a one-liner, that can instead be intuitively replaced
in the different places where it is used.
2023-03-24 09:58:49 +01:00
Pablo Correa Gómez
6702f26186
ev-view-presentation: Simplify reset_jobs calls
ev_presentation_delete_job already checks whether the job is NULL,
and finishes with a g_object_unref which warranties that

pview->*_job = NULL

So there's no need to set them afterwards.
2023-03-24 09:58:48 +01:00
Pablo Correa Gómez
33b251b6e1
libview: simplify freeing memory by better exploiting glib functions
Mostly g_clear_object and g_clear_pointer. But also some small
simplifications depending on the context.
2023-03-24 09:58:48 +01:00
Qiu Wenbo
48f4198625 libview: Remove trailing whitespaces
Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
Signed-off-by: Pablo Correa Gomez <ablocorrea@hotmail.com>
2023-03-22 20:15:51 +00:00
Pablo Correa Gómez
76f9217433 ev-view-presentation: remove deprecated call to gtk_style_context_set_background
The draw function already calls gtk_render_background, making this
deprecated function unnecessary. This has no behavior change.
2023-03-22 15:46:43 +00:00
Pablo Correa Gómez
a618409311 ev-view: remove non-needed call to deprecated gtk_style_context_set_background
This was introduced in 17859243df with
the rationale:

Even if we now render a background in _draw() with
gtk_render_background, using gtk_style_context_set_background() in
realize makes the backing GdkWindow not being completely transparent,
which enables GTK to apply optimizations during the paint cycle.
The result is, especially in clutter-gtk applications such as Documents,
scrolling in a document page is much smoother.

https://bugzilla.gnome.org/show_bug.cgi?id=692988

Clutter was completely archived in GNOME 42 https://blogs.gnome.org/clutter/
so the rationale does no longer hold. Since the call is deprecated, just
remove it, as it is unncessary.
2023-03-22 15:46:43 +00:00
Nelson Benítez León
4e56a2d63a ev-view: improve centering the page on scroll_to_page
When SCROLLING_TO_PAGE in a continuous view with
a FIT_PAGE sizing mode, let's center the page a
bit better so the next page is not visible.

Fixes #1868
Fixes #1905
2023-03-22 15:19:48 +00:00
Gary Li
6b77e0f9fe ev-view: Fix crash when releasing click with selected text holding click button
Evince currently fails an annotation assertion and crashes if the user selects text,
and while holding, press 's' and release the click.

This is because pressing 's' sets adding_annot to true. In the button release event handler,
if its true then we proceed to save the annotation to the document. However,
this release event corresponds to text selection, so in the button press handler we have not
populated view->adding_annot_info.annot, resulting in a failed assertion in the release handler.

To fix this, add a condition to check if we are just coming out of text selection before
doing annotation saving related logic.

Fixes https://gitlab.gnome.org/GNOME/evince/-/issues/1861
2023-02-28 02:00:46 +00:00
Romain
3816738386 libview: Fix missing last frame of an animation
Fixes #1821
2022-07-15 16:51:21 -04:00
Marek Kasik
88c8010564 Wait until all jobs finish before exit
Wait for all jobs before exiting main().
This allows clean execution of exit handlers.
Otherwise, the threads which executes the jobs could
access data already cleaned by exit handlers.

Fixes #1713
2022-07-14 15:10:00 +00:00
Nelson Benítez León
c76be8ba6f use default color when annotation has no color
Annotations may come with a NULL color, use
a default color there instead of letting
undefined GdkRGBA to crash the application.

We take the chance to share this default color
to be the same we already use when creating
an annotation from Evince.

We also take the chance to replace deprecated
function ev_annotation_set_color() with
ev_annotation_set_rgba()

Fixes crash in #1800
2022-06-05 11:52:56 -04:00
Germán Poo-Caamaño
204ec3a77b Add deprecation guards to now old find text related functions 2022-05-23 00:04:27 -04:00
Nelson Benítez León
495dd97e46 Add support for multi-line text search
which is available in Poppler since version 21.03.0

For that we create a new EvFindRectangle type to hold more match
information apart from coordinates, and use it all across Evince
including pdf backend (ev-poppler.cc) and djvu backend (djvu-document.c)
which are the only backends implementing the EvDocumentFindInterface.

To not break API compatibility, we added a new EvDocumentFindInterface
function which returns GList of this new EvFindRectangle type:

   GList *(* find_text_extended) (EvDocumentFind *document_find,
                                  EvPage         *page,
                                  const gchar    *text,
                                  EvFindOptions   options);

and changed Evince to use this new function instead of find_text_with_options().

Some info about how this new search feature works:

 - Ignores hyphen character while matching when:
      1) it's the last character of the line.
      2) its corresponding matching character in the search term
         is not an hyphen too.

 - Any whitespace characters in the search term will be allowed
   to match on the logic position where the lines split (i.e. what
   would normally be the newline character in a text file, but
   PDF text does not include newline characters between lines).

 - It won't match on text spanning more than two lines, i.e. it
   only matches text spanning from end of one line to start of
   next line.

Part of issue #333
2022-05-22 21:14:46 +00:00
Germán Poo-Caamaño
2dd19b3e30 libview: Fix typos in annotations 2022-03-02 16:08:07 -03:00
Germán Poo-Caamaño
e429e0b8c9 libview: Fix compilation warning on multiline string 2022-03-02 16:03:10 -03:00
Mads Chr. Olesen
9aaddb477c libview: set has-tooltip property unconditionally at init
The conditional setting seems to be an old artifact of once using
EvTooltip, instead of GTK tooltips.
2022-02-23 18:08:38 -03:00
Mads Chr. Olesen
f07b41adec libview: Bugfix: Move cursor over link handling to a separate function
Make "set-tooltip" set, even if no preview is shown.

Fixes #1695
2022-02-23 18:08:38 -03:00
Nelson Benítez León
e5594f9646 pdf: let launch action to open pdfs from click event
Issue #1333 removed Evince ability to run any command
from pdf 'launch action', while the security concerns
brought up in #1333 were valid, the measure implemented
was maybe too drastic, as there are valid use cases
where launching a pdf is needed.

For instance, the cases described in issue #48, one of
them is the document 'Nissan Patrol Maintenance Manual'
which is comprised of several pdf files, where there is
one acting as index for the others, this index pdf file
uses the launch action to open the other pdf's.

So this commit allows to launch a file from a link
action only when:

- that file is a pdf file.
- the launch action originates from click event,
  to be sure the user requested the action.

Besides, we don't just let the system execute the
file, but because it's a pdf we do it ourselves by
launching a new evince instance (or if that file was
already opened then presenting its window).

Fixes issue #48
2022-02-23 18:04:48 +00:00
Nelson Ben
da076895b1 EvView: fix cancelling ongoing highlight text annotation
Fix ev_view_cancel_add_annotation() to correctly cancel
an ongoing highlight text annotation.

Fixes issue #1690
2022-02-23 17:55:54 +00:00
Nelson Benítez León
04b2736786 New EvView signal to inform EvWindow we cancelled adding annotation
EvView have signals 'annot-added', 'annot-removed', 'annot-changed'
which EvWindow connects to update the window widgets accordingly.

When cancelling an ongoing add-annotation operation through eg.
not highlighting any text when adding a markup annotation, we
don't have any corresponding signal to let EvWindow know of this
cancel (as 'annot-added' is only for when it's created
succesfully).

So we add a new EvView 'annot-cancel-add' signal which is
emitted for this case and that EvWindow can respond to it
by updating the ui accordingly i.e. unpressing button in
EvAnnotationsToolbar.

Fixes part of #1730
2022-02-23 16:43:34 +00:00
Nelson Benítez León
6f06d2d688 EvView: preview popups only triggered by motion events
to avoid unwanted previews showing up in any of these
situations:

- when scrolling the view
- when pressing PageUp/PageDown or NextPage/PrevPage keys
- when changing to a page by clicking a bookmark or outline entry

we make sure to only show them when moving the mouse over them
(motion events).

Fixes issue #1666
2022-01-19 05:34:43 +00:00
Alexander Mikhaylenko
70916d5ed5 annotation-window: Fix title color
Use the same color for title as for the button instead of hardcoded black.
Remove the css that was leaking out to the context menu.
2022-01-12 03:24:53 +00:00
Christian Persch
117e36e6ae libview: Add Portal implementation of EvPrintOperationExport
Add EvPrintOperationExportPortal that uses the Print portal.
2022-01-12 02:05:56 +00:00
Christian Persch
454a350963 libview: Split the unix printing impl from the export print operation
Make EvPrintOperationExport an abstract base class, and move the
unix printing specific code to a new EvPrintOperationExportUnix.

This is in preparation to creating a EvPrintOperationExportPortal
which implements the export operation via Portal.
2022-01-12 02:05:56 +00:00
Christian Persch
e36ee4065d libview: Use GObject:constructed instead of constructor 2022-01-12 02:05:56 +00:00
Christian Persch
d73ac65cf4 libview: Whitespace cleanup 2022-01-12 02:05:56 +00:00
andreastedile
ad215dc600 libview: Open annotation windows when opening the document
By right clicking an annotation and selecting "Annotation Properties...",
there exists an option called "Initial window state" which regulates
whether the annotation window should be opened when opening the document.
This behavior was altered by commit aed1af6fa7,
whose purpose was exactly to prevent annotation windows from opening
for performance reasons.

Fixes: https://gitlab.gnome.org/GNOME/evince/-/issues/1425
2022-01-12 01:56:11 +00:00
Qiu Wenbo
b6237a2b2e doc: migrate to gi-docgen
Switch to gi-docgen to build the documentation.

Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
2022-01-09 00:13:20 +08:00
Christian Persch
39694038f5 libview: Add EvJobLoad class to load from file descriptor 2022-01-08 00:03:15 -03:00
Christian Persch
60ba7b0ee5 all: Replace include guards with pragma once
Instead of using the "#ifndef FOO_H", "#define FOO_H", …, "#endif FOO_H"
guards around the header file, use the "#pragma once".
2021-12-15 02:24:07 +00:00
Marek Kasik
8f7a7a1477 libview: Do not draw invalid surface
Fail the render job if the surface is in error state. This prevents
the failure of the render job leaking out to failing to render the
evince UI.

Based on a patch by Marek Kasik <mkasik@redhat.com>.
2021-12-02 23:24:55 +00:00
Christian Persch
6d5c94ee99 libview: Fix volatile misuse
Remove an incorrect/extraneous 'volatile', fixing a build warning about
incompatible pointer types with g_atomic_pointer_get().
2021-12-01 21:31:36 +01:00
Christian Persch
8ac25ff55e libview: Use symbol visibility for exported symbols
Use the newly added EV_PUBLIC macro to explicitly mark symbols to be
exported, instead of exporting everything starting with "ev_".

This removes lots of accidentally exposed, private functions. Since
those are not contained in public installed headers, this should be ok.
2021-12-01 16:51:33 +01:00
Christian Persch
40f495fbe2 libview: ev-view-cursor.h private to libview 2021-12-01 16:51:33 +01:00
Christian Persch
565be9b044 libview: EvPixbufCache is private to libview 2021-12-01 16:51:33 +01:00
Christian Persch
024d912682 libview: EvPageCache is private to libview
... so don't add it to the public API documentation.
2021-12-01 16:51:33 +01:00