Commit c5220b52 authored by Nelson Benítez León's avatar Nelson Benítez León Committed by Carlos Garcia Campos

libview: fix annotation window focus change after creation

Be able to start entering text right after selecting
or creating an annotation, also hide text cursor
when window goes unfocused (backdrop state).
parent 3258d89a
......@@ -258,14 +258,14 @@ ev_annotation_window_set_resize_cursor (GtkWidget *widget,
static gboolean
text_view_button_press (GtkWidget *widget,
GdkEventButton *event,
EvAnnotationWindow *window)
static void
text_view_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_flags)
ev_annotation_window_grab_focus (window);
GtkStateFlags current_flags = gtk_widget_get_state_flags (widget);
return FALSE;
if (current_flags & GTK_STATE_FLAG_BACKDROP)
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (widget), FALSE);
static void
......@@ -317,8 +317,8 @@ ev_annotation_window_init (EvAnnotationWindow *window)
swindow = gtk_scrolled_window_new (NULL, NULL);
window->text_view = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (window->text_view), GTK_WRAP_WORD);
g_signal_connect (window->text_view, "button_press_event",
G_CALLBACK (text_view_button_press),
g_signal_connect (window->text_view, "state-flags-changed",
G_CALLBACK (text_view_state_flags_changed),
gtk_container_add (GTK_CONTAINER (swindow), window->text_view);
gtk_widget_show (window->text_view);
......@@ -492,6 +492,10 @@ ev_annotation_window_focus_in_event (GtkWidget *widget,
window->in_move = FALSE;
gtk_widget_grab_focus (window->text_view);
send_focus_change (window->text_view, TRUE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (window->text_view), TRUE);
return FALSE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment