Why does Java resize a Window to 1x1 pixel when HDMI is unplugged (and does not resize back when HDMI is plugged)
Martin Petzold
martin.petzold at tavla.de
Fri Jun 9 12:01:53 UTC 2023
Dear Kevin,
thanks for your reply and forwarding this message. I am referring to
Java with XWayland mainly.
We have an embedded device with i.MX8MP hardware platform. It is not
that easy to go for very recent Linux platform, a lot of dependencies to
hardware components. I already talked to the Wayland mailing list. It
was not clear what causes this issue. There is only a guess recent
builds could fix it.
I would like to understand this bug. Even if I do 'setReziable(false)'
Java does change the size. Maybe you know about some work-around, how I
can catch and block this behaviour?
According to XrandR output the resolution is correct (however the
XWAYLAND name changes from 0..2). This brings it closer to Java:
HDMI PLUGGED (on boot)
xrandr --current
Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
XWAYLAND0 connected 1920x1080+0+0 (normal left inverted right x axis y
axis) 1110mm x 620mm
1920x1080 59.96*+
HDMI UNPLUGGED
xrandr --current
Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
XWAYLAND1 connected 1920x1080+0+0 (normal left inverted right x axis y
axis) 1150mm x 650mm
1920x1080 59.96*+
HDMI RE-PLUGGED
xrandr --current
Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
XWAYLAND2 connected 1920x1080+0+0 (normal left inverted right x axis y
axis) 1110mm x 620mm
1920x1080 59.96*+
Thanks,
Martin Petzold
Am 09.06.23 um 13:52 schrieb Kevin Rushforth:
> [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
>>
>
--
Martin Petzold (Inhaber & Geschäftsführer)
TAVLA Technology GmbH
Im Dau 14
50678 Köln
Deutschland
Telefon: +49 (0)221 / 3466 0885
Mobil: +49 (0)179 / 9220154
E-Mail:martin.petzold at tavla.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20230609/ac57c5b6/attachment.htm>
More information about the client-libs-dev
mailing list