From ee6f919ea768fd720b16e1aad96145b6b633c0c4 Mon Sep 17 00:00:00 2001 From: Router Gray Date: Thu, 1 Aug 2019 08:48:15 -0500 Subject: [PATCH] [Linux] Properly detect full screen resolutions. Thx Laffalott reporting and Henri Beauchamp for code. --- indra/llwindow/llwindowsdl.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 2c02cd143..71c22e48a 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1383,18 +1383,25 @@ LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_reso { modes--; SDL_Rect *r = *modes; - int w = r->w; - int h = r->h; + S32 w = r->w; + S32 h = r->h; if ((w >= 800) && (h >= 600)) { // make sure we don't add the same resolution multiple times! - if ( (mNumSupportedResolutions == 0) || - ((mSupportedResolutions[mNumSupportedResolutions-1].mWidth != w) && - (mSupportedResolutions[mNumSupportedResolutions-1].mHeight != h)) ) + bool resolution_exists = false; + for (S32 i = 0; i < mNumSupportedResolutions; ++i) + { + if (mSupportedResolutions[i].mWidth == w && + mSupportedResolutions[i].mHeight == h) + { + resolution_exists = true; + break; + } + } + if (!resolution_exists) { mSupportedResolutions[mNumSupportedResolutions].mWidth = w; - mSupportedResolutions[mNumSupportedResolutions].mHeight = h; - mNumSupportedResolutions++; + mSupportedResolutions[mNumSupportedResolutions++].mHeight = h; } } }