Why does Java resize a Window to 1x1 pixel when HDMI is unplugged (and does not resize back when HDMI is plugged)
Kevin Rushforth
kevin.rushforth at oracle.com
Fri Jun 9 11:55:58 UTC 2023
[Redirected from jdk-dev]
You should be aware that Wayland is not a supported desktop platform.
Work is ongoing under the Wakefield [1] project to add such support, but
that is a longer term effort. Having said that, many thing should
already work, so you might try a more recent version of Java (JDK 20 or
JDK 21 early-access) and see if your results are different.
Maybe others on this list will have comments about your specific issue.
-- Kevin
[1] https://openjdk.org/projects/wakefield/
On 6/9/2023 2:32 AM, Martin Petzold wrote:
> I have a Java application running on:
>
> XWayland 2:1.20.11-1+deb11u6, Weston 9.0.0-1, OpenJDK
> 11.0.18+10-1~deb11u1, Debian 11, Kernel 5.10.52
>
> My JFrame (Window) is set to:
> GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(this);
>
> I can then see my interface on the full screen (in my case it is a TV
> and I have CEC enabled in the Kernel). However, after I unplug HDMI
> and plug HDMI again, my interface is gone (black screen). There is
> only one small 1x1 pixel left. It seems the size of the Window is
> changed by Java / XWayland / (Weston). I am sure, that I am not
> changing it - I check all resize methods on JFrame.
>
> When I restart my Java application, it is back again - so it is not an
> issue of the OS (Linux) directly and also - most probably - not Weston.
>
> I also don't have this issue with a pure Wayland application (e.g.
> Weston flower). Using only Wayland (without Java and XWayland) things
> work.
>
> When I PLUG the HDMI there is NO java.awt.event.ComponentEvent
>
> When I UNPLUG HDMI, I get the following java.awt.event.ComponentEvent:
>
> java.awt.event.ComponentEvent[COMPONENT_RESIZED (0,0 1x1)] on frame0
> java.base/java.lang.Thread.getStackTrace(Thread.java:1602)
> java.desktop/java.awt.AWTEventMulticaster.componentResized(AWTEventMulticaster.java:167)
> java.desktop/java.awt.AWTEventMulticaster.componentResized(AWTEventMulticaster.java:167)
> java.desktop/java.awt.Component.processComponentEvent(Component.java:6461)
> java.desktop/java.awt.Component.processEvent(Component.java:6415)
> java.desktop/java.awt.Container.processEvent(Container.java:2263)
> java.desktop/java.awt.Window.processEvent(Window.java:2049)
> java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
> java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
> java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
> java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
> java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
> java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
> java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
> java.base/java.security.AccessController.doPrivileged(Native Method)
> java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
> java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
> java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
> java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
> java.base/java.security.AccessController.doPrivileged(Native Method)
> java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
> java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
> java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
> java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
> java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
> java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
> java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
> java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
>
> Unfortunately I also don't know how to manipulate the size after I
> catched this event. I tried to directly set the size back, but this
> did not work. I think it may don't work because at this time HDMI is
> UNPLUGGED. Also, if I try to set the size back to normal once the HDMI
> is plugged again, it does not work. I get overruled and the size is
> then back to 1x1 pixel.
>
> As I don't get any event when the HDMI is PLUGGED again, I also don't
> know when to (try to) set the size back to "normal".
>
>
> Thanks,
>
>
> Martin
More information about the client-libs-dev
mailing list