Trigger capture with spacebar

This commit is contained in:
Martijn Braam 2021-03-26 22:47:00 +01:00
parent ea20aa26fb
commit 721f943da9
1 changed files with 17 additions and 0 deletions

17
main.c
View File

@ -420,6 +420,12 @@ on_shutter_clicked(GtkWidget *widget, gpointer user_data)
mp_io_pipeline_capture();
}
void
on_capture_shortcut(void)
{
on_shutter_clicked(NULL, NULL);
}
static bool
check_point_inside_bounds(int x, int y, int *bounds_x, int *bounds_y)
{
@ -760,6 +766,17 @@ main(int argc, char *argv[])
gtk_style_context_add_provider(context, GTK_STYLE_PROVIDER(provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
GClosure* capture_shortcut = g_cclosure_new(on_capture_shortcut, 0, 0);
GtkAccelGroup* accel_group = gtk_accel_group_new();
gtk_accel_group_connect(accel_group,
GDK_KEY_space,
0,
0,
capture_shortcut);
gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
mp_io_pipeline_start();
camera = mp_get_camera_config(0);