[libbluray-devel] Implemented selecting button using number keys

hpi1 git at videolan.org
Fri Apr 22 10:34:32 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Apr 22 11:21:12 2011 +0300| [565c24b163aa31bcffacf4c633c01ebbc77b13cc] | committer: hpi1

Implemented selecting button using number keys

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=565c24b163aa31bcffacf4c633c01ebbc77b13cc
---

 src/libbluray/decoders/graphics_controller.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/decoders/graphics_controller.c b/src/libbluray/decoders/graphics_controller.c
index afc958f..a2c595d 100644
--- a/src/libbluray/decoders/graphics_controller.c
+++ b/src/libbluray/decoders/graphics_controller.c
@@ -493,6 +493,7 @@ static void _render_page(GRAPHICS_CONTROLLER *gc,
 
 #define VK_IS_NUMERIC(vk) (/*vk >= BD_VK_0  &&*/ vk <= BD_VK_9)
 #define VK_IS_CURSOR(vk)  (vk >= BD_VK_UP && vk <= BD_VK_RIGHT)
+#define VK_TO_NUMBER(vk)  ((vk) - BD_VK_0)
 
 static int _user_input(GRAPHICS_CONTROLLER *gc, bd_vk_key_e key, GC_NAV_CMDS *cmds)
 {
@@ -538,7 +539,15 @@ static int _user_input(GRAPHICS_CONTROLLER *gc, bd_vk_key_e key, GC_NAV_CMDS *cm
             continue;
         }
 
-        if (VK_IS_CURSOR(key) || key == BD_VK_ENTER) {
+        /* numeric select */
+        if (VK_IS_NUMERIC(key)) {
+            if (button->numeric_select_value == VK_TO_NUMBER(key)) {
+                new_btn_id = button->id;
+            }
+        }
+
+        /* cursor keys */
+        else if (VK_IS_CURSOR(key) || key == BD_VK_ENTER) {
             if (button->id == cur_btn_id) {
                 switch(key) {
                     case BD_VK_UP:
@@ -563,9 +572,6 @@ static int _user_input(GRAPHICS_CONTROLLER *gc, bd_vk_key_e key, GC_NAV_CMDS *cm
                     default:;
                 }
             }
-            if (VK_IS_NUMERIC(key)) {
-                // TODO: numeric_select_value
-            }
 
             if (new_btn_id != cur_btn_id) {
                 BD_IG_BUTTON *button = _find_button_page(page, new_btn_id, NULL);



More information about the libbluray-devel mailing list