[libbluray-devel] Add BDJ_EVENT_MOUSE

hpi1 git at videolan.org
Mon May 16 14:07:17 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon May 16 15:02:53 2016 +0300| [eefd7c6a192b5243ec9b25676944fcb87cfa3c2e] | committer: hpi1

Add BDJ_EVENT_MOUSE

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

 src/libbluray/bdj/bdj.c                            |    3 ++-
 src/libbluray/bdj/bdj.h                            |    3 ++-
 src/libbluray/bdj/java/java/awt/BDJHelper.java     |    8 ++++++++
 src/libbluray/bdj/java/org/videolan/Libbluray.java |    8 ++++++++
 src/libbluray/bluray.c                             |    7 ++++++-
 5 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index 3a4446d..9ee1aa8 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -703,6 +703,7 @@ int bdj_process_event(BDJAVA *bdjava, unsigned ev, unsigned param)
 
         /* 16 */ "VK_KEY",
         /* 17 */ "UO_MASKED",
+        /* 18 */ "MOUSE",
     };
 
     JNIEnv* env;
@@ -715,7 +716,7 @@ int bdj_process_event(BDJAVA *bdjava, unsigned ev, unsigned param)
         return -1;
     }
 
-    if (ev > BD_EVENT_LAST) {
+    if (ev > BDJ_EVENT_LAST) {
         BD_DEBUG(DBG_BDJ | DBG_CRIT, "bdj_process_event(%d,%d): unknown event\n", ev, param);
     }
     // Disable too verbose logging (PTS)
diff --git a/src/libbluray/bdj/bdj.h b/src/libbluray/bdj/bdj.h
index 4258470..ee6355e 100644
--- a/src/libbluray/bdj/bdj.h
+++ b/src/libbluray/bdj/bdj.h
@@ -54,8 +54,9 @@ typedef enum {
 
     BDJ_EVENT_VK_KEY           = 16,
     BDJ_EVENT_UO_MASKED        = 17,
+    BDJ_EVENT_MOUSE            = 18,
 
-    BDJ_EVENT_LAST             = 17,
+    BDJ_EVENT_LAST             = 18,
 
 } BDJ_EVENT;
 
diff --git a/src/libbluray/bdj/java/java/awt/BDJHelper.java b/src/libbluray/bdj/java/java/awt/BDJHelper.java
index 6d8c4af..59ed300 100644
--- a/src/libbluray/bdj/java/java/awt/BDJHelper.java
+++ b/src/libbluray/bdj/java/java/awt/BDJHelper.java
@@ -68,6 +68,14 @@ public class BDJHelper {
         }
     }
 
+    public static boolean postMouseEvent(int x, int y) {
+        return false;
+    }
+
+    public static boolean postMouseEvent(int button) {
+        return false;
+    }
+
     public static boolean postKeyEvent(int id, int modifiers, int keyCode) {
         Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getGlobalFocusOwner();
         if (focusOwner != null) {
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 93e8f31..f2d26dd 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -578,6 +578,10 @@ public class Libbluray {
             case 404: key = HRcEvent.VK_COLORED_KEY_1; break;
             case 405: key = HRcEvent.VK_COLORED_KEY_2; break;
             case 406: key = HRcEvent.VK_COLORED_KEY_3; break;
+            case 17:
+                result = java.awt.BDJHelper.postMouseEvent(0);
+                key = -1;
+                break;
             default:
                 key = -1;
                 result = false;
@@ -590,6 +594,9 @@ public class Libbluray {
                 result = r1 || r2 || r3;
             }
             break;
+        case BDJ_EVENT_MOUSE:
+            result = java.awt.BDJHelper.postMouseEvent(param >> 16, param & 0xffff);
+            break;
         default:
             System.err.println("Unknown event " + event + "." + param);
             result = false;
@@ -628,6 +635,7 @@ public class Libbluray {
 
     private static final int BDJ_EVENT_VK_KEY                   = 16;
     public  static final int BDJ_EVENT_UO_MASKED                = 17;
+    private static final int BDJ_EVENT_MOUSE                    = 18;
 
     /* TODO: use org/bluray/system/RegisterAccess instead */
     public static final int PSR_IG_STREAM_ID     = 0;
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 0e60b68..eadcf71 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -3510,6 +3510,7 @@ void bd_set_scr(BLURAY *bd, int64_t pts)
 
 int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y)
 {
+    uint32_t param = (x << 16) | y;
     int result = -1;
 
     bd_mutex_lock(&bd->mutex);
@@ -3517,7 +3518,11 @@ int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y)
     _set_scr(bd, pts);
 
     if (bd->title_type == title_hdmv) {
-        result = _run_gc(bd, GC_CTRL_MOUSE_MOVE, (x << 16) | y);
+        result = _run_gc(bd, GC_CTRL_MOUSE_MOVE, param);
+#ifdef USING_BDJAVA
+    } else if (bd->title_type == title_bdj) {
+        result = _bdj_event(bd, BDJ_EVENT_MOUSE, param);
+#endif
     }
 
     bd_mutex_unlock(&bd->mutex);



More information about the libbluray-devel mailing list