Off-topic I know, but this also irritates the hell out of me (It happens on numerous SDL apps).Pype.Clicker wrote: - hangman stalled qemu and now i have a non-moving mouse cursor on my X server >_<
Code: Select all
/*
* This program will unlock your pointer if it won't move anymore. This
* usually happens when a program crashes while the mouse was grabbed.
*
* Link with SDL. (http://www.libsdl.org/)
*
* gcc -o umouse umouse.c `sdl-config --cflags` `sdl-config --libs`
*
* written by Ryan C. Gordon ([email protected])
*/
#include <stdio.h>
#include <stdlib.h>
#include "SDL.h"
void adjust_gamma(int argc, char **argv)
{
int i;
double gamma;
for (i = 0; i < argc - 1; i++)
{
if (strcasecmp(argv[i], "--gamma") == 0)
{
gamma = atof(argv[i + 1]);
if (gamma == 0.0)
fprintf(stderr, "Cowardly refusing to set gamma to 0.0...\n");
else
{
if (SDL_SetGamma(gamma, gamma, gamma) == -1)
fprintf(stderr, "SDL_SetGamma() failed.\n");
} // else
} // if
} // for
} // adjust_gamma
int main(int argc, char **argv)
{
SDL_Event event;
SDL_Init(SDL_INIT_VIDEO);
SDL_SetVideoMode(640, 480, 16, 0);
SDL_ShowCursor(0);
SDL_WM_GrabInput(SDL_GRAB_ON);
adjust_gamma(argc, argv);
SDL_PumpEvents();
SDL_WM_GrabInput(SDL_GRAB_OFF);
SDL_ShowCursor(1);
SDL_Quit();
return(0);
} // main
// end of umouse.c ...