Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> --- v3: - add default value for subpixel_orientation; - don't take font_cs inside update_font_options(). dlls/gdi32/font.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 3ff6c6ef3f6..91703a85cb6 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -42,6 +42,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(font); static HKEY wine_fonts_key; static HKEY wine_fonts_cache_key; +static HKEY volatile_parameters_key; +static HANDLE volatile_parameters_changed_event; struct font_physdev { @@ -98,6 +100,8 @@ static struct font_gamma_ramp font_gamma_ramp; static void add_face_to_cache( struct gdi_font_face *face ); static void remove_face_from_cache( struct gdi_font_face *face ); +static void update_font_options(void); + static inline WCHAR facename_tolower( WCHAR c ) { if (c >= 'A' && c <= 'Z') return c - 'A' + 'a'; @@ -3764,6 +3768,7 @@ static HFONT CDECL font_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags ) default: if (!(*aa_flags = font->aa_flags)) { + update_font_options(); *aa_flags = lf.lfQuality == CLEARTYPE_QUALITY || lf.lfQuality == CLEARTYPE_NATURAL_QUALITY ? subpixel_orientation : font_smoothing; } @@ -3944,6 +3949,9 @@ static void init_font_options(void) antialias_fakes = (wcschr(L"yYtT1", buffer[0]) != NULL); } + font_smoothing = GGO_BITMAP; + subpixel_orientation = WINE_GGO_HRGB_BITMAP; + if (!RegOpenKeyW( HKEY_CURRENT_USER, L"Control Panel\\Desktop", &key )) { RegOpenKeyW( HKEY_CURRENT_USER, L"Software\\Wine\\Temporary System Parameters\\Control Panel\\Desktop", @@ -3992,6 +4000,26 @@ static void init_font_options(void) TRACE("gamma %d\n", font_gamma_ramp.gamma); } +/* font_cs must be held by the caller */ +static void update_font_options(void) +{ + if (!volatile_parameters_key) + { + if (RegOpenKeyW( HKEY_CURRENT_USER, L"Software\\Wine\\Temporary System Parameters\\Control Panel\\Desktop", + &volatile_parameters_key )) + return; + volatile_parameters_changed_event = CreateEventA( NULL, FALSE, TRUE, NULL ); + } + if (WaitForSingleObject( volatile_parameters_changed_event, 0 ) == WAIT_OBJECT_0) + { + if (RegNotifyChangeKeyValue( volatile_parameters_key, FALSE, + REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_THREAD_AGNOSTIC, + volatile_parameters_changed_event, TRUE)) + ERR("Error registering registry change notification.\n"); + + init_font_options(); + } +} static void FONT_LogFontAToW( const LOGFONTA *fontA, LPLOGFONTW fontW ) { -- 2.28.0