VirtualBox

Changeset 98246 in vbox for trunk/src/VBox/Frontends/VBoxSDL


Ignore:
Timestamp:
Jan 23, 2023 2:44:08 PM (2 years ago)
Author:
vboxsync
Message:

FE/SDL: bugref:9449. First fixes to build VBoxSDL with SDL2 on linux.

Location:
trunk/src/VBox/Frontends/VBoxSDL
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp

    r98103 r98246  
    773773    else
    774774    {
    775         mSurfVRAM = SDL_CreateRGBSurface(SDL_SWSURFACE, mGuestXRes, mGuestYRes, mBitsPerPixel,
     775        mSurfVRAM = SDL_CreateRGBSurface(SDL_SWSURFACE, mGuestXRes, mGuestYRes, 32,
    776776                                         Rmask, Gmask, Bmask, Amask);
    777777        LogFlow(("VBoxSDL:: using SDL_SWSURFACE\n"));
     
    10891089    RTCritSectEnter(&mUpdateLock);
    10901090    Log(("Updates %d, %d,%d %dx%d\n", mfUpdates, x, y, w, h));
     1091    // printf("Updates %d, %d,%d %dx%d\n", mfUpdates, x, y, w, h);
    10911092    if (!mfUpdates)
    10921093    {
     
    11601161    dstRect.h = RT_MAX(0, h - yCutoffGuest);
    11611162
     1163
     1164    /* hardware surfaces don't need update notifications */
     1165#if defined(VBOX_WITH_SDL2)
     1166    AssertRelease(mScreen->flags & SDL_PREALLOC);
     1167    SDL_Texture *pNewTexture = SDL_CreateTextureFromSurface(mpRenderer, mSurfVRAM);
     1168    /** @todo Do we need to update the dirty rect for the texture for SDL2 here as well? */
     1169    //SDL_RenderClear(mpRenderer);
     1170    SDL_RenderCopy(mpRenderer, pNewTexture, &srcRect, &dstRect);
     1171    SDL_RenderPresent(mpRenderer);
     1172    SDL_DestroyTexture(pNewTexture);
     1173#else
    11621174    /*
    11631175     * Now we just blit
    11641176     */
    11651177    SDL_BlitSurface(mSurfVRAM, &srcRect, mScreen, &dstRect);
    1166     /* hardware surfaces don't need update notifications */
    1167 #if defined(VBOX_WITH_SDL2)
    1168     AssertRelease(mScreen->flags & SDL_PREALLOC);
    1169     /** @todo Do we need to update the dirty rect for the texture for SDL2 here as well? */
    1170     SDL_RenderClear(mpRenderer);
    1171     SDL_RenderCopy(mpRenderer, mpTexture, &dstRect, &dstRect);
    1172     SDL_RenderPresent(mpRenderer);
    1173 #else
    11741178    if ((mScreen->flags & SDL_HWSURFACE) == 0)
    11751179        SDL_UpdateRect(mScreen, dstRect.x, dstRect.y, dstRect.w, dstRect.h);
  • trunk/src/VBox/Frontends/VBoxSDL/Makefile.kmk

    r98188 r98246  
    127127# tstSDL
    128128#
     129ifndef VBOX_WITH_SDL2
    129130PROGRAMS += tstSDL
    130131tstSDL_TEMPLATE = VBoxR3TstExe
     
    140141tstSDL_DEFS.linux = VBOX_OPENGL
    141142endif
     143
    142144
    143145tstSDL_LIBS = \
     
    158160tstSDL_LDFLAGS.darwin = \
    159161        -framework Foundation -framework AppKit
    160 
     162endif
    161163## @todo What was this stuff doing here? The exception config is saying two different things, and why just -O for release builds?
    162164#tstSDL_CXXFLAGS.win = \
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r98103 r98246  
    596596                {
    597597# if defined(VBOXSDL_WITH_X11)
     598#  ifdef VBOX_WITH_SDL2
     599                    pSWEv->COMSETTER(WinId)((LONG64)info.info.x11.window);
     600#  else
    598601                    pSWEv->COMSETTER(WinId)((LONG64)info.info.x11.wmwindow);
     602#  endif
    599603# elif defined(RT_OS_WINDOWS)
    600604#  ifdef VBOX_WITH_SDL2
     
    811815     */
    812816    {
     817#ifndef VBOX_WITH_SDL2
    813818        const SDL_version *pVersion = SDL_Linked_Version();
    814819        if (  SDL_VERSIONNUM(pVersion->major, pVersion->minor, pVersion->patch)
    815820            < SDL_VERSIONNUM(1, 2, 14))
    816821            RTEnvSet("SDL_DISABLE_LOCK_KEYS", "1");
     822#endif
    817823    }
    818824#endif
     
    34103416        case SDLK_RSHIFT:           return 0x36;
    34113417        case SDLK_KP_MULTIPLY:
    3412         case SDLK_PRINT:            return 0x37; /* fixme */
     3418            //case SDLK_PRINT:            return 0x37; /* fixme */
    34133419        case SDLK_LALT:             return 0x38;
    34143420        case SDLK_MODE: /* alt gr*/
     
    34273433        case SDLK_F10:              return 0x44;
    34283434        case SDLK_PAUSE:            return 0x45; /* not right */
    3429         case SDLK_NUMLOCK:          return 0x45;
    3430         case SDLK_SCROLLOCK:        return 0x46;
    3431         case SDLK_KP7:              return 0x47;
     3435            //case SDLK_NUMLOCK:          return 0x45;
     3436            //case SDLK_SCROLLOCK:        return 0x46;
     3437            //case SDLK_KP7:              return 0x47;
    34323438        case SDLK_HOME:             return 0x47 | 0x100;
    3433         case SDLK_KP8:              return 0x48;
     3439            //case SDLK_KP8:              return 0x48;
    34343440        case SDLK_UP:               return 0x48 | 0x100;
    3435         case SDLK_KP9:              return 0x49;
     3441            //case SDLK_KP9:              return 0x49;
    34363442        case SDLK_PAGEUP:           return 0x49 | 0x100;
    34373443        case SDLK_KP_MINUS:         return 0x4a;
    3438         case SDLK_KP4:              return 0x4b;
     3444            //case SDLK_KP4:              return 0x4b;
    34393445        case SDLK_LEFT:             return 0x4b | 0x100;
    3440         case SDLK_KP5:              return 0x4c;
    3441         case SDLK_KP6:              return 0x4d;
     3446            //case SDLK_KP5:              return 0x4c;
     3447            //case SDLK_KP6:              return 0x4d;
    34423448        case SDLK_RIGHT:            return 0x4d | 0x100;
    34433449        case SDLK_KP_PLUS:          return 0x4e;
    3444         case SDLK_KP1:              return 0x4f;
     3450            //case SDLK_KP1:              return 0x4f;
    34453451        case SDLK_END:              return 0x4f | 0x100;
    3446         case SDLK_KP2:              return 0x50;
     3452            //case SDLK_KP2:              return 0x50;
    34473453        case SDLK_DOWN:             return 0x50 | 0x100;
    3448         case SDLK_KP3:              return 0x51;
     3454            //case SDLK_KP3:              return 0x51;
    34493455        case SDLK_PAGEDOWN:         return 0x51 | 0x100;
    3450         case SDLK_KP0:              return 0x52;
     3456            //case SDLK_KP0:              return 0x52;
    34513457        case SDLK_INSERT:           return 0x52 | 0x100;
    34523458        case SDLK_KP_PERIOD:        return 0x53;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette