diff options
Diffstat (limited to 'indra/llwindow')
-rw-r--r-- | indra/llwindow/llkeyboardwin32.cpp | 24 | ||||
-rw-r--r-- | indra/llwindow/llwindow.cpp | 3 | ||||
-rw-r--r-- | indra/llwindow/llwindow.h | 3 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 9 | ||||
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 3 |
5 files changed, 17 insertions, 25 deletions
diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index 2123ed3939..4c207faa81 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -247,31 +247,9 @@ void LLKeyboardWin32::scanKeyboard() { S32 key; MSG msg; - BOOL pending_key_events = PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD); + PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD); for (key = 0; key < KEY_COUNT; key++) { - // On Windows, verify key down state. JC - // RN: only do this if we don't have further key events in the queue - // as otherwise there might be key repeat events still waiting for this key we are now dumping - if (!pending_key_events && mKeyLevel[key]) - { - // *TODO: I KNOW there must be a better way of - // interrogating the key state than this, using async key - // state can cause ALL kinds of bugs - Doug - if ((key < KEY_BUTTON0) && ((key < '0') || (key > '9'))) - { - // ...under windows make sure the key actually still is down. - // ...translate back to windows key - U16 virtual_key = inverseTranslateExtendedKey(key); - // keydown in highest bit - if (!pending_key_events && !(GetAsyncKeyState(virtual_key) & 0x8000)) - { - //LL_INFOS() << "Key up event missed, resetting" << LL_ENDL; - mKeyLevel[key] = FALSE; - } - } - } - // Generate callback if any event has occurred on this key this frame. // Can't just test mKeyLevel, because this could be a slow frame and // key might have gone down then up. JC diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index f4678a70c5..c5725677b4 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 0edf39f6ef..4380bbdb73 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -196,6 +196,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(); @@ -229,6 +231,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 a0fc91399b..2c841d4703 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 6f67b131d1..2e560ddb0a 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -583,7 +583,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 @@ -1061,6 +1061,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO { current_refresh = 60; } + mRefreshRate = current_refresh; gGLManager.shutdownGL(); //destroy gl context |