[totem/wip/hadess/keyboard-shortcuts: 6/6] main: Add 0-9 keys as shortcuts to seek to 0-90%




commit f2ce92b41e057f203290115caaf407e1f0f50084
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 15 15:29:27 2022 +0100

    main: Add 0-9 keys as shortcuts to seek to 0-90%
    
    Add keyboard shortcut for Numbers 1 to 9 (not on the numeric pad) to
    seek to the 10% to 90% of the video.
    
    As used on YouTube:
    https://support.google.com/youtube/answer/7631406?hl=en
    
    Closes: #466

 README             |  2 ++
 src/totem-object.c | 21 +++++++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/README b/README
index 4ab0a8eaa..297d3c981 100644
--- a/README
+++ b/README
@@ -31,6 +31,8 @@ Ctrl+H:
 Undocumented shortcuts:
 M (when playing a DVD):
        Menu
+0-9:
+       Skip to 0%-90% of the video
 Ctrl+Q:
        Quit
 Ctrl+W:
diff --git a/src/totem-object.c b/src/totem-object.c
index fb9c5a7c9..e89662fff 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -3625,10 +3625,6 @@ totem_object_handle_key_press (TotemObject *totem, GdkEventKey *event)
                if (bacon_video_widget_has_menus (totem->bvw) != FALSE)
                        bacon_video_widget_dvd_event (totem->bvw, BVW_DVD_ROOT_MENU_SELECT);
                break;
-       case GDK_KEY_0:
-               if (mask == GDK_CONTROL_MASK)
-                       totem_object_set_zoom (totem, FALSE);
-               break;
        case GDK_KEY_Menu:
        case GDK_KEY_F10:
                show_popup (totem);
@@ -3643,6 +3639,23 @@ totem_object_handle_key_press (TotemObject *totem, GdkEventKey *event)
        case GDK_KEY_Time:
                show_popup (totem);
                break;
+       case GDK_KEY_0:
+               if (mask == GDK_CONTROL_MASK) {
+                       totem_object_set_zoom (totem, FALSE);
+                       break;
+               }
+               /* fall-through */
+       case GDK_KEY_1:
+       case GDK_KEY_2:
+       case GDK_KEY_3:
+       case GDK_KEY_4:
+       case GDK_KEY_5:
+       case GDK_KEY_6:
+       case GDK_KEY_7:
+       case GDK_KEY_8:
+       case GDK_KEY_9:
+               totem_object_seek (totem, (event->keyval - GDK_KEY_0) * 0.1);
+               break;
        case GDK_KEY_equal:
                if (mask == GDK_CONTROL_MASK)
                        totem_object_set_zoom (totem, TRUE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]