Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clapper-app: Add unfullscreen keyboard shortcut #499

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/bin/clapper-app/clapper-app-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ clapper_app_application_constructed (GObject *object)
{ "app.preferences", { "<Control>comma", NULL, NULL }},
{ "app.about", { "F1", NULL, NULL }},
{ "win.toggle-fullscreen", { "F11", "f", NULL }},
{ "win.unfullscreen", { "Escape", NULL, NULL }},
{ "win.auto-resize", { "<Super>r", NULL, NULL }},
{ "win.show-help-overlay", { "<Control>question", NULL, NULL }},
{ "window.close", { "<Control>q", "q", NULL }},
Expand Down
12 changes: 12 additions & 0 deletions src/bin/clapper-app/clapper-app-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,17 @@ toggle_fullscreen (GSimpleAction *action, GVariant *param, gpointer user_data)
video_toggle_fullscreen_cb (CLAPPER_GTK_VIDEO_CAST (self->video), self);
}

static void
unfullscreen (GSimpleAction *action, GVariant *param, gpointer user_data)
{
GtkWindow *window = GTK_WINDOW (user_data);

if (gtk_window_is_fullscreen (window)) {
ClapperAppWindow *self = CLAPPER_APP_WINDOW_CAST (window);
video_toggle_fullscreen_cb (CLAPPER_GTK_VIDEO_CAST (self->video), self);
}
}

static void
auto_resize (GSimpleAction *action, GVariant *param, gpointer user_data)
{
Expand Down Expand Up @@ -1224,6 +1235,7 @@ clapper_app_window_constructed (GObject *object)

static const GActionEntry win_entries[] = {
{ "toggle-fullscreen", toggle_fullscreen, NULL, NULL, NULL },
{ "unfullscreen", unfullscreen, NULL, NULL, NULL },
{ "auto-resize", auto_resize, NULL, NULL, NULL },
{ "show-help-overlay", show_help_overlay, NULL, NULL, NULL },
};
Expand Down
6 changes: 6 additions & 0 deletions src/bin/clapper-app/ui/clapper-app-help-overlay.ui
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
<property name="accelerator">F11 f</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="title" translatable="yes">Unfullscreen</property>
<property name="accelerator">Escape</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="title" translatable="yes">Auto window resize</property>
Expand Down