Skip to content
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

Window focus signals #241

Closed
wants to merge 2 commits into from
Closed

Window focus signals #241

wants to merge 2 commits into from

Conversation

lpogic
Copy link

@lpogic lpogic commented May 19, 2024

The window focus state change signals added. It is imitating the Widget API (onFocus/onUnfocus).

There was also a problem with gui refreshing when it was changed in onUnfocus callback. Marking the event as processed resolved the issue.

@texus
Copy link
Owner

texus commented May 20, 2024

I'm not sure how I feel about this PR. My idea has always been that you should get window events from the window, the mainLoop() function was only added to reduce the size of example code. Over time it just got more complex because people actually started relying on it working properly for more complex cases.

I don't feel like handleEvent needs to return true for focus events, because the original idea was that true is returned for things that are handled by TGUI widgets and could be ignored by the user.

So I'm going to close this PR and make a commit that implements this slightly differently. I'll add an onWindowFocus and onWindowUnfocus signal, so that you can continue to use mainLoop() even if you need an unfocus signal. And I'll fix the gui refreshing in the mainLoop function similar to how MouseLeft is handled.

@texus texus closed this in a4fb753 May 20, 2024
@lpogic
Copy link
Author

lpogic commented May 20, 2024

What prompted me to prepare this PR was the need to handle window focus/unfocus in callback (I use TGUI through bindings in my project). I wasn't sure if BackendGui was the right place for these signals, but I couldn't think of anything better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants