From aeee10ea184d676d47134cf58cbf113731d5f73b Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 23 Jan 2008 16:10:05 +0100 Subject: [PATCH] add simplewindow_move() function and use it for statusbar --- statusbar.c | 13 +++++-------- window.c | 8 ++++++++ window.h | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/statusbar.c b/statusbar.c index 99653027a..3f404fc27 100644 --- a/statusbar.c +++ b/statusbar.c @@ -51,20 +51,17 @@ statusbar_update_position(Statusbar *statusbar) switch(statusbar->position) { case Top: - XMoveWindow(globalconf.display, statusbar->sw->window, - area.x, area.y); + simplewindow_move(statusbar->sw, area.x, area.y); break; case Bottom: - XMoveWindow(globalconf.display, statusbar->sw->window, - area.x, area.height - statusbar->height); + simplewindow_move(statusbar->sw, area.x, area.height - statusbar->sw->geometry.height); break; case Left: - XMoveWindow(globalconf.display, statusbar->sw->window, - area.x - statusbar->height, (area.y + area.height) - statusbar->width); + simplewindow_move(statusbar->sw, area.x - statusbar->sw->geometry.height, + (area.y + area.height) - statusbar->sw->geometry.width); break; case Right: - XMoveWindow(globalconf.display, statusbar->sw->window, - area.x + area.width, area.y); + simplewindow_move(statusbar->sw, area.x + area.width, area.y); break; case Off: XUnmapWindow(globalconf.display, statusbar->sw->window); diff --git a/window.c b/window.c index 6750db887..254c4ab23 100644 --- a/window.c +++ b/window.c @@ -227,4 +227,12 @@ simplewindow_delete(SimpleWindow *sw) p_delete(&sw); } +int +simplewindow_move(SimpleWindow *sw, int x, int y) +{ + sw->geometry.x = x; + sw->geometry.y = y; + XMoveWindow(globalconf.display, sw->window, x, y); +} + // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/window.h b/window.h index db7c74d4b..1ddec427c 100644 --- a/window.h +++ b/window.h @@ -32,6 +32,7 @@ void window_setshape(int, Window); int window_settrans(Window, double); SimpleWindow * simplewindow_new(int, int, int, unsigned int, unsigned int, unsigned int); void simplewindow_delete(SimpleWindow *); +int simplewindow_move(SimpleWindow *, int, int); #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80