X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsdl.c;h=4c484243934102774e2670d626f967495d87ef53;hb=59ee473b86e7cbc1d9b09a3c22b0bbd3a410f16f;hp=ab3ac82d20e80fa80ebb2f1ea29ad41f790a2da0;hpb=852a8eef1e8858a40da0be4093eba3deaf468f51;p=rocksndiamonds.git diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index ab3ac82d..4c484243 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -140,6 +140,13 @@ void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window, fullscreen_xoffset = (fullscreen_width - video.width) / 2; fullscreen_yoffset = (fullscreen_height - video.height) / 2; +#if 1 + checked_free(video.fullscreen_modes); + + video.fullscreen_modes = NULL; + video.fullscreen_mode_current = NULL; +#endif + /* get available hardware supported fullscreen modes */ modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE); @@ -228,7 +235,11 @@ void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window, should never be drawn to directly, it would do no harm nevertheless. */ /* create additional (symbolic) buffer for double-buffering */ +#if 1 + ReCreateBitmap(window, video.width, video.height, video.depth); +#else *window = CreateBitmap(video.width, video.height, video.depth); +#endif } boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen) @@ -241,6 +252,10 @@ boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen) if (*backbuffer == NULL) *backbuffer = CreateBitmapStruct(); + /* (real bitmap might be larger in fullscreen mode with video offsets) */ + (*backbuffer)->width = video.width; + (*backbuffer)->height = video.height; + if (fullscreen && !video.fullscreen_enabled && video.fullscreen_available) { setFullscreenParameters(setup.fullscreen_mode); @@ -292,10 +307,30 @@ boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen) (*backbuffer)->surface = new_surface; video.fullscreen_enabled = FALSE; + success = TRUE; } } +#if 1 + SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); + +#if defined(PLATFORM_WIN32) + { + SDL_SysWMinfo wminfo; + HWND hwnd; + + SDL_VERSION(&wminfo.version); + SDL_GetWMInfo(&wminfo); + + hwnd = wminfo.window; + + DragAcceptFiles(hwnd, TRUE); + } +#endif +#endif + + return success; } @@ -403,6 +438,17 @@ void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, int dst_x = x, dst_y = y; unsigned int time_last, time_current; + /* check if screen size has changed */ + if (surface_source != NULL && (video.width != surface_source->w || + video.height != surface_source->h)) + { + SDL_FreeSurface(surface_source); + SDL_FreeSurface(surface_target); + SDL_FreeSurface(surface_black); + + initialization_needed = TRUE; + } + src_rect.x = src_x; src_rect.y = src_y; src_rect.w = width; @@ -1787,6 +1833,36 @@ void SDLNextEvent(Event *event) } } +void SDLHandleWindowManagerEvent(Event *event) +{ +#if defined(PLATFORM_WIN32) + SDL_SysWMEvent *syswmevent = (SDL_SysWMEvent *)event; + SDL_SysWMmsg *syswmmsg = (SDL_SysWMmsg *)(syswmevent->msg); + + if (syswmmsg->msg == WM_DROPFILES) + { + HDROP hdrop = (HDROP)syswmmsg->wParam; + int i, num_files; + + printf("::: SDL_SYSWMEVENT:\n"); + + num_files = DragQueryFile(hdrop, 0xffffffff, NULL, 0); + + for (i = 0; i < num_files; i++) + { + int buffer_len = DragQueryFile(hdrop, i, NULL, 0); + char buffer[buffer_len + 1]; + + DragQueryFile(hdrop, i, buffer, buffer_len + 1); + + printf("::: - '%s'\n", buffer); + } + + DragFinish((HDROP)syswmmsg->wParam); + } +#endif +} + /* ========================================================================= */ /* joystick functions */