Screen/Infobar: Fix position with multi-head, add spgeo[] (screen pure geometry).
This commit is contained in:
parent
6eff09d790
commit
582f1a9481
@ -114,7 +114,7 @@ buttonpress(XButtonEvent *ev)
|
||||
{
|
||||
if(conf.layout_system && (ev->button == Button1 || ev->button == Button3)) /* True -> menu */
|
||||
{
|
||||
y = infobar[selscreen].layout_button->geo.y + INFOBARH;
|
||||
y = (sgeo[selscreen].y - (BORDH + TBARH)) + 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))
|
||||
|
||||
@ -50,18 +50,18 @@ infobar_init(void)
|
||||
switch(tags[sc][seltag[sc]].barpos)
|
||||
{
|
||||
case IB_Hide:
|
||||
sgeo[sc].y = TBARH;
|
||||
sgeo[selscreen].height += INFOBARH;
|
||||
infobar[selscreen].geo.y = -(infobar[selscreen].geo.height) * 2;
|
||||
sgeo[sc].y = spgeo[sc].y + TBARH;
|
||||
sgeo[sc].height += INFOBARH;
|
||||
infobar[sc].geo.y = -(infobar[sc].geo.height) * 2;
|
||||
break;
|
||||
case IB_Bottom:
|
||||
sgeo[selscreen].y = TBARH;
|
||||
infobar[selscreen].geo.y = sgeo[selscreen].height + TBARH;
|
||||
sgeo[sc].y = TBARH;
|
||||
infobar[sc].geo.y = spgeo[sc].y + sgeo[sc].height + TBARH;
|
||||
break;
|
||||
default:
|
||||
case IB_Top:
|
||||
sgeo[sc].y = INFOBARH + TBARH;
|
||||
infobar[selscreen].geo.y = sgeo[selscreen].y - (INFOBARH + TBARH);
|
||||
sgeo[sc].y = spgeo[sc].y + INFOBARH + TBARH;
|
||||
infobar[sc].geo.y = spgeo[sc].y;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -191,38 +191,26 @@ infobar_destroy(void)
|
||||
void
|
||||
infobar_set_position(int pos)
|
||||
{
|
||||
int th;
|
||||
|
||||
screen_get_sel();
|
||||
|
||||
if(XineramaIsActive(dpy))
|
||||
{
|
||||
int n = 0;
|
||||
XineramaScreenInfo *xsi = XineramaQueryScreens(dpy, &n);
|
||||
|
||||
th = xsi[selscreen].height;
|
||||
XFree(xsi);
|
||||
}
|
||||
else
|
||||
th = MAXH;
|
||||
|
||||
switch(pos)
|
||||
{
|
||||
case IB_Hide:
|
||||
sgeo[selscreen].y = TBARH;
|
||||
sgeo[selscreen].height = th - TBARH;
|
||||
sgeo[selscreen].y = spgeo[selscreen].y + TBARH;
|
||||
sgeo[selscreen].height = spgeo[selscreen].height - TBARH;
|
||||
infobar[selscreen].geo.y = -(infobar[selscreen].geo.height) * 2;
|
||||
break;
|
||||
case IB_Bottom:
|
||||
sgeo[selscreen].y = TBARH;
|
||||
sgeo[selscreen].height = th - INFOBARH - TBARH;
|
||||
infobar[selscreen].geo.y = sgeo[selscreen].height + TBARH;
|
||||
sgeo[selscreen].y = spgeo[selscreen].y + TBARH;
|
||||
sgeo[selscreen].height = spgeo[selscreen].height - INFOBARH - TBARH;
|
||||
infobar[selscreen].geo.y = spgeo[selscreen].y + sgeo[selscreen].height + TBARH;
|
||||
break;
|
||||
default:
|
||||
case IB_Top:
|
||||
sgeo[selscreen].y = INFOBARH + TBARH;
|
||||
sgeo[selscreen].height = th - INFOBARH - TBARH;
|
||||
infobar[selscreen].geo.y = sgeo[selscreen].y - (INFOBARH + TBARH);
|
||||
sgeo[selscreen].y = spgeo[selscreen].y + INFOBARH + TBARH;
|
||||
sgeo[selscreen].height = spgeo[selscreen].height - INFOBARH - TBARH;
|
||||
infobar[selscreen].geo.y = spgeo[selscreen].y;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -397,6 +397,7 @@ multi_tile(int screen, Position type)
|
||||
|
||||
/** Mirror layout function
|
||||
* \param screen Screen to execute this function
|
||||
* \param horizont To specify the mirror mode (vertical/horizontal)
|
||||
*/
|
||||
void
|
||||
mirror(int screen, Bool horizontal)
|
||||
|
||||
25
src/screen.c
25
src/screen.c
@ -70,6 +70,7 @@ screen_get_geo(int s)
|
||||
XineramaScreenInfo *xsi;
|
||||
|
||||
xsi = XineramaQueryScreens(dpy, &n);
|
||||
|
||||
geo.x = xsi[s].x_org + BORDH;
|
||||
if(barpos == IB_Hide || barpos == IB_Bottom)
|
||||
geo.y = TBARH;
|
||||
@ -168,13 +169,35 @@ screen_get_sel(void)
|
||||
void
|
||||
screen_init_geo(void)
|
||||
{
|
||||
int i;
|
||||
int i, n;
|
||||
XineramaScreenInfo *xsi;
|
||||
|
||||
sgeo = emalloc(screen_count(), sizeof(XRectangle));
|
||||
spgeo = emalloc(screen_count(), sizeof(XRectangle));
|
||||
|
||||
for(i = 0; i < screen_count(); ++i)
|
||||
sgeo[i] = screen_get_geo(i);
|
||||
|
||||
if(XineramaIsActive(dpy))
|
||||
{
|
||||
xsi = XineramaQueryScreens(dpy, &n);
|
||||
for(i = 0; i < n; ++i)
|
||||
{
|
||||
spgeo[i].x = xsi[i].x_org;
|
||||
spgeo[i].y = xsi[i].y_org;
|
||||
spgeo[i].width = xsi[i].width;
|
||||
spgeo[i].height = xsi[i].height;
|
||||
}
|
||||
XFree(xsi);
|
||||
}
|
||||
else
|
||||
{
|
||||
spgeo[0].x = 0;
|
||||
spgeo[0].y = 0;
|
||||
spgeo[0].width = MAXW;
|
||||
spgeo[0].height = MAXH;
|
||||
}
|
||||
|
||||
ewmh_set_desktop_geometry();
|
||||
ewmh_set_workarea();
|
||||
|
||||
|
||||
@ -106,6 +106,7 @@ quit(void)
|
||||
infobar_destroy();
|
||||
|
||||
IFREE(sgeo);
|
||||
IFREE(spgeo);
|
||||
IFREE(infobar);
|
||||
IFREE(keys);
|
||||
IFREE(func_list);
|
||||
|
||||
@ -311,6 +311,7 @@ Key *keys;
|
||||
Bool exiting;
|
||||
char statustext[1024];
|
||||
XRectangle *sgeo;
|
||||
XRectangle *spgeo;
|
||||
Cursor cursor[CurLast];
|
||||
|
||||
/* Fonts */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user