[libbluray-devel] Change event routing

hpi1 git at videolan.org
Thu Sep 13 14:15:31 CEST 2018


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Sep  4 15:56:14 2018 +0300| [f5dd832d57f31541e7c9efb3208d7c518cd8d172] | committer: hpi1

Change event routing

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

 src/libbluray/bdj/java/org/dvb/event/EventManager.java  | 7 ++-----
 src/libbluray/bdj/java/org/videolan/BDJXletContext.java | 8 ++++++++
 src/libbluray/bdj/java/org/videolan/GUIManager.java     | 4 ++--
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/libbluray/bdj/java/org/dvb/event/EventManager.java b/src/libbluray/bdj/java/org/dvb/event/EventManager.java
index 6a25fb7e..1271d603 100644
--- a/src/libbluray/bdj/java/org/dvb/event/EventManager.java
+++ b/src/libbluray/bdj/java/org/dvb/event/EventManager.java
@@ -29,10 +29,8 @@ import org.davic.resources.ResourceClient;
 import org.davic.resources.ResourceServer;
 import org.davic.resources.ResourceStatusEvent;
 import org.davic.resources.ResourceStatusListener;
-import org.havi.ui.HScene;
 import org.videolan.BDJAction;
 import org.videolan.BDJXletContext;
-import org.videolan.GUIManager;
 import org.videolan.Logger;
 
 public class EventManager implements ResourceServer {
@@ -152,11 +150,10 @@ public class EventManager implements ResourceServer {
 
     public boolean receiveKeyEventN(int type, int modifiers, int keyCode) {
         UserEvent ue = new UserEvent(this, 1, type, keyCode, modifiers, System.currentTimeMillis());
-        HScene focusHScene = GUIManager.getInstance().getFocusHScene();
+        BDJXletContext context = BDJXletContext.getFocusContext();
         boolean result = false;
 
-        if (focusHScene != null) {
-            BDJXletContext context = focusHScene.getXletContext();
+        if (context != null) {
             for (Iterator it = exclusiveAWTEventListener.iterator(); it.hasNext(); ) {
                 UserEventItem item = (UserEventItem)it.next();
                 if (item.context == null || item.context.isReleased()) {
diff --git a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
index 207dc1f0..4ff85c21 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
@@ -431,6 +431,14 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
         return ((BDJThreadGroup)obj).getContext();
     }
 
+    public static BDJXletContext getFocusContext() {
+        if (BDJXletContext.getCurrentContext() != null) {
+            logger.error("getFocusContext() called from Xlet code:\n" + Logger.dumpStack());
+            return null;
+        }
+        return GUIManager.getInstance().getFocusHSceneContext();
+    }
+
     protected void setArgs(String[] args) {
         this.args = args;
     }
diff --git a/src/libbluray/bdj/java/org/videolan/GUIManager.java b/src/libbluray/bdj/java/org/videolan/GUIManager.java
index 1d69d298..0790fc18 100644
--- a/src/libbluray/bdj/java/org/videolan/GUIManager.java
+++ b/src/libbluray/bdj/java/org/videolan/GUIManager.java
@@ -52,11 +52,11 @@ public class GUIManager extends BDRootWindow {
         }
     }
 
-    public HScene getFocusHScene() {
+    BDJXletContext getFocusHSceneContext() {
         Component component = getFocusOwner();
         while (component != null) {
             if (component instanceof HScene)
-                return (HScene)component;
+                return ((HScene)component).getXletContext();
             component = component.getParent();
         }
         return null;



More information about the libbluray-devel mailing list