From 53f1b23374382066b9eb31e4850ffe5e9a1e408d Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Mon, 4 Dec 2023 23:12:13 +0000 Subject: [PATCH] JAL-4059 Attempts to set JalviewJS desktop geometry from Info hash --- src/jalview/gui/Desktop.java | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index d2fab5c..25b34e9 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -789,11 +789,42 @@ public class Desktop extends jalview.jbgui.GDesktop String y = Cache.getProperty(windowName + "SCREEN_Y"); String width = Cache.getProperty(windowName + "SCREEN_WIDTH"); String height = Cache.getProperty(windowName + "SCREEN_HEIGHT"); - if ((x != null) && (y != null) && (width != null) && (height != null)) + if (Platform.isJS()) { - int ix = Integer.parseInt(x), iy = Integer.parseInt(y), - iw = Integer.parseInt(width), ih = Integer.parseInt(height); - if (Cache.getProperty("SCREENGEOMETRY_WIDTH") != null) + String infoX = JalviewJSUtil.getJ2sInfoValue("x"); + String infoY = JalviewJSUtil.getJ2sInfoValue("y"); + String infoWidth = JalviewJSUtil.getJ2sInfoValue("width"); + String infoHeight = JalviewJSUtil.getJ2sInfoValue("height"); + if (infoX != null) + { + x = "100"; + } + if (infoY != null) + { + y = "100"; + } + if (infoWidth != null) + { + width = infoWidth; + } + if (infoHeight != null) + { + height = infoHeight; + } + jalview.bin.Console + .info("##### width=" + width + ", infoheight=" + infoHeight); + jalview.bin.Console.info("##### x=" + x + ", y=" + y); + } + // Not working for JalviewJS yet + if (!Platform.isJS() && (x != null) && (y != null) && (width != null) + && (height != null)) + { + int ix = Integer.parseInt(x); + int iy = Integer.parseInt(y); + int iw = Integer.parseInt(width); + int ih = Integer.parseInt(height); + if (!Platform.isJS() + && Cache.getProperty("SCREENGEOMETRY_WIDTH") != null) { // attempt #1 - try to cope with change in screen geometry - this // version doesn't preserve original jv aspect ratio. -- 1.7.10.2