[Linux] NativeWindow::minimize() doesn't work with fast execution after application start
Problem Description
NativeWindow::minimize() doesn't work on Linux with fast execution after application start. It just do nothing or immediately "restore" window back.
Fullscreen application scaling broken after second screen disconnected using macOS. It happens if application was in fullscreen on screen which disconnected. It will be automatically moved to main screen but scaling/visualization will be broken.
Tested with multiple AIR 51.2.x versions, even with latest AIR 51.2.1.5 with multiple Linux Ubuntu 22/24 x86_64 devices with VM and physical machines. With Wayland and X11. The same issue in all cases. There is no such issues with Windows/macOS.
I tried to wait Event.ACTIVATE and other events from NativeWindow but nothing help.
Or maybe we should wait for some other event before trying to do that?
Related issues: https://github.com/airsdk/Adobe-Runtime-Support/issues/3689 https://github.com/airsdk/Adobe-Runtime-Support/issues/3505 https://github.com/airsdk/Adobe-Runtime-Support/issues/3498 https://github.com/airsdk/Adobe-Runtime-Support/issues/3241 https://github.com/airsdk/Adobe-Runtime-Support/issues/3239 https://github.com/airsdk/Adobe-Runtime-Support/issues/3176 https://github.com/airsdk/Adobe-Runtime-Support/issues/2497 https://github.com/airsdk/Adobe-Runtime-Support/issues/2495 https://github.com/airsdk/Adobe-Runtime-Support/issues/2241 https://github.com/airsdk/Adobe-Runtime-Support/issues/1200
Steps to Reproduce
Launch application with code below using Linux device. Application try to minimize itself just after start.
Application example with sources attached. linux_minimizing_on_start_bug.zip
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.utils.setTimeout;
public class LinuxMinimizingOnStartBug extends Sprite {
public function LinuxMinimizingOnStartBug() {
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
//Uncomment for workaround
//setTimeout(function():void {
stage.nativeWindow.minimize();
//}, 1000);
}
}
}
Actual Result:
Nothing happens or window immediately "restored" back. Looks like something from AIR at early stage calls NativeWindow::restore().
Expected Result: Window minimized.
Known Workarounds
Wait 1 second after application start before execute NativeWindow::minimize().