trunk/src/osd/sdl/draw13.c
| r242738 | r242739 | |
| 186 | 186 | // Stats |
| 187 | 187 | INT64 m_last_blit_time; |
| 188 | 188 | INT64 m_last_blit_pixels; |
| 189 | |
| 190 | // Original display_mode |
| 191 | SDL_DisplayMode m_original_mode; |
| 189 | 192 | }; |
| 190 | 193 | |
| 191 | 194 | //============================================================ |
| r242738 | r242739 | |
| 576 | 579 | // allocate memory for our structures |
| 577 | 580 | sdl_info *sdl = global_alloc(sdl_info); |
| 578 | 581 | |
| 582 | /* FIXME: On Ubuntu and potentially other Linux OS you should use |
| 583 | * to disable panning. This has to be done before every invocation of mame. |
| 584 | * |
| 585 | * xrandr --output HDMI-0 --panning 0x0+0+0 --fb 0x0 |
| 586 | * |
| 587 | */ |
| 588 | |
| 579 | 589 | osd_printf_verbose("Enter drawsdl2_window_create\n"); |
| 580 | 590 | |
| 581 | 591 | window->dxdata = sdl; |
| r242738 | r242739 | |
| 590 | 600 | if (window->fullscreen() && video_config.switchres) |
| 591 | 601 | { |
| 592 | 602 | SDL_DisplayMode mode; |
| 593 | | SDL_GetCurrentDisplayMode(window->monitor()->handle, &mode); |
| 603 | //SDL_GetCurrentDisplayMode(window->monitor()->handle, &mode); |
| 604 | SDL_GetWindowDisplayMode(window->sdl_window, &mode); |
| 605 | sdl->m_original_mode = mode; |
| 594 | 606 | mode.w = width; |
| 595 | 607 | mode.h = height; |
| 596 | 608 | if (window->refresh) |
| r242738 | r242739 | |
| 615 | 627 | osd_printf_warning("Ignoring depth %d\n", window->depth); |
| 616 | 628 | } |
| 617 | 629 | } |
| 618 | | SDL_SetWindowDisplayMode(window->sdl_window, &mode); // Try to set mode |
| 630 | SDL_SetWindowDisplayMode(window->sdl_window, &mode); // Try to set mode |
| 631 | #ifndef SDLMAME_WIN32 |
| 632 | /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution |
| 633 | * is in place after the mode switch - which will most likely be the case |
| 634 | * This is a hack to work around a deficiency in SDL2 |
| 635 | */ |
| 636 | SDL_WarpMouseInWindow(window->sdl_window, 1, 1); |
| 637 | #endif |
| 619 | 638 | } |
| 620 | 639 | else |
| 621 | 640 | SDL_SetWindowDisplayMode(window->sdl_window, NULL); // Use desktop |
| r242738 | r242739 | |
| 639 | 658 | SDL_RaiseWindow(window->sdl_window); |
| 640 | 659 | SDL_GetWindowSize(window->sdl_window, &window->width, &window->height); |
| 641 | 660 | |
| 642 | | |
| 643 | 661 | sdl->m_blittimer = 3; |
| 644 | 662 | |
| 645 | 663 | SDL_RenderPresent(sdl->m_renderer); |
| r242738 | r242739 | |
| 715 | 733 | SDL_GetWindowSize(window->sdl_window, &window->width, &window->height); |
| 716 | 734 | sdl->m_resize_pending = 0; |
| 717 | 735 | SDL_RenderSetViewport(sdl->m_renderer, NULL); |
| 736 | //sdlvideo_monitor_refresh(window->monitor()); |
| 737 | |
| 718 | 738 | } |
| 719 | 739 | |
| 720 | 740 | //SDL_SelectRenderer(window->sdl_window); |
| r242738 | r242739 | |
| 832 | 852 | |
| 833 | 853 | drawsdl2_destroy_all_textures(window); |
| 834 | 854 | |
| 835 | | SDL_DestroyWindow(window->sdl_window); |
| 855 | if (window->fullscreen() && video_config.switchres) |
| 856 | { |
| 857 | SDL_SetWindowFullscreen(window->sdl_window, 0); // Try to set mode |
| 858 | SDL_SetWindowDisplayMode(window->sdl_window, &sdl->m_original_mode); // Try to set mode |
| 859 | SDL_SetWindowFullscreen(window->sdl_window, SDL_WINDOW_FULLSCREEN); // Try to set mode |
| 860 | } |
| 836 | 861 | |
| 862 | SDL_DestroyWindow(window->sdl_window); |
| 863 | |
| 837 | 864 | global_free(sdl); |
| 838 | 865 | window->dxdata = NULL; |
| 839 | 866 | } |
trunk/src/osd/sdl/input.c
| r242738 | r242739 | |
| 1985 | 1985 | } |
| 1986 | 1986 | else |
| 1987 | 1987 | { |
| 1988 | | if (event.window.data1 != window->width || event.window.data2 != window->height) |
| 1989 | | window->window_resize(event.window.data1, event.window.data2); |
| 1988 | #ifndef SDLMAME_WIN32 |
| 1989 | /* FIXME: SDL2 sends some spurious resize events on Ubuntu |
| 1990 | * while in fullscreen mode. Ignore them for now. |
| 1991 | */ |
| 1992 | if (!window->fullscreen()) |
| 1993 | #endif |
| 1994 | { |
| 1995 | //printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event)); |
| 1996 | if (event.window.data1 != window->width || event.window.data2 != window->height) |
| 1997 | window->window_resize(event.window.data1, event.window.data2); |
| 1998 | } |
| 1990 | 1999 | } |
| 1991 | 2000 | focus_window = window; |
| 1992 | 2001 | break; |
trunk/src/osd/sdl/video.c
| r242738 | r242739 | |
| 155 | 155 | #if (SDLMAME_SDL2) |
| 156 | 156 | SDL_DisplayMode dmode; |
| 157 | 157 | |
| 158 | #if defined(SDLMAME_WIN32) |
| 158 | 159 | SDL_GetDesktopDisplayMode(monitor->handle, &dmode); |
| 160 | #else |
| 161 | SDL_GetCurrentDisplayMode(monitor->handle, &dmode); |
| 162 | #endif |
| 159 | 163 | monitor->monitor_width = dmode.w; |
| 160 | 164 | monitor->monitor_height = dmode.h; |
| 161 | 165 | monitor->center_width = dmode.w; |
| 162 | 166 | monitor->center_height = dmode.h; |
| 167 | |
| 168 | // FIXME: Use SDL_GetDisplayBounds(monitor->handle, &tt) to update monitor_x |
| 169 | // SDL_Rect tt; |
| 163 | 170 | #else |
| 164 | 171 | #if defined(SDLMAME_WIN32) // Win32 version |
| 165 | 172 | MONITORINFOEX info; |
| r242738 | r242739 | |
| 456 | 463 | monitor->monitor_height = dmode.h; |
| 457 | 464 | monitor->center_width = dmode.w; |
| 458 | 465 | monitor->center_height = dmode.h; |
| 466 | // FIXME: this should use SDL_GetDisplayBounds! |
| 459 | 467 | monitor->monitor_x = monx; |
| 460 | 468 | monitor->handle = i; |
| 461 | 469 | // guess the aspect ratio assuming square pixels |