From dd91df1ff4a5fd160edf8a4330ca0f664c0ffe72 Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Wed, 2 Oct 2019 21:21:47 +0200 Subject: [PATCH 1/3] Add no-controls command line argument --- src/main.c | 6 ++++++ src/parole-player.c | 14 +++++++++++++- src/parole-player.h | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index fc0114c..2d716df 100644 --- a/src/main.c +++ b/src/main.c @@ -220,6 +220,7 @@ int main(int argc, char **argv) { gboolean fullscreen = FALSE; gboolean enqueue = FALSE; gchar *client_id = NULL; + gboolean no_controls = FALSE; /* Command-line options */ GOptionEntry option_entries[] = { @@ -233,6 +234,8 @@ int main(int argc, char **argv) { &embedded, N_("Start in embedded mode"), NULL }, { "fullscreen", 'F', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &fullscreen, N_("Start in fullscreen mode"), NULL }, + { "no-controls", 'C', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, + &no_controls, N_("Hide controls"), NULL }, { "play", 'p', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &play, N_("Play or pause if already playing"), NULL }, { "next", 'N', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, @@ -340,6 +343,9 @@ int main(int argc, char **argv) { player = parole_player_new(client_id); g_free(client_id); + if (no_controls) + parole_player_no_controls(player); + if (embedded) parole_player_embedded(player); else if (fullscreen) diff --git a/src/parole-player.c b/src/parole-player.c index 53ac841..62eda90 100644 --- a/src/parole-player.c +++ b/src/parole-player.c @@ -362,6 +362,7 @@ struct ParolePlayerPrivate { /* Parole Player layouts */ gboolean embedded; gboolean full_screen; + gboolean no_controls; gboolean mini_mode; /* Remembered window sizes */ gint last_h, last_w; @@ -1977,6 +1978,9 @@ parole_player_reset_controls(ParolePlayer *player, gboolean fullscreen) { "window-width", &w, NULL); + if (player->priv->no_controls) + gtk_widget_hide(gtk_widget_get_parent(player->priv->control)); + if ( player->priv->full_screen != fullscreen ) { /* If the player is in fullscreen mode, change to windowed mode. */ if ( player->priv->full_screen ) { @@ -2074,6 +2078,12 @@ parole_player_full_screen(ParolePlayer *player, gboolean fullscreen) { parole_player_reset_controls(player, fullscreen); } +void +parole_player_no_controls(ParolePlayer *player) { + player->priv->no_controls = TRUE; + gtk_widget_hide(gtk_widget_get_parent(player->priv->control)); +} + void parole_player_fullscreen_action_cb(GSimpleAction *action) { parole_player_full_screen(parole_player, !parole_player->priv->full_screen); } @@ -2265,7 +2275,8 @@ parole_player_gst_widget_motion_notify_event(GtkWidget *widget, GdkEventMotion * hide_timeout = 0; } - gtk_widget_show(gtk_widget_get_parent(player->priv->control)); + if (! player->priv->no_controls) + gtk_widget_show(gtk_widget_get_parent(player->priv->control)); parole_player_set_cursor_visible(player, TRUE); @@ -3168,6 +3179,7 @@ parole_player_init(ParolePlayer *player) { player->priv->internal_range_change = FALSE; player->priv->exit = FALSE; player->priv->full_screen = FALSE; + player->priv->no_controls = FALSE; player->priv->buffering = FALSE; player->priv->row = NULL; player->priv->wait_for_gst_disc_info = FALSE; diff --git a/src/parole-player.h b/src/parole-player.h index d453d37..e728314 100644 --- a/src/parole-player.h +++ b/src/parole-player.h @@ -75,6 +75,8 @@ void parole_player_embedded (ParolePlayer *p void parole_player_full_screen (ParolePlayer *player, gboolean fullscreen); +void parole_player_no_controls (ParolePlayer *player); + GSimpleAction *parole_player_get_action(ParolePlayerAction action); -- 2.21.0