add simplewindow_move() function and use it for statusbar

This commit is contained in:
Julien Danjou 2008-01-23 16:10:05 +01:00
parent c1569eedf4
commit aeee10ea18
3 changed files with 14 additions and 8 deletions

View File

@ -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);

View File

@ -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

View File

@ -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