From 28de283a985cc17df2976951bcf9d0542e18d612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Sat, 25 May 2024 21:30:26 +0200 Subject: [PATCH] clapper-app: Add auto window resize keyboard shortcut In addition to middle click, also add "Super+r" keyboard shortcut to perform window resize to fit video action --- src/bin/clapper-app/clapper-app-application.c | 1 + src/bin/clapper-app/clapper-app-window.c | 7 +++++++ src/bin/clapper-app/ui/clapper-app-help-overlay.ui | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/src/bin/clapper-app/clapper-app-application.c b/src/bin/clapper-app/clapper-app-application.c index c7fd6f10..57acbfa4 100644 --- a/src/bin/clapper-app/clapper-app-application.c +++ b/src/bin/clapper-app/clapper-app-application.c @@ -700,6 +700,7 @@ clapper_app_application_constructed (GObject *object) { "app.preferences", { "comma", NULL, NULL }}, { "app.about", { "F1", NULL, NULL }}, { "win.toggle-fullscreen", { "F11", "f", NULL }}, + { "win.auto-resize", { "r", NULL, NULL }}, { "win.show-help-overlay", { "question", NULL, NULL }}, { "window.close", { "q", "q", NULL }}, }; diff --git a/src/bin/clapper-app/clapper-app-window.c b/src/bin/clapper-app/clapper-app-window.c index 8fb997d6..d76bc684 100644 --- a/src/bin/clapper-app/clapper-app-window.c +++ b/src/bin/clapper-app/clapper-app-window.c @@ -1063,6 +1063,12 @@ toggle_fullscreen (GSimpleAction *action, GVariant *param, gpointer user_data) video_toggle_fullscreen_cb (CLAPPER_GTK_VIDEO_CAST (self->video), self); } +static void +auto_resize (GSimpleAction *action, GVariant *param, gpointer user_data) +{ + _resize_window (CLAPPER_APP_WINDOW_CAST (user_data)); +} + static void show_help_overlay (GSimpleAction *action, GVariant *param, gpointer user_data) { @@ -1217,6 +1223,7 @@ clapper_app_window_constructed (GObject *object) static const GActionEntry win_entries[] = { { "toggle-fullscreen", toggle_fullscreen, NULL, NULL, NULL }, + { "auto-resize", auto_resize, NULL, NULL, NULL }, { "show-help-overlay", show_help_overlay, NULL, NULL, NULL }, }; diff --git a/src/bin/clapper-app/ui/clapper-app-help-overlay.ui b/src/bin/clapper-app/ui/clapper-app-help-overlay.ui index 01c342f3..a8a65bd5 100644 --- a/src/bin/clapper-app/ui/clapper-app-help-overlay.ui +++ b/src/bin/clapper-app/ui/clapper-app-help-overlay.ui @@ -33,6 +33,13 @@ F11 f + + + Auto window resize + Middle click + <Super>r + + Quit