From 70d45855848020998d5059149ced64c7b5ab5ef8 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 14 Sep 2017 00:48:59 +0200 Subject: [PATCH] Only query SPI_GETMOUSEVANISH system parameter only if the setting changes instead of every keypress --- indra/llwindow/llwindowwin32.cpp | 24 ++++++++++++++++++++++-- indra/llwindow/llwindowwin32.h | 3 +++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 3c8dddc363..1cd5c22a42 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -423,6 +423,13 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mKeyVirtualKey = 0; mhDC = NULL; mhRC = NULL; + + // Respect "Hide pointer while typing" Windows preference setting + if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0)) + { + mMouseVanish = TRUE; + } + // // Initialize the keyboard gKeyboard = new LLKeyboardWin32(); @@ -1687,8 +1694,7 @@ void LLWindowWin32::hideCursorUntilMouseMove() { // Respect "Hide pointer while typing" Windows preference setting //if (!mHideCursorPermanent) - BOOL mouse_vanish = FALSE; - if (!mHideCursorPermanent && (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mouse_vanish, 0) || mouse_vanish)) + if (!mHideCursorPermanent && mMouseVanish) // { hideCursor(); @@ -2706,6 +2712,20 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ return 0; break; + + // Respect "Hide pointer while typing" Windows preference setting + case WM_SETTINGCHANGE: + { + if (w_param == SPI_SETMOUSEVANISH) + { + if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &window_imp->mMouseVanish, 0)) + { + window_imp->mMouseVanish = TRUE; + } + } + } + break; + // } window_imp->mCallbacks->handlePauseWatchdog(window_imp); diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index a94f93a776..a2f88a37ad 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -224,6 +224,9 @@ protected: U32 mRawWParam; U32 mRawLParam; + // Respect "Hide pointer while typing" Windows preference setting + BOOL mMouseVanish; + friend class LLWindowManager; // Allow to query for window chrome sizes. public: