Skip to content

Commit

Permalink
Fix icewmbg centering when the XRender extension is used.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsbers committed Jan 22, 2024
1 parent 261d264 commit f861108
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/icewmbg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,15 @@ ref<YPixmap> Background::renderBackground(Image back, YColor color) {
}
ref<YPixmap> pixm = todraw->renderToPixmap(g.rdepth());
if (pixm != null) {
if (verbose) {
tlog(" ... @%d,%d %ux%u+%d+%d",
max(0, int(bw - width) / 2),
max(0, int(bh - height) / 2),
min(width, bw),
min(height, bh),
max(x, x + int(width - bw) / 2),
max(y, y + int(height - bh) / 2));
}
g.drawPixmap(pixm,
max(0, int(bw - width) / 2),
max(0, int(bh - height) / 2),
Expand Down
2 changes: 1 addition & 1 deletion src/icewmbg_prefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/* Synchronize with MAXWORKSPACES from wmmgr.h */
#define MAX_WORKSPACES 20
#define ICEBG_MAX_ARGS 5120
#define ICEBG_MAX_ARGS 5632

#include "yconfig.h"

Expand Down
4 changes: 2 additions & 2 deletions src/ypaint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ void Graphics::drawPixmap(ref<YPixmap> pix, int sx, int sy,
Picture source = pix->picture(), destin = picture();
if (source && destin) {
XRenderComposite(display(), PictOpOver, source, None, destin,
0, 0, 0, 0, dx - xOrigin, dy - yOrigin, w, h);
sx, sy, 0, 0, dx - xOrigin, dy - yOrigin, w, h);
return;
}

Expand Down Expand Up @@ -658,7 +658,7 @@ void Graphics::compositeImage(ref<YImage> img, int sx, int sy, unsigned w, unsig
XRenderComposite(display(),
img->hasAlpha() ? PictOpOver : PictOpSrc,
source, None, picture(),
0, 0, 0, 0, rx, ry,
sx, sy, 0, 0, rx, ry,
unsigned(rw), unsigned(rh));
return;
}
Expand Down

0 comments on commit f861108

Please sign in to comment.