зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1725454 - Implement ui.caretBlinkCount on Windows. r=mhowell
This makes Firefox respect the following Windows registry key: Computer\HKEY_CURRENT_USER\Control Panel\Desktop\CaretTimeout Which makes the caret stop blinking after a given timeout, and thus stop wasting CPU. Differential Revision: https://phabricator.services.mozilla.com/D122501
This commit is contained in:
Родитель
f090a6d7ac
Коммит
73568f7953
|
@ -4,6 +4,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsLookAndFeel.h"
|
||||
#include <stdint.h>
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
#include "nsStyleConsts.h"
|
||||
|
@ -369,6 +370,18 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
|||
case IntID::CaretBlinkTime:
|
||||
aResult = static_cast<int32_t>(::GetCaretBlinkTime());
|
||||
break;
|
||||
case IntID::CaretBlinkCount: {
|
||||
int32_t timeout = GetSystemParam(SPI_GETCARETTIMEOUT, 5000);
|
||||
auto blinkTime = ::GetCaretBlinkTime();
|
||||
if (timeout <= 0 || blinkTime <= 0) {
|
||||
aResult = -1;
|
||||
break;
|
||||
}
|
||||
// 2 * blinkTime because this integer is a full blink cycle.
|
||||
aResult = std::ceil(float(timeout) / (2.0f * float(blinkTime)));
|
||||
break;
|
||||
}
|
||||
|
||||
case IntID::CaretWidth:
|
||||
aResult = 1;
|
||||
break;
|
||||
|
|
|
@ -177,6 +177,9 @@
|
|||
#ifndef SPI_GETMENUSHOWDELAY
|
||||
# define SPI_GETMENUSHOWDELAY 106
|
||||
#endif // SPI_GETMENUSHOWDELAY
|
||||
#ifndef SPI_GETCARETTIMEOUT
|
||||
# define SPI_GETCARETTIMEOUT 0x2022
|
||||
#endif // SPI_GETCARETTIMEOUT
|
||||
#ifndef WS_EX_LAYOUTRTL
|
||||
# define WS_EX_LAYOUTRTL 0x00400000L // Right to left mirroring
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче