fix for older SDL versions

pull/1/head
dscho 19 years ago
parent 4301cdf1df
commit a20d0817ef

@ -3,7 +3,11 @@
static rfbBool resize(rfbClient* client) { static rfbBool resize(rfbClient* client) {
static char first=TRUE; static char first=TRUE;
#ifdef SDL_ASYNCBLIT
int flags=SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL; int flags=SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
#else
int flags=SDL_HWSURFACE|SDL_HWACCEL;
#endif
int width=client->width,height=client->height, int width=client->width,height=client->height,
depth=client->format.bitsPerPixel; depth=client->format.bitsPerPixel;
rfbBool okay=SDL_VideoModeOK(width,height,depth,flags); rfbBool okay=SDL_VideoModeOK(width,height,depth,flags);
@ -250,17 +254,19 @@ int main(int argc,char** argv) {
while(1) { while(1) {
if(SDL_PollEvent(&e)) if(SDL_PollEvent(&e))
switch(e.type) { switch(e.type) {
#if SDL_MAJOR_VERSION>1 || SDL_MINOR_VERSION>=2
case SDL_VIDEOEXPOSE: case SDL_VIDEOEXPOSE:
SendFramebufferUpdateRequest(cl,0,0,cl->width,cl->height,FALSE); SendFramebufferUpdateRequest(cl,0,0,cl->width,cl->height,FALSE);
break; break;
#endif
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEMOTION: { case SDL_MOUSEMOTION: {
int x,y; int x,y;
int state=SDL_GetMouseState(&x,&y); int state=SDL_GetMouseState(&x,&y);
struct { int sdl; int rfb; } buttonMapping[]={ struct { int sdl; int rfb; } buttonMapping[]={
{SDL_BUTTON_LEFT, rfbButton1Mask}, {1, rfbButton1Mask},
{SDL_BUTTON_RIGHT, rfbButton2Mask}, {3, rfbButton2Mask},
{SDL_BUTTON_MIDDLE, rfbButton3Mask}, {2, rfbButton3Mask},
{0,0} {0,0}
}; };
int i; int i;

Loading…
Cancel
Save