Adobe-Runtime-Support icon indicating copy to clipboard operation
Adobe-Runtime-Support copied to clipboard

[macOS] `NativeWindow::resizeToScreen()` resize window only to 1/4 of Retina screen

Open itlancer opened this issue 4 months ago • 0 comments

Problem Description

NativeWindow::resizeToScreen() resize window only to 1/4 of Retina screen for macOS devices.

Tested with latest AIR 50.2.4.5 and 51.0.0.4 with multiple macOS devices (Intel-based and ARM) with multiple applications and OS versions. Same issue with all devices with Retina (HiDPI) screens. There is no such issue with non-Retina screens. There is no such issue with Windows. Didn't test with Linux.

Related issues: 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/1669 https://github.com/airsdk/Adobe-Runtime-Support/issues/1123

Steps to Reproduce

Launch application with code below on any macOS device with Retina (HiDPI) screen and click anywhere on stage.

Application example with sources attached. macos_nativewindow_resizetoscreen_quarter_bug.zip

package {
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.events.Event;
	import flash.display.Screen;
	
	public class MacOSNativeWindowResizeToScreenQuarterBug extends Sprite {
		
		public function MacOSNativeWindowResizeToScreenQuarterBug() {
			addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			stage.addEventListener(MouseEvent.CLICK, click);
		}
	
		private function click(e:Event):void {
			trace("click");
			stage.nativeWindow.resizeToScreen(Screen.mainScreen);//This line cause resizing window to 1/4 of screen for macOS
		}
	}
}

Actual Result: Application window will be resized to 1/4 of screen at top left corner.

Expected Result: Application window will be resized to whole screen.

Known Workarounds

Calculate current target size of window by yourself and resize/reposition it via x/y/width/height/bounds properties.

itlancer avatar Apr 13 '24 17:04 itlancer