Skip to content

Commit edeb38b

Browse files
Byron Torresgnome-mpv
authored andcommitted
video-area: Inhibit eager reveal of floating controls
This commit inhibits Celluloid from revealing floating controls upon launching a video or fullscreen toggle. The floating controls should now be revealed only upon cursor motion. The old behaviour was rather annoying, especially when the user opened or fullscreened a video using the keyboard (pressing Enter in Nautilus, pressing 'f'); Once the Celluloid window opened or fullscreened in this manner, not using the mouse (cursor) would not trigger the reveal timeout, which would keep the floating controls revealed indefinitely, forcing the user to wiggle the cursor to trigger the timeout to hide the floating controls. It was also not often the desired default behaviour to even see the floating controls upon video launch at all. Rather, one might opine that a keybinding for revealing the floating controls would be a better UX. Perhaps something like Shift or Alt.
1 parent 1bada68 commit edeb38b

1 file changed

Lines changed: 22 additions & 26 deletions

File tree

src/celluloid-video-area.c

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ set_fullscreen_state(CelluloidVideoArea *area, gboolean fullscreen);
9191
static void
9292
set_cursor_visible(CelluloidVideoArea *area, gboolean visible);
9393

94+
static void
95+
hide_floating_controls(CelluloidVideoArea *area);
96+
9497
static void
9598
reveal_controls(CelluloidVideoArea *area);
9699

@@ -177,12 +180,19 @@ set_fullscreen_state(CelluloidVideoArea *area, gboolean fullscreen)
177180
celluloid_video_area_set_use_floating_header_bar
178181
(area, area->use_floating_controls || fullscreen);
179182
celluloid_video_area_set_control_box_floating
180-
(area, TRUE);
183+
(area, area->use_floating_controls || fullscreen);
184+
}
181185

182-
adw_toolbar_view_set_reveal_top_bars
183-
(ADW_TOOLBAR_VIEW(area->toolbar_view), TRUE);
184-
adw_toolbar_view_set_reveal_bottom_bars
185-
(ADW_TOOLBAR_VIEW(area->toolbar_view), TRUE);
186+
static void
187+
hide_floating_controls(CelluloidVideoArea *area)
188+
{
189+
if(area->use_floating_controls)
190+
{
191+
adw_toolbar_view_set_reveal_top_bars
192+
(ADW_TOOLBAR_VIEW(area->toolbar_view), FALSE);
193+
adw_toolbar_view_set_reveal_bottom_bars
194+
(ADW_TOOLBAR_VIEW(area->toolbar_view), FALSE);
195+
}
186196
}
187197

188198
static void
@@ -643,9 +653,11 @@ celluloid_video_area_init(CelluloidVideoArea *area)
643653
area->use_floating_controls || area->fullscreened);
644654

645655
adw_toolbar_view_set_reveal_top_bars
646-
(ADW_TOOLBAR_VIEW(area->toolbar_view), TRUE);
656+
( ADW_TOOLBAR_VIEW(area->toolbar_view),
657+
!area->use_floating_header_bar);
647658
adw_toolbar_view_set_reveal_bottom_bars
648-
(ADW_TOOLBAR_VIEW(area->toolbar_view), TRUE);
659+
( ADW_TOOLBAR_VIEW(area->toolbar_view),
660+
!area->use_floating_controls);
649661

650662
//TODO: Reduce spacing for headerbar when in compact mode
651663
adw_breakpoint_add_setters
@@ -693,25 +705,6 @@ celluloid_video_area_show_toast_message( CelluloidVideoArea *area,
693705
adw_toast_overlay_add_toast(toast_overlay, toast);
694706
}
695707

696-
void
697-
celluloid_video_area_set_reveal_control_box( CelluloidVideoArea *area,
698-
gboolean reveal )
699-
{
700-
adw_toolbar_view_set_reveal_bottom_bars
701-
(ADW_TOOLBAR_VIEW(area->toolbar_view), reveal);
702-
703-
g_source_clear(&area->timeout_tag);
704-
705-
if(reveal)
706-
{
707-
area->timeout_tag =
708-
g_timeout_add_seconds
709-
( FS_CONTROL_HIDE_DELAY,
710-
timeout_handler,
711-
area );
712-
}
713-
}
714-
715708
void
716709
celluloid_video_area_set_control_box_visible( CelluloidVideoArea *area,
717710
gboolean visible )
@@ -726,6 +719,7 @@ celluloid_video_area_set_status( CelluloidVideoArea *area,
726719
switch(status)
727720
{
728721
case CELLULOID_VIDEO_AREA_STATUS_LOADING:
722+
hide_floating_controls(area);
729723
adw_status_page_set_title
730724
( ADW_STATUS_PAGE(area->initial_page),
731725
_("Loading…") );
@@ -737,6 +731,7 @@ celluloid_video_area_set_status( CelluloidVideoArea *area,
737731
break;
738732

739733
case CELLULOID_VIDEO_AREA_STATUS_IDLE:
734+
reveal_controls(area);
740735
adw_status_page_set_title
741736
( ADW_STATUS_PAGE(area->initial_page),
742737
_("Welcome") );
@@ -748,6 +743,7 @@ celluloid_video_area_set_status( CelluloidVideoArea *area,
748743
break;
749744

750745
case CELLULOID_VIDEO_AREA_STATUS_PLAYING:
746+
hide_floating_controls(area);
751747
gtk_stack_set_visible_child
752748
(GTK_STACK(area->stack), area->graphics_offload);
753749
break;

0 commit comments

Comments
 (0)