From d098435d1460dd041a2be15d23d8c058f50d5630 Mon Sep 17 00:00:00 2001
From: Petri Hintukainen <phintuka@gmail.com>
Date: Fri, 16 Oct 2015 20:40:38 +0300
Subject: [PATCH 03/11] Add hotkey and input event for BluRay pop-up menu

---
 include/vlc_demux.h        | 1 +
 include/vlc_input.h        | 1 +
 include/vlc_keys.h         | 1 +
 modules/access/bluray.c    | 2 ++
 modules/control/hotkeys.c  | 1 +
 src/config/keys.c          | 1 +
 src/input/control.c        | 1 +
 src/input/input.c          | 2 ++
 src/input/input_internal.h | 1 +
 src/libvlc-module.c        | 6 ++++++
 10 files changed, 17 insertions(+)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 0810f08..186fa3f 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -181,6 +181,7 @@ enum demux_query_e
     DEMUX_NAV_DOWN,            /* res=can fail */
     DEMUX_NAV_LEFT,            /* res=can fail */
     DEMUX_NAV_RIGHT,           /* res=can fail */
+    DEMUX_NAV_POPUP,           /* res=can fail */
 };
 
 /*************************************************************************
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 81a93d7..c6307bf 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -432,6 +432,7 @@ enum input_query_e
     INPUT_NAV_DOWN,
     INPUT_NAV_LEFT,
     INPUT_NAV_RIGHT,
+    INPUT_NAV_POPUP,
 
     /* Meta datas */
     INPUT_ADD_INFO,   /* arg1= char* arg2= char* arg3=...     res=can fail */
diff --git a/include/vlc_keys.h b/include/vlc_keys.h
index ea54950..5733f97 100644
--- a/include/vlc_keys.h
+++ b/include/vlc_keys.h
@@ -128,6 +128,7 @@ typedef enum vlc_action {
     ACTIONID_NAV_DOWN,
     ACTIONID_NAV_LEFT,
     ACTIONID_NAV_RIGHT,
+    ACTIONID_NAV_POPUP,
     ACTIONID_JUMP_BACKWARD_EXTRASHORT,
     ACTIONID_JUMP_FORWARD_EXTRASHORT,
     ACTIONID_JUMP_BACKWARD_SHORT,
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index a7956bb..c672e45 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -1609,6 +1609,8 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
         return sendKeyEvent(p_sys, BD_VK_LEFT);
     case DEMUX_NAV_RIGHT:
         return sendKeyEvent(p_sys, BD_VK_RIGHT);
+    case DEMUX_NAV_POPUP:
+        return sendKeyEvent(p_sys, BD_VK_POPUP);
 
     case DEMUX_CAN_RECORD:
     case DEMUX_GET_FPS:
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 7c4ee7f..91ae6fc 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -771,6 +771,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
         case ACTIONID_NAV_DOWN:
         case ACTIONID_NAV_LEFT:
         case ACTIONID_NAV_RIGHT:
+        case ACTIONID_NAV_POPUP:
             if( p_input )
                 input_Control( p_input, i_action - ACTIONID_NAV_ACTIVATE
                                + INPUT_NAV_ACTIVATE, NULL );
diff --git a/src/config/keys.c b/src/config/keys.c
index 94e5cf5..1181952 100644
--- a/src/config/keys.c
+++ b/src/config/keys.c
@@ -306,6 +306,7 @@ static const struct action actions[] =
     { "nav-activate", ACTIONID_NAV_ACTIVATE, },
     { "nav-down", ACTIONID_NAV_DOWN, },
     { "nav-left", ACTIONID_NAV_LEFT, },
+    { "nav-popup", ACTIONID_NAV_POPUP, },
     { "nav-right", ACTIONID_NAV_RIGHT, },
     { "nav-up", ACTIONID_NAV_UP, },
     { "next", ACTIONID_NEXT, },
diff --git a/src/input/control.c b/src/input/control.c
index 79a1029..af4362c 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -141,6 +141,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
         case INPUT_NAV_DOWN:
         case INPUT_NAV_LEFT:
         case INPUT_NAV_RIGHT:
+        case INPUT_NAV_POPUP:
             input_ControlPush( p_input, i_query - INPUT_NAV_ACTIVATE
                                + INPUT_CONTROL_NAV_ACTIVATE, NULL );
             return VLC_SUCCESS;
diff --git a/src/input/input.c b/src/input/input.c
index 42aa157..f417208 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1509,6 +1509,7 @@ static bool ControlIsSeekRequest( int i_type )
     case INPUT_CONTROL_NAV_DOWN:
     case INPUT_CONTROL_NAV_LEFT:
     case INPUT_CONTROL_NAV_RIGHT:
+    case INPUT_CONTROL_NAV_POPUP:
         return true;
     default:
         return false;
@@ -2003,6 +2004,7 @@ static bool Control( input_thread_t *p_input,
         case INPUT_CONTROL_NAV_DOWN:
         case INPUT_CONTROL_NAV_LEFT:
         case INPUT_CONTROL_NAV_RIGHT:
+        case INPUT_CONTROL_NAV_POPUP:
             demux_Control( p_input->p->input.p_demux, i_type
                            - INPUT_CONTROL_NAV_ACTIVATE + DEMUX_NAV_ACTIVATE );
             break;
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index cf27ff3..e2aa65b 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -198,6 +198,7 @@ enum input_control_e
     INPUT_CONTROL_NAV_DOWN,     // INPUT_NAV_* and DEMUX_NAV_*.
     INPUT_CONTROL_NAV_LEFT,
     INPUT_CONTROL_NAV_RIGHT,
+    INPUT_CONTROL_NAV_POPUP,
 
     INPUT_CONTROL_SET_ES,
     INPUT_CONTROL_RESTART_ES,
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index a13093d..3ccfc4f 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -1249,6 +1249,8 @@ static const char *const mouse_wheel_texts[] = {
 #define NAV_RIGHT_KEY_LONGTEXT N_("Select the key to move the selector right in DVD menus.")
 #define NAV_ACTIVATE_KEY_TEXT N_("Activate")
 #define NAV_ACTIVATE_KEY_LONGTEXT N_("Select the key to activate selected item in DVD menus.")
+#define NAV_POPUP_KEY_TEXT N_("Navigate popup")
+#define NAV_POPUP_KEY_LONGTEXT N_("Select the key to toggle BluRay Pop-Up menu.")
 #define DISC_MENU_TEXT N_("Go to the DVD menu")
 #define DISC_MENU_LONGTEXT N_("Select the key to take you to the DVD menu")
 #define TITLE_PREV_TEXT N_("Select previous DVD title")
@@ -2140,6 +2142,7 @@ vlc_module_begin ()
 #   define KEY_NAV_DOWN           "Down"
 #   define KEY_NAV_LEFT           "Left"
 #   define KEY_NAV_RIGHT          "Right"
+#   define KEY_NAV_POPUP          "Alt+p"
 #   define KEY_QUIT               "Command+q"
 #   define KEY_VOL_UP             "Command+Up"
 #   define KEY_VOL_DOWN           "Command+Down"
@@ -2265,6 +2268,7 @@ vlc_module_begin ()
 #   define KEY_NAV_DOWN           "Down"
 #   define KEY_NAV_LEFT           "Left"
 #   define KEY_NAV_RIGHT          "Right"
+#   define KEY_NAV_POPUP          "Alt+p"
 #   define KEY_QUIT               "Ctrl+q"
 
 #ifdef _WIN32 /* On Windows, people expect volume keys to control the master */
@@ -2423,6 +2427,8 @@ vlc_module_begin ()
              NAV_LEFT_KEY_LONGTEXT, true )
     add_key( "key-nav-right", KEY_NAV_RIGHT, NAV_RIGHT_KEY_TEXT,
              NAV_RIGHT_KEY_LONGTEXT, true )
+    add_key( "key-nav-popup", KEY_NAV_POPUP, NAV_POPUP_KEY_TEXT,
+             NAV_POPUP_KEY_LONGTEXT, true )
 
     add_key( "key-disc-menu", KEY_DISC_MENU, DISC_MENU_TEXT,
              DISC_MENU_LONGTEXT, true )
-- 
2.1.4

