From 5da2fcb7e342a13cb0de16fc796569aa71054825 Mon Sep 17 00:00:00 2001 From: "Carlos R. Mafra" Date: Wed, 20 Aug 2014 15:54:24 +0100 Subject: [PATCH] apercu: Make preview size a configuration option Since the resolution of the Retina display tends to make everything small, the default apercu preview size (twice the icon size) couldn't be used to distinguish the window contents without tiring too much my eyes. Therefore, let's make the apercu size a configurable option. You can set it through the ApercuSize variable with $ wdwrite WindowMaker ApercuSize 4 in multiples of the icon size (in this case the apercu size will be four times the icon size). The default size remains 2 (twice the icon size). --- src/WindowMaker.h | 1 + src/balloon.c | 6 +++--- src/defaults.c | 2 ++ src/icon.c | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 5553d5b3..9689cba6 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -426,6 +426,7 @@ extern struct WPreferences { char cycle_ignore_minimized; /* Ignore minimized windows when cycling */ char strict_windoze_cycle; /* don't close switch panel when shift is released */ char panel_only_open; /* Only open the switch panel; don't switch */ + char apercu_size; /* Size of apercu preview as a multiple of icon size */ /* All delays here are in ms. 0 means instant auto-action. */ int clip_auto_raise_delay; /* Delay after which the clip will be raised when entered */ diff --git a/src/balloon.c b/src/balloon.c index 1fae947d..22b11604 100644 --- a/src/balloon.c +++ b/src/balloon.c @@ -423,8 +423,8 @@ static void showApercu(WScreen *scr, int x, int y, int height, int width, char * } XCopyArea(dpy, apercu, pixmap, scr->draw_gc, - 0, 0, (wPreferences.icon_size - 1 - APERCU_BORDER) * 2, - (wPreferences.icon_size - 1 - APERCU_BORDER) * 2, + 0, 0, (wPreferences.icon_size - 1 - APERCU_BORDER) * wPreferences.apercu_size, + (wPreferences.icon_size - 1 - APERCU_BORDER) * wPreferences.apercu_size, APERCU_BORDER, APERCU_BORDER + titleHeight); #ifdef SHAPED_BALLOON @@ -460,7 +460,7 @@ static void showBalloon(WScreen * scr) if (wPreferences.miniwin_apercu_balloon && scr->balloon->apercu != None) /* used to display either the apercu alone or the apercu and the title */ - showApercu(scr, x, y, (wPreferences.icon_size - 1) * 2, (wPreferences.icon_size - 1) * 2, + showApercu(scr, x, y, (wPreferences.icon_size - 1) * wPreferences.apercu_size, (wPreferences.icon_size - 1) * wPreferences.apercu_size, scr->balloon->text, scr->balloon->apercu); else showText(scr, x, y, scr->balloon->h, w, scr->balloon->text); diff --git a/src/defaults.c b/src/defaults.c index 155fe6f7..5e305c90 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -479,6 +479,8 @@ WDefaultEntry optionList[] = { &wPreferences.strict_windoze_cycle, getBool, NULL, NULL, NULL}, {"SwitchPanelOnlyOpen", "NO", NULL, &wPreferences.panel_only_open, getBool, NULL, NULL, NULL}, + {"ApercuSize", "2", NULL, + &wPreferences.apercu_size, getInt, NULL, NULL, NULL}, /* style options */ diff --git a/src/icon.c b/src/icon.c index e1321fae..d8265b52 100644 --- a/src/icon.c +++ b/src/icon.c @@ -593,8 +593,8 @@ void set_icon_apercu(WIcon *icon, RImage *image) RImage *scaled_apercu; WScreen *scr = icon->core->screen_ptr; - scaled_apercu = RSmoothScaleImage(image, (wPreferences.icon_size - 1 - APERCU_BORDER) * 2, - (wPreferences.icon_size - 1 - APERCU_BORDER) * 2 ); + scaled_apercu = RSmoothScaleImage(image, (wPreferences.icon_size - 1 - APERCU_BORDER) * wPreferences.apercu_size, + (wPreferences.icon_size - 1 - APERCU_BORDER) * wPreferences.apercu_size); if (RConvertImage(scr->rcontext, scaled_apercu, &tmp)) { if (icon->apercu != None) -- 2.11.4.GIT