diff --git a/core/src/avm2/globals/flash/desktop/Icon.as b/core/src/avm2/globals/flash/desktop/Icon.as new file mode 100644 index 000000000000..f893c9cf742d --- /dev/null +++ b/core/src/avm2/globals/flash/desktop/Icon.as @@ -0,0 +1,21 @@ +// The initial version of this file was autogenerated from the official AS3 reference at +// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/Icon.html +// by https://github.com/golfinq/ActionScript_Event_Builder +// It won't be regenerated in the future, so feel free to edit and/or fix + +package flash.desktop +{ + import flash.events.EventDispatcher; + [API("661")] + public class Icon extends EventDispatcher + { + + // The icon image as an array of BitmapData objects of different sizes. + public var bitmaps:Array; + + function Icon(bitmaps:Array) + { + this.bitmaps = bitmaps; + } + } +} diff --git a/core/src/avm2/globals/flash/desktop/InteractiveIcon.as b/core/src/avm2/globals/flash/desktop/InteractiveIcon.as new file mode 100644 index 000000000000..6761fb83d5f4 --- /dev/null +++ b/core/src/avm2/globals/flash/desktop/InteractiveIcon.as @@ -0,0 +1,27 @@ +// The initial version of this file was autogenerated from the official AS3 reference at +// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/InteractiveIcon.html +// by https://github.com/golfinq/ActionScript_Event_Builder +// It won't be regenerated in the future, so feel free to edit and/or fix + +package flash.desktop +{ + [API("661")] + public class InteractiveIcon extends Icon + { + // The current display height of the icon in pixels. + private var _height:int; + + // The current display width of the icon in pixels. + private var _width:int; + + public function get height():int + { + return this._height; + } + + public function get width():int + { + return this._width; + } + } +} diff --git a/core/src/avm2/globals/flash/desktop/NativeApplication.as b/core/src/avm2/globals/flash/desktop/NativeApplication.as new file mode 100644 index 000000000000..556cdc9bf342 --- /dev/null +++ b/core/src/avm2/globals/flash/desktop/NativeApplication.as @@ -0,0 +1,259 @@ +package flash.desktop +{ + import flash.display.NativeWindow; + import flash.events.InvokeEvent; + import flash.events.Event; + import flash.events.TimerEvent; + import flash.events.EventDispatcher; + import flash.system.Security; + import flash.utils.Timer; + import flash.utils.setTimeout; + import __ruffle__.stub_method; + import __ruffle__.stub_getter; + import __ruffle__.stub_setter; + + [API("661")] + public final class NativeApplication extends EventDispatcher + { + private static var _instance:NativeApplication; + + public var _openedWindows:Array = []; + + private var _idleThreshold:int = 300; + + public function NativeApplication() + { + super(); + setTimeout(function():void + { + dispatchEvent(new InvokeEvent(InvokeEvent.INVOKE, false, false, null, [])); + }, 500); + } + + public static function get nativeApplication():NativeApplication + { + if (!_instance) + _instance = new NativeApplication(); + return _instance; + } + + public static function get supportsMenu():Boolean + { + stub_getter("flash.desktop.NativeApplication", "supportsMenu"); + return false; + } + + public static function get supportsDockIcon():Boolean + { + stub_getter("flash.desktop.NativeApplication", "supportsDockIcon"); + return false; + } + + public static function get supportsSystemTrayIcon():Boolean + { + stub_getter("flash.desktop.NativeApplication", "supportsSystemTrayIcon"); + return false; + } + + [API("668")] + public static function get supportsDefaultApplication():Boolean + { + stub_getter("flash.desktop.NativeApplication", "supportsDefaultApplication"); + return false; + } + + [API("668")] + public static function get supportsStartAtLogin():Boolean + { + stub_getter("flash.desktop.NativeApplication", "supportsStartAtLogin"); + return false; + } + + public function exit(exitCode:int = 0):void + { + stub_method("flash.desktop.NativeApplication", "exit"); + } + + public function get runtimeVersion():String + { + stub_method("flash.desktop.NativeApplication", "runtimeVersion"); + return "5.0.0"; + } + + public function get runtimePatchLevel():uint + { + stub_method("flash.desktop.NativeApplication", "runtimePatchLevel"); + return 0; + } + + public function get applicationID():String + { + stub_method("flash.desktop.NativeApplication", "applicationID"); + return ""; + } + + public function get publisherID():String + { + stub_method("flash.desktop.NativeApplication", "publisherID"); + return ""; + } + + public function get applicationDescriptor():XML + { + stub_method("flash.desktop.NativeApplication", "applicationDescriptor"); + return null; + } + + public function get autoExit():Boolean + { + stub_getter("flash.desktop.NativeApplication", "autoExit"); + return false; + } + + public function set autoExit(param1:Boolean):void + { + stub_getter("flash.desktop.NativeApplication", "autoExit"); + } + + public function get icon():InteractiveIcon + { + stub_getter("flash.desktop.NativeApplication", "icon"); + return null; + } + + [API("668")] + public function get systemIdleMode():String + { + stub_getter("flash.desktop.NativeApplication", "systemIdleMode"); + return "normal"; + } + + [API("668")] + public function set systemIdleMode(param1:String):void + { + stub_setter("flash.desktop.NativeApplication", "systemIdleMode"); + } + + public function get startAtLogin():Boolean + { + stub_getter("flash.desktop.NativeApplication", "startAtLogin"); + return false; + } + + public function set startAtLogin(param1:Boolean):void + { + stub_setter("flash.desktop.NativeApplication", "startAtLogin"); + } + + public function activate(window:NativeWindow = null):void + { + stub_method("flash.desktop.NativeApplication", "activate"); + } + + public function get activeWindow():NativeWindow + { + stub_getter("flash.desktop.NativeApplication", "activeWindow"); + return _openedWindows[0]; + } + + public function get openedWindows():Array + { + stub_getter("flash.desktop.NativeApplication", "openedWindows"); + return _openedWindows; + } + + public function get timeSinceLastUserInput():int + { + stub_getter("flash.desktop.NativeApplication", "timeSinceLastUserInput"); + return 100; + } + + public function get idleThreshold():int + { + return this._idleThreshold; + } + + public function set idleThreshold(value:int):void + { + this._idleThreshold = value; + } + + public function copy():Boolean + { + stub_getter("flash.desktop.NativeApplication", "copy"); + return false; + } + + public function cut():Boolean + { + stub_getter("flash.desktop.NativeApplication", "cut"); + return false; + } + + public function paste():Boolean + { + stub_getter("flash.desktop.NativeApplication", "paste"); + return false; + } + + public function clear():Boolean + { + stub_getter("flash.desktop.NativeApplication", "clear"); + return false; + } + + public function selectAll():Boolean + { + stub_method("flash.desktop.NativeApplication", "selectAll"); + return false; + } + + public function getDefaultApplication(extension:String):String + { + stub_method("flash.desktop.NativeApplication", "getDefaultApplication"); + return null; + } + + public function isSetAsDefaultApplication(extension:String):Boolean + { + stub_method("flash.desktop.NativeApplication", "isSetAsDefaultApplication"); + return true; + } + + public function setAsDefaultApplication(extension:String):void + { + stub_method("flash.desktop.NativeApplication", "setAsDefaultApplication"); + } + + public function removeAsDefaultApplication(extension:String):void + { + stub_method("flash.desktop.NativeApplication", "removeAsDefaultApplication"); + } + + [API("681")] + public function get executeInBackground():Boolean + { + stub_getter("flash.desktop.NativeApplication", "executeInBackground"); + return false; + } + + [API("681")] + public function set executeInBackground(param1:Boolean):void + { + stub_setter("flash.desktop.NativeApplication", "executeInBackground"); + } + + // [API("721")] Ruffle doesn't support this API Version + public function get isCompiledAOT():Boolean + { + stub_getter("flash.desktop.NativeApplication", "isCompiledAOT"); + return false; + } + + public function get isActive():Boolean + { + stub_getter("flash.desktop.NativeApplication", "isActive"); + return true; + } + } +} diff --git a/core/src/avm2/globals/flash/display/NativeMenu.as b/core/src/avm2/globals/flash/display/NativeMenu.as index d002f30ff87d..df5d94974f76 100644 --- a/core/src/avm2/globals/flash/display/NativeMenu.as +++ b/core/src/avm2/globals/flash/display/NativeMenu.as @@ -1,6 +1,141 @@ -package flash.display { +package flash.display +{ + import flash.events.EventDispatcher; - public class NativeMenu extends EventDispatcher { + import __ruffle__.stub_method; + import __ruffle__.stub_getter; + + [API("661")] + public class NativeMenu extends EventDispatcher + { + + // Indicates whether any form of native menu is supported on the client system. + private var _isSupported:Boolean; + + // The array of NativeMenuItem objects in this menu. + public var items:Array; + + // The number of NativeMenuItem objects in this menu. + private var _numItems:int; + + // The parent menu. + private var _parent:NativeMenu; + + public function NativeMenu() + { + + } + + // Adds a menu item at the bottom of the menu. + public function addItem(item:NativeMenuItem):NativeMenuItem + { + stub_method("flash.display.NativeMenu", "addItem"); + return null; + } + + // Inserts a menu item at the specified position. + public function addItemAt(item:NativeMenuItem, index:int):NativeMenuItem + { + stub_method("flash.display.NativeMenu", "addItemAt"); + return null; + } + + // Adds a submenu to the menu by inserting a new menu item. + public function addSubmenu(submenu:NativeMenu, label:String):NativeMenuItem + { + stub_method("flash.display.NativeMenu", "addSubmenu"); + return null; + } + + // Adds a submenu to the menu by inserting a new menu item at the specified position. + public function addSubmenuAt(submenu:NativeMenu, index:int, label:String):NativeMenuItem + { + stub_method("flash.display.NativeMenu", "addSubmenuAt"); + return null; + } + + // Creates a copy of the menu and all items. + public function clone():NativeMenu + { + stub_method("flash.display.NativeMenu", "clone"); + return null; + } + + // Reports whether this menu contains the specified menu item. + public function containsItem(item:NativeMenuItem):Boolean + { + stub_method("flash.display.NativeMenu", "containsItem"); + return false; + } + + // Pops up this menu at the specified location. + public function display(stage:Stage, stageX:Number, stageY:Number):void + { + stub_method("flash.display.NativeMenu", "display"); + } + + // Gets the menu item at the specified index. + public function getItemAt(index:int):NativeMenuItem + { + stub_method("flash.display.NativeMenu", "getItemAt"); + return null; + } + + // Gets the menu item with the specified name. + public function getItemByName(name:String):NativeMenuItem + { + stub_method("flash.display.NativeMenu", "getItemByName"); + return null; + } + + // Gets the position of the specified item. + public function getItemIndex(item:NativeMenuItem):int + { + stub_method("flash.display.NativeMenu", "getItemIndex"); + return -1; + } + + // Removes all items from the menu. + public function removeAllItems():void + { + stub_method("flash.display.NativeMenu", "removeAllItems"); + } + + // Removes the specified menu item. + public function removeItem(item:NativeMenuItem):NativeMenuItem + { + stub_method("flash.display.NativeMenu", "removeItem"); + return null; + } + + // Removes and returns the menu item at the specified index. + public function removeItemAt(index:int):NativeMenuItem + { + stub_method("flash.display.NativeMenu", "removeItemAt"); + return null; + } + + // Moves a menu item to the specified position. + public function setItemIndex(item:NativeMenuItem, index:int):void + { + stub_method("flash.display.NativeMenu", "setItemIndex"); + } + + [API("668")] + public function get isSupported():Boolean + { + return this._isSupported; + } + + public function get numItems():int + { + return this._numItems; + } + + public function get parent():NativeMenu + { + return this._parent; + } } } diff --git a/core/src/avm2/globals/flash/display/NativeMenuItem.as b/core/src/avm2/globals/flash/display/NativeMenuItem.as index 1cdd9491f35f..c3665015a2bb 100644 --- a/core/src/avm2/globals/flash/display/NativeMenuItem.as +++ b/core/src/avm2/globals/flash/display/NativeMenuItem.as @@ -1,5 +1,7 @@ package flash.display { import flash.events.EventDispatcher; + + [API("661")] public class NativeMenuItem extends EventDispatcher { public var enabled: Boolean; } diff --git a/core/src/avm2/globals/flash/display/NativeWindow.as b/core/src/avm2/globals/flash/display/NativeWindow.as new file mode 100644 index 000000000000..28dfaf5129a7 --- /dev/null +++ b/core/src/avm2/globals/flash/display/NativeWindow.as @@ -0,0 +1,317 @@ +package flash.display +{ + import flash.geom.Point; + import flash.geom.Rectangle; + import flash.events.NativeWindowBoundsEvent; + import flash.events.Event; + import flash.events.EventDispatcher; + import flash.desktop.NativeApplication; + import __ruffle__.stub_method; + import __ruffle__.stub_getter; + import __ruffle__.stub_setter; + import __ruffle__.stub_constructor; + + [API("661")] + public class NativeWindow extends EventDispatcher + { + public const systemMaxSize:Point = new Point(2880, 2880); + public const systemMinSize:Point = new Point(1, 1); + public var minSize:Point = systemMinSize; + public var maxSize:Point = systemMaxSize; + public var title:String; + public var alwaysInFront:Boolean = true; + public var visible:Boolean = true; + + private var _bounds:Rectangle; + private var _maximizable:Boolean; + private var _minimizable:Boolean; + private var _resizable:Boolean; + private var _systemChrome:String; + private var _transparent:Boolean; + private var _type:String; + private var _closed:Boolean = false; + private var _stage:Stage; + + public function NativeWindow(initOptions:NativeWindowInitOptions, _stage:Stage = null) + { + stub_constructor("flash.display.NativeWindow"); + NativeApplication.nativeApplication._openedWindows.push(this); + if (_stage) + { + this._stage = _stage; + _stage.addEventListener(Event.RESIZE, function(e:Event):void + { + dispatchEvent(new NativeWindowBoundsEvent(NativeWindowBoundsEvent.RESIZE, false, false, _bounds, _bounds = new Rectangle(x, y, width, height))); + }); + } + else + { + stub_constructor("flash.display.NativeWindow without stage"); + } + + _maximizable = initOptions.maximizable; + _minimizable = initOptions.minimizable; + _resizable = initOptions.resizable; + _systemChrome = initOptions.systemChrome; + _transparent = initOptions.transparent; + _type = initOptions.type; + } + + public function get width():Number + { + stub_getter("flash.display.NativeWindow", "width"); + return _stage.stageWidth; + } + + public function set width(value:Number):void + { + stub_setter("flash.display.NativeWindow", "width"); + _stage.stageWidth = value; + } + + public function get height():Number + { + stub_getter("flash.display.NativeWindow", "height"); + return _stage.stageHeight; + } + + public function set height(value:Number):void + { + stub_setter("flash.display.NativeWindow", "height"); + _stage.stageHeight = value; + } + + public function get x():Number + { + stub_getter("flash.display.NativeWindow", "x"); + return _stage.x; + } + + public function set x(value:Number):void + { + stub_setter("flash.display.NativeWindow", "x"); + } + + public function get y():Number + { + stub_getter("flash.display.NativeWindow", "y"); + return _stage.y; + } + + public function set y(value:Number):void + { + stub_setter("flash.display.NativeWindow", "y"); + } + + public function get bounds():Rectangle + { + stub_getter("flash.display.NativeWindow", "bounds"); + return _bounds; + } + + public function set bounds(value:Rectangle):void + { + stub_setter("flash.display.NativeWindow", "bounds"); + _bounds.height = height = value.height; + _bounds.width = width = value.width; + } + + public function get maximizable():Boolean + { + stub_getter("flash.display.NativeWindow", "maximizable"); + return _maximizable; + } + + public function get minimizable():Boolean + { + stub_getter("flash.display.NativeWindow", "minimizable"); + return _minimizable; + } + + public function get resizable():Boolean + { + stub_getter("flash.display.NativeWindow", "resizable"); + return _resizable; + } + + public function get systemChrome():String + { + stub_getter("flash.display.NativeWindow", "systemChrome"); + return _systemChrome; + } + + public function get transparent():Boolean + { + stub_getter("flash.display.NativeWindow", "transparent"); + return _transparent; + } + + public function get type():String + { + stub_getter("flash.display.NativeWindow", "type"); + return _type; + } + + public function get stage():Stage + { + return _stage; + } + + // Activates this window. + public function activate():void + { + stub_method("flash.display.NativeWindow", "activate"); + dispatchEvent(new Event(Event.ACTIVATE)); + } + + // Closes this window. + public function close():void + { + stub_method("flash.display.NativeWindow", "close"); + if (!dispatchEvent(new Event(Event.CLOSING, false, true))) + { + _closed = true; + dispatchEvent(new Event(Event.CLOSE)); + dispatchEvent(new Event(Event.DEACTIVATE)); + } + + } + + // Converts a point in pixel coordinates relative to the origin of the window stage (a global point in terms of the display list), to a point on the virtual desktop. + public function globalToScreen(globalPoint:Point):Point + { + stub_method("flash.display.NativeWindow", "globalToScreen"); + return null; + } + + // Returns a list of the NativeWindow objects that are owned by this window. + [API("671")] + public function listOwnedWindows():Vector. + { + stub_method("flash.display.NativeWindow", "listOwnedWindows"); + return new Vector.(); + } + + // Maximizes this window. + public function maximize():void + { + stub_method("flash.display.NativeWindow", "maximize"); + } + + // Minimizes this window. + public function minimize():void + { + stub_method("flash.display.NativeWindow", "minimize"); + } + + // Triggers a visual cue through the operating system that an event of interest has occurred. + public function notifyUser(type:String):void + { + stub_method("flash.display.NativeWindow", "notifyUser"); + } + + // Sends this window directly behind the specified window. + public function orderInBackOf(window:NativeWindow):Boolean + { + stub_method("flash.display.NativeWindow", "orderInBackOf"); + return false; + } + + // Brings this window directly in front of the specified window. + public function orderInFrontOf(window:NativeWindow):Boolean + { + stub_method("flash.display.NativeWindow", "orderInFrontOf"); + return false; + } + + // Sends this window behind any other visible windows. + public function orderToBack():Boolean + { + stub_method("flash.display.NativeWindow", "orderToBack"); + return false; + } + + // Brings this window in front of any other visible windows. + public function orderToFront():Boolean + { + stub_method("flash.display.NativeWindow", "orderToFront"); + return false; + } + + // Restores this window from either a minimized or a maximized state. + public function restore():void + { + stub_method("flash.display.NativeWindow", "restore"); + } + + // Starts a system-controlled move of this window. + public function startMove():Boolean + { + stub_method("flash.display.NativeWindow", "startMove"); + return false; + } + + // Starts a system-controlled resize operation of this window. + public function startResize(edgeOrCorner:String = "BR"):Boolean + { + stub_method("flash.display.NativeWindow", "startResize"); + return false; + } + + public function get active():Boolean + { + return true; + } + + public function get closed():Boolean + { + return this._closed; + } + + public function get displayState():String + { + stub_getter("flash.display.NativeWindow", "displayState"); + return "normal"; + } + + [API("668")] + public function get isSupported():Boolean + { + stub_getter("flash.display.NativeWindow", "isSupported"); + return false; + } + + [API("671")] + public function get owner():NativeWindow + { + stub_getter("flash.display.NativeWindow", "owner"); + return this; + } + + [API("675")] + public function get renderMode():String + { + stub_getter("flash.display.NativeWindow", "renderMode"); + return "auto"; + } + + public function get supportsMenu():Boolean + { + stub_getter("flash.display.NativeWindow", "supportsMenu"); + return false; + } + + public function get supportsNotification():Boolean + { + stub_getter("flash.display.NativeWindow", "supportsNotification"); + return false; + } + + [API("661")] + public function get supportsTransparency():Boolean + { + stub_getter("flash.display.NativeWindow", "supportsTransparency"); + return false; + } + } +} diff --git a/core/src/avm2/globals/flash/display/NativeWindowDisplayState.as b/core/src/avm2/globals/flash/display/NativeWindowDisplayState.as new file mode 100644 index 000000000000..b405843c769b --- /dev/null +++ b/core/src/avm2/globals/flash/display/NativeWindowDisplayState.as @@ -0,0 +1,10 @@ +package flash.display +{ + [API("661")] + public final class NativeWindowDisplayState + { + public static const MAXIMIZED:String = "maximized"; + public static const MINIMIZED:String = "minimized"; + public static const NORMAL:String = "normal"; + } +} diff --git a/core/src/avm2/globals/flash/display/NativeWindowInitOptions.as b/core/src/avm2/globals/flash/display/NativeWindowInitOptions.as new file mode 100644 index 000000000000..af546213eda7 --- /dev/null +++ b/core/src/avm2/globals/flash/display/NativeWindowInitOptions.as @@ -0,0 +1,50 @@ +// The initial version of this file was autogenerated from the official AS3 reference at +// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/NativeWindowInitOptions.html +// by https://github.com/golfinq/ActionScript_Event_Builder +// It won't be regenerated in the future, so feel free to edit and/or fix + +package flash.display +{ + [API("661")] + public class NativeWindowInitOptions + { + + // Specifies whether the window can be maximized by the user. + public var maximizable:Boolean; + + // Specifies whether the window can be minimized by the user. + public var minimizable:Boolean; + + // Specifies the NativeWindow object that should own any windows created with this NativeWindowInitOptions. + [API("671")] + public var owner:NativeWindow; + + // Specifies the render mode of the NativeWindow object created with this NativeWindowInitOptions. + [API("675")] + public var renderMode:String; + + // Specifies whether the window can be resized by the user. + public var resizable:Boolean; + + // Specifies whether system chrome is provided for the window. + public var systemChrome:String; + + // Specifies whether the window supports transparency and alpha blending against the desktop. + public var transparent:Boolean; + + // Specifies the type of the window to be created. + public var type:String; + + public function NativeWindowInitOptions() + { + systemChrome = NativeWindowSystemChrome.STANDARD; + type = NativeWindowType.NORMAL; + transparent = false; + owner = null; + resizable = true; + maximizable = true; + minimizable = true; + } + + } +} diff --git a/core/src/avm2/globals/flash/display/NativeWindowSystemChrome.as b/core/src/avm2/globals/flash/display/NativeWindowSystemChrome.as new file mode 100644 index 000000000000..bb0f17322ccf --- /dev/null +++ b/core/src/avm2/globals/flash/display/NativeWindowSystemChrome.as @@ -0,0 +1,10 @@ +package flash.display +{ + [API("661")] + public final class NativeWindowSystemChrome + { + public static const ALTERNATE:String = "alternate"; + public static const NONE:String = "none"; + public static const STANDARD:String = "standard"; + } +} diff --git a/core/src/avm2/globals/flash/display/NativeWindowType.as b/core/src/avm2/globals/flash/display/NativeWindowType.as new file mode 100644 index 000000000000..d2345581bb05 --- /dev/null +++ b/core/src/avm2/globals/flash/display/NativeWindowType.as @@ -0,0 +1,10 @@ +package flash.display +{ + [API("661")] + public final class NativeWindowType + { + public static const LIGHTWEIGHT:String = "lightweight"; + public static const NORMAL:String = "normal"; + public static const UTILITY:String = "utility"; + } +} \ No newline at end of file diff --git a/core/src/avm2/globals/flash/display/Stage.as b/core/src/avm2/globals/flash/display/Stage.as index f4f8ea6302b9..d3b627e9068b 100644 --- a/core/src/avm2/globals/flash/display/Stage.as +++ b/core/src/avm2/globals/flash/display/Stage.as @@ -14,6 +14,8 @@ package flash.display { public class Stage extends DisplayObjectContainer { private var _colorCorrection:String = ColorCorrection.DEFAULT; private var _mouseLock:Boolean = false; + private var _nativeWindow:NativeWindow; + private var _fullScreenSourceRect:Rectangle; public function Stage() { throw new Error("You cannot construct new instances of the Stage.") @@ -210,8 +212,15 @@ package flash.display { public native function get fullScreenHeight():uint; - public native function get fullScreenSourceRect():Rectangle; - public native function set fullScreenSourceRect(value:Rectangle):void; + public function get fullScreenSourceRect():Rectangle { + stub_getter("flash.display.Stage", "fullScreenSourceRect"); + return this._fullScreenSourceRect; + } + + public function set fullScreenSourceRect(rect: Rectangle):void { + stub_setter("flash.display.Stage", "fullScreenSourceRect"); + this._fullScreenSourceRect = rect; + } public native function get fullScreenWidth():uint; @@ -317,5 +326,13 @@ package flash.display { public function setAspectRatio(newAspectRatio:String):void { stub_method("flash.display.Stage", "setAspectRatio"); } + + [API("661")] + public function get nativeWindow():NativeWindow { + if (!this._nativeWindow) { + this._nativeWindow = new NativeWindow(new NativeWindowInitOptions(), this); + } + return this._nativeWindow; + } } } diff --git a/core/src/avm2/globals/flash/display/stage.rs b/core/src/avm2/globals/flash/display/stage.rs index 20f1cc428d3e..dc9a1a334819 100644 --- a/core/src/avm2/globals/flash/display/stage.rs +++ b/core/src/avm2/globals/flash/display/stage.rs @@ -7,11 +7,11 @@ use crate::avm2::parameters::ParametersExt; use crate::avm2::value::Value; use crate::avm2::vector::VectorStorage; use crate::avm2::Error; +use crate::avm2_stub_getter; use crate::display_object::{ StageDisplayState, TDisplayObject, TDisplayObjectContainer, TInteractiveObject, }; use crate::string::{AvmString, WString}; -use crate::{avm2_stub_getter, avm2_stub_setter}; use swf::Color; /// Implements `flash.display.Stage`'s native instance constructor. @@ -443,26 +443,6 @@ pub fn invalidate<'gc>( Ok(Value::Undefined) } -/// Stage.fullScreenSourceRect's getter -pub fn get_full_screen_source_rect<'gc>( - activation: &mut Activation<'_, 'gc>, - _this: Object<'gc>, - _args: &[Value<'gc>], -) -> Result, Error<'gc>> { - avm2_stub_getter!(activation, "flash.display.Stage", "fullScreenSourceRect"); - Ok(Value::Undefined) -} - -/// Stage.fullScreenSourceRect's setter -pub fn set_full_screen_source_rect<'gc>( - activation: &mut Activation<'_, 'gc>, - _this: Object<'gc>, - _args: &[Value<'gc>], -) -> Result, Error<'gc>> { - avm2_stub_setter!(activation, "flash.display.Stage", "fullScreenSourceRect"); - Ok(Value::Undefined) -} - /// Stage.fullScreenHeight's getter pub fn get_full_screen_height<'gc>( activation: &mut Activation<'_, 'gc>, diff --git a/core/src/avm2/globals/flash/events/Event.as b/core/src/avm2/globals/flash/events/Event.as index f5a814dc5bba..8625c7a2231d 100644 --- a/core/src/avm2/globals/flash/events/Event.as +++ b/core/src/avm2/globals/flash/events/Event.as @@ -17,6 +17,9 @@ package flash.events { public static const CLOSE:String = "close"; + [API("661")] + public static const CLOSING:String = "closing"; + public static const COMPLETE:String = "complete"; public static const CONNECT:String = "connect"; @@ -31,6 +34,9 @@ package flash.events { public static const FRAME_CONSTRUCTED:String = "frameConstructed"; + [API("661")] + public static const EXITING:String = "exiting"; + public static const EXIT_FRAME:String = "exitFrame"; public static const FRAME_LABEL:String = "frameLabel"; diff --git a/core/src/avm2/globals/flash/events/InvokeEvent.as b/core/src/avm2/globals/flash/events/InvokeEvent.as new file mode 100644 index 000000000000..b82a616b70b7 --- /dev/null +++ b/core/src/avm2/globals/flash/events/InvokeEvent.as @@ -0,0 +1,55 @@ +// The initial version of this file was autogenerated from the official AS3 reference at +// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/InvokeEvent.html +// by https://github.com/golfinq/ActionScript_Event_Builder +// It won't be regenerated in the future, so feel free to edit and/or fix + +package flash.events +{ + + import flash.filesystem.File; + + [API("661")] + public class InvokeEvent extends Event + { + public static const INVOKE:String = "invoke"; + + // The array of string arguments passed during this invocation. + private var _arguments:Array; + + // The reason for this InvokeEvent. + private var _reason:String; + + // The directory that should be used to resolve any relative paths in the arguments array. + private var _currentDirectory:File; + + public function InvokeEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, dir:File = null, argv:Array = null, reason:String = "standard") + { + super(type, bubbles, cancelable); + this._currentDirectory = dir; + this._arguments = argv; + this._reason = reason; + } + + // [override] Creates a new copy of this event. + override public function clone():Event + { + return new InvokeEvent(this.type, this.bubbles, this.cancelable, this.arguments, this.reason); + } + + public function get arguments():Array + { + return this._arguments; + } + + [API("664")] + public function get reason():String + { + return this._reason; + } + + public function get currentDirectory():File + { + return this._currentDirectory; + } + } +} diff --git a/core/src/avm2/globals/flash/events/NativeWindowBoundsEvent.as b/core/src/avm2/globals/flash/events/NativeWindowBoundsEvent.as new file mode 100644 index 000000000000..746e077b1615 --- /dev/null +++ b/core/src/avm2/globals/flash/events/NativeWindowBoundsEvent.as @@ -0,0 +1,52 @@ +// The initial version of this file was autogenerated from the official AS3 reference at +// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/NativeWindowBoundsEvent.html +// by https://github.com/golfinq/ActionScript_Event_Builder +// It won't be regenerated in the future, so feel free to edit and/or fix + +package flash.events +{ + + import flash.geom.Rectangle; + + [API("661")] + public class NativeWindowBoundsEvent extends Event + { + public static const RESIZE:String = "resize"; + + // The bounds of the window before the change. + private var _beforeBounds:Rectangle; + + // The bounds of the window after the change. + private var _afterBounds:Rectangle; + + public function NativeWindowBoundsEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, beforeBounds:Rectangle = null, afterBounds:Rectangle = null) + { + super(type, bubbles, cancelable); + this._beforeBounds = beforeBounds; + this._afterBounds = afterBounds; + } + + // [override] Creates a copy of the NativeWindowBoundsEvent object and sets the value of each property to match that of the original. + override public function clone():Event + { + return new NativeWindowBoundsEvent(this.type, this.bubbles, this.cancelable, this.beforeBounds, this.afterBounds); + } + + // [override] Returns a string that contains all the properties of the NativeWindowBoundsEvent object. + override public function toString():String + { + return this.formatToString("NativeWindowBoundsEvent", "type", "bubbles", "cancelable"); + } + + public function get beforeBounds():Rectangle + { + return this._beforeBounds; + } + + public function get afterBounds():Rectangle + { + return this._afterBounds; + } + + } +} diff --git a/core/src/avm2/globals/flash/events/NativeWindowDisplayStateEvent.as b/core/src/avm2/globals/flash/events/NativeWindowDisplayStateEvent.as new file mode 100644 index 000000000000..b13882db55cc --- /dev/null +++ b/core/src/avm2/globals/flash/events/NativeWindowDisplayStateEvent.as @@ -0,0 +1,49 @@ +// The initial version of this file was autogenerated from the official AS3 reference at +// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/NativeWindowDisplayStateEvent.html +// by https://github.com/golfinq/ActionScript_Event_Builder +// It won't be regenerated in the future, so feel free to edit and/or fix + +package flash.events +{ + [API("661")] + public class NativeWindowDisplayStateEvent extends Event + { + public static const DISPLAY_STATE_CHANGE:String = "displayStateChange"; + + // The display state of the NativeWindow before the change. + private var _beforeDisplayState:String; + + // The display state of the NativeWindow after the change. + private var _afterDisplayState:String; + + public function NativeWindowDisplayStateEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false, beforeDisplayState:String = "", afterDisplayState:String = "") + { + super(type, bubbles, cancelable); + this._beforeDisplayState = beforeDisplayState; + this._afterDisplayState = afterDisplayState; + } + + // [override] Creates a copy of the NativeWindowDisplayStateEvent object and sets the value of each property to match that of the original. + override public function clone():Event + { + return new NativeWindowDisplayStateEvent(this.type, this.bubbles, this.cancelable, this.beforeDisplayState, this.afterDisplayState); + } + + // [override] Returns a string that contains all the properties of the NativeWindowDisplayStateEvent object. + override public function toString():String + { + return this.formatToString("NativeWindowDisplayStateEvent", "type", "bubbles", "cancelable", "beforeDisplayState", "afterDisplayState"); + } + + public function get beforeDisplayState():String + { + return this._beforeDisplayState; + } + + public function get afterDisplayState():String + { + return this._afterDisplayState; + } + + } +} diff --git a/core/src/avm2/globals/globals.as b/core/src/avm2/globals/globals.as index 281ee0db731b..3933435d8e08 100644 --- a/core/src/avm2/globals/globals.as +++ b/core/src/avm2/globals/globals.as @@ -58,6 +58,10 @@ include "flash/desktop/IFilePromise.as" include "flash/desktop/NativeProcess.as" include "flash/desktop/NativeProcessStartupInfo.as" +include "flash/desktop/Icon.as" +include "flash/desktop/InteractiveIcon.as" +include "flash/desktop/NativeApplication.as" + include "flash/display/IBitmapDrawable.as" include "flash/display/DisplayObject.as" include "flash/display/Bitmap.as" @@ -101,6 +105,11 @@ include "flash/display/LineScaleMode.as" include "flash/display/MorphShape.as" include "flash/display/NativeMenu.as" include "flash/display/NativeMenuItem.as" +include "flash/display/NativeWindowDisplayState.as" +include "flash/display/NativeWindowSystemChrome.as" +include "flash/display/NativeWindowType.as" +include "flash/display/NativeWindowInitOptions.as" +include "flash/display/NativeWindow.as" include "flash/display/PixelSnapping.as" include "flash/display/PNGEncoderOptions.as" include "flash/display/Scene.as" @@ -186,7 +195,10 @@ include "flash/events/GameInputEvent.as" include "flash/events/GesturePhase.as" include "flash/events/HTTPStatusEvent.as" include "flash/events/IOErrorEvent.as" +include "flash/events/InvokeEvent.as" include "flash/events/KeyboardEvent.as" +include "flash/events/NativeWindowBoundsEvent.as" +include "flash/events/NativeWindowDisplayStateEvent.as" include "flash/events/NetDataEvent.as" include "flash/events/NetFilterEvent.as" include "flash/events/NetStatusEvent.as" diff --git a/desktop/src/app.rs b/desktop/src/app.rs index 4d7521fc35a6..2cb5611dc444 100644 --- a/desktop/src/app.rs +++ b/desktop/src/app.rs @@ -206,7 +206,7 @@ impl App { let viewport_scale_factor = self.window.scale_factor(); player.set_viewport_dimensions(ViewportDimensions { width: size.width, - height: size.height - height_offset as u32, + height: size.height.saturating_sub(height_offset as u32), scale_factor: viewport_scale_factor, }); }