-   Programming (
-   -   SDL and mouse (

myrmidon 11-08-2005 03:31 PM

SDL and mouse
HI everyone, i have 1 question about SDL and mouse:

i created a simple sdl program (which displays some images from jpg files) , it works without any problem in X, in console without X it works still without problems BUT only when i'm running it like ROOT. When i try to run it with simple user, i cet the error : SDL unable to initialize the mouse.

NOw i dont need mouse support in it, can i disable mouse somehow ?

here is the part of code:

SDL_Surface *init_video()

SDL_Surface *screen;

/* Initialize SDL's video system and check for errors */
if (SDL_Init(SDL_INIT_VIDEO) != 0)
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return NULL;

/* Make sure SDL_Quit gets called when the program exits! */

/* Attempt to set a 640x480 hicolor video mode */
screen = SDL_SetVideoMode(640,480, 16, SDL_FULLSCREEN);
if (screen == NULL)
printf("Unable to set video mode: %s\n", SDL_GetError());
return NULL;

return screen;


mic 11-10-2005 01:51 AM

Set this environment variable:

export SDL_NOMOUSE=1
I too had hard time figuring that out :)

myrmidon 11-11-2005 10:33 AM

ok thx mate it woked.

All times are GMT -5. The time now is 08:56 PM.