-
Notifications
You must be signed in to change notification settings - Fork 476
Documentation for sdl2::video
#1487
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
Conversation
Provided documentation for most of the `sdl2::video` functions. Mostly did that to resolve some uncertanties in functions purpose (`grab`/`keyboard_grab`/`mouse_grab`, `minimize`). Looked at `SDL_SetWindowData`/`SDL_GetWindowData` ToDo: think that those functions should be removed.
This is indirectly related to #1199 issue which could now be closed ( |
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.
@Cobrand @antonilol Looks good to me but I want a second opinion - please approve only if ok.
@JktuJQ thanks for adding this
@JktuJQ minor feedback: looks like you're adding an extra |
Not a problem for me, will fix that |
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.
Looks good to me
I think now it could be merged with the main branch |
Provided documentation for most of the
sdl2::video
functions.Mostly did that to resolve some uncertanties in functions purposes (
grab
/keyboard_grab
/mouse_grab
,minimize
).Apparently,
grab
only grabs the mouse.SDL documentation:
when input is grabbed, the mouse is confined to the window. This function will also grab the keyboard if SDL_HINT_GRAB_KEYBOARD is set. To grab the keyboard without also grabbing the mouse, use SDL_SetWindowKeyboardGrab().
Since we can't set SDL_HINT_GRAB_KEYBOARD and by default it is set to 0,
grab
operates exactly asmouse_grab
(which makes it kinda pointless).minimize
does not set the minimal size of window's client area (minimum_size
), it minimizes the window to its iconic representation (without docs it would be confusing).Looked at
SDL_SetWindowData
/SDL_GetWindowData
ToDo.Those functions allow to store pointer to an arbitrary data (
userdata
) within the window (similar to hashmap) and to access it through the window.I don't think that it is possible to safely implement using those functions - there is simply no way to tell the exact type of value that is returned by
SDL_GetWindowData
.If needed, I could remove that ToDo in further commit and maybe implement that as an unsafe API.
Two more ToDos in
*_load_library
functions tell to useOsStr::to_cstring()
once it's stable - seems like it would never be stabilizedbecause, for example, Windows uses WTF-8 encoding which is considered a private implementation detail.
Seems like those ToDos might be removed as well.