infobar: Fix infobar toggle position.

This commit is contained in:
Martin Duquesnoy 2008-12-07 16:43:08 +01:00
parent ddc2ea5254
commit 96445baac5
4 changed files with 28 additions and 22 deletions

View File

@ -488,8 +488,8 @@ client_moveresize(Client *c, XRectangle geo, bool r)
&& geo.y < sgeo[i].y - INFOBARH - TBARH + sgeo[i].height + INFOBARH)
c->screen = i;
frame_moveresize(c, geo);
XMoveResizeWindow(dpy, c->win, BORDH, BORDH + TBARH, geo.width, geo.height);
frame_moveresize(c, c->geo);
XMoveResizeWindow(dpy, c->win, BORDH, BORDH + TBARH, c->geo.width, c->geo.height);
XSync(dpy, False);
}

View File

@ -187,14 +187,22 @@ infobar_destroy(void)
void
uicb_infobar_togglepos(uicb_t cmd)
{
XRectangle sg = sgeo[screen_get_sel()];
screen_get_sel();
conf.bartop = !conf.bartop;
infobar[selscreen].geo.y = (conf.bartop)
? sg.y - TBARH
: (sg.y - INFOBARH - TBARH) + sg.height + TBARH;
barwin_move(infobar[selscreen].bar, sg.x - BORDH, infobar[selscreen].geo.y);
if(conf.bartop)
{
sgeo[selscreen].y = INFOBARH + TBARH;
infobar[selscreen].geo.y = 0;
}
else
{
sgeo[selscreen].y = TBARH;
infobar[selscreen].geo.y = sgeo[selscreen].height + TBARH;
}
barwin_move(infobar[selscreen].bar, sgeo[selscreen].x - BORDH, infobar[selscreen].geo.y);
infobar_draw(selscreen);
arrange();

View File

@ -43,7 +43,7 @@ mouse_move(Client *c)
int mx = 0, my = 0, dint;
uint duint;
Window dw;
XRectangle geo;
XRectangle geo = c->geo;
XEvent ev;
if(c->max || c->tile || c->lmax)
@ -57,7 +57,7 @@ mouse_move(Client *c)
for(;;)
{
XMaskEvent(dpy, ButtonMask | MouseMask | ExposureMask | SubstructureRedirectMask, &ev);
XMaskEvent(dpy, MouseMask | ExposureMask | SubstructureRedirectMask, &ev);
if(ev.type == ButtonRelease)
{
@ -66,13 +66,12 @@ mouse_move(Client *c)
}
else if(ev.type == MotionNotify)
{
XSync(dpy, False);
geo.width = c->geo.width;
geo.height = c->geo.height;
geo.x = (ocx + (ev.xmotion.x - mx));
geo.y = (ocy + (ev.xmotion.y - my));
client_moveresize(c, geo, True);
XSync(dpy, False);
}
else if(ev.type == Expose)
expose(&ev.xexpose);
@ -89,7 +88,7 @@ mouse_resize(Client *c)
{
int ocx = c->geo.x;
int ocy = c->geo.y;
XRectangle geo;
XRectangle geo = c->geo;
XEvent ev;
if(c->max || c->lmax || c->tile)
@ -114,13 +113,12 @@ mouse_resize(Client *c)
}
else if(ev.type == MotionNotify)
{
XSync(dpy, False);
geo.x = c->geo.x; geo.y = c->geo.y;
geo.width = ((ev.xmotion.x - ocx < 1) ? 1 : ev.xmotion.x - ocx);
geo.height = ((ev.xmotion.y - ocy < 1) ? 1 : ev.xmotion.y - ocy);
client_moveresize(c, geo, True);
XSync(dpy, False);
}
else if(ev.type == Expose)
expose(&ev.xexpose);

View File

@ -105,7 +105,7 @@ void infobar_draw(int sc);
void infobar_draw_layout(int sc);
void infobar_draw_taglist(int sc);
void infobar_destroy(void);
void uicb_infobar_togglepos(uicb_t cmd);
void uicb_infobar_togglepos(uicb_t);
/* client.c */
void client_attach(Client *c);
@ -130,7 +130,7 @@ void client_raise(Client *c);
void client_unhide(Client *c);
void client_unmanage(Client *c);
void client_unmap(Client *c);
void uicb_client_raise(uicb_t cmd);
void uicb_client_raise(uicb_t);
void uicb_client_prev(uicb_t);
void uicb_client_next(uicb_t);
void uicb_client_kill(uicb_t);
@ -162,8 +162,8 @@ void getevent(XEvent ev);
void mouse_move(Client *c);
void mouse_resize(Client *c);
void mouse_grabbuttons(Client *c, Bool focused);
void uicb_mouse_move(uicb_t cmd);
void uicb_mouse_resize(uicb_t cmd);
void uicb_mouse_move(uicb_t);
void uicb_mouse_resize(uicb_t);
/* util.c */
ulong color_enlight(ulong col);
@ -201,7 +201,7 @@ Client *nexttiled(Client *c);
/* }}} */
void uicb_tile_switch(uicb_t);
void uicb_togglemax(uicb_t);
void uicb_togglefree(uicb_t cmd);
void uicb_togglefree(uicb_t);
void uicb_layout_prev(uicb_t);
void uicb_layout_next(uicb_t);
void uicb_set_mwfact(uicb_t);
@ -224,7 +224,7 @@ void mainloop(void);
void scan(void);
void handle_signal(int signum);
void uicb_quit(uicb_t);
void uicb_reload(uicb_t cmd);
void uicb_reload(uicb_t);
/* Variables */