VirtualBox

Changeset 98305 in vbox for trunk/src


Ignore:
Timestamp:
Jan 25, 2023 4:48:39 PM (2 years ago)
Author:
vboxsync
Message:

FE/SDL. bugref:9449. Removing VBOX_WITH_SDL2 define.

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

Legend:

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

    r98304 r98305  
    114114    mScreenId       = uScreenId;
    115115    mfUpdateImage   = fUpdateImage;
    116 #ifdef VBOX_WITH_SDL2
    117116    mpWindow        = NULL;
    118117    mpTexture       = NULL;
    119118    mpRenderer      = NULL;
    120 #endif
    121119    mSurfVRAM       = NULL;
    122120    mfInitialized   = false;
     
    150148#endif
    151149
    152 #ifdef VBOX_WITH_SDL2
    153150    rc = SDL_GetRendererInfo(mpRenderer, &mRenderInfo);
    154151    if (RT_SUCCESS(rc))
     
    163160                     RTEnvGet("SDL_VIDEODRIVER"));
    164161    }
    165 #endif
    166162
    167163    return rc;
     
    208204    gfSdlInitialized = true;
    209205
    210 #ifdef VBOX_WITH_SDL2
    211206    RT_NOREF(fShowSDLConfig);
    212 #endif /* !VBOX_WITH_SDL2 */
    213 
    214207    return true;
    215208}
     
    718711    LogFlow(("VBoxSDL:resizeSDL\n"));
    719712
    720 #ifdef VBOX_WITH_SDL2
    721713    const int cDisplays = SDL_GetNumVideoDisplays();
    722714    if (cDisplays > 0)
     
    751743    else
    752744        AssertFailed(); /** @todo */
    753 #endif /* VBOX_WITH_SDL2 */
    754745
    755746    uint32_t newWidth;
     
    775766    mTopOffset = 0;
    776767
    777 #ifdef VBOX_WITH_SDL2
    778768    int sdlWindowFlags = SDL_WINDOW_SHOWN;
    779769    if (mfResizable)
     
    834824            AssertReleaseFailed();
    835825    }
    836 #endif /* VBOX_WITH_SDL2 */
    837826}
    838827
     
    906895    dstRect.h = RT_MAX(0, h - yCutoffGuest);
    907896
    908 
    909     /* hardware surfaces don't need update notifications */
    910 #if defined(VBOX_WITH_SDL2)
    911897    SDL_Texture *pNewTexture = SDL_CreateTextureFromSurface(mpRenderer, mSurfVRAM);
    912898    /** @todo Do we need to update the dirty rect for the texture for SDL2 here as well? */
     
    917903    SDL_RenderPresent(mpRenderer);
    918904    SDL_DestroyTexture(pNewTexture);
    919 #endif
    920905    RTCritSectLeave(&mUpdateLock);
    921906}
     
    958943void VBoxSDLFB::getFullscreenGeometry(uint32_t *width, uint32_t *height)
    959944{
    960 #ifdef VBOX_WITH_SDL2
    961945    SDL_DisplayMode dm;
    962946    int rc = SDL_GetDesktopDisplayMode(0, &dm); /** @BUGBUG Handle multi monitor setups! */
     
    966950        *height = dm.w;
    967951    }
    968 #endif
    969 }
    970 
    971 #ifdef VBOX_WITH_SDL2
     952}
     953
    972954int VBoxSDLFB::setWindowTitle(const char *pcszTitle)
    973955{
     
    976958    return VINF_SUCCESS;
    977959}
    978 #endif
  • trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.h

    r98302 r98305  
    113113    int32_t getXOffset() { return mCenterXOffset; }
    114114    int32_t getYOffset() { return mCenterYOffset; }
    115 #ifdef VBOX_WITH_SDL2
    116115    SDL_Window *getWindow() { return mpWindow; }
    117116    bool hasWindow(uint32_t id) { return SDL_GetWindowID(mpWindow) == id; }
    118117    int setWindowTitle(const char *pcszTitle);
    119 #endif
    120118    void setWinId(int64_t winId) { mWinId = winId; }
    121119    void setOrigin(int32_t axOrigin, int32_t ayOrigin) { mOriginX = axOrigin; mOriginY = ayOrigin; }
     
    124122private:
    125123
    126 #ifdef VBOX_WITH_SDL2
    127124    /** the SDL window */
    128125    SDL_Window *mpWindow;
     
    133130    /** render info */
    134131    SDL_RendererInfo mRenderInfo;
    135 #endif
    136132    /** false if constructor failed */
    137133    bool mfInitialized;
  • trunk/src/VBox/Frontends/VBoxSDL/Makefile.kmk

    r98302 r98305  
    6363
    6464VBoxSDL_DEFS       =
    65 ifdef VBOX_WITH_SDL2
    66  VBoxSDL_DEFS     += VBOX_WITH_SDL2
    67 endif
    6865VBoxSDL_DEFS.freebsd = VBOXSDL_WITH_X11
    6966VBoxSDL_DEFS.linux = _GNU_SOURCE VBOXSDL_WITH_X11
     
    122119# tstSDL
    123120#
    124 ifndef VBOX_WITH_SDL2
     121if 0
    125122PROGRAMS += tstSDL
    126123tstSDL_TEMPLATE = VBoxR3TstExe
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r98304 r98305  
    176176static int     WaitSDLEvent(SDL_Event *event);
    177177static void    SetFullscreen(bool enable);
    178 
    179 #ifdef VBOX_WITH_SDL2
    180178static VBoxSDLFB *getFbFromWinId(Uint32 id);
    181 #endif
    182 
    183179
    184180/*********************************************************************************************************************************
     
    226222static Bstr gaFramebufferId[64];
    227223static SDL_Cursor *gpDefaultCursor = NULL;
    228 #ifdef VBOXSDL_WITH_X11
    229 static Cursor      gpDefaultOrigX11Cursor;
    230 #endif
    231 static SDL_Cursor *gpCustomCursor = 0;
    232224static SDL_Cursor *gpOffCursor = NULL;
    233225static SDL_TimerID gSdlResizeTimer = 0;
    234226static SDL_TimerID gSdlQuitTimer = 0;
    235 
    236 #if defined(VBOXSDL_WITH_X11) && !defined(VBOX_WITH_SDL2)
    237 static SDL_SysWMinfo gSdlInfo;
    238 #endif
    239227
    240228static RTSEMEVENT g_EventSemSDLEvents;
     
    499487#else
    500488                bool fCanShow = false;
    501 
    502 # ifdef VBOX_WITH_SDL2
    503489                Uint32 winId = 0;
    504 
    505490                VBoxSDLFB *fb = getFbFromWinId(winId);
    506 
    507491                SDL_SysWMinfo info;
    508492                SDL_VERSION(&info.version);
    509493                if (SDL_GetWindowWMInfo(fb->getWindow(), &info))
    510494                    fCanShow = true;
    511 # else
    512                 SDL_SysWMinfo info;
    513                 SDL_VERSION(&info.version);
    514                 if (!SDL_GetWMInfo(&info))
    515                     fCanShow = false;
    516                 else
    517                     fCanShow = true;
    518 # endif /* VBOX_WITH_SDL2 */
    519 
    520495                if (fCanShow)
    521496                    pCSWEv->AddApproval(NULL);
     
    537512                SDL_SysWMinfo info;
    538513                SDL_VERSION(&info.version);
    539 # ifdef VBOX_WITH_SDL2
    540514                VBoxSDLFB *fb = getFbFromWinId(winId);
    541515                if (SDL_GetWindowWMInfo(fb->getWindow(), &info))
    542 # else
    543                 if (SDL_GetWMInfo(&info))
    544 # endif /* VBOX_WITH_SDL2 */
    545516                {
    546517# if defined(VBOXSDL_WITH_X11)
    547 #  ifdef VBOX_WITH_SDL2
    548518                    pSWEv->COMSETTER(WinId)((LONG64)info.info.x11.window);
    549 #  else
    550                     pSWEv->COMSETTER(WinId)((LONG64)info.info.x11.wmwindow);
    551 #  endif
    552519# elif defined(RT_OS_WINDOWS)
    553 #  ifdef VBOX_WITH_SDL2
    554520                    pSWEv->COMSETTER(WinId)((intptr_t)info.info.win.window);
    555 #  else
    556                     pSWEv->COMSETTER(WinId)((intptr_t)info.window);
    557 #  endif /* VBOX_WITH_SDL2 */
    558521# else /* !RT_OS_WINDOWS */
    559522                    AssertFailed();
     
    19651928    /* memorize the default cursor */
    19661929    gpDefaultCursor = SDL_GetCursor();
    1967 
    1968 #if !defined(VBOX_WITH_SDL2)
    1969 # if defined(VBOXSDL_WITH_X11)
    1970     /* Get Window Manager info. We only need the X11 display. */
    1971     SDL_VERSION(&gSdlInfo.version);
    1972     if (!SDL_GetWMInfo(&gSdlInfo))
    1973         RTPrintf("Error: could not get SDL Window Manager info -- no Xcursor support!\n");
    1974     else
    1975         gfXCursorEnabled = TRUE;
    1976 
    1977 #  if !defined(VBOX_WITHOUT_XCURSOR)
    1978     /* SDL uses its own (plain) default cursor. Use the left arrow cursor instead which might look
    1979      * much better if a mouse cursor theme is installed. */
    1980     if (gfXCursorEnabled)
    1981     {
    1982         gpDefaultOrigX11Cursor = *(Cursor*)gpDefaultCursor->wm_cursor;
    1983         *(Cursor*)gpDefaultCursor->wm_cursor = XCreateFontCursor(gSdlInfo.info.x11.display, XC_left_ptr);
    1984         SDL_SetCursor(gpDefaultCursor);
    1985     }
    1986 #  endif
    1987     /* Initialise the keyboard */
    1988     X11DRV_InitKeyboard(gSdlInfo.info.x11.display, NULL, NULL, NULL, NULL);
    1989 # endif /* VBOXSDL_WITH_X11 */
    1990 
    1991     /* create a fake empty cursor */
    1992     {
    1993         uint8_t cursorData[1] = {0};
    1994         gpCustomCursor = SDL_CreateCursor(cursorData, cursorData, 8, 1, 0, 0);
    1995         gpCustomOrigWMcursor = gpCustomCursor->wm_cursor;
    1996         gpCustomCursor->wm_cursor = NULL;
    1997     }
    1998 #endif /* !VBOX_WITH_SDL2 */
    1999 
    20001930    /*
    20011931     * Register our user signal handler.
     
    22382168    UpdateTitlebar(TITLEBAR_NORMAL);
    22392169
    2240 #ifdef VBOX_WITH_SDL2
    2241     /* Key repeats are enabled by default on SDL2. */
    2242 #else
    2243     /*
    2244      * Enable keyboard repeats
    2245      */
    2246     SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
    2247 #endif
    2248 
    22492170    /*
    22502171     * Create PID file.
     
    22792200             * The screen needs to be repainted.
    22802201             */
    2281 #ifdef VBOX_WITH_SDL2
    22822202            case SDL_WINDOWEVENT:
    22832203            {
     
    23192239                        break;
    23202240                }
    2321             }
    2322 #else
    2323             case SDL_VIDEOEXPOSE:
    2324             {
    2325                 gpFramebuffer[0]->repaint();
    23262241                break;
    23272242            }
    2328 #endif
    23292243
    23302244            /*
     
    23342248            case SDL_KEYUP:
    23352249            {
    2336 #ifdef VBOX_WITH_SDL2
    23372250                SDL_Keycode ksym = event.key.keysym.sym;
    2338 #else
    2339                 SDLKey ksym = event.key.keysym.sym;
    2340 #endif
    23412251                switch (enmHKeyState)
    23422252                {
     
    24802390                {
    24812391                    VBoxSDLFB *fb;
    2482 #ifdef VBOX_WITH_SDL2
    24832392                    fb = getFbFromWinId(event.motion.windowID);
    2484 #else
    2485                     fb = gpFramebuffer[0];
    2486 #endif
    24872393                    AssertPtrBreak(fb);
    24882394                    SendMouseEvent(fb, 0, 0, 0);
     
    25092415                else if (gfGrabbed || UseAbsoluteMouse())
    25102416                {
    2511 #ifdef VBOX_WITH_SDL2
    25122417                    int dz = 0; /** @todo Implement mouse wheel support with SDL2 (event SDL_MOUSEWHEEL). */
    2513 #else
    2514                     int dz = bev->button == SDL_BUTTON_WHEELUP
    2515                                          ? -1
    2516                                          : bev->button == SDL_BUTTON_WHEELDOWN
    2517                                                        ? +1
    2518                                                        :  0;
    2519 #endif
    25202418                    /* end host key combination (CTRL+MouseButton) */
    25212419                    switch (enmHKeyState)
     
    25432441
    25442442                    VBoxSDLFB *fb;
    2545 #ifdef VBOX_WITH_SDL2
    25462443                    fb = getFbFromWinId(event.button.windowID);
    2547 #else
    2548                     fb = gpFramebuffer[0];
    2549 #endif
    25502444                    AssertPtrBreak(fb);
    25512445                    SendMouseEvent(fb, dz, event.type == SDL_MOUSEBUTTONDOWN, bev->button);
     
    25542448            }
    25552449
    2556 #ifndef 0
     2450#if 0
    25572451            /*
    25582452             * The window has gained or lost focus.
     
    30872981
    30882982#ifdef VBOXSDL_WITH_X11
    3089 # ifdef VBOX_WITH_SDL2
    3090 
    30912983    switch (ev->keysym.sym)
    30922984    {
     
    32103102                                    return 0;
    32113103    }
    3212 # else
    3213     keycode = X11DRV_KeyEvent(gSdlInfo.info.x11.display, keycode);
    3214 # endif
    32153104#elif defined(RT_OS_DARWIN)
    32163105    /* This is derived partially from SDL_QuartzKeys.h and partially from testing. */
     
    34213310static void ProcessKey(SDL_KeyboardEvent *ev)
    34223311{
    3423 #if (defined(DEBUG) || defined(VBOX_WITH_STATISTICS)) && !defined(VBOX_WITH_SDL2)
     3312#if 0 //(defined(DEBUG) || defined(VBOX_WITH_STATISTICS)) && !defined(VBOX_WITH_SDL2)
    34243313    if (gpMachineDebugger && ev->type == SDL_KEYDOWN)
    34253314    {
     
    36533542    if (!gfGuestNeedsHostCursor && gfRelativeMouseGuest)
    36543543        SDL_ShowCursor(SDL_DISABLE);
    3655 #ifdef VBOX_WITH_SDL2
    36563544    SDL_SetRelativeMouseMode(SDL_TRUE);
    3657 #else
    3658     SDL_WM_GrabInput(SDL_GRAB_ON);
    3659     // dummy read to avoid moving the mouse
    3660     SDL_GetRelativeMouseState(NULL, NULL);
    3661 #endif
    36623545    gfGrabbed = TRUE;
    36633546    UpdateTitlebar(TITLEBAR_NORMAL);
     
    36693552static void InputGrabEnd(void)
    36703553{
    3671 #ifdef VBOX_WITH_SDL2
    36723554    SDL_SetRelativeMouseMode(SDL_FALSE);
    3673 #else
    3674     SDL_WM_GrabInput(SDL_GRAB_OFF);
    3675 #endif
    36763555    if (!gfGuestNeedsHostCursor && gfRelativeMouseGuest)
    36773556        SDL_ShowCursor(SDL_ENABLE);
     
    36933572    bool abs;
    36943573
    3695 #ifdef VBOX_WITH_SDL2
    36963574    if (!fb)
    36973575    {
     
    37003578        return;
    37013579    }
    3702 #else
    3703     AssertRelease(fb != NULL);
    3704 #endif
    37053580
    37063581    /*
     
    41374012    setUITitle(szTitle);
    41384013#else
    4139 # ifdef VBOX_WITH_SDL2
    41404014    for (unsigned i = 0; i < gcMonitors; i++)
    41414015        gpFramebuffer[i]->setWindowTitle(szTitle);
    4142 # else
    4143     SDL_WM_SetCaption(szTitle, VBOX_PRODUCT);
    4144 # endif
    41454016#endif
    41464017}
     
    47344605        int rc = SDL_PushEvent(event);
    47354606        RTSemEventSignal(g_EventSemSDLEvents);
    4736 #ifdef VBOX_WITH_SDL2
    47374607        if (rc == 1)
    4738 #else
    4739         if (rc == 0)
    4740 #endif
    47414608            return 0;
    47424609        Log(("PushSDLEventForSure: waiting for 2ms (rc = %d)\n", rc));
     
    47564623{
    47574624    int rc = SDL_PushEvent(event);
    4758 #ifdef VBOX_WITH_SDL2
    47594625    bool fSuccess = (rc == 1);
    4760 #else
    4761     bool fSuccess = (rc == 0);
    4762 #endif
    47634626
    47644627    RTSemEventSignal(g_EventSemSDLEvents);
     
    48274690}
    48284691
    4829 #ifdef VBOX_WITH_SDL2
    48304692static VBoxSDLFB *getFbFromWinId(Uint32 id)
    48314693{
     
    48364698    return NULL;
    48374699}
    4838 #endif
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