From 22cfc6ddef8c4605b5722df898888fb5ce9ddf08 Mon Sep 17 00:00:00 2001 From: actionless Date: Mon, 2 Sep 2024 01:10:03 +0200 Subject: [PATCH] feat(ui_window, about): add `?` hotkey for showing help window --- README.md | 1 + src/about.c | 1 + src/ui_window.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 24b9c2c..8ae2f8c 100644 --- a/README.md +++ b/README.md @@ -62,4 +62,5 @@ See the output of `geh --help` for detals. * `-`, zoom out current image. * `0`, zoom current image to original size. * `F11`, toggle fullscreen mode. + * `?`, show help window. diff --git a/src/about.c b/src/about.c index 7142817..353fda7 100644 --- a/src/about.c +++ b/src/about.c @@ -168,5 +168,6 @@ gchar * get_key_bindings_message(void) "-, zoom out current image.\n" "0, zoom current image to original size.\n" "F11, toggle fullscreen mode.\n" + "?, show this help.\n" ); } diff --git a/src/ui_window.c b/src/ui_window.c index f818dac..cd32959 100644 --- a/src/ui_window.c +++ b/src/ui_window.c @@ -631,6 +631,12 @@ callback_key_press (GtkWidget *widget, GdkEventKey *key, gpointer data) } ui->is_fullscreen = ui->is_fullscreen == TRUE ? FALSE : TRUE; break; + case GDK_KEY_question: + gchar * message = get_key_bindings_message (); + GtkWidget * about_dialog = create_info_window (GTK_WINDOW (ui->window), "Key Bindings", message); + gtk_widget_show (about_dialog); + g_free(message); + break; default: return FALSE; break;