src/SDL_compat.c
branchSDL-1.3
changeset 1724 6c63fc2bd986
parent 1722 5daa04d862f1
child 1731 875c3cf1a12c
     1.1 --- a/src/SDL_compat.c	Thu Jul 06 05:53:32 2006 +0000
     1.2 +++ b/src/SDL_compat.c	Thu Jul 06 07:17:11 2006 +0000
     1.3 @@ -164,6 +164,12 @@
     1.4      switch (event->type) {
     1.5      case SDL_WINDOWEVENT:
     1.6          switch (event->window.event) {
     1.7 +        case SDL_WINDOWEVENT_EXPOSED:
     1.8 +            if (!SDL_HasEvent(SDL_VIDEOEXPOSEMASK)) {
     1.9 +                fake.type = SDL_VIDEOEXPOSE;
    1.10 +                SDL_PushEvent(&fake);
    1.11 +            }
    1.12 +            break;
    1.13          case SDL_WINDOWEVENT_RESIZED:
    1.14              fake.type = SDL_VIDEORESIZE;
    1.15              fake.resize.w = event->window.data1;
    1.16 @@ -206,6 +212,10 @@
    1.17              fake.active.state = SDL_APPINPUTFOCUS;
    1.18              SDL_PushEvent(&fake);
    1.19              break;
    1.20 +        case SDL_WINDOWEVENT_CLOSE:
    1.21 +            fake.type = SDL_QUIT;
    1.22 +            SDL_PushEvent(&fake);
    1.23 +            break;
    1.24          }
    1.25      case SDL_KEYDOWN:
    1.26      case SDL_KEYUP:
    1.27 @@ -226,6 +236,38 @@
    1.28              }
    1.29              break;
    1.30          }
    1.31 +    case SDL_MOUSEWHEEL:
    1.32 +        {
    1.33 +            Uint8 button;
    1.34 +            int selected;
    1.35 +            int x, y;
    1.36 +
    1.37 +            selected = SDL_SelectMouse(event->wheel.which);
    1.38 +            SDL_GetMouseState(&x, &y);
    1.39 +            SDL_SelectMouse(selected);
    1.40 +
    1.41 +            if (event->wheel.motion > 0) {
    1.42 +                button = SDL_BUTTON_WHEELUP;
    1.43 +            } else {
    1.44 +                button = SDL_BUTTON_WHEELDOWN;
    1.45 +            }
    1.46 +
    1.47 +            fake.button.which = event->wheel.windowID;
    1.48 +            fake.button.button = button;
    1.49 +            fake.button.x = x;
    1.50 +            fake.button.y = y;
    1.51 +            fake.button.windowID = event->wheel.windowID;
    1.52 +
    1.53 +            fake.type = SDL_MOUSEBUTTONDOWN;
    1.54 +            fake.button.state = SDL_PRESSED;
    1.55 +            SDL_PushEvent(&fake);
    1.56 +
    1.57 +            fake.type = SDL_MOUSEBUTTONUP;
    1.58 +            fake.button.state = SDL_RELEASED;
    1.59 +            SDL_PushEvent(&fake);
    1.60 +            break;
    1.61 +        }
    1.62 +
    1.63      }
    1.64      if (orig_eventfilter) {
    1.65          return orig_eventfilter(orig_eventfilterparam, event);
    1.66 @@ -304,7 +346,9 @@
    1.67          window_flags |= SDL_WINDOW_BORDERLESS;
    1.68      }
    1.69      SDL_VideoWindow =
    1.70 -        SDL_CreateWindow(wm_title, 0, 0, width, height, window_flags);
    1.71 +        SDL_CreateWindow(wm_title, SDL_WINDOWPOS_UNDEFINED,
    1.72 +                         SDL_WINDOWPOS_UNDEFINED, width, height,
    1.73 +                         window_flags);
    1.74      if (!SDL_VideoWindow) {
    1.75          return NULL;
    1.76      }