From e666cfc6a57248c8db8e51100a9bb019f33a8284 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 20 Jun 2015 18:23:59 +0200 Subject: [PATCH] WPrefs: fix conversion of old "Apercu" setting to the new keywords As pointed by Josip, the code for loading the legacy setting keywords for the Minipreview feature did not update correctly the configuration: - if the setting used a size as a multiple of icon size, this was understood as the minimum pixel size, which meant here disabling the feature. The code is now consistent with what Window Maker does; - if the old keyword were found, they were loaded but not removed from the database after creating the new ones, which is a source of problem as Window Maker assumes that the presence of the legacy keywords means they are to be taken in consideration. Reported-by: Josip Deanovic Signed-off-by: Christophe CURIS --- WPrefs.app/Icons.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/WPrefs.app/Icons.c b/WPrefs.app/Icons.c index 4e7f2375..e68da569 100644 --- a/WPrefs.app/Icons.c +++ b/WPrefs.app/Icons.c @@ -60,6 +60,8 @@ typedef struct _Panel { CallbackRec callbacks; + Bool have_legacy_apercu; + WMWidget *parent; WMFrame *posF; @@ -206,6 +208,7 @@ static void showData(_Panel * panel) * new settings * This hack should be kept for at least 2 years, that means >= 2017. */ + panel->have_legacy_apercu = False; str = GetStringForKey("MiniwindowPreviewBalloons"); if (str != NULL) { /* New names found, use them in priority */ @@ -221,9 +224,18 @@ static void showData(_Panel * panel) /* No new names, try the legacy names */ b = GetBoolForKey("MiniwindowApercuBalloons"); if (b) { + panel->have_legacy_apercu = True; i = GetIntegerForKey("ApercuSize"); + + /* + * In the beginning, the option was coded as a multiple of the icon + * size; then it was converted to pixel size + */ + if (i < 24) + i *= GetIntegerForKey("IconSize"); + if (i <= minipreview_minimum_size) - i = minipreview_minimum_size; + i = minipreview_minimum_size + 1; /* +1 to not display as "off" */ } else { i = minipreview_minimum_size; } @@ -466,6 +478,10 @@ static void storeData(_Panel * panel) } SetIntegerForKey(i, "MiniPreviewSize"); } + if (panel->have_legacy_apercu) { + RemoveObjectForKey("MiniwindowApercuBalloons"); + RemoveObjectForKey("ApercuSize"); + } for (i = 0; i < wlengthof(icon_animation); i++) { if (WMGetButtonSelected(panel->animB[i])) {