From 84b1bd2cdb55d1a293c7f19ee4585c1eeeac2879 Mon Sep 17 00:00:00 2001 From: Valentin Villenave Date: Wed, 13 Oct 2021 17:55:37 +0200 Subject: Enable mouse-less navigation & reading for output dialogs We actually want a cursor to be displayed in case a screen reader is used with visual tracking. --- src/fr-window.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/fr-window.c b/src/fr-window.c index 6023336..dd68dca 100644 --- a/src/fr-window.c +++ b/src/fr-window.c @@ -7124,7 +7124,9 @@ fr_window_view_last_output (FrWindow *window, dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (window), - GTK_DIALOG_DESTROY_WITH_PARENT, + /* Make this dialog modal, otherwise with most WMs + * the focus can’t be regained without the mouse. */ + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, "gtk-close", GTK_RESPONSE_CLOSE, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); @@ -7147,7 +7149,9 @@ fr_window_view_last_output (FrWindow *window, text_view = gtk_text_view_new_with_buffer (text_buffer); g_object_unref (text_buffer); gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE); - gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE); + /* Although this isn’t an editable text area, we do want the + * cursor for accessibility purposes. */ + gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), TRUE); /**/ @@ -7180,10 +7184,14 @@ fr_window_view_last_output (FrWindow *window, fr_window_view_last_output_print(text_buffer, &iter, window->archive->process->out.raw); /* Show STDERR of process */ fr_window_view_last_output_print(text_buffer, &iter, window->archive->process->err.raw); + /* place the cursor at the start */ + gtk_text_buffer_get_iter_at_offset (text_buffer, &iter, 0); + gtk_text_buffer_place_cursor(text_buffer, &iter); /**/ pref_util_restore_window_geometry (GTK_WINDOW (dialog), LAST_OUTPUT_DIALOG_NAME); + gtk_widget_grab_focus (text_view); } /* -- fr_window_rename_selection -- */ -- cgit v1.2.1