catwm: Added center_window

This commit is contained in:
Dylan Araps committed 2019-10-11 20:06:19 +03:00
1 parent efc1327d0e
commit 277bd8d2de
2 files changed
+13 -23

No files matched your search

+10
View File
@@ -51,6 +51,7 @@ struct desktop{
static void add_window(Window w);
static void buttonpress(XEvent *e);
static void buttonrelease(XEvent *e);
static void center_window();
static void change_desktop(const Arg arg);
static void client_to_desktop(const Arg arg);
static void configurerequest(XEvent *e);
@@ -140,6 +141,15 @@ void change_desktop(const Arg arg) {
update_current();
}
void center_window() {
XGetWindowAttributes(dis, current->win, &attr);
int x = (sw / 2) - (attr.width / 2);
int y = (sh / 2) - (attr.height / 2);
XMoveWindow(dis, current->win, x, y);
}
void client_to_desktop(const Arg arg) {
client *tmp = current;
int tmp2 = curr_desk;