Add IGraphics::GetScreenName

To get the screen name for each screen index.
This commit is contained in:
Robert Müller 2023-06-03 12:38:52 +02:00
parent 6bffc858fd
commit abfafa314a
5 changed files with 16 additions and 0 deletions

View file

@ -882,6 +882,12 @@ bool CGraphicsBackend_SDL_GL::GetDriverVersion(EGraphicsDriverAgeType DriverAgeT
return false;
}
const char *CGraphicsBackend_SDL_GL::GetScreenName(int Screen) const
{
const char *pName = SDL_GetDisplayName(Screen);
return pName == nullptr ? "unknown/error" : pName;
}
static void DisplayToVideoMode(CVideoMode *pVMode, SDL_DisplayMode *pMode, int HiDPIScale, int RefreshRate)
{
pVMode->m_CanvasWidth = pMode->w * HiDPIScale;

View file

@ -253,6 +253,7 @@ public:
const TTWGraphicsGPUList &GetGPUs() const override;
int GetNumScreens() const override { return m_NumScreens; }
const char *GetScreenName(int Screen) const override;
void GetVideoModes(CVideoMode *pModes, int MaxModes, int *pNumModes, int HiDPIScale, int MaxWindowWidth, int MaxWindowHeight, int ScreenID) override;
void GetCurrentVideoMode(CVideoMode &CurMode, int HiDPIScale, int MaxWindowWidth, int MaxWindowHeight, int ScreenID) override;

View file

@ -2939,6 +2939,11 @@ int CGraphics_Threaded::GetNumScreens() const
return m_pBackend->GetNumScreens();
}
const char *CGraphics_Threaded::GetScreenName(int Screen) const
{
return m_pBackend->GetScreenName(Screen);
}
void CGraphics_Threaded::Minimize()
{
m_pBackend->Minimize();

View file

@ -731,6 +731,7 @@ public:
virtual void GetCurrentVideoMode(CVideoMode &CurMode, int HiDPIScale, int MaxWindowWidth, int MaxWindowHeight, int Screen) = 0;
virtual int GetNumScreens() const = 0;
virtual const char *GetScreenName(int Screen) const = 0;
virtual void Minimize() = 0;
virtual void Maximize() = 0;
@ -1257,6 +1258,8 @@ public:
void IndicesNumRequiredNotify(unsigned int RequiredIndicesCount) override;
int GetNumScreens() const override;
const char *GetScreenName(int Screen) const override;
void Minimize() override;
void Maximize() override;
void WarnPngliteIncompatibleImages(bool Warn) override;

View file

@ -506,6 +506,7 @@ public:
virtual void Swap() = 0;
virtual int GetNumScreens() const = 0;
virtual const char *GetScreenName(int Screen) const = 0;
// synchronization
virtual void InsertSignal(class CSemaphore *pSemaphore) = 0;