The window always pops up in the background, but I want it to be in the foreground, at least in front of the terminal, in which the code is executed that opens the window.
I do not need focus on that window, so just raising without focus would be ok. (SDL2 Raising a window without giving it focus).
I've tried all SDL_WindowFlags, but none seems to help. Also SDL_RaiseWindow() did not help.
The window is meant for graphically displaying results of a terminal program. I compiled SDL2 from source 2.0.3 on CentOs 6.4
I compile the below program and start it from a bash terminal in KDE (Focus stealing prevention level: low, Focus Policy: click to focus).
Example code:
#include <SDL.h>
int main(int, char**){
SDL_Init(SDL_INIT_VIDEO);
SDL_Window *win = SDL_CreateWindow("Hello World!", 100, 100, 640, 480,
SDL_WINDOW_SHOWN | SDL_WINDOW_INPUT_GRABBED |
SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS |
SDL_WINDOW_FOREIGN | SDL_WINDOW_OPENGL);
SDL_RaiseWindow(win);
SDL_Delay(4000);
SDL_DestroyWindow(win);
SDL_Quit();
return 0;
}
EDIT: I've tried the same example in Cygwin64 under windows. The window pops-up in front of the terminal in that case. So is this a CentOS/window-manager problem?