Keyboard cues are disabled by default on newer versions of Windows. Some win32 common controls, e.g., button doesn't draw a focus rect when SystemParametersInfoW(SPI_GETKEYBOARDCUES) reports FALSE.
Drawing a focus rect when the button is really small creates an effect that makes the button look corrupted. On Windows, the focus rect is not drawn when keyboard cues are disabled, which is the default.
Other controls also have this behavior, so they're included as well. There are some exceptions, for example, SysMonthCal32 always draws a focus rect, even when keyboard cues are disabled.
-- v2: https://gitlab.winehq.org/wine/wine/-/merge_requests/8763
From: Zhiyi Zhang zzhang@codeweavers.com
Keyboard cues are disabled by default on newer versions of Windows. Some win32 common controls, e.g., button doesn't draw a focus rect when SystemParametersInfoW(SPI_GETKEYBOARDCUES) reports FALSE. --- dlls/win32u/sysparams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 463b6b00f68..55234fea97f 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -5262,7 +5262,7 @@ static WCHAR desk_wallpaper_path[MAX_PATH]; static PATH_ENTRY( DESKPATTERN, DESKTOP_KEY, "Pattern", desk_pattern_path ); static PATH_ENTRY( DESKWALLPAPER, DESKTOP_KEY, "Wallpaper", desk_wallpaper_path );
-static BYTE user_prefs[8] = { 0x30, 0x00, 0x00, 0x80, 0x12, 0x00, 0x00, 0x00 }; +static BYTE user_prefs[8] = { 0x10, 0x00, 0x00, 0x80, 0x12, 0x00, 0x00, 0x00 }; static BINARY_ENTRY( USERPREFERENCESMASK, user_prefs, DESKTOP_KEY, "UserPreferencesMask" );
static FONT_ENTRY( CAPTIONLOGFONT, FW_BOLD, METRICS_KEY, "CaptionFont" );
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/user32/tests/sysparams.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c index 870b7f1cc93..1234a4766d0 100644 --- a/dlls/user32/tests/sysparams.c +++ b/dlls/user32/tests/sysparams.c @@ -2574,6 +2574,38 @@ static void test_WM_DISPLAYCHANGE(void) displaychange_test_active = FALSE; }
+static void test_SPI_SETKEYBOARDCUES( void ) /* 0x100B */ +{ + BOOL ret, values[2], result; + unsigned int i; + + trace( "testing SPI_{GET,SET}KEYBOARDCUES\n" ); + SetLastError( 0xdeadbeef ); + ret = SystemParametersInfoA( SPI_GETKEYBOARDCUES, 0, &result, 0 ); + if (!test_error_msg( ret, "SPI_{GET,SET}KEYBOARDCUES" )) + return; + ok( result == FALSE, "Expected keyboard cues disabled by default.\n" ); + values[1] = result; + values[0] = !result; + + for (i = 0; i < ARRAY_SIZE( values ); i++) + { + ret = SystemParametersInfoA( SPI_SETKEYBOARDCUES, 0, IntToPtr(values[i]), SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); + if (!test_error_msg( ret, "SPI_SETKEYBOARDCUES" )) + break; + ok( ret, "%d: ret=%d err=%ld\n", i, ret, GetLastError() ); + test_change_message( SPI_SETKEYBOARDCUES, 1 ); + + ret = SystemParametersInfoA( SPI_GETKEYBOARDCUES, 0, &result, 0 ); + ok( ret, "%d: ret=%d err=%ld\n", i, ret, GetLastError() ); + eq( result, values[i], "SPI_GETKEYBOARDCUES", "%d" ); + } + + ret = SystemParametersInfoA( SPI_SETKEYBOARDCUES, 0, IntToPtr(values[1]), SPIF_UPDATEINIFILE ); + ok( ret, "***warning*** failed to restore the original value: ret=%d err=%ld\n", ret, GetLastError()); + flush_change_messages(); +} + /* * Registry entries for the system parameters. * Names are created by 'SET' flags names. @@ -2625,6 +2657,7 @@ static DWORD WINAPI SysParamsThreadFunc( LPVOID lpParam ) test_SPI_SETMENUSHOWDELAY(); /* 107 */ test_SPI_SETWHEELSCROLLCHARS(); /* 108 */ test_SPI_SETWALLPAPER(); /* 115 */ + test_SPI_SETKEYBOARDCUES(); /* 0x100B */
SendMessageA( ghTestWnd, WM_DESTROY, 0, 0 );