Layout: Simplify mirror code.
This commit is contained in:
parent
582f1a9481
commit
02af9d6523
@ -435,8 +435,8 @@ client_manage(Window w, XWindowAttributes *wa)
|
||||
* screen, else place the client in it */
|
||||
if(screen_get_with_geo(mx, my) != selscreen)
|
||||
{
|
||||
mx += sgeo[selscreen].x - BORDH;
|
||||
my += sgeo[selscreen].y - TBARH - INFOBARH;
|
||||
mx += spgeo[selscreen].x;
|
||||
my += spgeo[selscreen].y;
|
||||
}
|
||||
}
|
||||
c->ogeo.x = c->geo.x = mx;
|
||||
|
||||
@ -114,10 +114,10 @@ buttonpress(XButtonEvent *ev)
|
||||
{
|
||||
if(conf.layout_system && (ev->button == Button1 || ev->button == Button3)) /* True -> menu */
|
||||
{
|
||||
y = (sgeo[selscreen].y - (BORDH + TBARH)) + infobar[selscreen].layout_button->geo.y;
|
||||
y = spgeo[selscreen].y + infobar[selscreen].layout_button->geo.y;
|
||||
x = infobar[selscreen].layout_button->geo.x + (sgeo[selscreen].x - BORDH);
|
||||
|
||||
if(infobar[selscreen].geo.y != sgeo[selscreen].y - (INFOBARH + TBARH))
|
||||
if(infobar[selscreen].geo.y != spgeo[selscreen].y)
|
||||
y = infobar[selscreen].geo.y - (INFOBARH * menulayout.nitem) - SHADH;
|
||||
|
||||
menu_draw(menulayout, x, y);
|
||||
|
||||
17
src/layout.c
17
src/layout.c
@ -543,20 +543,11 @@ mirror(int screen, Bool horizontal)
|
||||
/* Next y/x position */
|
||||
if(i >= nmaster - 1)
|
||||
{
|
||||
if(horizontal)
|
||||
{
|
||||
if(i == nmaster || i == nmaster - 1)
|
||||
cgeo.x = sg.x;
|
||||
else
|
||||
cgeo.x = nextg[isp].x + nextg[isp].width + BORDH * 2;
|
||||
}
|
||||
|
||||
if(i == nmaster || i == nmaster - 1)
|
||||
cgeo.x = (horizontal) ? sg.x : nextg[isp].y + nextg[isp].height + BORDH + TBARH;
|
||||
else
|
||||
{
|
||||
if(i == nmaster || i == nmaster - 1)
|
||||
cgeo.y = sg.y;
|
||||
else
|
||||
cgeo.y = nextg[isp].y + nextg[isp].height + BORDH + TBARH;
|
||||
}
|
||||
cgeo.y = (horizontal) ? nextg[isp].x + nextg[isp].width + BORDH * 2 : sg.y;
|
||||
}
|
||||
else if (i <= nmaster - 1)
|
||||
{
|
||||
|
||||
13
src/screen.c
13
src/screen.c
@ -104,20 +104,11 @@ int
|
||||
screen_get_with_geo(int x, int y)
|
||||
{
|
||||
int i, r = 0;
|
||||
int barpos = tags[selscreen][seltag[selscreen]].barpos;
|
||||
int yh;
|
||||
|
||||
for(i = 0; i < screen_count(); ++i)
|
||||
{
|
||||
if(barpos == IB_Hide || barpos == IB_Bottom)
|
||||
yh = (sgeo[i].y - TBARH);
|
||||
else
|
||||
yh = (sgeo[i].y - INFOBARH - TBARH);
|
||||
|
||||
if((x >= sgeo[i].x && x < sgeo[i].x + sgeo[i].width)
|
||||
&& y >= yh && y < yh + (sgeo[i].height + INFOBARH + TBARH))
|
||||
if((x >= spgeo[i].x && x < spgeo[i].x + spgeo[i].width)
|
||||
&& y >= spgeo[i].y && y < spgeo[i].y + spgeo[i].height)
|
||||
r = i;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user