1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-24 15:12:32 +01:00

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 <djosip+news@linuxpages.net>
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2015-06-20 18:23:59 +02:00
committed by Carlos R. Mafra
parent ae7e228aa4
commit e666cfc6a5

View File

@@ -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])) {