[maemo-developers] [maemo-developers] Workaround to prevent crash when pressing home key in SDL programs (IT2006)?
From: Frantisek Dufka dufkaf at seznam.czDate: Tue Jun 20 10:26:13 EEST 2006
- Previous message: [maemo-developers] Libs and packages
- Next message: [maemo-developers] Workaround to prevent crash when pressing home key in SDL programs (IT2006)?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
gcc -Os sdltest.c -I /usr/include/SDL -I /usr/X11R6/include -o sdltest -lSDL
Frantisek
- Previous message: [maemo-developers] Libs and packages
- Next message: [maemo-developers] Workaround to prevent crash when pressing home key in SDL programs (IT2006)?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
