summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llwindow.cpp3
-rw-r--r--indra/llwindow/llwindow.h3
-rw-r--r--indra/llwindow/llwindowmacosx.cpp9
-rw-r--r--indra/llwindow/llwindowwin32.cpp3
4 files changed, 16 insertions, 2 deletions
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 66be3efffc..9e281dfc99 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -117,7 +117,8 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
mSwapMethod(SWAP_METHOD_UNDEFINED),
mHideCursorPermanent(FALSE),
mFlags(flags),
- mHighSurrogate(0)
+ mHighSurrogate(0),
+ mRefreshRate(0)
{
}
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index 862897a48c..b1408d894f 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -199,6 +199,8 @@ public:
// windows only DirectInput8 for joysticks
virtual void* getDirectInput8() { return NULL; };
virtual bool getInputDevices(U32 device_type_filter, void * devices_callback, void* userdata) { return false; };
+
+ virtual S32 getRefreshRate() { return mRefreshRate; }
protected:
LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags);
virtual ~LLWindow();
@@ -232,6 +234,7 @@ protected:
U16 mHighSurrogate;
S32 mMinWindowWidth;
S32 mMinWindowHeight;
+ S32 mRefreshRate;
// Handle a UTF-16 encoding unit received from keyboard.
// Converting the series of UTF-16 encoding units to UTF-32 data,
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index aae6539685..8bfaeca614 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -49,6 +49,8 @@ BOOL gHiDPISupport = TRUE;
const S32 BITS_PER_PIXEL = 32;
const S32 MAX_NUM_RESOLUTIONS = 32;
+const S32 DEFAULT_REFRESH_RATE = 60;
+
namespace
{
NSKeyEventRef mRawKeyEvent = NULL;
@@ -654,6 +656,13 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
}
}
+ mRefreshRate = CGDisplayModeGetRefreshRate(CGDisplayCopyDisplayMode(mDisplay));
+ if(mRefreshRate == 0)
+ {
+ //consider adding more appropriate fallback later
+ mRefreshRate = DEFAULT_REFRESH_RATE;
+ }
+
// Disable vertical sync for swap
toggleVSync(enable_vsync);
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 2bdfaf57de..651c04f32c 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -691,7 +691,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
{
current_refresh = 60;
}
-
+ mRefreshRate = current_refresh;
//-----------------------------------------------------------------------
// Drop resolution and go fullscreen
// use a display mode with our desired size and depth, with a refresh
@@ -1172,6 +1172,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO
{
current_refresh = 60;
}
+ mRefreshRate = current_refresh;
gGLManager.shutdownGL();
//destroy gl context