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
This commit is contained in:
Rafał Dzięgiel
2024-05-25 21:30:26 +02:00
parent ae6512b233
commit 28de283a98
3 changed files with 15 additions and 0 deletions

View File

@@ -700,6 +700,7 @@ clapper_app_application_constructed (GObject *object)
{ "app.preferences", { "<Control>comma", NULL, NULL }}, { "app.preferences", { "<Control>comma", NULL, NULL }},
{ "app.about", { "F1", NULL, NULL }}, { "app.about", { "F1", NULL, NULL }},
{ "win.toggle-fullscreen", { "F11", "f", NULL }}, { "win.toggle-fullscreen", { "F11", "f", NULL }},
{ "win.auto-resize", { "<Super>r", NULL, NULL }},
{ "win.show-help-overlay", { "<Control>question", NULL, NULL }}, { "win.show-help-overlay", { "<Control>question", NULL, NULL }},
{ "window.close", { "<Control>q", "q", NULL }}, { "window.close", { "<Control>q", "q", NULL }},
}; };

View File

@@ -1063,6 +1063,12 @@ toggle_fullscreen (GSimpleAction *action, GVariant *param, gpointer user_data)
video_toggle_fullscreen_cb (CLAPPER_GTK_VIDEO_CAST (self->video), self); 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 static void
show_help_overlay (GSimpleAction *action, GVariant *param, gpointer user_data) 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[] = { static const GActionEntry win_entries[] = {
{ "toggle-fullscreen", toggle_fullscreen, NULL, NULL, NULL }, { "toggle-fullscreen", toggle_fullscreen, NULL, NULL, NULL },
{ "auto-resize", auto_resize, NULL, NULL, NULL },
{ "show-help-overlay", show_help_overlay, NULL, NULL, NULL }, { "show-help-overlay", show_help_overlay, NULL, NULL, NULL },
}; };

View File

@@ -33,6 +33,13 @@
<property name="accelerator">F11 f</property> <property name="accelerator">F11 f</property>
</object> </object>
</child> </child>
<child>
<object class="GtkShortcutsShortcut">
<property name="title" translatable="yes">Auto window resize</property>
<property name="subtitle" translatable="yes">Middle click</property>
<property name="accelerator">&lt;Super&gt;r</property>
</object>
</child>
<child> <child>
<object class="GtkShortcutsShortcut"> <object class="GtkShortcutsShortcut">
<property name="title" translatable="yes">Quit</property> <property name="title" translatable="yes">Quit</property>