SDL2 Create a window without focus

I need to display a tooltip above the window. I create a second tooltip window and use SDL_RaiseWindow () to bring it to the top. However, this does a tooltip to steal focus, which is not what I want. Is there a way to make the window on top without changing focus?

Also, is there a way to set focus (mouse and / or keyboard) without changing the Z order of windows?

+3


source to share


2 answers


Old question, but this happened during my own search. You can try SDL_RaiseWindow()

to bring your tooltip up to the top, then use SDL_SetWindowInputFocus()

in the main window to switch focus to it.



0


source


The answer as suggested by Neil will only work under X11 as it SDL_SetWindowInputFocus()

is only implemented for that environment. Essentially, the desired behavior is not otherwise possible. I saw that there is a function request on the SDL forums for a function overload SDL_RaiseWindow()

to include an optional bool parameter to indicate whether the raised window should also receive input focus or not. I hope they do .



In any case, support for multiple windows under SDL 2.x is a bit weak. There is no built-in support for the Z-order of different windows, and trying to create one based on the "paint method" works, but leaves no control over the input focus.

0


source







All Articles