summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Cornish <cornish_rob@hotmail.com>2012-10-17 19:24:31 +1100
committerRob Cornish <cornish_rob@hotmail.com>2012-10-17 19:24:31 +1100
commit16654adff8ebd584bc93c4798b4e997dd286976e (patch)
treee2f839f3107b40ecef4ea73f054f9c84df79d41c
parent4b64d3a827c38725d454964823abc69b8f77b7ef (diff)
Add --image-bg option for wallpaper border
Previously feh would set a black background around wallpaper images, with no option to change. This commit extends the functionality offered by the --image-bg option, which is available for regular image viewing, to centered and max'ed feh backgrounds. Essentially, this means a white border can now be chosen in addition to a black one.
-rw-r--r--src/wallpaper.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/wallpaper.c b/src/wallpaper.c
index 8a4cafb..df78303 100644
--- a/src/wallpaper.c
+++ b/src/wallpaper.c
@@ -257,6 +257,8 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
char *home;
char filbuf[4096];
char fehbg_xinerama[] = "--no-xinerama";
+ char *bgfill = NULL;
+ bgfill = opt.image_bg == IMAGE_BG_WHITE ? "--image-bg white" : "--image-bg black" ;
/* local display to set closedownmode on */
Display *disp2;
@@ -326,7 +328,10 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
D(("centering\n"));
pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth);
- gcval.foreground = BlackPixel(disp, DefaultScreen(disp));
+ if (opt.image_bg == IMAGE_BG_WHITE)
+ gcval.foreground = WhitePixel(disp, DefaultScreen(disp));
+ else
+ gcval.foreground = BlackPixel(disp, DefaultScreen(disp));
gc = XCreateGC(disp, root, GCForeground, &gcval);
XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height);
@@ -343,7 +348,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
XFreeGC(disp, gc);
- fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-center", filbuf, NULL);
+ fehbg = estrjoin(" ", "feh", fehbg_xinerama, bgfill, "--bg-center", filbuf, NULL);
} else if (filled == 1) {
@@ -366,6 +371,10 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
XGCValues gcval;
pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth);
+ if (opt.image_bg == IMAGE_BG_WHITE)
+ gcval.foreground = WhitePixel(disp, DefaultScreen(disp));
+ else
+ gcval.foreground = BlackPixel(disp, DefaultScreen(disp));
gcval.foreground = BlackPixel(disp, DefaultScreen(disp));
gc = XCreateGC(disp, root, GCForeground, &gcval);
XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height);
@@ -383,7 +392,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
XFreeGC(disp, gc);
- fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-max", filbuf, NULL);
+ fehbg = estrjoin(" ", "feh", fehbg_xinerama, bgfill, "--bg-max", filbuf, NULL);
} else {
if (use_filelist)