SDL_WINDOW_INPUT_FOCUS and SDL_WINDOW_MOUSE_FOCUS
Asked Answered
H

1

6

What are the SDL_WindowFlags SDL_WINDOW_INPUT_FOCUS and SDL_WINDOW_MOUSE_FOCUS used for ?

If I am not mistaken SDL_WINDOW_INPUT_GRABBED indicates which window is receiving inputs, if any. But I simply cannot see what the two other flags mean. I checked SDL_video.h to see if I could get more information, but what I read didn't help :

SDL_WINDOW_INPUT_GRABBED = 0x00000100,      /**< window has grabbed input focus */
SDL_WINDOW_INPUT_FOCUS = 0x00000200,        /**< window has input focus */
SDL_WINDOW_MOUSE_FOCUS = 0x00000400,        /**< window has mouse focus */

I don't see the difference between "window has grabbed input focus" and "indow has input focus".
Is INPUT_FOCUS only for keyboard input and MOUSE_FOCUS for mouse input ? In that case, why would INPUT_GRABBED not be a combination of these two ?

Furthermore, is it possible to have a window with mouse focus and another with "input" focus (whatever "input" means here, except "mouse"), or something similar ?

Hemingway answered 23/7, 2014 at 18:54 Comment(0)
H
11

I just realised that SDL_WINDOW_INPUT_GRABBED was not what I thought it was. It is set with SDL_SetWindowGrab and forces the mouse to stay inside the window (so the window has both mouse and keyboard focus).
The INPUT_FOCUS flag indicates whether the window is active or not (has keyboard input, and probably other controller inputs too).
The MOUSE_FOCUS flag indicates whether the mouse is hovering over the window, even if the window is not active.

Hemingway answered 24/7, 2014 at 9:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.