xbattmon

simple battery monitor for X
git clone git://git.2f30.org/xbattmon
Log | Files | Refs | README | LICENSE

commit c1e73f5e48e1cd2451dcd20dd5891c4af1c0e978
parent 37a230997161b33f7fdd583b9b8c28afa539802c
Author: Quentin Rameau <quinq@fifth.space>
Date:   Wed, 12 Sep 2018 23:23:32 +0200

Do not draw the bar twice when transparency mode is set

Diffstat:
Mxbattmon.c | 28++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/xbattmon.c b/xbattmon.c @@ -209,20 +209,6 @@ redraw(void) left = cmap[COLOR_BAT_DRAINED]; } - if (placement == BOTTOM || placement == TOP) { - XMoveResizeWindow(dpy, winbar, barx, bary, barwidth, thickness); - XSetForeground(dpy, gcbar, done); - XFillRectangle(dpy, winbar, gcbar, 0, 0, pos, thickness); - XSetForeground(dpy, gcbar, left); - XFillRectangle(dpy, winbar, gcbar, pos, 0, barwidth, thickness); - } else { - XMoveResizeWindow(dpy, winbar, barx, bary, thickness, barheight); - XSetForeground(dpy, gcbar, done); - XFillRectangle(dpy, winbar, gcbar, 0, barheight - pos, thickness, barheight); - XSetForeground(dpy, gcbar, left); - XFillRectangle(dpy, winbar, gcbar, 0, 0, thickness, barheight - pos); - } - if (transparent) { if (!blink) XMapWindow(dpy, winbar); @@ -236,6 +222,20 @@ redraw(void) XMoveResizeWindow(dpy, winbar, barx, bary + (barheight - pos), thickness, pos); XFillRectangle(dpy, winbar, gcbar, 0, 0, thickness, barheight); } + } else { + if (placement == BOTTOM || placement == TOP) { + XMoveResizeWindow(dpy, winbar, barx, bary, barwidth, thickness); + XSetForeground(dpy, gcbar, done); + XFillRectangle(dpy, winbar, gcbar, 0, 0, pos, thickness); + XSetForeground(dpy, gcbar, left); + XFillRectangle(dpy, winbar, gcbar, pos, 0, barwidth, thickness); + } else { + XMoveResizeWindow(dpy, winbar, barx, bary, thickness, barheight); + XSetForeground(dpy, gcbar, done); + XFillRectangle(dpy, winbar, gcbar, 0, barheight - pos, thickness, barheight); + XSetForeground(dpy, gcbar, left); + XFillRectangle(dpy, winbar, gcbar, 0, 0, thickness, barheight - pos); + } } XFlush(dpy);