[maemo-developers] [maemo-developers] Workaround to prevent crash when pressing home key in SDL programs (IT2006)?
From: Tapani Pälli tapani.palli at nokia.comDate: Tue Jun 20 11:34:39 EEST 2006
- Previous message: [maemo-developers] Workaround to prevent crash when pressing home key in SDL programs (IT2006)?
- Next message: [maemo-developers] Workaround to prevent crash when pressing home key in SDL programs (IT2006)?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ext Frantisek Dufka wrote: > Hi, > > tried it yesterday just for fun and it works. > > code looks like this: > > #include <SDL/SDL.h> > #include "SDL_x11video.h" > #undef WMwindow > > extern SDL_VideoDevice *current_video; > > void SDL_X11_SetNetWMWindowType(char *windowtypestring){ > if (current_video && current_video->name && > (strcmp(current_video->name,"x11 > ")==0)){ > struct SDL_PrivateVideoData *x11data=(struct > SDL_PrivateVideoData *)current_video->hidden; > Atom atoms[1] = { None }; > Atom net_wm_window_type; > > net_wm_window_type = XInternAtom (x11data->X11_Display, > "_NET_WM_WINDOW_TYPE", False); > > atoms[0] = XInternAtom (x11data->X11_Display, > windowtypestring, > False); > > XChangeProperty ( x11data->X11_Display, > x11data->WMwindow, > net_wm_window_type, > XA_ATOM, 32, PropModeReplace, > (unsigned char *)atoms, 1); > > } > > } > > and example > > int main(int argc, char *argv[]){ > SDL_Event event; > int done=0; > SDL_Init(SDL_INIT_VIDEO); > SDL_SetVideoMode(720, 480, 0, 0); > SDL_WM_SetCaption(argv[0], NULL); > SDL_X11_SetNetWMWindowType("_NET_WM_WINDOW_TYPE_NORMAL"); > while (!done){ > SDL_PollEvent(&event); > if(event.key.keysym.sym == SDLK_ESCAPE) > done = 1; > SDL_Delay(1); > } > SDL_Quit(); > return(0); > } > > > but you need to have sdl sources (fakeroot apt-get source libsdl1.2) > to get SDL_x11video.h and SDL_sysvideo.h headers and compile it like this > You can access display and window from SDL code without SDL sources ... you have to include <SDL/SDL_syswm.h> and then in code : SDL_SysWMinfo wminfo; SDL_VERSION(&wminfo.version); SDL_GetWMInfo(&wminfo); then just use wminfo in calls to X like : XChangeWindowAttributes(wminfo.info.x11.display, wminfo.info.x11.fswindow ....... > gcc -Os sdltest.c -I /usr/include/SDL -I /usr/X11R6/include -o sdltest > -lSDL > > > Frantisek > _______________________________________________ > maemo-developers mailing list > maemo-developers at maemo.org > https://maemo.org/mailman/listinfo/maemo-developers > // Tapani
- Previous message: [maemo-developers] Workaround to prevent crash when pressing home key in SDL programs (IT2006)?
- Next message: [maemo-developers] Workaround to prevent crash when pressing home key in SDL programs (IT2006)?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]