From 96445baac51cc3cf3b3bd37fa671abc1968e7d93 Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Sun, 7 Dec 2008 16:43:08 +0100 Subject: [PATCH] infobar: Fix infobar toggle position. --- src/client.c | 4 ++-- src/infobar.c | 18 +++++++++++++----- src/mouse.c | 16 +++++++--------- src/wmfs.h | 12 ++++++------ 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/client.c b/src/client.c index b749389..ceb713f 100644 --- a/src/client.c +++ b/src/client.c @@ -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); } diff --git a/src/infobar.c b/src/infobar.c index 9656daf..8642c0b 100644 --- a/src/infobar.c +++ b/src/infobar.c @@ -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(); diff --git a/src/mouse.c b/src/mouse.c index 02c64d6..e8ac0e9 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -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); diff --git a/src/wmfs.h b/src/wmfs.h index 52a5ffd..721d3f9 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -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 */