ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/SDL/video_sdl.cpp
(Generate patch)

Comparing BasiliskII/src/SDL/video_sdl.cpp (file contents):
Revision 1.26 by gbeauche, 2006-05-13T16:58:44Z vs.
Revision 1.30 by asvitkine, 2007-01-21T19:33:13Z

# Line 27 | Line 27
27   *      Ctrl-F5 = grab mouse (in windowed mode)
28   *
29   *  FIXMEs and TODOs:
30 + *  - Windows requires an extra mouse event to update the actual cursor image?
31   *  - Ctr-Tab for suspend/resume but how? SDL does not support that for non-Linux
32   *  - Ctrl-Fn doesn't generate SDL_KEYDOWN events (SDL bug?)
33   *  - Mouse acceleration, there is no API in SDL yet for that
34   *  - Force relative mode in Grab mode even if SDL provides absolute coordinates?
34 *  - Fullscreen mode
35   *  - Gamma tables support is likely to be broken here
36   *  - Events processing is bound to the general emulation thread as SDL requires
37   *    to PumpEvents() within the same thread as the one that called SetVideoMode().
38   *    Besides, there can't seem to be a way to call SetVideoMode() from a child thread.
39 *  - Refresh performance is still slow. Use SDL_CreateRGBSurface()?
39   *  - Backport hw cursor acceleration to Basilisk II?
40   *  - Factor out code
41   */
# Line 49 | Line 48
48   #include <errno.h>
49   #include <vector>
50  
51 + #ifdef WIN32
52 + #include <malloc.h> /* alloca() */
53 + #endif
54 +
55   #include "cpu_emulation.h"
56   #include "main.h"
57   #include "adb.h"
# Line 716 | Line 719 | void driver_base::restore_mouse_accel(vo
719   *  Windowed display driver
720   */
721  
722 + static int SDL_display_opened = FALSE;
723 +
724   // Open display
725   driver_window::driver_window(SDL_monitor_desc &m)
726          : driver_base(m), mouse_grabbed(false)
# Line 727 | Line 732 | driver_window::driver_window(SDL_monitor
732          // Set absolute mouse mode
733          ADBSetRelMouseMode(mouse_grabbed);
734  
735 +        // This is ugly:
736 +        // If we're switching resolutions (ie, not setting it for the first time),
737 +        // there's a bug in SDL where the SDL_Surface created will not be properly
738 +        // setup. The solution is to SDL_Quit() before calling SDL_SetVideoMode for
739 +        // the second time (SDL_SetVideoMode will call SDL_Init() and all will be
740 +        // well). Without this, the video becomes corrupted (at least on Mac OS X),
741 +        // after the resolution switch (for the second and subsequent times).
742 +        if (SDL_display_opened)
743 +                SDL_Quit();
744 +
745          // Create surface
746          int depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH);
747          if ((s = SDL_SetVideoMode(width, height, depth, SDL_HWSURFACE)) == NULL)
748                  return;
749  
750 +        SDL_display_opened = TRUE;
751 +
752   #ifdef ENABLE_VOSF
753          use_vosf = true;
754          // Allocate memory for frame buffer (SIZE is extended to page-boundary)
# Line 2186 | Line 2203 | static inline void do_video_refresh(void
2203                  LOCK_EVENTS;
2204                  SDL_FreeCursor(sdl_cursor);
2205                  sdl_cursor = SDL_CreateCursor(MacCursor + 4, MacCursor + 36, 16, 16, MacCursor[2], MacCursor[3]);
2206 <                if (sdl_cursor)
2206 >                if (sdl_cursor) {
2207                          SDL_SetCursor(sdl_cursor);
2208 + #ifdef WIN32
2209 +                        // XXX Windows apparently needs an extra mouse event to
2210 +                        // make the new cursor image visible
2211 +                        int visible = SDL_ShowCursor(-1);
2212 +                        if (visible) {
2213 +                                int x, y;
2214 +                                SDL_GetMouseState(&x, &y);
2215 +                                SDL_WarpMouse(x, y);
2216 +                        }
2217 + #endif
2218 +                }
2219                  UNLOCK_EVENTS;
2220          }
2221   #endif
# Line 2262 | Line 2290 | void video_set_dirty_area(int x, int y,
2290  
2291   #ifdef ENABLE_VOSF
2292          if (use_vosf) {
2293 <                vosf_set_dirty_area(x, y, w, h, screen_width, bytes_per_row);
2293 >                vosf_set_dirty_area(x, y, w, h, screen_width, screen_height, bytes_per_row);
2294                  return;
2295          }
2296   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines