-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Added SDL_GetWindowFromEvent #10459
Added SDL_GetWindowFromEvent #10459
Conversation
Can you change it to SDL_GetWindowFromEvent()? Also, can we add an Xcode build to CI, or is that crazy talk? :) |
Xcode is built, see the |
Oh, gotcha. |
It still returns a |
It should return |
6605851
to
7b0adfc
Compare
include/SDL3/SDL_events.h
Outdated
@@ -1400,6 +1400,20 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EventEnabled(Uint32 type); | |||
*/ | |||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); | |||
|
|||
/** | |||
* Get the associated window of an event. |
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.
* Get the associated window of an event. | |
* Get window associated with an event. |
include/SDL3/SDL_events.h
Outdated
/** | ||
* Get the associated window of an event. | ||
* | ||
* \param event SDL event of which to get the window. |
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.
* \param event SDL event of which to get the window. | |
* \param event an event containing a `windowID` |
7b0adfc
to
934dd8b
Compare
934dd8b
to
c7dec9d
Compare
src/events/SDL_categories.c
Outdated
case -1; | ||
/* invalid event type (error is set by SDL_GetEventCategory) */ | ||
return NULL; | ||
default: | ||
/* event has no assiciated window (not an error) */ | ||
return NULL; |
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 added these to document the 2 cases.
7d78ce0
to
78fa3b3
Compare
78fa3b3
to
3ea0167
Compare
(Don't forget about the xcode project) |
Add
SDL_GetWindowIDFromEvent
SDL_GetWindowFromEvent
as a convenience function to get the windowidfrom a SDL_event.To fix the imgui event handling without modifying imgui's code, you can do:
@slouken
The xcode project needs an update: I added the new code to
src/events/SDL_categories.c
andsrc/events/SDL_categories_c.h
CI does not build any xcode test projects, so this issue is not caught.
Description
Existing Issue(s)
Fixes #10457