[libbluray-devel] BDToolkit.getEventQueue(): if context is not registered, check component parents

hpi1 git at videolan.org
Mon Apr 8 11:21:59 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Apr  8 12:00:13 2013 +0300| [b5b47d9dc828449338cf917e16ffe4571f13ea03] | committer: hpi1

BDToolkit.getEventQueue(): if context is not registered, check component parents

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

 src/libbluray/bdj/java-j2me/java/awt/BDToolkit.java |   19 ++++++++++++-------
 src/libbluray/bdj/java-j2se/java/awt/BDToolkit.java |   19 ++++++++++++-------
 2 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/src/libbluray/bdj/java-j2me/java/awt/BDToolkit.java b/src/libbluray/bdj/java-j2me/java/awt/BDToolkit.java
index dd98aa0..6102bce 100644
--- a/src/libbluray/bdj/java-j2me/java/awt/BDToolkit.java
+++ b/src/libbluray/bdj/java-j2me/java/awt/BDToolkit.java
@@ -211,14 +211,19 @@ public class BDToolkit extends Toolkit {
 
     public static EventQueue getEventQueue(Component component) {
         if (component != null) {
-            BDJXletContext ctx = (BDJXletContext)contextMap.get(component);
-            if (ctx != null) {
-                EventQueue eq = ctx.getEventQueue();
-                if (eq == null) {
-                    logger.warning("getEventQueue() failed: no context event queue");
+            do {
+                BDJXletContext ctx = (BDJXletContext)contextMap.get(component);
+                if (ctx != null) {
+                    EventQueue eq = ctx.getEventQueue();
+                    if (eq == null) {
+                        logger.warning("getEventQueue() failed: no context event queue");
+                    }
+                    return eq;
                 }
-                return eq;
-            }
+
+                component = component.getParent();
+            } while (component != null);
+
             logger.warning("getEventQueue() failed: no context");
         }
         return null;
diff --git a/src/libbluray/bdj/java-j2se/java/awt/BDToolkit.java b/src/libbluray/bdj/java-j2se/java/awt/BDToolkit.java
index 4aa1935..4455fc2 100644
--- a/src/libbluray/bdj/java-j2se/java/awt/BDToolkit.java
+++ b/src/libbluray/bdj/java-j2se/java/awt/BDToolkit.java
@@ -224,14 +224,19 @@ public class BDToolkit extends Toolkit implements KeyboardFocusManagerPeerProvid
 
     public static EventQueue getEventQueue(Component component) {
         if (component != null) {
-            BDJXletContext ctx = (BDJXletContext)contextMap.get(component);
-            if (ctx != null) {
-                EventQueue eq = ctx.getEventQueue();
-                if (eq == null) {
-                    logger.warning("getEventQueue() failed: no context event queue");
+            do {
+                BDJXletContext ctx = (BDJXletContext)contextMap.get(component);
+                if (ctx != null) {
+                    EventQueue eq = ctx.getEventQueue();
+                    if (eq == null) {
+                        logger.warning("getEventQueue() failed: no context event queue");
+                    }
+                    return eq;
                 }
-                return eq;
-            }
+
+                component = component.getParent();
+            } while (component != null);
+
             logger.warning("getEventQueue() failed: no context");
         }
         return null;



More information about the libbluray-devel mailing list