After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668446 - Adding annotation: No input possible until some focus change
Adding annotation: No input possible until some focus change
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: pdf annotations
3.2.x
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-22 18:42 UTC by Marcel Stimberg
Modified: 2013-11-02 15:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix for annotation focus issue (501 bytes, patch)
2013-02-20 06:58 UTC, Florian Echtler
none Details | Review
[PATCH] Fix focus on ev_annotation_window (2.10 KB, patch)
2013-05-28 03:57 UTC, José Aliste
committed Details | Review
Experimental patch for the focusing problem (1.63 KB, patch)
2013-07-17 13:19 UTC, Gökcen Eraslan
none Details | Review
Fix for bug (2.13 KB, patch)
2013-08-14 07:30 UTC, Nelson Benitez
committed Details | Review
Screencast of after patch behaviour (715.12 KB, video/webm)
2013-08-14 07:38 UTC, Nelson Benitez
  Details

Description Marcel Stimberg 2012-01-22 18:42:16 UTC
Originally reported in the Ubuntu bug tracker by Gerd Bavendiek:
https://bugs.launchpad.net/ubuntu/+source/evince/+bug/919965

"Adding a new annotion in evince (Oneiric) no input is possible until one switches focus from the input window to the document window and back again.

Initially the cursor of the annotation input box is blinking, but no input is possible."

I can reproduce the problem (except for the fact that I do not get any blinking cursor in the beginning) under Ubuntu Precise (evince 3.2.1) and in Fedora 16.

Maybe an unintended side effect of the fix for Bug #623829?
Comment 1 mateolan 2013-01-27 19:50:39 UTC
I have the same issue.  certain keys like "n" actually move me away from the annotation window. This is a big efficiency problem when trying to annotate many documents quickly.
Comment 2 Felix Möller 2013-01-27 20:44:10 UTC
I can confirm with evince 3.6.1 and poppler 0.20.5-1ubuntu2
Comment 3 Florian Echtler 2013-02-20 06:58:58 UTC
Created attachment 236900 [details] [review]
Fix for annotation focus issue
Comment 4 Florian Echtler 2013-02-20 07:00:56 UTC
Previous comment contains a patch for this issue, tested against 3.4.0-0ubuntu1.4 from Ubuntu 12.04 (Precise). Should work for newer versions, too.
Comment 5 José Aliste 2013-05-28 03:57:34 UTC
Created attachment 245425 [details] [review]
[PATCH] Fix focus on ev_annotation_window

 libview/ev-annotation-window.c | 21 ---------------------
 1 file changed, 21 deletions(-)
Comment 6 José Aliste 2013-05-28 03:59:38 UTC
This is like Florian's patch, but it also deletes the notify_enter and notify_leave functions that are not needed anymore... (and we are not getting the events across windows btw)
Comment 7 Florian Echtler 2013-05-28 06:25:51 UTC
Thanks for the patch, José - works for me. Would it be possible to tweak it so that the annotation window has focus immediately after creation? As it is now, I still have to click into the annotation once before I can type.
Comment 8 Carlos Garcia Campos 2013-05-28 17:42:08 UTC
Comment on attachment 245425 [details] [review]
[PATCH] Fix focus on ev_annotation_window

Great! another patch that fixes a bug just by removing code :-) Pushed to git master, thank you both!
Comment 9 Germán Poo-Caamaño 2013-05-28 18:24:24 UTC
I am re-opening the bug as per c#7.  Also, I have to click in different places before I can enter any text in the annotation window.
Comment 10 Germán Poo-Caamaño 2013-05-28 18:29:53 UTC
(In reply to comment #9)
> I am re-opening the bug as per c#7.  Also, I have to click in different places
> before I can enter any text in the annotation window.

Comment c#7 still holds regarding to the focus.  Forget the remaining, I was trying the wrong branch :-P
Comment 11 Gökcen Eraslan 2013-07-17 13:19:49 UTC
Created attachment 249404 [details] [review]
Experimental patch for the focusing problem

I prepared a working patch for the focusing problem but some points are not clear to me. The function showing the annotation popup window is ev_view_annotation_show_popup_window.

So, I added:

ev_annotation_window_grab_focus (EV_ANNOTATION_WINDOW(window));

call to the end of this function but I didn't work. Then I had to modify it so that it works for both focusing upon the initial creation of annotation window and focusing upon opening a closed annotation.

Other issue is that why are gtk_widget_grab_focus and gtk_widget_send_focus_change used together? I couldn't understand the purpose of using gtk_widget_send_focus_change.

Instead of

gtk_widget_grab_focus (GTK_WIDGET (window));
send_focus_change (window, TRUE);

why don't we use only

send_focus_change (window->text_view, TRUE);

and directly focus on the text_view?
Comment 12 Nelson Benitez 2013-08-14 07:30:53 UTC
Created attachment 251569 [details] [review]
Fix for bug

This patch fixes focusing the text entry after creating or selecting annotation, I also included code to hide the text cursor when the annot window is unfocused(backdrop state) to not give the user the false appearance he can enter text when he really can't (the window is unfocused).
Comment 13 Nelson Benitez 2013-08-14 07:38:51 UTC
Created attachment 251570 [details]
Screencast of after patch behaviour

This is a small screencast showing the patch behaviour.
Comment 14 Germán Poo-Caamaño 2013-09-20 07:27:44 UTC
Carlos,

Please review Nelson's patch in #12.  This could land on 3.10. Otherwise, annotations could become annoying.
Comment 15 Carlos Garcia Campos 2013-10-29 09:58:06 UTC
Review of attachment 251569 [details] [review]:

Thanks for the patch!. I've made a few minor changed and pushed to both branches.

::: libview/ev-annotation-window.c
@@ +264,2 @@
 {
+	GtkStateFlags cflags = gtk_widget_get_state_flags (widget);

I'm not sure what sflags and cflags mean, I guess c stands for current. I have renamed them as previous_flags and current_flags to make it clearer.