diff --git a/shell/platform/windows/keyboard_manager.cc b/shell/platform/windows/keyboard_manager.cc index 21433aa0e56b3..20faa1e12421d 100644 --- a/shell/platform/windows/keyboard_manager.cc +++ b/shell/platform/windows/keyboard_manager.cc @@ -15,7 +15,7 @@ namespace { // The maximum number of pending events to keep before // emitting a warning on the console about unhandled events. -static constexpr int kMaxPendingEvents = 1000; +constexpr int kMaxPendingEvents = 1000; // Returns true if this key is an AltRight key down event. // @@ -40,7 +40,7 @@ static constexpr int kMaxPendingEvents = 1000; // would be rare, and a misrecognition would only cause a minor consequence // where the CtrlLeft is released early; the later, real, CtrlLeft up event will // be ignored. -static bool IsKeyDownAltRight(int action, int virtual_key, bool extended) { +bool IsKeyDownAltRight(int action, int virtual_key, bool extended) { return virtual_key == VK_RMENU && extended && (action == WM_KEYDOWN || action == WM_SYSKEYDOWN); } @@ -48,7 +48,7 @@ static bool IsKeyDownAltRight(int action, int virtual_key, bool extended) { // Returns true if this key is a key up event of AltRight. // // This is used to assist a corner case described in |IsKeyDownAltRight|. -static bool IsKeyUpAltRight(int action, int virtual_key, bool extended) { +bool IsKeyUpAltRight(int action, int virtual_key, bool extended) { return virtual_key == VK_RMENU && extended && (action == WM_KEYUP || action == WM_SYSKEYUP); } @@ -56,24 +56,22 @@ static bool IsKeyUpAltRight(int action, int virtual_key, bool extended) { // Returns true if this key is a key down event of CtrlLeft. // // This is used to assist a corner case described in |IsKeyDownAltRight|. -static bool IsKeyDownCtrlLeft(int action, int virtual_key) { +bool IsKeyDownCtrlLeft(int action, int virtual_key) { return virtual_key == VK_LCONTROL && (action == WM_KEYDOWN || action == WM_SYSKEYDOWN); } // Returns if a character sent by Win32 is a dead key. -static bool IsDeadKey(uint32_t ch) { +bool IsDeadKey(uint32_t ch) { return (ch & kDeadKeyCharMask) != 0; } -static char32_t CodePointFromSurrogatePair(wchar_t high, wchar_t low) { +char32_t CodePointFromSurrogatePair(wchar_t high, wchar_t low) { return 0x10000 + ((static_cast(high) & 0x000003FF) << 10) + (low & 0x3FF); } -static uint16_t ResolveKeyCode(uint16_t original, - bool extended, - uint8_t scancode) { +uint16_t ResolveKeyCode(uint16_t original, bool extended, uint8_t scancode) { switch (original) { case VK_SHIFT: case VK_LSHIFT: @@ -89,13 +87,13 @@ static uint16_t ResolveKeyCode(uint16_t original, } } -static bool IsPrintable(uint32_t c) { +bool IsPrintable(uint32_t c) { constexpr char32_t kMinPrintable = ' '; constexpr char32_t kDelete = 0x7F; return c >= kMinPrintable && c != kDelete; } -static bool IsSysAction(UINT action) { +bool IsSysAction(UINT action) { return action == WM_SYSKEYDOWN || action == WM_SYSKEYUP || action == WM_SYSCHAR || action == WM_SYSDEADCHAR; } diff --git a/shell/platform/windows/keyboard_manager.h b/shell/platform/windows/keyboard_manager.h index 9988fec4c40da..b88983e44bac1 100644 --- a/shell/platform/windows/keyboard_manager.h +++ b/shell/platform/windows/keyboard_manager.h @@ -26,14 +26,14 @@ namespace flutter { // system calls (to allow mocking) and where to send the results of key calls // and text calls to. // -// Typically, |KeyboardManager| is owned by a |Window|, which also implements -// the window delegate. The key calls and text calls are forwarded to those of -// |Window|'s, and consequently, those of |FlutterWindowsView|'s. +// Typically, |KeyboardManager| is owned by a |FlutterWindow|, which also +// implements the window delegate. The key calls and text calls are forwarded to +// the |FlutterWindow|, and consequently, to the |FlutterWindowsView|. // // ## Terminology // -// The keyboard system follows the following terminology instead of the -// inconsistent/incomplete one used by Win32: +// The keyboard system uses the following terminology (which is different +// than Win32's terminology): // // * Message: An invocation of |WndProc|, which consists of an // action, an lparam, and a wparam.