diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-02-28 19:44:21 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-02-28 19:44:21 +0100 |
commit | c2e0b7239522dc417b87f45cd133fb8f046dedfa (patch) | |
tree | db02a2cc715f9345c7dc587788b44678475fd723 /src | |
parent | 017b13bcf1cb0e3d82e684d7fcf01954613f8173 (diff) |
Respect --geometry in --bg-fill (closes #209)
Diffstat (limited to 'src')
-rw-r--r-- | src/wallpaper.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/wallpaper.c b/src/wallpaper.c index 758a81a..2d3d3bc 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -160,11 +160,36 @@ static void feh_wm_set_bg_filled(Pixmap pmap, Imlib_Image im, int use_filelist, render_x = ( cut_x ? ((img_w - render_w) >> 1) : 0); render_y = ( !cut_x ? ((img_h - render_h) >> 1) : 0); + if ((opt.geom_flags & XValue) && cut_x) { + if (opt.geom_flags & XNegative) { + render_x = img_w - render_w + opt.geom_x; + } else { + render_x = opt.geom_x; + } + if (render_x < 0) { + render_x = 0; + } else if (render_x + render_w > img_w) { + render_x = img_w - render_w; + } + } + else if ((opt.geom_flags & YValue) && !cut_x) { + if (opt.geom_flags & YNegative) { + render_y = img_h - render_h + opt.geom_y; + } else { + render_y = opt.geom_y; + } + if (render_y < 0) { + render_y = 0; + } else if (render_y + render_h > img_h) { + render_y = img_h - render_h; + } + } + gib_imlib_render_image_part_on_drawable_at_size(pmap, im, render_x, render_y, render_w, render_h, x, y, w, h, - 1, 0, !opt.force_aliasing); + 1, 1, !opt.force_aliasing); if (use_filelist) gib_imlib_free_image_and_decache(im); |