-
Notifications
You must be signed in to change notification settings - Fork 16
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
Using SetWindowLongPtr to subclass current window to handle mouse hover/leave message #39
Conversation
I'll test this soon. |
For script callbacks I think we use this https://www.defold.com/ref/dmScript/ We allow user to specify a Lua script for the Native Extension to callback to. Can see an example here with gyro.start https://github.com/britzl/gyrobomber/blob/ae537116cdbbb1f8c30b08cdb8f9576c97e8ab41/main/main.script https://github.com/britzl/gyrobomber/blob/master/gyro/src/gyro.cpp https://github.com/britzl/gyrobomber/blob/master/gyro/src/gyro_ios.mm |
Good job! I will test again within a day. |
Why expose I added |
@dapetcu21 I added you as a contributor, feel free to improve this. |
@dapetcu21 i think not all the people need this, and it may be a good idea to ask developer to determine if they need to subclass a window, or we can add a parameter to enable this on InitializeDefos? Also my original idea is to make it a more general method that can customize other events, such as defos_events("eventname", callback), but i have no much time on this now.. |
@subsoap Thanks! What are the policies for merging code to master / reviewing PRs? @chaosddp Is there any forseeable problem if we subclass the window anyway when the user doesn't use any of the functionality that needs subclassing? If not, then there's no benefit to not subclassing, hence no reason to expose this option (and the additional complexity it brings) to the user. I think the API should isolate the user from platform specificities as much as we can and and adding a Windows-specific "window subclassing" concept is breaking that abstraction. EDIT: Maybe we can subclass on-demand when the event callback is bound |
@dapetcu21 no problem if we code carefully, and i agree with you to subclass on-demand, it seems a better way. |
I have a bit of time today, I'll try playing a bit with this and maybe if I have time left, I'll also port this to macOS |
@dapetcu21 You can merge when you want to if you trust the changes. If you want a second opinion ask someone to review. Soon we will do versioned releases once Linux support is added that will be a better barrier to users being exposed to mistakes or breaking changes. |
@dapetcu21 it says you're still waiting to respond and have not accepted collaborator access yet. I've resent invite. |
Oh. Didn't notice! Thanks. I'll take a look at the macOS side of things tomorrow night and it should be mergeable then. |
@subsoap this is the way to use SetWindowLongPtr to subclass a window to handle mouse event, please have a try, when the mouse leave/enter the window, the title will be changed.
And i think it is much better to make it possible to invoke a lua callback when the mouse leave/hover. But i do not know how, i will have a try tonight.