SDL+OpenGL Dock application

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:

void gfxengine_generic::setDock()
{
SDL_SysWMinfo sdl_info;
sdl_info=getWM();
sdl_info.info.x11.lock_func();
Display *display=sdl_info.info.x11.display;
Window window=sdl_info.info.x11.window;
XUnmapWindow(display,window);
Atom dock, win_type;
win_type=XInternAtom(display,"_NET_WM_WINDOW_TYPE",False);
dock=XInternAtom(display,"_NET_WM_WINDOW_TYPE_DOCK",False);
XChangeProperty(display, window, win_type, XA_ATOM, 32, PropModeReplace,
(unsigned char *) &dock,1);
XMapWindow(display,window);
sdl_info.info.x11.unlock_func();
}

SDL_SysWMinfo gfxengine_generic::getWM()
{
SDL_SysWMinfo sdl_info;

memset (&sdl_info, 0, sizeof (sdl_info));

SDL_VERSION (&sdl_info.version);
if (SDL_GetWMInfo (&sdl_info) <= 0 ||
    sdl_info.subsystem != SDL_SYSWM_X11) {
fprintf (stderr, "This is not X11\n");

memset (&sdl_info, 0, sizeof (sdl_info));
return sdl_info;
}

return sdl_info;

}

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; 
}

}