-
-
Notifications
You must be signed in to change notification settings - Fork 813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avm2: stub desktop AIR APIs #17299
avm2: stub desktop AIR APIs #17299
Conversation
Can you remove the AIR argv handling from this PR? I think we shouldn't combine it. |
I put air argv handling in the same PR because it's needed by NativeApplication. |
80f8fda
to
69a75a5
Compare
This PR is huge and does a lot of different stuff in one commit. @Mesteery if you split it up it will be easier and quicker to review. |
Thanks you for your review. I've normally addressed all the changes |
Thank you! 🥳 I'll take another look, and still have two files left to read through - but gotta sleep first. 😌😴 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is all from me. Thank you for dealing with all my nitpicking!
I'll squash-merge later today unless anyone else objects, or finds something else.
setTimeout(function():void | ||
{ | ||
dispatchEvent(new InvokeEvent(InvokeEvent.INVOKE, false, false, null, [])); | ||
}, 500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming this is fake behavior - can you add some comment here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with #17609, []
will be replaced by the real arguments passed to the application, but it stay fake behaviour I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry for not specifying - I mostly mean the 500ms delay. If you have an intuition of when this should actually trigger in application lifecycle, can you add it as a comment? If not, that's okay, just a // TODO
will be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know when INVOKE is triggered in AIR so I put a delay in case, so there are no issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InvokeEvent objects are dispatched by the NativeApplication object (NativeApplication.nativeApplication). To receive invoke events, call the addEventListener() method of the NativeApplication object. When an event listener registers for an invoke event, it will also receive all invoke events that occurred before the registration.
And in airglobal I can see an override public function addEventListener
for NativeApplication.
import __ruffle__.stub_getter; | ||
// According to the documentation, it should be [API("661")] | ||
// but airglobal.swc disagrees with that: | ||
[API("667")] | ||
public class NativeMenuItem extends EventDispatcher { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in FP, ContextMenu(Item) derives from NativeMenu(Item). Do we not want to do it here, or would it just complicate the current code too much?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a confuse.
We already have class ContextMenuItem extends NativeMenuItem
and class ContextMenu extends NativeMenu
. Do you mean that this version gate could cause problems for there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you're right!
The APIs between these two are super confusing tbh; I thought they'd overlap at least a little bit (as in, ContextMenuItem use some fields from the NativeMenuItem because why else use inheritance), but... no? ContextMenuItem has caption
, while NativeMenuItem has a label
etc? Super weird :P I wonder why there's inheritance at all then.
Anyway, if there's no expected conflict between fields/methods of these two pairs at all, then this can be closed :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. :D
Could you please confirm that NativeMenu[Item]
getting version-gated away won't mess with ContextMenu[Item]
being usable from non-AIR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't, playerglobal gets the highest versions
|
||
[API("661")] | ||
public function get nativeWindow():NativeWindow { | ||
if (!this._nativeWindow) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably do a stub warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
{ | ||
private static var _instance:NativeApplication; | ||
|
||
public var _openedWindows:Array = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way we could make sure that this isn't public
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the access of it go through the getter. I assume it returns a reference to this array.
2614031
to
7505da9
Compare
Thank you for addressing all the review notes! |
No description provided.