greetings,
I’ve been pounding away at this and it doesn’t seem I’m getting
to
where I need to be. I’m creating a “dock” application in SDL+OpenGL.
I’m
trying to set the X window type as a “dock” type so the window
manager
treats it like the gnome-panel etc. The app is 90% complete
so
switching to another toolkit isn’t an option. When I set the window
type,
nothing happens. The window remains below and the wm treats it as
normal.
Any help would be appreciated. Here is the code:
I figured out that there is no way to change the sdl window properties (correct me if I’m wrong). Thus I created an X window with the correct properties and then “hacked” sdl into that window via the SDL_WINDOWID. The problem is SDL will no loger get input. I know that SDL can be using inside qt. how does it get its input? any help would be appreciated.
int gfxengine_opengl::createScreen()
{
Window win; /* pointer to the newly created window. */
Display g_display;
int g_screen;
unsigned int display_width, display_height; / height and width of the X display. /
unsigned int width, height; / height and width for the new window. /
unsigned int win_x, win_y; / location of the window’s top-left corner. /
unsigned int win_border_width; / width of window’s border. */
char *display_name = getenv("DISPLAY"); /* address of the X display. */
char variable[64];
g_display = XOpenDisplay(display_name);
if (g_display == NULL)
{
cerr<<"couldn't connect to XServer"<<endl;
return -1;
}
/* get the geometry of the default screen for our display. */
g_screen = DefaultScreen(g_display);
display_width = DisplayWidth(g_display, g_screen);
display_height = DisplayHeight(g_display, g_screen);
/* make the new window occupy 1/9 of the screen's size. */
width = (display_width);
height = screenRect.h;
screenRect.w=width;
/* the window should be placed at the top-left corner of the screen. */
win_x = 0;
win_y = display_height-height;
/* the window's border shall be 2 pixels wide. */
win_border_width = 2;
win = XCreateSimpleWindow(g_display, RootWindow(g_display, g_screen),
win_x, win_y, width, height, win_border_width, BlackPixel(g_display, g_screen), WhitePixel(g_display,g_screen));
Atom dock, win_type;
win_type=XInternAtom(g_display,"_NET_WM_WINDOW_TYPE",False);
dock=XInternAtom(g_display,"_NET_WM_WINDOW_TYPE_DOCK",False);
XChangeProperty(g_display, win, win_type, XA_ATOM, 32, PropModeReplace,
(unsigned char *) &dock,1);
sprintf(variable, "SDL_WINDOWID=0x%lx", win);
putenv(variable);
XMapWindow(g_display, win);
XSync(g_display, False);
cout<<"created initial X window: "<<variable<<endl;
if( SDL_Init( SDL_INIT_EVERYTHING ) < 0 ) { return false; }
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
if( SDL_SetVideoMode( screenRect.w, screenRect.h, 32, SDL_OPENGL |
SDL_NOFRAME | SDL_HWPALETTE | SDL_GL_DOUBLEBUFFER /**/) == NULL )
{
return false;
}
if( init_gl() == false )
{
return false;
}
}