[libbluray-devel] HGraphicsDevice: Support for graphics resolution change

hpi1 git at videolan.org
Thu Oct 9 10:01:12 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Oct  9 10:38:55 2014 +0300| [4a111aef7f9902ce2676f8f9e1eb1ab98305e86f] | committer: hpi1

HGraphicsDevice: Support for graphics resolution change

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

 .../bdj/java/org/havi/ui/HGraphicsDevice.java      |   32 ++++++++++++++++++--
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/src/libbluray/bdj/java/org/havi/ui/HGraphicsDevice.java b/src/libbluray/bdj/java/org/havi/ui/HGraphicsDevice.java
index 7870951..d7ea2f5 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HGraphicsDevice.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HGraphicsDevice.java
@@ -19,6 +19,9 @@
 
 package org.havi.ui;
 
+import java.awt.Dimension;
+
+import org.videolan.GUIManager;
 import org.videolan.Logger;
 
 public class HGraphicsDevice extends HScreenDevice {
@@ -67,13 +70,36 @@ public class HGraphicsDevice extends HScreenDevice {
     public boolean setGraphicsConfiguration(HGraphicsConfiguration hgc)
             throws SecurityException, HPermissionDeniedException,
             HConfigurationException {
-        this.hgc = hgc;
 
         logger.unimplemented("setGraphicsConfiguration");
 
-        //org.videolan.GUIManager.getInstance().setBounds(0, 0, 960, 540);
-        // -- not enough ...
+        GUIManager mgr = GUIManager.getInstance();
+        Dimension d = hgc.getPixelResolution();
+        int curWidth = mgr.getWidth();
+        int curHeight = mgr.getHeight();
+
+        if (curWidth != d.width || curHeight != d.height) {
+            logger.info("Request to switch graphics resolution from " + curWidth + "x" + curHeight +
+                        " to " + d.width + "x" + d.height);
+
+            if (mgr.isVisible()) {
+                mgr.setVisible(false);
+                mgr.setBounds(0, 0, d.width, d.height);
+                mgr.setVisible(true);
+            } else {
+                mgr.setBounds(0, 0, d.width, d.height);
+            }
 
+            curWidth = mgr.getWidth();
+            curHeight = mgr.getHeight();
+            if (curWidth != d.width || curHeight != d.height) {
+                logger.error("Request to switch graphics resolution from " + curWidth + "x" + curHeight +
+                            " to " + d.width + "x" + d.height + " FAILED");
+                return false;
+            }
+        }
+
+        this.hgc = hgc;
         return true;
     }
 



More information about the libbluray-devel mailing list