commit f098fde9cd435d8395f3fa560880ffc3a439554d
parent 518bb08dc084df9b99a03ad077a1cfe767dfe55e
Author: Dylan Araps <dylan.araps@gmail.com>
Date: Thu, 17 Oct 2019 15:41:19 +0300
sowm: Shorter math for window centering.
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sowm.c b/sowm.c
@@ -335,8 +335,7 @@ void win_center(const Arg arg) {
win_size(w, &(int){0}, &(int){0}, &ww, &wh);
- XMoveWindow(d, w, sw / 2 - ww / 2,
- sh / 2 - wh / 2);
+ XMoveWindow(d, w, (sw - ww) / 2, (sh - wh) / 2);
}
/*
@@ -532,7 +531,7 @@ void run(const Arg arg) {
int main(void) {
XEvent ev;
- if (!(d = XOpenDisplay(0))) return 0;
+ if (!(d = XOpenDisplay(0))) exit(1);
signal(SIGCHLD, SIG_IGN);
XSetErrorHandler(xerror);